@powerhousedao/connect 1.0.0-sky.187 → 1.0.0-sky.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/assets/{app-D49Tx2Bq.js → app-CCIiKpPD.js} +16 -16
  2. package/dist/assets/app-CCIiKpPD.js.map +1 -0
  3. package/dist/assets/{app-loader-DxOroInF.js → app-loader-BfaRR27W.js} +3 -3
  4. package/dist/assets/{app-loader-DxOroInF.js.map → app-loader-BfaRR27W.js.map} +1 -1
  5. package/dist/assets/{browser-nO0Wirvo.js → browser-howbEbax.js} +4 -4
  6. package/dist/assets/{browser-nO0Wirvo.js.map → browser-howbEbax.js.map} +1 -1
  7. package/dist/assets/{ccip-Cbtp8sOL.js → ccip-uEKD33vK.js} +2 -2
  8. package/dist/assets/{ccip-Cbtp8sOL.js.map → ccip-uEKD33vK.js.map} +1 -1
  9. package/dist/assets/content-BjANsuRK.js +92 -0
  10. package/dist/assets/content-BjANsuRK.js.map +1 -0
  11. package/dist/assets/{editor-BPCS6Xtf.js → editor-7J_sXwzQ.js} +2 -2
  12. package/dist/assets/{editor-BPCS6Xtf.js.map → editor-7J_sXwzQ.js.map} +1 -1
  13. package/dist/assets/{editor-CAG-sw6z.js → editor-BvunQMK4.js} +2 -2
  14. package/dist/assets/{editor-CAG-sw6z.js.map → editor-BvunQMK4.js.map} +1 -1
  15. package/dist/assets/{editor-DyQFQRZr.js → editor-DU-lQtwD.js} +2 -2
  16. package/dist/assets/{editor-DyQFQRZr.js.map → editor-DU-lQtwD.js.map} +1 -1
  17. package/dist/assets/{editor-BZe-FWPe.js → editor-DsJju1GR.js} +2 -2
  18. package/dist/assets/{editor-BZe-FWPe.js.map → editor-DsJju1GR.js.map} +1 -1
  19. package/dist/assets/{editors-Cp2pNRWI.js → editors-C0ROY17i.js} +5 -5
  20. package/dist/assets/{editors-Cp2pNRWI.js.map → editors-C0ROY17i.js.map} +1 -1
  21. package/dist/assets/{index-KDfZFawS.js → index-Cgfr30M3.js} +2 -2
  22. package/dist/assets/{index-KDfZFawS.js.map → index-Cgfr30M3.js.map} +1 -1
  23. package/dist/assets/{index-CH59hMeC.js → index-h0as4MhA.js} +3 -3
  24. package/dist/assets/{index-CH59hMeC.js.map → index-h0as4MhA.js.map} +1 -1
  25. package/dist/assets/{main.B_r_OGSY.js → main.CnQ6SfYh.js} +2 -2
  26. package/dist/assets/{main.B_r_OGSY.js.map → main.CnQ6SfYh.js.map} +1 -1
  27. package/dist/assets/{root-Boy6zt_e.js → root-DY0hjxda.js} +2 -2
  28. package/dist/assets/{root-Boy6zt_e.js.map → root-DY0hjxda.js.map} +1 -1
  29. package/dist/assets/{router-D7_xmk-f.js → router-CUrO08Jn.js} +4 -4
  30. package/dist/assets/{router-D7_xmk-f.js.map → router-CUrO08Jn.js.map} +1 -1
  31. package/dist/assets/useUiNodes-Q80utwRx.js +107 -0
  32. package/dist/assets/{useUiNodes-BBBwb6rq.js.map → useUiNodes-Q80utwRx.js.map} +1 -1
  33. package/dist/index.html +3 -3
  34. package/dist/service-worker.js +1 -1
  35. package/dist/swEnv.js +2 -2
  36. package/dist/vite-envs.sh +5 -5
  37. package/package.json +2 -2
  38. package/dist/assets/app-D49Tx2Bq.js.map +0 -1
  39. package/dist/assets/content-3KD38dCg.js +0 -92
  40. package/dist/assets/content-3KD38dCg.js.map +0 -1
  41. package/dist/assets/useUiNodes-BBBwb6rq.js +0 -107
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-KDfZFawS.js","assets/main.B_r_OGSY.js","assets/app-loader-DxOroInF.js","assets/app-loader-DoI5W0wZ.css","assets/browser-nO0Wirvo.js","assets/router-D7_xmk-f.js"])))=>i.map(i=>d[i]);
2
- var zU=Object.defineProperty;var $E=t=>{throw TypeError(t)};var qU=(t,e,r)=>e in t?zU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var UE=(t,e,r)=>qU(t,typeof e!="symbol"?e+"":e,r),Yy=(t,e,r)=>e.has(t)||$E("Cannot "+r);var Ir=(t,e,r)=>(Yy(t,e,"read from private field"),r?r.call(t):e.get(t)),Ja=(t,e,r)=>e.has(t)?$E("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),md=(t,e,r,n)=>(Yy(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ma=(t,e,r)=>(Yy(t,e,"access private method"),r);import{_ as _f}from"./main.B_r_OGSY.js";import{jsx as et,jsxs as Yr,Fragment as wI}from"react/jsx-runtime";import{AddLocalDriveModal as VU,AddRemoteDriveModal as ZU,ConnectConfirmationModal as HU,ReadRequiredModal as _I,FILE as Ob,LOCAL as WU,ERROR as YU,CreateDocumentModal as JU,Modal as KU,Icon as bp,Combobox as Md,Button as qc,FormInput as zE,ConnectDeleteDriveModal as GU,ConnectDeleteItemModal as XU,DriveSettingsModal as QU,SettingsModal as ez,DocumentSelectSettingsRow as tz,ClearStorageSettingsRow as rz,DependencyVersions as nz,ConnectUpgradeDriveModal as iz,CookieBanner as az,WagmiContext as sz,UiNodesContextProvider as oz,ToastContainer as uz}from"@powerhousedao/design-system";import*as mt from"react";import Us,{createElement as ef,isValidElement as Wm,cloneElement as cz,Children as lz,createContext as R_,useContext as Ph,useState as ii,useRef as Ym,useEffect as vi,useReducer as dz,useDebugValue as fz,useCallback as Cr,useMemo as ko,Suspense as hz}from"react";import{g as xI,a as F_,c as Rs,s as wp,p as pz}from"./app-loader-DxOroInF.js";function mz(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Mb(){return Mb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Mb.apply(null,arguments)}var ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function NIe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var gz={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const yz=Bh(gz);var vz=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function qE(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(yz[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(vz),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var bz=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,wz=/^\s*$/,_z=Object.create(null);function EI(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(EI,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var xz={parse:function(t,e){e||(e={}),e.components||(e.components=_z);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(bz,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),h=c+u.length,p=t.charAt(h);if(f){var m=qE(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=qE(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!p||p==="<"||r.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&p!=="<"&&p)){l=a===-1?n:i[a].children;var y=t.indexOf("<",h),g=t.slice(h,y===-1?void 0:y);wz.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+EI("",r)},"")}};function Tm(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const VE={};function Jm(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&VE[e[0]]||(typeof e[0]=="string"&&(VE[e[0]]=new Date),Tm(...e))}const SI=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function ZE(t,e,r){t.loadNamespaces(e,SI(t,r))}function HE(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,SI(t,n))}function Ez(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function Sz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Jm("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):Ez(t,e,r)}function Jy(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Ky(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?Vc(e):e}function Tz(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Wm(e))}function Vc(t){return Array.isArray(t)?t:[t]}function Dz(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function TI(t,e){if(!t)return"";let r="";const n=Vc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Wm(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=TI(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Tm("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Tm("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Tm("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function Az(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){Vc(y).forEach(v=>{typeof v!="string"&&(Jy(v)?c(Ky(v)):typeof v=="object"&&!Wm(v)&&Object.assign(u,v))})}c(t);const l=xz.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,v){const w=Ky(y),x=p(w,g.children,v);return Tz(w)&&x.length===0||y.props&&y.props.i18nIsDynamicList?w:x}function h(y,g,v,w,x){y.dummy?(y.children=g,v.push(cz(y,{key:w},x?void 0:g))):v.push(...lz.map([y],_=>{const A={..._.props};return delete A.i18nIsDynamicList,Us.createElement(_.type,Mb({},A,{key:w,ref:_.ref},x?{}:{children:g}))}))}function p(y,g,v){const w=Vc(y);return Vc(g).reduce((_,A,M)=>{const F=A.children&&A.children[0]&&A.children[0].content&&r.services.interpolator.interpolate(A.children[0].content,d,r.language);if(A.type==="tag"){let k=w[parseInt(A.name,10)];v.length===1&&!k&&(k=v[0][A.name]),k||(k={});const $=Object.keys(A.attrs).length!==0?Dz({props:A.attrs},k):k,T=Wm($),N=T&&Jy(A,!0)&&!A.voidElement,b=o&&typeof $=="object"&&$.dummy&&!T,E=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,A.name);if(typeof $=="string"){const D=r.services.interpolator.interpolate($,d,r.language);_.push(D)}else if(Jy($)||N){const D=f($,A,v);h($,D,_,M)}else if(b){const D=p(w,A.children,v);h($,D,_,M)}else if(Number.isNaN(parseFloat(A.name)))if(E){const D=f($,A,v);h($,D,_,M,A.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(A.name)>-1)if(A.voidElement)_.push(ef(A.name,{key:`${A.name}-${M}`}));else{const D=p(w,A.children,v);_.push(ef(A.name,{key:`${A.name}-${M}`},D))}else if(A.voidElement)_.push(`<${A.name} />`);else{const D=p(w,A.children,v);_.push(`<${A.name}>${D}</${A.name}>`)}else if(typeof $=="object"&&!T){const D=A.children[0]?F:null;D&&_.push(D)}else h($,F,_,M,A.children.length!==1||!F)}else if(A.type==="text"){const k=n.transWrapTextNodes,$=a?n.unescape(r.services.interpolator.interpolate(A.content,d,r.language)):r.services.interpolator.interpolate(A.content,d,r.language);k?_.push(ef(k,{key:`${A.name}-${M}`},$)):_.push($)}return _},[])}const m=p([{dummy:!0,children:t||[]}],l,Vc(t||[]));return Ky(m[0])}function Nz(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:h,...p}=t;const m=d||F_();if(!m)return Jm("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(N=>N);a&&(s.context=a);const g={...xI(),...m.options&&m.options.react};let v=l||y.ns||m.options&&m.options.defaultNS;v=typeof v=="string"?[v]:v||["translation"];const w=TI(e,g),x=u||w||g.transEmptyNodeValue||i,{hashTransKey:_}=g,A=i||(_?_(w||x):w||x);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const M=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...M,defaultValue:x,ns:v},k=A?y(A,F):x;c&&Object.keys(c).forEach(N=>{const b=c[N];if(typeof b.type=="function"||!b.props||!b.props.children||k.indexOf(`${N}/>`)<0&&k.indexOf(`${N} />`)<0)return;function E(){return Us.createElement(Us.Fragment,null,b)}c[N]=Us.createElement(E,null)});const $=Az(c||e,k,m,g,F,h),T=n!==void 0?n:g.defaultTransParent;return T?ef(T,p,$):$}const DI=R_();class Iz{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function AI(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:h,...p}=t;const{i18n:m,defaultNS:y}=Ph(DI)||{},g=d||m||F_(),v=f||g&&g.t.bind(g);return Nz({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||v&&v.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:h,...p})}const Cz=(t,e)=>{const r=Ym();return vi(()=>{r.current=t},[t,e]),r.current};function nc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=Ph(DI)||{},a=r||n||F_();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Iz),!a){Jm("You will need to pass in an i18next instance by using initReactI18next");const w=(_,A)=>typeof A=="string"?A:A&&typeof A=="object"&&typeof A.defaultValue=="string"?A.defaultValue:Array.isArray(_)?_[_.length-1]:_,x=[w,{},!1];return x.t=w,x.i18n={},x.ready=!1,x}a.options.react&&a.options.react.wait!==void 0&&Jm("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...xI(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(w=>Sz(w,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,h]=ii(d);let p=c.join();e.lng&&(p=`${e.lng}${p}`);const m=Cz(p),y=Ym(!0);vi(()=>{const{bindI18n:w,bindI18nStore:x}=s;y.current=!0,!l&&!o&&(e.lng?HE(a,e.lng,c,()=>{y.current&&h(d)}):ZE(a,c,()=>{y.current&&h(d)})),l&&m&&m!==p&&y.current&&h(d);function _(){y.current&&h(d)}return w&&a&&a.on(w,_),x&&a&&a.store.on(x,_),()=>{y.current=!1,w&&a&&w.split(" ").forEach(A=>a.off(A,_)),x&&a&&x.split(" ").forEach(A=>a.store.off(A,_))}},[a,p]);const g=Ym(!0);vi(()=>{y.current&&!g.current&&h(d),g.current=!1},[a,u]);const v=[f,a,l];if(v.t=f,v.i18n=a,v.ready=l,l||!l&&!o)return v;throw new Promise(w=>{e.lng?HE(a,e.lng,c,()=>w()):ZE(a,c,()=>w())})}let Oz=0;function $n(t,e){const r=`atom${++Oz}`,n={toString(){return r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Mz,n.write=kz),e&&(n.write=e),n}function Mz(t){return t(this)}function kz(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const WE=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,YE=t=>"init"in t,JE=t=>!!t.write,Km=new WeakMap,kb=t=>{var e;return Rb(t)&&!((e=Km.get(t))!=null&&e[1])},Rz=(t,e)=>{const r=Km.get(t);r&&(r[1]=!0,r[0].forEach(n=>n(e)))},Fz=t=>{if(Km.has(t))return;const e=[new Set,!1];Km.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Rb=t=>typeof(t==null?void 0:t.then)=="function",KE=t=>"v"in t||"e"in t,_p=t=>{if("e"in t)throw t.e;return t.v},NI=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},GE=(t,e,r,n,i)=>{var a;r.d.set(n,i.n),kb(r.v)&&NI(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&Pz(t,n,e)},gd=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),tf=(t,e,r)=>{t[e].add(r)},XE=(t,e,r)=>{t.D.has(e)||(t.D.set(e,new Set),tf(t,"M",()=>{var n;(n=r.m)==null||n.l.forEach(i=>tf(t,"M",i))}))},Pz=(t,e,r)=>{const n=t.D.get(e);n&&n.add(r)},Bz=(t,e)=>t.D.get(e),uu=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t.H.size||t.M.size||t.L.size;)t.D.clear(),t.H.forEach(n),t.H.clear(),t.M.forEach(n),t.M.clear(),t.L.forEach(n),t.L.clear();if(r)throw e},II=(...[t,e,r,n])=>{const i=(g,v,w)=>{const x="v"in v,_=v.v,A=kb(v.v)?v.v:null;if(Rb(w)){Fz(w);for(const M of v.d.keys())NI(g,w,t(M));v.v=w}else v.v=w;delete v.e,delete v.x,(!x||!Object.is(_,v.v))&&(++v.n,A&&Rz(A,w))},a=(g,v)=>{var w;const x=t(v);if(KE(x)&&(x.m&&!x.x||Array.from(x.d).every(([$,T])=>a(g,$).n===T)))return x;x.d.clear();let _=!0;const A=$=>{if(WE(v,$)){const N=t($);if(!KE(N))if(YE($))i($,N,$.init);else throw new Error("no atom init");return _p(N)}const T=a(g,$);try{return _p(T)}finally{if(_)GE(g,v,x,$,T);else{const N=gd();GE(N,v,x,$,T),d(N,v,x),uu(N)}}};let M,F;const k={get signal(){return M||(M=new AbortController),M.signal},get setSelf(){return!F&&JE(v)&&(F=(...$)=>{if(!_)return l(v,...$)}),F}};try{const $=e(v,A,k);if(i(v,x,$),Rb($)){(w=$.onCancel)==null||w.call($,()=>M==null?void 0:M.abort());const T=()=>{if(x.m){const N=gd();d(N,v,x),uu(N)}};$.then(T,T)}return x}catch($){return delete x.v,x.e=$,delete x.x,++x.n,x}finally{_=!1}},s=g=>_p(a(void 0,g)),o=(g,v,w)=>{var x,_;const A=new Map;for(const M of((x=w.m)==null?void 0:x.t)||[]){const F=t(M);F.m&&A.set(M,F)}for(const M of w.p)A.set(M,t(M));return(_=Bz(g,v))==null||_.forEach(M=>{A.set(M,t(M))}),A},u=(g,v,w)=>{const x=[],_=new Set,A=new Set,M=[[v,w]];for(;M.length>0;){const[F,k]=M[M.length-1];if(A.has(F)){M.pop();continue}if(_.has(F)){x.push([F,k,k.n]),A.add(F),k.x=!0,M.pop();continue}_.add(F);for(const[$,T]of o(g,F,k))F!==$&&!_.has($)&&M.push([$,T])}tf(g,"H",()=>{const F=new Set([v]);for(let k=x.length-1;k>=0;--k){const[$,T,N]=x[k];let b=!1;for(const E of T.d.keys())if(E!==$&&F.has(E)){b=!0;break}b&&(a(g,$),d(g,$,T),N!==T.n&&(XE(g,$,T),F.add($))),delete T.x}})},c=(g,v,...w)=>{let x=!0;const _=M=>_p(a(g,M)),A=(M,...F)=>{const k=t(M);try{if(WE(v,M)){if(!YE(M))throw new Error("atom not writable");const $=k.n,T=F[0];i(M,k,T),d(g,M,k),$!==k.n&&(XE(g,M,k),u(g,M,k));return}else return c(g,M,...F)}finally{x||uu(g)}};try{return r(v,_,A,...w)}finally{x=!1}},l=(g,...v)=>{const w=gd();try{return c(w,g,...v)}finally{uu(w)}},d=(g,v,w)=>{if(w.m&&!kb(w.v)){for(const x of w.d.keys())w.m.d.has(x)||(f(g,x,t(x)).t.add(v),w.m.d.add(x));for(const x of w.m.d||[])if(!w.d.has(x)){w.m.d.delete(x);const _=h(g,x,t(x));_==null||_.t.delete(v)}}},f=(g,v,w)=>{if(!w.m){a(g,v);for(const x of w.d.keys())f(g,x,t(x)).t.add(v);if(w.m={l:new Set,d:new Set(w.d.keys()),t:new Set},JE(v)){const x=w.m;let _;const A=(M,F)=>{let k=!0;_=(...$)=>{try{return c(M,v,...$)}finally{k||uu(M)}};try{return F()}finally{k=!1}};tf(g,"L",()=>{const M=A(g,()=>n(v,(...F)=>_(...F)));M&&(x.u=F=>A(F,M))})}}return w.m},h=(g,v,w)=>{if(w.m&&!w.m.l.size&&!Array.from(w.m.t).some(x=>{var _;return(_=t(x).m)==null?void 0:_.d.has(v)})){const x=w.m.u;x&&tf(g,"L",()=>x(g)),delete w.m;for(const _ of w.d.keys()){const A=h(g,_,t(_));A==null||A.t.delete(v)}return}return w.m};return{get:s,set:l,sub:(g,v)=>{const w=gd(),x=t(g),A=f(w,g,x).l;return A.add(v),uu(w),()=>{A.delete(v);const M=gd();h(M,g,x),uu(M)}},unstable_derive:g=>II(...g(t,e,r,n))}},P_=()=>{const t=new WeakMap;return II(n=>{let i=t.get(n);return i||(i={d:new Map,p:new Set,n:0},t.set(n,i)),i},(n,...i)=>n.read(...i),(n,...i)=>n.write(...i),(n,...i)=>{var a;return(a=n.onMount)==null?void 0:a.call(n,...i)})};let Gy;const Lz=()=>(Gy||(Gy=P_()),Gy),CI=R_(void 0),OI=t=>Ph(CI)||Lz(),jz=({children:t,store:e})=>{const r=Ym(void 0);return!e&&!r.current&&(r.current=P_()),ef(CI.Provider,{value:e||r.current},t)},MI=t=>typeof(t==null?void 0:t.then)=="function",$z=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Uz=Us.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:($z(t),t)}),Xy=new WeakMap,zz=t=>{let e=Xy.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{MI(c)?(Xy.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),Xy.set(t,e)),e};function Lh(t,e){const r=OI(),[[n,i,a],s]=dz(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),vi(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),fz(o),MI(o)){const c=zz(o);return Uz(c)}return o}function qz(t,e){const r=OI();return Cr((...i)=>r.set(t,...i),[r,t])}function La(t,e){return[Lh(t),qz(t)]}const Vz=Symbol("");function Zz(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const Hz=t=>typeof(t==null?void 0:t.then)=="function";function Wz(t=()=>{try{return window.localStorage}catch{return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=p=>{if(p=p||"",n!==p){try{i=JSON.parse(p,e==null?void 0:e.reviver)}catch{return c}n=p}return i},h=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return Hz(h)?h.then(f):f(h)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let h;try{h=JSON.parse(f||"")}catch{h=d}l(h)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const Yz=Wz();function kI(t,e,r=Yz,n){const i=$n(e);return i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},$n(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===Vz?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const QE=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),Jz=new WeakMap,Kz=(t,e,r)=>{const n=QE(()=>new WeakMap,Jz,e);return QE(t,n,r)},Gz=t=>t instanceof Promise,Xz=()=>{};function RI(t,e=Xz){return Kz(()=>{const r=new WeakMap,n=new WeakMap,i=$n(0),a=$n((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!Gz(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,$n(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}function IIe(t){const e=$n(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const kd=Rs.routerBasename,jh=(t,e,r,n)=>kI(`${kd}:${t}`,e,void 0),Qz=(t,e,r)=>kI(t,e,{getItem(n,i){const a=localStorage.getItem(`${kd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${kd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${kd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${kd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),eq="acceptedCookies",tq=jh(eq,{analytics:!1,marketing:!1,functional:!1}),B_=()=>La(tq),rq="display-cookie-banner",nq=jh(rq,!0),iq=()=>La(nq);function aq(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return et(VU,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const sq=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),oq=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),uq=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),cq=/[^\p{L}\d]+/giu,eS="$1\0$2",tS="";function FI(t){let e=t.trim();e=e.replace(sq,eS).replace(oq,eS),e=e.replace(cq,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function lq(t){const e=FI(t);for(let r=0;r<e.length;r++){const n=e[r],i=uq.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function PI(t,e){const[r,n,i]=pq(t,e),a=dq(e==null?void 0:e.locale),s=fq(e==null?void 0:e.locale),o=hq(a,s);return r+n.map(o).join("")+i}function dq(t){return e=>e.toLocaleLowerCase(t)}function fq(t){return e=>e.toLocaleUpperCase(t)}function hq(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function pq(t,e={}){const r=e.split??(e.separateNumbers?lq:FI),n=e.prefixCharacters??tS,i=e.suffixCharacters??tS;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Fr(t,e){if(!!!t)throw new Error(e)}function Pu(t){return typeof t=="object"&&t!==null}function Ca(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const mq=/\r\n|[\n\r]/g;function Fb(t,e){let r=0,n=1;for(const i of t.body.matchAll(mq)){if(typeof i.index=="number"||Ca(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function gq(t){return BI(t.source,Fb(t.source,t.start))}function BI(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Cgfr30M3.js","assets/main.CnQ6SfYh.js","assets/app-loader-BfaRR27W.js","assets/app-loader-DoI5W0wZ.css","assets/browser-howbEbax.js","assets/router-CUrO08Jn.js"])))=>i.map(i=>d[i]);
2
+ var zU=Object.defineProperty;var $E=t=>{throw TypeError(t)};var qU=(t,e,r)=>e in t?zU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var UE=(t,e,r)=>qU(t,typeof e!="symbol"?e+"":e,r),Yy=(t,e,r)=>e.has(t)||$E("Cannot "+r);var Ir=(t,e,r)=>(Yy(t,e,"read from private field"),r?r.call(t):e.get(t)),Ja=(t,e,r)=>e.has(t)?$E("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),md=(t,e,r,n)=>(Yy(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ma=(t,e,r)=>(Yy(t,e,"access private method"),r);import{_ as _f}from"./main.CnQ6SfYh.js";import{jsx as et,jsxs as Yr,Fragment as wI}from"react/jsx-runtime";import{AddLocalDriveModal as VU,AddRemoteDriveModal as ZU,ConnectConfirmationModal as HU,ReadRequiredModal as _I,FILE as Ob,LOCAL as WU,ERROR as YU,CreateDocumentModal as JU,Modal as KU,Icon as bp,Combobox as Md,Button as qc,FormInput as zE,ConnectDeleteDriveModal as GU,ConnectDeleteItemModal as XU,DriveSettingsModal as QU,SettingsModal as ez,DocumentSelectSettingsRow as tz,ClearStorageSettingsRow as rz,DependencyVersions as nz,ConnectUpgradeDriveModal as iz,CookieBanner as az,WagmiContext as sz,UiNodesContextProvider as oz,ToastContainer as uz}from"@powerhousedao/design-system";import*as mt from"react";import Us,{createElement as ef,isValidElement as Wm,cloneElement as cz,Children as lz,createContext as R_,useContext as Ph,useState as ii,useRef as Ym,useEffect as vi,useReducer as dz,useDebugValue as fz,useCallback as Cr,useMemo as ko,Suspense as hz}from"react";import{g as xI,a as F_,c as Rs,s as wp,p as pz}from"./app-loader-BfaRR27W.js";function mz(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Mb(){return Mb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Mb.apply(null,arguments)}var ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function NIe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var gz={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const yz=Bh(gz);var vz=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function qE(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(yz[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(vz),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var bz=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,wz=/^\s*$/,_z=Object.create(null);function EI(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(EI,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var xz={parse:function(t,e){e||(e={}),e.components||(e.components=_z);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(bz,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),h=c+u.length,p=t.charAt(h);if(f){var m=qE(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=qE(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!p||p==="<"||r.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&p!=="<"&&p)){l=a===-1?n:i[a].children;var y=t.indexOf("<",h),g=t.slice(h,y===-1?void 0:y);wz.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+EI("",r)},"")}};function Tm(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const VE={};function Jm(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&VE[e[0]]||(typeof e[0]=="string"&&(VE[e[0]]=new Date),Tm(...e))}const SI=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function ZE(t,e,r){t.loadNamespaces(e,SI(t,r))}function HE(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,SI(t,n))}function Ez(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function Sz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Jm("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):Ez(t,e,r)}function Jy(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Ky(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?Vc(e):e}function Tz(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Wm(e))}function Vc(t){return Array.isArray(t)?t:[t]}function Dz(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function TI(t,e){if(!t)return"";let r="";const n=Vc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Wm(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=TI(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Tm("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Tm("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Tm("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function Az(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){Vc(y).forEach(v=>{typeof v!="string"&&(Jy(v)?c(Ky(v)):typeof v=="object"&&!Wm(v)&&Object.assign(u,v))})}c(t);const l=xz.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,v){const w=Ky(y),x=p(w,g.children,v);return Tz(w)&&x.length===0||y.props&&y.props.i18nIsDynamicList?w:x}function h(y,g,v,w,x){y.dummy?(y.children=g,v.push(cz(y,{key:w},x?void 0:g))):v.push(...lz.map([y],_=>{const A={..._.props};return delete A.i18nIsDynamicList,Us.createElement(_.type,Mb({},A,{key:w,ref:_.ref},x?{}:{children:g}))}))}function p(y,g,v){const w=Vc(y);return Vc(g).reduce((_,A,M)=>{const F=A.children&&A.children[0]&&A.children[0].content&&r.services.interpolator.interpolate(A.children[0].content,d,r.language);if(A.type==="tag"){let k=w[parseInt(A.name,10)];v.length===1&&!k&&(k=v[0][A.name]),k||(k={});const $=Object.keys(A.attrs).length!==0?Dz({props:A.attrs},k):k,T=Wm($),N=T&&Jy(A,!0)&&!A.voidElement,b=o&&typeof $=="object"&&$.dummy&&!T,E=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,A.name);if(typeof $=="string"){const D=r.services.interpolator.interpolate($,d,r.language);_.push(D)}else if(Jy($)||N){const D=f($,A,v);h($,D,_,M)}else if(b){const D=p(w,A.children,v);h($,D,_,M)}else if(Number.isNaN(parseFloat(A.name)))if(E){const D=f($,A,v);h($,D,_,M,A.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(A.name)>-1)if(A.voidElement)_.push(ef(A.name,{key:`${A.name}-${M}`}));else{const D=p(w,A.children,v);_.push(ef(A.name,{key:`${A.name}-${M}`},D))}else if(A.voidElement)_.push(`<${A.name} />`);else{const D=p(w,A.children,v);_.push(`<${A.name}>${D}</${A.name}>`)}else if(typeof $=="object"&&!T){const D=A.children[0]?F:null;D&&_.push(D)}else h($,F,_,M,A.children.length!==1||!F)}else if(A.type==="text"){const k=n.transWrapTextNodes,$=a?n.unescape(r.services.interpolator.interpolate(A.content,d,r.language)):r.services.interpolator.interpolate(A.content,d,r.language);k?_.push(ef(k,{key:`${A.name}-${M}`},$)):_.push($)}return _},[])}const m=p([{dummy:!0,children:t||[]}],l,Vc(t||[]));return Ky(m[0])}function Nz(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:h,...p}=t;const m=d||F_();if(!m)return Jm("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(N=>N);a&&(s.context=a);const g={...xI(),...m.options&&m.options.react};let v=l||y.ns||m.options&&m.options.defaultNS;v=typeof v=="string"?[v]:v||["translation"];const w=TI(e,g),x=u||w||g.transEmptyNodeValue||i,{hashTransKey:_}=g,A=i||(_?_(w||x):w||x);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const M=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...M,defaultValue:x,ns:v},k=A?y(A,F):x;c&&Object.keys(c).forEach(N=>{const b=c[N];if(typeof b.type=="function"||!b.props||!b.props.children||k.indexOf(`${N}/>`)<0&&k.indexOf(`${N} />`)<0)return;function E(){return Us.createElement(Us.Fragment,null,b)}c[N]=Us.createElement(E,null)});const $=Az(c||e,k,m,g,F,h),T=n!==void 0?n:g.defaultTransParent;return T?ef(T,p,$):$}const DI=R_();class Iz{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function AI(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:h,...p}=t;const{i18n:m,defaultNS:y}=Ph(DI)||{},g=d||m||F_(),v=f||g&&g.t.bind(g);return Nz({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||v&&v.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:h,...p})}const Cz=(t,e)=>{const r=Ym();return vi(()=>{r.current=t},[t,e]),r.current};function nc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=Ph(DI)||{},a=r||n||F_();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Iz),!a){Jm("You will need to pass in an i18next instance by using initReactI18next");const w=(_,A)=>typeof A=="string"?A:A&&typeof A=="object"&&typeof A.defaultValue=="string"?A.defaultValue:Array.isArray(_)?_[_.length-1]:_,x=[w,{},!1];return x.t=w,x.i18n={},x.ready=!1,x}a.options.react&&a.options.react.wait!==void 0&&Jm("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...xI(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(w=>Sz(w,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,h]=ii(d);let p=c.join();e.lng&&(p=`${e.lng}${p}`);const m=Cz(p),y=Ym(!0);vi(()=>{const{bindI18n:w,bindI18nStore:x}=s;y.current=!0,!l&&!o&&(e.lng?HE(a,e.lng,c,()=>{y.current&&h(d)}):ZE(a,c,()=>{y.current&&h(d)})),l&&m&&m!==p&&y.current&&h(d);function _(){y.current&&h(d)}return w&&a&&a.on(w,_),x&&a&&a.store.on(x,_),()=>{y.current=!1,w&&a&&w.split(" ").forEach(A=>a.off(A,_)),x&&a&&x.split(" ").forEach(A=>a.store.off(A,_))}},[a,p]);const g=Ym(!0);vi(()=>{y.current&&!g.current&&h(d),g.current=!1},[a,u]);const v=[f,a,l];if(v.t=f,v.i18n=a,v.ready=l,l||!l&&!o)return v;throw new Promise(w=>{e.lng?HE(a,e.lng,c,()=>w()):ZE(a,c,()=>w())})}let Oz=0;function Kn(t,e){const r=`atom${++Oz}`,n={toString(){return r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Mz,n.write=kz),e&&(n.write=e),n}function Mz(t){return t(this)}function kz(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const WE=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,YE=t=>"init"in t,JE=t=>!!t.write,Km=new WeakMap,kb=t=>{var e;return Rb(t)&&!((e=Km.get(t))!=null&&e[1])},Rz=(t,e)=>{const r=Km.get(t);r&&(r[1]=!0,r[0].forEach(n=>n(e)))},Fz=t=>{if(Km.has(t))return;const e=[new Set,!1];Km.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Rb=t=>typeof(t==null?void 0:t.then)=="function",KE=t=>"v"in t||"e"in t,_p=t=>{if("e"in t)throw t.e;return t.v},NI=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},GE=(t,e,r,n,i)=>{var a;r.d.set(n,i.n),kb(r.v)&&NI(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&Pz(t,n,e)},gd=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),tf=(t,e,r)=>{t[e].add(r)},XE=(t,e,r)=>{t.D.has(e)||(t.D.set(e,new Set),tf(t,"M",()=>{var n;(n=r.m)==null||n.l.forEach(i=>tf(t,"M",i))}))},Pz=(t,e,r)=>{const n=t.D.get(e);n&&n.add(r)},Bz=(t,e)=>t.D.get(e),uu=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t.H.size||t.M.size||t.L.size;)t.D.clear(),t.H.forEach(n),t.H.clear(),t.M.forEach(n),t.M.clear(),t.L.forEach(n),t.L.clear();if(r)throw e},II=(...[t,e,r,n])=>{const i=(g,v,w)=>{const x="v"in v,_=v.v,A=kb(v.v)?v.v:null;if(Rb(w)){Fz(w);for(const M of v.d.keys())NI(g,w,t(M));v.v=w}else v.v=w;delete v.e,delete v.x,(!x||!Object.is(_,v.v))&&(++v.n,A&&Rz(A,w))},a=(g,v)=>{var w;const x=t(v);if(KE(x)&&(x.m&&!x.x||Array.from(x.d).every(([$,T])=>a(g,$).n===T)))return x;x.d.clear();let _=!0;const A=$=>{if(WE(v,$)){const N=t($);if(!KE(N))if(YE($))i($,N,$.init);else throw new Error("no atom init");return _p(N)}const T=a(g,$);try{return _p(T)}finally{if(_)GE(g,v,x,$,T);else{const N=gd();GE(N,v,x,$,T),d(N,v,x),uu(N)}}};let M,F;const k={get signal(){return M||(M=new AbortController),M.signal},get setSelf(){return!F&&JE(v)&&(F=(...$)=>{if(!_)return l(v,...$)}),F}};try{const $=e(v,A,k);if(i(v,x,$),Rb($)){(w=$.onCancel)==null||w.call($,()=>M==null?void 0:M.abort());const T=()=>{if(x.m){const N=gd();d(N,v,x),uu(N)}};$.then(T,T)}return x}catch($){return delete x.v,x.e=$,delete x.x,++x.n,x}finally{_=!1}},s=g=>_p(a(void 0,g)),o=(g,v,w)=>{var x,_;const A=new Map;for(const M of((x=w.m)==null?void 0:x.t)||[]){const F=t(M);F.m&&A.set(M,F)}for(const M of w.p)A.set(M,t(M));return(_=Bz(g,v))==null||_.forEach(M=>{A.set(M,t(M))}),A},u=(g,v,w)=>{const x=[],_=new Set,A=new Set,M=[[v,w]];for(;M.length>0;){const[F,k]=M[M.length-1];if(A.has(F)){M.pop();continue}if(_.has(F)){x.push([F,k,k.n]),A.add(F),k.x=!0,M.pop();continue}_.add(F);for(const[$,T]of o(g,F,k))F!==$&&!_.has($)&&M.push([$,T])}tf(g,"H",()=>{const F=new Set([v]);for(let k=x.length-1;k>=0;--k){const[$,T,N]=x[k];let b=!1;for(const E of T.d.keys())if(E!==$&&F.has(E)){b=!0;break}b&&(a(g,$),d(g,$,T),N!==T.n&&(XE(g,$,T),F.add($))),delete T.x}})},c=(g,v,...w)=>{let x=!0;const _=M=>_p(a(g,M)),A=(M,...F)=>{const k=t(M);try{if(WE(v,M)){if(!YE(M))throw new Error("atom not writable");const $=k.n,T=F[0];i(M,k,T),d(g,M,k),$!==k.n&&(XE(g,M,k),u(g,M,k));return}else return c(g,M,...F)}finally{x||uu(g)}};try{return r(v,_,A,...w)}finally{x=!1}},l=(g,...v)=>{const w=gd();try{return c(w,g,...v)}finally{uu(w)}},d=(g,v,w)=>{if(w.m&&!kb(w.v)){for(const x of w.d.keys())w.m.d.has(x)||(f(g,x,t(x)).t.add(v),w.m.d.add(x));for(const x of w.m.d||[])if(!w.d.has(x)){w.m.d.delete(x);const _=h(g,x,t(x));_==null||_.t.delete(v)}}},f=(g,v,w)=>{if(!w.m){a(g,v);for(const x of w.d.keys())f(g,x,t(x)).t.add(v);if(w.m={l:new Set,d:new Set(w.d.keys()),t:new Set},JE(v)){const x=w.m;let _;const A=(M,F)=>{let k=!0;_=(...$)=>{try{return c(M,v,...$)}finally{k||uu(M)}};try{return F()}finally{k=!1}};tf(g,"L",()=>{const M=A(g,()=>n(v,(...F)=>_(...F)));M&&(x.u=F=>A(F,M))})}}return w.m},h=(g,v,w)=>{if(w.m&&!w.m.l.size&&!Array.from(w.m.t).some(x=>{var _;return(_=t(x).m)==null?void 0:_.d.has(v)})){const x=w.m.u;x&&tf(g,"L",()=>x(g)),delete w.m;for(const _ of w.d.keys()){const A=h(g,_,t(_));A==null||A.t.delete(v)}return}return w.m};return{get:s,set:l,sub:(g,v)=>{const w=gd(),x=t(g),A=f(w,g,x).l;return A.add(v),uu(w),()=>{A.delete(v);const M=gd();h(M,g,x),uu(M)}},unstable_derive:g=>II(...g(t,e,r,n))}},P_=()=>{const t=new WeakMap;return II(n=>{let i=t.get(n);return i||(i={d:new Map,p:new Set,n:0},t.set(n,i)),i},(n,...i)=>n.read(...i),(n,...i)=>n.write(...i),(n,...i)=>{var a;return(a=n.onMount)==null?void 0:a.call(n,...i)})};let Gy;const Lz=()=>(Gy||(Gy=P_()),Gy),CI=R_(void 0),OI=t=>Ph(CI)||Lz(),jz=({children:t,store:e})=>{const r=Ym(void 0);return!e&&!r.current&&(r.current=P_()),ef(CI.Provider,{value:e||r.current},t)},MI=t=>typeof(t==null?void 0:t.then)=="function",$z=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Uz=Us.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:($z(t),t)}),Xy=new WeakMap,zz=t=>{let e=Xy.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{MI(c)?(Xy.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),Xy.set(t,e)),e};function Lh(t,e){const r=OI(),[[n,i,a],s]=dz(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),vi(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),fz(o),MI(o)){const c=zz(o);return Uz(c)}return o}function qz(t,e){const r=OI();return Cr((...i)=>r.set(t,...i),[r,t])}function La(t,e){return[Lh(t),qz(t)]}const Vz=Symbol("");function Zz(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const Hz=t=>typeof(t==null?void 0:t.then)=="function";function Wz(t=()=>{try{return window.localStorage}catch{return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=p=>{if(p=p||"",n!==p){try{i=JSON.parse(p,e==null?void 0:e.reviver)}catch{return c}n=p}return i},h=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return Hz(h)?h.then(f):f(h)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let h;try{h=JSON.parse(f||"")}catch{h=d}l(h)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const Yz=Wz();function kI(t,e,r=Yz,n){const i=Kn(e);return i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},Kn(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===Vz?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const QE=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),Jz=new WeakMap,Kz=(t,e,r)=>{const n=QE(()=>new WeakMap,Jz,e);return QE(t,n,r)},Gz=t=>t instanceof Promise,Xz=()=>{};function RI(t,e=Xz){return Kz(()=>{const r=new WeakMap,n=new WeakMap,i=Kn(0),a=Kn((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!Gz(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,Kn(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}const kd=Rs.routerBasename,jh=(t,e,r,n)=>kI(`${kd}:${t}`,e,void 0),Qz=(t,e,r)=>kI(t,e,{getItem(n,i){const a=localStorage.getItem(`${kd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${kd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${kd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${kd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),eq="acceptedCookies",tq=jh(eq,{analytics:!1,marketing:!1,functional:!1}),B_=()=>La(tq),rq="display-cookie-banner",nq=jh(rq,!0),iq=()=>La(nq);function aq(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return et(VU,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const sq=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),oq=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),uq=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),cq=/[^\p{L}\d]+/giu,eS="$1\0$2",tS="";function FI(t){let e=t.trim();e=e.replace(sq,eS).replace(oq,eS),e=e.replace(cq,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function lq(t){const e=FI(t);for(let r=0;r<e.length;r++){const n=e[r],i=uq.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function PI(t,e){const[r,n,i]=pq(t,e),a=dq(e==null?void 0:e.locale),s=fq(e==null?void 0:e.locale),o=hq(a,s);return r+n.map(o).join("")+i}function dq(t){return e=>e.toLocaleLowerCase(t)}function fq(t){return e=>e.toLocaleUpperCase(t)}function hq(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function pq(t,e={}){const r=e.split??(e.separateNumbers?lq:FI),n=e.prefixCharacters??tS,i=e.suffixCharacters??tS;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Fr(t,e){if(!!!t)throw new Error(e)}function Pu(t){return typeof t=="object"&&t!==null}function Ca(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const mq=/\r\n|[\n\r]/g;function Fb(t,e){let r=0,n=1;for(const i of t.body.matchAll(mq)){if(typeof i.index=="number"||Ca(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function gq(t){return BI(t.source,Fb(t.source,t.start))}function BI(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
3
3
  `,l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){const f=Math.floor(u/80),h=u%80,p=[];for(let m=0;m<d.length;m+=80)p.push(d.slice(m,m+80));return c+rS([[`${s} |`,p[0]],...p.slice(1,f+1).map(m=>["|",m]),["|","^".padStart(h)],["|",p[f+1]]])}return c+rS([[`${s-1} |`,l[i-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function rS(t){const e=t.filter(([n,i])=>i!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(r)+(i?" "+i:"")).join(`
4
4
  `)}function yq(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class He extends Error{constructor(e,...r){var n,i,a;const{nodes:s,source:o,positions:u,path:c,originalError:l,extensions:d}=yq(r);super(e),this.name="GraphQLError",this.path=c??void 0,this.originalError=l??void 0,this.nodes=nS(Array.isArray(s)?s:s?[s]:void 0);const f=nS((n=this.nodes)===null||n===void 0?void 0:n.map(p=>p.loc).filter(p=>p!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=u??(f==null?void 0:f.map(p=>p.start)),this.locations=u&&o?u.map(p=>Fb(o,p)):f==null?void 0:f.map(p=>Fb(p.source,p.start));const h=Pu(l==null?void 0:l.extensions)?l==null?void 0:l.extensions:void 0;this.extensions=(a=d??h)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,He):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=`
5
5
 
@@ -47,11 +47,11 @@ spurious results.`)}}return!1};class ZI{constructor(e,r="GraphQL request",n={lin
47
47
  `)),`
48
48
  }`)}function yr(t,e,r=""){return e!=null&&e!==""?t+e+r:""}function Dm(t){return yr(" ",t.replace(/\n/g,`
49
49
  `))}function uS(t){var e;return(e=t==null?void 0:t.some(r=>r.includes(`
50
- `)))!==null&&e!==void 0?e:!1}function Lb(t,e){switch(t.kind){case ye.NULL:return null;case ye.INT:return parseInt(t.value,10);case ye.FLOAT:return parseFloat(t.value);case ye.STRING:case ye.ENUM:case ye.BOOLEAN:return t.value;case ye.LIST:return t.values.map(r=>Lb(r,e));case ye.OBJECT:return j_(t.fields,r=>r.name.value,r=>Lb(r.value,e));case ye.VARIABLE:return e==null?void 0:e[t.name.value]}}function qa(t){if(t!=null||Fr(!1,"Must provide name."),typeof t=="string"||Fr(!1,"Expected name to be a string."),t.length===0)throw new He("Expected name to be a non-empty string.");for(let e=1;e<t.length;++e)if(!UI(t.charCodeAt(e)))throw new He(`Names must only contain [_a-zA-Z0-9] but "${t}" does not.`);if(!L_(t.charCodeAt(0)))throw new He(`Names must start with [_a-zA-Z] but "${t}" does not.`);return t}function Qq(t){if(t==="true"||t==="false"||t==="null")throw new He(`Enum values cannot be named: ${t}`);return qa(t)}function U_(t){return Hl(t)||gi(t)||Un(t)||Vs(t)||Zs(t)||Ui(t)||zi(t)||on(t)}function Hl(t){return vs(t,Hs)}function gi(t){return vs(t,sa)}function Un(t){return vs(t,jb)}function Vs(t){return vs(t,el)}function Zs(t){return vs(t,Sf)}function Ui(t){return vs(t,$b)}function zi(t){return vs(t,hi)}function on(t){return vs(t,dr)}function KI(t){return Hl(t)||Zs(t)||Ui(t)||GI(t)&&KI(t.ofType)}function fl(t){return Hl(t)||Zs(t)}function Ef(t){return gi(t)||Un(t)||Vs(t)}function Nu(t){return Un(t)||Vs(t)}class hi{constructor(e){U_(e)||Fr(!1,`Expected ${At(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class dr{constructor(e){eV(e)||Fr(!1,`Expected ${At(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function GI(t){return zi(t)||on(t)}function eV(t){return U_(t)&&!on(t)}function tV(t){if(t)return on(t)?t.ofType:t}function ju(t){if(t){let e=t;for(;GI(e);)e=e.ofType;return e}}function XI(t){return typeof t=="function"?t():t}function QI(t){return typeof t=="function"?t():t}class Hs{constructor(e){var r,n,i,a;const s=(r=e.parseValue)!==null&&r!==void 0?r:sS;this.name=qa(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=(n=e.serialize)!==null&&n!==void 0?n:sS,this.parseValue=s,this.parseLiteral=(i=e.parseLiteral)!==null&&i!==void 0?i:(o,u)=>s(Lb(o,u)),this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(a=e.extensionASTNodes)!==null&&a!==void 0?a:[],e.specifiedByURL==null||typeof e.specifiedByURL=="string"||Fr(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${At(e.specifiedByURL)}.`),e.serialize==null||typeof e.serialize=="function"||Fr(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&(typeof e.parseValue=="function"&&typeof e.parseLiteral=="function"||Fr(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class sa{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._fields=()=>t9(e),this._interfaces=()=>e9(e),e.isTypeOf==null||typeof e.isTypeOf=="function"||Fr(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${At(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:n9(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function e9(t){var e;const r=XI((e=t.interfaces)!==null&&e!==void 0?e:[]);return Array.isArray(r)||Fr(!1,`${t.name} interfaces must be an Array or a function which returns an Array.`),r}function t9(t){const e=QI(t.fields);return Qc(e)||Fr(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),Fs(e,(r,n)=>{var i;Qc(r)||Fr(!1,`${t.name}.${n} field config must be an object.`),r.resolve==null||typeof r.resolve=="function"||Fr(!1,`${t.name}.${n} field resolver must be a function if provided, but got: ${At(r.resolve)}.`);const a=(i=r.args)!==null&&i!==void 0?i:{};return Qc(a)||Fr(!1,`${t.name}.${n} args must be an object with argument names as keys.`),{name:qa(n),description:r.description,type:r.type,args:r9(a),resolve:r.resolve,subscribe:r.subscribe,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}})}function r9(t){return Object.entries(t).map(([e,r])=>({name:qa(e),description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}))}function Qc(t){return Pu(t)&&!Array.isArray(t)}function n9(t){return Fs(t,e=>({description:e.description,type:e.type,args:i9(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function i9(t){return j_(t,e=>e.name,e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function a9(t){return on(t.type)&&t.defaultValue===void 0}class jb{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._fields=t9.bind(void 0,e),this._interfaces=e9.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||Fr(!1,`${this.name} must provide "resolveType" as a function, but got: ${At(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:n9(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class el{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._types=rV.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||Fr(!1,`${this.name} must provide "resolveType" as a function, but got: ${At(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rV(t){const e=XI(t.types);return Array.isArray(e)||Fr(!1,`Must provide Array of types or a function which returns such an array for Union ${t.name}.`),e}class Sf{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._values=typeof e.values=="function"?e.values:cS(this.name,e.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=cS(this.name,this._values())),this._values}getValue(e){return this._nameLookup===null&&(this._nameLookup=Lu(this.getValues(),r=>r.name)),this._nameLookup[e]}serialize(e){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(n=>[n.value,n])));const r=this._valueLookup.get(e);if(r===void 0)throw new He(`Enum "${this.name}" cannot represent value: ${At(e)}`);return r.name}parseValue(e){if(typeof e!="string"){const n=At(e);throw new He(`Enum "${this.name}" cannot represent non-string value: ${n}.`+Sp(this,n))}const r=this.getValue(e);if(r==null)throw new He(`Value "${e}" does not exist in "${this.name}" enum.`+Sp(this,e));return r.value}parseLiteral(e,r){if(e.kind!==ye.ENUM){const i=Mn(e);throw new He(`Enum "${this.name}" cannot represent non-enum value: ${i}.`+Sp(this,i),{nodes:e})}const n=this.getValue(e.value);if(n==null){const i=Mn(e);throw new He(`Value "${i}" does not exist in "${this.name}" enum.`+Sp(this,i),{nodes:e})}return n.value}toConfig(){const e=j_(this.getValues(),r=>r.name,r=>({description:r.description,value:r.value,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Sp(t,e){const r=t.getValues().map(i=>i.name),n=ic(e,r);return Ro("the enum value",n)}function cS(t,e){return Qc(e)||Fr(!1,`${t} values must be an object with value names as keys.`),Object.entries(e).map(([r,n])=>(Qc(n)||Fr(!1,`${t}.${r} must refer to an object with a "value" key representing an internal value but got: ${At(n)}.`),{name:Qq(r),description:n.description,value:n.value!==void 0?n.value:r,deprecationReason:n.deprecationReason,extensions:da(n.extensions),astNode:n.astNode}))}class $b{constructor(e){var r,n;this.name=qa(e.name),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this.isOneOf=(n=e.isOneOf)!==null&&n!==void 0?n:!1,this._fields=nV.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const e=Fs(this.getFields(),r=>({description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function nV(t){const e=QI(t.fields);return Qc(e)||Fr(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),Fs(e,(r,n)=>(!("resolve"in r)||Fr(!1,`${t.name}.${n} field has a resolve property, but Input Types cannot define resolvers.`),{name:qa(n),description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}))}function iV(t){return on(t.type)&&t.defaultValue===void 0}function rf(t,e,r){return e===r?!0:on(r)?on(e)?rf(t,e.ofType,r.ofType):!1:on(e)?rf(t,e.ofType,r):zi(r)?zi(e)?rf(t,e.ofType,r.ofType):!1:zi(e)?!1:Nu(r)&&(Un(e)||gi(e))&&t.isSubType(r,e)}function lS(t,e,r){return e===r?!0:Nu(e)?Nu(r)?t.getPossibleTypes(e).some(n=>t.isSubType(r,n)):t.isSubType(e,r):Nu(r)?t.isSubType(r,e):!1}const e1=2147483647,t1=-2147483648,aV=new Hs({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(t){const e=$h(t);if(typeof e=="boolean")return e?1:0;let r=e;if(typeof e=="string"&&e!==""&&(r=Number(e)),typeof r!="number"||!Number.isInteger(r))throw new He(`Int cannot represent non-integer value: ${At(e)}`);if(r>e1||r<t1)throw new He("Int cannot represent non 32-bit signed integer value: "+At(e));return r},parseValue(t){if(typeof t!="number"||!Number.isInteger(t))throw new He(`Int cannot represent non-integer value: ${At(t)}`);if(t>e1||t<t1)throw new He(`Int cannot represent non 32-bit signed integer value: ${t}`);return t},parseLiteral(t){if(t.kind!==ye.INT)throw new He(`Int cannot represent non-integer value: ${Mn(t)}`,{nodes:t});const e=parseInt(t.value,10);if(e>e1||e<t1)throw new He(`Int cannot represent non 32-bit signed integer value: ${t.value}`,{nodes:t});return e}}),sV=new Hs({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(t){const e=$h(t);if(typeof e=="boolean")return e?1:0;let r=e;if(typeof e=="string"&&e!==""&&(r=Number(e)),typeof r!="number"||!Number.isFinite(r))throw new He(`Float cannot represent non numeric value: ${At(e)}`);return r},parseValue(t){if(typeof t!="number"||!Number.isFinite(t))throw new He(`Float cannot represent non numeric value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.FLOAT&&t.kind!==ye.INT)throw new He(`Float cannot represent non numeric value: ${Mn(t)}`,t);return parseFloat(t.value)}}),xn=new Hs({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(t){const e=$h(t);if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"&&Number.isFinite(e))return e.toString();throw new He(`String cannot represent value: ${At(t)}`)},parseValue(t){if(typeof t!="string")throw new He(`String cannot represent a non string value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.STRING)throw new He(`String cannot represent a non string value: ${Mn(t)}`,{nodes:t});return t.value}}),$i=new Hs({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(t){const e=$h(t);if(typeof e=="boolean")return e;if(Number.isFinite(e))return e!==0;throw new He(`Boolean cannot represent a non boolean value: ${At(e)}`)},parseValue(t){if(typeof t!="boolean")throw new He(`Boolean cannot represent a non boolean value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.BOOLEAN)throw new He(`Boolean cannot represent a non boolean value: ${Mn(t)}`,{nodes:t});return t.value}}),s9=new Hs({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(t){const e=$h(t);if(typeof e=="string")return e;if(Number.isInteger(e))return String(e);throw new He(`ID cannot represent value: ${At(t)}`)},parseValue(t){if(typeof t=="string")return t;if(typeof t=="number"&&Number.isInteger(t))return t.toString();throw new He(`ID cannot represent value: ${At(t)}`)},parseLiteral(t){if(t.kind!==ye.STRING&&t.kind!==ye.INT)throw new He("ID cannot represent a non-string and non-integer value: "+Mn(t),{nodes:t});return t.value}}),z_=Object.freeze([xn,aV,sV,$i,s9]);function oV(t){return z_.some(({name:e})=>t.name===e)}function $h(t){if(Pu(t)){if(typeof t.valueOf=="function"){const e=t.valueOf();if(!Pu(e))return e}if(typeof t.toJSON=="function")return t.toJSON()}return t}function uV(t){return vs(t,Fo)}class Fo{constructor(e){var r,n;this.name=qa(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=(r=e.isRepeatable)!==null&&r!==void 0?r:!1,this.extensions=da(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||Fr(!1,`@${e.name} locations must be an Array.`);const i=(n=e.args)!==null&&n!==void 0?n:{};Pu(i)&&!Array.isArray(i)||Fr(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=r9(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:i9(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const o9=new Fo({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[It.FIELD,It.FRAGMENT_SPREAD,It.INLINE_FRAGMENT],args:{if:{type:new dr($i),description:"Included when true."}}}),u9=new Fo({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[It.FIELD,It.FRAGMENT_SPREAD,It.INLINE_FRAGMENT],args:{if:{type:new dr($i),description:"Skipped when true."}}}),cV="No longer supported",c9=new Fo({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[It.FIELD_DEFINITION,It.ARGUMENT_DEFINITION,It.INPUT_FIELD_DEFINITION,It.ENUM_VALUE],args:{reason:{type:xn,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:cV}}}),l9=new Fo({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[It.SCALAR],args:{url:{type:new dr(xn),description:"The URL that specifies the behavior of this scalar."}}}),d9=new Fo({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[It.INPUT_OBJECT],args:{}}),Wl=Object.freeze([o9,u9,c9,l9,d9]);function lV(t){return typeof t=="object"&&typeof(t==null?void 0:t[Symbol.iterator])=="function"}function Pd(t,e){if(on(e)){const r=Pd(t,e.ofType);return(r==null?void 0:r.kind)===ye.NULL?null:r}if(t===null)return{kind:ye.NULL};if(t===void 0)return null;if(zi(e)){const r=e.ofType;if(lV(t)){const n=[];for(const i of t){const a=Pd(i,r);a!=null&&n.push(a)}return{kind:ye.LIST,values:n}}return Pd(t,r)}if(Ui(e)){if(!Pu(t))return null;const r=[];for(const n of Object.values(e.getFields())){const i=Pd(t[n.name],n.type);i&&r.push({kind:ye.OBJECT_FIELD,name:{kind:ye.NAME,value:n.name},value:i})}return{kind:ye.OBJECT,fields:r}}if(fl(e)){const r=e.serialize(t);if(r==null)return null;if(typeof r=="boolean")return{kind:ye.BOOLEAN,value:r};if(typeof r=="number"&&Number.isFinite(r)){const n=String(r);return dS.test(n)?{kind:ye.INT,value:n}:{kind:ye.FLOAT,value:n}}if(typeof r=="string")return Zs(e)?{kind:ye.ENUM,value:r}:e===s9&&dS.test(r)?{kind:ye.INT,value:r}:{kind:ye.STRING,value:r};throw new TypeError(`Cannot convert value to AST: ${At(r)}.`)}Ca(!1,"Unexpected input type: "+At(e))}const dS=/^-?(?:0|[1-9][0-9]*)$/,q_=new sa({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:xn,resolve:t=>t.description},types:{description:"A list of all types supported by this server.",type:new dr(new hi(new dr(Aa))),resolve(t){return Object.values(t.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new dr(Aa),resolve:t=>t.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Aa,resolve:t=>t.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Aa,resolve:t=>t.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new dr(new hi(new dr(f9))),resolve:t=>t.getDirectives()}})}),f9=new sa({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
50
+ `)))!==null&&e!==void 0?e:!1}function Lb(t,e){switch(t.kind){case ye.NULL:return null;case ye.INT:return parseInt(t.value,10);case ye.FLOAT:return parseFloat(t.value);case ye.STRING:case ye.ENUM:case ye.BOOLEAN:return t.value;case ye.LIST:return t.values.map(r=>Lb(r,e));case ye.OBJECT:return j_(t.fields,r=>r.name.value,r=>Lb(r.value,e));case ye.VARIABLE:return e==null?void 0:e[t.name.value]}}function qa(t){if(t!=null||Fr(!1,"Must provide name."),typeof t=="string"||Fr(!1,"Expected name to be a string."),t.length===0)throw new He("Expected name to be a non-empty string.");for(let e=1;e<t.length;++e)if(!UI(t.charCodeAt(e)))throw new He(`Names must only contain [_a-zA-Z0-9] but "${t}" does not.`);if(!L_(t.charCodeAt(0)))throw new He(`Names must start with [_a-zA-Z] but "${t}" does not.`);return t}function Qq(t){if(t==="true"||t==="false"||t==="null")throw new He(`Enum values cannot be named: ${t}`);return qa(t)}function U_(t){return Hl(t)||gi(t)||$n(t)||Vs(t)||Zs(t)||Ui(t)||zi(t)||on(t)}function Hl(t){return vs(t,Hs)}function gi(t){return vs(t,sa)}function $n(t){return vs(t,jb)}function Vs(t){return vs(t,el)}function Zs(t){return vs(t,Sf)}function Ui(t){return vs(t,$b)}function zi(t){return vs(t,hi)}function on(t){return vs(t,dr)}function KI(t){return Hl(t)||Zs(t)||Ui(t)||GI(t)&&KI(t.ofType)}function fl(t){return Hl(t)||Zs(t)}function Ef(t){return gi(t)||$n(t)||Vs(t)}function Nu(t){return $n(t)||Vs(t)}class hi{constructor(e){U_(e)||Fr(!1,`Expected ${At(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class dr{constructor(e){eV(e)||Fr(!1,`Expected ${At(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function GI(t){return zi(t)||on(t)}function eV(t){return U_(t)&&!on(t)}function tV(t){if(t)return on(t)?t.ofType:t}function ju(t){if(t){let e=t;for(;GI(e);)e=e.ofType;return e}}function XI(t){return typeof t=="function"?t():t}function QI(t){return typeof t=="function"?t():t}class Hs{constructor(e){var r,n,i,a;const s=(r=e.parseValue)!==null&&r!==void 0?r:sS;this.name=qa(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=(n=e.serialize)!==null&&n!==void 0?n:sS,this.parseValue=s,this.parseLiteral=(i=e.parseLiteral)!==null&&i!==void 0?i:(o,u)=>s(Lb(o,u)),this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(a=e.extensionASTNodes)!==null&&a!==void 0?a:[],e.specifiedByURL==null||typeof e.specifiedByURL=="string"||Fr(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${At(e.specifiedByURL)}.`),e.serialize==null||typeof e.serialize=="function"||Fr(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&(typeof e.parseValue=="function"&&typeof e.parseLiteral=="function"||Fr(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class sa{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._fields=()=>t9(e),this._interfaces=()=>e9(e),e.isTypeOf==null||typeof e.isTypeOf=="function"||Fr(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${At(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:n9(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function e9(t){var e;const r=XI((e=t.interfaces)!==null&&e!==void 0?e:[]);return Array.isArray(r)||Fr(!1,`${t.name} interfaces must be an Array or a function which returns an Array.`),r}function t9(t){const e=QI(t.fields);return Qc(e)||Fr(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),Fs(e,(r,n)=>{var i;Qc(r)||Fr(!1,`${t.name}.${n} field config must be an object.`),r.resolve==null||typeof r.resolve=="function"||Fr(!1,`${t.name}.${n} field resolver must be a function if provided, but got: ${At(r.resolve)}.`);const a=(i=r.args)!==null&&i!==void 0?i:{};return Qc(a)||Fr(!1,`${t.name}.${n} args must be an object with argument names as keys.`),{name:qa(n),description:r.description,type:r.type,args:r9(a),resolve:r.resolve,subscribe:r.subscribe,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}})}function r9(t){return Object.entries(t).map(([e,r])=>({name:qa(e),description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}))}function Qc(t){return Pu(t)&&!Array.isArray(t)}function n9(t){return Fs(t,e=>({description:e.description,type:e.type,args:i9(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function i9(t){return j_(t,e=>e.name,e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function a9(t){return on(t.type)&&t.defaultValue===void 0}class jb{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._fields=t9.bind(void 0,e),this._interfaces=e9.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||Fr(!1,`${this.name} must provide "resolveType" as a function, but got: ${At(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:n9(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class el{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._types=rV.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||Fr(!1,`${this.name} must provide "resolveType" as a function, but got: ${At(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rV(t){const e=XI(t.types);return Array.isArray(e)||Fr(!1,`Must provide Array of types or a function which returns such an array for Union ${t.name}.`),e}class Sf{constructor(e){var r;this.name=qa(e.name),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._values=typeof e.values=="function"?e.values:cS(this.name,e.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=cS(this.name,this._values())),this._values}getValue(e){return this._nameLookup===null&&(this._nameLookup=Lu(this.getValues(),r=>r.name)),this._nameLookup[e]}serialize(e){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(n=>[n.value,n])));const r=this._valueLookup.get(e);if(r===void 0)throw new He(`Enum "${this.name}" cannot represent value: ${At(e)}`);return r.name}parseValue(e){if(typeof e!="string"){const n=At(e);throw new He(`Enum "${this.name}" cannot represent non-string value: ${n}.`+Sp(this,n))}const r=this.getValue(e);if(r==null)throw new He(`Value "${e}" does not exist in "${this.name}" enum.`+Sp(this,e));return r.value}parseLiteral(e,r){if(e.kind!==ye.ENUM){const i=Mn(e);throw new He(`Enum "${this.name}" cannot represent non-enum value: ${i}.`+Sp(this,i),{nodes:e})}const n=this.getValue(e.value);if(n==null){const i=Mn(e);throw new He(`Value "${i}" does not exist in "${this.name}" enum.`+Sp(this,i),{nodes:e})}return n.value}toConfig(){const e=j_(this.getValues(),r=>r.name,r=>({description:r.description,value:r.value,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Sp(t,e){const r=t.getValues().map(i=>i.name),n=ic(e,r);return Ro("the enum value",n)}function cS(t,e){return Qc(e)||Fr(!1,`${t} values must be an object with value names as keys.`),Object.entries(e).map(([r,n])=>(Qc(n)||Fr(!1,`${t}.${r} must refer to an object with a "value" key representing an internal value but got: ${At(n)}.`),{name:Qq(r),description:n.description,value:n.value!==void 0?n.value:r,deprecationReason:n.deprecationReason,extensions:da(n.extensions),astNode:n.astNode}))}class $b{constructor(e){var r,n;this.name=qa(e.name),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this.isOneOf=(n=e.isOneOf)!==null&&n!==void 0?n:!1,this._fields=nV.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const e=Fs(this.getFields(),r=>({description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function nV(t){const e=QI(t.fields);return Qc(e)||Fr(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),Fs(e,(r,n)=>(!("resolve"in r)||Fr(!1,`${t.name}.${n} field has a resolve property, but Input Types cannot define resolvers.`),{name:qa(n),description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:da(r.extensions),astNode:r.astNode}))}function iV(t){return on(t.type)&&t.defaultValue===void 0}function rf(t,e,r){return e===r?!0:on(r)?on(e)?rf(t,e.ofType,r.ofType):!1:on(e)?rf(t,e.ofType,r):zi(r)?zi(e)?rf(t,e.ofType,r.ofType):!1:zi(e)?!1:Nu(r)&&($n(e)||gi(e))&&t.isSubType(r,e)}function lS(t,e,r){return e===r?!0:Nu(e)?Nu(r)?t.getPossibleTypes(e).some(n=>t.isSubType(r,n)):t.isSubType(e,r):Nu(r)?t.isSubType(r,e):!1}const e1=2147483647,t1=-2147483648,aV=new Hs({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(t){const e=$h(t);if(typeof e=="boolean")return e?1:0;let r=e;if(typeof e=="string"&&e!==""&&(r=Number(e)),typeof r!="number"||!Number.isInteger(r))throw new He(`Int cannot represent non-integer value: ${At(e)}`);if(r>e1||r<t1)throw new He("Int cannot represent non 32-bit signed integer value: "+At(e));return r},parseValue(t){if(typeof t!="number"||!Number.isInteger(t))throw new He(`Int cannot represent non-integer value: ${At(t)}`);if(t>e1||t<t1)throw new He(`Int cannot represent non 32-bit signed integer value: ${t}`);return t},parseLiteral(t){if(t.kind!==ye.INT)throw new He(`Int cannot represent non-integer value: ${Mn(t)}`,{nodes:t});const e=parseInt(t.value,10);if(e>e1||e<t1)throw new He(`Int cannot represent non 32-bit signed integer value: ${t.value}`,{nodes:t});return e}}),sV=new Hs({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(t){const e=$h(t);if(typeof e=="boolean")return e?1:0;let r=e;if(typeof e=="string"&&e!==""&&(r=Number(e)),typeof r!="number"||!Number.isFinite(r))throw new He(`Float cannot represent non numeric value: ${At(e)}`);return r},parseValue(t){if(typeof t!="number"||!Number.isFinite(t))throw new He(`Float cannot represent non numeric value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.FLOAT&&t.kind!==ye.INT)throw new He(`Float cannot represent non numeric value: ${Mn(t)}`,t);return parseFloat(t.value)}}),xn=new Hs({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(t){const e=$h(t);if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"&&Number.isFinite(e))return e.toString();throw new He(`String cannot represent value: ${At(t)}`)},parseValue(t){if(typeof t!="string")throw new He(`String cannot represent a non string value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.STRING)throw new He(`String cannot represent a non string value: ${Mn(t)}`,{nodes:t});return t.value}}),$i=new Hs({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(t){const e=$h(t);if(typeof e=="boolean")return e;if(Number.isFinite(e))return e!==0;throw new He(`Boolean cannot represent a non boolean value: ${At(e)}`)},parseValue(t){if(typeof t!="boolean")throw new He(`Boolean cannot represent a non boolean value: ${At(t)}`);return t},parseLiteral(t){if(t.kind!==ye.BOOLEAN)throw new He(`Boolean cannot represent a non boolean value: ${Mn(t)}`,{nodes:t});return t.value}}),s9=new Hs({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(t){const e=$h(t);if(typeof e=="string")return e;if(Number.isInteger(e))return String(e);throw new He(`ID cannot represent value: ${At(t)}`)},parseValue(t){if(typeof t=="string")return t;if(typeof t=="number"&&Number.isInteger(t))return t.toString();throw new He(`ID cannot represent value: ${At(t)}`)},parseLiteral(t){if(t.kind!==ye.STRING&&t.kind!==ye.INT)throw new He("ID cannot represent a non-string and non-integer value: "+Mn(t),{nodes:t});return t.value}}),z_=Object.freeze([xn,aV,sV,$i,s9]);function oV(t){return z_.some(({name:e})=>t.name===e)}function $h(t){if(Pu(t)){if(typeof t.valueOf=="function"){const e=t.valueOf();if(!Pu(e))return e}if(typeof t.toJSON=="function")return t.toJSON()}return t}function uV(t){return vs(t,Fo)}class Fo{constructor(e){var r,n;this.name=qa(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=(r=e.isRepeatable)!==null&&r!==void 0?r:!1,this.extensions=da(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||Fr(!1,`@${e.name} locations must be an Array.`);const i=(n=e.args)!==null&&n!==void 0?n:{};Pu(i)&&!Array.isArray(i)||Fr(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=r9(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:i9(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const o9=new Fo({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[It.FIELD,It.FRAGMENT_SPREAD,It.INLINE_FRAGMENT],args:{if:{type:new dr($i),description:"Included when true."}}}),u9=new Fo({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[It.FIELD,It.FRAGMENT_SPREAD,It.INLINE_FRAGMENT],args:{if:{type:new dr($i),description:"Skipped when true."}}}),cV="No longer supported",c9=new Fo({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[It.FIELD_DEFINITION,It.ARGUMENT_DEFINITION,It.INPUT_FIELD_DEFINITION,It.ENUM_VALUE],args:{reason:{type:xn,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:cV}}}),l9=new Fo({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[It.SCALAR],args:{url:{type:new dr(xn),description:"The URL that specifies the behavior of this scalar."}}}),d9=new Fo({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[It.INPUT_OBJECT],args:{}}),Wl=Object.freeze([o9,u9,c9,l9,d9]);function lV(t){return typeof t=="object"&&typeof(t==null?void 0:t[Symbol.iterator])=="function"}function Pd(t,e){if(on(e)){const r=Pd(t,e.ofType);return(r==null?void 0:r.kind)===ye.NULL?null:r}if(t===null)return{kind:ye.NULL};if(t===void 0)return null;if(zi(e)){const r=e.ofType;if(lV(t)){const n=[];for(const i of t){const a=Pd(i,r);a!=null&&n.push(a)}return{kind:ye.LIST,values:n}}return Pd(t,r)}if(Ui(e)){if(!Pu(t))return null;const r=[];for(const n of Object.values(e.getFields())){const i=Pd(t[n.name],n.type);i&&r.push({kind:ye.OBJECT_FIELD,name:{kind:ye.NAME,value:n.name},value:i})}return{kind:ye.OBJECT,fields:r}}if(fl(e)){const r=e.serialize(t);if(r==null)return null;if(typeof r=="boolean")return{kind:ye.BOOLEAN,value:r};if(typeof r=="number"&&Number.isFinite(r)){const n=String(r);return dS.test(n)?{kind:ye.INT,value:n}:{kind:ye.FLOAT,value:n}}if(typeof r=="string")return Zs(e)?{kind:ye.ENUM,value:r}:e===s9&&dS.test(r)?{kind:ye.INT,value:r}:{kind:ye.STRING,value:r};throw new TypeError(`Cannot convert value to AST: ${At(r)}.`)}Ca(!1,"Unexpected input type: "+At(e))}const dS=/^-?(?:0|[1-9][0-9]*)$/,q_=new sa({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:xn,resolve:t=>t.description},types:{description:"A list of all types supported by this server.",type:new dr(new hi(new dr(Aa))),resolve(t){return Object.values(t.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new dr(Aa),resolve:t=>t.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Aa,resolve:t=>t.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Aa,resolve:t=>t.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new dr(new hi(new dr(f9))),resolve:t=>t.getDirectives()}})}),f9=new sa({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
51
51
 
52
- In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},isRepeatable:{type:new dr($i),resolve:t=>t.isRepeatable},locations:{type:new dr(new hi(new dr(h9))),resolve:t=>t.locations},args:{type:new dr(new hi(new dr(C0))),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(r=>r.deprecationReason==null)}}})}),h9=new Sf({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:It.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:It.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:It.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:It.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:It.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:It.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:It.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:It.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:It.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:It.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:It.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:It.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:It.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:It.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:It.UNION,description:"Location adjacent to a union definition."},ENUM:{value:It.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:It.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:It.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:It.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Aa=new sa({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new dr(g9),resolve(t){if(Hl(t))return Bn.SCALAR;if(gi(t))return Bn.OBJECT;if(Un(t))return Bn.INTERFACE;if(Vs(t))return Bn.UNION;if(Zs(t))return Bn.ENUM;if(Ui(t))return Bn.INPUT_OBJECT;if(zi(t))return Bn.LIST;if(on(t))return Bn.NON_NULL;Ca(!1,`Unexpected type: "${At(t)}".`)}},name:{type:xn,resolve:t=>"name"in t?t.name:void 0},description:{type:xn,resolve:t=>"description"in t?t.description:void 0},specifiedByURL:{type:xn,resolve:t=>"specifiedByURL"in t?t.specifiedByURL:void 0},fields:{type:new hi(new dr(p9)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(gi(t)||Un(t)){const r=Object.values(t.getFields());return e?r:r.filter(n=>n.deprecationReason==null)}}},interfaces:{type:new hi(new dr(Aa)),resolve(t){if(gi(t)||Un(t))return t.getInterfaces()}},possibleTypes:{type:new hi(new dr(Aa)),resolve(t,e,r,{schema:n}){if(Nu(t))return n.getPossibleTypes(t)}},enumValues:{type:new hi(new dr(m9)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Zs(t)){const r=t.getValues();return e?r:r.filter(n=>n.deprecationReason==null)}}},inputFields:{type:new hi(new dr(C0)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Ui(t)){const r=Object.values(t.getFields());return e?r:r.filter(n=>n.deprecationReason==null)}}},ofType:{type:Aa,resolve:t=>"ofType"in t?t.ofType:void 0},isOneOf:{type:$i,resolve:t=>{if(Ui(t))return t.isOneOf}}})}),p9=new sa({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},args:{type:new dr(new hi(new dr(C0))),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(r=>r.deprecationReason==null)}},type:{type:new dr(Aa),resolve:t=>t.type},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})}),C0=new sa({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},type:{type:new dr(Aa),resolve:t=>t.type},defaultValue:{type:xn,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(t){const{type:e,defaultValue:r}=t,n=Pd(r,e);return n?Mn(n):null}},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})}),m9=new sa({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})});var Bn;(function(t){t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.INPUT_OBJECT="INPUT_OBJECT",t.LIST="LIST",t.NON_NULL="NON_NULL"})(Bn||(Bn={}));const g9=new Sf({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Bn.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Bn.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Bn.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Bn.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Bn.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Bn.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Bn.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Bn.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}});new dr(q_);new dr(xn);new dr(xn);const V_=Object.freeze([q_,f9,h9,Aa,p9,C0,m9,g9]);function dV(t){return V_.some(({name:e})=>t.name===e)}class fV{constructor(e){var r,n;this.__validationErrors=e.assumeValid===!0?[]:void 0,Pu(e)||Fr(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||Fr(!1,`"types" must be Array if provided but got: ${At(e.types)}.`),!e.directives||Array.isArray(e.directives)||Fr(!1,`"directives" must be Array if provided but got: ${At(e.directives)}.`),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=(n=e.directives)!==null&&n!==void 0?n:Wl;const i=new Set(e.types);if(e.types!=null)for(const a of e.types)i.delete(a),xa(a,i);this._queryType!=null&&xa(this._queryType,i),this._mutationType!=null&&xa(this._mutationType,i),this._subscriptionType!=null&&xa(this._subscriptionType,i);for(const a of this._directives)if(uV(a))for(const s of a.args)xa(s.type,i);xa(q_,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const a of i){if(a==null)continue;const s=a.name;if(s||Fr(!1,"One of the provided types for building the Schema is missing a name."),this._typeMap[s]!==void 0)throw new Error(`Schema must contain uniquely named types but contains multiple types named "${s}".`);if(this._typeMap[s]=a,Un(a)){for(const o of a.getInterfaces())if(Un(o)){let u=this._implementationsMap[o.name];u===void 0&&(u=this._implementationsMap[o.name]={objects:[],interfaces:[]}),u.interfaces.push(a)}}else if(gi(a)){for(const o of a.getInterfaces())if(Un(o)){let u=this._implementationsMap[o.name];u===void 0&&(u=this._implementationsMap[o.name]={objects:[],interfaces:[]}),u.objects.push(a)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case aa.QUERY:return this.getQueryType();case aa.MUTATION:return this.getMutationType();case aa.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return Vs(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const r=this._implementationsMap[e.name];return r??{objects:[],interfaces:[]}}isSubType(e,r){let n=this._subTypeMap[e.name];if(n===void 0){if(n=Object.create(null),Vs(e))for(const i of e.getTypes())n[i.name]=!0;else{const i=this.getImplementations(e);for(const a of i.objects)n[a.name]=!0;for(const a of i.interfaces)n[a.name]=!0}this._subTypeMap[e.name]=n}return n[r.name]!==void 0}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find(r=>r.name===e)}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.__validationErrors!==void 0}}}function xa(t,e){const r=ju(t);if(!e.has(r)){if(e.add(r),Vs(r))for(const n of r.getTypes())xa(n,e);else if(gi(r)||Un(r)){for(const n of r.getInterfaces())xa(n,e);for(const n of Object.values(r.getFields())){xa(n.type,e);for(const i of n.args)xa(i.type,e)}}else if(Ui(r))for(const n of Object.values(r.getFields()))xa(n.type,e)}return e}function ds(t,e){switch(e.kind){case ye.LIST_TYPE:{const r=ds(t,e.type);return r&&new hi(r)}case ye.NON_NULL_TYPE:{const r=ds(t,e.type);return r&&new dr(r)}case ye.NAMED_TYPE:return t.getType(e.name.value)}}function hV(t){return t.kind===ye.OPERATION_DEFINITION||t.kind===ye.FRAGMENT_DEFINITION}function pV(t){return t.kind===ye.SCHEMA_DEFINITION||Uh(t)||t.kind===ye.DIRECTIVE_DEFINITION}function Uh(t){return t.kind===ye.SCALAR_TYPE_DEFINITION||t.kind===ye.OBJECT_TYPE_DEFINITION||t.kind===ye.INTERFACE_TYPE_DEFINITION||t.kind===ye.UNION_TYPE_DEFINITION||t.kind===ye.ENUM_TYPE_DEFINITION||t.kind===ye.INPUT_OBJECT_TYPE_DEFINITION}function mV(t){return t.kind===ye.SCHEMA_EXTENSION||Z_(t)}function Z_(t){return t.kind===ye.SCALAR_TYPE_EXTENSION||t.kind===ye.OBJECT_TYPE_EXTENSION||t.kind===ye.INTERFACE_TYPE_EXTENSION||t.kind===ye.UNION_TYPE_EXTENSION||t.kind===ye.ENUM_TYPE_EXTENSION||t.kind===ye.INPUT_OBJECT_TYPE_EXTENSION}function gV(t){return{Document(e){for(const r of e.definitions)if(!hV(r)){const n=r.kind===ye.SCHEMA_DEFINITION||r.kind===ye.SCHEMA_EXTENSION?"schema":'"'+r.name.value+'"';t.reportError(new He(`The ${n} definition is not executable.`,{nodes:r}))}return!1}}}function yV(t){return{Field(e){const r=t.getParentType();if(r&&!t.getFieldDef()){const i=t.getSchema(),a=e.name.value;let s=Ro("to use an inline fragment on",vV(i,r,a));s===""&&(s=Ro(bV(r,a))),t.reportError(new He(`Cannot query field "${a}" on type "${r.name}".`+s,{nodes:e}))}}}}function vV(t,e,r){if(!Nu(e))return[];const n=new Set,i=Object.create(null);for(const s of t.getPossibleTypes(e))if(s.getFields()[r]){n.add(s),i[s.name]=1;for(const o of s.getInterfaces()){var a;o.getFields()[r]&&(n.add(o),i[o.name]=((a=i[o.name])!==null&&a!==void 0?a:0)+1)}}return[...n].sort((s,o)=>{const u=i[o.name]-i[s.name];return u!==0?u:Un(s)&&t.isSubType(s,o)?-1:Un(o)&&t.isSubType(o,s)?1:$_(s.name,o.name)}).map(s=>s.name)}function bV(t,e){if(gi(t)||Un(t)){const r=Object.keys(t.getFields());return ic(e,r)}return[]}function wV(t){return{InlineFragment(e){const r=e.typeCondition;if(r){const n=ds(t.getSchema(),r);if(n&&!Ef(n)){const i=Mn(r);t.reportError(new He(`Fragment cannot condition on non composite type "${i}".`,{nodes:r}))}}},FragmentDefinition(e){const r=ds(t.getSchema(),e.typeCondition);if(r&&!Ef(r)){const n=Mn(e.typeCondition);t.reportError(new He(`Fragment "${e.name.value}" cannot condition on non composite type "${n}".`,{nodes:e.typeCondition}))}}}}function _V(t){return{...y9(t),Argument(e){const r=t.getArgument(),n=t.getFieldDef(),i=t.getParentType();if(!r&&n&&i){const a=e.name.value,s=n.args.map(u=>u.name),o=ic(a,s);t.reportError(new He(`Unknown argument "${a}" on field "${i.name}.${n.name}".`+Ro(o),{nodes:e}))}}}}function y9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const s of n)e[s.name]=s.args.map(o=>o.name);const i=t.getDocument().definitions;for(const s of i)if(s.kind===ye.DIRECTIVE_DEFINITION){var a;const o=(a=s.arguments)!==null&&a!==void 0?a:[];e[s.name.value]=o.map(u=>u.name.value)}return{Directive(s){const o=s.name.value,u=e[o];if(s.arguments&&u)for(const c of s.arguments){const l=c.name.value;if(!u.includes(l)){const d=ic(l,u);t.reportError(new He(`Unknown argument "${l}" on directive "@${o}".`+Ro(d),{nodes:c}))}}return!1}}}function v9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const a of n)e[a.name]=a.locations;const i=t.getDocument().definitions;for(const a of i)a.kind===ye.DIRECTIVE_DEFINITION&&(e[a.name.value]=a.locations.map(s=>s.value));return{Directive(a,s,o,u,c){const l=a.name.value,d=e[l];if(!d){t.reportError(new He(`Unknown directive "@${l}".`,{nodes:a}));return}const f=xV(c);f&&!d.includes(f)&&t.reportError(new He(`Directive "@${l}" may not be used on ${f}.`,{nodes:a}))}}}function xV(t){const e=t[t.length-1];switch("kind"in e||Ca(!1),e.kind){case ye.OPERATION_DEFINITION:return EV(e.operation);case ye.FIELD:return It.FIELD;case ye.FRAGMENT_SPREAD:return It.FRAGMENT_SPREAD;case ye.INLINE_FRAGMENT:return It.INLINE_FRAGMENT;case ye.FRAGMENT_DEFINITION:return It.FRAGMENT_DEFINITION;case ye.VARIABLE_DEFINITION:return It.VARIABLE_DEFINITION;case ye.SCHEMA_DEFINITION:case ye.SCHEMA_EXTENSION:return It.SCHEMA;case ye.SCALAR_TYPE_DEFINITION:case ye.SCALAR_TYPE_EXTENSION:return It.SCALAR;case ye.OBJECT_TYPE_DEFINITION:case ye.OBJECT_TYPE_EXTENSION:return It.OBJECT;case ye.FIELD_DEFINITION:return It.FIELD_DEFINITION;case ye.INTERFACE_TYPE_DEFINITION:case ye.INTERFACE_TYPE_EXTENSION:return It.INTERFACE;case ye.UNION_TYPE_DEFINITION:case ye.UNION_TYPE_EXTENSION:return It.UNION;case ye.ENUM_TYPE_DEFINITION:case ye.ENUM_TYPE_EXTENSION:return It.ENUM;case ye.ENUM_VALUE_DEFINITION:return It.ENUM_VALUE;case ye.INPUT_OBJECT_TYPE_DEFINITION:case ye.INPUT_OBJECT_TYPE_EXTENSION:return It.INPUT_OBJECT;case ye.INPUT_VALUE_DEFINITION:{const r=t[t.length-3];return"kind"in r||Ca(!1),r.kind===ye.INPUT_OBJECT_TYPE_DEFINITION?It.INPUT_FIELD_DEFINITION:It.ARGUMENT_DEFINITION}default:Ca(!1,"Unexpected kind: "+At(e.kind))}}function EV(t){switch(t){case aa.QUERY:return It.QUERY;case aa.MUTATION:return It.MUTATION;case aa.SUBSCRIPTION:return It.SUBSCRIPTION}}function SV(t){return{FragmentSpread(e){const r=e.name.value;t.getFragment(r)||t.reportError(new He(`Unknown fragment "${r}".`,{nodes:e.name}))}}}function b9(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);for(const a of t.getDocument().definitions)Uh(a)&&(n[a.name.value]=!0);const i=[...Object.keys(r),...Object.keys(n)];return{NamedType(a,s,o,u,c){const l=a.name.value;if(!r[l]&&!n[l]){var d;const f=(d=c[2])!==null&&d!==void 0?d:o,h=f!=null&&TV(f);if(h&&fS.includes(l))return;const p=ic(l,h?fS.concat(i):i);t.reportError(new He(`Unknown type "${l}".`+Ro(p),{nodes:a}))}}}}const fS=[...z_,...V_].map(t=>t.name);function TV(t){return"kind"in t&&(pV(t)||mV(t))}function DV(t){let e=0;return{Document(r){e=r.definitions.filter(n=>n.kind===ye.OPERATION_DEFINITION).length},OperationDefinition(r){!r.name&&e>1&&t.reportError(new He("This anonymous operation must be the only defined operation.",{nodes:r}))}}}function AV(t){var e,r,n;const i=t.getSchema(),a=(e=(r=(n=i==null?void 0:i.astNode)!==null&&n!==void 0?n:i==null?void 0:i.getQueryType())!==null&&r!==void 0?r:i==null?void 0:i.getMutationType())!==null&&e!==void 0?e:i==null?void 0:i.getSubscriptionType();let s=0;return{SchemaDefinition(o){if(a){t.reportError(new He("Cannot define a new schema within a schema extension.",{nodes:o}));return}s>0&&t.reportError(new He("Must provide only one schema definition.",{nodes:o})),++s}}}const NV=3;function IV(t){function e(r,n=Object.create(null),i=0){if(r.kind===ye.FRAGMENT_SPREAD){const a=r.name.value;if(n[a]===!0)return!1;const s=t.getFragment(a);if(!s)return!1;try{return n[a]=!0,e(s,n,i)}finally{n[a]=void 0}}if(r.kind===ye.FIELD&&(r.name.value==="fields"||r.name.value==="interfaces"||r.name.value==="possibleTypes"||r.name.value==="inputFields")&&(i++,i>=NV))return!0;if("selectionSet"in r&&r.selectionSet){for(const a of r.selectionSet.selections)if(e(a,n,i))return!0}return!1}return{Field(r){if((r.name.value==="__schema"||r.name.value==="__type")&&e(r))return t.reportError(new He("Maximum introspection depth exceeded",{nodes:[r]})),!1}}}function CV(t){const e=Object.create(null),r=[],n=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(a){return i(a),!1}};function i(a){if(e[a.name.value])return;const s=a.name.value;e[s]=!0;const o=t.getFragmentSpreads(a.selectionSet);if(o.length!==0){n[s]=r.length;for(const u of o){const c=u.name.value,l=n[c];if(r.push(u),l===void 0){const d=t.getFragment(c);d&&i(d)}else{const d=r.slice(l),f=d.slice(0,-1).map(h=>'"'+h.name.value+'"').join(", ");t.reportError(new He(`Cannot spread fragment "${c}" within itself`+(f!==""?` via ${f}.`:"."),{nodes:d}))}r.pop()}n[s]=void 0}}}function OV(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(r){const n=t.getRecursiveVariableUsages(r);for(const{node:i}of n){const a=i.name.value;e[a]!==!0&&t.reportError(new He(r.name?`Variable "$${a}" is not defined by operation "${r.name.value}".`:`Variable "$${a}" is not defined.`,{nodes:[i,r]}))}}},VariableDefinition(r){e[r.variable.name.value]=!0}}}function MV(t){const e=[],r=[];return{OperationDefinition(n){return e.push(n),!1},FragmentDefinition(n){return r.push(n),!1},Document:{leave(){const n=Object.create(null);for(const i of e)for(const a of t.getRecursivelyReferencedFragments(i))n[a.name.value]=!0;for(const i of r){const a=i.name.value;n[a]!==!0&&t.reportError(new He(`Fragment "${a}" is never used.`,{nodes:i}))}}}}}function kV(t){let e=[];return{OperationDefinition:{enter(){e=[]},leave(r){const n=Object.create(null),i=t.getRecursiveVariableUsages(r);for(const{node:a}of i)n[a.name.value]=!0;for(const a of e){const s=a.variable.name.value;n[s]!==!0&&t.reportError(new He(r.name?`Variable "$${s}" is never used in operation "${r.name.value}".`:`Variable "$${s}" is never used.`,{nodes:a}))}}},VariableDefinition(r){e.push(r)}}}function H_(t){switch(t.kind){case ye.OBJECT:return{...t,fields:RV(t.fields)};case ye.LIST:return{...t,values:t.values.map(H_)};case ye.INT:case ye.FLOAT:case ye.STRING:case ye.BOOLEAN:case ye.NULL:case ye.ENUM:case ye.VARIABLE:return t}}function RV(t){return t.map(e=>({...e,value:H_(e.value)})).sort((e,r)=>$_(e.name.value,r.name.value))}function w9(t){return Array.isArray(t)?t.map(([e,r])=>`subfields "${e}" conflict because `+w9(r)).join(" and "):t}function FV(t){const e=new E9,r=new UV,n=new Map;return{SelectionSet(i){const a=PV(t,n,e,r,t.getParentType(),i);for(const[[s,o],u,c]of a){const l=w9(o);t.reportError(new He(`Fields "${s}" conflict because ${l}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:u.concat(c)}))}}}}function PV(t,e,r,n,i,a){const s=[],[o,u]=Qm(t,e,i,a);if(LV(t,s,e,r,n,o),u.length!==0)for(let c=0;c<u.length;c++){Gm(t,s,e,r,n,!1,o,u[c]);for(let l=c+1;l<u.length;l++)Xm(t,s,e,r,n,!1,u[c],u[l])}return s}function Gm(t,e,r,n,i,a,s,o){if(n.has(s,o,a))return;n.add(s,o,a);const u=t.getFragment(o);if(!u)return;const[c,l]=zb(t,r,u);if(s!==c){W_(t,e,r,n,i,a,s,c);for(const d of l)Gm(t,e,r,n,i,a,s,d)}}function Xm(t,e,r,n,i,a,s,o){if(s===o||i.has(s,o,a))return;i.add(s,o,a);const u=t.getFragment(s),c=t.getFragment(o);if(!u||!c)return;const[l,d]=zb(t,r,u),[f,h]=zb(t,r,c);W_(t,e,r,n,i,a,l,f);for(const p of h)Xm(t,e,r,n,i,a,s,p);for(const p of d)Xm(t,e,r,n,i,a,p,o)}function BV(t,e,r,n,i,a,s,o,u){const c=[],[l,d]=Qm(t,e,a,s),[f,h]=Qm(t,e,o,u);W_(t,c,e,r,n,i,l,f);for(const p of h)Gm(t,c,e,r,n,i,l,p);for(const p of d)Gm(t,c,e,r,n,i,f,p);for(const p of d)for(const m of h)Xm(t,c,e,r,n,i,p,m);return c}function LV(t,e,r,n,i,a){for(const[s,o]of Object.entries(a))if(o.length>1)for(let u=0;u<o.length;u++)for(let c=u+1;c<o.length;c++){const l=_9(t,r,n,i,!1,s,o[u],o[c]);l&&e.push(l)}}function W_(t,e,r,n,i,a,s,o){for(const[u,c]of Object.entries(s)){const l=o[u];if(l)for(const d of c)for(const f of l){const h=_9(t,r,n,i,a,u,d,f);h&&e.push(h)}}}function _9(t,e,r,n,i,a,s,o){const[u,c,l]=s,[d,f,h]=o,p=i||u!==d&&gi(u)&&gi(d);if(!p){const w=c.name.value,x=f.name.value;if(w!==x)return[[a,`"${w}" and "${x}" are different fields`],[c],[f]];if(!jV(c,f))return[[a,"they have differing arguments"],[c],[f]]}const m=l==null?void 0:l.type,y=h==null?void 0:h.type;if(m&&y&&Ub(m,y))return[[a,`they return conflicting types "${At(m)}" and "${At(y)}"`],[c],[f]];const g=c.selectionSet,v=f.selectionSet;if(g&&v){const w=BV(t,e,r,n,p,ju(m),g,ju(y),v);return $V(w,a,c,f)}}function jV(t,e){const r=t.arguments,n=e.arguments;if(r===void 0||r.length===0)return n===void 0||n.length===0;if(n===void 0||n.length===0||r.length!==n.length)return!1;const i=new Map(n.map(({name:a,value:s})=>[a.value,s]));return r.every(a=>{const s=a.value,o=i.get(a.name.value);return o===void 0?!1:hS(s)===hS(o)})}function hS(t){return Mn(H_(t))}function Ub(t,e){return zi(t)?zi(e)?Ub(t.ofType,e.ofType):!0:zi(e)?!0:on(t)?on(e)?Ub(t.ofType,e.ofType):!0:on(e)?!0:fl(t)||fl(e)?t!==e:!1}function Qm(t,e,r,n){const i=e.get(n);if(i)return i;const a=Object.create(null),s=Object.create(null);x9(t,r,n,a,s);const o=[a,Object.keys(s)];return e.set(n,o),o}function zb(t,e,r){const n=e.get(r.selectionSet);if(n)return n;const i=ds(t.getSchema(),r.typeCondition);return Qm(t,e,i,r.selectionSet)}function x9(t,e,r,n,i){for(const a of r.selections)switch(a.kind){case ye.FIELD:{const s=a.name.value;let o;(gi(e)||Un(e))&&(o=e.getFields()[s]);const u=a.alias?a.alias.value:s;n[u]||(n[u]=[]),n[u].push([e,a,o]);break}case ye.FRAGMENT_SPREAD:i[a.name.value]=!0;break;case ye.INLINE_FRAGMENT:{const s=a.typeCondition,o=s?ds(t.getSchema(),s):e;x9(t,o,a.selectionSet,n,i);break}}}function $V(t,e,r,n){if(t.length>0)return[[e,t.map(([i])=>i)],[r,...t.map(([,i])=>i).flat()],[n,...t.map(([,,i])=>i).flat()]]}class E9{constructor(){this._data=new Map}has(e,r,n){var i;const a=(i=this._data.get(e))===null||i===void 0?void 0:i.get(r);return a===void 0?!1:n?!0:n===a}add(e,r,n){const i=this._data.get(e);i===void 0?this._data.set(e,new Map([[r,n]])):i.set(r,n)}}class UV{constructor(){this._orderedPairSet=new E9}has(e,r,n){return e<r?this._orderedPairSet.has(e,r,n):this._orderedPairSet.has(r,e,n)}add(e,r,n){e<r?this._orderedPairSet.add(e,r,n):this._orderedPairSet.add(r,e,n)}}function zV(t){return{InlineFragment(e){const r=t.getType(),n=t.getParentType();if(Ef(r)&&Ef(n)&&!lS(t.getSchema(),r,n)){const i=At(n),a=At(r);t.reportError(new He(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${a}".`,{nodes:e}))}},FragmentSpread(e){const r=e.name.value,n=qV(t,r),i=t.getParentType();if(n&&i&&!lS(t.getSchema(),n,i)){const a=At(i),s=At(n);t.reportError(new He(`Fragment "${r}" cannot be spread here as objects of type "${a}" can never be of type "${s}".`,{nodes:e}))}}}}function qV(t,e){const r=t.getFragment(e);if(r){const n=ds(t.getSchema(),r.typeCondition);if(Ef(n))return n}}function VV(t){const e=t.getSchema(),r=Object.create(null);for(const i of t.getDocument().definitions)Uh(i)&&(r[i.name.value]=i);return{ScalarTypeExtension:n,ObjectTypeExtension:n,InterfaceTypeExtension:n,UnionTypeExtension:n,EnumTypeExtension:n,InputObjectTypeExtension:n};function n(i){const a=i.name.value,s=r[a],o=e==null?void 0:e.getType(a);let u;if(s?u=ZV[s.kind]:o&&(u=HV(o)),u){if(u!==i.kind){const c=WV(i.kind);t.reportError(new He(`Cannot extend non-${c} type "${a}".`,{nodes:s?[s,i]:i}))}}else{const c=Object.keys({...r,...e==null?void 0:e.getTypeMap()}),l=ic(a,c);t.reportError(new He(`Cannot extend type "${a}" because it is not defined.`+Ro(l),{nodes:i.name}))}}}const ZV={[ye.SCALAR_TYPE_DEFINITION]:ye.SCALAR_TYPE_EXTENSION,[ye.OBJECT_TYPE_DEFINITION]:ye.OBJECT_TYPE_EXTENSION,[ye.INTERFACE_TYPE_DEFINITION]:ye.INTERFACE_TYPE_EXTENSION,[ye.UNION_TYPE_DEFINITION]:ye.UNION_TYPE_EXTENSION,[ye.ENUM_TYPE_DEFINITION]:ye.ENUM_TYPE_EXTENSION,[ye.INPUT_OBJECT_TYPE_DEFINITION]:ye.INPUT_OBJECT_TYPE_EXTENSION};function HV(t){if(Hl(t))return ye.SCALAR_TYPE_EXTENSION;if(gi(t))return ye.OBJECT_TYPE_EXTENSION;if(Un(t))return ye.INTERFACE_TYPE_EXTENSION;if(Vs(t))return ye.UNION_TYPE_EXTENSION;if(Zs(t))return ye.ENUM_TYPE_EXTENSION;if(Ui(t))return ye.INPUT_OBJECT_TYPE_EXTENSION;Ca(!1,"Unexpected type: "+At(t))}function WV(t){switch(t){case ye.SCALAR_TYPE_EXTENSION:return"scalar";case ye.OBJECT_TYPE_EXTENSION:return"object";case ye.INTERFACE_TYPE_EXTENSION:return"interface";case ye.UNION_TYPE_EXTENSION:return"union";case ye.ENUM_TYPE_EXTENSION:return"enum";case ye.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:Ca(!1,"Unexpected kind: "+At(t))}}function YV(t){return{...S9(t),Field:{leave(e){var r;const n=t.getFieldDef();if(!n)return!1;const i=new Set((r=e.arguments)===null||r===void 0?void 0:r.map(a=>a.name.value));for(const a of n.args)if(!i.has(a.name)&&a9(a)){const s=At(a.type);t.reportError(new He(`Field "${n.name}" argument "${a.name}" of type "${s}" is required, but it was not provided.`,{nodes:e}))}}}}}function S9(t){var e;const r=Object.create(null),n=t.getSchema(),i=(e=n==null?void 0:n.getDirectives())!==null&&e!==void 0?e:Wl;for(const o of i)r[o.name]=Lu(o.args.filter(a9),u=>u.name);const a=t.getDocument().definitions;for(const o of a)if(o.kind===ye.DIRECTIVE_DEFINITION){var s;const u=(s=o.arguments)!==null&&s!==void 0?s:[];r[o.name.value]=Lu(u.filter(JV),c=>c.name.value)}return{Directive:{leave(o){const u=o.name.value,c=r[u];if(c){var l;const d=(l=o.arguments)!==null&&l!==void 0?l:[],f=new Set(d.map(h=>h.name.value));for(const[h,p]of Object.entries(c))if(!f.has(h)){const m=U_(p.type)?At(p.type):Mn(p.type);t.reportError(new He(`Directive "@${u}" argument "${h}" of type "${m}" is required, but it was not provided.`,{nodes:o}))}}}}}}function JV(t){return t.type.kind===ye.NON_NULL_TYPE&&t.defaultValue==null}function KV(t){return{Field(e){const r=t.getType(),n=e.selectionSet;if(r)if(fl(ju(r))){if(n){const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" must not have a selection since type "${a}" has no subfields.`,{nodes:n}))}}else if(n){if(n.selections.length===0){const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" of type "${a}" must have at least one field selected.`,{nodes:e}))}}else{const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" of type "${a}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:e}))}}}}function wu(t,e,r){if(t){if(t.kind===ye.VARIABLE){const n=t.name.value;if(r==null||r[n]===void 0)return;const i=r[n];return i===null&&on(e)?void 0:i}if(on(e))return t.kind===ye.NULL?void 0:wu(t,e.ofType,r);if(t.kind===ye.NULL)return null;if(zi(e)){const n=e.ofType;if(t.kind===ye.LIST){const a=[];for(const s of t.values)if(pS(s,r)){if(on(n))return;a.push(null)}else{const o=wu(s,n,r);if(o===void 0)return;a.push(o)}return a}const i=wu(t,n,r);return i===void 0?void 0:[i]}if(Ui(e)){if(t.kind!==ye.OBJECT)return;const n=Object.create(null),i=Lu(t.fields,a=>a.name.value);for(const a of Object.values(e.getFields())){const s=i[a.name];if(!s||pS(s.value,r)){if(a.defaultValue!==void 0)n[a.name]=a.defaultValue;else if(on(a.type))return;continue}const o=wu(s.value,a.type,r);if(o===void 0)return;n[a.name]=o}if(e.isOneOf){const a=Object.keys(n);if(a.length!==1||n[a[0]]===null)return}return n}if(fl(e)){let n;try{n=e.parseLiteral(t,r)}catch{return}return n===void 0?void 0:n}Ca(!1,"Unexpected input type: "+At(e))}}function pS(t,e){return t.kind===ye.VARIABLE&&(e==null||e[t.name.value]===void 0)}function GV(t,e,r){var n;const i={},a=(n=e.arguments)!==null&&n!==void 0?n:[],s=Lu(a,o=>o.name.value);for(const o of t.args){const u=o.name,c=o.type,l=s[u];if(!l){if(o.defaultValue!==void 0)i[u]=o.defaultValue;else if(on(c))throw new He(`Argument "${u}" of required type "${At(c)}" was not provided.`,{nodes:e});continue}const d=l.value;let f=d.kind===ye.NULL;if(d.kind===ye.VARIABLE){const p=d.name.value;if(r==null||!XV(r,p)){if(o.defaultValue!==void 0)i[u]=o.defaultValue;else if(on(c))throw new He(`Argument "${u}" of required type "${At(c)}" was provided the variable "$${p}" which was not provided a runtime value.`,{nodes:d});continue}f=r[p]==null}if(f&&on(c))throw new He(`Argument "${u}" of non-null type "${At(c)}" must not be null.`,{nodes:d});const h=wu(d,c,r);if(h===void 0)throw new He(`Argument "${u}" has invalid value ${Mn(d)}.`,{nodes:d});i[u]=h}return i}function Tf(t,e,r){var n;const i=(n=e.directives)===null||n===void 0?void 0:n.find(a=>a.name.value===t.name);if(i)return GV(t,i,r)}function XV(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function QV(t,e,r,n,i){const a=new Map;return qb(t,e,r,n,i,a,new Set),a}function qb(t,e,r,n,i,a,s){for(const o of i.selections)switch(o.kind){case ye.FIELD:{if(!r1(r,o))continue;const u=eZ(o),c=a.get(u);c!==void 0?c.push(o):a.set(u,[o]);break}case ye.INLINE_FRAGMENT:{if(!r1(r,o)||!mS(t,o,n))continue;qb(t,e,r,n,o.selectionSet,a,s);break}case ye.FRAGMENT_SPREAD:{const u=o.name.value;if(s.has(u)||!r1(r,o))continue;s.add(u);const c=e[u];if(!c||!mS(t,c,n))continue;qb(t,e,r,n,c.selectionSet,a,s);break}}}function r1(t,e){const r=Tf(u9,e,t);if((r==null?void 0:r.if)===!0)return!1;const n=Tf(o9,e,t);return(n==null?void 0:n.if)!==!1}function mS(t,e,r){const n=e.typeCondition;if(!n)return!0;const i=ds(t,n);return i===r?!0:Nu(i)?t.isSubType(i,r):!1}function eZ(t){return t.alias?t.alias.value:t.name.value}function tZ(t){return{OperationDefinition(e){if(e.operation==="subscription"){const r=t.getSchema(),n=r.getSubscriptionType();if(n){const i=e.name?e.name.value:null,a=Object.create(null),s=t.getDocument(),o=Object.create(null);for(const c of s.definitions)c.kind===ye.FRAGMENT_DEFINITION&&(o[c.name.value]=c);const u=QV(r,o,a,n,e.selectionSet);if(u.size>1){const d=[...u.values()].slice(1).flat();t.reportError(new He(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:d}))}for(const c of u.values())c[0].name.value.startsWith("__")&&t.reportError(new He(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:c}))}}}}}function Y_(t,e){const r=new Map;for(const n of t){const i=e(n),a=r.get(i);a===void 0?r.set(i,[n]):a.push(n)}return r}function rZ(t){return{DirectiveDefinition(n){var i;const a=(i=n.arguments)!==null&&i!==void 0?i:[];return r(`@${n.name.value}`,a)},InterfaceTypeDefinition:e,InterfaceTypeExtension:e,ObjectTypeDefinition:e,ObjectTypeExtension:e};function e(n){var i;const a=n.name.value,s=(i=n.fields)!==null&&i!==void 0?i:[];for(const u of s){var o;const c=u.name.value,l=(o=u.arguments)!==null&&o!==void 0?o:[];r(`${a}.${c}`,l)}return!1}function r(n,i){const a=Y_(i,s=>s.name.value);for(const[s,o]of a)o.length>1&&t.reportError(new He(`Argument "${n}(${s}:)" can only be defined once.`,{nodes:o.map(u=>u.name)}));return!1}}function T9(t){return{Field:e,Directive:e};function e(r){var n;const i=(n=r.arguments)!==null&&n!==void 0?n:[],a=Y_(i,s=>s.name.value);for(const[s,o]of a)o.length>1&&t.reportError(new He(`There can be only one argument named "${s}".`,{nodes:o.map(u=>u.name)}))}}function nZ(t){const e=Object.create(null),r=t.getSchema();return{DirectiveDefinition(n){const i=n.name.value;if(r!=null&&r.getDirective(i)){t.reportError(new He(`Directive "@${i}" already exists in the schema. It cannot be redefined.`,{nodes:n.name}));return}return e[i]?t.reportError(new He(`There can be only one directive named "@${i}".`,{nodes:[e[i],n.name]})):e[i]=n.name,!1}}}function D9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const o of n)e[o.name]=!o.isRepeatable;const i=t.getDocument().definitions;for(const o of i)o.kind===ye.DIRECTIVE_DEFINITION&&(e[o.name.value]=!o.repeatable);const a=Object.create(null),s=Object.create(null);return{enter(o){if(!("directives"in o)||!o.directives)return;let u;if(o.kind===ye.SCHEMA_DEFINITION||o.kind===ye.SCHEMA_EXTENSION)u=a;else if(Uh(o)||Z_(o)){const c=o.name.value;u=s[c],u===void 0&&(s[c]=u=Object.create(null))}else u=Object.create(null);for(const c of o.directives){const l=c.name.value;e[l]&&(u[l]?t.reportError(new He(`The directive "@${l}" can only be used once at this location.`,{nodes:[u[l],c]})):u[l]=c)}}}}function iZ(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(a){var s;const o=a.name.value;n[o]||(n[o]=Object.create(null));const u=(s=a.values)!==null&&s!==void 0?s:[],c=n[o];for(const l of u){const d=l.name.value,f=r[o];Zs(f)&&f.getValue(d)?t.reportError(new He(`Enum value "${o}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:l.name})):c[d]?t.reportError(new He(`Enum value "${o}.${d}" can only be defined once.`,{nodes:[c[d],l.name]})):c[d]=l.name}return!1}}function aZ(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(a){var s;const o=a.name.value;n[o]||(n[o]=Object.create(null));const u=(s=a.fields)!==null&&s!==void 0?s:[],c=n[o];for(const l of u){const d=l.name.value;sZ(r[o],d)?t.reportError(new He(`Field "${o}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:l.name})):c[d]?t.reportError(new He(`Field "${o}.${d}" can only be defined once.`,{nodes:[c[d],l.name]})):c[d]=l.name}return!1}}function sZ(t,e){return gi(t)||Un(t)||Ui(t)?t.getFields()[e]!=null:!1}function oZ(t){const e=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(r){const n=r.name.value;return e[n]?t.reportError(new He(`There can be only one fragment named "${n}".`,{nodes:[e[n],r.name]})):e[n]=r.name,!1}}}function A9(t){const e=[];let r=Object.create(null);return{ObjectValue:{enter(){e.push(r),r=Object.create(null)},leave(){const n=e.pop();n||Ca(!1),r=n}},ObjectField(n){const i=n.name.value;r[i]?t.reportError(new He(`There can be only one input field named "${i}".`,{nodes:[r[i],n.name]})):r[i]=n.name}}}function uZ(t){const e=Object.create(null);return{OperationDefinition(r){const n=r.name;return n&&(e[n.value]?t.reportError(new He(`There can be only one operation named "${n.value}".`,{nodes:[e[n.value],n]})):e[n.value]=n),!1},FragmentDefinition:()=>!1}}function cZ(t){const e=t.getSchema(),r=Object.create(null),n=e?{query:e.getQueryType(),mutation:e.getMutationType(),subscription:e.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(a){var s;const o=(s=a.operationTypes)!==null&&s!==void 0?s:[];for(const u of o){const c=u.operation,l=r[c];n[c]?t.reportError(new He(`Type for ${c} already defined in the schema. It cannot be redefined.`,{nodes:u})):l?t.reportError(new He(`There can be only one ${c} type in schema.`,{nodes:[l,u]})):r[c]=u}return!1}}function lZ(t){const e=Object.create(null),r=t.getSchema();return{ScalarTypeDefinition:n,ObjectTypeDefinition:n,InterfaceTypeDefinition:n,UnionTypeDefinition:n,EnumTypeDefinition:n,InputObjectTypeDefinition:n};function n(i){const a=i.name.value;if(r!=null&&r.getType(a)){t.reportError(new He(`Type "${a}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:i.name}));return}return e[a]?t.reportError(new He(`There can be only one type named "${a}".`,{nodes:[e[a],i.name]})):e[a]=i.name,!1}}function dZ(t){return{OperationDefinition(e){var r;const n=(r=e.variableDefinitions)!==null&&r!==void 0?r:[],i=Y_(n,a=>a.variable.name.value);for(const[a,s]of i)s.length>1&&t.reportError(new He(`There can be only one variable named "$${a}".`,{nodes:s.map(o=>o.variable.name)}))}}}function fZ(t){let e={};return{OperationDefinition:{enter(){e={}}},VariableDefinition(r){e[r.variable.name.value]=r},ListValue(r){const n=tV(t.getParentInputType());if(!zi(n))return cu(t,r),!1},ObjectValue(r){const n=ju(t.getInputType());if(!Ui(n))return cu(t,r),!1;const i=Lu(r.fields,a=>a.name.value);for(const a of Object.values(n.getFields()))if(!i[a.name]&&iV(a)){const o=At(a.type);t.reportError(new He(`Field "${n.name}.${a.name}" of required type "${o}" was not provided.`,{nodes:r}))}n.isOneOf&&hZ(t,r,n,i,e)},ObjectField(r){const n=ju(t.getParentInputType());if(!t.getInputType()&&Ui(n)){const a=ic(r.name.value,Object.keys(n.getFields()));t.reportError(new He(`Field "${r.name.value}" is not defined by type "${n.name}".`+Ro(a),{nodes:r}))}},NullValue(r){const n=t.getInputType();on(n)&&t.reportError(new He(`Expected value of type "${At(n)}", found ${Mn(r)}.`,{nodes:r}))},EnumValue:r=>cu(t,r),IntValue:r=>cu(t,r),FloatValue:r=>cu(t,r),StringValue:r=>cu(t,r),BooleanValue:r=>cu(t,r)}}function cu(t,e){const r=t.getInputType();if(!r)return;const n=ju(r);if(!fl(n)){const i=At(r);t.reportError(new He(`Expected value of type "${i}", found ${Mn(e)}.`,{nodes:e}));return}try{if(n.parseLiteral(e,void 0)===void 0){const a=At(r);t.reportError(new He(`Expected value of type "${a}", found ${Mn(e)}.`,{nodes:e}))}}catch(i){const a=At(r);i instanceof He?t.reportError(i):t.reportError(new He(`Expected value of type "${a}", found ${Mn(e)}; `+i.message,{nodes:e,originalError:i}))}}function hZ(t,e,r,n,i){var a;const s=Object.keys(n);if(s.length!==1){t.reportError(new He(`OneOf Input Object "${r.name}" must specify exactly one key.`,{nodes:[e]}));return}const u=(a=n[s[0]])===null||a===void 0?void 0:a.value,c=!u||u.kind===ye.NULL,l=(u==null?void 0:u.kind)===ye.VARIABLE;if(c){t.reportError(new He(`Field "${r.name}.${s[0]}" must be non-null.`,{nodes:[e]}));return}if(l){const d=u.name.value;i[d].type.kind!==ye.NON_NULL_TYPE&&t.reportError(new He(`Variable "${d}" must be non-nullable to be used for OneOf Input Object "${r.name}".`,{nodes:[e]}))}}function pZ(t){return{VariableDefinition(e){const r=ds(t.getSchema(),e.type);if(r!==void 0&&!KI(r)){const n=e.variable.name.value,i=Mn(e.type);t.reportError(new He(`Variable "$${n}" cannot be non-input type "${i}".`,{nodes:e.type}))}}}}function mZ(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(r){const n=t.getRecursiveVariableUsages(r);for(const{node:i,type:a,defaultValue:s}of n){const o=i.name.value,u=e[o];if(u&&a){const c=t.getSchema(),l=ds(c,u.type);if(l&&!gZ(c,l,u.defaultValue,a,s)){const d=At(l),f=At(a);t.reportError(new He(`Variable "$${o}" of type "${d}" used in position expecting type "${f}".`,{nodes:[u,i]}))}}}}},VariableDefinition(r){e[r.variable.name.value]=r}}}function gZ(t,e,r,n,i){if(on(n)&&!on(e)){if(!(r!=null&&r.kind!==ye.NULL)&&!(i!==void 0))return!1;const o=n.ofType;return rf(t,e,o)}return rf(t,e,n)}const yZ=Object.freeze([IV]);Object.freeze([gV,uZ,DV,tZ,b9,wV,pZ,KV,yV,oZ,SV,MV,zV,CV,dZ,OV,kV,v9,D9,_V,T9,fZ,YV,mZ,FV,A9,...yZ]);const vZ=Object.freeze([AV,cZ,lZ,iZ,aZ,rZ,nZ,b9,v9,D9,VV,y9,T9,A9,S9]);class bZ{constructor(e,r){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=r}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let r;if(this._fragments)r=this._fragments;else{r=Object.create(null);for(const n of this.getDocument().definitions)n.kind===ye.FRAGMENT_DEFINITION&&(r[n.name.value]=n);this._fragments=r}return r[e]}getFragmentSpreads(e){let r=this._fragmentSpreads.get(e);if(!r){r=[];const n=[e];let i;for(;i=n.pop();)for(const a of i.selections)a.kind===ye.FRAGMENT_SPREAD?r.push(a):a.selectionSet&&n.push(a.selectionSet);this._fragmentSpreads.set(e,r)}return r}getRecursivelyReferencedFragments(e){let r=this._recursivelyReferencedFragments.get(e);if(!r){r=[];const n=Object.create(null),i=[e.selectionSet];let a;for(;a=i.pop();)for(const s of this.getFragmentSpreads(a)){const o=s.name.value;if(n[o]!==!0){n[o]=!0;const u=this.getFragment(o);u&&(r.push(u),i.push(u.selectionSet))}}this._recursivelyReferencedFragments.set(e,r)}return r}}class wZ extends bZ{constructor(e,r,n){super(e,n),this._schema=r}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}function _Z(t,e,r=vZ){const n=[],i=new wZ(t,e,s=>{n.push(s)}),a=r.map(s=>s(i));return YI(t,Kq(a)),n}function xZ(t){const e=_Z(t);if(e.length!==0)throw new Error(e.map(r=>r.message).join(`
52
+ In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},isRepeatable:{type:new dr($i),resolve:t=>t.isRepeatable},locations:{type:new dr(new hi(new dr(h9))),resolve:t=>t.locations},args:{type:new dr(new hi(new dr(C0))),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(r=>r.deprecationReason==null)}}})}),h9=new Sf({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:It.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:It.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:It.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:It.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:It.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:It.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:It.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:It.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:It.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:It.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:It.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:It.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:It.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:It.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:It.UNION,description:"Location adjacent to a union definition."},ENUM:{value:It.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:It.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:It.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:It.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Aa=new sa({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new dr(g9),resolve(t){if(Hl(t))return Bn.SCALAR;if(gi(t))return Bn.OBJECT;if($n(t))return Bn.INTERFACE;if(Vs(t))return Bn.UNION;if(Zs(t))return Bn.ENUM;if(Ui(t))return Bn.INPUT_OBJECT;if(zi(t))return Bn.LIST;if(on(t))return Bn.NON_NULL;Ca(!1,`Unexpected type: "${At(t)}".`)}},name:{type:xn,resolve:t=>"name"in t?t.name:void 0},description:{type:xn,resolve:t=>"description"in t?t.description:void 0},specifiedByURL:{type:xn,resolve:t=>"specifiedByURL"in t?t.specifiedByURL:void 0},fields:{type:new hi(new dr(p9)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(gi(t)||$n(t)){const r=Object.values(t.getFields());return e?r:r.filter(n=>n.deprecationReason==null)}}},interfaces:{type:new hi(new dr(Aa)),resolve(t){if(gi(t)||$n(t))return t.getInterfaces()}},possibleTypes:{type:new hi(new dr(Aa)),resolve(t,e,r,{schema:n}){if(Nu(t))return n.getPossibleTypes(t)}},enumValues:{type:new hi(new dr(m9)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Zs(t)){const r=t.getValues();return e?r:r.filter(n=>n.deprecationReason==null)}}},inputFields:{type:new hi(new dr(C0)),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Ui(t)){const r=Object.values(t.getFields());return e?r:r.filter(n=>n.deprecationReason==null)}}},ofType:{type:Aa,resolve:t=>"ofType"in t?t.ofType:void 0},isOneOf:{type:$i,resolve:t=>{if(Ui(t))return t.isOneOf}}})}),p9=new sa({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},args:{type:new dr(new hi(new dr(C0))),args:{includeDeprecated:{type:$i,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(r=>r.deprecationReason==null)}},type:{type:new dr(Aa),resolve:t=>t.type},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})}),C0=new sa({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},type:{type:new dr(Aa),resolve:t=>t.type},defaultValue:{type:xn,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(t){const{type:e,defaultValue:r}=t,n=Pd(r,e);return n?Mn(n):null}},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})}),m9=new sa({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new dr(xn),resolve:t=>t.name},description:{type:xn,resolve:t=>t.description},isDeprecated:{type:new dr($i),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:xn,resolve:t=>t.deprecationReason}})});var Bn;(function(t){t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.INPUT_OBJECT="INPUT_OBJECT",t.LIST="LIST",t.NON_NULL="NON_NULL"})(Bn||(Bn={}));const g9=new Sf({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Bn.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Bn.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Bn.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Bn.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Bn.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Bn.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Bn.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Bn.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}});new dr(q_);new dr(xn);new dr(xn);const V_=Object.freeze([q_,f9,h9,Aa,p9,C0,m9,g9]);function dV(t){return V_.some(({name:e})=>t.name===e)}class fV{constructor(e){var r,n;this.__validationErrors=e.assumeValid===!0?[]:void 0,Pu(e)||Fr(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||Fr(!1,`"types" must be Array if provided but got: ${At(e.types)}.`),!e.directives||Array.isArray(e.directives)||Fr(!1,`"directives" must be Array if provided but got: ${At(e.directives)}.`),this.description=e.description,this.extensions=da(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(r=e.extensionASTNodes)!==null&&r!==void 0?r:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=(n=e.directives)!==null&&n!==void 0?n:Wl;const i=new Set(e.types);if(e.types!=null)for(const a of e.types)i.delete(a),xa(a,i);this._queryType!=null&&xa(this._queryType,i),this._mutationType!=null&&xa(this._mutationType,i),this._subscriptionType!=null&&xa(this._subscriptionType,i);for(const a of this._directives)if(uV(a))for(const s of a.args)xa(s.type,i);xa(q_,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const a of i){if(a==null)continue;const s=a.name;if(s||Fr(!1,"One of the provided types for building the Schema is missing a name."),this._typeMap[s]!==void 0)throw new Error(`Schema must contain uniquely named types but contains multiple types named "${s}".`);if(this._typeMap[s]=a,$n(a)){for(const o of a.getInterfaces())if($n(o)){let u=this._implementationsMap[o.name];u===void 0&&(u=this._implementationsMap[o.name]={objects:[],interfaces:[]}),u.interfaces.push(a)}}else if(gi(a)){for(const o of a.getInterfaces())if($n(o)){let u=this._implementationsMap[o.name];u===void 0&&(u=this._implementationsMap[o.name]={objects:[],interfaces:[]}),u.objects.push(a)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case aa.QUERY:return this.getQueryType();case aa.MUTATION:return this.getMutationType();case aa.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return Vs(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const r=this._implementationsMap[e.name];return r??{objects:[],interfaces:[]}}isSubType(e,r){let n=this._subTypeMap[e.name];if(n===void 0){if(n=Object.create(null),Vs(e))for(const i of e.getTypes())n[i.name]=!0;else{const i=this.getImplementations(e);for(const a of i.objects)n[a.name]=!0;for(const a of i.interfaces)n[a.name]=!0}this._subTypeMap[e.name]=n}return n[r.name]!==void 0}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find(r=>r.name===e)}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.__validationErrors!==void 0}}}function xa(t,e){const r=ju(t);if(!e.has(r)){if(e.add(r),Vs(r))for(const n of r.getTypes())xa(n,e);else if(gi(r)||$n(r)){for(const n of r.getInterfaces())xa(n,e);for(const n of Object.values(r.getFields())){xa(n.type,e);for(const i of n.args)xa(i.type,e)}}else if(Ui(r))for(const n of Object.values(r.getFields()))xa(n.type,e)}return e}function ds(t,e){switch(e.kind){case ye.LIST_TYPE:{const r=ds(t,e.type);return r&&new hi(r)}case ye.NON_NULL_TYPE:{const r=ds(t,e.type);return r&&new dr(r)}case ye.NAMED_TYPE:return t.getType(e.name.value)}}function hV(t){return t.kind===ye.OPERATION_DEFINITION||t.kind===ye.FRAGMENT_DEFINITION}function pV(t){return t.kind===ye.SCHEMA_DEFINITION||Uh(t)||t.kind===ye.DIRECTIVE_DEFINITION}function Uh(t){return t.kind===ye.SCALAR_TYPE_DEFINITION||t.kind===ye.OBJECT_TYPE_DEFINITION||t.kind===ye.INTERFACE_TYPE_DEFINITION||t.kind===ye.UNION_TYPE_DEFINITION||t.kind===ye.ENUM_TYPE_DEFINITION||t.kind===ye.INPUT_OBJECT_TYPE_DEFINITION}function mV(t){return t.kind===ye.SCHEMA_EXTENSION||Z_(t)}function Z_(t){return t.kind===ye.SCALAR_TYPE_EXTENSION||t.kind===ye.OBJECT_TYPE_EXTENSION||t.kind===ye.INTERFACE_TYPE_EXTENSION||t.kind===ye.UNION_TYPE_EXTENSION||t.kind===ye.ENUM_TYPE_EXTENSION||t.kind===ye.INPUT_OBJECT_TYPE_EXTENSION}function gV(t){return{Document(e){for(const r of e.definitions)if(!hV(r)){const n=r.kind===ye.SCHEMA_DEFINITION||r.kind===ye.SCHEMA_EXTENSION?"schema":'"'+r.name.value+'"';t.reportError(new He(`The ${n} definition is not executable.`,{nodes:r}))}return!1}}}function yV(t){return{Field(e){const r=t.getParentType();if(r&&!t.getFieldDef()){const i=t.getSchema(),a=e.name.value;let s=Ro("to use an inline fragment on",vV(i,r,a));s===""&&(s=Ro(bV(r,a))),t.reportError(new He(`Cannot query field "${a}" on type "${r.name}".`+s,{nodes:e}))}}}}function vV(t,e,r){if(!Nu(e))return[];const n=new Set,i=Object.create(null);for(const s of t.getPossibleTypes(e))if(s.getFields()[r]){n.add(s),i[s.name]=1;for(const o of s.getInterfaces()){var a;o.getFields()[r]&&(n.add(o),i[o.name]=((a=i[o.name])!==null&&a!==void 0?a:0)+1)}}return[...n].sort((s,o)=>{const u=i[o.name]-i[s.name];return u!==0?u:$n(s)&&t.isSubType(s,o)?-1:$n(o)&&t.isSubType(o,s)?1:$_(s.name,o.name)}).map(s=>s.name)}function bV(t,e){if(gi(t)||$n(t)){const r=Object.keys(t.getFields());return ic(e,r)}return[]}function wV(t){return{InlineFragment(e){const r=e.typeCondition;if(r){const n=ds(t.getSchema(),r);if(n&&!Ef(n)){const i=Mn(r);t.reportError(new He(`Fragment cannot condition on non composite type "${i}".`,{nodes:r}))}}},FragmentDefinition(e){const r=ds(t.getSchema(),e.typeCondition);if(r&&!Ef(r)){const n=Mn(e.typeCondition);t.reportError(new He(`Fragment "${e.name.value}" cannot condition on non composite type "${n}".`,{nodes:e.typeCondition}))}}}}function _V(t){return{...y9(t),Argument(e){const r=t.getArgument(),n=t.getFieldDef(),i=t.getParentType();if(!r&&n&&i){const a=e.name.value,s=n.args.map(u=>u.name),o=ic(a,s);t.reportError(new He(`Unknown argument "${a}" on field "${i.name}.${n.name}".`+Ro(o),{nodes:e}))}}}}function y9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const s of n)e[s.name]=s.args.map(o=>o.name);const i=t.getDocument().definitions;for(const s of i)if(s.kind===ye.DIRECTIVE_DEFINITION){var a;const o=(a=s.arguments)!==null&&a!==void 0?a:[];e[s.name.value]=o.map(u=>u.name.value)}return{Directive(s){const o=s.name.value,u=e[o];if(s.arguments&&u)for(const c of s.arguments){const l=c.name.value;if(!u.includes(l)){const d=ic(l,u);t.reportError(new He(`Unknown argument "${l}" on directive "@${o}".`+Ro(d),{nodes:c}))}}return!1}}}function v9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const a of n)e[a.name]=a.locations;const i=t.getDocument().definitions;for(const a of i)a.kind===ye.DIRECTIVE_DEFINITION&&(e[a.name.value]=a.locations.map(s=>s.value));return{Directive(a,s,o,u,c){const l=a.name.value,d=e[l];if(!d){t.reportError(new He(`Unknown directive "@${l}".`,{nodes:a}));return}const f=xV(c);f&&!d.includes(f)&&t.reportError(new He(`Directive "@${l}" may not be used on ${f}.`,{nodes:a}))}}}function xV(t){const e=t[t.length-1];switch("kind"in e||Ca(!1),e.kind){case ye.OPERATION_DEFINITION:return EV(e.operation);case ye.FIELD:return It.FIELD;case ye.FRAGMENT_SPREAD:return It.FRAGMENT_SPREAD;case ye.INLINE_FRAGMENT:return It.INLINE_FRAGMENT;case ye.FRAGMENT_DEFINITION:return It.FRAGMENT_DEFINITION;case ye.VARIABLE_DEFINITION:return It.VARIABLE_DEFINITION;case ye.SCHEMA_DEFINITION:case ye.SCHEMA_EXTENSION:return It.SCHEMA;case ye.SCALAR_TYPE_DEFINITION:case ye.SCALAR_TYPE_EXTENSION:return It.SCALAR;case ye.OBJECT_TYPE_DEFINITION:case ye.OBJECT_TYPE_EXTENSION:return It.OBJECT;case ye.FIELD_DEFINITION:return It.FIELD_DEFINITION;case ye.INTERFACE_TYPE_DEFINITION:case ye.INTERFACE_TYPE_EXTENSION:return It.INTERFACE;case ye.UNION_TYPE_DEFINITION:case ye.UNION_TYPE_EXTENSION:return It.UNION;case ye.ENUM_TYPE_DEFINITION:case ye.ENUM_TYPE_EXTENSION:return It.ENUM;case ye.ENUM_VALUE_DEFINITION:return It.ENUM_VALUE;case ye.INPUT_OBJECT_TYPE_DEFINITION:case ye.INPUT_OBJECT_TYPE_EXTENSION:return It.INPUT_OBJECT;case ye.INPUT_VALUE_DEFINITION:{const r=t[t.length-3];return"kind"in r||Ca(!1),r.kind===ye.INPUT_OBJECT_TYPE_DEFINITION?It.INPUT_FIELD_DEFINITION:It.ARGUMENT_DEFINITION}default:Ca(!1,"Unexpected kind: "+At(e.kind))}}function EV(t){switch(t){case aa.QUERY:return It.QUERY;case aa.MUTATION:return It.MUTATION;case aa.SUBSCRIPTION:return It.SUBSCRIPTION}}function SV(t){return{FragmentSpread(e){const r=e.name.value;t.getFragment(r)||t.reportError(new He(`Unknown fragment "${r}".`,{nodes:e.name}))}}}function b9(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);for(const a of t.getDocument().definitions)Uh(a)&&(n[a.name.value]=!0);const i=[...Object.keys(r),...Object.keys(n)];return{NamedType(a,s,o,u,c){const l=a.name.value;if(!r[l]&&!n[l]){var d;const f=(d=c[2])!==null&&d!==void 0?d:o,h=f!=null&&TV(f);if(h&&fS.includes(l))return;const p=ic(l,h?fS.concat(i):i);t.reportError(new He(`Unknown type "${l}".`+Ro(p),{nodes:a}))}}}}const fS=[...z_,...V_].map(t=>t.name);function TV(t){return"kind"in t&&(pV(t)||mV(t))}function DV(t){let e=0;return{Document(r){e=r.definitions.filter(n=>n.kind===ye.OPERATION_DEFINITION).length},OperationDefinition(r){!r.name&&e>1&&t.reportError(new He("This anonymous operation must be the only defined operation.",{nodes:r}))}}}function AV(t){var e,r,n;const i=t.getSchema(),a=(e=(r=(n=i==null?void 0:i.astNode)!==null&&n!==void 0?n:i==null?void 0:i.getQueryType())!==null&&r!==void 0?r:i==null?void 0:i.getMutationType())!==null&&e!==void 0?e:i==null?void 0:i.getSubscriptionType();let s=0;return{SchemaDefinition(o){if(a){t.reportError(new He("Cannot define a new schema within a schema extension.",{nodes:o}));return}s>0&&t.reportError(new He("Must provide only one schema definition.",{nodes:o})),++s}}}const NV=3;function IV(t){function e(r,n=Object.create(null),i=0){if(r.kind===ye.FRAGMENT_SPREAD){const a=r.name.value;if(n[a]===!0)return!1;const s=t.getFragment(a);if(!s)return!1;try{return n[a]=!0,e(s,n,i)}finally{n[a]=void 0}}if(r.kind===ye.FIELD&&(r.name.value==="fields"||r.name.value==="interfaces"||r.name.value==="possibleTypes"||r.name.value==="inputFields")&&(i++,i>=NV))return!0;if("selectionSet"in r&&r.selectionSet){for(const a of r.selectionSet.selections)if(e(a,n,i))return!0}return!1}return{Field(r){if((r.name.value==="__schema"||r.name.value==="__type")&&e(r))return t.reportError(new He("Maximum introspection depth exceeded",{nodes:[r]})),!1}}}function CV(t){const e=Object.create(null),r=[],n=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(a){return i(a),!1}};function i(a){if(e[a.name.value])return;const s=a.name.value;e[s]=!0;const o=t.getFragmentSpreads(a.selectionSet);if(o.length!==0){n[s]=r.length;for(const u of o){const c=u.name.value,l=n[c];if(r.push(u),l===void 0){const d=t.getFragment(c);d&&i(d)}else{const d=r.slice(l),f=d.slice(0,-1).map(h=>'"'+h.name.value+'"').join(", ");t.reportError(new He(`Cannot spread fragment "${c}" within itself`+(f!==""?` via ${f}.`:"."),{nodes:d}))}r.pop()}n[s]=void 0}}}function OV(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(r){const n=t.getRecursiveVariableUsages(r);for(const{node:i}of n){const a=i.name.value;e[a]!==!0&&t.reportError(new He(r.name?`Variable "$${a}" is not defined by operation "${r.name.value}".`:`Variable "$${a}" is not defined.`,{nodes:[i,r]}))}}},VariableDefinition(r){e[r.variable.name.value]=!0}}}function MV(t){const e=[],r=[];return{OperationDefinition(n){return e.push(n),!1},FragmentDefinition(n){return r.push(n),!1},Document:{leave(){const n=Object.create(null);for(const i of e)for(const a of t.getRecursivelyReferencedFragments(i))n[a.name.value]=!0;for(const i of r){const a=i.name.value;n[a]!==!0&&t.reportError(new He(`Fragment "${a}" is never used.`,{nodes:i}))}}}}}function kV(t){let e=[];return{OperationDefinition:{enter(){e=[]},leave(r){const n=Object.create(null),i=t.getRecursiveVariableUsages(r);for(const{node:a}of i)n[a.name.value]=!0;for(const a of e){const s=a.variable.name.value;n[s]!==!0&&t.reportError(new He(r.name?`Variable "$${s}" is never used in operation "${r.name.value}".`:`Variable "$${s}" is never used.`,{nodes:a}))}}},VariableDefinition(r){e.push(r)}}}function H_(t){switch(t.kind){case ye.OBJECT:return{...t,fields:RV(t.fields)};case ye.LIST:return{...t,values:t.values.map(H_)};case ye.INT:case ye.FLOAT:case ye.STRING:case ye.BOOLEAN:case ye.NULL:case ye.ENUM:case ye.VARIABLE:return t}}function RV(t){return t.map(e=>({...e,value:H_(e.value)})).sort((e,r)=>$_(e.name.value,r.name.value))}function w9(t){return Array.isArray(t)?t.map(([e,r])=>`subfields "${e}" conflict because `+w9(r)).join(" and "):t}function FV(t){const e=new E9,r=new UV,n=new Map;return{SelectionSet(i){const a=PV(t,n,e,r,t.getParentType(),i);for(const[[s,o],u,c]of a){const l=w9(o);t.reportError(new He(`Fields "${s}" conflict because ${l}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:u.concat(c)}))}}}}function PV(t,e,r,n,i,a){const s=[],[o,u]=Qm(t,e,i,a);if(LV(t,s,e,r,n,o),u.length!==0)for(let c=0;c<u.length;c++){Gm(t,s,e,r,n,!1,o,u[c]);for(let l=c+1;l<u.length;l++)Xm(t,s,e,r,n,!1,u[c],u[l])}return s}function Gm(t,e,r,n,i,a,s,o){if(n.has(s,o,a))return;n.add(s,o,a);const u=t.getFragment(o);if(!u)return;const[c,l]=zb(t,r,u);if(s!==c){W_(t,e,r,n,i,a,s,c);for(const d of l)Gm(t,e,r,n,i,a,s,d)}}function Xm(t,e,r,n,i,a,s,o){if(s===o||i.has(s,o,a))return;i.add(s,o,a);const u=t.getFragment(s),c=t.getFragment(o);if(!u||!c)return;const[l,d]=zb(t,r,u),[f,h]=zb(t,r,c);W_(t,e,r,n,i,a,l,f);for(const p of h)Xm(t,e,r,n,i,a,s,p);for(const p of d)Xm(t,e,r,n,i,a,p,o)}function BV(t,e,r,n,i,a,s,o,u){const c=[],[l,d]=Qm(t,e,a,s),[f,h]=Qm(t,e,o,u);W_(t,c,e,r,n,i,l,f);for(const p of h)Gm(t,c,e,r,n,i,l,p);for(const p of d)Gm(t,c,e,r,n,i,f,p);for(const p of d)for(const m of h)Xm(t,c,e,r,n,i,p,m);return c}function LV(t,e,r,n,i,a){for(const[s,o]of Object.entries(a))if(o.length>1)for(let u=0;u<o.length;u++)for(let c=u+1;c<o.length;c++){const l=_9(t,r,n,i,!1,s,o[u],o[c]);l&&e.push(l)}}function W_(t,e,r,n,i,a,s,o){for(const[u,c]of Object.entries(s)){const l=o[u];if(l)for(const d of c)for(const f of l){const h=_9(t,r,n,i,a,u,d,f);h&&e.push(h)}}}function _9(t,e,r,n,i,a,s,o){const[u,c,l]=s,[d,f,h]=o,p=i||u!==d&&gi(u)&&gi(d);if(!p){const w=c.name.value,x=f.name.value;if(w!==x)return[[a,`"${w}" and "${x}" are different fields`],[c],[f]];if(!jV(c,f))return[[a,"they have differing arguments"],[c],[f]]}const m=l==null?void 0:l.type,y=h==null?void 0:h.type;if(m&&y&&Ub(m,y))return[[a,`they return conflicting types "${At(m)}" and "${At(y)}"`],[c],[f]];const g=c.selectionSet,v=f.selectionSet;if(g&&v){const w=BV(t,e,r,n,p,ju(m),g,ju(y),v);return $V(w,a,c,f)}}function jV(t,e){const r=t.arguments,n=e.arguments;if(r===void 0||r.length===0)return n===void 0||n.length===0;if(n===void 0||n.length===0||r.length!==n.length)return!1;const i=new Map(n.map(({name:a,value:s})=>[a.value,s]));return r.every(a=>{const s=a.value,o=i.get(a.name.value);return o===void 0?!1:hS(s)===hS(o)})}function hS(t){return Mn(H_(t))}function Ub(t,e){return zi(t)?zi(e)?Ub(t.ofType,e.ofType):!0:zi(e)?!0:on(t)?on(e)?Ub(t.ofType,e.ofType):!0:on(e)?!0:fl(t)||fl(e)?t!==e:!1}function Qm(t,e,r,n){const i=e.get(n);if(i)return i;const a=Object.create(null),s=Object.create(null);x9(t,r,n,a,s);const o=[a,Object.keys(s)];return e.set(n,o),o}function zb(t,e,r){const n=e.get(r.selectionSet);if(n)return n;const i=ds(t.getSchema(),r.typeCondition);return Qm(t,e,i,r.selectionSet)}function x9(t,e,r,n,i){for(const a of r.selections)switch(a.kind){case ye.FIELD:{const s=a.name.value;let o;(gi(e)||$n(e))&&(o=e.getFields()[s]);const u=a.alias?a.alias.value:s;n[u]||(n[u]=[]),n[u].push([e,a,o]);break}case ye.FRAGMENT_SPREAD:i[a.name.value]=!0;break;case ye.INLINE_FRAGMENT:{const s=a.typeCondition,o=s?ds(t.getSchema(),s):e;x9(t,o,a.selectionSet,n,i);break}}}function $V(t,e,r,n){if(t.length>0)return[[e,t.map(([i])=>i)],[r,...t.map(([,i])=>i).flat()],[n,...t.map(([,,i])=>i).flat()]]}class E9{constructor(){this._data=new Map}has(e,r,n){var i;const a=(i=this._data.get(e))===null||i===void 0?void 0:i.get(r);return a===void 0?!1:n?!0:n===a}add(e,r,n){const i=this._data.get(e);i===void 0?this._data.set(e,new Map([[r,n]])):i.set(r,n)}}class UV{constructor(){this._orderedPairSet=new E9}has(e,r,n){return e<r?this._orderedPairSet.has(e,r,n):this._orderedPairSet.has(r,e,n)}add(e,r,n){e<r?this._orderedPairSet.add(e,r,n):this._orderedPairSet.add(r,e,n)}}function zV(t){return{InlineFragment(e){const r=t.getType(),n=t.getParentType();if(Ef(r)&&Ef(n)&&!lS(t.getSchema(),r,n)){const i=At(n),a=At(r);t.reportError(new He(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${a}".`,{nodes:e}))}},FragmentSpread(e){const r=e.name.value,n=qV(t,r),i=t.getParentType();if(n&&i&&!lS(t.getSchema(),n,i)){const a=At(i),s=At(n);t.reportError(new He(`Fragment "${r}" cannot be spread here as objects of type "${a}" can never be of type "${s}".`,{nodes:e}))}}}}function qV(t,e){const r=t.getFragment(e);if(r){const n=ds(t.getSchema(),r.typeCondition);if(Ef(n))return n}}function VV(t){const e=t.getSchema(),r=Object.create(null);for(const i of t.getDocument().definitions)Uh(i)&&(r[i.name.value]=i);return{ScalarTypeExtension:n,ObjectTypeExtension:n,InterfaceTypeExtension:n,UnionTypeExtension:n,EnumTypeExtension:n,InputObjectTypeExtension:n};function n(i){const a=i.name.value,s=r[a],o=e==null?void 0:e.getType(a);let u;if(s?u=ZV[s.kind]:o&&(u=HV(o)),u){if(u!==i.kind){const c=WV(i.kind);t.reportError(new He(`Cannot extend non-${c} type "${a}".`,{nodes:s?[s,i]:i}))}}else{const c=Object.keys({...r,...e==null?void 0:e.getTypeMap()}),l=ic(a,c);t.reportError(new He(`Cannot extend type "${a}" because it is not defined.`+Ro(l),{nodes:i.name}))}}}const ZV={[ye.SCALAR_TYPE_DEFINITION]:ye.SCALAR_TYPE_EXTENSION,[ye.OBJECT_TYPE_DEFINITION]:ye.OBJECT_TYPE_EXTENSION,[ye.INTERFACE_TYPE_DEFINITION]:ye.INTERFACE_TYPE_EXTENSION,[ye.UNION_TYPE_DEFINITION]:ye.UNION_TYPE_EXTENSION,[ye.ENUM_TYPE_DEFINITION]:ye.ENUM_TYPE_EXTENSION,[ye.INPUT_OBJECT_TYPE_DEFINITION]:ye.INPUT_OBJECT_TYPE_EXTENSION};function HV(t){if(Hl(t))return ye.SCALAR_TYPE_EXTENSION;if(gi(t))return ye.OBJECT_TYPE_EXTENSION;if($n(t))return ye.INTERFACE_TYPE_EXTENSION;if(Vs(t))return ye.UNION_TYPE_EXTENSION;if(Zs(t))return ye.ENUM_TYPE_EXTENSION;if(Ui(t))return ye.INPUT_OBJECT_TYPE_EXTENSION;Ca(!1,"Unexpected type: "+At(t))}function WV(t){switch(t){case ye.SCALAR_TYPE_EXTENSION:return"scalar";case ye.OBJECT_TYPE_EXTENSION:return"object";case ye.INTERFACE_TYPE_EXTENSION:return"interface";case ye.UNION_TYPE_EXTENSION:return"union";case ye.ENUM_TYPE_EXTENSION:return"enum";case ye.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:Ca(!1,"Unexpected kind: "+At(t))}}function YV(t){return{...S9(t),Field:{leave(e){var r;const n=t.getFieldDef();if(!n)return!1;const i=new Set((r=e.arguments)===null||r===void 0?void 0:r.map(a=>a.name.value));for(const a of n.args)if(!i.has(a.name)&&a9(a)){const s=At(a.type);t.reportError(new He(`Field "${n.name}" argument "${a.name}" of type "${s}" is required, but it was not provided.`,{nodes:e}))}}}}}function S9(t){var e;const r=Object.create(null),n=t.getSchema(),i=(e=n==null?void 0:n.getDirectives())!==null&&e!==void 0?e:Wl;for(const o of i)r[o.name]=Lu(o.args.filter(a9),u=>u.name);const a=t.getDocument().definitions;for(const o of a)if(o.kind===ye.DIRECTIVE_DEFINITION){var s;const u=(s=o.arguments)!==null&&s!==void 0?s:[];r[o.name.value]=Lu(u.filter(JV),c=>c.name.value)}return{Directive:{leave(o){const u=o.name.value,c=r[u];if(c){var l;const d=(l=o.arguments)!==null&&l!==void 0?l:[],f=new Set(d.map(h=>h.name.value));for(const[h,p]of Object.entries(c))if(!f.has(h)){const m=U_(p.type)?At(p.type):Mn(p.type);t.reportError(new He(`Directive "@${u}" argument "${h}" of type "${m}" is required, but it was not provided.`,{nodes:o}))}}}}}}function JV(t){return t.type.kind===ye.NON_NULL_TYPE&&t.defaultValue==null}function KV(t){return{Field(e){const r=t.getType(),n=e.selectionSet;if(r)if(fl(ju(r))){if(n){const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" must not have a selection since type "${a}" has no subfields.`,{nodes:n}))}}else if(n){if(n.selections.length===0){const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" of type "${a}" must have at least one field selected.`,{nodes:e}))}}else{const i=e.name.value,a=At(r);t.reportError(new He(`Field "${i}" of type "${a}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:e}))}}}}function wu(t,e,r){if(t){if(t.kind===ye.VARIABLE){const n=t.name.value;if(r==null||r[n]===void 0)return;const i=r[n];return i===null&&on(e)?void 0:i}if(on(e))return t.kind===ye.NULL?void 0:wu(t,e.ofType,r);if(t.kind===ye.NULL)return null;if(zi(e)){const n=e.ofType;if(t.kind===ye.LIST){const a=[];for(const s of t.values)if(pS(s,r)){if(on(n))return;a.push(null)}else{const o=wu(s,n,r);if(o===void 0)return;a.push(o)}return a}const i=wu(t,n,r);return i===void 0?void 0:[i]}if(Ui(e)){if(t.kind!==ye.OBJECT)return;const n=Object.create(null),i=Lu(t.fields,a=>a.name.value);for(const a of Object.values(e.getFields())){const s=i[a.name];if(!s||pS(s.value,r)){if(a.defaultValue!==void 0)n[a.name]=a.defaultValue;else if(on(a.type))return;continue}const o=wu(s.value,a.type,r);if(o===void 0)return;n[a.name]=o}if(e.isOneOf){const a=Object.keys(n);if(a.length!==1||n[a[0]]===null)return}return n}if(fl(e)){let n;try{n=e.parseLiteral(t,r)}catch{return}return n===void 0?void 0:n}Ca(!1,"Unexpected input type: "+At(e))}}function pS(t,e){return t.kind===ye.VARIABLE&&(e==null||e[t.name.value]===void 0)}function GV(t,e,r){var n;const i={},a=(n=e.arguments)!==null&&n!==void 0?n:[],s=Lu(a,o=>o.name.value);for(const o of t.args){const u=o.name,c=o.type,l=s[u];if(!l){if(o.defaultValue!==void 0)i[u]=o.defaultValue;else if(on(c))throw new He(`Argument "${u}" of required type "${At(c)}" was not provided.`,{nodes:e});continue}const d=l.value;let f=d.kind===ye.NULL;if(d.kind===ye.VARIABLE){const p=d.name.value;if(r==null||!XV(r,p)){if(o.defaultValue!==void 0)i[u]=o.defaultValue;else if(on(c))throw new He(`Argument "${u}" of required type "${At(c)}" was provided the variable "$${p}" which was not provided a runtime value.`,{nodes:d});continue}f=r[p]==null}if(f&&on(c))throw new He(`Argument "${u}" of non-null type "${At(c)}" must not be null.`,{nodes:d});const h=wu(d,c,r);if(h===void 0)throw new He(`Argument "${u}" has invalid value ${Mn(d)}.`,{nodes:d});i[u]=h}return i}function Tf(t,e,r){var n;const i=(n=e.directives)===null||n===void 0?void 0:n.find(a=>a.name.value===t.name);if(i)return GV(t,i,r)}function XV(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function QV(t,e,r,n,i){const a=new Map;return qb(t,e,r,n,i,a,new Set),a}function qb(t,e,r,n,i,a,s){for(const o of i.selections)switch(o.kind){case ye.FIELD:{if(!r1(r,o))continue;const u=eZ(o),c=a.get(u);c!==void 0?c.push(o):a.set(u,[o]);break}case ye.INLINE_FRAGMENT:{if(!r1(r,o)||!mS(t,o,n))continue;qb(t,e,r,n,o.selectionSet,a,s);break}case ye.FRAGMENT_SPREAD:{const u=o.name.value;if(s.has(u)||!r1(r,o))continue;s.add(u);const c=e[u];if(!c||!mS(t,c,n))continue;qb(t,e,r,n,c.selectionSet,a,s);break}}}function r1(t,e){const r=Tf(u9,e,t);if((r==null?void 0:r.if)===!0)return!1;const n=Tf(o9,e,t);return(n==null?void 0:n.if)!==!1}function mS(t,e,r){const n=e.typeCondition;if(!n)return!0;const i=ds(t,n);return i===r?!0:Nu(i)?t.isSubType(i,r):!1}function eZ(t){return t.alias?t.alias.value:t.name.value}function tZ(t){return{OperationDefinition(e){if(e.operation==="subscription"){const r=t.getSchema(),n=r.getSubscriptionType();if(n){const i=e.name?e.name.value:null,a=Object.create(null),s=t.getDocument(),o=Object.create(null);for(const c of s.definitions)c.kind===ye.FRAGMENT_DEFINITION&&(o[c.name.value]=c);const u=QV(r,o,a,n,e.selectionSet);if(u.size>1){const d=[...u.values()].slice(1).flat();t.reportError(new He(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:d}))}for(const c of u.values())c[0].name.value.startsWith("__")&&t.reportError(new He(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:c}))}}}}}function Y_(t,e){const r=new Map;for(const n of t){const i=e(n),a=r.get(i);a===void 0?r.set(i,[n]):a.push(n)}return r}function rZ(t){return{DirectiveDefinition(n){var i;const a=(i=n.arguments)!==null&&i!==void 0?i:[];return r(`@${n.name.value}`,a)},InterfaceTypeDefinition:e,InterfaceTypeExtension:e,ObjectTypeDefinition:e,ObjectTypeExtension:e};function e(n){var i;const a=n.name.value,s=(i=n.fields)!==null&&i!==void 0?i:[];for(const u of s){var o;const c=u.name.value,l=(o=u.arguments)!==null&&o!==void 0?o:[];r(`${a}.${c}`,l)}return!1}function r(n,i){const a=Y_(i,s=>s.name.value);for(const[s,o]of a)o.length>1&&t.reportError(new He(`Argument "${n}(${s}:)" can only be defined once.`,{nodes:o.map(u=>u.name)}));return!1}}function T9(t){return{Field:e,Directive:e};function e(r){var n;const i=(n=r.arguments)!==null&&n!==void 0?n:[],a=Y_(i,s=>s.name.value);for(const[s,o]of a)o.length>1&&t.reportError(new He(`There can be only one argument named "${s}".`,{nodes:o.map(u=>u.name)}))}}function nZ(t){const e=Object.create(null),r=t.getSchema();return{DirectiveDefinition(n){const i=n.name.value;if(r!=null&&r.getDirective(i)){t.reportError(new He(`Directive "@${i}" already exists in the schema. It cannot be redefined.`,{nodes:n.name}));return}return e[i]?t.reportError(new He(`There can be only one directive named "@${i}".`,{nodes:[e[i],n.name]})):e[i]=n.name,!1}}}function D9(t){const e=Object.create(null),r=t.getSchema(),n=r?r.getDirectives():Wl;for(const o of n)e[o.name]=!o.isRepeatable;const i=t.getDocument().definitions;for(const o of i)o.kind===ye.DIRECTIVE_DEFINITION&&(e[o.name.value]=!o.repeatable);const a=Object.create(null),s=Object.create(null);return{enter(o){if(!("directives"in o)||!o.directives)return;let u;if(o.kind===ye.SCHEMA_DEFINITION||o.kind===ye.SCHEMA_EXTENSION)u=a;else if(Uh(o)||Z_(o)){const c=o.name.value;u=s[c],u===void 0&&(s[c]=u=Object.create(null))}else u=Object.create(null);for(const c of o.directives){const l=c.name.value;e[l]&&(u[l]?t.reportError(new He(`The directive "@${l}" can only be used once at this location.`,{nodes:[u[l],c]})):u[l]=c)}}}}function iZ(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(a){var s;const o=a.name.value;n[o]||(n[o]=Object.create(null));const u=(s=a.values)!==null&&s!==void 0?s:[],c=n[o];for(const l of u){const d=l.name.value,f=r[o];Zs(f)&&f.getValue(d)?t.reportError(new He(`Enum value "${o}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:l.name})):c[d]?t.reportError(new He(`Enum value "${o}.${d}" can only be defined once.`,{nodes:[c[d],l.name]})):c[d]=l.name}return!1}}function aZ(t){const e=t.getSchema(),r=e?e.getTypeMap():Object.create(null),n=Object.create(null);return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(a){var s;const o=a.name.value;n[o]||(n[o]=Object.create(null));const u=(s=a.fields)!==null&&s!==void 0?s:[],c=n[o];for(const l of u){const d=l.name.value;sZ(r[o],d)?t.reportError(new He(`Field "${o}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:l.name})):c[d]?t.reportError(new He(`Field "${o}.${d}" can only be defined once.`,{nodes:[c[d],l.name]})):c[d]=l.name}return!1}}function sZ(t,e){return gi(t)||$n(t)||Ui(t)?t.getFields()[e]!=null:!1}function oZ(t){const e=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(r){const n=r.name.value;return e[n]?t.reportError(new He(`There can be only one fragment named "${n}".`,{nodes:[e[n],r.name]})):e[n]=r.name,!1}}}function A9(t){const e=[];let r=Object.create(null);return{ObjectValue:{enter(){e.push(r),r=Object.create(null)},leave(){const n=e.pop();n||Ca(!1),r=n}},ObjectField(n){const i=n.name.value;r[i]?t.reportError(new He(`There can be only one input field named "${i}".`,{nodes:[r[i],n.name]})):r[i]=n.name}}}function uZ(t){const e=Object.create(null);return{OperationDefinition(r){const n=r.name;return n&&(e[n.value]?t.reportError(new He(`There can be only one operation named "${n.value}".`,{nodes:[e[n.value],n]})):e[n.value]=n),!1},FragmentDefinition:()=>!1}}function cZ(t){const e=t.getSchema(),r=Object.create(null),n=e?{query:e.getQueryType(),mutation:e.getMutationType(),subscription:e.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(a){var s;const o=(s=a.operationTypes)!==null&&s!==void 0?s:[];for(const u of o){const c=u.operation,l=r[c];n[c]?t.reportError(new He(`Type for ${c} already defined in the schema. It cannot be redefined.`,{nodes:u})):l?t.reportError(new He(`There can be only one ${c} type in schema.`,{nodes:[l,u]})):r[c]=u}return!1}}function lZ(t){const e=Object.create(null),r=t.getSchema();return{ScalarTypeDefinition:n,ObjectTypeDefinition:n,InterfaceTypeDefinition:n,UnionTypeDefinition:n,EnumTypeDefinition:n,InputObjectTypeDefinition:n};function n(i){const a=i.name.value;if(r!=null&&r.getType(a)){t.reportError(new He(`Type "${a}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:i.name}));return}return e[a]?t.reportError(new He(`There can be only one type named "${a}".`,{nodes:[e[a],i.name]})):e[a]=i.name,!1}}function dZ(t){return{OperationDefinition(e){var r;const n=(r=e.variableDefinitions)!==null&&r!==void 0?r:[],i=Y_(n,a=>a.variable.name.value);for(const[a,s]of i)s.length>1&&t.reportError(new He(`There can be only one variable named "$${a}".`,{nodes:s.map(o=>o.variable.name)}))}}}function fZ(t){let e={};return{OperationDefinition:{enter(){e={}}},VariableDefinition(r){e[r.variable.name.value]=r},ListValue(r){const n=tV(t.getParentInputType());if(!zi(n))return cu(t,r),!1},ObjectValue(r){const n=ju(t.getInputType());if(!Ui(n))return cu(t,r),!1;const i=Lu(r.fields,a=>a.name.value);for(const a of Object.values(n.getFields()))if(!i[a.name]&&iV(a)){const o=At(a.type);t.reportError(new He(`Field "${n.name}.${a.name}" of required type "${o}" was not provided.`,{nodes:r}))}n.isOneOf&&hZ(t,r,n,i,e)},ObjectField(r){const n=ju(t.getParentInputType());if(!t.getInputType()&&Ui(n)){const a=ic(r.name.value,Object.keys(n.getFields()));t.reportError(new He(`Field "${r.name.value}" is not defined by type "${n.name}".`+Ro(a),{nodes:r}))}},NullValue(r){const n=t.getInputType();on(n)&&t.reportError(new He(`Expected value of type "${At(n)}", found ${Mn(r)}.`,{nodes:r}))},EnumValue:r=>cu(t,r),IntValue:r=>cu(t,r),FloatValue:r=>cu(t,r),StringValue:r=>cu(t,r),BooleanValue:r=>cu(t,r)}}function cu(t,e){const r=t.getInputType();if(!r)return;const n=ju(r);if(!fl(n)){const i=At(r);t.reportError(new He(`Expected value of type "${i}", found ${Mn(e)}.`,{nodes:e}));return}try{if(n.parseLiteral(e,void 0)===void 0){const a=At(r);t.reportError(new He(`Expected value of type "${a}", found ${Mn(e)}.`,{nodes:e}))}}catch(i){const a=At(r);i instanceof He?t.reportError(i):t.reportError(new He(`Expected value of type "${a}", found ${Mn(e)}; `+i.message,{nodes:e,originalError:i}))}}function hZ(t,e,r,n,i){var a;const s=Object.keys(n);if(s.length!==1){t.reportError(new He(`OneOf Input Object "${r.name}" must specify exactly one key.`,{nodes:[e]}));return}const u=(a=n[s[0]])===null||a===void 0?void 0:a.value,c=!u||u.kind===ye.NULL,l=(u==null?void 0:u.kind)===ye.VARIABLE;if(c){t.reportError(new He(`Field "${r.name}.${s[0]}" must be non-null.`,{nodes:[e]}));return}if(l){const d=u.name.value;i[d].type.kind!==ye.NON_NULL_TYPE&&t.reportError(new He(`Variable "${d}" must be non-nullable to be used for OneOf Input Object "${r.name}".`,{nodes:[e]}))}}function pZ(t){return{VariableDefinition(e){const r=ds(t.getSchema(),e.type);if(r!==void 0&&!KI(r)){const n=e.variable.name.value,i=Mn(e.type);t.reportError(new He(`Variable "$${n}" cannot be non-input type "${i}".`,{nodes:e.type}))}}}}function mZ(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(r){const n=t.getRecursiveVariableUsages(r);for(const{node:i,type:a,defaultValue:s}of n){const o=i.name.value,u=e[o];if(u&&a){const c=t.getSchema(),l=ds(c,u.type);if(l&&!gZ(c,l,u.defaultValue,a,s)){const d=At(l),f=At(a);t.reportError(new He(`Variable "$${o}" of type "${d}" used in position expecting type "${f}".`,{nodes:[u,i]}))}}}}},VariableDefinition(r){e[r.variable.name.value]=r}}}function gZ(t,e,r,n,i){if(on(n)&&!on(e)){if(!(r!=null&&r.kind!==ye.NULL)&&!(i!==void 0))return!1;const o=n.ofType;return rf(t,e,o)}return rf(t,e,n)}const yZ=Object.freeze([IV]);Object.freeze([gV,uZ,DV,tZ,b9,wV,pZ,KV,yV,oZ,SV,MV,zV,CV,dZ,OV,kV,v9,D9,_V,T9,fZ,YV,mZ,FV,A9,...yZ]);const vZ=Object.freeze([AV,cZ,lZ,iZ,aZ,rZ,nZ,b9,v9,D9,VV,y9,T9,A9,S9]);class bZ{constructor(e,r){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=r}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let r;if(this._fragments)r=this._fragments;else{r=Object.create(null);for(const n of this.getDocument().definitions)n.kind===ye.FRAGMENT_DEFINITION&&(r[n.name.value]=n);this._fragments=r}return r[e]}getFragmentSpreads(e){let r=this._fragmentSpreads.get(e);if(!r){r=[];const n=[e];let i;for(;i=n.pop();)for(const a of i.selections)a.kind===ye.FRAGMENT_SPREAD?r.push(a):a.selectionSet&&n.push(a.selectionSet);this._fragmentSpreads.set(e,r)}return r}getRecursivelyReferencedFragments(e){let r=this._recursivelyReferencedFragments.get(e);if(!r){r=[];const n=Object.create(null),i=[e.selectionSet];let a;for(;a=i.pop();)for(const s of this.getFragmentSpreads(a)){const o=s.name.value;if(n[o]!==!0){n[o]=!0;const u=this.getFragment(o);u&&(r.push(u),i.push(u.selectionSet))}}this._recursivelyReferencedFragments.set(e,r)}return r}}class wZ extends bZ{constructor(e,r,n){super(e,n),this._schema=r}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}function _Z(t,e,r=vZ){const n=[],i=new wZ(t,e,s=>{n.push(s)}),a=r.map(s=>s(i));return YI(t,Kq(a)),n}function xZ(t){const e=_Z(t);if(e.length!==0)throw new Error(e.map(r=>r.message).join(`
53
53
 
54
- `))}function EZ(t,e,r){var n,i,a,s;const o=[],u=Object.create(null),c=[];let l;const d=[];for(const L of e.definitions)if(L.kind===ye.SCHEMA_DEFINITION)l=L;else if(L.kind===ye.SCHEMA_EXTENSION)d.push(L);else if(Uh(L))o.push(L);else if(Z_(L)){const q=L.name.value,J=u[q];u[q]=J?J.concat([L]):[L]}else L.kind===ye.DIRECTIVE_DEFINITION&&c.push(L);if(Object.keys(u).length===0&&o.length===0&&c.length===0&&d.length===0&&l==null)return t;const f=Object.create(null);for(const L of t.types)f[L.name]=v(L);for(const L of o){var h;const q=L.name.value;f[q]=(h=gS[q])!==null&&h!==void 0?h:R(L)}const p={query:t.query&&y(t.query),mutation:t.mutation&&y(t.mutation),subscription:t.subscription&&y(t.subscription),...l&&T([l]),...T(d)};return{description:(n=l)===null||n===void 0||(i=n.description)===null||i===void 0?void 0:i.value,...p,types:Object.values(f),directives:[...t.directives.map(g),...c.map(E)],extensions:Object.create(null),astNode:(a=l)!==null&&a!==void 0?a:t.astNode,extensionASTNodes:t.extensionASTNodes.concat(d),assumeValid:(s=r==null?void 0:r.assumeValid)!==null&&s!==void 0?s:!1};function m(L){return zi(L)?new hi(m(L.ofType)):on(L)?new dr(m(L.ofType)):y(L)}function y(L){return f[L.name]}function g(L){const q=L.toConfig();return new Fo({...q,args:Fs(q.args,$)})}function v(L){if(dV(L)||oV(L))return L;if(Hl(L))return _(L);if(gi(L))return A(L);if(Un(L))return M(L);if(Vs(L))return F(L);if(Zs(L))return x(L);if(Ui(L))return w(L);Ca(!1,"Unexpected type: "+At(L))}function w(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new $b({...J,fields:()=>({...Fs(J.fields,ie=>({...ie,type:m(ie.type)})),...I(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function x(L){var q;const J=L.toConfig(),G=(q=u[L.name])!==null&&q!==void 0?q:[];return new Sf({...J,values:{...J.values,...O(G)},extensionASTNodes:J.extensionASTNodes.concat(G)})}function _(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];let ie=J.specifiedByURL;for(const V of G){var z;ie=(z=yS(V))!==null&&z!==void 0?z:ie}return new Hs({...J,specifiedByURL:ie,extensionASTNodes:J.extensionASTNodes.concat(G)})}function A(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new sa({...J,interfaces:()=>[...L.getInterfaces().map(y),...S(G)],fields:()=>({...Fs(J.fields,k),...D(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function M(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new jb({...J,interfaces:()=>[...L.getInterfaces().map(y),...S(G)],fields:()=>({...Fs(J.fields,k),...D(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function F(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new el({...J,types:()=>[...L.getTypes().map(y),...P(G)],extensionASTNodes:J.extensionASTNodes.concat(G)})}function k(L){return{...L,type:m(L.type),args:L.args&&Fs(L.args,$)}}function $(L){return{...L,type:m(L.type)}}function T(L){const q={};for(const G of L){var J;const ie=(J=G.operationTypes)!==null&&J!==void 0?J:[];for(const z of ie)q[z.operation]=N(z.type)}return q}function N(L){var q;const J=L.name.value,G=(q=gS[J])!==null&&q!==void 0?q:f[J];if(G===void 0)throw new Error(`Unknown type: "${J}".`);return G}function b(L){return L.kind===ye.LIST_TYPE?new hi(b(L.type)):L.kind===ye.NON_NULL_TYPE?new dr(b(L.type)):N(L)}function E(L){var q;return new Fo({name:L.name.value,description:(q=L.description)===null||q===void 0?void 0:q.value,locations:L.locations.map(({value:J})=>J),isRepeatable:L.repeatable,args:C(L.arguments),astNode:L})}function D(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.fields)!==null&&J!==void 0?J:[];for(const V of z){var G;q[V.name.value]={type:b(V.type),description:(G=V.description)===null||G===void 0?void 0:G.value,args:C(V.arguments),deprecationReason:Tp(V),astNode:V}}}return q}function C(L){const q=L??[],J=Object.create(null);for(const ie of q){var G;const z=b(ie.type);J[ie.name.value]={type:z,description:(G=ie.description)===null||G===void 0?void 0:G.value,defaultValue:wu(ie.defaultValue,z),deprecationReason:Tp(ie),astNode:ie}}return J}function I(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.fields)!==null&&J!==void 0?J:[];for(const V of z){var G;const Q=b(V.type);q[V.name.value]={type:Q,description:(G=V.description)===null||G===void 0?void 0:G.value,defaultValue:wu(V.defaultValue,Q),deprecationReason:Tp(V),astNode:V}}}return q}function O(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.values)!==null&&J!==void 0?J:[];for(const V of z){var G;q[V.name.value]={description:(G=V.description)===null||G===void 0?void 0:G.value,deprecationReason:Tp(V),astNode:V}}}return q}function S(L){return L.flatMap(q=>{var J,G;return(J=(G=q.interfaces)===null||G===void 0?void 0:G.map(N))!==null&&J!==void 0?J:[]})}function P(L){return L.flatMap(q=>{var J,G;return(J=(G=q.types)===null||G===void 0?void 0:G.map(N))!==null&&J!==void 0?J:[]})}function R(L){var q;const J=L.name.value,G=(q=u[J])!==null&&q!==void 0?q:[];switch(L.kind){case ye.OBJECT_TYPE_DEFINITION:{var ie;const le=[L,...G];return new sa({name:J,description:(ie=L.description)===null||ie===void 0?void 0:ie.value,interfaces:()=>S(le),fields:()=>D(le),astNode:L,extensionASTNodes:G})}case ye.INTERFACE_TYPE_DEFINITION:{var z;const le=[L,...G];return new jb({name:J,description:(z=L.description)===null||z===void 0?void 0:z.value,interfaces:()=>S(le),fields:()=>D(le),astNode:L,extensionASTNodes:G})}case ye.ENUM_TYPE_DEFINITION:{var V;const le=[L,...G];return new Sf({name:J,description:(V=L.description)===null||V===void 0?void 0:V.value,values:O(le),astNode:L,extensionASTNodes:G})}case ye.UNION_TYPE_DEFINITION:{var Q;const le=[L,...G];return new el({name:J,description:(Q=L.description)===null||Q===void 0?void 0:Q.value,types:()=>P(le),astNode:L,extensionASTNodes:G})}case ye.SCALAR_TYPE_DEFINITION:{var ae;return new Hs({name:J,description:(ae=L.description)===null||ae===void 0?void 0:ae.value,specifiedByURL:yS(L),astNode:L,extensionASTNodes:G})}case ye.INPUT_OBJECT_TYPE_DEFINITION:{var oe;const le=[L,...G];return new $b({name:J,description:(oe=L.description)===null||oe===void 0?void 0:oe.value,fields:()=>I(le),astNode:L,extensionASTNodes:G,isOneOf:SZ(L)})}}}}const gS=Lu([...z_,...V_],t=>t.name);function Tp(t){const e=Tf(c9,t);return e==null?void 0:e.reason}function yS(t){const e=Tf(l9,t);return e==null?void 0:e.url}function SZ(t){return!!Tf(d9,t)}function TZ(t,e){t!=null&&t.kind===ye.DOCUMENT||Fr(!1,"Must provide valid Document AST."),(e==null?void 0:e.assumeValid)!==!0&&(e==null?void 0:e.assumeValidSDL)!==!0&&xZ(t);const n=EZ({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},t,e);if(n.astNode==null)for(const a of n.types)switch(a.name){case"Query":n.query=a;break;case"Mutation":n.mutation=a;break;case"Subscription":n.subscription=a;break}const i=[...n.directives,...Wl.filter(a=>n.directives.every(s=>s.name!==a.name))];return new fV({...n,directives:i})}function DZ(t,e){const r=HI(t,{noLocation:void 0,allowLegacyFragmentVariables:void 0});return TZ(r,{assumeValidSDL:void 0,assumeValid:void 0})}const J_=JSON,AZ=t=>t.toUpperCase(),NZ=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},IZ=(t,e,r)=>t.document?t:{document:t,variables:e,requestHeaders:r,signal:void 0},CZ=(t,e,r)=>t.query?t:{query:t,variables:e,requestHeaders:r,signal:void 0},OZ=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0},vS=t=>{var n,i;let e;const r=t.definitions.filter(a=>a.kind==="OperationDefinition");return r.length===1&&(e=(i=(n=r[0])==null?void 0:n.name)==null?void 0:i.value),e},n1=t=>{if(typeof t=="string"){let r;try{const n=HI(t);r=vS(n)}catch{}return{query:t,operationName:r}}const e=vS(t);return{query:Mn(t),operationName:e}};class tl extends Error{constructor(e,r){const n=`${tl.extractMessage(e)}: ${JSON.stringify({response:e,request:r})}`;super(n),Object.setPrototypeOf(this,tl.prototype),this.response=e,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,tl)}static extractMessage(e){var r,n;return((n=(r=e.errors)==null?void 0:r[0])==null?void 0:n.message)??`GraphQL Error (Code: ${e.status})`}}var Vb={exports:{}};(function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof ia<"u"&&ia,n=function(){function a(){this.fetch=!1,this.DOMException=r.DOMException}return a.prototype=r,new a}();(function(a){(function(s){var o=typeof a<"u"&&a||typeof self<"u"&&self||typeof ia<"u"&&ia||{},u={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function c(D){return D&&DataView.prototype.isPrototypeOf(D)}if(u.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(D){return D&&l.indexOf(Object.prototype.toString.call(D))>-1};function f(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function h(D){return typeof D!="string"&&(D=String(D)),D}function p(D){var C={next:function(){var I=D.shift();return{done:I===void 0,value:I}}};return u.iterable&&(C[Symbol.iterator]=function(){return C}),C}function m(D){this.map={},D instanceof m?D.forEach(function(C,I){this.append(I,C)},this):Array.isArray(D)?D.forEach(function(C){if(C.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+C.length);this.append(C[0],C[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(C){this.append(C,D[C])},this)}m.prototype.append=function(D,C){D=f(D),C=h(C);var I=this.map[D];this.map[D]=I?I+", "+C:C},m.prototype.delete=function(D){delete this.map[f(D)]},m.prototype.get=function(D){return D=f(D),this.has(D)?this.map[D]:null},m.prototype.has=function(D){return this.map.hasOwnProperty(f(D))},m.prototype.set=function(D,C){this.map[f(D)]=h(C)},m.prototype.forEach=function(D,C){for(var I in this.map)this.map.hasOwnProperty(I)&&D.call(C,this.map[I],I,this)},m.prototype.keys=function(){var D=[];return this.forEach(function(C,I){D.push(I)}),p(D)},m.prototype.values=function(){var D=[];return this.forEach(function(C){D.push(C)}),p(D)},m.prototype.entries=function(){var D=[];return this.forEach(function(C,I){D.push([I,C])}),p(D)},u.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function y(D){if(!D._noBody){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}}function g(D){return new Promise(function(C,I){D.onload=function(){C(D.result)},D.onerror=function(){I(D.error)}})}function v(D){var C=new FileReader,I=g(C);return C.readAsArrayBuffer(D),I}function w(D){var C=new FileReader,I=g(C),O=/charset=([A-Za-z0-9_-]+)/.exec(D.type),S=O?O[1]:"utf-8";return C.readAsText(D,S),I}function x(D){for(var C=new Uint8Array(D),I=new Array(C.length),O=0;O<C.length;O++)I[O]=String.fromCharCode(C[O]);return I.join("")}function _(D){if(D.slice)return D.slice(0);var C=new Uint8Array(D.byteLength);return C.set(new Uint8Array(D)),C.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:u.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:u.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():u.arrayBuffer&&u.blob&&c(D)?(this._bodyArrayBuffer=_(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||d(D))?this._bodyArrayBuffer=_(D):this._bodyText=D=Object.prototype.toString.call(D):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var D=y(this);if(D)return D;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var D=y(this);return D||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(u.blob)return this.blob().then(v);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var D=y(this);if(D)return D;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(x(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}var M=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(D){var C=D.toUpperCase();return M.indexOf(C)>-1?C:D}function k(D,C){if(!(this instanceof k))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');C=C||{};var I=C.body;if(D instanceof k){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,C.headers||(this.headers=new m(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!I&&D._bodyInit!=null&&(I=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=C.credentials||this.credentials||"same-origin",(C.headers||!this.headers)&&(this.headers=new m(C.headers)),this.method=F(C.method||this.method||"GET"),this.mode=C.mode||this.mode||null,this.signal=C.signal||this.signal||function(){if("AbortController"in o){var P=new AbortController;return P.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(I),(this.method==="GET"||this.method==="HEAD")&&(C.cache==="no-store"||C.cache==="no-cache")){var O=/([?&])_=[^&]*/;if(O.test(this.url))this.url=this.url.replace(O,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function $(D){var C=new FormData;return D.trim().split("&").forEach(function(I){if(I){var O=I.split("="),S=O.shift().replace(/\+/g," "),P=O.join("=").replace(/\+/g," ");C.append(decodeURIComponent(S),decodeURIComponent(P))}}),C}function T(D){var C=new m,I=D.replace(/\r?\n[\t ]+/g," ");return I.split("\r").map(function(O){return O.indexOf(`
54
+ `))}function EZ(t,e,r){var n,i,a,s;const o=[],u=Object.create(null),c=[];let l;const d=[];for(const L of e.definitions)if(L.kind===ye.SCHEMA_DEFINITION)l=L;else if(L.kind===ye.SCHEMA_EXTENSION)d.push(L);else if(Uh(L))o.push(L);else if(Z_(L)){const q=L.name.value,J=u[q];u[q]=J?J.concat([L]):[L]}else L.kind===ye.DIRECTIVE_DEFINITION&&c.push(L);if(Object.keys(u).length===0&&o.length===0&&c.length===0&&d.length===0&&l==null)return t;const f=Object.create(null);for(const L of t.types)f[L.name]=v(L);for(const L of o){var h;const q=L.name.value;f[q]=(h=gS[q])!==null&&h!==void 0?h:R(L)}const p={query:t.query&&y(t.query),mutation:t.mutation&&y(t.mutation),subscription:t.subscription&&y(t.subscription),...l&&T([l]),...T(d)};return{description:(n=l)===null||n===void 0||(i=n.description)===null||i===void 0?void 0:i.value,...p,types:Object.values(f),directives:[...t.directives.map(g),...c.map(E)],extensions:Object.create(null),astNode:(a=l)!==null&&a!==void 0?a:t.astNode,extensionASTNodes:t.extensionASTNodes.concat(d),assumeValid:(s=r==null?void 0:r.assumeValid)!==null&&s!==void 0?s:!1};function m(L){return zi(L)?new hi(m(L.ofType)):on(L)?new dr(m(L.ofType)):y(L)}function y(L){return f[L.name]}function g(L){const q=L.toConfig();return new Fo({...q,args:Fs(q.args,$)})}function v(L){if(dV(L)||oV(L))return L;if(Hl(L))return _(L);if(gi(L))return A(L);if($n(L))return M(L);if(Vs(L))return F(L);if(Zs(L))return x(L);if(Ui(L))return w(L);Ca(!1,"Unexpected type: "+At(L))}function w(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new $b({...J,fields:()=>({...Fs(J.fields,ie=>({...ie,type:m(ie.type)})),...I(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function x(L){var q;const J=L.toConfig(),G=(q=u[L.name])!==null&&q!==void 0?q:[];return new Sf({...J,values:{...J.values,...O(G)},extensionASTNodes:J.extensionASTNodes.concat(G)})}function _(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];let ie=J.specifiedByURL;for(const V of G){var z;ie=(z=yS(V))!==null&&z!==void 0?z:ie}return new Hs({...J,specifiedByURL:ie,extensionASTNodes:J.extensionASTNodes.concat(G)})}function A(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new sa({...J,interfaces:()=>[...L.getInterfaces().map(y),...S(G)],fields:()=>({...Fs(J.fields,k),...D(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function M(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new jb({...J,interfaces:()=>[...L.getInterfaces().map(y),...S(G)],fields:()=>({...Fs(J.fields,k),...D(G)}),extensionASTNodes:J.extensionASTNodes.concat(G)})}function F(L){var q;const J=L.toConfig(),G=(q=u[J.name])!==null&&q!==void 0?q:[];return new el({...J,types:()=>[...L.getTypes().map(y),...P(G)],extensionASTNodes:J.extensionASTNodes.concat(G)})}function k(L){return{...L,type:m(L.type),args:L.args&&Fs(L.args,$)}}function $(L){return{...L,type:m(L.type)}}function T(L){const q={};for(const G of L){var J;const ie=(J=G.operationTypes)!==null&&J!==void 0?J:[];for(const z of ie)q[z.operation]=N(z.type)}return q}function N(L){var q;const J=L.name.value,G=(q=gS[J])!==null&&q!==void 0?q:f[J];if(G===void 0)throw new Error(`Unknown type: "${J}".`);return G}function b(L){return L.kind===ye.LIST_TYPE?new hi(b(L.type)):L.kind===ye.NON_NULL_TYPE?new dr(b(L.type)):N(L)}function E(L){var q;return new Fo({name:L.name.value,description:(q=L.description)===null||q===void 0?void 0:q.value,locations:L.locations.map(({value:J})=>J),isRepeatable:L.repeatable,args:C(L.arguments),astNode:L})}function D(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.fields)!==null&&J!==void 0?J:[];for(const V of z){var G;q[V.name.value]={type:b(V.type),description:(G=V.description)===null||G===void 0?void 0:G.value,args:C(V.arguments),deprecationReason:Tp(V),astNode:V}}}return q}function C(L){const q=L??[],J=Object.create(null);for(const ie of q){var G;const z=b(ie.type);J[ie.name.value]={type:z,description:(G=ie.description)===null||G===void 0?void 0:G.value,defaultValue:wu(ie.defaultValue,z),deprecationReason:Tp(ie),astNode:ie}}return J}function I(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.fields)!==null&&J!==void 0?J:[];for(const V of z){var G;const Q=b(V.type);q[V.name.value]={type:Q,description:(G=V.description)===null||G===void 0?void 0:G.value,defaultValue:wu(V.defaultValue,Q),deprecationReason:Tp(V),astNode:V}}}return q}function O(L){const q=Object.create(null);for(const ie of L){var J;const z=(J=ie.values)!==null&&J!==void 0?J:[];for(const V of z){var G;q[V.name.value]={description:(G=V.description)===null||G===void 0?void 0:G.value,deprecationReason:Tp(V),astNode:V}}}return q}function S(L){return L.flatMap(q=>{var J,G;return(J=(G=q.interfaces)===null||G===void 0?void 0:G.map(N))!==null&&J!==void 0?J:[]})}function P(L){return L.flatMap(q=>{var J,G;return(J=(G=q.types)===null||G===void 0?void 0:G.map(N))!==null&&J!==void 0?J:[]})}function R(L){var q;const J=L.name.value,G=(q=u[J])!==null&&q!==void 0?q:[];switch(L.kind){case ye.OBJECT_TYPE_DEFINITION:{var ie;const le=[L,...G];return new sa({name:J,description:(ie=L.description)===null||ie===void 0?void 0:ie.value,interfaces:()=>S(le),fields:()=>D(le),astNode:L,extensionASTNodes:G})}case ye.INTERFACE_TYPE_DEFINITION:{var z;const le=[L,...G];return new jb({name:J,description:(z=L.description)===null||z===void 0?void 0:z.value,interfaces:()=>S(le),fields:()=>D(le),astNode:L,extensionASTNodes:G})}case ye.ENUM_TYPE_DEFINITION:{var V;const le=[L,...G];return new Sf({name:J,description:(V=L.description)===null||V===void 0?void 0:V.value,values:O(le),astNode:L,extensionASTNodes:G})}case ye.UNION_TYPE_DEFINITION:{var Q;const le=[L,...G];return new el({name:J,description:(Q=L.description)===null||Q===void 0?void 0:Q.value,types:()=>P(le),astNode:L,extensionASTNodes:G})}case ye.SCALAR_TYPE_DEFINITION:{var ae;return new Hs({name:J,description:(ae=L.description)===null||ae===void 0?void 0:ae.value,specifiedByURL:yS(L),astNode:L,extensionASTNodes:G})}case ye.INPUT_OBJECT_TYPE_DEFINITION:{var oe;const le=[L,...G];return new $b({name:J,description:(oe=L.description)===null||oe===void 0?void 0:oe.value,fields:()=>I(le),astNode:L,extensionASTNodes:G,isOneOf:SZ(L)})}}}}const gS=Lu([...z_,...V_],t=>t.name);function Tp(t){const e=Tf(c9,t);return e==null?void 0:e.reason}function yS(t){const e=Tf(l9,t);return e==null?void 0:e.url}function SZ(t){return!!Tf(d9,t)}function TZ(t,e){t!=null&&t.kind===ye.DOCUMENT||Fr(!1,"Must provide valid Document AST."),(e==null?void 0:e.assumeValid)!==!0&&(e==null?void 0:e.assumeValidSDL)!==!0&&xZ(t);const n=EZ({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},t,e);if(n.astNode==null)for(const a of n.types)switch(a.name){case"Query":n.query=a;break;case"Mutation":n.mutation=a;break;case"Subscription":n.subscription=a;break}const i=[...n.directives,...Wl.filter(a=>n.directives.every(s=>s.name!==a.name))];return new fV({...n,directives:i})}function DZ(t,e){const r=HI(t,{noLocation:void 0,allowLegacyFragmentVariables:void 0});return TZ(r,{assumeValidSDL:void 0,assumeValid:void 0})}const J_=JSON,AZ=t=>t.toUpperCase(),NZ=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},IZ=(t,e,r)=>t.document?t:{document:t,variables:e,requestHeaders:r,signal:void 0},CZ=(t,e,r)=>t.query?t:{query:t,variables:e,requestHeaders:r,signal:void 0},OZ=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0},vS=t=>{var n,i;let e;const r=t.definitions.filter(a=>a.kind==="OperationDefinition");return r.length===1&&(e=(i=(n=r[0])==null?void 0:n.name)==null?void 0:i.value),e},n1=t=>{if(typeof t=="string"){let r;try{const n=HI(t);r=vS(n)}catch{}return{query:t,operationName:r}}const e=vS(t);return{query:Mn(t),operationName:e}};class tl extends Error{constructor(e,r){const n=`${tl.extractMessage(e)}: ${JSON.stringify({response:e,request:r})}`;super(n),Object.setPrototypeOf(this,tl.prototype),this.response=e,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,tl)}static extractMessage(e){var r,n;return((n=(r=e.errors)==null?void 0:r[0])==null?void 0:n.message)??`GraphQL Error (Code: ${e.status})`}}var Vb={exports:{}};(function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof ia<"u"&&ia,n=function(){function a(){this.fetch=!1,this.DOMException=r.DOMException}return a.prototype=r,new a}();(function(a){(function(s){var o=typeof a<"u"&&a||typeof self<"u"&&self||typeof ia<"u"&&ia||{},u={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function c(D){return D&&DataView.prototype.isPrototypeOf(D)}if(u.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(D){return D&&l.indexOf(Object.prototype.toString.call(D))>-1};function f(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function h(D){return typeof D!="string"&&(D=String(D)),D}function p(D){var C={next:function(){var I=D.shift();return{done:I===void 0,value:I}}};return u.iterable&&(C[Symbol.iterator]=function(){return C}),C}function m(D){this.map={},D instanceof m?D.forEach(function(C,I){this.append(I,C)},this):Array.isArray(D)?D.forEach(function(C){if(C.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+C.length);this.append(C[0],C[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(C){this.append(C,D[C])},this)}m.prototype.append=function(D,C){D=f(D),C=h(C);var I=this.map[D];this.map[D]=I?I+", "+C:C},m.prototype.delete=function(D){delete this.map[f(D)]},m.prototype.get=function(D){return D=f(D),this.has(D)?this.map[D]:null},m.prototype.has=function(D){return this.map.hasOwnProperty(f(D))},m.prototype.set=function(D,C){this.map[f(D)]=h(C)},m.prototype.forEach=function(D,C){for(var I in this.map)this.map.hasOwnProperty(I)&&D.call(C,this.map[I],I,this)},m.prototype.keys=function(){var D=[];return this.forEach(function(C,I){D.push(I)}),p(D)},m.prototype.values=function(){var D=[];return this.forEach(function(C){D.push(C)}),p(D)},m.prototype.entries=function(){var D=[];return this.forEach(function(C,I){D.push([I,C])}),p(D)},u.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function y(D){if(!D._noBody){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}}function g(D){return new Promise(function(C,I){D.onload=function(){C(D.result)},D.onerror=function(){I(D.error)}})}function v(D){var C=new FileReader,I=g(C);return C.readAsArrayBuffer(D),I}function w(D){var C=new FileReader,I=g(C),O=/charset=([A-Za-z0-9_-]+)/.exec(D.type),S=O?O[1]:"utf-8";return C.readAsText(D,S),I}function x(D){for(var C=new Uint8Array(D),I=new Array(C.length),O=0;O<C.length;O++)I[O]=String.fromCharCode(C[O]);return I.join("")}function _(D){if(D.slice)return D.slice(0);var C=new Uint8Array(D.byteLength);return C.set(new Uint8Array(D)),C.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:u.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:u.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():u.arrayBuffer&&u.blob&&c(D)?(this._bodyArrayBuffer=_(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||d(D))?this._bodyArrayBuffer=_(D):this._bodyText=D=Object.prototype.toString.call(D):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var D=y(this);if(D)return D;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var D=y(this);return D||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(u.blob)return this.blob().then(v);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var D=y(this);if(D)return D;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(x(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}var M=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(D){var C=D.toUpperCase();return M.indexOf(C)>-1?C:D}function k(D,C){if(!(this instanceof k))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');C=C||{};var I=C.body;if(D instanceof k){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,C.headers||(this.headers=new m(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!I&&D._bodyInit!=null&&(I=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=C.credentials||this.credentials||"same-origin",(C.headers||!this.headers)&&(this.headers=new m(C.headers)),this.method=F(C.method||this.method||"GET"),this.mode=C.mode||this.mode||null,this.signal=C.signal||this.signal||function(){if("AbortController"in o){var P=new AbortController;return P.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(I),(this.method==="GET"||this.method==="HEAD")&&(C.cache==="no-store"||C.cache==="no-cache")){var O=/([?&])_=[^&]*/;if(O.test(this.url))this.url=this.url.replace(O,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function $(D){var C=new FormData;return D.trim().split("&").forEach(function(I){if(I){var O=I.split("="),S=O.shift().replace(/\+/g," "),P=O.join("=").replace(/\+/g," ");C.append(decodeURIComponent(S),decodeURIComponent(P))}}),C}function T(D){var C=new m,I=D.replace(/\r?\n[\t ]+/g," ");return I.split("\r").map(function(O){return O.indexOf(`
55
55
  `)===0?O.substr(1,O.length):O}).forEach(function(O){var S=O.split(":"),P=S.shift().trim();if(P){var R=S.join(":").trim();try{C.append(P,R)}catch(L){console.warn("Response "+L.message)}}}),C}A.call(k.prototype);function N(D,C){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(C||(C={}),this.type="default",this.status=C.status===void 0?200:C.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=C.statusText===void 0?"":""+C.statusText,this.headers=new m(C.headers),this.url=C.url||"",this._initBody(D)}A.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},N.error=function(){var D=new N(null,{status:200,statusText:""});return D.ok=!1,D.status=0,D.type="error",D};var b=[301,302,303,307,308];N.redirect=function(D,C){if(b.indexOf(C)===-1)throw new RangeError("Invalid status code");return new N(null,{status:C,headers:{location:D}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(C,I){this.message=C,this.name=I;var O=Error(C);this.stack=O.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function E(D,C){return new Promise(function(I,O){var S=new k(D,C);if(S.signal&&S.signal.aborted)return O(new s.DOMException("Aborted","AbortError"));var P=new XMLHttpRequest;function R(){P.abort()}P.onload=function(){var J={statusText:P.statusText,headers:T(P.getAllResponseHeaders()||"")};S.url.indexOf("file://")===0&&(P.status<200||P.status>599)?J.status=200:J.status=P.status,J.url="responseURL"in P?P.responseURL:J.headers.get("X-Request-URL");var G="response"in P?P.response:P.responseText;setTimeout(function(){I(new N(G,J))},0)},P.onerror=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},P.ontimeout=function(){setTimeout(function(){O(new TypeError("Network request timed out"))},0)},P.onabort=function(){setTimeout(function(){O(new s.DOMException("Aborted","AbortError"))},0)};function L(J){try{return J===""&&o.location.href?o.location.href:J}catch{return J}}if(P.open(S.method,L(S.url),!0),S.credentials==="include"?P.withCredentials=!0:S.credentials==="omit"&&(P.withCredentials=!1),"responseType"in P&&(u.blob?P.responseType="blob":u.arrayBuffer&&(P.responseType="arraybuffer")),C&&typeof C.headers=="object"&&!(C.headers instanceof m||o.Headers&&C.headers instanceof o.Headers)){var q=[];Object.getOwnPropertyNames(C.headers).forEach(function(J){q.push(f(J)),P.setRequestHeader(J,h(C.headers[J]))}),S.headers.forEach(function(J,G){q.indexOf(G)===-1&&P.setRequestHeader(G,J)})}else S.headers.forEach(function(J,G){P.setRequestHeader(G,J)});S.signal&&(S.signal.addEventListener("abort",R),P.onreadystatechange=function(){P.readyState===4&&S.signal.removeEventListener("abort",R)}),P.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return E.polyfill=!0,o.fetch||(o.fetch=E,o.Headers=m,o.Request=k,o.Response=N),s.Headers=m,s.Request=k,s.Response=N,s.fetch=E,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=r.fetch?r:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(Vb,Vb.exports);var eg=Vb.exports;const Am=Bh(eg),MZ=mz({__proto__:null,default:Am},[eg]),yc=t=>{let e={};return t&&(typeof Headers<"u"&&t instanceof Headers||MZ&&eg.Headers&&t instanceof eg.Headers?e=NZ(t):Array.isArray(t)?t.forEach(([r,n])=>{r&&n!==void 0&&(e[r]=n)}):e=t),e},bS=t=>t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),kZ=t=>{if(!Array.isArray(t.query)){const n=t,i=[`query=${encodeURIComponent(bS(n.query))}`];return t.variables&&i.push(`variables=${encodeURIComponent(n.jsonSerializer.stringify(n.variables))}`),n.operationName&&i.push(`operationName=${encodeURIComponent(n.operationName)}`),i.join("&")}if(typeof t.variables<"u"&&!Array.isArray(t.variables))throw new Error("Cannot create query with given variable type, array expected");const e=t,r=t.query.reduce((n,i,a)=>(n.push({query:bS(i),variables:e.variables?e.jsonSerializer.stringify(e.variables[a]):void 0}),n),[]);return`query=${encodeURIComponent(e.jsonSerializer.stringify(r))}`},RZ=t=>async e=>{const{url:r,query:n,variables:i,operationName:a,fetch:s,fetchOptions:o,middleware:u}=e,c={...e.headers};let l="",d;t==="POST"?(d=PZ(n,i,a,o.jsonSerializer),typeof d=="string"&&(c["Content-Type"]="application/json")):l=kZ({query:n,variables:i,operationName:a,jsonSerializer:o.jsonSerializer??J_});const f={method:t,headers:c,body:d,...o};let h=r,p=f;if(u){const m=await Promise.resolve(u({...f,url:r,operationName:a,variables:i})),{url:y,...g}=m;h=y,p=g}return l&&(h=`${h}?${l}`),await s(h,p)};class FZ{constructor(e,r={}){this.url=e,this.requestConfig=r,this.rawRequest=async(...n)=>{const[i,a,s]=n,o=CZ(i,a,s),{headers:u,fetch:c=Am,method:l="POST",requestMiddleware:d,responseMiddleware:f,...h}=this.requestConfig,{url:p}=this;o.signal!==void 0&&(h.signal=o.signal);const{operationName:m}=n1(o.query);return i1({url:p,query:o.query,variables:o.variables,headers:{...yc(a1(u)),...yc(o.requestHeaders)},operationName:m,fetch:c,method:l,fetchOptions:h,middleware:d}).then(y=>(f&&f(y),y)).catch(y=>{throw f&&f(y),y})}}async request(e,...r){const[n,i]=r,a=IZ(e,n,i),{headers:s,fetch:o=Am,method:u="POST",requestMiddleware:c,responseMiddleware:l,...d}=this.requestConfig,{url:f}=this;a.signal!==void 0&&(d.signal=a.signal);const{query:h,operationName:p}=n1(a.document);return i1({url:f,query:h,variables:a.variables,headers:{...yc(a1(s)),...yc(a.requestHeaders)},operationName:p,fetch:o,method:u,fetchOptions:d,middleware:c}).then(m=>(l&&l(m),m.data)).catch(m=>{throw l&&l(m),m})}batchRequests(e,r){const n=OZ(e,r),{headers:i,...a}=this.requestConfig;n.signal!==void 0&&(a.signal=n.signal);const s=n.documents.map(({document:u})=>n1(u).query),o=n.documents.map(({variables:u})=>u);return i1({url:this.url,query:s,variables:o,headers:{...yc(a1(i)),...yc(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??Am,method:this.requestConfig.method||"POST",fetchOptions:a,middleware:this.requestConfig.requestMiddleware}).then(u=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(u),u.data)).catch(u=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(u),u})}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,r){const{headers:n}=this.requestConfig;return n?n[e]=r:this.requestConfig.headers={[e]:r},this}setEndpoint(e){return this.url=e,this}}const i1=async t=>{const{query:e,variables:r,fetchOptions:n}=t,i=RZ(AZ(t.method??"post")),a=Array.isArray(t.query),s=await i(t),o=await BZ(s,n.jsonSerializer??J_),u=Array.isArray(o)?!o.some(({data:l})=>!l):!!o.data,c=Array.isArray(o)||!o.errors||Array.isArray(o.errors)&&!o.errors.length||n.errorPolicy==="all"||n.errorPolicy==="ignore";if(s.ok&&c&&u){const{errors:l,...d}=(Array.isArray(o),o),f=n.errorPolicy==="ignore"?d:o;return{...a?{data:f}:f,headers:s.headers,status:s.status}}else{const l=typeof o=="string"?{error:o}:o;throw new tl({...l,status:s.status,headers:s.headers},{query:e,variables:r})}},PZ=(t,e,r,n)=>{const i=n??J_;if(!Array.isArray(t))return i.stringify({query:t,variables:e,operationName:r});if(typeof e<"u"&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");const a=t.reduce((s,o,u)=>(s.push({query:o,variables:e?e[u]:void 0}),s),[]);return i.stringify(a)},BZ=async(t,e)=>{let r;return t.headers.forEach((n,i)=>{i.toLowerCase()==="content-type"&&(r=n)}),r&&(r.toLowerCase().startsWith("application/json")||r.toLowerCase().startsWith("application/graphql+json")||r.toLowerCase().startsWith("application/graphql-response+json"))?e.parse(await t.text()):t.text()},a1=t=>typeof t=="function"?t():t,rl=(t,...e)=>t.reduce((r,n,i)=>`${r}${n}${i in e?String(e[i]):""}`,"");var es;class LZ{constructor(){Ja(this,es,console)}set logger(e){md(this,es,e)}log(...e){return Ir(this,es).log(...e)}info(...e){return Ir(this,es).info(...e)}warn(...e){return Ir(this,es).warn(...e)}error(...e){return Ir(this,es).error(...e)}debug(...e){return Ir(this,es).debug(...e)}trace(...e){return Ir(this,es).trace(...e)}}es=new WeakMap;const N9=new LZ,ir=N9,jZ=t=>N9.logger=t;async function nl(...t){const[e,...r]=t,n=new FZ(e,{fetch}),{errors:i,...a}=await n.request(...r),s={...a};return i!=null&&i.length&&(s.errors=i.map(({message:o,...u})=>new He(o,u))),s}function Nm(t){return t instanceof sa?Object.entries(t.getFields()).map(([e,r])=>{const n=r.type instanceof dr?r.type.ofType:r.type;if(n instanceof sa||n instanceof el)return`${e} { ${Nm(n)} }`;if(n instanceof hi){const i=n.ofType instanceof dr?n.ofType.ofType:n.ofType;if(i instanceof Hs)return e;if(i instanceof sa||i instanceof el)return`${e} { ${Nm(i)} }`;throw new Error(`List item type ${i.toString()} is not handled`)}return e}).join(" "):t instanceof el?t.getTypes().map(e=>`... on ${e.name} { ${Nm(e)} }`).join(" "):""}function $Z(t,e){const r=PI(t.name),n=t.specifications.at(-1);if(!n)throw new Error("No document model specification found");const i=`${n.state.global.schema} type Query { ${r}: ${r}State }`,s=DZ(i).getQueryType();if(!s)throw new Error("No query type found");const u=s.getFields()[r];if(!u)throw new Error("No state query found");return Nm(u.type)}async function _u(t){var r,n;let e;try{const i=await nl(t,rl`
56
56
  query getDrive {
57
57
  drive {
@@ -337,7 +337,7 @@ type DocumentDriveLocalState{
337
337
  trigger: Trigger!
338
338
  }`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z30dsU=",name:"REMOVE_TRIGGER",description:"",schema:`input RemoveTriggerInput {
339
339
  triggerId: String!
340
- }`,template:"",reducer:"",errors:[],examples:[],scope:"local"}]}]}]},mO=t=>t!=null,rK=X.any().refine(t=>mO(t)),gO=X.enum(["Internal","MatrixConnect","PullResponder","RESTWebhook","SecureConnect","SwitchboardPush"]),yO=X.enum(["PullResponder"]);function x2(){return X.object({document:X.unknown().nullish(),documentType:X.string(),id:X.string(),name:X.string(),parentFolder:X.string().nullish(),synchronizationUnits:X.array(F0())})}function E2(){return X.object({id:X.string(),name:X.string(),parentFolder:X.string().nullish()})}function S2(){return X.object({listener:N2()})}function T2(){return X.object({trigger:P2()})}function D2(){return X.object({srcId:X.string(),synchronizationUnits:X.array(F0()).nullish(),targetId:X.string(),targetName:X.string().nullish(),targetParentFolder:X.string().nullish()})}function A2(){return X.object({id:X.string()})}function nK(){return X.object({__typename:X.literal("DocumentDriveLocalState").optional(),availableOffline:X.boolean(),listeners:X.array(N2()),sharingType:X.string().nullable(),triggers:X.array(P2())})}function iK(){return X.object({__typename:X.literal("DocumentDriveState").optional(),icon:X.string().nullable(),id:X.string(),name:X.string(),nodes:X.array(xO()),slug:X.string().nullable()})}function vO(){return X.object({__typename:X.literal("FileNode").optional(),documentType:X.string(),id:X.string(),kind:X.string(),name:X.string(),parentFolder:X.string().nullable(),synchronizationUnits:X.array(F0())})}function bO(){return X.object({__typename:X.literal("FolderNode").optional(),id:X.string(),kind:X.string(),name:X.string(),parentFolder:X.string().nullable()})}function N2(){return X.object({__typename:X.literal("Listener").optional(),block:X.boolean(),callInfo:wO().nullable(),filter:_O(),label:X.string().nullable(),listenerId:X.string(),system:X.boolean()})}function wO(){return X.object({__typename:X.literal("ListenerCallInfo").optional(),data:X.string().nullable(),name:X.string().nullable(),transmitterType:gO.nullable()})}function _O(){return X.object({__typename:X.literal("ListenerFilter").optional(),branch:X.array(X.string()).nullable(),documentId:X.array(X.string()).nullable(),documentType:X.array(X.string()),scope:X.array(X.string()).nullable()})}function I2(){return X.object({srcFolder:X.string(),targetParentFolder:X.string().nullish()})}function xO(){return X.union([vO(),bO()])}function EO(){return X.object({__typename:X.literal("PullResponderTriggerData").optional(),interval:X.string(),listenerId:X.string(),url:X.string()})}function C2(){return X.object({listenerId:X.string()})}function O2(){return X.object({triggerId:X.string()})}function M2(){return X.object({availableOffline:X.boolean()})}function k2(){return X.object({icon:X.string()})}function R2(){return X.object({name:X.string()})}function F2(){return X.object({type:X.string()})}function F0(){return X.object({__typename:X.literal("SynchronizationUnit").optional(),branch:X.string(),scope:X.string(),syncId:X.string()})}function P2(){return X.object({__typename:X.literal("Trigger").optional(),data:SO().nullable(),id:X.string(),type:yO})}function SO(){return EO()}function B2(){return X.object({documentType:X.string().nullish(),id:X.string(),name:X.string().nullish(),parentFolder:X.string().nullish()})}function L2(){return X.object({id:X.string(),name:X.string().nullish(),parentFolder:X.string().nullish()})}const aK=Object.freeze(Object.defineProperty({__proto__:null,AddFileInputSchema:x2,AddFolderInputSchema:E2,AddListenerInputSchema:S2,AddTriggerInputSchema:T2,CopyNodeInputSchema:D2,DeleteNodeInputSchema:A2,DocumentDriveLocalStateSchema:nK,DocumentDriveStateSchema:iK,FileNodeSchema:vO,FolderNodeSchema:bO,ListenerCallInfoSchema:wO,ListenerFilterSchema:_O,ListenerSchema:N2,MoveNodeInputSchema:I2,NodeSchema:xO,PullResponderTriggerDataSchema:EO,RemoveListenerInputSchema:C2,RemoveTriggerInputSchema:O2,SetAvailableOfflineInputSchema:M2,SetDriveIconInputSchema:k2,SetDriveNameInputSchema:R2,SetSharingTypeInputSchema:F2,SynchronizationUnitSchema:F0,TransmitterTypeSchema:gO,TriggerDataSchema:SO,TriggerSchema:P2,TriggerTypeSchema:yO,UpdateFileInputSchema:B2,UpdateNodeInputSchema:L2,definedNonNullAnySchema:rK,isDefinedNonNullAny:mO},Symbol.toStringTag,{value:"Module"})),du={addFileOperation(t,e,r){if(t.nodes.find(o=>o.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const n=po({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null}),i=e.input.synchronizationUnits,a=i.find(o=>!!t.nodes.find(u=>Ni(u)&&u.synchronizationUnits.find(c=>c.syncId===o.syncId)));if(a)throw new Error(`A synchronization unit with Id ${a.syncId} already exists`);const s={id:e.input.id,name:n,kind:"file",parentFolder:e.input.parentFolder??null,synchronizationUnits:i,documentType:e.input.documentType};t.nodes.push(s),r==null||r({type:"CREATE_CHILD_DOCUMENT",input:{id:e.input.id,documentType:e.input.documentType,synchronizationUnits:i,document:e.input.document}})},addFolderOperation(t,e){if(t.nodes.find(n=>n.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const r=po({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null});t.nodes.push({...e.input,name:r,kind:"folder",parentFolder:e.input.parentFolder??null})},deleteNodeOperation(t,e,r){const n=t.nodes.find(a=>a.id===e.input.id);if(!n)throw new Error(`Node with id ${e.input.id} not found`);const i=_l(n,t.nodes);t.nodes=t.nodes.filter(a=>a.id!==e.input.id&&!i.find(s=>s.id===a.id)),[n,...i].filter(a=>Ni(a)).forEach(a=>{r==null||r({type:"DELETE_CHILD_DOCUMENT",input:{id:a.id}})})},updateFileOperation(t,e){t.nodes=t.nodes.map(r=>r.id===e.input.id?{...r,name:po({nodes:t.nodes,srcName:e.input.name??r.name,targetParentFolder:e.input.parentFolder||null}),documentType:e.input.documentType??r.documentType}:r)},updateNodeOperation(t,e){t.nodes=t.nodes.map(r=>r.id===e.input.id?{...r,name:po({nodes:t.nodes,srcName:e.input.name??r.name,targetParentFolder:e.input.parentFolder||null}),parentFolder:e.input.parentFolder===null?null:r.parentFolder}:r)},copyNodeOperation(t,e,r){const n=t.nodes.find(o=>o.id===e.input.srcId);if(!n)throw new Error(`Node with id ${e.input.srcId} not found`);if(t.nodes.find(o=>o.id===e.input.targetId))throw new Error(`Node with id ${e.input.targetId} already exists`);const i=po({nodes:t.nodes,srcName:e.input.targetName||n.name,targetParentFolder:e.input.targetParentFolder||null}),a={...n,name:i,id:e.input.targetId,parentFolder:e.input.targetParentFolder||null},s=Ni(a);if(s){const o=e.input.synchronizationUnits;if(!e.input.synchronizationUnits)throw new Error("Synchronization units were not provided");const u=o.find(c=>!!t.nodes.find(l=>Ni(l)&&l.synchronizationUnits.find(d=>d.syncId===c.syncId)));if(u)throw new Error(`A synchronization unit with Id ${u.syncId} already exists`);a.synchronizationUnits=o}t.nodes.push(a),s&&(r==null||r({type:"COPY_CHILD_DOCUMENT",input:{id:e.input.srcId,newId:e.input.targetId,synchronizationUnits:a.synchronizationUnits}}))},moveNodeOperation(t,e){if(e.input.srcFolder===e.input.targetParentFolder)throw new Error("Circular Reference Error: Attempting to move a node to its current parent folder");const r=t.nodes.find(i=>i.id===e.input.srcFolder);if(!r)throw new Error(`Node with id ${e.input.srcFolder} not found`);const n=po({nodes:t.nodes,srcName:r.name,targetParentFolder:e.input.targetParentFolder||null});if(P0(r)&&_l(r,t.nodes).find(i=>i.id===e.input.targetParentFolder))throw new Error("Circular Reference Error: Cannot move a folder to one of its descendants");t.nodes=t.nodes.map(i=>i.id===e.input.srcFolder?{...i,name:n,parentFolder:e.input.targetParentFolder||null}:i)}},uo={setDriveNameOperation(t,e,r){t.name=e.input.name},setDriveIconOperation(t,e,r){t.icon=e.input.icon},setSharingTypeOperation(t,e,r){t.sharingType=e.input.type},setAvailableOfflineOperation(t,e,r){t.availableOffline=e.input.availableOffline},addListenerOperation(t,e,r){if(t.listeners.find(n=>n.listenerId===e.input.listener.listenerId))throw new Error(`A listener with Id: ${e.input.listener.listenerId} already exists`);t.listeners.push(e.input.listener)},removeListenerOperation(t,e,r){t.listeners=t.listeners.filter(n=>n.listenerId!==e.input.listenerId)},addTriggerOperation(t,e,r){if(t.triggers.find(n=>n.id===e.input.trigger.id))throw new Error(`A trigger with Id: ${e.input.trigger.id} already exists`);t.triggers.push(e.input.trigger)},removeTriggerOperation(t,e,r){t.triggers=t.triggers.filter(n=>n.id!==e.input.triggerId)}},sK=(t,e,r)=>{if(Xe.isBaseAction(e))return t;switch(e.type){case"ADD_FILE":x2().parse(e.input),du.addFileOperation(t[e.scope],e,r);break;case"ADD_FOLDER":E2().parse(e.input),du.addFolderOperation(t[e.scope],e,r);break;case"DELETE_NODE":A2().parse(e.input),du.deleteNodeOperation(t[e.scope],e,r);break;case"UPDATE_FILE":B2().parse(e.input),du.updateFileOperation(t[e.scope],e,r);break;case"UPDATE_NODE":L2().parse(e.input),du.updateNodeOperation(t[e.scope],e,r);break;case"COPY_NODE":D2().parse(e.input),du.copyNodeOperation(t[e.scope],e,r);break;case"MOVE_NODE":I2().parse(e.input),du.moveNodeOperation(t[e.scope],e,r);break;case"SET_DRIVE_NAME":R2().parse(e.input),uo.setDriveNameOperation(t[e.scope],e,r);break;case"SET_DRIVE_ICON":k2().parse(e.input),uo.setDriveIconOperation(t[e.scope],e,r);break;case"SET_SHARING_TYPE":F2().parse(e.input),uo.setSharingTypeOperation(t[e.scope],e,r);break;case"SET_AVAILABLE_OFFLINE":M2().parse(e.input),uo.setAvailableOfflineOperation(t[e.scope],e,r);break;case"ADD_LISTENER":S2().parse(e.input),uo.addListenerOperation(t[e.scope],e,r);break;case"REMOVE_LISTENER":C2().parse(e.input),uo.removeListenerOperation(t[e.scope],e,r);break;case"ADD_TRIGGER":T2().parse(e.input),uo.addTriggerOperation(t[e.scope],e,r);break;case"REMOVE_TRIGGER":O2().parse(e.input),uo.removeTriggerOperation(t[e.scope],e,r);break;default:return t}},Wu=Xe.createReducer(sK),oK={id:"",name:"",nodes:[],icon:null,slug:null},uK={listeners:[],triggers:[],sharingType:"private",availableOffline:!1},sf={fileExtension:"phdd",createState(t){return{global:{...oK,...t==null?void 0:t.global},local:{...uK,...t==null?void 0:t.local}}},createExtendedState(t){return Xe.createExtendedState({...t,documentType:"powerhouse/document-drive"},sf.createState)},createDocument(t){return Xe.createDocument(sf.createExtendedState(t),sf.createState)},saveToFile(t,e,r){return Xe.saveToFile(t,e,"phdd",r)},saveToFileHandle(t,e){return Xe.saveToFileHandle(t,e)},loadFromFile(t){return Xe.loadFromFile(t,Wu)},loadFromInput(t){return Xe.loadFromInput(t,Wu)}},{createAction:oc}=Xe,j2=t=>oc("ADD_FILE",{...t},void 0,x2,"global"),TO=t=>oc("ADD_FOLDER",{...t},void 0,E2,"global"),DO=t=>oc("DELETE_NODE",{...t},void 0,A2,"global"),AO=t=>oc("UPDATE_FILE",{...t},void 0,B2,"global"),NO=t=>oc("UPDATE_NODE",{...t},void 0,L2,"global"),$2=t=>oc("COPY_NODE",{...t},void 0,D2,"global"),IO=t=>oc("MOVE_NODE",{...t},void 0,I2,"global");let cK=class extends Pr{addFile(e){return this.dispatch(j2(e))}addFolder(e){return this.dispatch(TO(e))}deleteNode(e){return this.dispatch(DO(e))}updateFile(e){return this.dispatch(AO(e))}updateNode(e){return this.dispatch(NO(e))}copyNode(e){return this.dispatch($2(e))}moveNode(e){return this.dispatch(IO(e))}};const{createAction:Xo}=Xe,CO=t=>Xo("SET_DRIVE_NAME",{...t},void 0,R2,"global"),OO=t=>Xo("SET_DRIVE_ICON",{...t},void 0,k2,"global"),MO=t=>Xo("SET_SHARING_TYPE",{...t},void 0,F2,"local"),kO=t=>Xo("SET_AVAILABLE_OFFLINE",{...t},void 0,M2,"local"),RO=t=>Xo("ADD_LISTENER",{...t},void 0,S2,"local"),FO=t=>Xo("REMOVE_LISTENER",{...t},void 0,C2,"local"),PO=t=>Xo("ADD_TRIGGER",{...t},void 0,T2,"local"),BO=t=>Xo("REMOVE_TRIGGER",{...t},void 0,O2,"local");let lK=class extends Pr{setDriveName(e){return this.dispatch(CO(e))}setDriveIcon(e){return this.dispatch(OO(e))}setSharingType(e){return this.dispatch(MO(e))}setAvailableOffline(e){return this.dispatch(kO(e))}addListener(e){return this.dispatch(RO(e))}removeListener(e){return this.dispatch(FO(e))}addTrigger(e){return this.dispatch(PO(e))}removeTrigger(e){return this.dispatch(BO(e))}};const LO=class jO extends Pr{constructor(e,r){super(Wu,sf.createDocument(e),r)}saveToFile(e,r){return super.saveToFile(e,jO.fileExtension,r)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const r=new this;return await r.loadFromFile(e),r}};tK(LO,"fileExtension","phdd");let U2=LO;Go(U2,[cK,lK]);const dK=Object.freeze(Object.defineProperty({__proto__:null,addFile:j2,addFolder:TO,addListener:RO,addTrigger:PO,copyNode:$2,deleteNode:DO,moveNode:IO,removeListener:FO,removeTrigger:BO,setAvailableOffline:kO,setDriveIcon:OO,setDriveName:CO,setSharingType:MO,updateFile:AO,updateNode:NO},Symbol.toStringTag,{value:"Module"}));var Hn=[];for(var d1=0;d1<256;++d1)Hn.push((d1+256).toString(16).slice(1));function fK(t,e=0){return(Hn[t[e+0]]+Hn[t[e+1]]+Hn[t[e+2]]+Hn[t[e+3]]+"-"+Hn[t[e+4]]+Hn[t[e+5]]+"-"+Hn[t[e+6]]+Hn[t[e+7]]+"-"+Hn[t[e+8]]+Hn[t[e+9]]+"-"+Hn[t[e+10]]+Hn[t[e+11]]+Hn[t[e+12]]+Hn[t[e+13]]+Hn[t[e+14]]+Hn[t[e+15]]).toLowerCase()}var Np,hK=new Uint8Array(16);function pK(){if(!Np&&(Np=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Np))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Np(hK)}var mK=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const CS={randomUUID:mK};function gK(t,e,r){if(CS.randomUUID&&!t)return CS.randomUUID();t=t||{};var n=t.random||(t.rng||pK)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,fK(n)}function Ni(t){return t.kind==="file"}function P0(t){return t.kind==="folder"}function z2(t,e){if(t.parentFolder){const r=e.find(n=>n.id===t.parentFolder);if(!r)throw new Error(`Parent node with id ${t.parentFolder} not found`);return[r,...z2(r,e)]}else return[]}function _l(t,e){const r=e.filter(i=>i.parentFolder===t.id),n=r.map(i=>_l(i,e));return[...r,...n.flat()]}function $O(t,e,r){const n=r.find(o=>o.id===t.srcId);if(!n)throw new Error(`Node with id ${t.srcId} not found`);const i=[{...n,name:t.targetName||n.name,parentFolder:t.targetParentFolder||null},..._l(n,r)],a={};t.targetParentFolder&&(a[t.targetParentFolder]=t.targetParentFolder);const s=o=>{let u=a[o];if(!u){const c=o;u=e(o),a[c]=u}return u};return i.map(o=>({srcId:o.id,targetId:s(o.id),targetName:o.name,targetParentFolder:o.parentFolder?s(o.parentFolder):null,synchronizationUnits:Ni(o)?o.synchronizationUnits.map(u=>({...u,syncId:Yh(r)})):void 0}))}function Yh(t){let e="";for(;!e||t.find(r=>Ni(r)&&r.synchronizationUnits.find(n=>n.syncId===e));)e=gK();return e}function q2(t,e,r="main"){return e.map(n=>({scope:n,branch:r,syncId:Yh(t.nodes)}))}function V2(t,e,r){return j2({...e,synchronizationUnits:q2(t,r)})}function UO(t,e){const r=t.nodes.find(i=>i.id===e.srcId);if(!r)throw new Error(`Node with id ${e.srcId} not found`);let n;return Ni(r)&&(n=r.synchronizationUnits.map(i=>({...i,syncId:Yh(t.nodes)}))),$2({...e,synchronizationUnits:n})}function Z2(t,e){let r=0;const n=new RegExp(`^${H2(e)} \\(copy\\)(?: (\\d+))?$`);for(const i of t){const a=i.match(n);if(a){const s=a[1]?parseInt(a[1],10):1;s>r&&(r=s)}}return r+1}function H2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function po(t){const{nodes:e,targetParentFolder:r,srcName:n}=t,i=e.filter(a=>r===""?a.parentFolder===null:a.parentFolder===r).map(a=>a.name);return i.includes(n)?`${n} (copy) ${Z2(i,n)}`:n}const yK=Object.freeze(Object.defineProperty({__proto__:null,escapeRegExp:H2,generateAddNodeAction:V2,generateCopyNodeAction:UO,generateNodesCopy:$O,generateSynchronizationUnitId:Yh,generateSynchronizationUnits:q2,getAncestors:z2,getDescendants:_l,getNextCopyNumber:Z2,handleTargetNameCollisions:po,isFileNode:Ni,isFolderNode:P0},Symbol.toStringTag,{value:"Module"})),zO=U2,nh={...sf,...yK},Jn={...Ko,...dK},qO={Document:zO,reducer:Wu,actions:Jn,utils:nh,documentModel:R0},vK=Object.freeze(Object.defineProperty({__proto__:null,Document:zO,DocumentDrive:U2,actions:Jn,documentModel:R0,escapeRegExp:H2,generateAddNodeAction:V2,generateCopyNodeAction:UO,generateNodesCopy:$O,generateSynchronizationUnitId:Yh,generateSynchronizationUnits:q2,getAncestors:z2,getDescendants:_l,getNextCopyNumber:Z2,handleTargetNameCollisions:po,isFileNode:Ni,isFolderNode:P0,module:qO,reducer:Wu,utils:nh,z:aK},Symbol.toStringTag,{value:"Module"}));let VO=()=>({emit(t,...e){for(let r=this.events[t]||[],n=0,i=r.length;n<i;n++)r[n](...e)},events:{},on(t,e){var r;return((r=this.events)[t]||(r[t]=[])).push(e),()=>{var n;this.events[t]=(n=this.events[t])==null?void 0:n.filter(i=>e!==i)}}});class ZO{constructor(){this.cache=new Map}async setDocument(e,r,n){var o;const i=n.operations.global.map(u=>(delete u.resultingState,u)),a=n.operations.local.map(u=>(delete u.resultingState,u)),s={...n,operations:{global:i,local:a}};return this.cache.has(e)||this.cache.set(e,new Map),(o=this.cache.get(e))==null||o.set(r,s),!0}async deleteDocument(e,r){var n;return((n=this.cache.get(e))==null?void 0:n.delete(r))??!1}async getDocument(e,r){var n;return(n=this.cache.get(e))==null?void 0:n.get(r)}}class bK extends Error{constructor(e,r){super(`Document model "${e}" not found`,{cause:r}),this.id=e}}class Di extends Error{constructor(e,r,n,i){super(n,{cause:i??r}),this.status=e,this.operation=r}}class wK extends Di{constructor(e,r){super("CONFLICT",r,`Conflicting operation on index ${r.index}`,{existingOperation:e,newOperation:r})}}class _K extends Error{constructor(e){super(`Drive already exists. ID: ${e}`),this.driveId=e}}class of extends Error{constructor(e){super(`Drive with id ${e} not found`),this.driveId=e}}class HO extends Error{constructor(e,r){super(e),this.syncUnitId=r}}var ih;(t=>{t.useMessageChannel=typeof MessageChannel>"u"?new Error("MessageChannel is not supported"):n=>{const i=new AbortController,a=i.signal,s=new MessageChannel;return s.port1.postMessage(null),s.port2.addEventListener("message",()=>{n(),s.port1.close(),s.port2.close()},{once:!0,signal:a}),s.port2.start(),()=>i.abort()},t.usePostMessage=(()=>{const n=typeof window=="object"&&window||typeof global=="object"&&global||typeof self=="object"&&self;if(!n)return new Error("No global object found");const i=n;if(!i.postMessage||!i.addEventListener||i.importScripts)return new Error("postMessage is not supported");let a=0;const s=new Map;function o(){return a===9007199254740991?0:++a}const u="com.usePostMessage"+Math.random();return i.addEventListener("message",c=>{const l=c;if(typeof l.data!="string"||l.source!==i||!l.data.startsWith(u))return;const d=l.data.split(":").at(1);if(d===void 0)return;const f=+d,h=s.get(f);h&&(h(),s.delete(f))},!1),c=>{const l=o();return s.set(l,c),i.postMessage(u+":"+l,{targetOrigin:"*"}),()=>{s.delete(l)}}})(),t.useSetImmediate=typeof window<"u"?new Error("setImmediate is not supported on the browser"):typeof setImmediate>"u"?new Error("setImmediate is not supported"):n=>{const i=setImmediate(n);return()=>clearImmediate(i)},t.useSetTimeout=n=>{const i=setTimeout(n,0);return()=>clearTimeout(i)};function e(n){return t.useSetImmediate instanceof Error?t.useMessageChannel instanceof Error?t.usePostMessage instanceof Error?(0,t.useSetTimeout)(n):(0,t.usePostMessage)(n):(0,t.useMessageChannel)(n):(0,t.useSetImmediate)(n)}t.runAsap=e;function r(n,i=e){if(i instanceof Error)throw new Error("queueMethod is not supported",{cause:i});return new Promise((a,s)=>{i(()=>{n().then(a).catch(s)})})}t.runAsapAsync=r})(ih||(ih={}));const xK=ih.runAsap,EK=ih.runAsapAsync;function mu(t){return t.documentType===R0.id}function _g(t,e){const r=Object.keys(t).reduce((i,a)=>{var o;const s=a;return i[s]=((o=t[s].at(-1))==null?void 0:o.index)??0,i},{}),n=e.find(i=>i.index<(r[i.scope]??0));if(n)throw new Di("ERROR",n,`Tried to add operation with index ${n.index} and document is at index ${r[n.scope]}`);return e.sort((i,a)=>i.index-a.index).reduce((i,a)=>{const s=i[a.scope]||[];return{...i,[a.scope]:[...s,a]}},t)}function W2(){return s2()}function SK(t,e){return new Date(t)<new Date(e)}function km(t){return"operations"in t}function TK(t){return"actions"in t}class DK{constructor(e){this.blocked=!1,this.deleted=!1,this.items=[],this.dependencies=new Array,this.id=e}async setDeleted(e){this.deleted=e}async isDeleted(){return this.deleted}async addJob(e){return this.items.push(e),Promise.resolve()}async getNextJob(){const e=this.items.shift();return Promise.resolve(e)}async amountOfJobs(){return Promise.resolve(this.items.length)}getId(){return this.id}async setBlocked(e){this.blocked=e}async isBlocked(){return this.blocked}async getJobs(){return this.items}async addDependencies(e){this.dependencies.find(r=>r.jobId===e.jobId)||this.dependencies.push(e),this.isBlocked()||this.setBlocked(!0)}async removeDependencies(e){this.dependencies=this.dependencies.filter(r=>r.jobId!==e.jobId&&r.driveId!==e.driveId),this.dependencies.length===0&&await this.setBlocked(!1)}}class WO{constructor(e=3,r=0){this.emitter=VO(),this.ticker=0,this.queues=[],this.workers=e,this.timeout=r}async init(e,r){this.delegate=e;for(let n=0;n<this.workers;n++)setTimeout(()=>this.processNextJob.bind(this)().catch(r),100*n);return Promise.resolve()}async addJob(e){if(!this.delegate)throw new Error("No server delegate defined");const r=W2(),n=this.getQueue(e.driveId,e.documentId);if(await n.isDeleted())throw new Error("Queue is deleted");if(e.documentId&&!await this.delegate.checkDocumentExists(e.driveId,e.documentId)&&!await n.isBlocked()){await n.setBlocked(!0);const c=await this.getQueue(e.driveId).getJobs();for(const l of c)(km(l)?l.operations:l.actions).find(h=>{const p=h.input;return h.type==="ADD_FILE"&&p.id===e.documentId})&&await n.addDependencies(l)}const a=km(e)?e.operations:e.actions,s=a.filter(u=>u.type==="ADD_FILE");for(const u of s){const c=u.input;await this.getQueue(e.driveId,c.id).addDependencies({jobId:r,...e})}const o=a.filter(u=>u.type==="DELETE_NODE");for(const u of o){const c=u.input;await this.getQueue(e.driveId,c.id).setDeleted(!0)}return await n.addJob({jobId:r,...e}),r}getQueue(e,r){const n=this.getQueueId(e,r);let i=this.queues.find(a=>a.getId()===n);return i||(i=new DK(n),this.queues.push(i)),i}removeQueue(e,r){const n=this.getQueueId(e,r);this.queues=this.queues.filter(i=>i.getId()!==n),this.emit("queueRemoved",n)}getQueueByIndex(e){const r=this.queues[e];return r||null}getQueues(){return this.queues.map(e=>e.getId())}retryNextJob(e){const r=e!==void 0?e:this.timeout;(r>0?i=>setTimeout(i,r):xK)(()=>this.processNextJob())}async findFirstNonEmptyQueue(e){const r=this.queues.length;for(let n=0;n<r;n++){const i=(e+n)%r,a=this.queues[i];if(a&&await a.amountOfJobs()>0)return i}return null}async processNextJob(){if(!this.delegate)throw new Error("No server delegate defined");if(this.queues.length===0){this.retryNextJob();return}const e=this.queues[this.ticker];if(!e){this.ticker=0,this.retryNextJob();return}if(await e.amountOfJobs()===0){const a=await this.findFirstNonEmptyQueue(this.ticker);a!==null?(this.ticker=a,this.retryNextJob(0)):this.retryNextJob();return}if(this.ticker=this.ticker===this.queues.length-1?0:this.ticker+1,await e.isBlocked()){this.retryNextJob();return}await e.setBlocked(!0);const i=await e.getNextJob();if(!i){this.retryNextJob();return}try{const a=await this.delegate.processJob(i),o=(km(i)?i.operations:i.actions).filter(u=>u.type==="ADD_FILE");if(o.length>0)for(const u of o)await this.getQueue(i.driveId,u.input.id).removeDependencies(i);this.emit("jobCompleted",i,a)}catch(a){ir.error("job failed",a),this.emit("jobFailed",i,a)}finally{await e.setBlocked(!1),this.retryNextJob(0)}}emit(e,...r){this.emitter.emit(e,...r)}on(e,r){return this.emitter.on(e,r)}getQueueId(e,r){return`queue:${e}${r?`:${r}`:""}`}}class B0 extends Error{}class gu extends B0{constructor(e){super(`Read drive ${e} not found.`)}}class AK extends B0{constructor(e){super(`Read drive with slug ${e} not found.`)}}class OS extends B0{constructor(e,r){super(`Document with id ${r} not found on read drive ${e}.`)}}var Fh,wa,rc,lw,YO;class NK{constructor(e){Ja(this,rc);Ja(this,Fh);Ja(this,wa,new Map);md(this,Fh,e)}async fetchDrive(e){const r=Ir(this,wa).get(e);if(!r)return new gu(e);const n=await this.fetchDocument(e,e,R0.id);if(n instanceof Error)return n;const i={...n,readContext:r.context};return r.drive=i,i}async fetchDocument(e,r,n){const i=Ir(this,wa).get(e);if(!i)return new gu(e);let a;try{a=Ir(this,Fh).call(this,n)}catch(c){return new bK(n,c)}const{url:s}=i.context,{errors:o,document:u}=await wS(s,r,a);if(o){const c=ma(this,rc,lw).call(this,o,e,r);if(c instanceof B0)return c;if(c)throw c}return u||new OS(e,r)}async addReadDrive(e,r){const{id:n}=(r==null?void 0:r.expectedDriveInfo)??await _u(e),i=await ma(this,rc,YO).call(this,n,e);if(i instanceof Error)throw i;if(!i)throw new Error(`Drive "${n}" not found at ${e}`);Ir(this,wa).set(n,{drive:i,context:{...r,url:e}})}async getReadDrives(){return Promise.resolve([...Ir(this,wa).keys()])}async getReadDrive(e){const r=Ir(this,wa).get(e);return Promise.resolve(r?{...r.drive,readContext:r.context}:new gu(e))}async getReadDriveBySlug(e){const r=[...Ir(this,wa).values()].find(({drive:n})=>n.state.global.slug===e);return Promise.resolve(r?{...r.drive,readContext:r.context}:new AK(e))}getReadDriveContext(e){var r;return Promise.resolve(((r=Ir(this,wa).get(e))==null?void 0:r.context)??new gu(e))}deleteReadDrive(e){const r=Ir(this,wa).delete(e);return Promise.resolve(r?void 0:new gu(e))}}Fh=new WeakMap,wa=new WeakMap,rc=new WeakSet,lw=function(e,r,n){for(const a of e){if(a.message===`Drive with id ${r} not found`)return new gu(r);if(n&&a.message===`Document with id ${n} not found`)return new OS(r,n)}const i=e.at(0);if(i)return i},YO=async function(e,r){const{errors:n,document:i}=await wS(r,e,vK);return(n?ma(this,rc,lw).call(this,n,e):void 0)||i};function IK(t){var e,r,n,Rm,Fm,s;return s=class extends t{constructor(...c){super(...c);Ja(this,n);Ja(this,e);Ja(this,r,new Set);md(this,e,new NK(this.getDocumentModel.bind(this))),ma(this,n,Rm).call(this).then(l=>{l.length&&ma(this,n,Fm).call(this,l,"add")}).catch(ir.error)}getReadDrives(){return Ir(this,e).getReadDrives()}getReadDrive(c){return Ir(this,e).getReadDrive(c)}getReadDriveBySlug(c){return Ir(this,e).getReadDriveBySlug(c)}getReadDriveContext(c){return Ir(this,e).getReadDriveContext(c)}async addReadDrive(c,l){await Ir(this,e).addReadDrive(c,l),ma(this,n,Fm).call(this,await ma(this,n,Rm).call(this),"add")}fetchDrive(c){return Ir(this,e).fetchDrive(c)}fetchDocument(c,l,d){return Ir(this,e).fetchDocument(c,l,d)}async deleteReadDrive(c){const l=await Ir(this,e).deleteReadDrive(c);if(l)return l;ma(this,n,Fm).call(this,await ma(this,n,Rm).call(this),"delete")}async migrateReadDrive(c,l){const d=await this.getReadDriveContext(c);if(d instanceof Error)return d;const{url:f,...h}=d;try{return await this.addRemoteDrive(f,l)}catch(p){throw ir.error(p),await this.addReadDrive(d.url,h),p}}onReadDrivesUpdate(c){return Ir(this,r).add(c),Promise.resolve(()=>Ir(this,r).delete(c))}},e=new WeakMap,r=new WeakMap,n=new WeakSet,Rm=async function(){const c=await this.getReadDrives();return(await Promise.all(c.map(d=>this.getReadDrive(d)))).filter(d=>!(d instanceof Error))},Fm=function(c,l){Ir(this,r).forEach(d=>d(c,l))},s}class CK{constructor(){this.slugToDriveId={},this.documents={},this.drives={}}checkDocumentExists(e,r){var n;return Promise.resolve(((n=this.documents[e])==null?void 0:n[r])!==void 0)}async getDocuments(e){return Object.keys(this.documents[e]??{})}async getDocument(e,r){const n=this.documents[e];if(!n)throw new of(e);const i=n[r];if(!i)throw new Error(`Document with id ${r} not found`);return i}async saveDocument(e,r,n){this.documents[e]=this.documents[e]??{},this.documents[e][r]=n}async clearStorage(){this.documents={},this.drives={}}async createDocument(e,r,n){this.documents[e]=this.documents[e]??{};const{operations:i,initialState:a,name:s,revision:o,documentType:u,created:c,lastModified:l,clipboard:d,state:f}=n;this.documents[e][r]={operations:i,initialState:a,name:s,revision:o,documentType:u,created:c,lastModified:l,clipboard:d,state:f}}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_g(a.operations,n);this.documents[e][r]={...a,...i,operations:s}}async deleteDocument(e,r){if(!this.documents[e])throw new of(e);delete this.documents[e][r]}async getDrives(){return Object.keys(this.drives)}async getDrive(e){const r=this.drives[e];if(!r)throw new of(e);return r}async getDriveBySlug(e){const r=this.slugToDriveId[e];if(!r)throw new Error(`Drive with slug ${e} not found`);return this.getDrive(r)}async createDrive(e,r){this.drives[e]=r,this.documents[e]={};const{slug:n}=r.initialState.state.global;n&&(this.slugToDriveId[n]=e)}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_g(i.operations,r);this.drives[e]={...i,...n,operations:a}}async deleteDrive(e){delete this.documents[e],delete this.drives[e]}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}}function OK(t){return typeof t.getReadDrives=="function"}class MK{constructor(e,r,n){if(this.server=e,this.delegate=r,this.defaultRemoteDrives=new Map,n!=null&&n.defaultDrives.remoteDrives)for(const i of n.defaultDrives.remoteDrives)this.defaultRemoteDrives.set(i.url,{...i,status:"PENDING"});this.removeOldRemoteDrivesConfig=(n==null?void 0:n.defaultDrives.removeOldRemoteDrives)||{strategy:"preserve-all"}}getDefaultRemoteDrives(){return new Map(JSON.parse(JSON.stringify(Array.from(this.defaultRemoteDrives))))}async deleteDriveById(e){try{await this.server.deleteDrive(e)}catch(r){r instanceof of||ir.error(r)}}async preserveDrivesById(e,r,n="detach"){const i=r.map(o=>this.server.getDrive(o)),s=(await Promise.all(i)).filter(o=>o.state.local.listeners.length>0||o.state.local.triggers.length>0).filter(o=>!e.includes(o.state.global.id)).map(o=>o.state.global.id);n==="detach"?await this.detachDrivesById(s):await this.removeDrivesById(s)}async removeDrivesById(e){for(const r of e)await this.deleteDriveById(r)}async detachDrivesById(e){const r=e.map(n=>this.delegate.detachDrive(n));await Promise.all(r)}async removeOldremoteDrives(){const e=await this.server.getDrives();switch(this.removeOldRemoteDrivesConfig.strategy){case"preserve-by-id-and-detach":case"preserve-by-id":{const r=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-id-and-detach"?"detach":"remove";await this.preserveDrivesById(this.removeOldRemoteDrivesConfig.ids,e,r);break}case"preserve-by-url-and-detach":case"preserve-by-url":{const r=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-url-and-detach"?"detach":"remove",n=this.removeOldRemoteDrivesConfig.urls.map(a=>_u(a)),i=(await Promise.all(n)).map(a=>a.id);await this.preserveDrivesById(i,e,r);break}case"remove-by-id":{const r=this.removeOldRemoteDrivesConfig.ids.filter(n=>e.includes(n));await this.removeDrivesById(r);break}case"remove-by-url":{const r=this.removeOldRemoteDrivesConfig.urls.map(a=>_u(a)),i=(await Promise.all(r)).map(a=>a.id).filter(a=>e.includes(a));await this.removeDrivesById(i);break}case"remove-all":{const r=e.map(a=>this.server.getDrive(a)),i=(await Promise.all(r)).filter(a=>a.state.local.listeners.length>0||a.state.local.triggers.length>0).map(a=>a.state.global.id);await this.removeDrivesById(i);break}case"detach-by-id":{const n=this.removeOldRemoteDrivesConfig.ids.filter(i=>e.includes(i)).map(i=>this.delegate.detachDrive(i));await Promise.all(n);break}case"detach-by-url":{const r=this.removeOldRemoteDrivesConfig.urls.map(s=>_u(s)),a=(await Promise.all(r)).map(s=>s.id).filter(s=>e.includes(s)).map(s=>this.delegate.detachDrive(s));await Promise.all(a);break}}}async setAllDefaultDrivesAccessLevel(e){const r=this.defaultRemoteDrives.values();for(const n of r)await this.setDefaultDriveAccessLevel(n.url,e)}async setDefaultDriveAccessLevel(e,r){const n=this.defaultRemoteDrives.get(e);if(n&&n.options.accessLevel!==r){const i={...n,options:{...n.options,accessLevel:r}};this.defaultRemoteDrives.set(e,i),await this.initializeDefaultRemoteDrives([i])}}async initializeDefaultRemoteDrives(e=Array.from(this.defaultRemoteDrives.values())){const r=await this.server.getDrives(),n=OK(this.server)?this.server:void 0,i=await(n==null?void 0:n.getReadDrives());for(const a of e){let s={...a};try{const o=a.metadata??await _u(a.url);s={...a,metadata:o},this.defaultRemoteDrives.set(a.url,s);const u=r.includes(o.id),c=i==null?void 0:i.includes(o.id),l=a.options.accessLevel!==void 0,d=n&&a.options.accessLevel==="READ",f=d?c:u;if(l&&(d?u:c))try{await(d?this.server.deleteDrive(o.id):n==null?void 0:n.deleteReadDrive(o.id))}catch(p){ir.error(p)}if(f){s.status="ALREADY_ADDED",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ALREADY_ADDED",this.defaultRemoteDrives,s,o.id,o.name);continue}s.status="ADDING",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ADDING",this.defaultRemoteDrives,s),!l&&n||d?await n.addReadDrive(a.url,{...a.options,expectedDriveInfo:o}):await this.server.addRemoteDrive(a.url,{...a.options,expectedDriveInfo:o}),s.status="SUCCESS",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("SUCCESS",this.defaultRemoteDrives,s,o.id,o.name)}catch(o){s.status="ERROR",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ERROR",this.defaultRemoteDrives,s,void 0,void 0,o)}}}}const{attachBranch:kK,garbageCollect:RK,groupOperationsByScope:FK,merge:PK,split:a9e,precedes:BK,removeExistingOperations:LK,reshuffleByTimestamp:jK,sortOperations:$K,addUndo:s9e,checkOperationsIntegrity:o9e,checkCleanedOperationsIntegrity:u9e,reshuffleByTimestampAndIndex:c9e,nextSkipNumber:l9e,prepareOperations:d9e,IntegrityIssueSubType:f9e,IntegrityIssueType:h9e}=Xe.documentHelpers;class UK{}const dw={sequentialUpdates:!0};class zK{constructor(e,r=new Map,n=dw){this.listenerState=new Map,this.transmitters={},this.drive=e,this.listenerState=r,this.options={...dw,...n}}}var D0,KO;class JO{constructor(e,r){Ja(this,D0);this.listener=e,this.drive=r}async transmit(e,r){var i;if(!this.receiver)return[];const n=[];for(const a of e){const s=await ma(this,D0,KO).call(this,a),o=((i=s.at(-1))==null?void 0:i.state)??{};n.push({...a,operations:s,state:o})}try{return await this.receiver.onStrands(n),e.map(({operations:a,...s})=>{var o;return{...s,status:"SUCCESS",revision:((o=a.at(a.length-1))==null?void 0:o.index)??-1}})}catch(a){return ir.error(a),e.map(({operations:s,...o})=>{var u;return{...o,status:"ERROR",revision:(((u=s.at(0))==null?void 0:u.index)??0)-1}})}}setReceiver(e){this.receiver=e}async disconnect(){var e;await((e=this.receiver)==null?void 0:e.onDisconnect())}getListener(){return this.listener}}D0=new WeakSet,KO=async function(e){const r=[],n=new Map,i=async a=>{const s=n.get(a);if(s)return s;const o={revisions:{[e.scope]:a},checkHashes:!1},u=await(e.documentId?this.drive.getDocument(e.driveId,e.documentId,o):this.drive.getDrive(e.driveId,o));return a<0?n.set(a,u.initialState.state[e.scope]):n.set(a,u.state[e.scope]),n.get(a)};for(const a of e.operations)r.push({...a,state:await i(a.index),previousState:await i(a.index-1)});return r};class Ps{constructor(e,r,n){this.listener=e,this.drive=r,this.manager=n}getStrands(e){return this.manager.getStrands(this.listener.driveId,this.listener.listenerId,e)}disconnect(){return Promise.resolve()}async processAcknowledge(e,r,n){const i=await this.manager.getListenerSyncUnitIds(e,r);let a=!0;for(const s of n){const o=i.find(u=>u.scope===s.scope&&u.branch===s.branch&&u.driveId===s.driveId&&u.documentId==s.documentId);if(!o){ir.warn("Unknown sync unit was acknowledged",s),a=!1;continue}await this.manager.updateListenerRevision(r,e,o.syncId,s.revision)}return a}static async registerPullResponder(e,r,n){var s;const i=await nl(r,rl`
340
+ }`,template:"",reducer:"",errors:[],examples:[],scope:"local"}]}]}]},mO=t=>t!=null,rK=X.any().refine(t=>mO(t)),gO=X.enum(["Internal","MatrixConnect","PullResponder","RESTWebhook","SecureConnect","SwitchboardPush"]),yO=X.enum(["PullResponder"]);function x2(){return X.object({document:X.unknown().nullish(),documentType:X.string(),id:X.string(),name:X.string(),parentFolder:X.string().nullish(),synchronizationUnits:X.array(F0())})}function E2(){return X.object({id:X.string(),name:X.string(),parentFolder:X.string().nullish()})}function S2(){return X.object({listener:N2()})}function T2(){return X.object({trigger:P2()})}function D2(){return X.object({srcId:X.string(),synchronizationUnits:X.array(F0()).nullish(),targetId:X.string(),targetName:X.string().nullish(),targetParentFolder:X.string().nullish()})}function A2(){return X.object({id:X.string()})}function nK(){return X.object({__typename:X.literal("DocumentDriveLocalState").optional(),availableOffline:X.boolean(),listeners:X.array(N2()),sharingType:X.string().nullable(),triggers:X.array(P2())})}function iK(){return X.object({__typename:X.literal("DocumentDriveState").optional(),icon:X.string().nullable(),id:X.string(),name:X.string(),nodes:X.array(xO()),slug:X.string().nullable()})}function vO(){return X.object({__typename:X.literal("FileNode").optional(),documentType:X.string(),id:X.string(),kind:X.string(),name:X.string(),parentFolder:X.string().nullable(),synchronizationUnits:X.array(F0())})}function bO(){return X.object({__typename:X.literal("FolderNode").optional(),id:X.string(),kind:X.string(),name:X.string(),parentFolder:X.string().nullable()})}function N2(){return X.object({__typename:X.literal("Listener").optional(),block:X.boolean(),callInfo:wO().nullable(),filter:_O(),label:X.string().nullable(),listenerId:X.string(),system:X.boolean()})}function wO(){return X.object({__typename:X.literal("ListenerCallInfo").optional(),data:X.string().nullable(),name:X.string().nullable(),transmitterType:gO.nullable()})}function _O(){return X.object({__typename:X.literal("ListenerFilter").optional(),branch:X.array(X.string()).nullable(),documentId:X.array(X.string()).nullable(),documentType:X.array(X.string()),scope:X.array(X.string()).nullable()})}function I2(){return X.object({srcFolder:X.string(),targetParentFolder:X.string().nullish()})}function xO(){return X.union([vO(),bO()])}function EO(){return X.object({__typename:X.literal("PullResponderTriggerData").optional(),interval:X.string(),listenerId:X.string(),url:X.string()})}function C2(){return X.object({listenerId:X.string()})}function O2(){return X.object({triggerId:X.string()})}function M2(){return X.object({availableOffline:X.boolean()})}function k2(){return X.object({icon:X.string()})}function R2(){return X.object({name:X.string()})}function F2(){return X.object({type:X.string()})}function F0(){return X.object({__typename:X.literal("SynchronizationUnit").optional(),branch:X.string(),scope:X.string(),syncId:X.string()})}function P2(){return X.object({__typename:X.literal("Trigger").optional(),data:SO().nullable(),id:X.string(),type:yO})}function SO(){return EO()}function B2(){return X.object({documentType:X.string().nullish(),id:X.string(),name:X.string().nullish(),parentFolder:X.string().nullish()})}function L2(){return X.object({id:X.string(),name:X.string().nullish(),parentFolder:X.string().nullish()})}const aK=Object.freeze(Object.defineProperty({__proto__:null,AddFileInputSchema:x2,AddFolderInputSchema:E2,AddListenerInputSchema:S2,AddTriggerInputSchema:T2,CopyNodeInputSchema:D2,DeleteNodeInputSchema:A2,DocumentDriveLocalStateSchema:nK,DocumentDriveStateSchema:iK,FileNodeSchema:vO,FolderNodeSchema:bO,ListenerCallInfoSchema:wO,ListenerFilterSchema:_O,ListenerSchema:N2,MoveNodeInputSchema:I2,NodeSchema:xO,PullResponderTriggerDataSchema:EO,RemoveListenerInputSchema:C2,RemoveTriggerInputSchema:O2,SetAvailableOfflineInputSchema:M2,SetDriveIconInputSchema:k2,SetDriveNameInputSchema:R2,SetSharingTypeInputSchema:F2,SynchronizationUnitSchema:F0,TransmitterTypeSchema:gO,TriggerDataSchema:SO,TriggerSchema:P2,TriggerTypeSchema:yO,UpdateFileInputSchema:B2,UpdateNodeInputSchema:L2,definedNonNullAnySchema:rK,isDefinedNonNullAny:mO},Symbol.toStringTag,{value:"Module"})),du={addFileOperation(t,e,r){if(t.nodes.find(o=>o.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const n=po({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null}),i=e.input.synchronizationUnits,a=i.find(o=>!!t.nodes.find(u=>Ni(u)&&u.synchronizationUnits.find(c=>c.syncId===o.syncId)));if(a)throw new Error(`A synchronization unit with Id ${a.syncId} already exists`);const s={id:e.input.id,name:n,kind:"file",parentFolder:e.input.parentFolder??null,synchronizationUnits:i,documentType:e.input.documentType};t.nodes.push(s),r==null||r({type:"CREATE_CHILD_DOCUMENT",input:{id:e.input.id,documentType:e.input.documentType,synchronizationUnits:i,document:e.input.document}})},addFolderOperation(t,e){if(t.nodes.find(n=>n.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const r=po({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null});t.nodes.push({...e.input,name:r,kind:"folder",parentFolder:e.input.parentFolder??null})},deleteNodeOperation(t,e,r){const n=t.nodes.find(a=>a.id===e.input.id);if(!n)throw new Error(`Node with id ${e.input.id} not found`);const i=_l(n,t.nodes);t.nodes=t.nodes.filter(a=>a.id!==e.input.id&&!i.find(s=>s.id===a.id)),[n,...i].filter(a=>Ni(a)).forEach(a=>{r==null||r({type:"DELETE_CHILD_DOCUMENT",input:{id:a.id}})})},updateFileOperation(t,e){t.nodes=t.nodes.map(r=>r.id===e.input.id?{...r,name:po({nodes:t.nodes,srcName:e.input.name??r.name,targetParentFolder:e.input.parentFolder||null}),documentType:e.input.documentType??r.documentType}:r)},updateNodeOperation(t,e){t.nodes=t.nodes.map(r=>r.id===e.input.id?{...r,name:po({nodes:t.nodes,srcName:e.input.name??r.name,targetParentFolder:e.input.parentFolder||null}),parentFolder:e.input.parentFolder===null?null:r.parentFolder}:r)},copyNodeOperation(t,e,r){const n=t.nodes.find(o=>o.id===e.input.srcId);if(!n)throw new Error(`Node with id ${e.input.srcId} not found`);if(t.nodes.find(o=>o.id===e.input.targetId))throw new Error(`Node with id ${e.input.targetId} already exists`);const i=po({nodes:t.nodes,srcName:e.input.targetName||n.name,targetParentFolder:e.input.targetParentFolder||null}),a={...n,name:i,id:e.input.targetId,parentFolder:e.input.targetParentFolder||null},s=Ni(a);if(s){const o=e.input.synchronizationUnits;if(!e.input.synchronizationUnits)throw new Error("Synchronization units were not provided");const u=o.find(c=>!!t.nodes.find(l=>Ni(l)&&l.synchronizationUnits.find(d=>d.syncId===c.syncId)));if(u)throw new Error(`A synchronization unit with Id ${u.syncId} already exists`);a.synchronizationUnits=o}t.nodes.push(a),s&&(r==null||r({type:"COPY_CHILD_DOCUMENT",input:{id:e.input.srcId,newId:e.input.targetId,synchronizationUnits:a.synchronizationUnits}}))},moveNodeOperation(t,e){if(e.input.srcFolder===e.input.targetParentFolder)throw new Error("Circular Reference Error: Attempting to move a node to its current parent folder");const r=t.nodes.find(i=>i.id===e.input.srcFolder);if(!r)throw new Error(`Node with id ${e.input.srcFolder} not found`);const n=po({nodes:t.nodes,srcName:r.name,targetParentFolder:e.input.targetParentFolder||null});if(P0(r)&&_l(r,t.nodes).find(i=>i.id===e.input.targetParentFolder))throw new Error("Circular Reference Error: Cannot move a folder to one of its descendants");t.nodes=t.nodes.map(i=>i.id===e.input.srcFolder?{...i,name:n,parentFolder:e.input.targetParentFolder||null}:i)}},uo={setDriveNameOperation(t,e,r){t.name=e.input.name},setDriveIconOperation(t,e,r){t.icon=e.input.icon},setSharingTypeOperation(t,e,r){t.sharingType=e.input.type},setAvailableOfflineOperation(t,e,r){t.availableOffline=e.input.availableOffline},addListenerOperation(t,e,r){if(t.listeners.find(n=>n.listenerId===e.input.listener.listenerId))throw new Error(`A listener with Id: ${e.input.listener.listenerId} already exists`);t.listeners.push(e.input.listener)},removeListenerOperation(t,e,r){t.listeners=t.listeners.filter(n=>n.listenerId!==e.input.listenerId)},addTriggerOperation(t,e,r){if(t.triggers.find(n=>n.id===e.input.trigger.id))throw new Error(`A trigger with Id: ${e.input.trigger.id} already exists`);t.triggers.push(e.input.trigger)},removeTriggerOperation(t,e,r){t.triggers=t.triggers.filter(n=>n.id!==e.input.triggerId)}},sK=(t,e,r)=>{if(Xe.isBaseAction(e))return t;switch(e.type){case"ADD_FILE":x2().parse(e.input),du.addFileOperation(t[e.scope],e,r);break;case"ADD_FOLDER":E2().parse(e.input),du.addFolderOperation(t[e.scope],e,r);break;case"DELETE_NODE":A2().parse(e.input),du.deleteNodeOperation(t[e.scope],e,r);break;case"UPDATE_FILE":B2().parse(e.input),du.updateFileOperation(t[e.scope],e,r);break;case"UPDATE_NODE":L2().parse(e.input),du.updateNodeOperation(t[e.scope],e,r);break;case"COPY_NODE":D2().parse(e.input),du.copyNodeOperation(t[e.scope],e,r);break;case"MOVE_NODE":I2().parse(e.input),du.moveNodeOperation(t[e.scope],e,r);break;case"SET_DRIVE_NAME":R2().parse(e.input),uo.setDriveNameOperation(t[e.scope],e,r);break;case"SET_DRIVE_ICON":k2().parse(e.input),uo.setDriveIconOperation(t[e.scope],e,r);break;case"SET_SHARING_TYPE":F2().parse(e.input),uo.setSharingTypeOperation(t[e.scope],e,r);break;case"SET_AVAILABLE_OFFLINE":M2().parse(e.input),uo.setAvailableOfflineOperation(t[e.scope],e,r);break;case"ADD_LISTENER":S2().parse(e.input),uo.addListenerOperation(t[e.scope],e,r);break;case"REMOVE_LISTENER":C2().parse(e.input),uo.removeListenerOperation(t[e.scope],e,r);break;case"ADD_TRIGGER":T2().parse(e.input),uo.addTriggerOperation(t[e.scope],e,r);break;case"REMOVE_TRIGGER":O2().parse(e.input),uo.removeTriggerOperation(t[e.scope],e,r);break;default:return t}},Wu=Xe.createReducer(sK),oK={id:"",name:"",nodes:[],icon:null,slug:null},uK={listeners:[],triggers:[],sharingType:"private",availableOffline:!1},sf={fileExtension:"phdd",createState(t){return{global:{...oK,...t==null?void 0:t.global},local:{...uK,...t==null?void 0:t.local}}},createExtendedState(t){return Xe.createExtendedState({...t,documentType:"powerhouse/document-drive"},sf.createState)},createDocument(t){return Xe.createDocument(sf.createExtendedState(t),sf.createState)},saveToFile(t,e,r){return Xe.saveToFile(t,e,"phdd",r)},saveToFileHandle(t,e){return Xe.saveToFileHandle(t,e)},loadFromFile(t){return Xe.loadFromFile(t,Wu)},loadFromInput(t){return Xe.loadFromInput(t,Wu)}},{createAction:oc}=Xe,j2=t=>oc("ADD_FILE",{...t},void 0,x2,"global"),TO=t=>oc("ADD_FOLDER",{...t},void 0,E2,"global"),DO=t=>oc("DELETE_NODE",{...t},void 0,A2,"global"),AO=t=>oc("UPDATE_FILE",{...t},void 0,B2,"global"),NO=t=>oc("UPDATE_NODE",{...t},void 0,L2,"global"),$2=t=>oc("COPY_NODE",{...t},void 0,D2,"global"),IO=t=>oc("MOVE_NODE",{...t},void 0,I2,"global");let cK=class extends Pr{addFile(e){return this.dispatch(j2(e))}addFolder(e){return this.dispatch(TO(e))}deleteNode(e){return this.dispatch(DO(e))}updateFile(e){return this.dispatch(AO(e))}updateNode(e){return this.dispatch(NO(e))}copyNode(e){return this.dispatch($2(e))}moveNode(e){return this.dispatch(IO(e))}};const{createAction:Xo}=Xe,CO=t=>Xo("SET_DRIVE_NAME",{...t},void 0,R2,"global"),OO=t=>Xo("SET_DRIVE_ICON",{...t},void 0,k2,"global"),MO=t=>Xo("SET_SHARING_TYPE",{...t},void 0,F2,"local"),kO=t=>Xo("SET_AVAILABLE_OFFLINE",{...t},void 0,M2,"local"),RO=t=>Xo("ADD_LISTENER",{...t},void 0,S2,"local"),FO=t=>Xo("REMOVE_LISTENER",{...t},void 0,C2,"local"),PO=t=>Xo("ADD_TRIGGER",{...t},void 0,T2,"local"),BO=t=>Xo("REMOVE_TRIGGER",{...t},void 0,O2,"local");let lK=class extends Pr{setDriveName(e){return this.dispatch(CO(e))}setDriveIcon(e){return this.dispatch(OO(e))}setSharingType(e){return this.dispatch(MO(e))}setAvailableOffline(e){return this.dispatch(kO(e))}addListener(e){return this.dispatch(RO(e))}removeListener(e){return this.dispatch(FO(e))}addTrigger(e){return this.dispatch(PO(e))}removeTrigger(e){return this.dispatch(BO(e))}};const LO=class jO extends Pr{constructor(e,r){super(Wu,sf.createDocument(e),r)}saveToFile(e,r){return super.saveToFile(e,jO.fileExtension,r)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const r=new this;return await r.loadFromFile(e),r}};tK(LO,"fileExtension","phdd");let U2=LO;Go(U2,[cK,lK]);const dK=Object.freeze(Object.defineProperty({__proto__:null,addFile:j2,addFolder:TO,addListener:RO,addTrigger:PO,copyNode:$2,deleteNode:DO,moveNode:IO,removeListener:FO,removeTrigger:BO,setAvailableOffline:kO,setDriveIcon:OO,setDriveName:CO,setSharingType:MO,updateFile:AO,updateNode:NO},Symbol.toStringTag,{value:"Module"}));var Zn=[];for(var d1=0;d1<256;++d1)Zn.push((d1+256).toString(16).slice(1));function fK(t,e=0){return(Zn[t[e+0]]+Zn[t[e+1]]+Zn[t[e+2]]+Zn[t[e+3]]+"-"+Zn[t[e+4]]+Zn[t[e+5]]+"-"+Zn[t[e+6]]+Zn[t[e+7]]+"-"+Zn[t[e+8]]+Zn[t[e+9]]+"-"+Zn[t[e+10]]+Zn[t[e+11]]+Zn[t[e+12]]+Zn[t[e+13]]+Zn[t[e+14]]+Zn[t[e+15]]).toLowerCase()}var Np,hK=new Uint8Array(16);function pK(){if(!Np&&(Np=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Np))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Np(hK)}var mK=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const CS={randomUUID:mK};function gK(t,e,r){if(CS.randomUUID&&!t)return CS.randomUUID();t=t||{};var n=t.random||(t.rng||pK)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,fK(n)}function Ni(t){return t.kind==="file"}function P0(t){return t.kind==="folder"}function z2(t,e){if(t.parentFolder){const r=e.find(n=>n.id===t.parentFolder);if(!r)throw new Error(`Parent node with id ${t.parentFolder} not found`);return[r,...z2(r,e)]}else return[]}function _l(t,e){const r=e.filter(i=>i.parentFolder===t.id),n=r.map(i=>_l(i,e));return[...r,...n.flat()]}function $O(t,e,r){const n=r.find(o=>o.id===t.srcId);if(!n)throw new Error(`Node with id ${t.srcId} not found`);const i=[{...n,name:t.targetName||n.name,parentFolder:t.targetParentFolder||null},..._l(n,r)],a={};t.targetParentFolder&&(a[t.targetParentFolder]=t.targetParentFolder);const s=o=>{let u=a[o];if(!u){const c=o;u=e(o),a[c]=u}return u};return i.map(o=>({srcId:o.id,targetId:s(o.id),targetName:o.name,targetParentFolder:o.parentFolder?s(o.parentFolder):null,synchronizationUnits:Ni(o)?o.synchronizationUnits.map(u=>({...u,syncId:Yh(r)})):void 0}))}function Yh(t){let e="";for(;!e||t.find(r=>Ni(r)&&r.synchronizationUnits.find(n=>n.syncId===e));)e=gK();return e}function q2(t,e,r="main"){return e.map(n=>({scope:n,branch:r,syncId:Yh(t.nodes)}))}function V2(t,e,r){return j2({...e,synchronizationUnits:q2(t,r)})}function UO(t,e){const r=t.nodes.find(i=>i.id===e.srcId);if(!r)throw new Error(`Node with id ${e.srcId} not found`);let n;return Ni(r)&&(n=r.synchronizationUnits.map(i=>({...i,syncId:Yh(t.nodes)}))),$2({...e,synchronizationUnits:n})}function Z2(t,e){let r=0;const n=new RegExp(`^${H2(e)} \\(copy\\)(?: (\\d+))?$`);for(const i of t){const a=i.match(n);if(a){const s=a[1]?parseInt(a[1],10):1;s>r&&(r=s)}}return r+1}function H2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function po(t){const{nodes:e,targetParentFolder:r,srcName:n}=t,i=e.filter(a=>r===""?a.parentFolder===null:a.parentFolder===r).map(a=>a.name);return i.includes(n)?`${n} (copy) ${Z2(i,n)}`:n}const yK=Object.freeze(Object.defineProperty({__proto__:null,escapeRegExp:H2,generateAddNodeAction:V2,generateCopyNodeAction:UO,generateNodesCopy:$O,generateSynchronizationUnitId:Yh,generateSynchronizationUnits:q2,getAncestors:z2,getDescendants:_l,getNextCopyNumber:Z2,handleTargetNameCollisions:po,isFileNode:Ni,isFolderNode:P0},Symbol.toStringTag,{value:"Module"})),zO=U2,nh={...sf,...yK},Yn={...Ko,...dK},qO={Document:zO,reducer:Wu,actions:Yn,utils:nh,documentModel:R0},vK=Object.freeze(Object.defineProperty({__proto__:null,Document:zO,DocumentDrive:U2,actions:Yn,documentModel:R0,escapeRegExp:H2,generateAddNodeAction:V2,generateCopyNodeAction:UO,generateNodesCopy:$O,generateSynchronizationUnitId:Yh,generateSynchronizationUnits:q2,getAncestors:z2,getDescendants:_l,getNextCopyNumber:Z2,handleTargetNameCollisions:po,isFileNode:Ni,isFolderNode:P0,module:qO,reducer:Wu,utils:nh,z:aK},Symbol.toStringTag,{value:"Module"}));let VO=()=>({emit(t,...e){for(let r=this.events[t]||[],n=0,i=r.length;n<i;n++)r[n](...e)},events:{},on(t,e){var r;return((r=this.events)[t]||(r[t]=[])).push(e),()=>{var n;this.events[t]=(n=this.events[t])==null?void 0:n.filter(i=>e!==i)}}});class ZO{constructor(){this.cache=new Map}async setDocument(e,r,n){var o;const i=n.operations.global.map(u=>(delete u.resultingState,u)),a=n.operations.local.map(u=>(delete u.resultingState,u)),s={...n,operations:{global:i,local:a}};return this.cache.has(e)||this.cache.set(e,new Map),(o=this.cache.get(e))==null||o.set(r,s),!0}async deleteDocument(e,r){var n;return((n=this.cache.get(e))==null?void 0:n.delete(r))??!1}async getDocument(e,r){var n;return(n=this.cache.get(e))==null?void 0:n.get(r)}}class bK extends Error{constructor(e,r){super(`Document model "${e}" not found`,{cause:r}),this.id=e}}class Di extends Error{constructor(e,r,n,i){super(n,{cause:i??r}),this.status=e,this.operation=r}}class wK extends Di{constructor(e,r){super("CONFLICT",r,`Conflicting operation on index ${r.index}`,{existingOperation:e,newOperation:r})}}class _K extends Error{constructor(e){super(`Drive already exists. ID: ${e}`),this.driveId=e}}class of extends Error{constructor(e){super(`Drive with id ${e} not found`),this.driveId=e}}class HO extends Error{constructor(e,r){super(e),this.syncUnitId=r}}var ih;(t=>{t.useMessageChannel=typeof MessageChannel>"u"?new Error("MessageChannel is not supported"):n=>{const i=new AbortController,a=i.signal,s=new MessageChannel;return s.port1.postMessage(null),s.port2.addEventListener("message",()=>{n(),s.port1.close(),s.port2.close()},{once:!0,signal:a}),s.port2.start(),()=>i.abort()},t.usePostMessage=(()=>{const n=typeof window=="object"&&window||typeof global=="object"&&global||typeof self=="object"&&self;if(!n)return new Error("No global object found");const i=n;if(!i.postMessage||!i.addEventListener||i.importScripts)return new Error("postMessage is not supported");let a=0;const s=new Map;function o(){return a===9007199254740991?0:++a}const u="com.usePostMessage"+Math.random();return i.addEventListener("message",c=>{const l=c;if(typeof l.data!="string"||l.source!==i||!l.data.startsWith(u))return;const d=l.data.split(":").at(1);if(d===void 0)return;const f=+d,h=s.get(f);h&&(h(),s.delete(f))},!1),c=>{const l=o();return s.set(l,c),i.postMessage(u+":"+l,{targetOrigin:"*"}),()=>{s.delete(l)}}})(),t.useSetImmediate=typeof window<"u"?new Error("setImmediate is not supported on the browser"):typeof setImmediate>"u"?new Error("setImmediate is not supported"):n=>{const i=setImmediate(n);return()=>clearImmediate(i)},t.useSetTimeout=n=>{const i=setTimeout(n,0);return()=>clearTimeout(i)};function e(n){return t.useSetImmediate instanceof Error?t.useMessageChannel instanceof Error?t.usePostMessage instanceof Error?(0,t.useSetTimeout)(n):(0,t.usePostMessage)(n):(0,t.useMessageChannel)(n):(0,t.useSetImmediate)(n)}t.runAsap=e;function r(n,i=e){if(i instanceof Error)throw new Error("queueMethod is not supported",{cause:i});return new Promise((a,s)=>{i(()=>{n().then(a).catch(s)})})}t.runAsapAsync=r})(ih||(ih={}));const xK=ih.runAsap,EK=ih.runAsapAsync;function mu(t){return t.documentType===R0.id}function _g(t,e){const r=Object.keys(t).reduce((i,a)=>{var o;const s=a;return i[s]=((o=t[s].at(-1))==null?void 0:o.index)??0,i},{}),n=e.find(i=>i.index<(r[i.scope]??0));if(n)throw new Di("ERROR",n,`Tried to add operation with index ${n.index} and document is at index ${r[n.scope]}`);return e.sort((i,a)=>i.index-a.index).reduce((i,a)=>{const s=i[a.scope]||[];return{...i,[a.scope]:[...s,a]}},t)}function W2(){return s2()}function SK(t,e){return new Date(t)<new Date(e)}function km(t){return"operations"in t}function TK(t){return"actions"in t}class DK{constructor(e){this.blocked=!1,this.deleted=!1,this.items=[],this.dependencies=new Array,this.id=e}async setDeleted(e){this.deleted=e}async isDeleted(){return this.deleted}async addJob(e){return this.items.push(e),Promise.resolve()}async getNextJob(){const e=this.items.shift();return Promise.resolve(e)}async amountOfJobs(){return Promise.resolve(this.items.length)}getId(){return this.id}async setBlocked(e){this.blocked=e}async isBlocked(){return this.blocked}async getJobs(){return this.items}async addDependencies(e){this.dependencies.find(r=>r.jobId===e.jobId)||this.dependencies.push(e),this.isBlocked()||this.setBlocked(!0)}async removeDependencies(e){this.dependencies=this.dependencies.filter(r=>r.jobId!==e.jobId&&r.driveId!==e.driveId),this.dependencies.length===0&&await this.setBlocked(!1)}}class WO{constructor(e=3,r=0){this.emitter=VO(),this.ticker=0,this.queues=[],this.workers=e,this.timeout=r}async init(e,r){this.delegate=e;for(let n=0;n<this.workers;n++)setTimeout(()=>this.processNextJob.bind(this)().catch(r),100*n);return Promise.resolve()}async addJob(e){if(!this.delegate)throw new Error("No server delegate defined");const r=W2(),n=this.getQueue(e.driveId,e.documentId);if(await n.isDeleted())throw new Error("Queue is deleted");if(e.documentId&&!await this.delegate.checkDocumentExists(e.driveId,e.documentId)&&!await n.isBlocked()){await n.setBlocked(!0);const c=await this.getQueue(e.driveId).getJobs();for(const l of c)(km(l)?l.operations:l.actions).find(h=>{const p=h.input;return h.type==="ADD_FILE"&&p.id===e.documentId})&&await n.addDependencies(l)}const a=km(e)?e.operations:e.actions,s=a.filter(u=>u.type==="ADD_FILE");for(const u of s){const c=u.input;await this.getQueue(e.driveId,c.id).addDependencies({jobId:r,...e})}const o=a.filter(u=>u.type==="DELETE_NODE");for(const u of o){const c=u.input;await this.getQueue(e.driveId,c.id).setDeleted(!0)}return await n.addJob({jobId:r,...e}),r}getQueue(e,r){const n=this.getQueueId(e,r);let i=this.queues.find(a=>a.getId()===n);return i||(i=new DK(n),this.queues.push(i)),i}removeQueue(e,r){const n=this.getQueueId(e,r);this.queues=this.queues.filter(i=>i.getId()!==n),this.emit("queueRemoved",n)}getQueueByIndex(e){const r=this.queues[e];return r||null}getQueues(){return this.queues.map(e=>e.getId())}retryNextJob(e){const r=e!==void 0?e:this.timeout;(r>0?i=>setTimeout(i,r):xK)(()=>this.processNextJob())}async findFirstNonEmptyQueue(e){const r=this.queues.length;for(let n=0;n<r;n++){const i=(e+n)%r,a=this.queues[i];if(a&&await a.amountOfJobs()>0)return i}return null}async processNextJob(){if(!this.delegate)throw new Error("No server delegate defined");if(this.queues.length===0){this.retryNextJob();return}const e=this.queues[this.ticker];if(!e){this.ticker=0,this.retryNextJob();return}if(await e.amountOfJobs()===0){const a=await this.findFirstNonEmptyQueue(this.ticker);a!==null?(this.ticker=a,this.retryNextJob(0)):this.retryNextJob();return}if(this.ticker=this.ticker===this.queues.length-1?0:this.ticker+1,await e.isBlocked()){this.retryNextJob();return}await e.setBlocked(!0);const i=await e.getNextJob();if(!i){this.retryNextJob();return}try{const a=await this.delegate.processJob(i),o=(km(i)?i.operations:i.actions).filter(u=>u.type==="ADD_FILE");if(o.length>0)for(const u of o)await this.getQueue(i.driveId,u.input.id).removeDependencies(i);this.emit("jobCompleted",i,a)}catch(a){ir.error("job failed",a),this.emit("jobFailed",i,a)}finally{await e.setBlocked(!1),this.retryNextJob(0)}}emit(e,...r){this.emitter.emit(e,...r)}on(e,r){return this.emitter.on(e,r)}getQueueId(e,r){return`queue:${e}${r?`:${r}`:""}`}}class B0 extends Error{}class gu extends B0{constructor(e){super(`Read drive ${e} not found.`)}}class AK extends B0{constructor(e){super(`Read drive with slug ${e} not found.`)}}class OS extends B0{constructor(e,r){super(`Document with id ${r} not found on read drive ${e}.`)}}var Fh,wa,rc,lw,YO;class NK{constructor(e){Ja(this,rc);Ja(this,Fh);Ja(this,wa,new Map);md(this,Fh,e)}async fetchDrive(e){const r=Ir(this,wa).get(e);if(!r)return new gu(e);const n=await this.fetchDocument(e,e,R0.id);if(n instanceof Error)return n;const i={...n,readContext:r.context};return r.drive=i,i}async fetchDocument(e,r,n){const i=Ir(this,wa).get(e);if(!i)return new gu(e);let a;try{a=Ir(this,Fh).call(this,n)}catch(c){return new bK(n,c)}const{url:s}=i.context,{errors:o,document:u}=await wS(s,r,a);if(o){const c=ma(this,rc,lw).call(this,o,e,r);if(c instanceof B0)return c;if(c)throw c}return u||new OS(e,r)}async addReadDrive(e,r){const{id:n}=(r==null?void 0:r.expectedDriveInfo)??await _u(e),i=await ma(this,rc,YO).call(this,n,e);if(i instanceof Error)throw i;if(!i)throw new Error(`Drive "${n}" not found at ${e}`);Ir(this,wa).set(n,{drive:i,context:{...r,url:e}})}async getReadDrives(){return Promise.resolve([...Ir(this,wa).keys()])}async getReadDrive(e){const r=Ir(this,wa).get(e);return Promise.resolve(r?{...r.drive,readContext:r.context}:new gu(e))}async getReadDriveBySlug(e){const r=[...Ir(this,wa).values()].find(({drive:n})=>n.state.global.slug===e);return Promise.resolve(r?{...r.drive,readContext:r.context}:new AK(e))}getReadDriveContext(e){var r;return Promise.resolve(((r=Ir(this,wa).get(e))==null?void 0:r.context)??new gu(e))}deleteReadDrive(e){const r=Ir(this,wa).delete(e);return Promise.resolve(r?void 0:new gu(e))}}Fh=new WeakMap,wa=new WeakMap,rc=new WeakSet,lw=function(e,r,n){for(const a of e){if(a.message===`Drive with id ${r} not found`)return new gu(r);if(n&&a.message===`Document with id ${n} not found`)return new OS(r,n)}const i=e.at(0);if(i)return i},YO=async function(e,r){const{errors:n,document:i}=await wS(r,e,vK);return(n?ma(this,rc,lw).call(this,n,e):void 0)||i};function IK(t){var e,r,n,Rm,Fm,s;return s=class extends t{constructor(...c){super(...c);Ja(this,n);Ja(this,e);Ja(this,r,new Set);md(this,e,new NK(this.getDocumentModel.bind(this))),ma(this,n,Rm).call(this).then(l=>{l.length&&ma(this,n,Fm).call(this,l,"add")}).catch(ir.error)}getReadDrives(){return Ir(this,e).getReadDrives()}getReadDrive(c){return Ir(this,e).getReadDrive(c)}getReadDriveBySlug(c){return Ir(this,e).getReadDriveBySlug(c)}getReadDriveContext(c){return Ir(this,e).getReadDriveContext(c)}async addReadDrive(c,l){await Ir(this,e).addReadDrive(c,l),ma(this,n,Fm).call(this,await ma(this,n,Rm).call(this),"add")}fetchDrive(c){return Ir(this,e).fetchDrive(c)}fetchDocument(c,l,d){return Ir(this,e).fetchDocument(c,l,d)}async deleteReadDrive(c){const l=await Ir(this,e).deleteReadDrive(c);if(l)return l;ma(this,n,Fm).call(this,await ma(this,n,Rm).call(this),"delete")}async migrateReadDrive(c,l){const d=await this.getReadDriveContext(c);if(d instanceof Error)return d;const{url:f,...h}=d;try{return await this.addRemoteDrive(f,l)}catch(p){throw ir.error(p),await this.addReadDrive(d.url,h),p}}onReadDrivesUpdate(c){return Ir(this,r).add(c),Promise.resolve(()=>Ir(this,r).delete(c))}},e=new WeakMap,r=new WeakMap,n=new WeakSet,Rm=async function(){const c=await this.getReadDrives();return(await Promise.all(c.map(d=>this.getReadDrive(d)))).filter(d=>!(d instanceof Error))},Fm=function(c,l){Ir(this,r).forEach(d=>d(c,l))},s}class CK{constructor(){this.slugToDriveId={},this.documents={},this.drives={}}checkDocumentExists(e,r){var n;return Promise.resolve(((n=this.documents[e])==null?void 0:n[r])!==void 0)}async getDocuments(e){return Object.keys(this.documents[e]??{})}async getDocument(e,r){const n=this.documents[e];if(!n)throw new of(e);const i=n[r];if(!i)throw new Error(`Document with id ${r} not found`);return i}async saveDocument(e,r,n){this.documents[e]=this.documents[e]??{},this.documents[e][r]=n}async clearStorage(){this.documents={},this.drives={}}async createDocument(e,r,n){this.documents[e]=this.documents[e]??{};const{operations:i,initialState:a,name:s,revision:o,documentType:u,created:c,lastModified:l,clipboard:d,state:f}=n;this.documents[e][r]={operations:i,initialState:a,name:s,revision:o,documentType:u,created:c,lastModified:l,clipboard:d,state:f}}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_g(a.operations,n);this.documents[e][r]={...a,...i,operations:s}}async deleteDocument(e,r){if(!this.documents[e])throw new of(e);delete this.documents[e][r]}async getDrives(){return Object.keys(this.drives)}async getDrive(e){const r=this.drives[e];if(!r)throw new of(e);return r}async getDriveBySlug(e){const r=this.slugToDriveId[e];if(!r)throw new Error(`Drive with slug ${e} not found`);return this.getDrive(r)}async createDrive(e,r){this.drives[e]=r,this.documents[e]={};const{slug:n}=r.initialState.state.global;n&&(this.slugToDriveId[n]=e)}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_g(i.operations,r);this.drives[e]={...i,...n,operations:a}}async deleteDrive(e){delete this.documents[e],delete this.drives[e]}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}}function OK(t){return typeof t.getReadDrives=="function"}class MK{constructor(e,r,n){if(this.server=e,this.delegate=r,this.defaultRemoteDrives=new Map,n!=null&&n.defaultDrives.remoteDrives)for(const i of n.defaultDrives.remoteDrives)this.defaultRemoteDrives.set(i.url,{...i,status:"PENDING"});this.removeOldRemoteDrivesConfig=(n==null?void 0:n.defaultDrives.removeOldRemoteDrives)||{strategy:"preserve-all"}}getDefaultRemoteDrives(){return new Map(JSON.parse(JSON.stringify(Array.from(this.defaultRemoteDrives))))}async deleteDriveById(e){try{await this.server.deleteDrive(e)}catch(r){r instanceof of||ir.error(r)}}async preserveDrivesById(e,r,n="detach"){const i=r.map(o=>this.server.getDrive(o)),s=(await Promise.all(i)).filter(o=>o.state.local.listeners.length>0||o.state.local.triggers.length>0).filter(o=>!e.includes(o.state.global.id)).map(o=>o.state.global.id);n==="detach"?await this.detachDrivesById(s):await this.removeDrivesById(s)}async removeDrivesById(e){for(const r of e)await this.deleteDriveById(r)}async detachDrivesById(e){const r=e.map(n=>this.delegate.detachDrive(n));await Promise.all(r)}async removeOldremoteDrives(){const e=await this.server.getDrives();switch(this.removeOldRemoteDrivesConfig.strategy){case"preserve-by-id-and-detach":case"preserve-by-id":{const r=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-id-and-detach"?"detach":"remove";await this.preserveDrivesById(this.removeOldRemoteDrivesConfig.ids,e,r);break}case"preserve-by-url-and-detach":case"preserve-by-url":{const r=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-url-and-detach"?"detach":"remove",n=this.removeOldRemoteDrivesConfig.urls.map(a=>_u(a)),i=(await Promise.all(n)).map(a=>a.id);await this.preserveDrivesById(i,e,r);break}case"remove-by-id":{const r=this.removeOldRemoteDrivesConfig.ids.filter(n=>e.includes(n));await this.removeDrivesById(r);break}case"remove-by-url":{const r=this.removeOldRemoteDrivesConfig.urls.map(a=>_u(a)),i=(await Promise.all(r)).map(a=>a.id).filter(a=>e.includes(a));await this.removeDrivesById(i);break}case"remove-all":{const r=e.map(a=>this.server.getDrive(a)),i=(await Promise.all(r)).filter(a=>a.state.local.listeners.length>0||a.state.local.triggers.length>0).map(a=>a.state.global.id);await this.removeDrivesById(i);break}case"detach-by-id":{const n=this.removeOldRemoteDrivesConfig.ids.filter(i=>e.includes(i)).map(i=>this.delegate.detachDrive(i));await Promise.all(n);break}case"detach-by-url":{const r=this.removeOldRemoteDrivesConfig.urls.map(s=>_u(s)),a=(await Promise.all(r)).map(s=>s.id).filter(s=>e.includes(s)).map(s=>this.delegate.detachDrive(s));await Promise.all(a);break}}}async setAllDefaultDrivesAccessLevel(e){const r=this.defaultRemoteDrives.values();for(const n of r)await this.setDefaultDriveAccessLevel(n.url,e)}async setDefaultDriveAccessLevel(e,r){const n=this.defaultRemoteDrives.get(e);if(n&&n.options.accessLevel!==r){const i={...n,options:{...n.options,accessLevel:r}};this.defaultRemoteDrives.set(e,i),await this.initializeDefaultRemoteDrives([i])}}async initializeDefaultRemoteDrives(e=Array.from(this.defaultRemoteDrives.values())){const r=await this.server.getDrives(),n=OK(this.server)?this.server:void 0,i=await(n==null?void 0:n.getReadDrives());for(const a of e){let s={...a};try{const o=a.metadata??await _u(a.url);s={...a,metadata:o},this.defaultRemoteDrives.set(a.url,s);const u=r.includes(o.id),c=i==null?void 0:i.includes(o.id),l=a.options.accessLevel!==void 0,d=n&&a.options.accessLevel==="READ",f=d?c:u;if(l&&(d?u:c))try{await(d?this.server.deleteDrive(o.id):n==null?void 0:n.deleteReadDrive(o.id))}catch(p){ir.error(p)}if(f){s.status="ALREADY_ADDED",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ALREADY_ADDED",this.defaultRemoteDrives,s,o.id,o.name);continue}s.status="ADDING",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ADDING",this.defaultRemoteDrives,s),!l&&n||d?await n.addReadDrive(a.url,{...a.options,expectedDriveInfo:o}):await this.server.addRemoteDrive(a.url,{...a.options,expectedDriveInfo:o}),s.status="SUCCESS",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("SUCCESS",this.defaultRemoteDrives,s,o.id,o.name)}catch(o){s.status="ERROR",this.defaultRemoteDrives.set(a.url,s),this.delegate.emit("ERROR",this.defaultRemoteDrives,s,void 0,void 0,o)}}}}const{attachBranch:kK,garbageCollect:RK,groupOperationsByScope:FK,merge:PK,split:i9e,precedes:BK,removeExistingOperations:LK,reshuffleByTimestamp:jK,sortOperations:$K,addUndo:a9e,checkOperationsIntegrity:s9e,checkCleanedOperationsIntegrity:o9e,reshuffleByTimestampAndIndex:u9e,nextSkipNumber:c9e,prepareOperations:l9e,IntegrityIssueSubType:d9e,IntegrityIssueType:f9e}=Xe.documentHelpers;class UK{}const dw={sequentialUpdates:!0};class zK{constructor(e,r=new Map,n=dw){this.listenerState=new Map,this.transmitters={},this.drive=e,this.listenerState=r,this.options={...dw,...n}}}var D0,KO;class JO{constructor(e,r){Ja(this,D0);this.listener=e,this.drive=r}async transmit(e,r){var i;if(!this.receiver)return[];const n=[];for(const a of e){const s=await ma(this,D0,KO).call(this,a),o=((i=s.at(-1))==null?void 0:i.state)??{};n.push({...a,operations:s,state:o})}try{return await this.receiver.onStrands(n),e.map(({operations:a,...s})=>{var o;return{...s,status:"SUCCESS",revision:((o=a.at(a.length-1))==null?void 0:o.index)??-1}})}catch(a){return ir.error(a),e.map(({operations:s,...o})=>{var u;return{...o,status:"ERROR",revision:(((u=s.at(0))==null?void 0:u.index)??0)-1}})}}setReceiver(e){this.receiver=e}async disconnect(){var e;await((e=this.receiver)==null?void 0:e.onDisconnect())}getListener(){return this.listener}}D0=new WeakSet,KO=async function(e){const r=[],n=new Map,i=async a=>{const s=n.get(a);if(s)return s;const o={revisions:{[e.scope]:a},checkHashes:!1},u=await(e.documentId?this.drive.getDocument(e.driveId,e.documentId,o):this.drive.getDrive(e.driveId,o));return a<0?n.set(a,u.initialState.state[e.scope]):n.set(a,u.state[e.scope]),n.get(a)};for(const a of e.operations)r.push({...a,state:await i(a.index),previousState:await i(a.index-1)});return r};class Ps{constructor(e,r,n){this.listener=e,this.drive=r,this.manager=n}getStrands(e){return this.manager.getStrands(this.listener.driveId,this.listener.listenerId,e)}disconnect(){return Promise.resolve()}async processAcknowledge(e,r,n){const i=await this.manager.getListenerSyncUnitIds(e,r);let a=!0;for(const s of n){const o=i.find(u=>u.scope===s.scope&&u.branch===s.branch&&u.driveId===s.driveId&&u.documentId==s.documentId);if(!o){ir.warn("Unknown sync unit was acknowledged",s),a=!1;continue}await this.manager.updateListenerRevision(r,e,o.syncId,s.revision)}return a}static async registerPullResponder(e,r,n){var s;const i=await nl(r,rl`
341
341
  mutation registerPullResponderListener($filter: InputListenerFilter!) {
342
342
  registerPullResponderListener(filter: $filter) {
343
343
  listenerId
@@ -399,7 +399,7 @@ type DocumentDriveLocalState{
399
399
  error
400
400
  }
401
401
  }
402
- `,{strands:e.map(a=>({...a,operations:a.operations.map(s=>({...s,input:eG(s.input)}))}))});if(!i)throw new Error("Couldn't update listener revision");return i}catch(i){throw ir.error(i),i}return[]}}function rG(t,e=250){let r;return(n,...i)=>(r&&clearTimeout(r),new Promise((a,s)=>{n?t(...i).then(a).catch(s):r=setTimeout(()=>{t(...i).then(a).catch(s)},e)}))}const A0=class A0 extends zK{constructor(){super(...arguments),this.triggerUpdate=rG(this._triggerUpdate.bind(this),A0.LISTENER_UPDATE_DELAY)}async getTransmitter(e,r){var n;return Promise.resolve((n=this.transmitters[e])==null?void 0:n[r])}driveHasListeners(e){return this.listenerState.has(e)}async addListener(e){var s;const r=e.driveId;this.listenerState.has(r)||this.listenerState.set(r,new Map),this.listenerState.get(r).set(e.listenerId,{block:e.block,driveId:e.driveId,pendingTimeout:"0",listener:e,listenerStatus:"CREATED",syncUnits:new Map});let i;switch((s=e.callInfo)==null?void 0:s.transmitterType){case"SwitchboardPush":{i=new tG(e,this.drive);break}case"PullResponder":{i=new Ps(e,this.drive,this);break}case"Internal":{i=new JO(e,this.drive);break}}if(!i)throw new Error("Transmitter not found");const a=this.transmitters[r]||{};return a[e.listenerId]=i,this.transmitters[r]=a,this.triggerUpdate(!0,{type:"local"}),Promise.resolve(i)}async removeListener(e,r){const n=this.listenerState.get(e);return n?Promise.resolve(n.delete(r)):!1}async removeSyncUnits(e,r){const n=this.listenerState.get(e);if(n){for(const[,i]of n)for(const a of r)i.syncUnits.delete(a.syncId);return Promise.resolve()}}async updateSynchronizationRevisions(e,r,n,i,a,s=!1){const o=this.listenerState.get(e);if(!o)return[];const u=[];for(const[,c]of o){if(u.find(d=>d.listenerId===c.listener.listenerId))continue;const l=await this.getTransmitter(e,c.listener.listenerId);if(l!=null&&l.transmit)for(const d of r){if(!this._checkFilter(c.listener.filter,d))continue;const f=c.syncUnits.get(d.syncId);if(!f||f.listenerRev<d.revision){u.push(c.listener);break}}}return u.length?(i==null||i(u),this.triggerUpdate(s,n,a)):[]}async updateListenerRevision(e,r,n,i){const a=this.listenerState.get(r);if(!a)return;const s=a.get(e);if(!s)return;const o=new Date().toISOString(),u=s.syncUnits.get(n);return u?(u.listenerRev=i,u.lastUpdated=o):s.syncUnits.set(n,{listenerRev:i,lastUpdated:o}),Promise.resolve()}async _triggerUpdate(e,r){var i;const n=[];for(const[a,s]of this.listenerState)for(const[o,u]of s){const c=await this.getTransmitter(a,o);if(!(c!=null&&c.transmit))continue;const l=await this.getListenerSyncUnits(a,u.listener.listenerId),d=[],f=l.map(h=>async()=>{const p=u.syncUnits.get(h.syncId);if(p&&p.listenerRev>=h.revision)return;const m=[];try{const y=await this.drive.getOperationData(a,h.syncId,{fromRevision:p==null?void 0:p.listenerRev});m.push(...y)}catch(y){ir.error(y)}m.length&&d.push({driveId:a,documentId:h.documentId,branch:h.branch,operations:m,scope:h.scope})});if(this.options.sequentialUpdates)for(const h of f)await h();else await Promise.all(f.map(h=>h()));if(d.length!=0){u.pendingTimeout=new Date(new Date().getTime()/1e3+300).toISOString(),u.listenerStatus="PENDING";try{const h=await c.transmit(d,e);u.pendingTimeout="0",u.listenerStatus="PENDING";const p=new Date().toISOString();for(const m of h){const y=l.find(g=>m.documentId===g.documentId&&m.scope===g.scope&&m.branch===g.branch);y?u.syncUnits.set(y.syncId,{lastUpdated:p,listenerRev:m.revision}):ir.warn(`Received revision for untracked unit for listener ${u.listener.listenerId}`,m)}for(const m of h){const y=m.status==="ERROR";if((i=m.error)!=null&&i.includes("Missing operations")){const g=await this._triggerUpdate(e,r);n.push(...g)}else if(n.push({listenerId:u.listener.listenerId,listenerRevisions:h}),y)throw new Di(m.status,void 0,m.error,m.error)}u.listenerStatus="SUCCESS"}catch(h){r==null||r(h,a,u),u.listenerStatus=h instanceof Di?h.status:"ERROR"}}}return n}_checkFilter(e,r){const{branch:n,documentId:i,scope:a,documentType:s}=r;return!!((!e.branch||e.branch.includes(n)||e.branch.includes("*"))&&(!e.documentId||e.documentId.includes(i)||e.documentId.includes("*"))&&(!e.scope||e.scope.includes(a)||e.scope.includes("*"))&&(!e.documentType||e.documentType.includes(s)||e.documentType.includes("*")))}getListenerSyncUnits(e,r,n){var s;const i=(s=this.listenerState.get(e))==null?void 0:s.get(r);if(!i)return[];const a=i.listener.filter;return this.drive.getSynchronizationUnits(e,a.documentId??["*"],a.scope??["*"],a.branch??["*"],a.documentType??["*"],n)}getListenerSyncUnitIds(e,r){var a;const n=(a=this.listenerState.get(e))==null?void 0:a.get(r);if(!n)return[];const i=n.listener.filter;return this.drive.getSynchronizationUnitsIds(e,i.documentId??["*"],i.scope??["*"],i.branch??["*"],i.documentType??["*"])}async initDrive(e){const{state:{local:{listeners:r}}}=e;for(const n of r)await this.addListener({block:n.block,driveId:e.state.global.id,filter:{branch:n.filter.branch??[],documentId:n.filter.documentId??[],documentType:n.filter.documentType,scope:n.filter.scope??[]},listenerId:n.listenerId,system:n.system,callInfo:n.callInfo??void 0,label:n.label??""})}async removeDrive(e){this.listenerState.delete(e);const r=this.transmitters[e];r&&await Promise.all(Object.values(r).map(n=>{var i;return(i=n.disconnect)==null?void 0:i.call(n)}))}getListener(e,r){const n=this.listenerState.get(e);if(!n)throw new Error("Drive not found");const i=n.get(r);if(!i)throw new Error("Listener not found");return Promise.resolve(i)}async getStrands(e,r,n){const i=await this.getListener(e,r),a=[],s=await this.drive.getDrive(e),o=await this.getListenerSyncUnits(e,r,s),u=n==null?void 0:n.limit;let c=0;const l=o.map(d=>async()=>{if(u&&c>=u||d.revision<0)return;const f=i.syncUnits.get(d.syncId);if(f&&f.listenerRev>=d.revision)return;const{documentId:h,driveId:p,scope:m,branch:y}=d;try{const g=await this.drive.getOperationData(p,d.syncId,{since:n==null?void 0:n.since,fromRevision:(n==null?void 0:n.fromRevision)??(f==null?void 0:f.listenerRev),limit:u?u-c:void 0},s);if(!g.length)return;c+=g.length,a.push({driveId:p,documentId:h,scope:m,branch:y,operations:g})}catch(g){ir.error(g);return}});if(this.options.sequentialUpdates)for(const d of l)await d();else await Promise.all(l.map(d=>d()));return a}};A0.LISTENER_UPDATE_DELAY=250;let fw=A0;function MS(t,e){return e?Object.keys(t).reduce((r,n)=>{const i=e[n];return i!==void 0&&(r[n]=t[n].filter(a=>a.index<=i)),r},{global:[],local:[]}):t}function f1(t,e){return!e||Object.entries(e).find(([r,n])=>{const i=t.operations[r].at(-1);return n===-1?i!==void 0:(i==null?void 0:i.index)!==n})===void 0}const nG=5e3;class iG extends UK{constructor(e,r=new CK,n=new ZO,i=new WO,a){var s,o;super(),this.emitter=VO(),this.triggerMap=new Map,this.syncStatus=new Map,this.defaultDrivesManagerDelegate={detachDrive:this.detachDrive.bind(this),emit:(...u)=>this.emit("defaultRemoteDrive",...u)},this.queueDelegate={checkDocumentExists:(u,c)=>this.storage.checkDocumentExists(u,c),processOperationJob:async({driveId:u,documentId:c,operations:l,options:d})=>c?this.addOperations(u,c,l,d):this.addDriveOperations(u,l,d),processActionJob:async({driveId:u,documentId:c,actions:l,options:d})=>c?this.addActions(u,c,l,d):this.addDriveActions(u,l,d),processJob:async u=>{if(km(u))return this.queueDelegate.processOperationJob(u);if(TK(u))return this.queueDelegate.processActionJob(u);throw new Error("Unknown job type",u)}},this.options={...a,defaultDrives:{...a==null?void 0:a.defaultDrives},listenerManager:{...dw,...a==null?void 0:a.listenerManager},taskQueueMethod:(a==null?void 0:a.taskQueueMethod)===void 0?ih.runAsap:a.taskQueueMethod},this.listenerStateManager=new fw(this,void 0,a==null?void 0:a.listenerManager),this.documentModels=e,this.storage=r,this.cache=n,this.queueManager=i,this.defaultDrivesManager=new MK(this,this.defaultDrivesManagerDelegate,a),(o=(s=this.storage).setStorageDelegate)==null||o.call(s,{getCachedOperations:async(u,c)=>{try{const l=await this.cache.getDocument(u,c);return l==null?void 0:l.operations}catch(l){ir.error(l);return}}}),this.initializePromise=this._initialize()}setDocumentModels(e){this.documentModels=[...e],this.emit("documentModels",[...e])}initializeDefaultRemoteDrives(){return this.defaultDrivesManager.initializeDefaultRemoteDrives()}getDefaultRemoteDrives(){return this.defaultDrivesManager.getDefaultRemoteDrives()}setDefaultDriveAccessLevel(e,r){return this.defaultDrivesManager.setDefaultDriveAccessLevel(e,r)}setAllDefaultDrivesAccessLevel(e){return this.defaultDrivesManager.setAllDefaultDrivesAccessLevel(e)}getOperationSource(e){return e.type==="local"?"push":"pull"}getCombinedSyncUnitStatus(e){if(!e.pull&&!e.push||e.pull==="INITIAL_SYNC")return"INITIAL_SYNC";if(e.push==="INITIAL_SYNC")return e.pull||"INITIAL_SYNC";const r=["ERROR","MISSING","CONFLICT","SYNCING","SUCCESS"];return Object.values(e).sort((i,a)=>r.indexOf(i)-r.indexOf(a))[0]}initSyncStatus(e,r){const n=Object.entries(r).reduce((i,[a,s])=>({...i,[a]:s!=="SYNCING"?s:"INITIAL_SYNC"}),{});this.syncStatus.set(e,n),this.emit("syncStatus",e,this.getCombinedSyncUnitStatus(n),void 0,n)}async initializeDriveSyncStatus(e,r){const n=await this.getSynchronizationUnitsIds(e),i={pull:r.state.local.triggers.length>0?"INITIAL_SYNC":void 0,push:r.state.local.listeners.length>0?"SUCCESS":void 0};if(!i.pull&&!i.push)return;const a=[e,...n.map(s=>s.syncId)];for(const s of a)this.initSyncStatus(s,i)}updateSyncUnitStatus(e,r,n){if(r===null){this.syncStatus.delete(e);return}const i=this.syncStatus.get(e);if(!i){this.initSyncStatus(e,r);return}if(Object.entries(r).some(([s,o])=>i[s]!==o)){const s=Object.entries(r).reduce((c,[l,d])=>({...c,[l]:c[l]==="INITIAL_SYNC"&&d==="SYNCING"?"INITIAL_SYNC":d}),i),o=this.getCombinedSyncUnitStatus(i),u=this.getCombinedSyncUnitStatus(s);this.syncStatus.set(e,s),o!==u&&this.emit("syncStatus",e,this.getCombinedSyncUnitStatus(s),n,s)}}async saveStrand(e,r){const n=e.operations.map(a=>({...a,scope:e.scope,branch:e.branch})),i=await(e.documentId?this.queueOperations(e.driveId,e.documentId,n,{source:r}):this.queueDriveOperations(e.driveId,n,{source:r}));if(i.status==="ERROR"){const a=e.documentId!==""?(await this.getSynchronizationUnitsIds(e.driveId,[e.documentId],[e.scope],[e.branch])).map(o=>o.syncId):[e.driveId],s=this.getOperationSource(r);for(const o of a)this.updateSyncUnitStatus(o,{[s]:i.status},i.error)}return this.emit("strandUpdate",e),i}handleListenerError(e,r,n){ir.error(`Listener ${n.listener.label??n.listener.listenerId} error:`,e);const i=e instanceof Di?e.status:"ERROR";this.updateSyncUnitStatus(r,{push:i},e)}shouldSyncRemoteDrive(e){return e.state.local.availableOffline&&e.state.local.triggers.length>0}async startSyncRemoteDrive(e){const r=await this.getDrive(e);let n=this.triggerMap.get(e);const i=await this.getSynchronizationUnitsIds(e,void 0,void 0,void 0,void 0,r);for(const a of r.state.local.triggers)if(!(n!=null&&n.get(a.id))){n||(n=new Map),this.updateSyncUnitStatus(e,{pull:"SYNCING"});for(const s of i)this.updateSyncUnitStatus(s.syncId,{pull:"SYNCING"});if(Ps.isPullResponderTrigger(a)){let s=!0;const o=Ps.setupPull(e,a,this.saveStrand.bind(this),u=>{const c=u instanceof Di?u.status:"ERROR";this.updateSyncUnitStatus(e,{pull:c},u),u instanceof tl&&this.emit("clientStrandsError",e,a,u.response.status,u.message)},u=>{const c=u.filter(d=>d.status!=="SUCCESS");c.length<1&&this.updateSyncUnitStatus(e,{pull:"SUCCESS"});const l=u.filter(d=>d.documentId!=="").map(d=>d.documentId);if(this.getSynchronizationUnitsIds(e,l).then(d=>{for(const f of d){const h=c.find(p=>p.documentId===f.documentId);h?this.updateSyncUnitStatus(f.syncId,{pull:h.status},h.error):this.updateSyncUnitStatus(f.syncId,{pull:"SUCCESS"})}}).catch(console.error),s){s=!1;const d=r.state.local.listeners.find(f=>{var h;return a.data.url===((h=f.callInfo)==null?void 0:h.data)});d&&this.getSynchronizationUnitsRevision(e,i).then(f=>{for(const h of f)this.listenerStateManager.updateListenerRevision(d.listenerId,e,h.syncId,h.revision).catch(ir.error)}).catch(ir.error)}});n.set(a.id,o),this.triggerMap.set(e,n)}}}async stopSyncRemoteDrive(e){const n=(await this.getSynchronizationUnitsIds(e)).filter(a=>a.documentId!=="").map(a=>a.syncId),i=this.triggerMap.get(e);i==null||i.forEach(a=>a()),this.updateSyncUnitStatus(e,null);for(const a of n)this.updateSyncUnitStatus(a,null);return this.triggerMap.delete(e)}initialize(){return this.initializePromise}async _initialize(){await this.queueManager.init(this.queueDelegate,n=>{ir.error("Error initializing queue manager",n),e.push(n)});try{await this.defaultDrivesManager.removeOldremoteDrives()}catch(n){ir.error(n)}const e=[],r=await this.getDrives();for(const n of r)await this._initializeDrive(n).catch(i=>{ir.error(`Error initializing drive ${n}`,i),e.push(i)});return this.options.defaultDrives.loadOnInit!==!1&&await this.defaultDrivesManager.initializeDefaultRemoteDrives(),typeof window<"u"&&window.addEventListener("online",()=>{this.listenerStateManager.triggerUpdate(!1,{type:"local"},this.handleListenerError.bind(this)).catch(n=>{ir.error("Non handled error updating listeners",n)})}),e.length===0?null:e}async _initializeDrive(e){const r=await this.getDrive(e);await this.initializeDriveSyncStatus(e,r),this.shouldSyncRemoteDrive(r)&&await this.startSyncRemoteDrive(e),await this.listenerStateManager.initDrive(r)}async getSynchronizationUnits(e,r,n,i,a,s){const o=s||await this.getDrive(e),u=await this.getSynchronizationUnitsIds(e,r,n,i,a,o);return this.getSynchronizationUnitsRevision(e,u,o)}async getSynchronizationUnitsRevision(e,r,n){const i=n||await this.getDrive(e),a=await this.storage.getSynchronizationUnitsRevision(r),s=r.map(o=>({...o,lastUpdated:i.created,revision:-1}));for(const o of a){const u=s.find(c=>o.driveId===c.driveId&&o.documentId===c.documentId&&o.scope===c.scope&&o.branch===c.branch);u&&(u.revision=o.revision,u.lastUpdated=o.lastUpdated)}return s}async getSynchronizationUnitsIds(e,r,n,i,a,s){const u=(s??await this.getDrive(e)).state.global.nodes.filter(l=>Ni(l)&&(!(r!=null&&r.length)||r.includes(l.id)||r.includes("*"))&&(!(a!=null&&a.length)||a.includes(l.documentType)||a.includes("*")));(!r||r.includes("*")||r.includes(""))&&(!(a!=null&&a.length)||a.includes("powerhouse/document-drive")||a.includes("*"))&&u.unshift({id:"",documentType:"powerhouse/document-drive",synchronizationUnits:[{syncId:"0",scope:"global",branch:"main"}]});const c=[];for(const l of u){const d=n!=null&&n.length||i!=null&&i.length?l.synchronizationUnits.filter(f=>(!(n!=null&&n.length)||n.includes(f.scope)||n.includes("*"))&&(!(i!=null&&i.length)||i.includes(f.branch)||i.includes("*"))):l.synchronizationUnits;d.length&&c.push(...d.map(f=>({driveId:e,documentId:l.id,syncId:f.syncId,documentType:l.documentType,scope:f.scope,branch:f.branch})))}return c}async getSynchronizationUnitIdInfo(e,r,n){const a=(n||await this.getDrive(e)).state.global.nodes.find(o=>Ni(o)&&o.synchronizationUnits.find(u=>u.syncId===r));if(!a||!Ni(a))return;const s=a.synchronizationUnits.find(o=>o.syncId===r);if(s)return{syncId:r,scope:s.scope,branch:s.branch,driveId:e,documentId:a.id,documentType:a.documentType}}async getSynchronizationUnit(e,r,n){const i=await this.getSynchronizationUnitIdInfo(e,r,n);if(!i)return;const{scope:a,branch:s,documentId:o,documentType:u}=i,c=await this.getDocument(e,o),l=c.operations[a]??[],d=l[l.length-1];return{syncId:r,scope:a,branch:s,driveId:e,documentId:o,documentType:u,lastUpdated:(d==null?void 0:d.timestamp)??c.lastModified,revision:(d==null?void 0:d.index)??0}}async getOperationData(e,r,n,i){const a=r==="0"?{documentId:"",scope:"global"}:await this.getSynchronizationUnitIdInfo(e,r,i);if(!a)throw new Error(`Invalid Sync Id ${r} in drive ${e}`);const u=((r==="0"?i||await this.getDrive(e):await this.getDocument(e,a.documentId)).operations[a.scope]??[]).filter(l=>Object.keys(n).length===0||(n.since===void 0||SK(n.since,l.timestamp))&&(n.fromRevision===void 0||l.index>n.fromRevision));return(n.limit?u.slice(0,n.limit):u).map(l=>({hash:l.hash,index:l.index,timestamp:l.timestamp,type:l.type,input:l.input,skip:l.skip,context:l.context,id:l.id}))}getDocumentModel(e){const r=this.documentModels.find(n=>n.documentModel.id===e);if(!r)throw new Error(`Document type ${e} not supported`);return r}getDocumentModels(){return[...this.documentModels]}async addDrive(e){const r=e.global.id||W2();if(!r)throw new Error("Invalid Drive Id");if((await this.storage.getDrives()).includes(r))throw new _K(r);const i=nh.createDocument({state:e});return await this.storage.createDrive(r,i),e.global.slug&&await this.cache.deleteDocument("drives-slug",e.global.slug),await this._initializeDrive(r),this.emit("driveAdded",i),i}async addRemoteDrive(e,r){const{id:n,name:i,slug:a,icon:s}=r.expectedDriveInfo||await _u(e),{pullFilter:o,pullInterval:u,availableOffline:c,sharingType:l,listeners:d,triggers:f}=r,h=await Ps.createPullResponderTrigger(n,e,{pullFilter:o,pullInterval:u});return await this.addDrive({global:{id:n,name:i,slug:a,icon:s??null},local:{triggers:[...f,h],listeners:d,availableOffline:c,sharingType:l}})}async registerPullResponderTrigger(e,r,n){return await Ps.createPullResponderTrigger(e,r,n)}async deleteDrive(e){(await Promise.allSettled([this.stopSyncRemoteDrive(e),this.listenerStateManager.removeDrive(e),this.cache.deleteDocument("drives",e),this.storage.deleteDrive(e)])).forEach(n=>{if(n.status==="rejected")throw n.reason})}getDrives(){return this.storage.getDrives()}async getDrive(e,r){let n;try{const s=await this.cache.getDocument("drives",e);if(s&&mu(s)&&(n=s,f1(n,r==null?void 0:r.revisions)))return n}catch(s){ir.error("Error getting drive from cache",s)}const i=n??await this.storage.getDrive(e),a=this._buildDocument(i,r);if(mu(a))return r!=null&&r.revisions||this.cache.setDocument("drives",e,a).catch(ir.error),a;throw new Error(`Document with id ${e} is not a Document Drive`)}async getDriveBySlug(e,r){try{const a=await this.cache.getDocument("drives-slug",e);if(a&&mu(a))return a}catch(a){ir.error("Error getting drive from cache",a)}const n=await this.storage.getDriveBySlug(e),i=this._buildDocument(n,r);if(mu(i))return this.cache.setDocument("drives-slug",e,i).catch(ir.error),i;throw new Error(`Document with slug ${e} is not a Document Drive`)}async getDocument(e,r,n){let i;try{if(i=await this.cache.getDocument(e,r),i&&f1(i,n==null?void 0:n.revisions))return i}catch(o){ir.error("Error getting document from cache",o)}const a=i??await this.storage.getDocument(e,r),s=this._buildDocument(a,n);return n!=null&&n.revisions||this.cache.setDocument(e,r,s).catch(ir.error),s}getDocuments(e){return this.storage.getDocuments(e)}async createDocument(e,r){let n;if(r.document){if(r.documentType!==r.document.documentType)throw new Error(`Provided document is not ${r.documentType}`);n=this._buildDocument(r.document).state}const i=r.document??this.getDocumentModel(r.documentType).utils.createDocument(),a={name:i.name,revision:i.revision,documentType:i.documentType,created:i.created,lastModified:i.lastModified,operations:{global:[],local:[]},initialState:i.initialState,clipboard:[],state:n??i.state};await this.storage.createDocument(e,r.id,a);for(const o of r.synchronizationUnits)this.initSyncStatus(o.syncId,{pull:this.triggerMap.get(e)?"INITIAL_SYNC":void 0,push:this.listenerStateManager.driveHasListeners(e)?"SUCCESS":void 0});const s=Object.values(i.operations).flat();return s.length&&(mu(i)?await this.storage.addDriveOperations(e,s,i):await this.storage.addDocumentOperations(e,r.id,s,i)),i}async deleteDocument(e,r){try{const n=await this.getSynchronizationUnitsIds(e,[r]);for(const i of n)this.updateSyncUnitStatus(i.syncId,null);await this.listenerStateManager.removeSyncUnits(e,n)}catch(n){ir.warn("Error deleting document",n)}return await this.cache.deleteDocument(e,r),this.storage.deleteDocument(e,r)}async _processOperations(e,r,n,i){const a=[],s=[],o=await this._addDocumentResultingStage(n,e,r);let u=this._buildDocument(o),c;const l=FK(i);for(const d of Object.keys(l)){const f=n.operations[d],h=LK(l[d]||[],f);if(h.length<1)continue;const p=RK($K(f)),[m,y]=kK(p,h),v=(y.length<1?m:PK(p,m,jK)).filter(w=>p.length<1||BK(p[p.length-1],w));for(const w of v){let x=!1;if(y.length>0){const _=i.find(A=>A.hash===w.hash);x=!_||_.index!==w.index||_.skip!==w.skip}try{const _=this.options.taskQueueMethod,A=()=>this._performOperation(e,r,u,w,x),M=await(_?EK(A,_):A());u=M.document,s.push(...M.signals),a.push(M.operation)}catch(_){c=_ instanceof Di?_:new Di("ERROR",w,_.message,_.cause);break}}}return{document:u,operationsApplied:a,signals:s,error:c}}async _addDocumentResultingStage(e,r,n,i){var o,u,c,l;const a=(i==null?void 0:i.revisions)!==void 0?MS(e.operations,i.revisions):e.operations,s=Xe.documentHelpers.garbageCollectDocumentOperations(a);for(const d of Object.keys(s)){const f=s[d].at(-1);f&&!f.resultingState&&(f.resultingState=await(n?(u=(o=this.storage).getOperationResultingState)==null?void 0:u.call(o,r,n,f.index,f.scope,"main"):(l=(c=this.storage).getDriveOperationResultingState)==null?void 0:l.call(c,r,f.index,f.scope,"main")))}return{...e,operations:s}}_buildDocument(e,r){if(e.state&&(!r||r.checkHashes===!1)&&f1(e,r==null?void 0:r.revisions))return e;const n=this.getDocumentModel(e.documentType),i=(r==null?void 0:r.revisions)!==void 0?MS(e.operations,r.revisions):e.operations,a=Xe.documentHelpers.garbageCollectDocumentOperations(i);return Xe.replayDocument(e.initialState,a,n.reducer,void 0,e,void 0,{...r,checkHashes:(r==null?void 0:r.checkHashes)??!0,reuseOperationResultingState:(r==null?void 0:r.checkHashes)??!0})}async _performOperation(e,r,n,i,a=!1){var m,y,g,v;const s=this.getDocumentModel(n.documentType),o=[];let u=n;const c=i.scope,d=Xe.documentHelpers.garbageCollectDocumentOperations({...n.operations,[c]:Xe.documentHelpers.skipHeaderOperations(n.operations[c],i)})[c].at(-1);d&&!d.resultingState&&(d.resultingState=await(r?(y=(m=this.storage).getOperationResultingState)==null?void 0:y.call(m,e,r,d.index,d.scope,"main"):(v=(g=this.storage).getDriveOperationResultingState)==null?void 0:v.call(g,e,d.index,d.scope,"main")));const f=[];u=s.reducer(u,i,w=>{let x;switch(w.type){case"CREATE_CHILD_DOCUMENT":x=()=>this.createDocument(e,w.input);break;case"DELETE_CHILD_DOCUMENT":x=()=>this.deleteDocument(e,w.input.id);break;case"COPY_CHILD_DOCUMENT":x=()=>this.getDocument(e,w.input.id).then(_=>this.createDocument(e,{id:w.input.newId,documentType:_.documentType,document:_,synchronizationUnits:w.input.synchronizationUnits}));break}x&&f.push(()=>x().then(_=>({signal:w,result:_})))},{skip:i.skip,reuseOperationResultingState:!0});const p=u.operations[i.scope].filter(w=>w.index==i.index&&w.skip==i.skip).at(0);if(!p)throw new Di("ERROR",i,`Operation with index ${i.index}:${i.skip} was not applied.`);if(!p.error&&p.hash!==i.hash&&!a)throw new wK(i,p);for(const w of f){const x=await w();o.push(x)}return{document:u,signals:o,operation:p}}addOperation(e,r,n,i){return this.addOperations(e,r,[n],i)}async _addOperations(e,r,n){if(this.storage.addDocumentOperationsWithTransaction)await this.storage.addDocumentOperationsWithTransaction(e,r,n);else{const i=await this.storage.getDocument(e,r),a=await n(i);a.operations.length>0&&await this.storage.addDocumentOperations(e,r,a.operations,a.header)}}queueOperation(e,r,n,i){return this.queueOperations(e,r,[n],i)}async resultIfExistingOperations(e,r,n){try{const i=await this.getDocument(e,r);return n.find(s=>!s.id||!i.operations[s.scope].find(o=>o.id===s.id&&o.index===s.index&&o.type===s.type&&o.hash===s.hash))?void 0:{status:"SUCCESS",document:i,operations:n,signals:[]}}catch(i){i.message.includes(`Document with id ${r} not found`)||console.error(i);return}}async queueOperations(e,r,n,i){const a=await this.resultIfExistingOperations(e,r,n);if(a)return a;try{const s=await this.queueManager.addJob({driveId:e,documentId:r,operations:n,options:i});return new Promise((o,u)=>{const c=this.queueManager.on("jobCompleted",(d,f)=>{d.jobId===s&&(c(),l(),o(f))}),l=this.queueManager.on("jobFailed",(d,f)=>{d.jobId===s&&(c(),l(),u(f))})})}catch(s){throw ir.error("Error adding job",s),s}}async queueAction(e,r,n,i){return this.queueActions(e,r,[n],i)}async queueActions(e,r,n,i){try{const a=await this.queueManager.addJob({driveId:e,documentId:r,actions:n,options:i});return new Promise((s,o)=>{const u=this.queueManager.on("jobCompleted",(l,d)=>{l.jobId===a&&(u(),c(),s(d))}),c=this.queueManager.on("jobFailed",(l,d)=>{l.jobId===a&&(u(),c(),o(d))})})}catch(a){throw ir.error("Error adding job",a),a}}async queueDriveAction(e,r,n){return this.queueDriveActions(e,[r],n)}async queueDriveActions(e,r,n){try{const i=await this.queueManager.addJob({driveId:e,actions:r,options:n});return new Promise((a,s)=>{const o=this.queueManager.on("jobCompleted",(c,l)=>{c.jobId===i&&(o(),u(),a(l))}),u=this.queueManager.on("jobFailed",(c,l)=>{c.jobId===i&&(o(),u(),s(l))})})}catch(i){throw ir.error("Error adding drive job",i),i}}async addOperations(e,r,n,i){const a=await this.resultIfExistingOperations(e,r,n);if(a)return a;let s;const o=[],u=[];let c;try{await this._addOperations(e,r,async y=>{const g=await this._processOperations(e,r,y,n);if(!g.document)throw ir.error("Invalid document"),g.error??new Error("Invalid document");return s=g.document,c=g.error,u.push(...g.signals),o.push(...g.operationsApplied),{operations:g.operationsApplied,header:g.document,newState:s.state}}),s&&this.cache.setDocument(e,r,s).catch(ir.error);const{scopes:l,branches:d}=o.reduce((y,g)=>(y.scopes.includes(g.scope)||y.scopes.push(g.scope),y),{scopes:[],branches:["main"]}),f=await this.getSynchronizationUnits(e,[r],l,d),p=o.find(y=>!n.find(g=>g.id===y.id&&g.index===y.index&&g.skip===y.skip&&g.hash===y.hash))?{type:"local"}:(i==null?void 0:i.source)??{type:"local"},m=this.getOperationSource(p);if(this.listenerStateManager.updateSynchronizationRevisions(e,f,p,()=>{this.updateSyncUnitStatus(e,{[m]:"SYNCING"});for(const y of f)this.updateSyncUnitStatus(y.syncId,{[m]:"SYNCING"})},this.handleListenerError.bind(this),(i==null?void 0:i.forceSync)??p.type==="local").then(y=>{y.length&&this.updateSyncUnitStatus(e,{[m]:"SUCCESS"});for(const g of f)this.updateSyncUnitStatus(g.syncId,{[m]:"SUCCESS"})}).catch(y=>{ir.error("Non handled error updating sync revision",y),this.updateSyncUnitStatus(e,{[m]:"ERROR"},y);for(const g of f)this.updateSyncUnitStatus(g.syncId,{[m]:"ERROR"},y)}),c)throw c;return{status:"SUCCESS",document:s,operations:o,signals:u}}catch(l){const d=l instanceof Di?l:new Di("ERROR",void 0,l.message,l.cause);return{status:d.status,error:d,document:s,operations:o,signals:u}}}addDriveOperation(e,r,n){return this.addDriveOperations(e,[r],n)}async clearStorage(){var e,r;for(const n of await this.getDrives())await this.deleteDrive(n);await((r=(e=this.storage).clearStorage)==null?void 0:r.call(e))}async _addDriveOperations(e,r){if(this.storage.addDriveOperationsWithTransaction)return this.storage.addDriveOperationsWithTransaction(e,r);{const n=await this.storage.getDrive(e),i=await r(n);return i.operations.length>0&&await this.storage.addDriveOperations(e,i.operations,i.header),i}}queueDriveOperation(e,r,n){return this.queueDriveOperations(e,[r],n)}async resultIfExistingDriveOperations(e,r){try{const n=await this.getDrive(e);return r.find(a=>!a.id||!n.operations[a.scope].find(s=>s.id===a.id&&s.index===a.index&&s.type===a.type&&s.hash===a.hash))?void 0:{status:"SUCCESS",document:n,operations:r,signals:[]}}catch(n){console.error(n);return}}async queueDriveOperations(e,r,n){const i=await this.resultIfExistingDriveOperations(e,r);if(i)return i;try{const a=await this.queueManager.addJob({driveId:e,operations:r,options:n});return new Promise((s,o)=>{const u=this.queueManager.on("jobCompleted",(l,d)=>{l.jobId===a&&(u(),c(),s(d))}),c=this.queueManager.on("jobFailed",(l,d)=>{l.jobId===a&&(u(),c(),o(d))})})}catch(a){throw ir.error("Error adding drive job",a),a}}async addDriveOperations(e,r,n){let i;const a=[],s=[];let o;const u=await this.resultIfExistingDriveOperations(e,r);if(u)return u;try{if(await this._addDriveOperations(e,async l=>{const d=await this._processOperations(e,void 0,l,r.slice());return i=d.document,a.push(...d.operationsApplied),s.push(...d.signals),o=d.error,{operations:d.operationsApplied,header:d.document}}),!i||!mu(i))throw o??new Error("Invalid Document Drive document");this.cache.setDocument("drives",e,i).catch(ir.error);for(const l of a)switch(l.type){case"ADD_LISTENER":{await this.addListener(e,l);break}case"REMOVE_LISTENER":{await this.removeListener(e,l);break}}const c=a.filter(l=>l.scope==="global").slice().pop();if(c){const d=a.find(h=>!r.find(p=>p.id===h.id&&p.index===h.index&&p.skip===h.skip&&p.hash===h.hash))?{type:"local"}:(n==null?void 0:n.source)??{type:"local"},f=this.getOperationSource(d);this.listenerStateManager.updateSynchronizationRevisions(e,[{syncId:"0",driveId:e,documentId:"",scope:"global",branch:"main",documentType:"powerhouse/document-drive",lastUpdated:c.timestamp,revision:c.index}],d,()=>{this.updateSyncUnitStatus(e,{[f]:"SYNCING"})},this.handleListenerError.bind(this),(n==null?void 0:n.forceSync)??d.type==="local").then(h=>{h.length&&this.updateSyncUnitStatus(e,{[f]:"SUCCESS"})}).catch(h=>{ir.error("Non handled error updating sync revision",h),this.updateSyncUnitStatus(e,{[f]:"ERROR"},h)})}if(this.shouldSyncRemoteDrive(i)?this.startSyncRemoteDrive(i.state.global.id):this.stopSyncRemoteDrive(i.state.global.id),o)throw o;return{status:"SUCCESS",document:i,operations:a,signals:s}}catch(c){const l=c instanceof Di?c:new Di("ERROR",void 0,c.message,c.cause);return{status:l.status,error:l,document:i,operations:a,signals:s}}}_buildOperations(e,r){const n=[],{reducer:i}=this.getDocumentModel(e.documentType);for(const a of r){e=i(e,a);const s=e.operations[a.scope].slice().pop();if(!s)throw new Error("Error creating operations");n.push(s)}return n}async addAction(e,r,n,i){return this.addActions(e,r,[n],i)}async addActions(e,r,n,i){const a=await this.getDocument(e,r),s=this._buildOperations(a,n);return this.addOperations(e,r,s,i)}async addDriveAction(e,r,n){return this.addDriveActions(e,[r],n)}async addDriveActions(e,r,n){const i=await this.getDrive(e),a=this._buildOperations(i,r);return await this.addDriveOperations(e,a,n)}async addInternalListener(e,r,n){const i={callInfo:{data:"",name:"Interal",transmitterType:"Internal"},system:!0,...n};await this.addDriveAction(e,Jn.addListener({listener:i}));const a=await this.getTransmitter(e,n.listenerId);if(!a)throw ir.error("Internal listener not found"),new Error("Internal listener not found");if(!(a instanceof JO))throw ir.error("Listener is not an internal transmitter"),new Error("Listener is not an internal transmitter");return a.setReceiver(r),a}async detachDrive(e){const r=await this.getDrive(e),n=r.state.local.listeners||[],i=r.state.local.triggers||[];for(const a of n)await this.addDriveAction(e,Jn.removeListener({listenerId:a.listenerId}));for(const a of i)await this.addDriveAction(e,Jn.removeTrigger({triggerId:a.id}));await this.addDriveAction(e,Jn.setSharingType({type:"LOCAL"}))}async addListener(e,r){var i,a,s;const{listener:n}=r.input;await this.listenerStateManager.addListener({...n,driveId:e,label:n.label??"",system:n.system??!1,filter:{branch:n.filter.branch??[],documentId:n.filter.documentId??[],documentType:n.filter.documentType??[],scope:n.filter.scope??[]},callInfo:{data:((i=n.callInfo)==null?void 0:i.data)??"",name:((a=n.callInfo)==null?void 0:a.name)??"PullResponder",transmitterType:((s=n.callInfo)==null?void 0:s.transmitterType)??"PullResponder"}})}async removeListener(e,r){const{listenerId:n}=r.input;await this.listenerStateManager.removeListener(e,n)}getTransmitter(e,r){return this.listenerStateManager.getTransmitter(e,r)}getListener(e,r){return this.listenerStateManager.getListener(e,r)}getSyncStatus(e){const r=this.syncStatus.get(e);return r?this.getCombinedSyncUnitStatus(r):new HO(`Sync status not found for syncUnitId: ${e}`,e)}on(e,r){return this.emitter.on(e,r)}emit(e,...r){return this.emitter.emit(e,...r)}}const aG=IK(iG),GO=Object.prototype.toString;function al(t){switch(GO.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Ks(t,Error)}}function Kl(t,e){return GO.call(t)===`[object ${e}]`}function Y2(t){return Kl(t,"ErrorEvent")}function kS(t){return Kl(t,"DOMError")}function sG(t){return Kl(t,"DOMException")}function us(t){return Kl(t,"String")}function J2(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function K2(t){return t===null||J2(t)||typeof t!="object"&&typeof t!="function"}function Yu(t){return Kl(t,"Object")}function L0(t){return typeof Event<"u"&&Ks(t,Event)}function oG(t){return typeof Element<"u"&&Ks(t,Element)}function uG(t){return Kl(t,"RegExp")}function j0(t){return!!(t&&t.then&&typeof t.then=="function")}function cG(t){return Yu(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function XO(t){return typeof t=="number"&&t!==t}function Ks(t,e){try{return t instanceof e}catch{return!1}}function QO(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function sl(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function xg(t,e){if(!Array.isArray(t))return"";const r=[];for(let n=0;n<t.length;n++){const i=t[n];try{QO(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function lG(t,e,r=!1){return us(t)?uG(e)?e.test(t):us(e)?r?t===e:t.includes(e):!1:!1}function Gl(t,e=[],r=!1){return e.some(n=>lG(t,n,r))}function dG(t,e,r=250,n,i,a,s){if(!a.exception||!a.exception.values||!s||!Ks(s.originalException,Error))return;const o=a.exception.values.length>0?a.exception.values[a.exception.values.length-1]:void 0;o&&(a.exception.values=fG(hw(t,e,i,s.originalException,n,a.exception.values,o,0),r))}function hw(t,e,r,n,i,a,s,o){if(a.length>=r+1)return a;let u=[...a];if(Ks(n[i],Error)){RS(s,o);const c=t(e,n[i]),l=u.length;FS(c,i,l,o),u=hw(t,e,r,n[i],i,[c,...u],c,l)}return Array.isArray(n.errors)&&n.errors.forEach((c,l)=>{if(Ks(c,Error)){RS(s,o);const d=t(e,c),f=u.length;FS(d,`errors[${l}]`,f,o),u=hw(t,e,r,c,i,[d,...u],d,f)}}),u}function RS(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function FS(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:r,parent_id:n}}function fG(t,e){return t.map(r=>(r.value&&(r.value=sl(r.value,e)),r))}function Ip(t){return t&&t.Math==Math?t:void 0}const br=typeof globalThis=="object"&&Ip(globalThis)||typeof window=="object"&&Ip(window)||typeof self=="object"&&Ip(self)||typeof global=="object"&&Ip(global)||function(){return this}()||{};function G2(){return br}function eM(t,e,r){const n=r||br,i=n.__SENTRY__=n.__SENTRY__||{};return i[t]||(i[t]=e())}const ol=G2(),hG=80;function zo(t,e={}){if(!t)return"<unknown>";try{let r=t;const n=5,i=[];let a=0,s=0;const o=" > ",u=o.length;let c;const l=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||hG;for(;r&&a++<n&&(c=pG(r,l),!(c==="html"||a>1&&s+i.length*u+c.length>=d));)i.push(c),s+=c.length,r=r.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function pG(t,e){const r=t,n=[];let i,a,s,o,u;if(!r||!r.tagName)return"";if(ol.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const c=e&&e.length?e.filter(d=>r.getAttribute(d)).map(d=>[d,r.getAttribute(d)]):null;if(c&&c.length)c.forEach(d=>{n.push(`[${d[0]}="${d[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&us(i))for(a=i.split(/\s+/),u=0;u<a.length;u++)n.push(`.${a[u]}`);const l=["aria-label","type","name","title","alt"];for(u=0;u<l.length;u++)s=l[u],o=r.getAttribute(s),o&&n.push(`[${s}="${o}"]`);return n.join("")}function mG(){try{return ol.document.location.href}catch{return""}}function gG(t){return ol.document&&ol.document.querySelector?ol.document.querySelector(t):null}function tM(t){if(!ol.HTMLElement)return null;let e=t;const r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement&&e.dataset.sentryComponent)return e.dataset.sentryComponent;e=e.parentNode}return null}const Xl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,yG="Sentry Logger ",Eg=["debug","info","warn","error","log","assert","trace"],Sg={};function Ju(t){if(!("console"in br))return t();const e=br.console,r={},n=Object.keys(Sg);n.forEach(i=>{const a=Sg[i];r[i]=e[i],e[i]=a});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function vG(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Xl?Eg.forEach(r=>{e[r]=(...n)=>{t&&Ju(()=>{br.console[r](`${yG}[${r}]:`,...n)})}}):Eg.forEach(r=>{e[r]=()=>{}}),e}const Me=vG(),bG=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function wG(t){return t==="http"||t==="https"}function Ql(t,e=!1){const{host:r,path:n,pass:i,port:a,projectId:s,protocol:o,publicKey:u}=t;return`${o}://${u}${e&&i?`:${i}`:""}@${r}${a?`:${a}`:""}/${n&&`${n}/`}${s}`}function _G(t){const e=bG.exec(t);if(!e){Ju(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[r,n,i="",a,s="",o]=e.slice(1);let u="",c=o;const l=c.split("/");if(l.length>1&&(u=l.slice(0,-1).join("/"),c=l.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return rM({host:a,pass:i,path:u,projectId:c,port:s,protocol:r,publicKey:n})}function rM(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function xG(t){if(!Xl)return!0;const{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(Me.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?wG(n)?e&&isNaN(parseInt(e,10))?(Me.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Me.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(Me.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function EG(t){const e=typeof t=="string"?_G(t):rM(t);if(!(!e||!xG(e)))return e}class ns extends Error{constructor(e,r="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=r}}function jn(t,e,r){if(!(e in t))return;const n=t[e],i=r(n);typeof i=="function"&&nM(i,n),t[e]=i}function qo(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Xl&&Me.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function nM(t,e){try{const r=e.prototype||{};t.prototype=e.prototype=r,qo(t,"__sentry_original__",e)}catch{}}function X2(t){return t.__sentry_original__}function SG(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function iM(t){if(al(t))return{message:t.message,name:t.name,stack:t.stack,...BS(t)};if(L0(t)){const e={type:t.type,target:PS(t.target),currentTarget:PS(t.currentTarget),...BS(t)};return typeof CustomEvent<"u"&&Ks(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function PS(t){try{return oG(t)?zo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function BS(t){if(typeof t=="object"&&t!==null){const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function TG(t,e=40){const r=Object.keys(iM(t));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=e)return sl(r[0],e);for(let n=r.length;n>0;n--){const i=r.slice(0,n).join(", ");if(!(i.length>e))return n===r.length?i:sl(i,e)}return""}function mi(t){return pw(t,new Map)}function pw(t,e){if(DG(t)){const r=e.get(t);if(r!==void 0)return r;const n={};e.set(t,n);for(const i of Object.keys(t))typeof t[i]<"u"&&(n[i]=pw(t[i],e));return n}if(Array.isArray(t)){const r=e.get(t);if(r!==void 0)return r;const n=[];return e.set(t,n),t.forEach(i=>{n.push(pw(i,e))}),n}return t}function DG(t){if(!Yu(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const aM=50,LS=/\(error: (.*)\)/,jS=/captureMessage|captureException/;function sM(...t){const e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0)=>{const i=[],a=r.split(`
402
+ `,{strands:e.map(a=>({...a,operations:a.operations.map(s=>({...s,input:eG(s.input)}))}))});if(!i)throw new Error("Couldn't update listener revision");return i}catch(i){throw ir.error(i),i}return[]}}function rG(t,e=250){let r;return(n,...i)=>(r&&clearTimeout(r),new Promise((a,s)=>{n?t(...i).then(a).catch(s):r=setTimeout(()=>{t(...i).then(a).catch(s)},e)}))}const A0=class A0 extends zK{constructor(){super(...arguments),this.triggerUpdate=rG(this._triggerUpdate.bind(this),A0.LISTENER_UPDATE_DELAY)}async getTransmitter(e,r){var n;return Promise.resolve((n=this.transmitters[e])==null?void 0:n[r])}driveHasListeners(e){return this.listenerState.has(e)}async addListener(e){var s;const r=e.driveId;this.listenerState.has(r)||this.listenerState.set(r,new Map),this.listenerState.get(r).set(e.listenerId,{block:e.block,driveId:e.driveId,pendingTimeout:"0",listener:e,listenerStatus:"CREATED",syncUnits:new Map});let i;switch((s=e.callInfo)==null?void 0:s.transmitterType){case"SwitchboardPush":{i=new tG(e,this.drive);break}case"PullResponder":{i=new Ps(e,this.drive,this);break}case"Internal":{i=new JO(e,this.drive);break}}if(!i)throw new Error("Transmitter not found");const a=this.transmitters[r]||{};return a[e.listenerId]=i,this.transmitters[r]=a,this.triggerUpdate(!0,{type:"local"}),Promise.resolve(i)}async removeListener(e,r){const n=this.listenerState.get(e);return n?Promise.resolve(n.delete(r)):!1}async removeSyncUnits(e,r){const n=this.listenerState.get(e);if(n){for(const[,i]of n)for(const a of r)i.syncUnits.delete(a.syncId);return Promise.resolve()}}async updateSynchronizationRevisions(e,r,n,i,a,s=!1){const o=this.listenerState.get(e);if(!o)return[];const u=[];for(const[,c]of o){if(u.find(d=>d.listenerId===c.listener.listenerId))continue;const l=await this.getTransmitter(e,c.listener.listenerId);if(l!=null&&l.transmit)for(const d of r){if(!this._checkFilter(c.listener.filter,d))continue;const f=c.syncUnits.get(d.syncId);if(!f||f.listenerRev<d.revision){u.push(c.listener);break}}}return u.length?(i==null||i(u),this.triggerUpdate(s,n,a)):[]}async updateListenerRevision(e,r,n,i){const a=this.listenerState.get(r);if(!a)return;const s=a.get(e);if(!s)return;const o=new Date().toISOString(),u=s.syncUnits.get(n);return u?(u.listenerRev=i,u.lastUpdated=o):s.syncUnits.set(n,{listenerRev:i,lastUpdated:o}),Promise.resolve()}async _triggerUpdate(e,r){var i;const n=[];for(const[a,s]of this.listenerState)for(const[o,u]of s){const c=await this.getTransmitter(a,o);if(!(c!=null&&c.transmit))continue;const l=await this.getListenerSyncUnits(a,u.listener.listenerId),d=[],f=l.map(h=>async()=>{const p=u.syncUnits.get(h.syncId);if(p&&p.listenerRev>=h.revision)return;const m=[];try{const y=await this.drive.getOperationData(a,h.syncId,{fromRevision:p==null?void 0:p.listenerRev});m.push(...y)}catch(y){ir.error(y)}m.length&&d.push({driveId:a,documentId:h.documentId,branch:h.branch,operations:m,scope:h.scope})});if(this.options.sequentialUpdates)for(const h of f)await h();else await Promise.all(f.map(h=>h()));if(d.length!=0){u.pendingTimeout=new Date(new Date().getTime()/1e3+300).toISOString(),u.listenerStatus="PENDING";try{const h=await c.transmit(d,e);u.pendingTimeout="0",u.listenerStatus="PENDING";const p=new Date().toISOString();for(const m of h){const y=l.find(g=>m.documentId===g.documentId&&m.scope===g.scope&&m.branch===g.branch);y?u.syncUnits.set(y.syncId,{lastUpdated:p,listenerRev:m.revision}):ir.warn(`Received revision for untracked unit for listener ${u.listener.listenerId}`,m)}for(const m of h){const y=m.status==="ERROR";if((i=m.error)!=null&&i.includes("Missing operations")){const g=await this._triggerUpdate(e,r);n.push(...g)}else if(n.push({listenerId:u.listener.listenerId,listenerRevisions:h}),y)throw new Di(m.status,void 0,m.error,m.error)}u.listenerStatus="SUCCESS"}catch(h){r==null||r(h,a,u),u.listenerStatus=h instanceof Di?h.status:"ERROR"}}}return n}_checkFilter(e,r){const{branch:n,documentId:i,scope:a,documentType:s}=r;return!!((!e.branch||e.branch.includes(n)||e.branch.includes("*"))&&(!e.documentId||e.documentId.includes(i)||e.documentId.includes("*"))&&(!e.scope||e.scope.includes(a)||e.scope.includes("*"))&&(!e.documentType||e.documentType.includes(s)||e.documentType.includes("*")))}getListenerSyncUnits(e,r,n){var s;const i=(s=this.listenerState.get(e))==null?void 0:s.get(r);if(!i)return[];const a=i.listener.filter;return this.drive.getSynchronizationUnits(e,a.documentId??["*"],a.scope??["*"],a.branch??["*"],a.documentType??["*"],n)}getListenerSyncUnitIds(e,r){var a;const n=(a=this.listenerState.get(e))==null?void 0:a.get(r);if(!n)return[];const i=n.listener.filter;return this.drive.getSynchronizationUnitsIds(e,i.documentId??["*"],i.scope??["*"],i.branch??["*"],i.documentType??["*"])}async initDrive(e){const{state:{local:{listeners:r}}}=e;for(const n of r)await this.addListener({block:n.block,driveId:e.state.global.id,filter:{branch:n.filter.branch??[],documentId:n.filter.documentId??[],documentType:n.filter.documentType,scope:n.filter.scope??[]},listenerId:n.listenerId,system:n.system,callInfo:n.callInfo??void 0,label:n.label??""})}async removeDrive(e){this.listenerState.delete(e);const r=this.transmitters[e];r&&await Promise.all(Object.values(r).map(n=>{var i;return(i=n.disconnect)==null?void 0:i.call(n)}))}getListener(e,r){const n=this.listenerState.get(e);if(!n)throw new Error("Drive not found");const i=n.get(r);if(!i)throw new Error("Listener not found");return Promise.resolve(i)}async getStrands(e,r,n){const i=await this.getListener(e,r),a=[],s=await this.drive.getDrive(e),o=await this.getListenerSyncUnits(e,r,s),u=n==null?void 0:n.limit;let c=0;const l=o.map(d=>async()=>{if(u&&c>=u||d.revision<0)return;const f=i.syncUnits.get(d.syncId);if(f&&f.listenerRev>=d.revision)return;const{documentId:h,driveId:p,scope:m,branch:y}=d;try{const g=await this.drive.getOperationData(p,d.syncId,{since:n==null?void 0:n.since,fromRevision:(n==null?void 0:n.fromRevision)??(f==null?void 0:f.listenerRev),limit:u?u-c:void 0},s);if(!g.length)return;c+=g.length,a.push({driveId:p,documentId:h,scope:m,branch:y,operations:g})}catch(g){ir.error(g);return}});if(this.options.sequentialUpdates)for(const d of l)await d();else await Promise.all(l.map(d=>d()));return a}};A0.LISTENER_UPDATE_DELAY=250;let fw=A0;function MS(t,e){return e?Object.keys(t).reduce((r,n)=>{const i=e[n];return i!==void 0&&(r[n]=t[n].filter(a=>a.index<=i)),r},{global:[],local:[]}):t}function f1(t,e){return!e||Object.entries(e).find(([r,n])=>{const i=t.operations[r].at(-1);return n===-1?i!==void 0:(i==null?void 0:i.index)!==n})===void 0}const nG=5e3;class iG extends UK{constructor(e,r=new CK,n=new ZO,i=new WO,a){var s,o;super(),this.emitter=VO(),this.triggerMap=new Map,this.syncStatus=new Map,this.defaultDrivesManagerDelegate={detachDrive:this.detachDrive.bind(this),emit:(...u)=>this.emit("defaultRemoteDrive",...u)},this.queueDelegate={checkDocumentExists:(u,c)=>this.storage.checkDocumentExists(u,c),processOperationJob:async({driveId:u,documentId:c,operations:l,options:d})=>c?this.addOperations(u,c,l,d):this.addDriveOperations(u,l,d),processActionJob:async({driveId:u,documentId:c,actions:l,options:d})=>c?this.addActions(u,c,l,d):this.addDriveActions(u,l,d),processJob:async u=>{if(km(u))return this.queueDelegate.processOperationJob(u);if(TK(u))return this.queueDelegate.processActionJob(u);throw new Error("Unknown job type",u)}},this.options={...a,defaultDrives:{...a==null?void 0:a.defaultDrives},listenerManager:{...dw,...a==null?void 0:a.listenerManager},taskQueueMethod:(a==null?void 0:a.taskQueueMethod)===void 0?ih.runAsap:a.taskQueueMethod},this.listenerStateManager=new fw(this,void 0,a==null?void 0:a.listenerManager),this.documentModels=e,this.storage=r,this.cache=n,this.queueManager=i,this.defaultDrivesManager=new MK(this,this.defaultDrivesManagerDelegate,a),(o=(s=this.storage).setStorageDelegate)==null||o.call(s,{getCachedOperations:async(u,c)=>{try{const l=await this.cache.getDocument(u,c);return l==null?void 0:l.operations}catch(l){ir.error(l);return}}}),this.initializePromise=this._initialize()}setDocumentModels(e){this.documentModels=[...e],this.emit("documentModels",[...e])}initializeDefaultRemoteDrives(){return this.defaultDrivesManager.initializeDefaultRemoteDrives()}getDefaultRemoteDrives(){return this.defaultDrivesManager.getDefaultRemoteDrives()}setDefaultDriveAccessLevel(e,r){return this.defaultDrivesManager.setDefaultDriveAccessLevel(e,r)}setAllDefaultDrivesAccessLevel(e){return this.defaultDrivesManager.setAllDefaultDrivesAccessLevel(e)}getOperationSource(e){return e.type==="local"?"push":"pull"}getCombinedSyncUnitStatus(e){if(!e.pull&&!e.push||e.pull==="INITIAL_SYNC")return"INITIAL_SYNC";if(e.push==="INITIAL_SYNC")return e.pull||"INITIAL_SYNC";const r=["ERROR","MISSING","CONFLICT","SYNCING","SUCCESS"];return Object.values(e).sort((i,a)=>r.indexOf(i)-r.indexOf(a))[0]}initSyncStatus(e,r){const n=Object.entries(r).reduce((i,[a,s])=>({...i,[a]:s!=="SYNCING"?s:"INITIAL_SYNC"}),{});this.syncStatus.set(e,n),this.emit("syncStatus",e,this.getCombinedSyncUnitStatus(n),void 0,n)}async initializeDriveSyncStatus(e,r){const n=await this.getSynchronizationUnitsIds(e),i={pull:r.state.local.triggers.length>0?"INITIAL_SYNC":void 0,push:r.state.local.listeners.length>0?"SUCCESS":void 0};if(!i.pull&&!i.push)return;const a=[e,...n.map(s=>s.syncId)];for(const s of a)this.initSyncStatus(s,i)}updateSyncUnitStatus(e,r,n){if(r===null){this.syncStatus.delete(e);return}const i=this.syncStatus.get(e);if(!i){this.initSyncStatus(e,r);return}if(Object.entries(r).some(([s,o])=>i[s]!==o)){const s=Object.entries(r).reduce((c,[l,d])=>({...c,[l]:c[l]==="INITIAL_SYNC"&&d==="SYNCING"?"INITIAL_SYNC":d}),i),o=this.getCombinedSyncUnitStatus(i),u=this.getCombinedSyncUnitStatus(s);this.syncStatus.set(e,s),o!==u&&this.emit("syncStatus",e,this.getCombinedSyncUnitStatus(s),n,s)}}async saveStrand(e,r){const n=e.operations.map(a=>({...a,scope:e.scope,branch:e.branch})),i=await(e.documentId?this.queueOperations(e.driveId,e.documentId,n,{source:r}):this.queueDriveOperations(e.driveId,n,{source:r}));if(i.status==="ERROR"){const a=e.documentId!==""?(await this.getSynchronizationUnitsIds(e.driveId,[e.documentId],[e.scope],[e.branch])).map(o=>o.syncId):[e.driveId],s=this.getOperationSource(r);for(const o of a)this.updateSyncUnitStatus(o,{[s]:i.status},i.error)}return this.emit("strandUpdate",e),i}handleListenerError(e,r,n){ir.error(`Listener ${n.listener.label??n.listener.listenerId} error:`,e);const i=e instanceof Di?e.status:"ERROR";this.updateSyncUnitStatus(r,{push:i},e)}shouldSyncRemoteDrive(e){return e.state.local.availableOffline&&e.state.local.triggers.length>0}async startSyncRemoteDrive(e){const r=await this.getDrive(e);let n=this.triggerMap.get(e);const i=await this.getSynchronizationUnitsIds(e,void 0,void 0,void 0,void 0,r);for(const a of r.state.local.triggers)if(!(n!=null&&n.get(a.id))){n||(n=new Map),this.updateSyncUnitStatus(e,{pull:"SYNCING"});for(const s of i)this.updateSyncUnitStatus(s.syncId,{pull:"SYNCING"});if(Ps.isPullResponderTrigger(a)){let s=!0;const o=Ps.setupPull(e,a,this.saveStrand.bind(this),u=>{const c=u instanceof Di?u.status:"ERROR";this.updateSyncUnitStatus(e,{pull:c},u),u instanceof tl&&this.emit("clientStrandsError",e,a,u.response.status,u.message)},u=>{const c=u.filter(d=>d.status!=="SUCCESS");c.length<1&&this.updateSyncUnitStatus(e,{pull:"SUCCESS"});const l=u.filter(d=>d.documentId!=="").map(d=>d.documentId);if(this.getSynchronizationUnitsIds(e,l).then(d=>{for(const f of d){const h=c.find(p=>p.documentId===f.documentId);h?this.updateSyncUnitStatus(f.syncId,{pull:h.status},h.error):this.updateSyncUnitStatus(f.syncId,{pull:"SUCCESS"})}}).catch(console.error),s){s=!1;const d=r.state.local.listeners.find(f=>{var h;return a.data.url===((h=f.callInfo)==null?void 0:h.data)});d&&this.getSynchronizationUnitsRevision(e,i).then(f=>{for(const h of f)this.listenerStateManager.updateListenerRevision(d.listenerId,e,h.syncId,h.revision).catch(ir.error)}).catch(ir.error)}});n.set(a.id,o),this.triggerMap.set(e,n)}}}async stopSyncRemoteDrive(e){const n=(await this.getSynchronizationUnitsIds(e)).filter(a=>a.documentId!=="").map(a=>a.syncId),i=this.triggerMap.get(e);i==null||i.forEach(a=>a()),this.updateSyncUnitStatus(e,null);for(const a of n)this.updateSyncUnitStatus(a,null);return this.triggerMap.delete(e)}initialize(){return this.initializePromise}async _initialize(){await this.queueManager.init(this.queueDelegate,n=>{ir.error("Error initializing queue manager",n),e.push(n)});try{await this.defaultDrivesManager.removeOldremoteDrives()}catch(n){ir.error(n)}const e=[],r=await this.getDrives();for(const n of r)await this._initializeDrive(n).catch(i=>{ir.error(`Error initializing drive ${n}`,i),e.push(i)});return this.options.defaultDrives.loadOnInit!==!1&&await this.defaultDrivesManager.initializeDefaultRemoteDrives(),typeof window<"u"&&window.addEventListener("online",()=>{this.listenerStateManager.triggerUpdate(!1,{type:"local"},this.handleListenerError.bind(this)).catch(n=>{ir.error("Non handled error updating listeners",n)})}),e.length===0?null:e}async _initializeDrive(e){const r=await this.getDrive(e);await this.initializeDriveSyncStatus(e,r),this.shouldSyncRemoteDrive(r)&&await this.startSyncRemoteDrive(e),await this.listenerStateManager.initDrive(r)}async getSynchronizationUnits(e,r,n,i,a,s){const o=s||await this.getDrive(e),u=await this.getSynchronizationUnitsIds(e,r,n,i,a,o);return this.getSynchronizationUnitsRevision(e,u,o)}async getSynchronizationUnitsRevision(e,r,n){const i=n||await this.getDrive(e),a=await this.storage.getSynchronizationUnitsRevision(r),s=r.map(o=>({...o,lastUpdated:i.created,revision:-1}));for(const o of a){const u=s.find(c=>o.driveId===c.driveId&&o.documentId===c.documentId&&o.scope===c.scope&&o.branch===c.branch);u&&(u.revision=o.revision,u.lastUpdated=o.lastUpdated)}return s}async getSynchronizationUnitsIds(e,r,n,i,a,s){const u=(s??await this.getDrive(e)).state.global.nodes.filter(l=>Ni(l)&&(!(r!=null&&r.length)||r.includes(l.id)||r.includes("*"))&&(!(a!=null&&a.length)||a.includes(l.documentType)||a.includes("*")));(!r||r.includes("*")||r.includes(""))&&(!(a!=null&&a.length)||a.includes("powerhouse/document-drive")||a.includes("*"))&&u.unshift({id:"",documentType:"powerhouse/document-drive",synchronizationUnits:[{syncId:"0",scope:"global",branch:"main"}]});const c=[];for(const l of u){const d=n!=null&&n.length||i!=null&&i.length?l.synchronizationUnits.filter(f=>(!(n!=null&&n.length)||n.includes(f.scope)||n.includes("*"))&&(!(i!=null&&i.length)||i.includes(f.branch)||i.includes("*"))):l.synchronizationUnits;d.length&&c.push(...d.map(f=>({driveId:e,documentId:l.id,syncId:f.syncId,documentType:l.documentType,scope:f.scope,branch:f.branch})))}return c}async getSynchronizationUnitIdInfo(e,r,n){const a=(n||await this.getDrive(e)).state.global.nodes.find(o=>Ni(o)&&o.synchronizationUnits.find(u=>u.syncId===r));if(!a||!Ni(a))return;const s=a.synchronizationUnits.find(o=>o.syncId===r);if(s)return{syncId:r,scope:s.scope,branch:s.branch,driveId:e,documentId:a.id,documentType:a.documentType}}async getSynchronizationUnit(e,r,n){const i=await this.getSynchronizationUnitIdInfo(e,r,n);if(!i)return;const{scope:a,branch:s,documentId:o,documentType:u}=i,c=await this.getDocument(e,o),l=c.operations[a]??[],d=l[l.length-1];return{syncId:r,scope:a,branch:s,driveId:e,documentId:o,documentType:u,lastUpdated:(d==null?void 0:d.timestamp)??c.lastModified,revision:(d==null?void 0:d.index)??0}}async getOperationData(e,r,n,i){const a=r==="0"?{documentId:"",scope:"global"}:await this.getSynchronizationUnitIdInfo(e,r,i);if(!a)throw new Error(`Invalid Sync Id ${r} in drive ${e}`);const u=((r==="0"?i||await this.getDrive(e):await this.getDocument(e,a.documentId)).operations[a.scope]??[]).filter(l=>Object.keys(n).length===0||(n.since===void 0||SK(n.since,l.timestamp))&&(n.fromRevision===void 0||l.index>n.fromRevision));return(n.limit?u.slice(0,n.limit):u).map(l=>({hash:l.hash,index:l.index,timestamp:l.timestamp,type:l.type,input:l.input,skip:l.skip,context:l.context,id:l.id}))}getDocumentModel(e){const r=this.documentModels.find(n=>n.documentModel.id===e);if(!r)throw new Error(`Document type ${e} not supported`);return r}getDocumentModels(){return[...this.documentModels]}async addDrive(e){const r=e.global.id||W2();if(!r)throw new Error("Invalid Drive Id");if((await this.storage.getDrives()).includes(r))throw new _K(r);const i=nh.createDocument({state:e});return await this.storage.createDrive(r,i),e.global.slug&&await this.cache.deleteDocument("drives-slug",e.global.slug),await this._initializeDrive(r),this.emit("driveAdded",i),i}async addRemoteDrive(e,r){const{id:n,name:i,slug:a,icon:s}=r.expectedDriveInfo||await _u(e),{pullFilter:o,pullInterval:u,availableOffline:c,sharingType:l,listeners:d,triggers:f}=r,h=await Ps.createPullResponderTrigger(n,e,{pullFilter:o,pullInterval:u});return await this.addDrive({global:{id:n,name:i,slug:a,icon:s??null},local:{triggers:[...f,h],listeners:d,availableOffline:c,sharingType:l}})}async registerPullResponderTrigger(e,r,n){return await Ps.createPullResponderTrigger(e,r,n)}async deleteDrive(e){(await Promise.allSettled([this.stopSyncRemoteDrive(e),this.listenerStateManager.removeDrive(e),this.cache.deleteDocument("drives",e),this.storage.deleteDrive(e)])).forEach(n=>{if(n.status==="rejected")throw n.reason})}getDrives(){return this.storage.getDrives()}async getDrive(e,r){let n;try{const s=await this.cache.getDocument("drives",e);if(s&&mu(s)&&(n=s,f1(n,r==null?void 0:r.revisions)))return n}catch(s){ir.error("Error getting drive from cache",s)}const i=n??await this.storage.getDrive(e),a=this._buildDocument(i,r);if(mu(a))return r!=null&&r.revisions||this.cache.setDocument("drives",e,a).catch(ir.error),a;throw new Error(`Document with id ${e} is not a Document Drive`)}async getDriveBySlug(e,r){try{const a=await this.cache.getDocument("drives-slug",e);if(a&&mu(a))return a}catch(a){ir.error("Error getting drive from cache",a)}const n=await this.storage.getDriveBySlug(e),i=this._buildDocument(n,r);if(mu(i))return this.cache.setDocument("drives-slug",e,i).catch(ir.error),i;throw new Error(`Document with slug ${e} is not a Document Drive`)}async getDocument(e,r,n){let i;try{if(i=await this.cache.getDocument(e,r),i&&f1(i,n==null?void 0:n.revisions))return i}catch(o){ir.error("Error getting document from cache",o)}const a=i??await this.storage.getDocument(e,r),s=this._buildDocument(a,n);return n!=null&&n.revisions||this.cache.setDocument(e,r,s).catch(ir.error),s}getDocuments(e){return this.storage.getDocuments(e)}async createDocument(e,r){let n;if(r.document){if(r.documentType!==r.document.documentType)throw new Error(`Provided document is not ${r.documentType}`);n=this._buildDocument(r.document).state}const i=r.document??this.getDocumentModel(r.documentType).utils.createDocument(),a={name:i.name,revision:i.revision,documentType:i.documentType,created:i.created,lastModified:i.lastModified,operations:{global:[],local:[]},initialState:i.initialState,clipboard:[],state:n??i.state};await this.storage.createDocument(e,r.id,a);for(const o of r.synchronizationUnits)this.initSyncStatus(o.syncId,{pull:this.triggerMap.get(e)?"INITIAL_SYNC":void 0,push:this.listenerStateManager.driveHasListeners(e)?"SUCCESS":void 0});const s=Object.values(i.operations).flat();return s.length&&(mu(i)?await this.storage.addDriveOperations(e,s,i):await this.storage.addDocumentOperations(e,r.id,s,i)),i}async deleteDocument(e,r){try{const n=await this.getSynchronizationUnitsIds(e,[r]);for(const i of n)this.updateSyncUnitStatus(i.syncId,null);await this.listenerStateManager.removeSyncUnits(e,n)}catch(n){ir.warn("Error deleting document",n)}return await this.cache.deleteDocument(e,r),this.storage.deleteDocument(e,r)}async _processOperations(e,r,n,i){const a=[],s=[],o=await this._addDocumentResultingStage(n,e,r);let u=this._buildDocument(o),c;const l=FK(i);for(const d of Object.keys(l)){const f=n.operations[d],h=LK(l[d]||[],f);if(h.length<1)continue;const p=RK($K(f)),[m,y]=kK(p,h),v=(y.length<1?m:PK(p,m,jK)).filter(w=>p.length<1||BK(p[p.length-1],w));for(const w of v){let x=!1;if(y.length>0){const _=i.find(A=>A.hash===w.hash);x=!_||_.index!==w.index||_.skip!==w.skip}try{const _=this.options.taskQueueMethod,A=()=>this._performOperation(e,r,u,w,x),M=await(_?EK(A,_):A());u=M.document,s.push(...M.signals),a.push(M.operation)}catch(_){c=_ instanceof Di?_:new Di("ERROR",w,_.message,_.cause);break}}}return{document:u,operationsApplied:a,signals:s,error:c}}async _addDocumentResultingStage(e,r,n,i){var o,u,c,l;const a=(i==null?void 0:i.revisions)!==void 0?MS(e.operations,i.revisions):e.operations,s=Xe.documentHelpers.garbageCollectDocumentOperations(a);for(const d of Object.keys(s)){const f=s[d].at(-1);f&&!f.resultingState&&(f.resultingState=await(n?(u=(o=this.storage).getOperationResultingState)==null?void 0:u.call(o,r,n,f.index,f.scope,"main"):(l=(c=this.storage).getDriveOperationResultingState)==null?void 0:l.call(c,r,f.index,f.scope,"main")))}return{...e,operations:s}}_buildDocument(e,r){if(e.state&&(!r||r.checkHashes===!1)&&f1(e,r==null?void 0:r.revisions))return e;const n=this.getDocumentModel(e.documentType),i=(r==null?void 0:r.revisions)!==void 0?MS(e.operations,r.revisions):e.operations,a=Xe.documentHelpers.garbageCollectDocumentOperations(i);return Xe.replayDocument(e.initialState,a,n.reducer,void 0,e,void 0,{...r,checkHashes:(r==null?void 0:r.checkHashes)??!0,reuseOperationResultingState:(r==null?void 0:r.checkHashes)??!0})}async _performOperation(e,r,n,i,a=!1){var m,y,g,v;const s=this.getDocumentModel(n.documentType),o=[];let u=n;const c=i.scope,d=Xe.documentHelpers.garbageCollectDocumentOperations({...n.operations,[c]:Xe.documentHelpers.skipHeaderOperations(n.operations[c],i)})[c].at(-1);d&&!d.resultingState&&(d.resultingState=await(r?(y=(m=this.storage).getOperationResultingState)==null?void 0:y.call(m,e,r,d.index,d.scope,"main"):(v=(g=this.storage).getDriveOperationResultingState)==null?void 0:v.call(g,e,d.index,d.scope,"main")));const f=[];u=s.reducer(u,i,w=>{let x;switch(w.type){case"CREATE_CHILD_DOCUMENT":x=()=>this.createDocument(e,w.input);break;case"DELETE_CHILD_DOCUMENT":x=()=>this.deleteDocument(e,w.input.id);break;case"COPY_CHILD_DOCUMENT":x=()=>this.getDocument(e,w.input.id).then(_=>this.createDocument(e,{id:w.input.newId,documentType:_.documentType,document:_,synchronizationUnits:w.input.synchronizationUnits}));break}x&&f.push(()=>x().then(_=>({signal:w,result:_})))},{skip:i.skip,reuseOperationResultingState:!0});const p=u.operations[i.scope].filter(w=>w.index==i.index&&w.skip==i.skip).at(0);if(!p)throw new Di("ERROR",i,`Operation with index ${i.index}:${i.skip} was not applied.`);if(!p.error&&p.hash!==i.hash&&!a)throw new wK(i,p);for(const w of f){const x=await w();o.push(x)}return{document:u,signals:o,operation:p}}addOperation(e,r,n,i){return this.addOperations(e,r,[n],i)}async _addOperations(e,r,n){if(this.storage.addDocumentOperationsWithTransaction)await this.storage.addDocumentOperationsWithTransaction(e,r,n);else{const i=await this.storage.getDocument(e,r),a=await n(i);a.operations.length>0&&await this.storage.addDocumentOperations(e,r,a.operations,a.header)}}queueOperation(e,r,n,i){return this.queueOperations(e,r,[n],i)}async resultIfExistingOperations(e,r,n){try{const i=await this.getDocument(e,r);return n.find(s=>!s.id||!i.operations[s.scope].find(o=>o.id===s.id&&o.index===s.index&&o.type===s.type&&o.hash===s.hash))?void 0:{status:"SUCCESS",document:i,operations:n,signals:[]}}catch(i){i.message.includes(`Document with id ${r} not found`)||console.error(i);return}}async queueOperations(e,r,n,i){const a=await this.resultIfExistingOperations(e,r,n);if(a)return a;try{const s=await this.queueManager.addJob({driveId:e,documentId:r,operations:n,options:i});return new Promise((o,u)=>{const c=this.queueManager.on("jobCompleted",(d,f)=>{d.jobId===s&&(c(),l(),o(f))}),l=this.queueManager.on("jobFailed",(d,f)=>{d.jobId===s&&(c(),l(),u(f))})})}catch(s){throw ir.error("Error adding job",s),s}}async queueAction(e,r,n,i){return this.queueActions(e,r,[n],i)}async queueActions(e,r,n,i){try{const a=await this.queueManager.addJob({driveId:e,documentId:r,actions:n,options:i});return new Promise((s,o)=>{const u=this.queueManager.on("jobCompleted",(l,d)=>{l.jobId===a&&(u(),c(),s(d))}),c=this.queueManager.on("jobFailed",(l,d)=>{l.jobId===a&&(u(),c(),o(d))})})}catch(a){throw ir.error("Error adding job",a),a}}async queueDriveAction(e,r,n){return this.queueDriveActions(e,[r],n)}async queueDriveActions(e,r,n){try{const i=await this.queueManager.addJob({driveId:e,actions:r,options:n});return new Promise((a,s)=>{const o=this.queueManager.on("jobCompleted",(c,l)=>{c.jobId===i&&(o(),u(),a(l))}),u=this.queueManager.on("jobFailed",(c,l)=>{c.jobId===i&&(o(),u(),s(l))})})}catch(i){throw ir.error("Error adding drive job",i),i}}async addOperations(e,r,n,i){const a=await this.resultIfExistingOperations(e,r,n);if(a)return a;let s;const o=[],u=[];let c;try{await this._addOperations(e,r,async y=>{const g=await this._processOperations(e,r,y,n);if(!g.document)throw ir.error("Invalid document"),g.error??new Error("Invalid document");return s=g.document,c=g.error,u.push(...g.signals),o.push(...g.operationsApplied),{operations:g.operationsApplied,header:g.document,newState:s.state}}),s&&this.cache.setDocument(e,r,s).catch(ir.error);const{scopes:l,branches:d}=o.reduce((y,g)=>(y.scopes.includes(g.scope)||y.scopes.push(g.scope),y),{scopes:[],branches:["main"]}),f=await this.getSynchronizationUnits(e,[r],l,d),p=o.find(y=>!n.find(g=>g.id===y.id&&g.index===y.index&&g.skip===y.skip&&g.hash===y.hash))?{type:"local"}:(i==null?void 0:i.source)??{type:"local"},m=this.getOperationSource(p);if(this.listenerStateManager.updateSynchronizationRevisions(e,f,p,()=>{this.updateSyncUnitStatus(e,{[m]:"SYNCING"});for(const y of f)this.updateSyncUnitStatus(y.syncId,{[m]:"SYNCING"})},this.handleListenerError.bind(this),(i==null?void 0:i.forceSync)??p.type==="local").then(y=>{y.length&&this.updateSyncUnitStatus(e,{[m]:"SUCCESS"});for(const g of f)this.updateSyncUnitStatus(g.syncId,{[m]:"SUCCESS"})}).catch(y=>{ir.error("Non handled error updating sync revision",y),this.updateSyncUnitStatus(e,{[m]:"ERROR"},y);for(const g of f)this.updateSyncUnitStatus(g.syncId,{[m]:"ERROR"},y)}),c)throw c;return{status:"SUCCESS",document:s,operations:o,signals:u}}catch(l){const d=l instanceof Di?l:new Di("ERROR",void 0,l.message,l.cause);return{status:d.status,error:d,document:s,operations:o,signals:u}}}addDriveOperation(e,r,n){return this.addDriveOperations(e,[r],n)}async clearStorage(){var e,r;for(const n of await this.getDrives())await this.deleteDrive(n);await((r=(e=this.storage).clearStorage)==null?void 0:r.call(e))}async _addDriveOperations(e,r){if(this.storage.addDriveOperationsWithTransaction)return this.storage.addDriveOperationsWithTransaction(e,r);{const n=await this.storage.getDrive(e),i=await r(n);return i.operations.length>0&&await this.storage.addDriveOperations(e,i.operations,i.header),i}}queueDriveOperation(e,r,n){return this.queueDriveOperations(e,[r],n)}async resultIfExistingDriveOperations(e,r){try{const n=await this.getDrive(e);return r.find(a=>!a.id||!n.operations[a.scope].find(s=>s.id===a.id&&s.index===a.index&&s.type===a.type&&s.hash===a.hash))?void 0:{status:"SUCCESS",document:n,operations:r,signals:[]}}catch(n){console.error(n);return}}async queueDriveOperations(e,r,n){const i=await this.resultIfExistingDriveOperations(e,r);if(i)return i;try{const a=await this.queueManager.addJob({driveId:e,operations:r,options:n});return new Promise((s,o)=>{const u=this.queueManager.on("jobCompleted",(l,d)=>{l.jobId===a&&(u(),c(),s(d))}),c=this.queueManager.on("jobFailed",(l,d)=>{l.jobId===a&&(u(),c(),o(d))})})}catch(a){throw ir.error("Error adding drive job",a),a}}async addDriveOperations(e,r,n){let i;const a=[],s=[];let o;const u=await this.resultIfExistingDriveOperations(e,r);if(u)return u;try{if(await this._addDriveOperations(e,async l=>{const d=await this._processOperations(e,void 0,l,r.slice());return i=d.document,a.push(...d.operationsApplied),s.push(...d.signals),o=d.error,{operations:d.operationsApplied,header:d.document}}),!i||!mu(i))throw o??new Error("Invalid Document Drive document");this.cache.setDocument("drives",e,i).catch(ir.error);for(const l of a)switch(l.type){case"ADD_LISTENER":{await this.addListener(e,l);break}case"REMOVE_LISTENER":{await this.removeListener(e,l);break}}const c=a.filter(l=>l.scope==="global").slice().pop();if(c){const d=a.find(h=>!r.find(p=>p.id===h.id&&p.index===h.index&&p.skip===h.skip&&p.hash===h.hash))?{type:"local"}:(n==null?void 0:n.source)??{type:"local"},f=this.getOperationSource(d);this.listenerStateManager.updateSynchronizationRevisions(e,[{syncId:"0",driveId:e,documentId:"",scope:"global",branch:"main",documentType:"powerhouse/document-drive",lastUpdated:c.timestamp,revision:c.index}],d,()=>{this.updateSyncUnitStatus(e,{[f]:"SYNCING"})},this.handleListenerError.bind(this),(n==null?void 0:n.forceSync)??d.type==="local").then(h=>{h.length&&this.updateSyncUnitStatus(e,{[f]:"SUCCESS"})}).catch(h=>{ir.error("Non handled error updating sync revision",h),this.updateSyncUnitStatus(e,{[f]:"ERROR"},h)})}if(this.shouldSyncRemoteDrive(i)?this.startSyncRemoteDrive(i.state.global.id):this.stopSyncRemoteDrive(i.state.global.id),o)throw o;return{status:"SUCCESS",document:i,operations:a,signals:s}}catch(c){const l=c instanceof Di?c:new Di("ERROR",void 0,c.message,c.cause);return{status:l.status,error:l,document:i,operations:a,signals:s}}}_buildOperations(e,r){const n=[],{reducer:i}=this.getDocumentModel(e.documentType);for(const a of r){e=i(e,a);const s=e.operations[a.scope].slice().pop();if(!s)throw new Error("Error creating operations");n.push(s)}return n}async addAction(e,r,n,i){return this.addActions(e,r,[n],i)}async addActions(e,r,n,i){const a=await this.getDocument(e,r),s=this._buildOperations(a,n);return this.addOperations(e,r,s,i)}async addDriveAction(e,r,n){return this.addDriveActions(e,[r],n)}async addDriveActions(e,r,n){const i=await this.getDrive(e),a=this._buildOperations(i,r);return await this.addDriveOperations(e,a,n)}async addInternalListener(e,r,n){const i={callInfo:{data:"",name:"Interal",transmitterType:"Internal"},system:!0,...n};await this.addDriveAction(e,Yn.addListener({listener:i}));const a=await this.getTransmitter(e,n.listenerId);if(!a)throw ir.error("Internal listener not found"),new Error("Internal listener not found");if(!(a instanceof JO))throw ir.error("Listener is not an internal transmitter"),new Error("Listener is not an internal transmitter");return a.setReceiver(r),a}async detachDrive(e){const r=await this.getDrive(e),n=r.state.local.listeners||[],i=r.state.local.triggers||[];for(const a of n)await this.addDriveAction(e,Yn.removeListener({listenerId:a.listenerId}));for(const a of i)await this.addDriveAction(e,Yn.removeTrigger({triggerId:a.id}));await this.addDriveAction(e,Yn.setSharingType({type:"LOCAL"}))}async addListener(e,r){var i,a,s;const{listener:n}=r.input;await this.listenerStateManager.addListener({...n,driveId:e,label:n.label??"",system:n.system??!1,filter:{branch:n.filter.branch??[],documentId:n.filter.documentId??[],documentType:n.filter.documentType??[],scope:n.filter.scope??[]},callInfo:{data:((i=n.callInfo)==null?void 0:i.data)??"",name:((a=n.callInfo)==null?void 0:a.name)??"PullResponder",transmitterType:((s=n.callInfo)==null?void 0:s.transmitterType)??"PullResponder"}})}async removeListener(e,r){const{listenerId:n}=r.input;await this.listenerStateManager.removeListener(e,n)}getTransmitter(e,r){return this.listenerStateManager.getTransmitter(e,r)}getListener(e,r){return this.listenerStateManager.getListener(e,r)}getSyncStatus(e){const r=this.syncStatus.get(e);return r?this.getCombinedSyncUnitStatus(r):new HO(`Sync status not found for syncUnitId: ${e}`,e)}on(e,r){return this.emitter.on(e,r)}emit(e,...r){return this.emitter.emit(e,...r)}}const aG=IK(iG),GO=Object.prototype.toString;function al(t){switch(GO.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Ks(t,Error)}}function Kl(t,e){return GO.call(t)===`[object ${e}]`}function Y2(t){return Kl(t,"ErrorEvent")}function kS(t){return Kl(t,"DOMError")}function sG(t){return Kl(t,"DOMException")}function us(t){return Kl(t,"String")}function J2(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function K2(t){return t===null||J2(t)||typeof t!="object"&&typeof t!="function"}function Yu(t){return Kl(t,"Object")}function L0(t){return typeof Event<"u"&&Ks(t,Event)}function oG(t){return typeof Element<"u"&&Ks(t,Element)}function uG(t){return Kl(t,"RegExp")}function j0(t){return!!(t&&t.then&&typeof t.then=="function")}function cG(t){return Yu(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function XO(t){return typeof t=="number"&&t!==t}function Ks(t,e){try{return t instanceof e}catch{return!1}}function QO(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function sl(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function xg(t,e){if(!Array.isArray(t))return"";const r=[];for(let n=0;n<t.length;n++){const i=t[n];try{QO(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function lG(t,e,r=!1){return us(t)?uG(e)?e.test(t):us(e)?r?t===e:t.includes(e):!1:!1}function Gl(t,e=[],r=!1){return e.some(n=>lG(t,n,r))}function dG(t,e,r=250,n,i,a,s){if(!a.exception||!a.exception.values||!s||!Ks(s.originalException,Error))return;const o=a.exception.values.length>0?a.exception.values[a.exception.values.length-1]:void 0;o&&(a.exception.values=fG(hw(t,e,i,s.originalException,n,a.exception.values,o,0),r))}function hw(t,e,r,n,i,a,s,o){if(a.length>=r+1)return a;let u=[...a];if(Ks(n[i],Error)){RS(s,o);const c=t(e,n[i]),l=u.length;FS(c,i,l,o),u=hw(t,e,r,n[i],i,[c,...u],c,l)}return Array.isArray(n.errors)&&n.errors.forEach((c,l)=>{if(Ks(c,Error)){RS(s,o);const d=t(e,c),f=u.length;FS(d,`errors[${l}]`,f,o),u=hw(t,e,r,c,i,[d,...u],d,f)}}),u}function RS(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function FS(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:r,parent_id:n}}function fG(t,e){return t.map(r=>(r.value&&(r.value=sl(r.value,e)),r))}function Ip(t){return t&&t.Math==Math?t:void 0}const br=typeof globalThis=="object"&&Ip(globalThis)||typeof window=="object"&&Ip(window)||typeof self=="object"&&Ip(self)||typeof global=="object"&&Ip(global)||function(){return this}()||{};function G2(){return br}function eM(t,e,r){const n=r||br,i=n.__SENTRY__=n.__SENTRY__||{};return i[t]||(i[t]=e())}const ol=G2(),hG=80;function zo(t,e={}){if(!t)return"<unknown>";try{let r=t;const n=5,i=[];let a=0,s=0;const o=" > ",u=o.length;let c;const l=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||hG;for(;r&&a++<n&&(c=pG(r,l),!(c==="html"||a>1&&s+i.length*u+c.length>=d));)i.push(c),s+=c.length,r=r.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function pG(t,e){const r=t,n=[];let i,a,s,o,u;if(!r||!r.tagName)return"";if(ol.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const c=e&&e.length?e.filter(d=>r.getAttribute(d)).map(d=>[d,r.getAttribute(d)]):null;if(c&&c.length)c.forEach(d=>{n.push(`[${d[0]}="${d[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&us(i))for(a=i.split(/\s+/),u=0;u<a.length;u++)n.push(`.${a[u]}`);const l=["aria-label","type","name","title","alt"];for(u=0;u<l.length;u++)s=l[u],o=r.getAttribute(s),o&&n.push(`[${s}="${o}"]`);return n.join("")}function mG(){try{return ol.document.location.href}catch{return""}}function gG(t){return ol.document&&ol.document.querySelector?ol.document.querySelector(t):null}function tM(t){if(!ol.HTMLElement)return null;let e=t;const r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement&&e.dataset.sentryComponent)return e.dataset.sentryComponent;e=e.parentNode}return null}const Xl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,yG="Sentry Logger ",Eg=["debug","info","warn","error","log","assert","trace"],Sg={};function Ju(t){if(!("console"in br))return t();const e=br.console,r={},n=Object.keys(Sg);n.forEach(i=>{const a=Sg[i];r[i]=e[i],e[i]=a});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function vG(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Xl?Eg.forEach(r=>{e[r]=(...n)=>{t&&Ju(()=>{br.console[r](`${yG}[${r}]:`,...n)})}}):Eg.forEach(r=>{e[r]=()=>{}}),e}const Me=vG(),bG=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function wG(t){return t==="http"||t==="https"}function Ql(t,e=!1){const{host:r,path:n,pass:i,port:a,projectId:s,protocol:o,publicKey:u}=t;return`${o}://${u}${e&&i?`:${i}`:""}@${r}${a?`:${a}`:""}/${n&&`${n}/`}${s}`}function _G(t){const e=bG.exec(t);if(!e){Ju(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[r,n,i="",a,s="",o]=e.slice(1);let u="",c=o;const l=c.split("/");if(l.length>1&&(u=l.slice(0,-1).join("/"),c=l.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return rM({host:a,pass:i,path:u,projectId:c,port:s,protocol:r,publicKey:n})}function rM(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function xG(t){if(!Xl)return!0;const{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(Me.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?wG(n)?e&&isNaN(parseInt(e,10))?(Me.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Me.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(Me.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function EG(t){const e=typeof t=="string"?_G(t):rM(t);if(!(!e||!xG(e)))return e}class ns extends Error{constructor(e,r="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=r}}function jn(t,e,r){if(!(e in t))return;const n=t[e],i=r(n);typeof i=="function"&&nM(i,n),t[e]=i}function qo(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Xl&&Me.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function nM(t,e){try{const r=e.prototype||{};t.prototype=e.prototype=r,qo(t,"__sentry_original__",e)}catch{}}function X2(t){return t.__sentry_original__}function SG(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function iM(t){if(al(t))return{message:t.message,name:t.name,stack:t.stack,...BS(t)};if(L0(t)){const e={type:t.type,target:PS(t.target),currentTarget:PS(t.currentTarget),...BS(t)};return typeof CustomEvent<"u"&&Ks(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function PS(t){try{return oG(t)?zo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function BS(t){if(typeof t=="object"&&t!==null){const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function TG(t,e=40){const r=Object.keys(iM(t));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=e)return sl(r[0],e);for(let n=r.length;n>0;n--){const i=r.slice(0,n).join(", ");if(!(i.length>e))return n===r.length?i:sl(i,e)}return""}function mi(t){return pw(t,new Map)}function pw(t,e){if(DG(t)){const r=e.get(t);if(r!==void 0)return r;const n={};e.set(t,n);for(const i of Object.keys(t))typeof t[i]<"u"&&(n[i]=pw(t[i],e));return n}if(Array.isArray(t)){const r=e.get(t);if(r!==void 0)return r;const n=[];return e.set(t,n),t.forEach(i=>{n.push(pw(i,e))}),n}return t}function DG(t){if(!Yu(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const aM=50,LS=/\(error: (.*)\)/,jS=/captureMessage|captureException/;function sM(...t){const e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0)=>{const i=[],a=r.split(`
403
403
  `);for(let s=n;s<a.length;s++){const o=a[s];if(o.length>1024)continue;const u=LS.test(o)?o.replace(LS,"$1"):o;if(!u.match(/\S*Error: /)){for(const c of e){const l=c(u);if(l){i.push(l);break}}if(i.length>=aM)break}}return NG(i)}}function AG(t){return Array.isArray(t)?sM(...t):t}function NG(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),jS.test(e[e.length-1].function||"")&&(e.pop(),jS.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,aM).map(r=>({...r,filename:r.filename||e[e.length-1].filename,function:r.function||"?"}))}const h1="<anonymous>";function Gs(t){try{return!t||typeof t!="function"?h1:t.name||h1}catch{return h1}}const Pm={},$S={};function cc(t,e){Pm[t]=Pm[t]||[],Pm[t].push(e)}function lc(t,e){$S[t]||(e(),$S[t]=!0)}function Ra(t,e){const r=t&&Pm[t];if(r)for(const n of r)try{n(e)}catch(i){Xl&&Me.error(`Error while triggering instrumentation handler.
404
404
  Type: ${t}
405
405
  Name: ${Gs(n)}
@@ -436,7 +436,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${l} })`),this._initialOptions.errorSamp
436
436
  Version 1.10.0
437
437
  https://localforage.github.io/localForage
438
438
  (c) 2013-2017 Mozilla, Apache License 2.0
439
- */(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,i,a){function s(c,l){if(!i[c]){if(!n[c]){var d=typeof So=="function"&&So;if(!l&&d)return d(c,!0);if(o)return o(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};n[c][0].call(h.exports,function(p){var m=n[c][1][p];return s(m||p)},h,h.exports,r,n,i,a)}return i[c].exports}for(var o=typeof So=="function"&&So,u=0;u<a.length;u++)s(a[u]);return s}({1:[function(r,n,i){(function(a){var s=a.MutationObserver||a.WebKitMutationObserver,o;if(s){var u=0,c=new s(p),l=a.document.createTextNode("");c.observe(l,{characterData:!0}),o=function(){l.data=u=++u%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var d=new a.MessageChannel;d.port1.onmessage=p,o=function(){d.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?o=function(){var y=a.document.createElement("script");y.onreadystatechange=function(){p(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},a.document.documentElement.appendChild(y)}:o=function(){setTimeout(p,0)};var f,h=[];function p(){f=!0;for(var y,g,v=h.length;v;){for(g=h,h=[],y=-1;++y<v;)g[y]();v=h.length}f=!1}n.exports=m;function m(y){h.push(y)===1&&!f&&o()}}).call(this,typeof ia<"u"?ia:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var a=r(1);function s(){}var o={},u=["REJECTED"],c=["FULFILLED"],l=["PENDING"];n.exports=d;function d(_){if(typeof _!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,_!==s&&m(this,_)}d.prototype.catch=function(_){return this.then(null,_)},d.prototype.then=function(_,A){if(typeof _!="function"&&this.state===c||typeof A!="function"&&this.state===u)return this;var M=new this.constructor(s);if(this.state!==l){var F=this.state===c?_:A;h(M,F,this.outcome)}else this.queue.push(new f(M,_,A));return M};function f(_,A,M){this.promise=_,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof M=="function"&&(this.onRejected=M,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(_){o.resolve(this.promise,_)},f.prototype.otherCallFulfilled=function(_){h(this.promise,this.onFulfilled,_)},f.prototype.callRejected=function(_){o.reject(this.promise,_)},f.prototype.otherCallRejected=function(_){h(this.promise,this.onRejected,_)};function h(_,A,M){a(function(){var F;try{F=A(M)}catch(k){return o.reject(_,k)}F===_?o.reject(_,new TypeError("Cannot resolve promise with itself")):o.resolve(_,F)})}o.resolve=function(_,A){var M=y(p,A);if(M.status==="error")return o.reject(_,M.value);var F=M.value;if(F)m(_,F);else{_.state=c,_.outcome=A;for(var k=-1,$=_.queue.length;++k<$;)_.queue[k].callFulfilled(A)}return _},o.reject=function(_,A){_.state=u,_.outcome=A;for(var M=-1,F=_.queue.length;++M<F;)_.queue[M].callRejected(A);return _};function p(_){var A=_&&_.then;if(_&&(typeof _=="object"||typeof _=="function")&&typeof A=="function")return function(){A.apply(_,arguments)}}function m(_,A){var M=!1;function F(N){M||(M=!0,o.reject(_,N))}function k(N){M||(M=!0,o.resolve(_,N))}function $(){A(k,F)}var T=y($);T.status==="error"&&F(T.value)}function y(_,A){var M={};try{M.value=_(A),M.status="success"}catch(F){M.status="error",M.value=F}return M}d.resolve=g;function g(_){return _ instanceof this?_:o.resolve(new this(s),_)}d.reject=v;function v(_){var A=new this(s);return o.reject(A,_)}d.all=w;function w(_){var A=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=_.length,F=!1;if(!M)return this.resolve([]);for(var k=new Array(M),$=0,T=-1,N=new this(s);++T<M;)b(_[T],T);return N;function b(E,D){A.resolve(E).then(C,function(I){F||(F=!0,o.reject(N,I))});function C(I){k[D]=I,++$===M&&!F&&(F=!0,o.resolve(N,k))}}}d.race=x;function x(_){var A=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=_.length,F=!1;if(!M)return this.resolve([]);for(var k=-1,$=new this(s);++k<M;)T(_[k]);return $;function T(N){A.resolve(N).then(function(b){F||(F=!0,o.resolve($,b))},function(b){F||(F=!0,o.reject($,b))})}}},{1:1}],3:[function(r,n,i){(function(a){typeof a.Promise!="function"&&(a.Promise=r(2))}).call(this,typeof ia<"u"?ia:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ue){return typeof ue}:function(ue){return ue&&typeof Symbol=="function"&&ue.constructor===Symbol&&ue!==Symbol.prototype?"symbol":typeof ue};function s(ue,ge){if(!(ue instanceof ge))throw new TypeError("Cannot call a class as a function")}function o(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var u=o();function c(){try{if(!u||!u.open)return!1;var ue=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),ge=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!ue||ge)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(ue,ge){ue=ue||[],ge=ge||{};try{return new Blob(ue,ge)}catch(_e){if(_e.name!=="TypeError")throw _e;for(var fe=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,xe=new fe,Se=0;Se<ue.length;Se+=1)xe.append(ue[Se]);return xe.getBlob(ge.type)}}typeof Promise>"u"&&r(3);var d=Promise;function f(ue,ge){ge&&ue.then(function(fe){ge(null,fe)},function(fe){ge(fe)})}function h(ue,ge,fe){typeof ge=="function"&&ue.then(ge),typeof fe=="function"&&ue.catch(fe)}function p(ue){return typeof ue!="string"&&(console.warn(ue+" used as a key, but it is not a string."),ue=String(ue)),ue}function m(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var y="local-forage-detect-blob-support",g=void 0,v={},w=Object.prototype.toString,x="readonly",_="readwrite";function A(ue){for(var ge=ue.length,fe=new ArrayBuffer(ge),xe=new Uint8Array(fe),Se=0;Se<ge;Se++)xe[Se]=ue.charCodeAt(Se);return fe}function M(ue){return new d(function(ge){var fe=ue.transaction(y,_),xe=l([""]);fe.objectStore(y).put(xe,"key"),fe.onabort=function(Se){Se.preventDefault(),Se.stopPropagation(),ge(!1)},fe.oncomplete=function(){var Se=navigator.userAgent.match(/Chrome\/(\d+)/),_e=navigator.userAgent.match(/Edge\//);ge(_e||!Se||parseInt(Se[1],10)>=43)}}).catch(function(){return!1})}function F(ue){return typeof g=="boolean"?d.resolve(g):M(ue).then(function(ge){return g=ge,g})}function k(ue){var ge=v[ue.name],fe={};fe.promise=new d(function(xe,Se){fe.resolve=xe,fe.reject=Se}),ge.deferredOperations.push(fe),ge.dbReady?ge.dbReady=ge.dbReady.then(function(){return fe.promise}):ge.dbReady=fe.promise}function $(ue){var ge=v[ue.name],fe=ge.deferredOperations.pop();if(fe)return fe.resolve(),fe.promise}function T(ue,ge){var fe=v[ue.name],xe=fe.deferredOperations.pop();if(xe)return xe.reject(ge),xe.promise}function N(ue,ge){return new d(function(fe,xe){if(v[ue.name]=v[ue.name]||L(),ue.db)if(ge)k(ue),ue.db.close();else return fe(ue.db);var Se=[ue.name];ge&&Se.push(ue.version);var _e=u.open.apply(u,Se);ge&&(_e.onupgradeneeded=function(Re){var Ue=_e.result;try{Ue.createObjectStore(ue.storeName),Re.oldVersion<=1&&Ue.createObjectStore(y)}catch(Ke){if(Ke.name==="ConstraintError")console.warn('The database "'+ue.name+'" has been upgraded from version '+Re.oldVersion+" to version "+Re.newVersion+', but the storage "'+ue.storeName+'" already exists.');else throw Ke}}),_e.onerror=function(Re){Re.preventDefault(),xe(_e.error)},_e.onsuccess=function(){var Re=_e.result;Re.onversionchange=function(Ue){Ue.target.close()},fe(Re),$(ue)}})}function b(ue){return N(ue,!1)}function E(ue){return N(ue,!0)}function D(ue,ge){if(!ue.db)return!0;var fe=!ue.db.objectStoreNames.contains(ue.storeName),xe=ue.version<ue.db.version,Se=ue.version>ue.db.version;if(xe&&(ue.version!==ge&&console.warn('The database "'+ue.name+`" can't be downgraded from version `+ue.db.version+" to version "+ue.version+"."),ue.version=ue.db.version),Se||fe){if(fe){var _e=ue.db.version+1;_e>ue.version&&(ue.version=_e)}return!0}return!1}function C(ue){return new d(function(ge,fe){var xe=new FileReader;xe.onerror=fe,xe.onloadend=function(Se){var _e=btoa(Se.target.result||"");ge({__local_forage_encoded_blob:!0,data:_e,type:ue.type})},xe.readAsBinaryString(ue)})}function I(ue){var ge=A(atob(ue.data));return l([ge],{type:ue.type})}function O(ue){return ue&&ue.__local_forage_encoded_blob}function S(ue){var ge=this,fe=ge._initReady().then(function(){var xe=v[ge._dbInfo.name];if(xe&&xe.dbReady)return xe.dbReady});return h(fe,ue,ue),fe}function P(ue){k(ue);for(var ge=v[ue.name],fe=ge.forages,xe=0;xe<fe.length;xe++){var Se=fe[xe];Se._dbInfo.db&&(Se._dbInfo.db.close(),Se._dbInfo.db=null)}return ue.db=null,b(ue).then(function(_e){return ue.db=_e,D(ue)?E(ue):_e}).then(function(_e){ue.db=ge.db=_e;for(var Re=0;Re<fe.length;Re++)fe[Re]._dbInfo.db=_e}).catch(function(_e){throw T(ue,_e),_e})}function R(ue,ge,fe,xe){xe===void 0&&(xe=1);try{var Se=ue.db.transaction(ue.storeName,ge);fe(null,Se)}catch(_e){if(xe>0&&(!ue.db||_e.name==="InvalidStateError"||_e.name==="NotFoundError"))return d.resolve().then(function(){if(!ue.db||_e.name==="NotFoundError"&&!ue.db.objectStoreNames.contains(ue.storeName)&&ue.version<=ue.db.version)return ue.db&&(ue.version=ue.db.version+1),E(ue)}).then(function(){return P(ue).then(function(){R(ue,ge,fe,xe-1)})}).catch(fe);fe(_e)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function q(ue){var ge=this,fe={db:null};if(ue)for(var xe in ue)fe[xe]=ue[xe];var Se=v[fe.name];Se||(Se=L(),v[fe.name]=Se),Se.forages.push(ge),ge._initReady||(ge._initReady=ge.ready,ge.ready=S);var _e=[];function Re(){return d.resolve()}for(var Ue=0;Ue<Se.forages.length;Ue++){var Ke=Se.forages[Ue];Ke!==ge&&_e.push(Ke._initReady().catch(Re))}var Ge=Se.forages.slice(0);return d.all(_e).then(function(){return fe.db=Se.db,b(fe)}).then(function(nt){return fe.db=nt,D(fe,ge._defaultConfig.version)?E(fe):nt}).then(function(nt){fe.db=Se.db=nt,ge._dbInfo=fe;for(var bt=0;bt<Ge.length;bt++){var hr=Ge[bt];hr!==ge&&(hr._dbInfo.db=fe.db,hr._dbInfo.version=fe.version)}})}function J(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.get(ue);Ge.onsuccess=function(){var nt=Ge.result;nt===void 0&&(nt=null),O(nt)&&(nt=I(nt)),Se(nt)},Ge.onerror=function(){_e(Ge.error)}}catch(nt){_e(nt)}})}).catch(_e)});return f(xe,ge),xe}function G(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.openCursor(),nt=1;Ge.onsuccess=function(){var bt=Ge.result;if(bt){var hr=bt.value;O(hr)&&(hr=I(hr));var Lr=ue(hr,bt.key,nt++);Lr!==void 0?Se(Lr):bt.continue()}else Se()},Ge.onerror=function(){_e(Ge.error)}}catch(bt){_e(bt)}})}).catch(_e)});return f(xe,ge),xe}function ie(ue,ge,fe){var xe=this;ue=p(ue);var Se=new d(function(_e,Re){var Ue;xe.ready().then(function(){return Ue=xe._dbInfo,w.call(ge)==="[object Blob]"?F(Ue.db).then(function(Ke){return Ke?ge:C(ge)}):ge}).then(function(Ke){R(xe._dbInfo,_,function(Ge,nt){if(Ge)return Re(Ge);try{var bt=nt.objectStore(xe._dbInfo.storeName);Ke===null&&(Ke=void 0);var hr=bt.put(Ke,ue);nt.oncomplete=function(){Ke===void 0&&(Ke=null),_e(Ke)},nt.onabort=nt.onerror=function(){var Lr=hr.error?hr.error:hr.transaction.error;Re(Lr)}}catch(Lr){Re(Lr)}})}).catch(Re)});return f(Se,fe),Se}function z(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,_,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.delete(ue);Ue.oncomplete=function(){Se()},Ue.onerror=function(){_e(Ge.error)},Ue.onabort=function(){var nt=Ge.error?Ge.error:Ge.transaction.error;_e(nt)}}catch(nt){_e(nt)}})}).catch(_e)});return f(xe,ge),xe}function V(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,_,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.clear();Re.oncomplete=function(){xe()},Re.onabort=Re.onerror=function(){var Ge=Ke.error?Ke.error:Ke.transaction.error;Se(Ge)}}catch(Ge){Se(Ge)}})}).catch(Se)});return f(fe,ue),fe}function Q(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,x,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.count();Ke.onsuccess=function(){xe(Ke.result)},Ke.onerror=function(){Se(Ke.error)}}catch(Ge){Se(Ge)}})}).catch(Se)});return f(fe,ue),fe}function ae(ue,ge){var fe=this,xe=new d(function(Se,_e){if(ue<0){Se(null);return}fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=!1,nt=Ke.openKeyCursor();nt.onsuccess=function(){var bt=nt.result;if(!bt){Se(null);return}ue===0||Ge?Se(bt.key):(Ge=!0,bt.advance(ue))},nt.onerror=function(){_e(nt.error)}}catch(bt){_e(bt)}})}).catch(_e)});return f(xe,ge),xe}function oe(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,x,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.openKeyCursor(),Ge=[];Ke.onsuccess=function(){var nt=Ke.result;if(!nt){xe(Ge);return}Ge.push(nt.key),nt.continue()},Ke.onerror=function(){Se(Ke.error)}}catch(nt){Se(nt)}})}).catch(Se)});return f(fe,ue),fe}function le(ue,ge){ge=m.apply(this,arguments);var fe=this.config();ue=typeof ue!="function"&&ue||{},ue.name||(ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName);var xe=this,Se;if(!ue.name)Se=d.reject("Invalid arguments");else{var _e=ue.name===fe.name&&xe._dbInfo.db,Re=_e?d.resolve(xe._dbInfo.db):b(ue).then(function(Ue){var Ke=v[ue.name],Ge=Ke.forages;Ke.db=Ue;for(var nt=0;nt<Ge.length;nt++)Ge[nt]._dbInfo.db=Ue;return Ue});ue.storeName?Se=Re.then(function(Ue){if(Ue.objectStoreNames.contains(ue.storeName)){var Ke=Ue.version+1;k(ue);var Ge=v[ue.name],nt=Ge.forages;Ue.close();for(var bt=0;bt<nt.length;bt++){var hr=nt[bt];hr._dbInfo.db=null,hr._dbInfo.version=Ke}var Lr=new d(function(zr,Sn){var wn=u.open(ue.name,Ke);wn.onerror=function(Ki){var pd=wn.result;pd.close(),Sn(Ki)},wn.onupgradeneeded=function(){var Ki=wn.result;Ki.deleteObjectStore(ue.storeName)},wn.onsuccess=function(){var Ki=wn.result;Ki.close(),zr(Ki)}});return Lr.then(function(zr){Ge.db=zr;for(var Sn=0;Sn<nt.length;Sn++){var wn=nt[Sn];wn._dbInfo.db=zr,$(wn._dbInfo)}}).catch(function(zr){throw(T(ue,zr)||d.resolve()).catch(function(){}),zr})}}):Se=Re.then(function(Ue){k(ue);var Ke=v[ue.name],Ge=Ke.forages;Ue.close();for(var nt=0;nt<Ge.length;nt++){var bt=Ge[nt];bt._dbInfo.db=null}var hr=new d(function(Lr,zr){var Sn=u.deleteDatabase(ue.name);Sn.onerror=function(){var wn=Sn.result;wn&&wn.close(),zr(Sn.error)},Sn.onblocked=function(){console.warn('dropInstance blocked for database "'+ue.name+'" until all open connections are closed')},Sn.onsuccess=function(){var wn=Sn.result;wn&&wn.close(),Lr(wn)}});return hr.then(function(Lr){Ke.db=Lr;for(var zr=0;zr<Ge.length;zr++){var Sn=Ge[zr];$(Sn._dbInfo)}}).catch(function(Lr){throw(T(ue,Lr)||d.resolve()).catch(function(){}),Lr})})}return f(Se,ge),Se}var he={_driver:"asyncStorage",_initStorage:q,_support:c(),iterate:G,getItem:J,setItem:ie,removeItem:z,clear:V,length:Q,key:ae,keys:oe,dropInstance:le};function Z(){return typeof openDatabase=="function"}var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,U="__lfsc__:",W=U.length,ee="arbf",te="blob",ne="si08",Y="ui08",re="uic8",ce="si16",de="si32",ve="ur16",we="ui32",Ae="fl32",Ne="fl64",Pe=W+ee.length,Ce=Object.prototype.toString;function Qe(ue){var ge=ue.length*.75,fe=ue.length,xe,Se=0,_e,Re,Ue,Ke;ue[ue.length-1]==="="&&(ge--,ue[ue.length-2]==="="&&ge--);var Ge=new ArrayBuffer(ge),nt=new Uint8Array(Ge);for(xe=0;xe<fe;xe+=4)_e=K.indexOf(ue[xe]),Re=K.indexOf(ue[xe+1]),Ue=K.indexOf(ue[xe+2]),Ke=K.indexOf(ue[xe+3]),nt[Se++]=_e<<2|Re>>4,nt[Se++]=(Re&15)<<4|Ue>>2,nt[Se++]=(Ue&3)<<6|Ke&63;return Ge}function ft(ue){var ge=new Uint8Array(ue),fe="",xe;for(xe=0;xe<ge.length;xe+=3)fe+=K[ge[xe]>>2],fe+=K[(ge[xe]&3)<<4|ge[xe+1]>>4],fe+=K[(ge[xe+1]&15)<<2|ge[xe+2]>>6],fe+=K[ge[xe+2]&63];return ge.length%3===2?fe=fe.substring(0,fe.length-1)+"=":ge.length%3===1&&(fe=fe.substring(0,fe.length-2)+"=="),fe}function $e(ue,ge){var fe="";if(ue&&(fe=Ce.call(ue)),ue&&(fe==="[object ArrayBuffer]"||ue.buffer&&Ce.call(ue.buffer)==="[object ArrayBuffer]")){var xe,Se=U;ue instanceof ArrayBuffer?(xe=ue,Se+=ee):(xe=ue.buffer,fe==="[object Int8Array]"?Se+=ne:fe==="[object Uint8Array]"?Se+=Y:fe==="[object Uint8ClampedArray]"?Se+=re:fe==="[object Int16Array]"?Se+=ce:fe==="[object Uint16Array]"?Se+=ve:fe==="[object Int32Array]"?Se+=de:fe==="[object Uint32Array]"?Se+=we:fe==="[object Float32Array]"?Se+=Ae:fe==="[object Float64Array]"?Se+=Ne:ge(new Error("Failed to get type for BinaryArray"))),ge(Se+ft(xe))}else if(fe==="[object Blob]"){var _e=new FileReader;_e.onload=function(){var Re=B+ue.type+"~"+ft(this.result);ge(U+te+Re)},_e.readAsArrayBuffer(ue)}else try{ge(JSON.stringify(ue))}catch(Re){console.error("Couldn't convert value into a JSON string: ",ue),ge(null,Re)}}function Et(ue){if(ue.substring(0,W)!==U)return JSON.parse(ue);var ge=ue.substring(Pe),fe=ue.substring(W,Pe),xe;if(fe===te&&j.test(ge)){var Se=ge.match(j);xe=Se[1],ge=ge.substring(Se[0].length)}var _e=Qe(ge);switch(fe){case ee:return _e;case te:return l([_e],{type:xe});case ne:return new Int8Array(_e);case Y:return new Uint8Array(_e);case re:return new Uint8ClampedArray(_e);case ce:return new Int16Array(_e);case ve:return new Uint16Array(_e);case de:return new Int32Array(_e);case we:return new Uint32Array(_e);case Ae:return new Float32Array(_e);case Ne:return new Float64Array(_e);default:throw new Error("Unkown type: "+fe)}}var H={serialize:$e,deserialize:Et,stringToBuffer:Qe,bufferToString:ft};function pe(ue,ge,fe,xe){ue.executeSql("CREATE TABLE IF NOT EXISTS "+ge.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],fe,xe)}function Ee(ue){var ge=this,fe={db:null};if(ue)for(var xe in ue)fe[xe]=typeof ue[xe]!="string"?ue[xe].toString():ue[xe];var Se=new d(function(_e,Re){try{fe.db=openDatabase(fe.name,String(fe.version),fe.description,fe.size)}catch(Ue){return Re(Ue)}fe.db.transaction(function(Ue){pe(Ue,fe,function(){ge._dbInfo=fe,_e()},function(Ke,Ge){Re(Ge)})},Re)});return fe.serializer=H,Se}function Oe(ue,ge,fe,xe,Se,_e){ue.executeSql(fe,xe,Se,function(Re,Ue){Ue.code===Ue.SYNTAX_ERR?Re.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[ge.storeName],function(Ke,Ge){Ge.rows.length?_e(Ke,Ue):pe(Ke,ge,function(){Ke.executeSql(fe,xe,Se,_e)},_e)},_e):_e(Re,Ue)},_e)}function je(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT * FROM "+Re.storeName+" WHERE key = ? LIMIT 1",[ue],function(Ke,Ge){var nt=Ge.rows.length?Ge.rows.item(0).value:null;nt&&(nt=Re.serializer.deserialize(nt)),Se(nt)},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function it(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT * FROM "+Re.storeName,[],function(Ke,Ge){for(var nt=Ge.rows,bt=nt.length,hr=0;hr<bt;hr++){var Lr=nt.item(hr),zr=Lr.value;if(zr&&(zr=Re.serializer.deserialize(zr)),zr=ue(zr,Lr.key,hr+1),zr!==void 0){Se(zr);return}}Se()},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function jt(ue,ge,fe,xe){var Se=this;ue=p(ue);var _e=new d(function(Re,Ue){Se.ready().then(function(){ge===void 0&&(ge=null);var Ke=ge,Ge=Se._dbInfo;Ge.serializer.serialize(ge,function(nt,bt){bt?Ue(bt):Ge.db.transaction(function(hr){Oe(hr,Ge,"INSERT OR REPLACE INTO "+Ge.storeName+" (key, value) VALUES (?, ?)",[ue,nt],function(){Re(Ke)},function(Lr,zr){Ue(zr)})},function(hr){if(hr.code===hr.QUOTA_ERR){if(xe>0){Re(jt.apply(Se,[ue,Ke,fe,xe-1]));return}Ue(hr)}})})}).catch(Ue)});return f(_e,fe),_e}function Ft(ue,ge,fe){return jt.apply(this,[ue,ge,fe,1])}function Br(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"DELETE FROM "+Re.storeName+" WHERE key = ?",[ue],function(){Se()},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function Or(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"DELETE FROM "+_e.storeName,[],function(){xe()},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function Mt(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"SELECT COUNT(key) as c FROM "+_e.storeName,[],function(Ue,Ke){var Ge=Ke.rows.item(0).c;xe(Ge)},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function jr(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT key FROM "+Re.storeName+" WHERE id = ? LIMIT 1",[ue+1],function(Ke,Ge){var nt=Ge.rows.length?Ge.rows.item(0).key:null;Se(nt)},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function $r(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"SELECT key FROM "+_e.storeName,[],function(Ue,Ke){for(var Ge=[],nt=0;nt<Ke.rows.length;nt++)Ge.push(Ke.rows.item(nt).key);xe(Ge)},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function me(ue){return new d(function(ge,fe){ue.transaction(function(xe){xe.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Se,_e){for(var Re=[],Ue=0;Ue<_e.rows.length;Ue++)Re.push(_e.rows.item(Ue).name);ge({db:ue,storeNames:Re})},function(Se,_e){fe(_e)})},function(xe){fe(xe)})})}function be(ue,ge){ge=m.apply(this,arguments);var fe=this.config();ue=typeof ue!="function"&&ue||{},ue.name||(ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName);var xe=this,Se;return ue.name?Se=new d(function(_e){var Re;ue.name===fe.name?Re=xe._dbInfo.db:Re=openDatabase(ue.name,"","",0),ue.storeName?_e({db:Re,storeNames:[ue.storeName]}):_e(me(Re))}).then(function(_e){return new d(function(Re,Ue){_e.db.transaction(function(Ke){function Ge(Lr){return new d(function(zr,Sn){Ke.executeSql("DROP TABLE IF EXISTS "+Lr,[],function(){zr()},function(wn,Ki){Sn(Ki)})})}for(var nt=[],bt=0,hr=_e.storeNames.length;bt<hr;bt++)nt.push(Ge(_e.storeNames[bt]));d.all(nt).then(function(){Re()}).catch(function(Lr){Ue(Lr)})},function(Ke){Ue(Ke)})})}):Se=d.reject("Invalid arguments"),f(Se,ge),Se}var De={_driver:"webSQLStorage",_initStorage:Ee,_support:Z(),iterate:it,getItem:je,setItem:Ft,removeItem:Br,clear:Or,length:Mt,key:jr,keys:$r,dropInstance:be};function Ie(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ze(ue,ge){var fe=ue.name+"/";return ue.storeName!==ge.storeName&&(fe+=ue.storeName+"/"),fe}function tt(){var ue="_localforage_support_test";try{return localStorage.setItem(ue,!0),localStorage.removeItem(ue),!1}catch{return!0}}function Ye(){return!tt()||localStorage.length>0}function We(ue){var ge=this,fe={};if(ue)for(var xe in ue)fe[xe]=ue[xe];return fe.keyPrefix=Ze(ue,ge._defaultConfig),Ye()?(ge._dbInfo=fe,fe.serializer=H,d.resolve()):d.reject()}function Je(ue){var ge=this,fe=ge.ready().then(function(){for(var xe=ge._dbInfo.keyPrefix,Se=localStorage.length-1;Se>=0;Se--){var _e=localStorage.key(Se);_e.indexOf(xe)===0&&localStorage.removeItem(_e)}});return f(fe,ue),fe}function Be(ue,ge){var fe=this;ue=p(ue);var xe=fe.ready().then(function(){var Se=fe._dbInfo,_e=localStorage.getItem(Se.keyPrefix+ue);return _e&&(_e=Se.serializer.deserialize(_e)),_e});return f(xe,ge),xe}function rt(ue,ge){var fe=this,xe=fe.ready().then(function(){for(var Se=fe._dbInfo,_e=Se.keyPrefix,Re=_e.length,Ue=localStorage.length,Ke=1,Ge=0;Ge<Ue;Ge++){var nt=localStorage.key(Ge);if(nt.indexOf(_e)===0){var bt=localStorage.getItem(nt);if(bt&&(bt=Se.serializer.deserialize(bt)),bt=ue(bt,nt.substring(Re),Ke++),bt!==void 0)return bt}}});return f(xe,ge),xe}function ht(ue,ge){var fe=this,xe=fe.ready().then(function(){var Se=fe._dbInfo,_e;try{_e=localStorage.key(ue)}catch{_e=null}return _e&&(_e=_e.substring(Se.keyPrefix.length)),_e});return f(xe,ge),xe}function gt(ue){var ge=this,fe=ge.ready().then(function(){for(var xe=ge._dbInfo,Se=localStorage.length,_e=[],Re=0;Re<Se;Re++){var Ue=localStorage.key(Re);Ue.indexOf(xe.keyPrefix)===0&&_e.push(Ue.substring(xe.keyPrefix.length))}return _e});return f(fe,ue),fe}function Ur(ue){var ge=this,fe=ge.keys().then(function(xe){return xe.length});return f(fe,ue),fe}function fr(ue,ge){var fe=this;ue=p(ue);var xe=fe.ready().then(function(){var Se=fe._dbInfo;localStorage.removeItem(Se.keyPrefix+ue)});return f(xe,ge),xe}function Jt(ue,ge,fe){var xe=this;ue=p(ue);var Se=xe.ready().then(function(){ge===void 0&&(ge=null);var _e=ge;return new d(function(Re,Ue){var Ke=xe._dbInfo;Ke.serializer.serialize(ge,function(Ge,nt){if(nt)Ue(nt);else try{localStorage.setItem(Ke.keyPrefix+ue,Ge),Re(_e)}catch(bt){(bt.name==="QuotaExceededError"||bt.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Ue(bt),Ue(bt)}})})});return f(Se,fe),Se}function Sr(ue,ge){if(ge=m.apply(this,arguments),ue=typeof ue!="function"&&ue||{},!ue.name){var fe=this.config();ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName}var xe=this,Se;return ue.name?Se=new d(function(_e){ue.storeName?_e(Ze(ue,xe._defaultConfig)):_e(ue.name+"/")}).then(function(_e){for(var Re=localStorage.length-1;Re>=0;Re--){var Ue=localStorage.key(Re);Ue.indexOf(_e)===0&&localStorage.removeItem(Ue)}}):Se=d.reject("Invalid arguments"),f(Se,ge),Se}var Fn={_driver:"localStorageWrapper",_initStorage:We,_support:Ie(),iterate:rt,getItem:Be,setItem:Jt,removeItem:fr,clear:Je,length:Ur,key:ht,keys:gt,dropInstance:Sr},qn=function(ge,fe){return ge===fe||typeof ge=="number"&&typeof fe=="number"&&isNaN(ge)&&isNaN(fe)},bn=function(ge,fe){for(var xe=ge.length,Se=0;Se<xe;){if(qn(ge[Se],fe))return!0;Se++}return!1},Qr=Array.isArray||function(ue){return Object.prototype.toString.call(ue)==="[object Array]"},kt={},rn={},un={INDEXEDDB:he,WEBSQL:De,LOCALSTORAGE:Fn},Dn=[un.INDEXEDDB._driver,un.WEBSQL._driver,un.LOCALSTORAGE._driver],fn=["dropInstance"],Zt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fn),Mr={description:"",driver:Dn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ti(ue,ge){ue[ge]=function(){var fe=arguments;return ue.ready().then(function(){return ue[ge].apply(ue,fe)})}}function Vn(){for(var ue=1;ue<arguments.length;ue++){var ge=arguments[ue];if(ge)for(var fe in ge)ge.hasOwnProperty(fe)&&(Qr(ge[fe])?arguments[0][fe]=ge[fe].slice():arguments[0][fe]=ge[fe])}return arguments[0]}var nn=function(){function ue(ge){s(this,ue);for(var fe in un)if(un.hasOwnProperty(fe)){var xe=un[fe],Se=xe._driver;this[fe]=Se,kt[Se]||this.defineDriver(xe)}this._defaultConfig=Vn({},Mr),this._config=Vn({},this._defaultConfig,ge),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return ue.prototype.config=function(fe){if((typeof fe>"u"?"undefined":a(fe))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var xe in fe){if(xe==="storeName"&&(fe[xe]=fe[xe].replace(/\W/g,"_")),xe==="version"&&typeof fe[xe]!="number")return new Error("Database version must be a number.");this._config[xe]=fe[xe]}return"driver"in fe&&fe.driver?this.setDriver(this._config.driver):!0}else return typeof fe=="string"?this._config[fe]:this._config},ue.prototype.defineDriver=function(fe,xe,Se){var _e=new d(function(Re,Ue){try{var Ke=fe._driver,Ge=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!fe._driver){Ue(Ge);return}for(var nt=Zt.concat("_initStorage"),bt=0,hr=nt.length;bt<hr;bt++){var Lr=nt[bt],zr=!bn(fn,Lr);if((zr||fe[Lr])&&typeof fe[Lr]!="function"){Ue(Ge);return}}var Sn=function(){for(var pd=function($U){return function(){var UU=new Error("Method "+$U+" is not implemented by the current driver"),jE=d.reject(UU);return f(jE,arguments[arguments.length-1]),jE}},Hy=0,jU=fn.length;Hy<jU;Hy++){var Wy=fn[Hy];fe[Wy]||(fe[Wy]=pd(Wy))}};Sn();var wn=function(pd){kt[Ke]&&console.info("Redefining LocalForage driver: "+Ke),kt[Ke]=fe,rn[Ke]=pd,Re()};"_support"in fe?fe._support&&typeof fe._support=="function"?fe._support().then(wn,Ue):wn(!!fe._support):wn(!0)}catch(Ki){Ue(Ki)}});return h(_e,xe,Se),_e},ue.prototype.driver=function(){return this._driver||null},ue.prototype.getDriver=function(fe,xe,Se){var _e=kt[fe]?d.resolve(kt[fe]):d.reject(new Error("Driver not found."));return h(_e,xe,Se),_e},ue.prototype.getSerializer=function(fe){var xe=d.resolve(H);return h(xe,fe),xe},ue.prototype.ready=function(fe){var xe=this,Se=xe._driverSet.then(function(){return xe._ready===null&&(xe._ready=xe._initDriver()),xe._ready});return h(Se,fe,fe),Se},ue.prototype.setDriver=function(fe,xe,Se){var _e=this;Qr(fe)||(fe=[fe]);var Re=this._getSupportedDrivers(fe);function Ue(){_e._config.driver=_e.driver()}function Ke(bt){return _e._extend(bt),Ue(),_e._ready=_e._initStorage(_e._config),_e._ready}function Ge(bt){return function(){var hr=0;function Lr(){for(;hr<bt.length;){var zr=bt[hr];return hr++,_e._dbInfo=null,_e._ready=null,_e.getDriver(zr).then(Ke).catch(Lr)}Ue();var Sn=new Error("No available storage method found.");return _e._driverSet=d.reject(Sn),_e._driverSet}return Lr()}}var nt=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=nt.then(function(){var bt=Re[0];return _e._dbInfo=null,_e._ready=null,_e.getDriver(bt).then(function(hr){_e._driver=hr._driver,Ue(),_e._wrapLibraryMethodsWithReady(),_e._initDriver=Ge(Re)})}).catch(function(){Ue();var bt=new Error("No available storage method found.");return _e._driverSet=d.reject(bt),_e._driverSet}),h(this._driverSet,xe,Se),this._driverSet},ue.prototype.supports=function(fe){return!!rn[fe]},ue.prototype._extend=function(fe){Vn(this,fe)},ue.prototype._getSupportedDrivers=function(fe){for(var xe=[],Se=0,_e=fe.length;Se<_e;Se++){var Re=fe[Se];this.supports(Re)&&xe.push(Re)}return xe},ue.prototype._wrapLibraryMethodsWithReady=function(){for(var fe=0,xe=Zt.length;fe<xe;fe++)ti(this,Zt[fe])},ue.prototype.createInstance=function(fe){return new ue(fe)},ue}(),Ji=new nn;n.exports=Ji},{3:3}]},{},[4])(4)})})(_k);var jae=_k.exports;const W3=Bh(jae),xk="HttpClient",$ae=(t={})=>{const e={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...t};return{name:xk,setupOnce(){},setup(r){Yae(r,e),Jae(r,e)}}},Ek=$ae;Va(xk,Ek);function Uae(t,e,r,n){if(Tk(t,r.status,r.url)){const i=Kae(e,n);let a,s,o,u;Ak()&&([{headers:a,cookies:o},{headers:s,cookies:u}]=[{cookieHeader:"Cookie",obj:i},{cookieHeader:"Set-Cookie",obj:r}].map(({cookieHeader:l,obj:d})=>{const f=Vae(d.headers);let h;try{const p=f[l]||f[l.toLowerCase()]||void 0;p&&(h=Sk(p))}catch{ch&&Me.log(`Could not extract cookies from header ${l}`)}return{headers:f,cookies:h}}));const c=Dk({url:i.url,method:i.method,status:r.status,requestHeaders:a,responseHeaders:s,requestCookies:o,responseCookies:u});H0(c)}}function zae(t,e,r,n){if(Tk(t,e.status,e.responseURL)){let i,a,s;if(Ak()){try{const u=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;u&&(a=Sk(u))}catch{ch&&Me.log("Could not extract cookies from response headers")}try{s=Zae(e)}catch{ch&&Me.log("Could not extract headers from response")}i=n}const o=Dk({url:e.responseURL,method:r,status:e.status,requestHeaders:i,responseHeaders:s,responseCookies:a});H0(o)}}function qae(t){if(t){const e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function Sk(t){return t.split("; ").reduce((e,r)=>{const[n,i]=r.split("=");return e[n]=i,e},{})}function Vae(t){const e={};return t.forEach((r,n)=>{e[n]=r}),e}function Zae(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
439
+ */(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,i,a){function s(c,l){if(!i[c]){if(!n[c]){var d=typeof So=="function"&&So;if(!l&&d)return d(c,!0);if(o)return o(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};n[c][0].call(h.exports,function(p){var m=n[c][1][p];return s(m||p)},h,h.exports,r,n,i,a)}return i[c].exports}for(var o=typeof So=="function"&&So,u=0;u<a.length;u++)s(a[u]);return s}({1:[function(r,n,i){(function(a){var s=a.MutationObserver||a.WebKitMutationObserver,o;if(s){var u=0,c=new s(p),l=a.document.createTextNode("");c.observe(l,{characterData:!0}),o=function(){l.data=u=++u%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var d=new a.MessageChannel;d.port1.onmessage=p,o=function(){d.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?o=function(){var y=a.document.createElement("script");y.onreadystatechange=function(){p(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},a.document.documentElement.appendChild(y)}:o=function(){setTimeout(p,0)};var f,h=[];function p(){f=!0;for(var y,g,v=h.length;v;){for(g=h,h=[],y=-1;++y<v;)g[y]();v=h.length}f=!1}n.exports=m;function m(y){h.push(y)===1&&!f&&o()}}).call(this,typeof ia<"u"?ia:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var a=r(1);function s(){}var o={},u=["REJECTED"],c=["FULFILLED"],l=["PENDING"];n.exports=d;function d(_){if(typeof _!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,_!==s&&m(this,_)}d.prototype.catch=function(_){return this.then(null,_)},d.prototype.then=function(_,A){if(typeof _!="function"&&this.state===c||typeof A!="function"&&this.state===u)return this;var M=new this.constructor(s);if(this.state!==l){var F=this.state===c?_:A;h(M,F,this.outcome)}else this.queue.push(new f(M,_,A));return M};function f(_,A,M){this.promise=_,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof M=="function"&&(this.onRejected=M,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(_){o.resolve(this.promise,_)},f.prototype.otherCallFulfilled=function(_){h(this.promise,this.onFulfilled,_)},f.prototype.callRejected=function(_){o.reject(this.promise,_)},f.prototype.otherCallRejected=function(_){h(this.promise,this.onRejected,_)};function h(_,A,M){a(function(){var F;try{F=A(M)}catch(k){return o.reject(_,k)}F===_?o.reject(_,new TypeError("Cannot resolve promise with itself")):o.resolve(_,F)})}o.resolve=function(_,A){var M=y(p,A);if(M.status==="error")return o.reject(_,M.value);var F=M.value;if(F)m(_,F);else{_.state=c,_.outcome=A;for(var k=-1,$=_.queue.length;++k<$;)_.queue[k].callFulfilled(A)}return _},o.reject=function(_,A){_.state=u,_.outcome=A;for(var M=-1,F=_.queue.length;++M<F;)_.queue[M].callRejected(A);return _};function p(_){var A=_&&_.then;if(_&&(typeof _=="object"||typeof _=="function")&&typeof A=="function")return function(){A.apply(_,arguments)}}function m(_,A){var M=!1;function F(N){M||(M=!0,o.reject(_,N))}function k(N){M||(M=!0,o.resolve(_,N))}function $(){A(k,F)}var T=y($);T.status==="error"&&F(T.value)}function y(_,A){var M={};try{M.value=_(A),M.status="success"}catch(F){M.status="error",M.value=F}return M}d.resolve=g;function g(_){return _ instanceof this?_:o.resolve(new this(s),_)}d.reject=v;function v(_){var A=new this(s);return o.reject(A,_)}d.all=w;function w(_){var A=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=_.length,F=!1;if(!M)return this.resolve([]);for(var k=new Array(M),$=0,T=-1,N=new this(s);++T<M;)b(_[T],T);return N;function b(E,D){A.resolve(E).then(C,function(I){F||(F=!0,o.reject(N,I))});function C(I){k[D]=I,++$===M&&!F&&(F=!0,o.resolve(N,k))}}}d.race=x;function x(_){var A=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=_.length,F=!1;if(!M)return this.resolve([]);for(var k=-1,$=new this(s);++k<M;)T(_[k]);return $;function T(N){A.resolve(N).then(function(b){F||(F=!0,o.resolve($,b))},function(b){F||(F=!0,o.reject($,b))})}}},{1:1}],3:[function(r,n,i){(function(a){typeof a.Promise!="function"&&(a.Promise=r(2))}).call(this,typeof ia<"u"?ia:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ue){return typeof ue}:function(ue){return ue&&typeof Symbol=="function"&&ue.constructor===Symbol&&ue!==Symbol.prototype?"symbol":typeof ue};function s(ue,ge){if(!(ue instanceof ge))throw new TypeError("Cannot call a class as a function")}function o(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var u=o();function c(){try{if(!u||!u.open)return!1;var ue=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),ge=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!ue||ge)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(ue,ge){ue=ue||[],ge=ge||{};try{return new Blob(ue,ge)}catch(_e){if(_e.name!=="TypeError")throw _e;for(var fe=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,xe=new fe,Se=0;Se<ue.length;Se+=1)xe.append(ue[Se]);return xe.getBlob(ge.type)}}typeof Promise>"u"&&r(3);var d=Promise;function f(ue,ge){ge&&ue.then(function(fe){ge(null,fe)},function(fe){ge(fe)})}function h(ue,ge,fe){typeof ge=="function"&&ue.then(ge),typeof fe=="function"&&ue.catch(fe)}function p(ue){return typeof ue!="string"&&(console.warn(ue+" used as a key, but it is not a string."),ue=String(ue)),ue}function m(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var y="local-forage-detect-blob-support",g=void 0,v={},w=Object.prototype.toString,x="readonly",_="readwrite";function A(ue){for(var ge=ue.length,fe=new ArrayBuffer(ge),xe=new Uint8Array(fe),Se=0;Se<ge;Se++)xe[Se]=ue.charCodeAt(Se);return fe}function M(ue){return new d(function(ge){var fe=ue.transaction(y,_),xe=l([""]);fe.objectStore(y).put(xe,"key"),fe.onabort=function(Se){Se.preventDefault(),Se.stopPropagation(),ge(!1)},fe.oncomplete=function(){var Se=navigator.userAgent.match(/Chrome\/(\d+)/),_e=navigator.userAgent.match(/Edge\//);ge(_e||!Se||parseInt(Se[1],10)>=43)}}).catch(function(){return!1})}function F(ue){return typeof g=="boolean"?d.resolve(g):M(ue).then(function(ge){return g=ge,g})}function k(ue){var ge=v[ue.name],fe={};fe.promise=new d(function(xe,Se){fe.resolve=xe,fe.reject=Se}),ge.deferredOperations.push(fe),ge.dbReady?ge.dbReady=ge.dbReady.then(function(){return fe.promise}):ge.dbReady=fe.promise}function $(ue){var ge=v[ue.name],fe=ge.deferredOperations.pop();if(fe)return fe.resolve(),fe.promise}function T(ue,ge){var fe=v[ue.name],xe=fe.deferredOperations.pop();if(xe)return xe.reject(ge),xe.promise}function N(ue,ge){return new d(function(fe,xe){if(v[ue.name]=v[ue.name]||L(),ue.db)if(ge)k(ue),ue.db.close();else return fe(ue.db);var Se=[ue.name];ge&&Se.push(ue.version);var _e=u.open.apply(u,Se);ge&&(_e.onupgradeneeded=function(Re){var Ue=_e.result;try{Ue.createObjectStore(ue.storeName),Re.oldVersion<=1&&Ue.createObjectStore(y)}catch(Ke){if(Ke.name==="ConstraintError")console.warn('The database "'+ue.name+'" has been upgraded from version '+Re.oldVersion+" to version "+Re.newVersion+', but the storage "'+ue.storeName+'" already exists.');else throw Ke}}),_e.onerror=function(Re){Re.preventDefault(),xe(_e.error)},_e.onsuccess=function(){var Re=_e.result;Re.onversionchange=function(Ue){Ue.target.close()},fe(Re),$(ue)}})}function b(ue){return N(ue,!1)}function E(ue){return N(ue,!0)}function D(ue,ge){if(!ue.db)return!0;var fe=!ue.db.objectStoreNames.contains(ue.storeName),xe=ue.version<ue.db.version,Se=ue.version>ue.db.version;if(xe&&(ue.version!==ge&&console.warn('The database "'+ue.name+`" can't be downgraded from version `+ue.db.version+" to version "+ue.version+"."),ue.version=ue.db.version),Se||fe){if(fe){var _e=ue.db.version+1;_e>ue.version&&(ue.version=_e)}return!0}return!1}function C(ue){return new d(function(ge,fe){var xe=new FileReader;xe.onerror=fe,xe.onloadend=function(Se){var _e=btoa(Se.target.result||"");ge({__local_forage_encoded_blob:!0,data:_e,type:ue.type})},xe.readAsBinaryString(ue)})}function I(ue){var ge=A(atob(ue.data));return l([ge],{type:ue.type})}function O(ue){return ue&&ue.__local_forage_encoded_blob}function S(ue){var ge=this,fe=ge._initReady().then(function(){var xe=v[ge._dbInfo.name];if(xe&&xe.dbReady)return xe.dbReady});return h(fe,ue,ue),fe}function P(ue){k(ue);for(var ge=v[ue.name],fe=ge.forages,xe=0;xe<fe.length;xe++){var Se=fe[xe];Se._dbInfo.db&&(Se._dbInfo.db.close(),Se._dbInfo.db=null)}return ue.db=null,b(ue).then(function(_e){return ue.db=_e,D(ue)?E(ue):_e}).then(function(_e){ue.db=ge.db=_e;for(var Re=0;Re<fe.length;Re++)fe[Re]._dbInfo.db=_e}).catch(function(_e){throw T(ue,_e),_e})}function R(ue,ge,fe,xe){xe===void 0&&(xe=1);try{var Se=ue.db.transaction(ue.storeName,ge);fe(null,Se)}catch(_e){if(xe>0&&(!ue.db||_e.name==="InvalidStateError"||_e.name==="NotFoundError"))return d.resolve().then(function(){if(!ue.db||_e.name==="NotFoundError"&&!ue.db.objectStoreNames.contains(ue.storeName)&&ue.version<=ue.db.version)return ue.db&&(ue.version=ue.db.version+1),E(ue)}).then(function(){return P(ue).then(function(){R(ue,ge,fe,xe-1)})}).catch(fe);fe(_e)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function q(ue){var ge=this,fe={db:null};if(ue)for(var xe in ue)fe[xe]=ue[xe];var Se=v[fe.name];Se||(Se=L(),v[fe.name]=Se),Se.forages.push(ge),ge._initReady||(ge._initReady=ge.ready,ge.ready=S);var _e=[];function Re(){return d.resolve()}for(var Ue=0;Ue<Se.forages.length;Ue++){var Ke=Se.forages[Ue];Ke!==ge&&_e.push(Ke._initReady().catch(Re))}var Ge=Se.forages.slice(0);return d.all(_e).then(function(){return fe.db=Se.db,b(fe)}).then(function(nt){return fe.db=nt,D(fe,ge._defaultConfig.version)?E(fe):nt}).then(function(nt){fe.db=Se.db=nt,ge._dbInfo=fe;for(var bt=0;bt<Ge.length;bt++){var hr=Ge[bt];hr!==ge&&(hr._dbInfo.db=fe.db,hr._dbInfo.version=fe.version)}})}function J(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.get(ue);Ge.onsuccess=function(){var nt=Ge.result;nt===void 0&&(nt=null),O(nt)&&(nt=I(nt)),Se(nt)},Ge.onerror=function(){_e(Ge.error)}}catch(nt){_e(nt)}})}).catch(_e)});return f(xe,ge),xe}function G(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.openCursor(),nt=1;Ge.onsuccess=function(){var bt=Ge.result;if(bt){var hr=bt.value;O(hr)&&(hr=I(hr));var Lr=ue(hr,bt.key,nt++);Lr!==void 0?Se(Lr):bt.continue()}else Se()},Ge.onerror=function(){_e(Ge.error)}}catch(bt){_e(bt)}})}).catch(_e)});return f(xe,ge),xe}function ie(ue,ge,fe){var xe=this;ue=p(ue);var Se=new d(function(_e,Re){var Ue;xe.ready().then(function(){return Ue=xe._dbInfo,w.call(ge)==="[object Blob]"?F(Ue.db).then(function(Ke){return Ke?ge:C(ge)}):ge}).then(function(Ke){R(xe._dbInfo,_,function(Ge,nt){if(Ge)return Re(Ge);try{var bt=nt.objectStore(xe._dbInfo.storeName);Ke===null&&(Ke=void 0);var hr=bt.put(Ke,ue);nt.oncomplete=function(){Ke===void 0&&(Ke=null),_e(Ke)},nt.onabort=nt.onerror=function(){var Lr=hr.error?hr.error:hr.transaction.error;Re(Lr)}}catch(Lr){Re(Lr)}})}).catch(Re)});return f(Se,fe),Se}function z(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){R(fe._dbInfo,_,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=Ke.delete(ue);Ue.oncomplete=function(){Se()},Ue.onerror=function(){_e(Ge.error)},Ue.onabort=function(){var nt=Ge.error?Ge.error:Ge.transaction.error;_e(nt)}}catch(nt){_e(nt)}})}).catch(_e)});return f(xe,ge),xe}function V(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,_,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.clear();Re.oncomplete=function(){xe()},Re.onabort=Re.onerror=function(){var Ge=Ke.error?Ke.error:Ke.transaction.error;Se(Ge)}}catch(Ge){Se(Ge)}})}).catch(Se)});return f(fe,ue),fe}function Q(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,x,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.count();Ke.onsuccess=function(){xe(Ke.result)},Ke.onerror=function(){Se(Ke.error)}}catch(Ge){Se(Ge)}})}).catch(Se)});return f(fe,ue),fe}function ae(ue,ge){var fe=this,xe=new d(function(Se,_e){if(ue<0){Se(null);return}fe.ready().then(function(){R(fe._dbInfo,x,function(Re,Ue){if(Re)return _e(Re);try{var Ke=Ue.objectStore(fe._dbInfo.storeName),Ge=!1,nt=Ke.openKeyCursor();nt.onsuccess=function(){var bt=nt.result;if(!bt){Se(null);return}ue===0||Ge?Se(bt.key):(Ge=!0,bt.advance(ue))},nt.onerror=function(){_e(nt.error)}}catch(bt){_e(bt)}})}).catch(_e)});return f(xe,ge),xe}function oe(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){R(ge._dbInfo,x,function(_e,Re){if(_e)return Se(_e);try{var Ue=Re.objectStore(ge._dbInfo.storeName),Ke=Ue.openKeyCursor(),Ge=[];Ke.onsuccess=function(){var nt=Ke.result;if(!nt){xe(Ge);return}Ge.push(nt.key),nt.continue()},Ke.onerror=function(){Se(Ke.error)}}catch(nt){Se(nt)}})}).catch(Se)});return f(fe,ue),fe}function le(ue,ge){ge=m.apply(this,arguments);var fe=this.config();ue=typeof ue!="function"&&ue||{},ue.name||(ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName);var xe=this,Se;if(!ue.name)Se=d.reject("Invalid arguments");else{var _e=ue.name===fe.name&&xe._dbInfo.db,Re=_e?d.resolve(xe._dbInfo.db):b(ue).then(function(Ue){var Ke=v[ue.name],Ge=Ke.forages;Ke.db=Ue;for(var nt=0;nt<Ge.length;nt++)Ge[nt]._dbInfo.db=Ue;return Ue});ue.storeName?Se=Re.then(function(Ue){if(Ue.objectStoreNames.contains(ue.storeName)){var Ke=Ue.version+1;k(ue);var Ge=v[ue.name],nt=Ge.forages;Ue.close();for(var bt=0;bt<nt.length;bt++){var hr=nt[bt];hr._dbInfo.db=null,hr._dbInfo.version=Ke}var Lr=new d(function(zr,Sn){var wn=u.open(ue.name,Ke);wn.onerror=function(Ki){var pd=wn.result;pd.close(),Sn(Ki)},wn.onupgradeneeded=function(){var Ki=wn.result;Ki.deleteObjectStore(ue.storeName)},wn.onsuccess=function(){var Ki=wn.result;Ki.close(),zr(Ki)}});return Lr.then(function(zr){Ge.db=zr;for(var Sn=0;Sn<nt.length;Sn++){var wn=nt[Sn];wn._dbInfo.db=zr,$(wn._dbInfo)}}).catch(function(zr){throw(T(ue,zr)||d.resolve()).catch(function(){}),zr})}}):Se=Re.then(function(Ue){k(ue);var Ke=v[ue.name],Ge=Ke.forages;Ue.close();for(var nt=0;nt<Ge.length;nt++){var bt=Ge[nt];bt._dbInfo.db=null}var hr=new d(function(Lr,zr){var Sn=u.deleteDatabase(ue.name);Sn.onerror=function(){var wn=Sn.result;wn&&wn.close(),zr(Sn.error)},Sn.onblocked=function(){console.warn('dropInstance blocked for database "'+ue.name+'" until all open connections are closed')},Sn.onsuccess=function(){var wn=Sn.result;wn&&wn.close(),Lr(wn)}});return hr.then(function(Lr){Ke.db=Lr;for(var zr=0;zr<Ge.length;zr++){var Sn=Ge[zr];$(Sn._dbInfo)}}).catch(function(Lr){throw(T(ue,Lr)||d.resolve()).catch(function(){}),Lr})})}return f(Se,ge),Se}var he={_driver:"asyncStorage",_initStorage:q,_support:c(),iterate:G,getItem:J,setItem:ie,removeItem:z,clear:V,length:Q,key:ae,keys:oe,dropInstance:le};function Z(){return typeof openDatabase=="function"}var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,U="__lfsc__:",W=U.length,ee="arbf",te="blob",ne="si08",Y="ui08",re="uic8",ce="si16",de="si32",ve="ur16",we="ui32",Ae="fl32",Ne="fl64",Pe=W+ee.length,Ce=Object.prototype.toString;function Qe(ue){var ge=ue.length*.75,fe=ue.length,xe,Se=0,_e,Re,Ue,Ke;ue[ue.length-1]==="="&&(ge--,ue[ue.length-2]==="="&&ge--);var Ge=new ArrayBuffer(ge),nt=new Uint8Array(Ge);for(xe=0;xe<fe;xe+=4)_e=K.indexOf(ue[xe]),Re=K.indexOf(ue[xe+1]),Ue=K.indexOf(ue[xe+2]),Ke=K.indexOf(ue[xe+3]),nt[Se++]=_e<<2|Re>>4,nt[Se++]=(Re&15)<<4|Ue>>2,nt[Se++]=(Ue&3)<<6|Ke&63;return Ge}function ft(ue){var ge=new Uint8Array(ue),fe="",xe;for(xe=0;xe<ge.length;xe+=3)fe+=K[ge[xe]>>2],fe+=K[(ge[xe]&3)<<4|ge[xe+1]>>4],fe+=K[(ge[xe+1]&15)<<2|ge[xe+2]>>6],fe+=K[ge[xe+2]&63];return ge.length%3===2?fe=fe.substring(0,fe.length-1)+"=":ge.length%3===1&&(fe=fe.substring(0,fe.length-2)+"=="),fe}function $e(ue,ge){var fe="";if(ue&&(fe=Ce.call(ue)),ue&&(fe==="[object ArrayBuffer]"||ue.buffer&&Ce.call(ue.buffer)==="[object ArrayBuffer]")){var xe,Se=U;ue instanceof ArrayBuffer?(xe=ue,Se+=ee):(xe=ue.buffer,fe==="[object Int8Array]"?Se+=ne:fe==="[object Uint8Array]"?Se+=Y:fe==="[object Uint8ClampedArray]"?Se+=re:fe==="[object Int16Array]"?Se+=ce:fe==="[object Uint16Array]"?Se+=ve:fe==="[object Int32Array]"?Se+=de:fe==="[object Uint32Array]"?Se+=we:fe==="[object Float32Array]"?Se+=Ae:fe==="[object Float64Array]"?Se+=Ne:ge(new Error("Failed to get type for BinaryArray"))),ge(Se+ft(xe))}else if(fe==="[object Blob]"){var _e=new FileReader;_e.onload=function(){var Re=B+ue.type+"~"+ft(this.result);ge(U+te+Re)},_e.readAsArrayBuffer(ue)}else try{ge(JSON.stringify(ue))}catch(Re){console.error("Couldn't convert value into a JSON string: ",ue),ge(null,Re)}}function Et(ue){if(ue.substring(0,W)!==U)return JSON.parse(ue);var ge=ue.substring(Pe),fe=ue.substring(W,Pe),xe;if(fe===te&&j.test(ge)){var Se=ge.match(j);xe=Se[1],ge=ge.substring(Se[0].length)}var _e=Qe(ge);switch(fe){case ee:return _e;case te:return l([_e],{type:xe});case ne:return new Int8Array(_e);case Y:return new Uint8Array(_e);case re:return new Uint8ClampedArray(_e);case ce:return new Int16Array(_e);case ve:return new Uint16Array(_e);case de:return new Int32Array(_e);case we:return new Uint32Array(_e);case Ae:return new Float32Array(_e);case Ne:return new Float64Array(_e);default:throw new Error("Unkown type: "+fe)}}var H={serialize:$e,deserialize:Et,stringToBuffer:Qe,bufferToString:ft};function pe(ue,ge,fe,xe){ue.executeSql("CREATE TABLE IF NOT EXISTS "+ge.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],fe,xe)}function Ee(ue){var ge=this,fe={db:null};if(ue)for(var xe in ue)fe[xe]=typeof ue[xe]!="string"?ue[xe].toString():ue[xe];var Se=new d(function(_e,Re){try{fe.db=openDatabase(fe.name,String(fe.version),fe.description,fe.size)}catch(Ue){return Re(Ue)}fe.db.transaction(function(Ue){pe(Ue,fe,function(){ge._dbInfo=fe,_e()},function(Ke,Ge){Re(Ge)})},Re)});return fe.serializer=H,Se}function Oe(ue,ge,fe,xe,Se,_e){ue.executeSql(fe,xe,Se,function(Re,Ue){Ue.code===Ue.SYNTAX_ERR?Re.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[ge.storeName],function(Ke,Ge){Ge.rows.length?_e(Ke,Ue):pe(Ke,ge,function(){Ke.executeSql(fe,xe,Se,_e)},_e)},_e):_e(Re,Ue)},_e)}function je(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT * FROM "+Re.storeName+" WHERE key = ? LIMIT 1",[ue],function(Ke,Ge){var nt=Ge.rows.length?Ge.rows.item(0).value:null;nt&&(nt=Re.serializer.deserialize(nt)),Se(nt)},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function it(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT * FROM "+Re.storeName,[],function(Ke,Ge){for(var nt=Ge.rows,bt=nt.length,hr=0;hr<bt;hr++){var Lr=nt.item(hr),zr=Lr.value;if(zr&&(zr=Re.serializer.deserialize(zr)),zr=ue(zr,Lr.key,hr+1),zr!==void 0){Se(zr);return}}Se()},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function jt(ue,ge,fe,xe){var Se=this;ue=p(ue);var _e=new d(function(Re,Ue){Se.ready().then(function(){ge===void 0&&(ge=null);var Ke=ge,Ge=Se._dbInfo;Ge.serializer.serialize(ge,function(nt,bt){bt?Ue(bt):Ge.db.transaction(function(hr){Oe(hr,Ge,"INSERT OR REPLACE INTO "+Ge.storeName+" (key, value) VALUES (?, ?)",[ue,nt],function(){Re(Ke)},function(Lr,zr){Ue(zr)})},function(hr){if(hr.code===hr.QUOTA_ERR){if(xe>0){Re(jt.apply(Se,[ue,Ke,fe,xe-1]));return}Ue(hr)}})})}).catch(Ue)});return f(_e,fe),_e}function Ft(ue,ge,fe){return jt.apply(this,[ue,ge,fe,1])}function Br(ue,ge){var fe=this;ue=p(ue);var xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"DELETE FROM "+Re.storeName+" WHERE key = ?",[ue],function(){Se()},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function Or(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"DELETE FROM "+_e.storeName,[],function(){xe()},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function Mt(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"SELECT COUNT(key) as c FROM "+_e.storeName,[],function(Ue,Ke){var Ge=Ke.rows.item(0).c;xe(Ge)},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function jr(ue,ge){var fe=this,xe=new d(function(Se,_e){fe.ready().then(function(){var Re=fe._dbInfo;Re.db.transaction(function(Ue){Oe(Ue,Re,"SELECT key FROM "+Re.storeName+" WHERE id = ? LIMIT 1",[ue+1],function(Ke,Ge){var nt=Ge.rows.length?Ge.rows.item(0).key:null;Se(nt)},function(Ke,Ge){_e(Ge)})})}).catch(_e)});return f(xe,ge),xe}function $r(ue){var ge=this,fe=new d(function(xe,Se){ge.ready().then(function(){var _e=ge._dbInfo;_e.db.transaction(function(Re){Oe(Re,_e,"SELECT key FROM "+_e.storeName,[],function(Ue,Ke){for(var Ge=[],nt=0;nt<Ke.rows.length;nt++)Ge.push(Ke.rows.item(nt).key);xe(Ge)},function(Ue,Ke){Se(Ke)})})}).catch(Se)});return f(fe,ue),fe}function me(ue){return new d(function(ge,fe){ue.transaction(function(xe){xe.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Se,_e){for(var Re=[],Ue=0;Ue<_e.rows.length;Ue++)Re.push(_e.rows.item(Ue).name);ge({db:ue,storeNames:Re})},function(Se,_e){fe(_e)})},function(xe){fe(xe)})})}function be(ue,ge){ge=m.apply(this,arguments);var fe=this.config();ue=typeof ue!="function"&&ue||{},ue.name||(ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName);var xe=this,Se;return ue.name?Se=new d(function(_e){var Re;ue.name===fe.name?Re=xe._dbInfo.db:Re=openDatabase(ue.name,"","",0),ue.storeName?_e({db:Re,storeNames:[ue.storeName]}):_e(me(Re))}).then(function(_e){return new d(function(Re,Ue){_e.db.transaction(function(Ke){function Ge(Lr){return new d(function(zr,Sn){Ke.executeSql("DROP TABLE IF EXISTS "+Lr,[],function(){zr()},function(wn,Ki){Sn(Ki)})})}for(var nt=[],bt=0,hr=_e.storeNames.length;bt<hr;bt++)nt.push(Ge(_e.storeNames[bt]));d.all(nt).then(function(){Re()}).catch(function(Lr){Ue(Lr)})},function(Ke){Ue(Ke)})})}):Se=d.reject("Invalid arguments"),f(Se,ge),Se}var De={_driver:"webSQLStorage",_initStorage:Ee,_support:Z(),iterate:it,getItem:je,setItem:Ft,removeItem:Br,clear:Or,length:Mt,key:jr,keys:$r,dropInstance:be};function Ie(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ze(ue,ge){var fe=ue.name+"/";return ue.storeName!==ge.storeName&&(fe+=ue.storeName+"/"),fe}function tt(){var ue="_localforage_support_test";try{return localStorage.setItem(ue,!0),localStorage.removeItem(ue),!1}catch{return!0}}function Ye(){return!tt()||localStorage.length>0}function We(ue){var ge=this,fe={};if(ue)for(var xe in ue)fe[xe]=ue[xe];return fe.keyPrefix=Ze(ue,ge._defaultConfig),Ye()?(ge._dbInfo=fe,fe.serializer=H,d.resolve()):d.reject()}function Je(ue){var ge=this,fe=ge.ready().then(function(){for(var xe=ge._dbInfo.keyPrefix,Se=localStorage.length-1;Se>=0;Se--){var _e=localStorage.key(Se);_e.indexOf(xe)===0&&localStorage.removeItem(_e)}});return f(fe,ue),fe}function Be(ue,ge){var fe=this;ue=p(ue);var xe=fe.ready().then(function(){var Se=fe._dbInfo,_e=localStorage.getItem(Se.keyPrefix+ue);return _e&&(_e=Se.serializer.deserialize(_e)),_e});return f(xe,ge),xe}function rt(ue,ge){var fe=this,xe=fe.ready().then(function(){for(var Se=fe._dbInfo,_e=Se.keyPrefix,Re=_e.length,Ue=localStorage.length,Ke=1,Ge=0;Ge<Ue;Ge++){var nt=localStorage.key(Ge);if(nt.indexOf(_e)===0){var bt=localStorage.getItem(nt);if(bt&&(bt=Se.serializer.deserialize(bt)),bt=ue(bt,nt.substring(Re),Ke++),bt!==void 0)return bt}}});return f(xe,ge),xe}function ht(ue,ge){var fe=this,xe=fe.ready().then(function(){var Se=fe._dbInfo,_e;try{_e=localStorage.key(ue)}catch{_e=null}return _e&&(_e=_e.substring(Se.keyPrefix.length)),_e});return f(xe,ge),xe}function gt(ue){var ge=this,fe=ge.ready().then(function(){for(var xe=ge._dbInfo,Se=localStorage.length,_e=[],Re=0;Re<Se;Re++){var Ue=localStorage.key(Re);Ue.indexOf(xe.keyPrefix)===0&&_e.push(Ue.substring(xe.keyPrefix.length))}return _e});return f(fe,ue),fe}function Ur(ue){var ge=this,fe=ge.keys().then(function(xe){return xe.length});return f(fe,ue),fe}function fr(ue,ge){var fe=this;ue=p(ue);var xe=fe.ready().then(function(){var Se=fe._dbInfo;localStorage.removeItem(Se.keyPrefix+ue)});return f(xe,ge),xe}function Jt(ue,ge,fe){var xe=this;ue=p(ue);var Se=xe.ready().then(function(){ge===void 0&&(ge=null);var _e=ge;return new d(function(Re,Ue){var Ke=xe._dbInfo;Ke.serializer.serialize(ge,function(Ge,nt){if(nt)Ue(nt);else try{localStorage.setItem(Ke.keyPrefix+ue,Ge),Re(_e)}catch(bt){(bt.name==="QuotaExceededError"||bt.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Ue(bt),Ue(bt)}})})});return f(Se,fe),Se}function Sr(ue,ge){if(ge=m.apply(this,arguments),ue=typeof ue!="function"&&ue||{},!ue.name){var fe=this.config();ue.name=ue.name||fe.name,ue.storeName=ue.storeName||fe.storeName}var xe=this,Se;return ue.name?Se=new d(function(_e){ue.storeName?_e(Ze(ue,xe._defaultConfig)):_e(ue.name+"/")}).then(function(_e){for(var Re=localStorage.length-1;Re>=0;Re--){var Ue=localStorage.key(Re);Ue.indexOf(_e)===0&&localStorage.removeItem(Ue)}}):Se=d.reject("Invalid arguments"),f(Se,ge),Se}var Fn={_driver:"localStorageWrapper",_initStorage:We,_support:Ie(),iterate:rt,getItem:Be,setItem:Jt,removeItem:fr,clear:Je,length:Ur,key:ht,keys:gt,dropInstance:Sr},zn=function(ge,fe){return ge===fe||typeof ge=="number"&&typeof fe=="number"&&isNaN(ge)&&isNaN(fe)},bn=function(ge,fe){for(var xe=ge.length,Se=0;Se<xe;){if(zn(ge[Se],fe))return!0;Se++}return!1},Qr=Array.isArray||function(ue){return Object.prototype.toString.call(ue)==="[object Array]"},kt={},rn={},un={INDEXEDDB:he,WEBSQL:De,LOCALSTORAGE:Fn},Dn=[un.INDEXEDDB._driver,un.WEBSQL._driver,un.LOCALSTORAGE._driver],fn=["dropInstance"],Zt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fn),Mr={description:"",driver:Dn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ti(ue,ge){ue[ge]=function(){var fe=arguments;return ue.ready().then(function(){return ue[ge].apply(ue,fe)})}}function qn(){for(var ue=1;ue<arguments.length;ue++){var ge=arguments[ue];if(ge)for(var fe in ge)ge.hasOwnProperty(fe)&&(Qr(ge[fe])?arguments[0][fe]=ge[fe].slice():arguments[0][fe]=ge[fe])}return arguments[0]}var nn=function(){function ue(ge){s(this,ue);for(var fe in un)if(un.hasOwnProperty(fe)){var xe=un[fe],Se=xe._driver;this[fe]=Se,kt[Se]||this.defineDriver(xe)}this._defaultConfig=qn({},Mr),this._config=qn({},this._defaultConfig,ge),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return ue.prototype.config=function(fe){if((typeof fe>"u"?"undefined":a(fe))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var xe in fe){if(xe==="storeName"&&(fe[xe]=fe[xe].replace(/\W/g,"_")),xe==="version"&&typeof fe[xe]!="number")return new Error("Database version must be a number.");this._config[xe]=fe[xe]}return"driver"in fe&&fe.driver?this.setDriver(this._config.driver):!0}else return typeof fe=="string"?this._config[fe]:this._config},ue.prototype.defineDriver=function(fe,xe,Se){var _e=new d(function(Re,Ue){try{var Ke=fe._driver,Ge=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!fe._driver){Ue(Ge);return}for(var nt=Zt.concat("_initStorage"),bt=0,hr=nt.length;bt<hr;bt++){var Lr=nt[bt],zr=!bn(fn,Lr);if((zr||fe[Lr])&&typeof fe[Lr]!="function"){Ue(Ge);return}}var Sn=function(){for(var pd=function($U){return function(){var UU=new Error("Method "+$U+" is not implemented by the current driver"),jE=d.reject(UU);return f(jE,arguments[arguments.length-1]),jE}},Hy=0,jU=fn.length;Hy<jU;Hy++){var Wy=fn[Hy];fe[Wy]||(fe[Wy]=pd(Wy))}};Sn();var wn=function(pd){kt[Ke]&&console.info("Redefining LocalForage driver: "+Ke),kt[Ke]=fe,rn[Ke]=pd,Re()};"_support"in fe?fe._support&&typeof fe._support=="function"?fe._support().then(wn,Ue):wn(!!fe._support):wn(!0)}catch(Ki){Ue(Ki)}});return h(_e,xe,Se),_e},ue.prototype.driver=function(){return this._driver||null},ue.prototype.getDriver=function(fe,xe,Se){var _e=kt[fe]?d.resolve(kt[fe]):d.reject(new Error("Driver not found."));return h(_e,xe,Se),_e},ue.prototype.getSerializer=function(fe){var xe=d.resolve(H);return h(xe,fe),xe},ue.prototype.ready=function(fe){var xe=this,Se=xe._driverSet.then(function(){return xe._ready===null&&(xe._ready=xe._initDriver()),xe._ready});return h(Se,fe,fe),Se},ue.prototype.setDriver=function(fe,xe,Se){var _e=this;Qr(fe)||(fe=[fe]);var Re=this._getSupportedDrivers(fe);function Ue(){_e._config.driver=_e.driver()}function Ke(bt){return _e._extend(bt),Ue(),_e._ready=_e._initStorage(_e._config),_e._ready}function Ge(bt){return function(){var hr=0;function Lr(){for(;hr<bt.length;){var zr=bt[hr];return hr++,_e._dbInfo=null,_e._ready=null,_e.getDriver(zr).then(Ke).catch(Lr)}Ue();var Sn=new Error("No available storage method found.");return _e._driverSet=d.reject(Sn),_e._driverSet}return Lr()}}var nt=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=nt.then(function(){var bt=Re[0];return _e._dbInfo=null,_e._ready=null,_e.getDriver(bt).then(function(hr){_e._driver=hr._driver,Ue(),_e._wrapLibraryMethodsWithReady(),_e._initDriver=Ge(Re)})}).catch(function(){Ue();var bt=new Error("No available storage method found.");return _e._driverSet=d.reject(bt),_e._driverSet}),h(this._driverSet,xe,Se),this._driverSet},ue.prototype.supports=function(fe){return!!rn[fe]},ue.prototype._extend=function(fe){qn(this,fe)},ue.prototype._getSupportedDrivers=function(fe){for(var xe=[],Se=0,_e=fe.length;Se<_e;Se++){var Re=fe[Se];this.supports(Re)&&xe.push(Re)}return xe},ue.prototype._wrapLibraryMethodsWithReady=function(){for(var fe=0,xe=Zt.length;fe<xe;fe++)ti(this,Zt[fe])},ue.prototype.createInstance=function(fe){return new ue(fe)},ue}(),Ji=new nn;n.exports=Ji},{3:3}]},{},[4])(4)})})(_k);var jae=_k.exports;const W3=Bh(jae),xk="HttpClient",$ae=(t={})=>{const e={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...t};return{name:xk,setupOnce(){},setup(r){Yae(r,e),Jae(r,e)}}},Ek=$ae;Va(xk,Ek);function Uae(t,e,r,n){if(Tk(t,r.status,r.url)){const i=Kae(e,n);let a,s,o,u;Ak()&&([{headers:a,cookies:o},{headers:s,cookies:u}]=[{cookieHeader:"Cookie",obj:i},{cookieHeader:"Set-Cookie",obj:r}].map(({cookieHeader:l,obj:d})=>{const f=Vae(d.headers);let h;try{const p=f[l]||f[l.toLowerCase()]||void 0;p&&(h=Sk(p))}catch{ch&&Me.log(`Could not extract cookies from header ${l}`)}return{headers:f,cookies:h}}));const c=Dk({url:i.url,method:i.method,status:r.status,requestHeaders:a,responseHeaders:s,requestCookies:o,responseCookies:u});H0(c)}}function zae(t,e,r,n){if(Tk(t,e.status,e.responseURL)){let i,a,s;if(Ak()){try{const u=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;u&&(a=Sk(u))}catch{ch&&Me.log("Could not extract cookies from response headers")}try{s=Zae(e)}catch{ch&&Me.log("Could not extract headers from response")}i=n}const o=Dk({url:e.responseURL,method:r,status:e.status,requestHeaders:i,responseHeaders:s,responseCookies:a});H0(o)}}function qae(t){if(t){const e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function Sk(t){return t.split("; ").reduce((e,r)=>{const[n,i]=r.split("=");return e[n]=i,e},{})}function Vae(t){const e={};return t.forEach((r,n)=>{e[n]=r}),e}function Zae(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
440
440
  `).reduce((r,n)=>{const[i,a]=n.split(": ");return r[i]=a,r},{}):{}}function Hae(t,e){return t.some(r=>typeof r=="string"?e.includes(r):r.test(e))}function Wae(t,e){return t.some(r=>typeof r=="number"?r===e:e>=r[0]&&e<=r[1])}function Yae(t,e){fM()&&$0(r=>{if(Er()!==t)return;const{response:n,args:i}=r,[a,s]=i;n&&Uae(e,a,n,s)})}function Jae(t,e){"XMLHttpRequest"in br&&z0(r=>{if(Er()!==t)return;const n=r.xhr,i=n[Bs];if(!i)return;const{method:a,request_headers:s}=i;try{zae(e,n,a,s)}catch(o){ch&&Me.warn("Error while extracting response event form XHR response",o)}})}function Tk(t,e,r){return Wae(t.failedRequestStatusCodes,e)&&Hae(t.failedRequestTargets,r)&&!HM(r,Er())}function Dk(t){const e=`HTTP Client Error with status code: ${t.status}`,r={message:e,exception:{values:[{type:"Error",value:e}]},request:{url:t.url,method:t.method,headers:t.requestHeaders,cookies:t.requestCookies},contexts:{response:{status_code:t.status,headers:t.responseHeaders,cookies:t.responseCookies,body_size:qae(t.responseHeaders)}}};return Ku(r,{type:"http.client",handled:!1}),r}function Kae(t,e){return!e&&t instanceof Request||t instanceof Request&&t.bodyUsed?t:new Request(t,e)}function Ak(){const t=Er();return t?!!t.getOptions().sendDefaultPii:!1}function Gae(t){const e={...t};WM(e,"react"),ure(e)}var Nk={exports:{}},Hr={};/** @license React v16.13.1
441
441
  * react-is.production.min.js
442
442
  *
@@ -444,7 +444,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${l} })`),this._initialOptions.errorSamp
444
444
  *
445
445
  * This source code is licensed under the MIT license found in the
446
446
  * LICENSE file in the root directory of this source tree.
447
- */var zn=typeof Symbol=="function"&&Symbol.for,Ax=zn?Symbol.for("react.element"):60103,Nx=zn?Symbol.for("react.portal"):60106,ny=zn?Symbol.for("react.fragment"):60107,iy=zn?Symbol.for("react.strict_mode"):60108,ay=zn?Symbol.for("react.profiler"):60114,sy=zn?Symbol.for("react.provider"):60109,oy=zn?Symbol.for("react.context"):60110,Ix=zn?Symbol.for("react.async_mode"):60111,uy=zn?Symbol.for("react.concurrent_mode"):60111,cy=zn?Symbol.for("react.forward_ref"):60112,ly=zn?Symbol.for("react.suspense"):60113,Xae=zn?Symbol.for("react.suspense_list"):60120,dy=zn?Symbol.for("react.memo"):60115,fy=zn?Symbol.for("react.lazy"):60116,Qae=zn?Symbol.for("react.block"):60121,ese=zn?Symbol.for("react.fundamental"):60117,tse=zn?Symbol.for("react.responder"):60118,rse=zn?Symbol.for("react.scope"):60119;function Wi(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case Ax:switch(t=t.type,t){case Ix:case uy:case ny:case ay:case iy:case ly:return t;default:switch(t=t&&t.$$typeof,t){case oy:case cy:case fy:case dy:case sy:return t;default:return e}}case Nx:return e}}}function Ik(t){return Wi(t)===uy}Hr.AsyncMode=Ix;Hr.ConcurrentMode=uy;Hr.ContextConsumer=oy;Hr.ContextProvider=sy;Hr.Element=Ax;Hr.ForwardRef=cy;Hr.Fragment=ny;Hr.Lazy=fy;Hr.Memo=dy;Hr.Portal=Nx;Hr.Profiler=ay;Hr.StrictMode=iy;Hr.Suspense=ly;Hr.isAsyncMode=function(t){return Ik(t)||Wi(t)===Ix};Hr.isConcurrentMode=Ik;Hr.isContextConsumer=function(t){return Wi(t)===oy};Hr.isContextProvider=function(t){return Wi(t)===sy};Hr.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ax};Hr.isForwardRef=function(t){return Wi(t)===cy};Hr.isFragment=function(t){return Wi(t)===ny};Hr.isLazy=function(t){return Wi(t)===fy};Hr.isMemo=function(t){return Wi(t)===dy};Hr.isPortal=function(t){return Wi(t)===Nx};Hr.isProfiler=function(t){return Wi(t)===ay};Hr.isStrictMode=function(t){return Wi(t)===iy};Hr.isSuspense=function(t){return Wi(t)===ly};Hr.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===ny||t===uy||t===ay||t===iy||t===ly||t===Xae||typeof t=="object"&&t!==null&&(t.$$typeof===fy||t.$$typeof===dy||t.$$typeof===sy||t.$$typeof===oy||t.$$typeof===cy||t.$$typeof===ese||t.$$typeof===tse||t.$$typeof===rse||t.$$typeof===Qae)};Hr.typeOf=Wi;Nk.exports=Hr;var nse=Nk.exports,Ck=nse,ise={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},ase={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ok={};Ok[Ck.ForwardRef]=ise;Ok[Ck.Memo]=ase;function sse(t){const e=Yee({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:n,useNavigationType:i,createRoutesFromChildren:a,matchRoutes:s,stripBasename:o,instrumentPageLoad:u=!0,instrumentNavigation:c=!0}=t;return{...e,afterAllSetup(l){e.afterAllSetup(l);const d=Zr.location&&Zr.location.pathname;u&&d&&c7(l,{name:d,attributes:{[cs]:"url",[Zd]:"pageload",[Eu]:"auto.pageload.react.reactrouter_v6"}})}}}function ose(...t){let e,r;const n=t.findIndex(i=>i instanceof Error);n?(e=t.at(n),r=t.slice(0,n).concat(t.slice(n+1))):t.length===1?e=t:t.length>1&&(e=t[0],r=t.slice(1)),!(e instanceof TypeError&&e.message==="Failed to fetch"&&!navigator.onLine)&&Gh(e,r?{data:r}:void 0)}var ts;class use{constructor(){Ja(this,ts,console);this.log=this.log.bind(this),this.info=this.info.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.debug=this.debug.bind(this),this.trace=this.trace.bind(this)}set logger(e){md(this,ts,e)}log(...e){return Ir(this,ts).log(...e)}info(...e){return Ir(this,ts).info(...e)}warn(...e){return Ir(this,ts).warn(...e)}error(...e){return ose(...e),Ir(this,ts).error(...e)}debug(...e){return Ir(this,ts).debug(...e)}trace(...e){return Ir(this,ts).trace(...e)}}ts=new WeakMap;const Cn=new use;jZ(Cn);var cse=Object.defineProperty,lse=(t,e,r)=>e in t?cse(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dse=(t,e,r)=>lse(t,e+"",r);const fse={id:"makerdao/feedback-issues",name:"Atlas Feedback Issues",extension:".phdm",description:"Provide feedback on the data presented in the Atlas in a decentralized way.",author:{name:"powerhouse",website:"https://powerhouse.inc"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type AtlasFeedbackIssuesState {
447
+ */var Un=typeof Symbol=="function"&&Symbol.for,Ax=Un?Symbol.for("react.element"):60103,Nx=Un?Symbol.for("react.portal"):60106,ny=Un?Symbol.for("react.fragment"):60107,iy=Un?Symbol.for("react.strict_mode"):60108,ay=Un?Symbol.for("react.profiler"):60114,sy=Un?Symbol.for("react.provider"):60109,oy=Un?Symbol.for("react.context"):60110,Ix=Un?Symbol.for("react.async_mode"):60111,uy=Un?Symbol.for("react.concurrent_mode"):60111,cy=Un?Symbol.for("react.forward_ref"):60112,ly=Un?Symbol.for("react.suspense"):60113,Xae=Un?Symbol.for("react.suspense_list"):60120,dy=Un?Symbol.for("react.memo"):60115,fy=Un?Symbol.for("react.lazy"):60116,Qae=Un?Symbol.for("react.block"):60121,ese=Un?Symbol.for("react.fundamental"):60117,tse=Un?Symbol.for("react.responder"):60118,rse=Un?Symbol.for("react.scope"):60119;function Wi(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case Ax:switch(t=t.type,t){case Ix:case uy:case ny:case ay:case iy:case ly:return t;default:switch(t=t&&t.$$typeof,t){case oy:case cy:case fy:case dy:case sy:return t;default:return e}}case Nx:return e}}}function Ik(t){return Wi(t)===uy}Hr.AsyncMode=Ix;Hr.ConcurrentMode=uy;Hr.ContextConsumer=oy;Hr.ContextProvider=sy;Hr.Element=Ax;Hr.ForwardRef=cy;Hr.Fragment=ny;Hr.Lazy=fy;Hr.Memo=dy;Hr.Portal=Nx;Hr.Profiler=ay;Hr.StrictMode=iy;Hr.Suspense=ly;Hr.isAsyncMode=function(t){return Ik(t)||Wi(t)===Ix};Hr.isConcurrentMode=Ik;Hr.isContextConsumer=function(t){return Wi(t)===oy};Hr.isContextProvider=function(t){return Wi(t)===sy};Hr.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ax};Hr.isForwardRef=function(t){return Wi(t)===cy};Hr.isFragment=function(t){return Wi(t)===ny};Hr.isLazy=function(t){return Wi(t)===fy};Hr.isMemo=function(t){return Wi(t)===dy};Hr.isPortal=function(t){return Wi(t)===Nx};Hr.isProfiler=function(t){return Wi(t)===ay};Hr.isStrictMode=function(t){return Wi(t)===iy};Hr.isSuspense=function(t){return Wi(t)===ly};Hr.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===ny||t===uy||t===ay||t===iy||t===ly||t===Xae||typeof t=="object"&&t!==null&&(t.$$typeof===fy||t.$$typeof===dy||t.$$typeof===sy||t.$$typeof===oy||t.$$typeof===cy||t.$$typeof===ese||t.$$typeof===tse||t.$$typeof===rse||t.$$typeof===Qae)};Hr.typeOf=Wi;Nk.exports=Hr;var nse=Nk.exports,Ck=nse,ise={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},ase={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ok={};Ok[Ck.ForwardRef]=ise;Ok[Ck.Memo]=ase;function sse(t){const e=Yee({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:n,useNavigationType:i,createRoutesFromChildren:a,matchRoutes:s,stripBasename:o,instrumentPageLoad:u=!0,instrumentNavigation:c=!0}=t;return{...e,afterAllSetup(l){e.afterAllSetup(l);const d=Zr.location&&Zr.location.pathname;u&&d&&c7(l,{name:d,attributes:{[cs]:"url",[Zd]:"pageload",[Eu]:"auto.pageload.react.reactrouter_v6"}})}}}function ose(...t){let e,r;const n=t.findIndex(i=>i instanceof Error);n?(e=t.at(n),r=t.slice(0,n).concat(t.slice(n+1))):t.length===1?e=t:t.length>1&&(e=t[0],r=t.slice(1)),!(e instanceof TypeError&&e.message==="Failed to fetch"&&!navigator.onLine)&&Gh(e,r?{data:r}:void 0)}var ts;class use{constructor(){Ja(this,ts,console);this.log=this.log.bind(this),this.info=this.info.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.debug=this.debug.bind(this),this.trace=this.trace.bind(this)}set logger(e){md(this,ts,e)}log(...e){return Ir(this,ts).log(...e)}info(...e){return Ir(this,ts).info(...e)}warn(...e){return Ir(this,ts).warn(...e)}error(...e){return ose(...e),Ir(this,ts).error(...e)}debug(...e){return Ir(this,ts).debug(...e)}trace(...e){return Ir(this,ts).trace(...e)}}ts=new WeakMap;const Cn=new use;jZ(Cn);var cse=Object.defineProperty,lse=(t,e,r)=>e in t?cse(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dse=(t,e,r)=>lse(t,e+"",r);const fse={id:"makerdao/feedback-issues",name:"Atlas Feedback Issues",extension:".phdm",description:"Provide feedback on the data presented in the Atlas in a decentralized way.",author:{name:"powerhouse",website:"https://powerhouse.inc"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type AtlasFeedbackIssuesState {
448
448
  """
449
449
  The list of issues submitted to the Atlas.
450
450
  """
@@ -1043,13 +1043,13 @@ spvId: ID! # Spv.id
1043
1043
  }`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"sVzG0QHIjUwD4IffaZ+47riwIVM=",name:"DELETE_GROUP_TRANSACTION",description:"",schema:`input DeleteGroupTransactionInput {
1044
1044
  id: ID!
1045
1045
  }
1046
- `,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]},Fue=t=>t!=null;X.any().refine(t=>Fue(t));const IF=X.enum(["Cash","FixedIncome"]),CF=X.enum(["AssetPurchase","AssetSale","FeesIncome","FeesPayment","InterestIncome","InterestPayment","PrincipalDraw","PrincipalReturn"]);function OF(){return X.object({fees:X.array(tP()).nullish(),id:X.string()})}function e6(){return X.object({__typename:X.literal("BaseTransaction").optional(),accountId:X.string().nullable(),amount:X.number(),assetId:X.string(),assetType:IF,counterPartyAccountId:X.string().nullable(),entryTime:X.string().datetime(),id:X.string(),settlementTime:X.string().datetime().nullable(),tradeTime:X.string().datetime().nullable()})}function t6(){return X.object({accountId:X.string().nullish(),amount:X.number().nullish(),assetId:X.string().nullish(),assetType:IF.nullish(),counterPartyAccountId:X.string().nullish(),entryTime:X.string().datetime().nullish(),id:X.string(),settlementTime:X.string().datetime().nullish(),tradeTime:X.string().datetime().nullish()})}function MF(){return X.object({id:X.string(),label:X.string().nullish(),reference:X.string()})}function kF(){return X.object({balance:X.number(),currency:X.string(),id:X.string(),spvId:X.string()})}function RF(){return X.object({CUSIP:X.string().nullish(),ISIN:X.string().nullish(),coupon:X.number().nullish(),fixedIncomeTypeId:X.string(),id:X.string(),maturity:X.string().datetime().nullish(),name:X.string(),spvId:X.string()})}function FF(){return X.object({id:X.string(),name:X.string()})}function PF(){return X.object({cashTransaction:e6(),entryTime:X.string().datetime(),fees:X.array(tP()).nullish(),fixedIncomeTransaction:e6().nullish(),id:X.string(),serviceProviderFeeTypeId:X.string().nullish(),txRef:X.string().nullish(),type:CF})}function BF(){return X.object({accountId:X.string(),feeType:X.string(),id:X.string(),name:X.string()})}function LF(){return X.object({id:X.string(),name:X.string()})}function jF(){return X.object({id:X.string()})}function $F(){return X.object({id:X.string()})}function UF(){return X.object({id:X.string()})}function zF(){return X.object({id:X.string()})}function qF(){return X.object({id:X.string()})}function VF(){return X.object({id:X.string()})}function ZF(){return X.object({id:X.string()})}function HF(){return X.object({id:X.string(),label:X.string().nullish(),reference:X.string().nullish()})}function WF(){return X.object({currency:X.string().nullish(),id:X.string(),spvId:X.string().nullish()})}function YF(){return X.object({CUSIP:X.string().nullish(),ISIN:X.string().nullish(),coupon:X.number().nullish(),fixedIncomeTypeId:X.string().nullish(),id:X.string(),maturity:X.string().datetime().nullish(),name:X.string().nullish(),spvId:X.string().nullish()})}function JF(){return X.object({id:X.string(),name:X.string().nullish()})}function KF(){return X.object({fees:X.array(X.lazy(()=>Pue())).nullish(),id:X.string()})}function GF(){return X.object({cashTransaction:X.lazy(()=>t6().nullish()),entryTime:X.string().datetime().nullish(),fixedIncomeTransaction:X.lazy(()=>t6().nullish()),id:X.string(),serviceProviderFeeTypeId:X.string().nullish(),txRef:X.string().nullish(),type:CF.nullish()})}function XF(){return X.object({accountId:X.string().nullish(),feeType:X.string().nullish(),id:X.string(),name:X.string().nullish()})}function QF(){return X.object({id:X.string(),name:X.string().nullish()})}function Pue(){return X.object({amount:X.number().nullish(),id:X.string().nullish(),serviceProviderFeeTypeId:X.string().nullish()})}function eP(){return X.object({feeIds:X.array(X.string()).nullish(),id:X.string()})}function tP(){return X.object({__typename:X.literal("TransactionFee").optional(),amount:X.number(),id:X.string(),serviceProviderFeeTypeId:X.string()})}const Es={createSpvOperation(t,e,r){if(!e.input.id)throw new Error("SPV must have an id");if(!e.input.name)throw new Error("SPV must have a name");if(t.spvs.find(n=>n.id===e.input.id))throw new Error(`SPV with id ${e.input.id} already exists!`);t.spvs.push(e.input)},editSpvOperation(t,e,r){if(!e.input.id)throw new Error("SPV must have an id");if(!t.spvs.find(n=>n.id===e.input.id))throw new Error(`SPV with id ${e.input.id} does not exist!`);t.spvs=t.spvs.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteSpvOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("SPV must have an id");if(!t.spvs.find(i=>i.id===n))throw new Error(`SPV with id ${n} does not exist!`);if(t.portfolio.filter(i=>i.spvId===n).length!==0)throw new Error("Cannot delete SPV because it has assets that depend on it. Please change or delete those assets first.");t.spvs=t.spvs.filter(i=>i.id!==n)},createServiceProviderFeeTypeOperation(t,e,r){if(!e.input.id)throw new Error("Service provider must have an id");if(!e.input.name)throw new Error("Service provider must have a name");if(!e.input.feeType)throw new Error("Service provider must have a fee type");if(!e.input.accountId)throw new Error("Service provider must have an associated account id");if(!t.accounts.find(n=>n.id===e.input.accountId))throw new Error(`Account with id ${e.input.accountId} does not exist!`);if(t.serviceProviderFeeTypes.find(n=>n.id===e.input.id))throw new Error(`Service provider with id ${e.input.id} already exists!`);t.serviceProviderFeeTypes.push(e.input)},editServiceProviderFeeTypeOperation(t,e,r){if(!e.input.id)throw new Error("Service provider must have an id");if(!t.serviceProviderFeeTypes.find(n=>n.id===e.input.id))throw new Error(`Service provider with id ${e.input.id} does not exist!`);if(e.input.accountId&&!t.accounts.find(n=>n.id===e.input.accountId))throw new Error(`Account with id ${e.input.accountId} does not exist!`);t.serviceProviderFeeTypes=t.serviceProviderFeeTypes.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteServiceProviderFeeTypeOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("Service provider fee type must have an id");if(!t.serviceProviderFeeTypes.find(i=>i.id===n))throw new Error(`Service provider with id ${n} does not exist!`);if(t.transactions.filter(i=>{var a;return(a=i.fees)==null?void 0:a.some(s=>s.serviceProviderFeeTypeId===n)}).length!==0)throw new Error("Cannot delete service provider fee type because it has transactions that depend on it. Please change or delete those transactions first.");t.serviceProviderFeeTypes=t.serviceProviderFeeTypes.filter(i=>i.id!==n)},createAccountOperation(t,e,r){if(!e.input.id)throw new Error("Account must have an id");if(!e.input.reference)throw new Error("Account must have a reference");if(t.accounts.find(n=>n.id===e.input.id))throw new Error(`Account with id ${e.input.id} already exists!`);t.accounts.push(e.input)},editAccountOperation(t,e,r){if(!e.input.id)throw new Error("Account must have an id");if(!t.accounts.find(n=>n.id===e.input.id))throw new Error(`Account with id ${e.input.id} does not exist!`);t.accounts=t.accounts.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteAccountOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("Account must have an id");if(n===t.principalLenderAccountId)throw new Error("Cannot delete principal lender account.");if(!t.accounts.find(i=>i.id===n))throw new Error(`Account with id ${n} does not exist!`);if(t.serviceProviderFeeTypes.filter(i=>i.accountId===n).length!==0)throw new Error("Cannot delete account because it has service provider fee types that depend on it. Please change or delete those service provider fee types first.");if(t.transactions.filter(i=>{var a;return((a=i.fixedIncomeTransaction)==null?void 0:a.accountId)===n||i.cashTransaction.accountId===n}).length!==0)throw new Error("Cannot delete account because it has transactions that depend on it. Please change or delete those transactions first.");t.accounts=t.accounts.filter(i=>i.id!==n)}};function ai(){return ai=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ai.apply(null,arguments)}var rP={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function yi(t,e){if(Xg(t,e))return t[e];throw typeof t[e]=="function"&&jx(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Fl(t,e,r){if(Xg(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Xg(t,e){return!Lue(t)&&!Array.isArray(t)?!1:ut(jue,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Bue(t,e){if(!jx(t,e))throw new Error('No access to method "'+e+'"');return t[e]}function jx(t,e){return t==null||typeof t[e]!="function"||ut(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:ut($ue,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Lue(t){return typeof t=="object"&&t&&t.constructor===Object}var jue={length:!0,name:!0},$ue={toString:!0,valueOf:!0,toLocaleString:!0};class by{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return yi(this.wrappedObject,e)}set(e,r){return Fl(this.wrappedObject,e,r),this}has(e){return Xg(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return iP(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){Xg(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class nP{constructor(e,r,n){this.a=e,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return iP(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function iP(t,e){return{next:()=>{var r=t.next();return r.done?r:{value:e(r.value),done:!1}}}}function Th(){return new Map}function cl(t){if(!t)return Th();if(ku(t))return t;if(nd(t))return new by(t);throw new Error("createMap can create maps from objects or Maps")}function Uue(t){if(t instanceof by)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);Fl(e,r,n)}return e}function Ht(t){return typeof t=="number"}function Vt(t){return!t||typeof t!="object"||typeof t.constructor!="function"?!1:t.isBigNumber===!0&&typeof t.constructor.prototype=="object"&&t.constructor.prototype.isBigNumber===!0||typeof t.constructor.isDecimal=="function"&&t.constructor.isDecimal(t)===!0}function aP(t){return typeof t=="bigint"}function Pa(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function fc(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function Ai(t){return t&&t.constructor.prototype.isUnit===!0||!1}function si(t){return typeof t=="string"}var kr=Array.isArray;function Dt(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function Zi(t){return Array.isArray(t)||Dt(t)}function Dh(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function To(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function wy(t){return t&&t.constructor.prototype.isRange===!0||!1}function op(t){return t&&t.constructor.prototype.isIndex===!0||!1}function sP(t){return typeof t=="boolean"}function oP(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function $x(t){return t&&t.constructor.prototype.isHelp===!0||!1}function uP(t){return typeof t=="function"}function cP(t){return t instanceof Date}function lP(t){return t instanceof RegExp}function nd(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!Pa(t)&&!fc(t))}function ku(t){return t?t instanceof Map||t instanceof by||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function zue(t){return ku(t)&&ku(t.a)&&ku(t.b)}function que(t){return ku(t)&&nd(t.wrappedObject)}function dP(t){return t===null}function fP(t){return t===void 0}function Wo(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function Pi(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function hP(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function pP(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function mP(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function pr(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gw(t){return pr(t)||yn(t)&&t.args.length===1&&pr(t.args[0])&&"-+~".includes(t.op)}function id(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Qs(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function hc(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function Rr(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function up(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function yn(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function gs(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function gP(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function yP(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function On(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ux(t){return t&&t.constructor.prototype.isChain===!0||!1}function Gr(t){var e=typeof t;return e==="object"?t===null?"null":Vt(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function Ct(t){var e=typeof t;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||t===null||t===void 0)return t;if(typeof t.clone=="function")return t.clone();if(Array.isArray(t))return t.map(function(r){return Ct(r)});if(t instanceof Date)return new Date(t.valueOf());if(Vt(t))return t;if(nd(t))return Vue(t,Ct);if(e==="function")return t;throw new TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function Vue(t,e){var r={};for(var n in t)ut(t,n)&&(r[n]=e(t[n]));return r}function vP(t,e){for(var r in e)ut(e,r)&&(t[r]=e[r]);return t}function bP(t,e){if(Array.isArray(e))throw new TypeError("Arrays are not supported by deepExtend");for(var r in e)if(ut(e,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(e[r]&&e[r].constructor===Object)t[r]===void 0&&(t[r]={}),t[r]&&t[r].constructor===Object?bP(t[r],e[r]):t[r]=e[r];else{if(Array.isArray(e[r]))throw new TypeError("Arrays are not supported by deepExtend");t[r]=e[r]}return t}function eo(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!eo(t[n],e[n]))return!1;return!0}else{if(typeof t=="function")return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!eo(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function Zue(t){var e={};return wP(t,e),e}function wP(t,e){for(var r in t)if(ut(t,r)){var n=t[r];typeof n=="object"&&n!==null?wP(n,e):e[r]=n}}function $m(t,e,r){var n=!0,i;Object.defineProperty(t,e,{get:function(){return n&&(i=r(),n=!1),i},set:function(a){i=a,n=!1},configurable:!0,enumerable:!0})}function ut(t,e){return t&&Object.hasOwnProperty.call(t,e)}function Hue(t){return t&&typeof t.factory=="function"}function Wue(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=t[i];a!==void 0&&(r[i]=a)}return r}var r6=["Matrix","Array"],n6=["number","BigNumber","Fraction"];function Yue(t,e){function r(n){if(n){if(n.epsilon!==void 0){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');var i=Ct(n);return i.relTol=n.epsilon,i.absTol=n.epsilon*.001,delete i.epsilon,r(i)}var a=Ct(t);i6(n,"matrix",r6),i6(n,"number",n6),bP(t,n);var s=Ct(t),o=Ct(n);return e("config",s,a,o),s}else return Ct(t)}return r.MATRIX_OPTIONS=r6,r.NUMBER_OPTIONS=n6,Object.keys(rP).forEach(n=>{Object.defineProperty(r,n,{get:()=>t[n],enumerable:!0,configurable:!0})}),r}function i6(t,e,r){t[e]!==void 0&&!r.includes(t[e])&&console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+r.map(n=>JSON.stringify(n)).join(", ")+".")}function a6(){return!0}function Xi(){return!1}function _c(){}const s6="Argument is not a typed-function.";function _P(){function t(Y){return typeof Y=="object"&&Y!==null&&Y.constructor===Object}const e=[{name:"number",test:function(Y){return typeof Y=="number"}},{name:"string",test:function(Y){return typeof Y=="string"}},{name:"boolean",test:function(Y){return typeof Y=="boolean"}},{name:"Function",test:function(Y){return typeof Y=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(Y){return Y instanceof Date}},{name:"RegExp",test:function(Y){return Y instanceof RegExp}},{name:"Object",test:t},{name:"null",test:function(Y){return Y===null}},{name:"undefined",test:function(Y){return Y===void 0}}],r={name:"any",test:a6,isAny:!0};let n,i,a=0,s={createCount:0};function o(Y){const re=n.get(Y);if(re)return re;let ce='Unknown type "'+Y+'"';const de=Y.toLowerCase();let ve;for(ve of i)if(ve.toLowerCase()===de){ce+='. Did you mean "'+ve+'" ?';break}throw new TypeError(ce)}function u(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const ce=re?o(re).index:i.length,de=[];for(let we=0;we<Y.length;++we){if(!Y[we]||typeof Y[we].name!="string"||typeof Y[we].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const Ae=Y[we].name;if(n.has(Ae))throw new TypeError('Duplicate type name "'+Ae+'"');de.push(Ae),n.set(Ae,{name:Ae,test:Y[we].test,isAny:Y[we].isAny,index:ce+we,conversionsTo:[]})}const ve=i.slice(ce);i=i.slice(0,ce).concat(de).concat(ve);for(let we=ce+de.length;we<i.length;++we)n.get(i[we]).index=we}function c(){n=new Map,i=[],a=0,u([r],!1)}c(),u(e);function l(){let Y;for(Y of i)n.get(Y).conversionsTo=[];a=0}function d(Y){const re=i.filter(ce=>{const de=n.get(ce);return!de.isAny&&de.test(Y)});return re.length?re:["any"]}function f(Y){return Y&&typeof Y=="function"&&"_typedFunctionData"in Y}function h(Y,re,ce){if(!f(Y))throw new TypeError(s6);const de=ce&&ce.exact,ve=Array.isArray(re)?re.join(","):re,we=x(ve),Ae=y(we);if(!de||Ae in Y.signatures){const Qe=Y._typedFunctionData.signatureMap.get(Ae);if(Qe)return Qe}const Ne=we.length;let Pe;if(de){Pe=[];let Qe;for(Qe in Y.signatures)Pe.push(Y._typedFunctionData.signatureMap.get(Qe))}else Pe=Y._typedFunctionData.signatures;for(let Qe=0;Qe<Ne;++Qe){const ft=we[Qe],$e=[];let Et;for(Et of Pe){const H=F(Et.params,Qe);if(!(!H||ft.restParam&&!H.restParam)){if(!H.hasAny){const pe=w(H);if(ft.types.some(Ee=>!pe.has(Ee.name)))continue}$e.push(Et)}}if(Pe=$e,Pe.length===0)break}let Ce;for(Ce of Pe)if(Ce.params.length<=Ne)return Ce;throw new TypeError("Signature not found (signature: "+(Y.name||"unnamed")+"("+y(we,", ")+"))")}function p(Y,re,ce){return h(Y,re,ce).implementation}function m(Y,re){const ce=o(re);if(ce.test(Y))return Y;const de=ce.conversionsTo;if(de.length===0)throw new Error("There are no conversions to "+re+" defined.");for(let ve=0;ve<de.length;ve++)if(o(de[ve].from).test(Y))return de[ve].convert(Y);throw new Error("Cannot convert "+Y+" to "+re)}function y(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return Y.map(ce=>ce.name).join(re)}function g(Y){const re=Y.indexOf("...")===0,ce=(re?Y.length>3?Y.slice(3):"any":Y).split("|").map(we=>o(we.trim()));let de=!1,ve=re?"...":"";return{types:ce.map(function(we){return de=we.isAny||de,ve+=we.name+"|",{name:we.name,typeIndex:we.index,test:we.test,isAny:we.isAny,conversion:null,conversionIndex:-1}}),name:ve.slice(0,-1),hasAny:de,hasConversion:!1,restParam:re}}function v(Y){const re=Y.types.map(Ae=>Ae.name),ce=I(re);let de=Y.hasAny,ve=Y.name;const we=ce.map(function(Ae){const Ne=o(Ae.from);return de=Ne.isAny||de,ve+="|"+Ae.from,{name:Ae.from,typeIndex:Ne.index,test:Ne.test,isAny:Ne.isAny,conversion:Ae,conversionIndex:Ae.index}});return{types:Y.types.concat(we),name:ve,hasAny:de,hasConversion:we.length>0,restParam:Y.restParam}}function w(Y){return Y.typeSet||(Y.typeSet=new Set,Y.types.forEach(re=>Y.typeSet.add(re.name))),Y.typeSet}function x(Y){const re=[];if(typeof Y!="string")throw new TypeError("Signatures must be strings");const ce=Y.trim();if(ce==="")return re;const de=ce.split(",");for(let ve=0;ve<de.length;++ve){const we=g(de[ve].trim());if(we.restParam&&ve!==de.length-1)throw new SyntaxError('Unexpected rest parameter "'+de[ve]+'": only allowed for the last parameter');if(we.types.length===0)return null;re.push(we)}return re}function _(Y){const re=Q(Y);return re?re.restParam:!1}function A(Y){if(!Y||Y.types.length===0)return a6;if(Y.types.length===1)return o(Y.types[0].name).test;if(Y.types.length===2){const re=o(Y.types[0].name).test,ce=o(Y.types[1].name).test;return function(de){return re(de)||ce(de)}}else{const re=Y.types.map(function(ce){return o(ce.name).test});return function(ce){for(let de=0;de<re.length;de++)if(re[de](ce))return!0;return!1}}}function M(Y){let re,ce,de;if(_(Y)){re=V(Y).map(A);const ve=re.length,we=A(Q(Y)),Ae=function(Ne){for(let Pe=ve;Pe<Ne.length;Pe++)if(!we(Ne[Pe]))return!1;return!0};return function(Ne){for(let Pe=0;Pe<re.length;Pe++)if(!re[Pe](Ne[Pe]))return!1;return Ae(Ne)&&Ne.length>=ve+1}}else return Y.length===0?function(ve){return ve.length===0}:Y.length===1?(ce=A(Y[0]),function(ve){return ce(ve[0])&&ve.length===1}):Y.length===2?(ce=A(Y[0]),de=A(Y[1]),function(ve){return ce(ve[0])&&de(ve[1])&&ve.length===2}):(re=Y.map(A),function(ve){for(let we=0;we<re.length;we++)if(!re[we](ve[we]))return!1;return ve.length===re.length})}function F(Y,re){return re<Y.length?Y[re]:_(Y)?Q(Y):null}function k(Y,re){const ce=F(Y,re);return ce?w(ce):new Set}function $(Y){return Y.conversion===null||Y.conversion===void 0}function T(Y,re){const ce=new Set;return Y.forEach(de=>{const ve=k(de.params,re);let we;for(we of ve)ce.add(we)}),ce.has("any")?["any"]:Array.from(ce)}function N(Y,re,ce){let de,ve;const we=Y||"unnamed";let Ae=ce,Ne;for(Ne=0;Ne<re.length;Ne++){const ft=[];if(Ae.forEach($e=>{const Et=F($e.params,Ne),H=A(Et);(Ne<$e.params.length||_($e.params))&&H(re[Ne])&&ft.push($e)}),ft.length===0){if(ve=T(Ae,Ne),ve.length>0){const $e=d(re[Ne]);return de=new TypeError("Unexpected type of argument in function "+we+" (expected: "+ve.join(" or ")+", actual: "+$e.join(" | ")+", index: "+Ne+")"),de.data={category:"wrongType",fn:we,index:Ne,actual:$e,expected:ve},de}}else Ae=ft}const Pe=Ae.map(function(ft){return _(ft.params)?1/0:ft.params.length});if(re.length<Math.min.apply(null,Pe))return ve=T(Ae,Ne),de=new TypeError("Too few arguments in function "+we+" (expected: "+ve.join(" or ")+", index: "+re.length+")"),de.data={category:"tooFewArgs",fn:we,index:re.length,expected:ve},de;const Ce=Math.max.apply(null,Pe);if(re.length>Ce)return de=new TypeError("Too many arguments in function "+we+" (expected: "+Ce+", actual: "+re.length+")"),de.data={category:"tooManyArgs",fn:we,index:re.length,expectedLength:Ce},de;const Qe=[];for(let ft=0;ft<re.length;++ft)Qe.push(d(re[ft]).join("|"));return de=new TypeError('Arguments of type "'+Qe.join(", ")+'" do not match any of the defined signatures of function '+we+"."),de.data={category:"mismatch",actual:Qe},de}function b(Y){let re=i.length+1;for(let ce=0;ce<Y.types.length;ce++)$(Y.types[ce])&&(re=Math.min(re,Y.types[ce].typeIndex));return re}function E(Y){let re=a+1;for(let ce=0;ce<Y.types.length;ce++)$(Y.types[ce])||(re=Math.min(re,Y.types[ce].conversionIndex));return re}function D(Y,re){if(Y.hasAny){if(!re.hasAny)return 1}else if(re.hasAny)return-1;if(Y.restParam){if(!re.restParam)return 1}else if(re.restParam)return-1;if(Y.hasConversion){if(!re.hasConversion)return 1}else if(re.hasConversion)return-1;const ce=b(Y)-b(re);if(ce<0)return-1;if(ce>0)return 1;const de=E(Y)-E(re);return de<0?-1:de>0?1:0}function C(Y,re){const ce=Y.params,de=re.params,ve=Q(ce),we=Q(de),Ae=_(ce),Ne=_(de);if(Ae&&ve.hasAny){if(!Ne||!we.hasAny)return 1}else if(Ne&&we.hasAny)return-1;let Pe=0,Ce=0,Qe;for(Qe of ce)Qe.hasAny&&++Pe,Qe.hasConversion&&++Ce;let ft=0,$e=0;for(Qe of de)Qe.hasAny&&++ft,Qe.hasConversion&&++$e;if(Pe!==ft)return Pe-ft;if(Ae&&ve.hasConversion){if(!Ne||!we.hasConversion)return 1}else if(Ne&&we.hasConversion)return-1;if(Ce!==$e)return Ce-$e;if(Ae){if(!Ne)return 1}else if(Ne)return-1;const Et=(ce.length-de.length)*(Ae?-1:1);if(Et!==0)return Et;const H=[];let pe=0;for(let Oe=0;Oe<ce.length;++Oe){const je=D(ce[Oe],de[Oe]);H.push(je),pe+=je}if(pe!==0)return pe;let Ee;for(Ee of H)if(Ee!==0)return Ee;return 0}function I(Y){if(Y.length===0)return[];const re=Y.map(o);Y.length>1&&re.sort((ve,we)=>ve.index-we.index);let ce=re[0].conversionsTo;if(Y.length===1)return ce;ce=ce.concat([]);const de=new Set(Y);for(let ve=1;ve<re.length;++ve){let we;for(we of re[ve].conversionsTo)de.has(we.from)||(ce.push(we),de.add(we.from))}return ce}function O(Y,re){let ce=re;if(Y.some(ve=>ve.hasConversion)){const ve=_(Y),we=Y.map(S);ce=function(){const Ae=[],Ne=ve?arguments.length-1:arguments.length;for(let Pe=0;Pe<Ne;Pe++)Ae[Pe]=we[Pe](arguments[Pe]);return ve&&(Ae[Ne]=arguments[Ne].map(we[Ne])),re.apply(this,Ae)}}let de=ce;if(_(Y)){const ve=Y.length-1;de=function(){return ce.apply(this,ae(arguments,0,ve).concat([ae(arguments,ve)]))}}return de}function S(Y){let re,ce,de,ve;const we=[],Ae=[];switch(Y.types.forEach(function(Ne){Ne.conversion&&(we.push(o(Ne.conversion.from).test),Ae.push(Ne.conversion.convert))}),Ae.length){case 0:return function(Ne){return Ne};case 1:return re=we[0],de=Ae[0],function(Ne){return re(Ne)?de(Ne):Ne};case 2:return re=we[0],ce=we[1],de=Ae[0],ve=Ae[1],function(Ne){return re(Ne)?de(Ne):ce(Ne)?ve(Ne):Ne};default:return function(Ne){for(let Pe=0;Pe<Ae.length;Pe++)if(we[Pe](Ne))return Ae[Pe](Ne);return Ne}}}function P(Y){function re(ce,de,ve){if(de<ce.length){const we=ce[de];let Ae=[];if(we.restParam){const Ne=we.types.filter($);Ne.length<we.types.length&&Ae.push({types:Ne,name:"..."+Ne.map(Pe=>Pe.name).join("|"),hasAny:Ne.some(Pe=>Pe.isAny),hasConversion:!1,restParam:!0}),Ae.push(we)}else Ae=we.types.map(function(Ne){return{types:[Ne],name:Ne.name,hasAny:Ne.isAny,hasConversion:Ne.conversion,restParam:!1}});return le(Ae,function(Ne){return re(ce,de+1,ve.concat([Ne]))})}else return[ve]}return re(Y,0,[])}function R(Y,re){const ce=Math.max(Y.length,re.length);for(let Ne=0;Ne<ce;Ne++){const Pe=k(Y,Ne),Ce=k(re,Ne);let Qe=!1,ft;for(ft of Ce)if(Pe.has(ft)){Qe=!0;break}if(!Qe)return!1}const de=Y.length,ve=re.length,we=_(Y),Ae=_(re);return we?Ae?de===ve:ve>=de:Ae?de>=ve:de===ve}function L(Y){return Y.map(re=>j(re)?K(re.referToSelf.callback):B(re)?Z(re.referTo.references,re.referTo.callback):re)}function q(Y,re,ce){const de=[];let ve;for(ve of Y){let we=ce[ve];if(typeof we!="number")throw new TypeError('No definition for referenced signature "'+ve+'"');if(we=re[we],typeof we!="function")return!1;de.push(we)}return de}function J(Y,re,ce){const de=L(Y),ve=new Array(de.length).fill(!1);let we=!0;for(;we;){we=!1;let Ae=!0;for(let Ne=0;Ne<de.length;++Ne){if(ve[Ne])continue;const Pe=de[Ne];if(j(Pe))de[Ne]=Pe.referToSelf.callback(ce),de[Ne].referToSelf=Pe.referToSelf,ve[Ne]=!0,Ae=!1;else if(B(Pe)){const Ce=q(Pe.referTo.references,de,re);Ce?(de[Ne]=Pe.referTo.callback.apply(this,Ce),de[Ne].referTo=Pe.referTo,ve[Ne]=!0,Ae=!1):we=!0}}if(Ae&&we)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return de}function G(Y){const re=/\bthis(\(|\.signatures\b)/;Object.keys(Y).forEach(ce=>{const de=Y[ce];if(re.test(de.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function ie(Y,re){if(s.createCount++,Object.keys(re).length===0)throw new SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&G(re);const ce=[],de=[],ve={},we=[];let Ae;for(Ae in re){if(!Object.prototype.hasOwnProperty.call(re,Ae))continue;const kt=x(Ae);if(!kt)continue;ce.forEach(function(fn){if(R(fn,kt))throw new TypeError('Conflicting signatures "'+y(fn)+'" and "'+y(kt)+'".')}),ce.push(kt);const rn=de.length;de.push(re[Ae]);const un=kt.map(v);let Dn;for(Dn of P(un)){const fn=y(Dn);we.push({params:Dn,name:fn,fn:rn}),Dn.every(Zt=>!Zt.hasConversion)&&(ve[fn]=rn)}}we.sort(C);const Ne=J(de,ve,Qr);let Pe;for(Pe in ve)Object.prototype.hasOwnProperty.call(ve,Pe)&&(ve[Pe]=Ne[ve[Pe]]);const Ce=[],Qe=new Map;for(Pe of we)Qe.has(Pe.name)||(Pe.fn=Ne[Pe.fn],Ce.push(Pe),Qe.set(Pe.name,Pe));const ft=Ce[0]&&Ce[0].params.length<=2&&!_(Ce[0].params),$e=Ce[1]&&Ce[1].params.length<=2&&!_(Ce[1].params),Et=Ce[2]&&Ce[2].params.length<=2&&!_(Ce[2].params),H=Ce[3]&&Ce[3].params.length<=2&&!_(Ce[3].params),pe=Ce[4]&&Ce[4].params.length<=2&&!_(Ce[4].params),Ee=Ce[5]&&Ce[5].params.length<=2&&!_(Ce[5].params),Oe=ft&&$e&&Et&&H&&pe&&Ee;for(let kt=0;kt<Ce.length;++kt)Ce[kt].test=M(Ce[kt].params);const je=ft?A(Ce[0].params[0]):Xi,it=$e?A(Ce[1].params[0]):Xi,jt=Et?A(Ce[2].params[0]):Xi,Ft=H?A(Ce[3].params[0]):Xi,Br=pe?A(Ce[4].params[0]):Xi,Or=Ee?A(Ce[5].params[0]):Xi,Mt=ft?A(Ce[0].params[1]):Xi,jr=$e?A(Ce[1].params[1]):Xi,$r=Et?A(Ce[2].params[1]):Xi,me=H?A(Ce[3].params[1]):Xi,be=pe?A(Ce[4].params[1]):Xi,De=Ee?A(Ce[5].params[1]):Xi;for(let kt=0;kt<Ce.length;++kt)Ce[kt].implementation=O(Ce[kt].params,Ce[kt].fn);const Ie=ft?Ce[0].implementation:_c,Ze=$e?Ce[1].implementation:_c,tt=Et?Ce[2].implementation:_c,Ye=H?Ce[3].implementation:_c,We=pe?Ce[4].implementation:_c,Je=Ee?Ce[5].implementation:_c,Be=ft?Ce[0].params.length:-1,rt=$e?Ce[1].params.length:-1,ht=Et?Ce[2].params.length:-1,gt=H?Ce[3].params.length:-1,Ur=pe?Ce[4].params.length:-1,fr=Ee?Ce[5].params.length:-1,Jt=Oe?6:0,Sr=Ce.length,Fn=Ce.map(kt=>kt.test),qn=Ce.map(kt=>kt.implementation),bn=function(){for(let kt=Jt;kt<Sr;kt++)if(Fn[kt](arguments))return qn[kt].apply(this,arguments);return s.onMismatch(Y,arguments,Ce)};function Qr(kt,rn){return arguments.length===Be&&je(kt)&&Mt(rn)?Ie.apply(this,arguments):arguments.length===rt&&it(kt)&&jr(rn)?Ze.apply(this,arguments):arguments.length===ht&&jt(kt)&&$r(rn)?tt.apply(this,arguments):arguments.length===gt&&Ft(kt)&&me(rn)?Ye.apply(this,arguments):arguments.length===Ur&&Br(kt)&&be(rn)?We.apply(this,arguments):arguments.length===fr&&Or(kt)&&De(rn)?Je.apply(this,arguments):bn.apply(this,arguments)}try{Object.defineProperty(Qr,"name",{value:Y})}catch{}return Qr.signatures=ve,Qr._typedFunctionData={signatures:Ce,signatureMap:Qe},Qr}function z(Y,re,ce){throw N(Y,re,ce)}function V(Y){return ae(Y,0,Y.length-1)}function Q(Y){return Y[Y.length-1]}function ae(Y,re,ce){return Array.prototype.slice.call(Y,re,ce)}function oe(Y,re){for(let ce=0;ce<Y.length;ce++)if(re(Y[ce]))return Y[ce]}function le(Y,re){return Array.prototype.concat.apply([],Y.map(re))}function he(){const Y=V(arguments).map(ce=>y(x(ce))),re=Q(arguments);if(typeof re!="function")throw new TypeError("Callback function expected as last argument");return Z(Y,re)}function Z(Y,re){return{referTo:{references:Y,callback:re}}}function K(Y){if(typeof Y!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:Y}}}function B(Y){return Y&&typeof Y.referTo=="object"&&Array.isArray(Y.referTo.references)&&typeof Y.referTo.callback=="function"}function j(Y){return Y&&typeof Y.referToSelf=="object"&&typeof Y.referToSelf.callback=="function"}function U(Y,re){if(!Y)return re;if(re&&re!==Y){const ce=new Error("Function names do not match (expected: "+Y+", actual: "+re+")");throw ce.data={actual:re,expected:Y},ce}return Y}function W(Y){let re;for(const ce in Y)Object.prototype.hasOwnProperty.call(Y,ce)&&(f(Y[ce])||typeof Y[ce].signature=="string")&&(re=U(re,Y[ce].name));return re}function ee(Y,re){let ce;for(ce in re)if(Object.prototype.hasOwnProperty.call(re,ce)){if(ce in Y&&re[ce]!==Y[ce]){const de=new Error('Signature "'+ce+'" is defined twice');throw de.data={signature:ce,sourceFunction:re[ce],destFunction:Y[ce]},de}Y[ce]=re[ce]}}const te=s;s=function(Y){const re=typeof Y=="string",ce=re?1:0;let de=re?Y:"";const ve={};for(let we=ce;we<arguments.length;++we){const Ae=arguments[we];let Ne={},Pe;if(typeof Ae=="function"?(Pe=Ae.name,typeof Ae.signature=="string"?Ne[Ae.signature]=Ae:f(Ae)&&(Ne=Ae.signatures)):t(Ae)&&(Ne=Ae,re||(Pe=W(Ae))),Object.keys(Ne).length===0){const Ce=new TypeError("Argument to 'typed' at index "+we+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw Ce.data={index:we,argument:Ae},Ce}re||(de=U(de,Pe)),ee(ve,Ne)}return ie(de||"",ve)},s.create=_P,s.createCount=te.createCount,s.onMismatch=z,s.throwMismatchError=z,s.createError=N,s.clear=c,s.clearConversions=l,s.addTypes=u,s._findType=o,s.referTo=he,s.referToSelf=K,s.convert=m,s.findSignature=h,s.find=p,s.isTypedFunction=f,s.warnAgainstDeprecatedThis=!0,s.addType=function(Y,re){let ce="any";re!==!1&&n.has("Object")&&(ce="Object"),s.addTypes([Y],ce)};function ne(Y){if(!Y||typeof Y.from!="string"||typeof Y.to!="string"||typeof Y.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(Y.to===Y.from)throw new SyntaxError('Illegal to define conversion from "'+Y.from+'" to itself.')}return s.addConversion=function(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ne(Y);const ce=o(Y.to),de=ce.conversionsTo.find(ve=>ve.from===Y.from);if(de)if(re&&re.override)s.removeConversion({from:de.from,to:Y.to,convert:de.convert});else throw new Error('There is already a conversion from "'+Y.from+'" to "'+ce.name+'"');ce.conversionsTo.push({from:Y.from,convert:Y.convert,index:a++})},s.addConversions=function(Y,re){Y.forEach(ce=>s.addConversion(ce,re))},s.removeConversion=function(Y){ne(Y);const re=o(Y.to),ce=oe(re.conversionsTo,ve=>ve.from===Y.from);if(!ce)throw new Error("Attempt to remove nonexistent conversion from "+Y.from+" to "+Y.to);if(ce.convert!==Y.convert)throw new Error("Conversion to remove does not match existing conversion");const de=re.conversionsTo.indexOf(ce);re.conversionsTo.splice(de,1)},s.resolve=function(Y,re){if(!f(Y))throw new TypeError(s6);const ce=Y._typedFunctionData.signatures;for(let de=0;de<ce.length;++de)if(ce[de].test(re))return ce[de];return null},s}const Ah=_P();function se(t,e,r,n){function i(a){var s=Wue(a,e.map(xP));return Jue(t,e,a),r(s)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function gf(t){return typeof t=="function"&&typeof t.fn=="string"&&Array.isArray(t.dependencies)}function Jue(t,e,r){var n=e.filter(a=>!Kue(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function Kue(t){return t&&t[0]==="?"}function xP(t){return t&&t[0]==="?"?t.slice(1):t}function vt(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function Gue(t){return/^-?\d+$/.test(t)}function ru(t,e){return e.number==="bigint"&&!Gue(t)?e.numberFallback:e.number}var Do=Math.sign||function(t){return t>0?1:t<0?-1:0},Xue=Math.log2||function(t){return Math.log(t)/Math.LN2},Que=Math.log10||function(t){return Math.log(t)/Math.LN10},ece=Math.log1p||function(t){return Math.log(t+1)},tce=Math.cbrt||function(t){if(t===0)return t;var e=t<0,r;return e&&(t=-t),isFinite(t)?(r=Math.exp(Math.log(t)/3),r=(t/(r*r)+2*r)/3):r=t,e?-r:r},rce=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function N1(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!vt(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!vt(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var s="";return t<0&&(t=-t,s="-"),"".concat(s).concat(i).concat(t.toString(e)).concat(a)}function Ru(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=EP(e);switch(r){case"fixed":return SP(t,n);case"exponential":return TP(t,n);case"engineering":return nce(t,n);case"bin":return N1(t,2,i);case"oct":return N1(t,8,i);case"hex":return N1(t,16,i);case"auto":return ice(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],s=arguments[4];return a!=="."?a+s:s});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function EP(t){var e="auto",r,n;if(t!==void 0)if(Ht(t))r=t;else if(Vt(t))r=t.toNumber();else if(nd(t))t.precision!==void 0&&(r=o6(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=o6(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function cp(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(o){return i-=o.length,""}).replace(/0*$/,"").split("").map(function(o){return parseInt(o)});return s.length===0&&(s.push(0),i++),{sign:r,coefficients:s,exponent:i}}function nce(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=_y(r,e),i=n.exponent,a=n.coefficients,s=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Ht(e))for(;e>a.length||i-s+1>a.length;)a.push(0);else for(var o=Math.abs(i-s)-(a.length-1),u=0;u<o;u++)a.push(0);for(var c=Math.abs(i-s),l=1;c>0;)l++,c--;var d=a.slice(l).join(""),f=Ht(e)&&d.length||d.match(/[1-9]/)?"."+d:"",h=a.slice(0,l).join("")+f+"e"+(i>=0?"+":"")+s.toString();return n.sign+h}function SP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=typeof e=="number"?_y(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,s=a+(e||0);return i.length<s&&(i=i.concat(ll(s-i.length))),a<0&&(i=ll(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function TP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=e?_y(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(ll(e-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ice(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=u6(r==null?void 0:r.lowerExp,-3),i=u6(r==null?void 0:r.upperExp,5),a=cp(t),s=e?_y(a,e):a;if(s.exponent<n||s.exponent>=i)return TP(t,e);var o=s.coefficients,u=s.exponent;o.length<e&&(o=o.concat(ll(e-o.length))),o=o.concat(ll(u-o.length+1+(o.length<e?e-o.length:0))),o=ll(-u).concat(o);var c=u>0?u:0;return c<o.length-1&&o.splice(c+1,0,"."),s.sign+o.join("")}function _y(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function ll(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function ace(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}function Gn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(t)||isNaN(e)?!1:!isFinite(t)||!isFinite(e)?t===e:t===e?!0:Math.abs(t-e)<=Math.max(r*Math.max(Math.abs(t),Math.abs(e)),n)}var sce=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},oce=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},uce=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},cce=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},lce=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},dce=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function fce(t,e){var r=!0,n=e>0?!0:e<0?!1:1/e===1/0;return r^n?-6.283185307179586:t}function o6(t,e){if(Ht(t))return t;if(Vt(t))return t.toNumber();e()}function u6(t,e){return Ht(t)?t:Vt(t)?t.toNumber():e}var DP=function(){return DP=Ah.create,Ah},hce=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],pce=se("typed",hce,function(t){var{BigNumber:e,Complex:r,DenseMatrix:n,Fraction:i}=t,a=DP();return a.clear(),a.addTypes([{name:"number",test:Ht},{name:"Complex",test:Pa},{name:"BigNumber",test:Vt},{name:"bigint",test:aP},{name:"Fraction",test:fc},{name:"Unit",test:Ai},{name:"identifier",test:s=>/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:si},{name:"Chain",test:Ux},{name:"Array",test:kr},{name:"Matrix",test:Dt},{name:"DenseMatrix",test:Dh},{name:"SparseMatrix",test:To},{name:"Range",test:wy},{name:"Index",test:op},{name:"boolean",test:sP},{name:"ResultSet",test:oP},{name:"Help",test:$x},{name:"function",test:uP},{name:"Date",test:cP},{name:"RegExp",test:lP},{name:"null",test:dP},{name:"undefined",test:fP},{name:"AccessorNode",test:Wo},{name:"ArrayNode",test:Pi},{name:"AssignmentNode",test:hP},{name:"BlockNode",test:pP},{name:"ConditionalNode",test:mP},{name:"ConstantNode",test:pr},{name:"FunctionNode",test:Qs},{name:"FunctionAssignmentNode",test:id},{name:"IndexNode",test:hc},{name:"Node",test:Rr},{name:"ObjectNode",test:up},{name:"OperatorNode",test:yn},{name:"ParenthesisNode",test:gs},{name:"RangeNode",test:gP},{name:"RelationalNode",test:yP},{name:"SymbolNode",test:On},{name:"Map",test:ku},{name:"Object",test:nd}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(s){if(e||Zp(s),ace(s)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+s+"). Use function bignumber(x) to convert to BigNumber.");return new e(s)}},{from:"number",to:"Complex",convert:function(s){return r||Hp(s),new r(s,0)}},{from:"BigNumber",to:"Complex",convert:function(s){return r||Hp(s),new r(s.toNumber(),0)}},{from:"bigint",to:"number",convert:function(s){if(s>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+s+")");return Number(s)}},{from:"bigint",to:"BigNumber",convert:function(s){return e||Zp(s),new e(s.toString())}},{from:"bigint",to:"Fraction",convert:function(s){return i||Wp(s),new i(s.toString())}},{from:"Fraction",to:"BigNumber",convert:function(s){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(s){return r||Hp(s),new r(s.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(s){i||Wp(s);var o=new i(s);if(o.valueOf()!==s)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+s+"). Use function fraction(x) to convert to Fraction.");return o}},{from:"string",to:"number",convert:function(s){var o=Number(s);if(isNaN(o))throw new Error('Cannot convert "'+s+'" to a number');return o}},{from:"string",to:"BigNumber",convert:function(s){e||Zp(s);try{return new e(s)}catch{throw new Error('Cannot convert "'+s+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(s){try{return BigInt(s)}catch{throw new Error('Cannot convert "'+s+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(s){i||Wp(s);try{return new i(s)}catch{throw new Error('Cannot convert "'+s+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(s){r||Hp(s);try{return new r(s)}catch{throw new Error('Cannot convert "'+s+'" to Complex')}}},{from:"boolean",to:"number",convert:function(s){return+s}},{from:"boolean",to:"BigNumber",convert:function(s){return e||Zp(s),new e(+s)}},{from:"boolean",to:"bigint",convert:function(s){return BigInt(+s)}},{from:"boolean",to:"Fraction",convert:function(s){return i||Wp(s),new i(+s)}},{from:"boolean",to:"string",convert:function(s){return String(s)}},{from:"Array",to:"Matrix",convert:function(s){return n||mce(),new n(s)}},{from:"Matrix",to:"Array",convert:function(s){return s.valueOf()}}]),a.onMismatch=(s,o,u)=>{var c=a.createError(s,o,u);if(["wrongType","mismatch"].includes(c.data.category)&&o.length===1&&Zi(o[0])&&u.some(d=>!d.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=c.data,l}throw c},a.onMismatch=(s,o,u)=>{var c=a.createError(s,o,u);if(["wrongType","mismatch"].includes(c.data.category)&&o.length===1&&Zi(o[0])&&u.some(d=>!d.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=c.data,l}throw c},a});function Zp(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function Hp(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function mce(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Wp(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var gce="ResultSet",yce=[],vce=se(gce,yce,()=>{function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0});/*!
1046
+ `,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]},Fue=t=>t!=null;X.any().refine(t=>Fue(t));const IF=X.enum(["Cash","FixedIncome"]),CF=X.enum(["AssetPurchase","AssetSale","FeesIncome","FeesPayment","InterestIncome","InterestPayment","PrincipalDraw","PrincipalReturn"]);function OF(){return X.object({fees:X.array(tP()).nullish(),id:X.string()})}function e6(){return X.object({__typename:X.literal("BaseTransaction").optional(),accountId:X.string().nullable(),amount:X.number(),assetId:X.string(),assetType:IF,counterPartyAccountId:X.string().nullable(),entryTime:X.string().datetime(),id:X.string(),settlementTime:X.string().datetime().nullable(),tradeTime:X.string().datetime().nullable()})}function t6(){return X.object({accountId:X.string().nullish(),amount:X.number().nullish(),assetId:X.string().nullish(),assetType:IF.nullish(),counterPartyAccountId:X.string().nullish(),entryTime:X.string().datetime().nullish(),id:X.string(),settlementTime:X.string().datetime().nullish(),tradeTime:X.string().datetime().nullish()})}function MF(){return X.object({id:X.string(),label:X.string().nullish(),reference:X.string()})}function kF(){return X.object({balance:X.number(),currency:X.string(),id:X.string(),spvId:X.string()})}function RF(){return X.object({CUSIP:X.string().nullish(),ISIN:X.string().nullish(),coupon:X.number().nullish(),fixedIncomeTypeId:X.string(),id:X.string(),maturity:X.string().datetime().nullish(),name:X.string(),spvId:X.string()})}function FF(){return X.object({id:X.string(),name:X.string()})}function PF(){return X.object({cashTransaction:e6(),entryTime:X.string().datetime(),fees:X.array(tP()).nullish(),fixedIncomeTransaction:e6().nullish(),id:X.string(),serviceProviderFeeTypeId:X.string().nullish(),txRef:X.string().nullish(),type:CF})}function BF(){return X.object({accountId:X.string(),feeType:X.string(),id:X.string(),name:X.string()})}function LF(){return X.object({id:X.string(),name:X.string()})}function jF(){return X.object({id:X.string()})}function $F(){return X.object({id:X.string()})}function UF(){return X.object({id:X.string()})}function zF(){return X.object({id:X.string()})}function qF(){return X.object({id:X.string()})}function VF(){return X.object({id:X.string()})}function ZF(){return X.object({id:X.string()})}function HF(){return X.object({id:X.string(),label:X.string().nullish(),reference:X.string().nullish()})}function WF(){return X.object({currency:X.string().nullish(),id:X.string(),spvId:X.string().nullish()})}function YF(){return X.object({CUSIP:X.string().nullish(),ISIN:X.string().nullish(),coupon:X.number().nullish(),fixedIncomeTypeId:X.string().nullish(),id:X.string(),maturity:X.string().datetime().nullish(),name:X.string().nullish(),spvId:X.string().nullish()})}function JF(){return X.object({id:X.string(),name:X.string().nullish()})}function KF(){return X.object({fees:X.array(X.lazy(()=>Pue())).nullish(),id:X.string()})}function GF(){return X.object({cashTransaction:X.lazy(()=>t6().nullish()),entryTime:X.string().datetime().nullish(),fixedIncomeTransaction:X.lazy(()=>t6().nullish()),id:X.string(),serviceProviderFeeTypeId:X.string().nullish(),txRef:X.string().nullish(),type:CF.nullish()})}function XF(){return X.object({accountId:X.string().nullish(),feeType:X.string().nullish(),id:X.string(),name:X.string().nullish()})}function QF(){return X.object({id:X.string(),name:X.string().nullish()})}function Pue(){return X.object({amount:X.number().nullish(),id:X.string().nullish(),serviceProviderFeeTypeId:X.string().nullish()})}function eP(){return X.object({feeIds:X.array(X.string()).nullish(),id:X.string()})}function tP(){return X.object({__typename:X.literal("TransactionFee").optional(),amount:X.number(),id:X.string(),serviceProviderFeeTypeId:X.string()})}const Es={createSpvOperation(t,e,r){if(!e.input.id)throw new Error("SPV must have an id");if(!e.input.name)throw new Error("SPV must have a name");if(t.spvs.find(n=>n.id===e.input.id))throw new Error(`SPV with id ${e.input.id} already exists!`);t.spvs.push(e.input)},editSpvOperation(t,e,r){if(!e.input.id)throw new Error("SPV must have an id");if(!t.spvs.find(n=>n.id===e.input.id))throw new Error(`SPV with id ${e.input.id} does not exist!`);t.spvs=t.spvs.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteSpvOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("SPV must have an id");if(!t.spvs.find(i=>i.id===n))throw new Error(`SPV with id ${n} does not exist!`);if(t.portfolio.filter(i=>i.spvId===n).length!==0)throw new Error("Cannot delete SPV because it has assets that depend on it. Please change or delete those assets first.");t.spvs=t.spvs.filter(i=>i.id!==n)},createServiceProviderFeeTypeOperation(t,e,r){if(!e.input.id)throw new Error("Service provider must have an id");if(!e.input.name)throw new Error("Service provider must have a name");if(!e.input.feeType)throw new Error("Service provider must have a fee type");if(!e.input.accountId)throw new Error("Service provider must have an associated account id");if(!t.accounts.find(n=>n.id===e.input.accountId))throw new Error(`Account with id ${e.input.accountId} does not exist!`);if(t.serviceProviderFeeTypes.find(n=>n.id===e.input.id))throw new Error(`Service provider with id ${e.input.id} already exists!`);t.serviceProviderFeeTypes.push(e.input)},editServiceProviderFeeTypeOperation(t,e,r){if(!e.input.id)throw new Error("Service provider must have an id");if(!t.serviceProviderFeeTypes.find(n=>n.id===e.input.id))throw new Error(`Service provider with id ${e.input.id} does not exist!`);if(e.input.accountId&&!t.accounts.find(n=>n.id===e.input.accountId))throw new Error(`Account with id ${e.input.accountId} does not exist!`);t.serviceProviderFeeTypes=t.serviceProviderFeeTypes.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteServiceProviderFeeTypeOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("Service provider fee type must have an id");if(!t.serviceProviderFeeTypes.find(i=>i.id===n))throw new Error(`Service provider with id ${n} does not exist!`);if(t.transactions.filter(i=>{var a;return(a=i.fees)==null?void 0:a.some(s=>s.serviceProviderFeeTypeId===n)}).length!==0)throw new Error("Cannot delete service provider fee type because it has transactions that depend on it. Please change or delete those transactions first.");t.serviceProviderFeeTypes=t.serviceProviderFeeTypes.filter(i=>i.id!==n)},createAccountOperation(t,e,r){if(!e.input.id)throw new Error("Account must have an id");if(!e.input.reference)throw new Error("Account must have a reference");if(t.accounts.find(n=>n.id===e.input.id))throw new Error(`Account with id ${e.input.id} already exists!`);t.accounts.push(e.input)},editAccountOperation(t,e,r){if(!e.input.id)throw new Error("Account must have an id");if(!t.accounts.find(n=>n.id===e.input.id))throw new Error(`Account with id ${e.input.id} does not exist!`);t.accounts=t.accounts.map(n=>n.id===e.input.id?{...n,...e.input}:n)},deleteAccountOperation(t,e,r){const n=e.input.id;if(!n)throw new Error("Account must have an id");if(n===t.principalLenderAccountId)throw new Error("Cannot delete principal lender account.");if(!t.accounts.find(i=>i.id===n))throw new Error(`Account with id ${n} does not exist!`);if(t.serviceProviderFeeTypes.filter(i=>i.accountId===n).length!==0)throw new Error("Cannot delete account because it has service provider fee types that depend on it. Please change or delete those service provider fee types first.");if(t.transactions.filter(i=>{var a;return((a=i.fixedIncomeTransaction)==null?void 0:a.accountId)===n||i.cashTransaction.accountId===n}).length!==0)throw new Error("Cannot delete account because it has transactions that depend on it. Please change or delete those transactions first.");t.accounts=t.accounts.filter(i=>i.id!==n)}};function ai(){return ai=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ai.apply(null,arguments)}var rP={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function yi(t,e){if(Xg(t,e))return t[e];throw typeof t[e]=="function"&&jx(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Fl(t,e,r){if(Xg(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Xg(t,e){return!Lue(t)&&!Array.isArray(t)?!1:ut(jue,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Bue(t,e){if(!jx(t,e))throw new Error('No access to method "'+e+'"');return t[e]}function jx(t,e){return t==null||typeof t[e]!="function"||ut(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:ut($ue,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Lue(t){return typeof t=="object"&&t&&t.constructor===Object}var jue={length:!0,name:!0},$ue={toString:!0,valueOf:!0,toLocaleString:!0};class by{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return yi(this.wrappedObject,e)}set(e,r){return Fl(this.wrappedObject,e,r),this}has(e){return Xg(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return iP(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){Xg(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class nP{constructor(e,r,n){this.a=e,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return iP(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function iP(t,e){return{next:()=>{var r=t.next();return r.done?r:{value:e(r.value),done:!1}}}}function Th(){return new Map}function cl(t){if(!t)return Th();if(ku(t))return t;if(nd(t))return new by(t);throw new Error("createMap can create maps from objects or Maps")}function Uue(t){if(t instanceof by)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);Fl(e,r,n)}return e}function Ht(t){return typeof t=="number"}function Vt(t){return!t||typeof t!="object"||typeof t.constructor!="function"?!1:t.isBigNumber===!0&&typeof t.constructor.prototype=="object"&&t.constructor.prototype.isBigNumber===!0||typeof t.constructor.isDecimal=="function"&&t.constructor.isDecimal(t)===!0}function aP(t){return typeof t=="bigint"}function Pa(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function fc(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function Ai(t){return t&&t.constructor.prototype.isUnit===!0||!1}function si(t){return typeof t=="string"}var kr=Array.isArray;function Dt(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function Zi(t){return Array.isArray(t)||Dt(t)}function Dh(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function To(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function wy(t){return t&&t.constructor.prototype.isRange===!0||!1}function op(t){return t&&t.constructor.prototype.isIndex===!0||!1}function sP(t){return typeof t=="boolean"}function oP(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function $x(t){return t&&t.constructor.prototype.isHelp===!0||!1}function uP(t){return typeof t=="function"}function cP(t){return t instanceof Date}function lP(t){return t instanceof RegExp}function nd(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!Pa(t)&&!fc(t))}function ku(t){return t?t instanceof Map||t instanceof by||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function zue(t){return ku(t)&&ku(t.a)&&ku(t.b)}function que(t){return ku(t)&&nd(t.wrappedObject)}function dP(t){return t===null}function fP(t){return t===void 0}function Wo(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function Pi(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function hP(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function pP(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function mP(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function pr(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gw(t){return pr(t)||yn(t)&&t.args.length===1&&pr(t.args[0])&&"-+~".includes(t.op)}function id(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Qs(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function hc(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function Rr(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function up(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function yn(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function gs(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function gP(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function yP(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function On(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ux(t){return t&&t.constructor.prototype.isChain===!0||!1}function Gr(t){var e=typeof t;return e==="object"?t===null?"null":Vt(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function Ct(t){var e=typeof t;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||t===null||t===void 0)return t;if(typeof t.clone=="function")return t.clone();if(Array.isArray(t))return t.map(function(r){return Ct(r)});if(t instanceof Date)return new Date(t.valueOf());if(Vt(t))return t;if(nd(t))return Vue(t,Ct);if(e==="function")return t;throw new TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function Vue(t,e){var r={};for(var n in t)ut(t,n)&&(r[n]=e(t[n]));return r}function vP(t,e){for(var r in e)ut(e,r)&&(t[r]=e[r]);return t}function bP(t,e){if(Array.isArray(e))throw new TypeError("Arrays are not supported by deepExtend");for(var r in e)if(ut(e,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(e[r]&&e[r].constructor===Object)t[r]===void 0&&(t[r]={}),t[r]&&t[r].constructor===Object?bP(t[r],e[r]):t[r]=e[r];else{if(Array.isArray(e[r]))throw new TypeError("Arrays are not supported by deepExtend");t[r]=e[r]}return t}function eo(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!eo(t[n],e[n]))return!1;return!0}else{if(typeof t=="function")return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!eo(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function Zue(t){var e={};return wP(t,e),e}function wP(t,e){for(var r in t)if(ut(t,r)){var n=t[r];typeof n=="object"&&n!==null?wP(n,e):e[r]=n}}function $m(t,e,r){var n=!0,i;Object.defineProperty(t,e,{get:function(){return n&&(i=r(),n=!1),i},set:function(a){i=a,n=!1},configurable:!0,enumerable:!0})}function ut(t,e){return t&&Object.hasOwnProperty.call(t,e)}function Hue(t){return t&&typeof t.factory=="function"}function Wue(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=t[i];a!==void 0&&(r[i]=a)}return r}var r6=["Matrix","Array"],n6=["number","BigNumber","Fraction"];function Yue(t,e){function r(n){if(n){if(n.epsilon!==void 0){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');var i=Ct(n);return i.relTol=n.epsilon,i.absTol=n.epsilon*.001,delete i.epsilon,r(i)}var a=Ct(t);i6(n,"matrix",r6),i6(n,"number",n6),bP(t,n);var s=Ct(t),o=Ct(n);return e("config",s,a,o),s}else return Ct(t)}return r.MATRIX_OPTIONS=r6,r.NUMBER_OPTIONS=n6,Object.keys(rP).forEach(n=>{Object.defineProperty(r,n,{get:()=>t[n],enumerable:!0,configurable:!0})}),r}function i6(t,e,r){t[e]!==void 0&&!r.includes(t[e])&&console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+r.map(n=>JSON.stringify(n)).join(", ")+".")}function a6(){return!0}function Xi(){return!1}function _c(){}const s6="Argument is not a typed-function.";function _P(){function t(Y){return typeof Y=="object"&&Y!==null&&Y.constructor===Object}const e=[{name:"number",test:function(Y){return typeof Y=="number"}},{name:"string",test:function(Y){return typeof Y=="string"}},{name:"boolean",test:function(Y){return typeof Y=="boolean"}},{name:"Function",test:function(Y){return typeof Y=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(Y){return Y instanceof Date}},{name:"RegExp",test:function(Y){return Y instanceof RegExp}},{name:"Object",test:t},{name:"null",test:function(Y){return Y===null}},{name:"undefined",test:function(Y){return Y===void 0}}],r={name:"any",test:a6,isAny:!0};let n,i,a=0,s={createCount:0};function o(Y){const re=n.get(Y);if(re)return re;let ce='Unknown type "'+Y+'"';const de=Y.toLowerCase();let ve;for(ve of i)if(ve.toLowerCase()===de){ce+='. Did you mean "'+ve+'" ?';break}throw new TypeError(ce)}function u(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const ce=re?o(re).index:i.length,de=[];for(let we=0;we<Y.length;++we){if(!Y[we]||typeof Y[we].name!="string"||typeof Y[we].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const Ae=Y[we].name;if(n.has(Ae))throw new TypeError('Duplicate type name "'+Ae+'"');de.push(Ae),n.set(Ae,{name:Ae,test:Y[we].test,isAny:Y[we].isAny,index:ce+we,conversionsTo:[]})}const ve=i.slice(ce);i=i.slice(0,ce).concat(de).concat(ve);for(let we=ce+de.length;we<i.length;++we)n.get(i[we]).index=we}function c(){n=new Map,i=[],a=0,u([r],!1)}c(),u(e);function l(){let Y;for(Y of i)n.get(Y).conversionsTo=[];a=0}function d(Y){const re=i.filter(ce=>{const de=n.get(ce);return!de.isAny&&de.test(Y)});return re.length?re:["any"]}function f(Y){return Y&&typeof Y=="function"&&"_typedFunctionData"in Y}function h(Y,re,ce){if(!f(Y))throw new TypeError(s6);const de=ce&&ce.exact,ve=Array.isArray(re)?re.join(","):re,we=x(ve),Ae=y(we);if(!de||Ae in Y.signatures){const Qe=Y._typedFunctionData.signatureMap.get(Ae);if(Qe)return Qe}const Ne=we.length;let Pe;if(de){Pe=[];let Qe;for(Qe in Y.signatures)Pe.push(Y._typedFunctionData.signatureMap.get(Qe))}else Pe=Y._typedFunctionData.signatures;for(let Qe=0;Qe<Ne;++Qe){const ft=we[Qe],$e=[];let Et;for(Et of Pe){const H=F(Et.params,Qe);if(!(!H||ft.restParam&&!H.restParam)){if(!H.hasAny){const pe=w(H);if(ft.types.some(Ee=>!pe.has(Ee.name)))continue}$e.push(Et)}}if(Pe=$e,Pe.length===0)break}let Ce;for(Ce of Pe)if(Ce.params.length<=Ne)return Ce;throw new TypeError("Signature not found (signature: "+(Y.name||"unnamed")+"("+y(we,", ")+"))")}function p(Y,re,ce){return h(Y,re,ce).implementation}function m(Y,re){const ce=o(re);if(ce.test(Y))return Y;const de=ce.conversionsTo;if(de.length===0)throw new Error("There are no conversions to "+re+" defined.");for(let ve=0;ve<de.length;ve++)if(o(de[ve].from).test(Y))return de[ve].convert(Y);throw new Error("Cannot convert "+Y+" to "+re)}function y(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return Y.map(ce=>ce.name).join(re)}function g(Y){const re=Y.indexOf("...")===0,ce=(re?Y.length>3?Y.slice(3):"any":Y).split("|").map(we=>o(we.trim()));let de=!1,ve=re?"...":"";return{types:ce.map(function(we){return de=we.isAny||de,ve+=we.name+"|",{name:we.name,typeIndex:we.index,test:we.test,isAny:we.isAny,conversion:null,conversionIndex:-1}}),name:ve.slice(0,-1),hasAny:de,hasConversion:!1,restParam:re}}function v(Y){const re=Y.types.map(Ae=>Ae.name),ce=I(re);let de=Y.hasAny,ve=Y.name;const we=ce.map(function(Ae){const Ne=o(Ae.from);return de=Ne.isAny||de,ve+="|"+Ae.from,{name:Ae.from,typeIndex:Ne.index,test:Ne.test,isAny:Ne.isAny,conversion:Ae,conversionIndex:Ae.index}});return{types:Y.types.concat(we),name:ve,hasAny:de,hasConversion:we.length>0,restParam:Y.restParam}}function w(Y){return Y.typeSet||(Y.typeSet=new Set,Y.types.forEach(re=>Y.typeSet.add(re.name))),Y.typeSet}function x(Y){const re=[];if(typeof Y!="string")throw new TypeError("Signatures must be strings");const ce=Y.trim();if(ce==="")return re;const de=ce.split(",");for(let ve=0;ve<de.length;++ve){const we=g(de[ve].trim());if(we.restParam&&ve!==de.length-1)throw new SyntaxError('Unexpected rest parameter "'+de[ve]+'": only allowed for the last parameter');if(we.types.length===0)return null;re.push(we)}return re}function _(Y){const re=Q(Y);return re?re.restParam:!1}function A(Y){if(!Y||Y.types.length===0)return a6;if(Y.types.length===1)return o(Y.types[0].name).test;if(Y.types.length===2){const re=o(Y.types[0].name).test,ce=o(Y.types[1].name).test;return function(de){return re(de)||ce(de)}}else{const re=Y.types.map(function(ce){return o(ce.name).test});return function(ce){for(let de=0;de<re.length;de++)if(re[de](ce))return!0;return!1}}}function M(Y){let re,ce,de;if(_(Y)){re=V(Y).map(A);const ve=re.length,we=A(Q(Y)),Ae=function(Ne){for(let Pe=ve;Pe<Ne.length;Pe++)if(!we(Ne[Pe]))return!1;return!0};return function(Ne){for(let Pe=0;Pe<re.length;Pe++)if(!re[Pe](Ne[Pe]))return!1;return Ae(Ne)&&Ne.length>=ve+1}}else return Y.length===0?function(ve){return ve.length===0}:Y.length===1?(ce=A(Y[0]),function(ve){return ce(ve[0])&&ve.length===1}):Y.length===2?(ce=A(Y[0]),de=A(Y[1]),function(ve){return ce(ve[0])&&de(ve[1])&&ve.length===2}):(re=Y.map(A),function(ve){for(let we=0;we<re.length;we++)if(!re[we](ve[we]))return!1;return ve.length===re.length})}function F(Y,re){return re<Y.length?Y[re]:_(Y)?Q(Y):null}function k(Y,re){const ce=F(Y,re);return ce?w(ce):new Set}function $(Y){return Y.conversion===null||Y.conversion===void 0}function T(Y,re){const ce=new Set;return Y.forEach(de=>{const ve=k(de.params,re);let we;for(we of ve)ce.add(we)}),ce.has("any")?["any"]:Array.from(ce)}function N(Y,re,ce){let de,ve;const we=Y||"unnamed";let Ae=ce,Ne;for(Ne=0;Ne<re.length;Ne++){const ft=[];if(Ae.forEach($e=>{const Et=F($e.params,Ne),H=A(Et);(Ne<$e.params.length||_($e.params))&&H(re[Ne])&&ft.push($e)}),ft.length===0){if(ve=T(Ae,Ne),ve.length>0){const $e=d(re[Ne]);return de=new TypeError("Unexpected type of argument in function "+we+" (expected: "+ve.join(" or ")+", actual: "+$e.join(" | ")+", index: "+Ne+")"),de.data={category:"wrongType",fn:we,index:Ne,actual:$e,expected:ve},de}}else Ae=ft}const Pe=Ae.map(function(ft){return _(ft.params)?1/0:ft.params.length});if(re.length<Math.min.apply(null,Pe))return ve=T(Ae,Ne),de=new TypeError("Too few arguments in function "+we+" (expected: "+ve.join(" or ")+", index: "+re.length+")"),de.data={category:"tooFewArgs",fn:we,index:re.length,expected:ve},de;const Ce=Math.max.apply(null,Pe);if(re.length>Ce)return de=new TypeError("Too many arguments in function "+we+" (expected: "+Ce+", actual: "+re.length+")"),de.data={category:"tooManyArgs",fn:we,index:re.length,expectedLength:Ce},de;const Qe=[];for(let ft=0;ft<re.length;++ft)Qe.push(d(re[ft]).join("|"));return de=new TypeError('Arguments of type "'+Qe.join(", ")+'" do not match any of the defined signatures of function '+we+"."),de.data={category:"mismatch",actual:Qe},de}function b(Y){let re=i.length+1;for(let ce=0;ce<Y.types.length;ce++)$(Y.types[ce])&&(re=Math.min(re,Y.types[ce].typeIndex));return re}function E(Y){let re=a+1;for(let ce=0;ce<Y.types.length;ce++)$(Y.types[ce])||(re=Math.min(re,Y.types[ce].conversionIndex));return re}function D(Y,re){if(Y.hasAny){if(!re.hasAny)return 1}else if(re.hasAny)return-1;if(Y.restParam){if(!re.restParam)return 1}else if(re.restParam)return-1;if(Y.hasConversion){if(!re.hasConversion)return 1}else if(re.hasConversion)return-1;const ce=b(Y)-b(re);if(ce<0)return-1;if(ce>0)return 1;const de=E(Y)-E(re);return de<0?-1:de>0?1:0}function C(Y,re){const ce=Y.params,de=re.params,ve=Q(ce),we=Q(de),Ae=_(ce),Ne=_(de);if(Ae&&ve.hasAny){if(!Ne||!we.hasAny)return 1}else if(Ne&&we.hasAny)return-1;let Pe=0,Ce=0,Qe;for(Qe of ce)Qe.hasAny&&++Pe,Qe.hasConversion&&++Ce;let ft=0,$e=0;for(Qe of de)Qe.hasAny&&++ft,Qe.hasConversion&&++$e;if(Pe!==ft)return Pe-ft;if(Ae&&ve.hasConversion){if(!Ne||!we.hasConversion)return 1}else if(Ne&&we.hasConversion)return-1;if(Ce!==$e)return Ce-$e;if(Ae){if(!Ne)return 1}else if(Ne)return-1;const Et=(ce.length-de.length)*(Ae?-1:1);if(Et!==0)return Et;const H=[];let pe=0;for(let Oe=0;Oe<ce.length;++Oe){const je=D(ce[Oe],de[Oe]);H.push(je),pe+=je}if(pe!==0)return pe;let Ee;for(Ee of H)if(Ee!==0)return Ee;return 0}function I(Y){if(Y.length===0)return[];const re=Y.map(o);Y.length>1&&re.sort((ve,we)=>ve.index-we.index);let ce=re[0].conversionsTo;if(Y.length===1)return ce;ce=ce.concat([]);const de=new Set(Y);for(let ve=1;ve<re.length;++ve){let we;for(we of re[ve].conversionsTo)de.has(we.from)||(ce.push(we),de.add(we.from))}return ce}function O(Y,re){let ce=re;if(Y.some(ve=>ve.hasConversion)){const ve=_(Y),we=Y.map(S);ce=function(){const Ae=[],Ne=ve?arguments.length-1:arguments.length;for(let Pe=0;Pe<Ne;Pe++)Ae[Pe]=we[Pe](arguments[Pe]);return ve&&(Ae[Ne]=arguments[Ne].map(we[Ne])),re.apply(this,Ae)}}let de=ce;if(_(Y)){const ve=Y.length-1;de=function(){return ce.apply(this,ae(arguments,0,ve).concat([ae(arguments,ve)]))}}return de}function S(Y){let re,ce,de,ve;const we=[],Ae=[];switch(Y.types.forEach(function(Ne){Ne.conversion&&(we.push(o(Ne.conversion.from).test),Ae.push(Ne.conversion.convert))}),Ae.length){case 0:return function(Ne){return Ne};case 1:return re=we[0],de=Ae[0],function(Ne){return re(Ne)?de(Ne):Ne};case 2:return re=we[0],ce=we[1],de=Ae[0],ve=Ae[1],function(Ne){return re(Ne)?de(Ne):ce(Ne)?ve(Ne):Ne};default:return function(Ne){for(let Pe=0;Pe<Ae.length;Pe++)if(we[Pe](Ne))return Ae[Pe](Ne);return Ne}}}function P(Y){function re(ce,de,ve){if(de<ce.length){const we=ce[de];let Ae=[];if(we.restParam){const Ne=we.types.filter($);Ne.length<we.types.length&&Ae.push({types:Ne,name:"..."+Ne.map(Pe=>Pe.name).join("|"),hasAny:Ne.some(Pe=>Pe.isAny),hasConversion:!1,restParam:!0}),Ae.push(we)}else Ae=we.types.map(function(Ne){return{types:[Ne],name:Ne.name,hasAny:Ne.isAny,hasConversion:Ne.conversion,restParam:!1}});return le(Ae,function(Ne){return re(ce,de+1,ve.concat([Ne]))})}else return[ve]}return re(Y,0,[])}function R(Y,re){const ce=Math.max(Y.length,re.length);for(let Ne=0;Ne<ce;Ne++){const Pe=k(Y,Ne),Ce=k(re,Ne);let Qe=!1,ft;for(ft of Ce)if(Pe.has(ft)){Qe=!0;break}if(!Qe)return!1}const de=Y.length,ve=re.length,we=_(Y),Ae=_(re);return we?Ae?de===ve:ve>=de:Ae?de>=ve:de===ve}function L(Y){return Y.map(re=>j(re)?K(re.referToSelf.callback):B(re)?Z(re.referTo.references,re.referTo.callback):re)}function q(Y,re,ce){const de=[];let ve;for(ve of Y){let we=ce[ve];if(typeof we!="number")throw new TypeError('No definition for referenced signature "'+ve+'"');if(we=re[we],typeof we!="function")return!1;de.push(we)}return de}function J(Y,re,ce){const de=L(Y),ve=new Array(de.length).fill(!1);let we=!0;for(;we;){we=!1;let Ae=!0;for(let Ne=0;Ne<de.length;++Ne){if(ve[Ne])continue;const Pe=de[Ne];if(j(Pe))de[Ne]=Pe.referToSelf.callback(ce),de[Ne].referToSelf=Pe.referToSelf,ve[Ne]=!0,Ae=!1;else if(B(Pe)){const Ce=q(Pe.referTo.references,de,re);Ce?(de[Ne]=Pe.referTo.callback.apply(this,Ce),de[Ne].referTo=Pe.referTo,ve[Ne]=!0,Ae=!1):we=!0}}if(Ae&&we)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return de}function G(Y){const re=/\bthis(\(|\.signatures\b)/;Object.keys(Y).forEach(ce=>{const de=Y[ce];if(re.test(de.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function ie(Y,re){if(s.createCount++,Object.keys(re).length===0)throw new SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&G(re);const ce=[],de=[],ve={},we=[];let Ae;for(Ae in re){if(!Object.prototype.hasOwnProperty.call(re,Ae))continue;const kt=x(Ae);if(!kt)continue;ce.forEach(function(fn){if(R(fn,kt))throw new TypeError('Conflicting signatures "'+y(fn)+'" and "'+y(kt)+'".')}),ce.push(kt);const rn=de.length;de.push(re[Ae]);const un=kt.map(v);let Dn;for(Dn of P(un)){const fn=y(Dn);we.push({params:Dn,name:fn,fn:rn}),Dn.every(Zt=>!Zt.hasConversion)&&(ve[fn]=rn)}}we.sort(C);const Ne=J(de,ve,Qr);let Pe;for(Pe in ve)Object.prototype.hasOwnProperty.call(ve,Pe)&&(ve[Pe]=Ne[ve[Pe]]);const Ce=[],Qe=new Map;for(Pe of we)Qe.has(Pe.name)||(Pe.fn=Ne[Pe.fn],Ce.push(Pe),Qe.set(Pe.name,Pe));const ft=Ce[0]&&Ce[0].params.length<=2&&!_(Ce[0].params),$e=Ce[1]&&Ce[1].params.length<=2&&!_(Ce[1].params),Et=Ce[2]&&Ce[2].params.length<=2&&!_(Ce[2].params),H=Ce[3]&&Ce[3].params.length<=2&&!_(Ce[3].params),pe=Ce[4]&&Ce[4].params.length<=2&&!_(Ce[4].params),Ee=Ce[5]&&Ce[5].params.length<=2&&!_(Ce[5].params),Oe=ft&&$e&&Et&&H&&pe&&Ee;for(let kt=0;kt<Ce.length;++kt)Ce[kt].test=M(Ce[kt].params);const je=ft?A(Ce[0].params[0]):Xi,it=$e?A(Ce[1].params[0]):Xi,jt=Et?A(Ce[2].params[0]):Xi,Ft=H?A(Ce[3].params[0]):Xi,Br=pe?A(Ce[4].params[0]):Xi,Or=Ee?A(Ce[5].params[0]):Xi,Mt=ft?A(Ce[0].params[1]):Xi,jr=$e?A(Ce[1].params[1]):Xi,$r=Et?A(Ce[2].params[1]):Xi,me=H?A(Ce[3].params[1]):Xi,be=pe?A(Ce[4].params[1]):Xi,De=Ee?A(Ce[5].params[1]):Xi;for(let kt=0;kt<Ce.length;++kt)Ce[kt].implementation=O(Ce[kt].params,Ce[kt].fn);const Ie=ft?Ce[0].implementation:_c,Ze=$e?Ce[1].implementation:_c,tt=Et?Ce[2].implementation:_c,Ye=H?Ce[3].implementation:_c,We=pe?Ce[4].implementation:_c,Je=Ee?Ce[5].implementation:_c,Be=ft?Ce[0].params.length:-1,rt=$e?Ce[1].params.length:-1,ht=Et?Ce[2].params.length:-1,gt=H?Ce[3].params.length:-1,Ur=pe?Ce[4].params.length:-1,fr=Ee?Ce[5].params.length:-1,Jt=Oe?6:0,Sr=Ce.length,Fn=Ce.map(kt=>kt.test),zn=Ce.map(kt=>kt.implementation),bn=function(){for(let kt=Jt;kt<Sr;kt++)if(Fn[kt](arguments))return zn[kt].apply(this,arguments);return s.onMismatch(Y,arguments,Ce)};function Qr(kt,rn){return arguments.length===Be&&je(kt)&&Mt(rn)?Ie.apply(this,arguments):arguments.length===rt&&it(kt)&&jr(rn)?Ze.apply(this,arguments):arguments.length===ht&&jt(kt)&&$r(rn)?tt.apply(this,arguments):arguments.length===gt&&Ft(kt)&&me(rn)?Ye.apply(this,arguments):arguments.length===Ur&&Br(kt)&&be(rn)?We.apply(this,arguments):arguments.length===fr&&Or(kt)&&De(rn)?Je.apply(this,arguments):bn.apply(this,arguments)}try{Object.defineProperty(Qr,"name",{value:Y})}catch{}return Qr.signatures=ve,Qr._typedFunctionData={signatures:Ce,signatureMap:Qe},Qr}function z(Y,re,ce){throw N(Y,re,ce)}function V(Y){return ae(Y,0,Y.length-1)}function Q(Y){return Y[Y.length-1]}function ae(Y,re,ce){return Array.prototype.slice.call(Y,re,ce)}function oe(Y,re){for(let ce=0;ce<Y.length;ce++)if(re(Y[ce]))return Y[ce]}function le(Y,re){return Array.prototype.concat.apply([],Y.map(re))}function he(){const Y=V(arguments).map(ce=>y(x(ce))),re=Q(arguments);if(typeof re!="function")throw new TypeError("Callback function expected as last argument");return Z(Y,re)}function Z(Y,re){return{referTo:{references:Y,callback:re}}}function K(Y){if(typeof Y!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:Y}}}function B(Y){return Y&&typeof Y.referTo=="object"&&Array.isArray(Y.referTo.references)&&typeof Y.referTo.callback=="function"}function j(Y){return Y&&typeof Y.referToSelf=="object"&&typeof Y.referToSelf.callback=="function"}function U(Y,re){if(!Y)return re;if(re&&re!==Y){const ce=new Error("Function names do not match (expected: "+Y+", actual: "+re+")");throw ce.data={actual:re,expected:Y},ce}return Y}function W(Y){let re;for(const ce in Y)Object.prototype.hasOwnProperty.call(Y,ce)&&(f(Y[ce])||typeof Y[ce].signature=="string")&&(re=U(re,Y[ce].name));return re}function ee(Y,re){let ce;for(ce in re)if(Object.prototype.hasOwnProperty.call(re,ce)){if(ce in Y&&re[ce]!==Y[ce]){const de=new Error('Signature "'+ce+'" is defined twice');throw de.data={signature:ce,sourceFunction:re[ce],destFunction:Y[ce]},de}Y[ce]=re[ce]}}const te=s;s=function(Y){const re=typeof Y=="string",ce=re?1:0;let de=re?Y:"";const ve={};for(let we=ce;we<arguments.length;++we){const Ae=arguments[we];let Ne={},Pe;if(typeof Ae=="function"?(Pe=Ae.name,typeof Ae.signature=="string"?Ne[Ae.signature]=Ae:f(Ae)&&(Ne=Ae.signatures)):t(Ae)&&(Ne=Ae,re||(Pe=W(Ae))),Object.keys(Ne).length===0){const Ce=new TypeError("Argument to 'typed' at index "+we+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw Ce.data={index:we,argument:Ae},Ce}re||(de=U(de,Pe)),ee(ve,Ne)}return ie(de||"",ve)},s.create=_P,s.createCount=te.createCount,s.onMismatch=z,s.throwMismatchError=z,s.createError=N,s.clear=c,s.clearConversions=l,s.addTypes=u,s._findType=o,s.referTo=he,s.referToSelf=K,s.convert=m,s.findSignature=h,s.find=p,s.isTypedFunction=f,s.warnAgainstDeprecatedThis=!0,s.addType=function(Y,re){let ce="any";re!==!1&&n.has("Object")&&(ce="Object"),s.addTypes([Y],ce)};function ne(Y){if(!Y||typeof Y.from!="string"||typeof Y.to!="string"||typeof Y.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(Y.to===Y.from)throw new SyntaxError('Illegal to define conversion from "'+Y.from+'" to itself.')}return s.addConversion=function(Y){let re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ne(Y);const ce=o(Y.to),de=ce.conversionsTo.find(ve=>ve.from===Y.from);if(de)if(re&&re.override)s.removeConversion({from:de.from,to:Y.to,convert:de.convert});else throw new Error('There is already a conversion from "'+Y.from+'" to "'+ce.name+'"');ce.conversionsTo.push({from:Y.from,convert:Y.convert,index:a++})},s.addConversions=function(Y,re){Y.forEach(ce=>s.addConversion(ce,re))},s.removeConversion=function(Y){ne(Y);const re=o(Y.to),ce=oe(re.conversionsTo,ve=>ve.from===Y.from);if(!ce)throw new Error("Attempt to remove nonexistent conversion from "+Y.from+" to "+Y.to);if(ce.convert!==Y.convert)throw new Error("Conversion to remove does not match existing conversion");const de=re.conversionsTo.indexOf(ce);re.conversionsTo.splice(de,1)},s.resolve=function(Y,re){if(!f(Y))throw new TypeError(s6);const ce=Y._typedFunctionData.signatures;for(let de=0;de<ce.length;++de)if(ce[de].test(re))return ce[de];return null},s}const Ah=_P();function se(t,e,r,n){function i(a){var s=Wue(a,e.map(xP));return Jue(t,e,a),r(s)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function gf(t){return typeof t=="function"&&typeof t.fn=="string"&&Array.isArray(t.dependencies)}function Jue(t,e,r){var n=e.filter(a=>!Kue(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function Kue(t){return t&&t[0]==="?"}function xP(t){return t&&t[0]==="?"?t.slice(1):t}function vt(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function Gue(t){return/^-?\d+$/.test(t)}function ru(t,e){return e.number==="bigint"&&!Gue(t)?e.numberFallback:e.number}var Do=Math.sign||function(t){return t>0?1:t<0?-1:0},Xue=Math.log2||function(t){return Math.log(t)/Math.LN2},Que=Math.log10||function(t){return Math.log(t)/Math.LN10},ece=Math.log1p||function(t){return Math.log(t+1)},tce=Math.cbrt||function(t){if(t===0)return t;var e=t<0,r;return e&&(t=-t),isFinite(t)?(r=Math.exp(Math.log(t)/3),r=(t/(r*r)+2*r)/3):r=t,e?-r:r},rce=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function N1(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!vt(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!vt(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var s="";return t<0&&(t=-t,s="-"),"".concat(s).concat(i).concat(t.toString(e)).concat(a)}function Ru(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=EP(e);switch(r){case"fixed":return SP(t,n);case"exponential":return TP(t,n);case"engineering":return nce(t,n);case"bin":return N1(t,2,i);case"oct":return N1(t,8,i);case"hex":return N1(t,16,i);case"auto":return ice(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],s=arguments[4];return a!=="."?a+s:s});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function EP(t){var e="auto",r,n;if(t!==void 0)if(Ht(t))r=t;else if(Vt(t))r=t.toNumber();else if(nd(t))t.precision!==void 0&&(r=o6(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=o6(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function cp(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(o){return i-=o.length,""}).replace(/0*$/,"").split("").map(function(o){return parseInt(o)});return s.length===0&&(s.push(0),i++),{sign:r,coefficients:s,exponent:i}}function nce(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=_y(r,e),i=n.exponent,a=n.coefficients,s=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Ht(e))for(;e>a.length||i-s+1>a.length;)a.push(0);else for(var o=Math.abs(i-s)-(a.length-1),u=0;u<o;u++)a.push(0);for(var c=Math.abs(i-s),l=1;c>0;)l++,c--;var d=a.slice(l).join(""),f=Ht(e)&&d.length||d.match(/[1-9]/)?"."+d:"",h=a.slice(0,l).join("")+f+"e"+(i>=0?"+":"")+s.toString();return n.sign+h}function SP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=typeof e=="number"?_y(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,s=a+(e||0);return i.length<s&&(i=i.concat(ll(s-i.length))),a<0&&(i=ll(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function TP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=cp(t),n=e?_y(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(ll(e-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ice(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=u6(r==null?void 0:r.lowerExp,-3),i=u6(r==null?void 0:r.upperExp,5),a=cp(t),s=e?_y(a,e):a;if(s.exponent<n||s.exponent>=i)return TP(t,e);var o=s.coefficients,u=s.exponent;o.length<e&&(o=o.concat(ll(e-o.length))),o=o.concat(ll(u-o.length+1+(o.length<e?e-o.length:0))),o=ll(-u).concat(o);var c=u>0?u:0;return c<o.length-1&&o.splice(c+1,0,"."),s.sign+o.join("")}function _y(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function ll(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function ace(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}function Gn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(t)||isNaN(e)?!1:!isFinite(t)||!isFinite(e)?t===e:t===e?!0:Math.abs(t-e)<=Math.max(r*Math.max(Math.abs(t),Math.abs(e)),n)}var sce=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},oce=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},uce=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},cce=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},lce=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},dce=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function fce(t,e){var r=!0,n=e>0?!0:e<0?!1:1/e===1/0;return r^n?-6.283185307179586:t}function o6(t,e){if(Ht(t))return t;if(Vt(t))return t.toNumber();e()}function u6(t,e){return Ht(t)?t:Vt(t)?t.toNumber():e}var DP=function(){return DP=Ah.create,Ah},hce=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],pce=se("typed",hce,function(t){var{BigNumber:e,Complex:r,DenseMatrix:n,Fraction:i}=t,a=DP();return a.clear(),a.addTypes([{name:"number",test:Ht},{name:"Complex",test:Pa},{name:"BigNumber",test:Vt},{name:"bigint",test:aP},{name:"Fraction",test:fc},{name:"Unit",test:Ai},{name:"identifier",test:s=>/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:si},{name:"Chain",test:Ux},{name:"Array",test:kr},{name:"Matrix",test:Dt},{name:"DenseMatrix",test:Dh},{name:"SparseMatrix",test:To},{name:"Range",test:wy},{name:"Index",test:op},{name:"boolean",test:sP},{name:"ResultSet",test:oP},{name:"Help",test:$x},{name:"function",test:uP},{name:"Date",test:cP},{name:"RegExp",test:lP},{name:"null",test:dP},{name:"undefined",test:fP},{name:"AccessorNode",test:Wo},{name:"ArrayNode",test:Pi},{name:"AssignmentNode",test:hP},{name:"BlockNode",test:pP},{name:"ConditionalNode",test:mP},{name:"ConstantNode",test:pr},{name:"FunctionNode",test:Qs},{name:"FunctionAssignmentNode",test:id},{name:"IndexNode",test:hc},{name:"Node",test:Rr},{name:"ObjectNode",test:up},{name:"OperatorNode",test:yn},{name:"ParenthesisNode",test:gs},{name:"RangeNode",test:gP},{name:"RelationalNode",test:yP},{name:"SymbolNode",test:On},{name:"Map",test:ku},{name:"Object",test:nd}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(s){if(e||Zp(s),ace(s)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+s+"). Use function bignumber(x) to convert to BigNumber.");return new e(s)}},{from:"number",to:"Complex",convert:function(s){return r||Hp(s),new r(s,0)}},{from:"BigNumber",to:"Complex",convert:function(s){return r||Hp(s),new r(s.toNumber(),0)}},{from:"bigint",to:"number",convert:function(s){if(s>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+s+")");return Number(s)}},{from:"bigint",to:"BigNumber",convert:function(s){return e||Zp(s),new e(s.toString())}},{from:"bigint",to:"Fraction",convert:function(s){return i||Wp(s),new i(s.toString())}},{from:"Fraction",to:"BigNumber",convert:function(s){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(s){return r||Hp(s),new r(s.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(s){i||Wp(s);var o=new i(s);if(o.valueOf()!==s)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+s+"). Use function fraction(x) to convert to Fraction.");return o}},{from:"string",to:"number",convert:function(s){var o=Number(s);if(isNaN(o))throw new Error('Cannot convert "'+s+'" to a number');return o}},{from:"string",to:"BigNumber",convert:function(s){e||Zp(s);try{return new e(s)}catch{throw new Error('Cannot convert "'+s+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(s){try{return BigInt(s)}catch{throw new Error('Cannot convert "'+s+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(s){i||Wp(s);try{return new i(s)}catch{throw new Error('Cannot convert "'+s+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(s){r||Hp(s);try{return new r(s)}catch{throw new Error('Cannot convert "'+s+'" to Complex')}}},{from:"boolean",to:"number",convert:function(s){return+s}},{from:"boolean",to:"BigNumber",convert:function(s){return e||Zp(s),new e(+s)}},{from:"boolean",to:"bigint",convert:function(s){return BigInt(+s)}},{from:"boolean",to:"Fraction",convert:function(s){return i||Wp(s),new i(+s)}},{from:"boolean",to:"string",convert:function(s){return String(s)}},{from:"Array",to:"Matrix",convert:function(s){return n||mce(),new n(s)}},{from:"Matrix",to:"Array",convert:function(s){return s.valueOf()}}]),a.onMismatch=(s,o,u)=>{var c=a.createError(s,o,u);if(["wrongType","mismatch"].includes(c.data.category)&&o.length===1&&Zi(o[0])&&u.some(d=>!d.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=c.data,l}throw c},a.onMismatch=(s,o,u)=>{var c=a.createError(s,o,u);if(["wrongType","mismatch"].includes(c.data.category)&&o.length===1&&Zi(o[0])&&u.some(d=>!d.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=c.data,l}throw c},a});function Zp(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function Hp(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function mce(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Wp(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var gce="ResultSet",yce=[],vce=se(gce,yce,()=>{function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0});/*!
1047
1047
  * decimal.js v10.4.3
1048
1048
  * An arbitrary-precision Decimal type for JavaScript.
1049
1049
  * https://github.com/MikeMcl/decimal.js
1050
1050
  * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
1051
1051
  * MIT Licence
1052
- */var Xw=9e15,nu=1e9,Qw="0123456789abcdef",Qg="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",e0="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",e_={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:Xw,crypto:!1},AP,js,Wt=!0,xy="[DecimalError] ",Yo=xy+"Invalid argument: ",NP=xy+"Precision limit exceeded",IP=xy+"crypto unavailable",CP="[object Decimal]",ui=Math.floor,An=Math.pow,bce=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,wce=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,_ce=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,OP=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ba=1e7,Ot=7,xce=9007199254740991,Ece=Qg.length-1,t_=e0.length-1,Le={toStringTag:CP};Le.absoluteValue=Le.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Tt(t)};Le.ceil=function(){return Tt(new this.constructor(this),this.e+1,2)};Le.clampedTo=Le.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(Yo+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};Le.comparedTo=Le.cmp=function(t){var e,r,n,i,a=this,s=a.d,o=(t=new a.constructor(t)).d,u=a.s,c=t.s;if(!s||!o)return!u||!c?NaN:u!==c?u:s===o?0:!s^u<0?1:-1;if(!s[0]||!o[0])return s[0]?u:o[0]?-c:0;if(u!==c)return u;if(a.e!==t.e)return a.e>t.e^u<0?1:-1;for(n=s.length,i=o.length,e=0,r=n<i?n:i;e<r;++e)if(s[e]!==o[e])return s[e]>o[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};Le.cosine=Le.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=Sce(n,PP(n,r)),n.precision=t,n.rounding=e,Tt(js==2||js==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};Le.cubeRoot=Le.cbrt=function(){var t,e,r,n,i,a,s,o,u,c,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(Wt=!1,a=l.s*An(l.s*l,1/3),!a||Math.abs(a)==1/0?(r=Kn(l.d),t=l.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=An(r,1/3),t=ui((t+1)/3)-(t%3==(t<0?-1:2)),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new d(r),n.s=l.s):n=new d(a.toString()),s=(t=d.precision)+3;;)if(o=n,u=o.times(o).times(o),c=u.plus(l),n=tn(c.plus(l).times(o),c.plus(u),s+2,1),Kn(o.d).slice(0,s)===(r=Kn(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(Tt(o,t+1,0),o.times(o).times(o).eq(l))){n=o;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Tt(n,t+1,1),e=!n.times(n).times(n).eq(l));break}return Wt=!0,Tt(n,t,d.rounding,e)};Le.decimalPlaces=Le.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-ui(this.e/Ot))*Ot,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};Le.dividedBy=Le.div=function(t){return tn(this,new this.constructor(t))};Le.dividedToIntegerBy=Le.divToInt=function(t){var e=this,r=e.constructor;return Tt(tn(e,new r(t),0,1,1),r.precision,r.rounding)};Le.equals=Le.eq=function(t){return this.cmp(t)===0};Le.floor=function(){return Tt(new this.constructor(this),this.e+1,3)};Le.greaterThan=Le.gt=function(t){return this.cmp(t)>0};Le.greaterThanOrEqualTo=Le.gte=function(t){var e=this.cmp(t);return e==1||e===0};Le.hyperbolicCosine=Le.cosh=function(){var t,e,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,i<32?(t=Math.ceil(i/3),e=(1/Sy(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=Pl(s,1,a.times(e),new s(1),!0);for(var u,c=t,l=new s(8);c--;)u=a.times(a),a=o.minus(u.times(l.minus(u.times(l))));return Tt(a,s.precision=r,s.rounding=n,!0)};Le.hyperbolicSine=Le.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Pl(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Sy(5,t)),i=Pl(a,2,i,i,!0);for(var s,o=new a(5),u=new a(16),c=new a(20);t--;)s=i.times(i),i=i.times(o.plus(s.times(u.times(s).plus(c))))}return a.precision=e,a.rounding=r,Tt(i,e,r,!0)};Le.hyperbolicTangent=Le.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,tn(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};Le.inverseCosine=Le.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?e.isNeg()?Ia(r,i,a):new r(0):new r(NaN):e.isZero()?Ia(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=Ia(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))};Le.inverseHyperbolicCosine=Le.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Wt=!1,r=r.times(r).minus(1).sqrt().plus(r),Wt=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};Le.inverseHyperbolicSine=Le.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Wt=!1,r=r.times(r).plus(1).sqrt().plus(r),Wt=!0,n.precision=t,n.rounding=e,r.ln())};Le.inverseHyperbolicTangent=Le.atanh=function(){var t,e,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):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Tt(new a(i),t,e,!0):(a.precision=r=n-i.e,i=tn(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)};Le.inverseSine=Le.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,e!==-1?e===0?(t=Ia(a,r+4,n).times(.5),t.s=i.s,t):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)))};Le.inverseTangent=Le.atan=function(){var t,e,r,n,i,a,s,o,u,c=this,l=c.constructor,d=l.precision,f=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&d+4<=t_)return s=Ia(l,d+4,f).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(d+4<=t_)return s=Ia(l,d+4,f).times(.5),s.s=c.s,s}for(l.precision=o=d+10,l.rounding=1,r=Math.min(28,o/Ot+2|0),t=r;t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Wt=!1,e=Math.ceil(o/Ot),n=1,u=c.times(c),s=new l(c),i=c;t!==-1;)if(i=i.times(u),a=s.minus(i.div(n+=2)),i=i.times(u),s=a.plus(i.div(n+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===a.d[t]&&t--;);return r&&(s=s.times(2<<r-1)),Wt=!0,Tt(s,l.precision=d,l.rounding=f,!0)};Le.isFinite=function(){return!!this.d};Le.isInteger=Le.isInt=function(){return!!this.d&&ui(this.e/Ot)>this.d.length-2};Le.isNaN=function(){return!this.s};Le.isNegative=Le.isNeg=function(){return this.s<0};Le.isPositive=Le.isPos=function(){return this.s>0};Le.isZero=function(){return!!this.d&&this.d[0]===0};Le.lessThan=Le.lt=function(t){return this.cmp(t)<0};Le.lessThanOrEqualTo=Le.lte=function(t){return this.cmp(t)<1};Le.logarithm=Le.log=function(t){var e,r,n,i,a,s,o,u,c=this,l=c.constructor,d=l.precision,f=l.rounding,h=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new l(r&&!r[0]?-1/0:c.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(Wt=!1,o=d+h,s=Ao(c,o),n=e?t0(l,o+10):Ao(t,o),u=tn(s,n,o,1),Nh(u.d,i=d,f))do if(o+=10,s=Ao(c,o),n=e?t0(l,o+10):Ao(t,o),u=tn(s,n,o,1),!a){+Kn(u.d).slice(i+1,i+15)+1==1e14&&(u=Tt(u,d+1,0));break}while(Nh(u.d,i+=10,f));return Wt=!0,Tt(u,d,f)};Le.minus=Le.sub=function(t){var e,r,n,i,a,s,o,u,c,l,d,f,h=this,p=h.constructor;if(t=new p(t),!h.d||!t.d)return!h.s||!t.s?t=new p(NaN):h.d?t.s=-t.s:t=new p(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(c=h.d,f=t.d,o=p.precision,u=p.rounding,!c[0]||!f[0]){if(f[0])t.s=-t.s;else if(c[0])t=new p(h);else return new p(u===3?-0:0);return Wt?Tt(t,o,u):t}if(r=ui(t.e/Ot),l=ui(h.e/Ot),c=c.slice(),a=l-r,a){for(d=a<0,d?(e=c,a=-a,s=f.length):(e=f,r=l,s=c.length),n=Math.max(Math.ceil(o/Ot),s)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=f.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(c[n]!=f[n]){d=c[n]<f[n];break}a=0}for(d&&(e=c,c=f,f=e,t.s=-t.s),s=c.length,n=f.length-s;n>0;--n)c[s++]=0;for(n=f.length;n>a;){if(c[--n]<f[n]){for(i=n;i&&c[--i]===0;)c[i]=Ba-1;--c[i],c[n]+=Ba}c[n]-=f[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=Ey(c,r),Wt?Tt(t,o,u):t):new p(u===3?-0:0)};Le.modulo=Le.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Tt(new n(r),n.precision,n.rounding):(Wt=!1,n.modulo==9?(e=tn(r,t.abs(),0,3,1),e.s*=t.s):e=tn(r,t,0,n.modulo,1),e=e.times(t),Wt=!0,r.minus(e))};Le.naturalExponential=Le.exp=function(){return r_(this)};Le.naturalLogarithm=Le.ln=function(){return Ao(this)};Le.negated=Le.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Tt(t)};Le.plus=Le.add=function(t){var e,r,n,i,a,s,o,u,c,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(c=d.d,l=t.d,o=f.precision,u=f.rounding,!c[0]||!l[0])return l[0]||(t=new f(d)),Wt?Tt(t,o,u):t;if(a=ui(d.e/Ot),n=ui(t.e/Ot),c=c.slice(),i=a-n,i){for(i<0?(r=c,i=-i,s=l.length):(r=l,n=a,s=c.length),a=Math.ceil(o/Ot),s=a>s?a+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=c.length,i=l.length,s-i<0&&(i=s,r=l,l=c,c=r),e=0;i;)e=(c[--i]=c[i]+l[i]+e)/Ba|0,c[i]%=Ba;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return t.d=c,t.e=Ey(c,n),Wt?Tt(t,o,u):t};Le.precision=Le.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Yo+t);return r.d?(e=MP(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};Le.round=function(){var t=this,e=t.constructor;return Tt(new e(t),t.e+1,e.rounding)};Le.sine=Le.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=Dce(n,PP(n,r)),n.precision=t,n.rounding=e,Tt(js>2?r.neg():r,t,e,!0)):new n(NaN)};Le.squareRoot=Le.sqrt=function(){var t,e,r,n,i,a,s=this,o=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!o||!o[0])return new l(!c||c<0&&(!o||o[0])?NaN:o?s:1/0);for(Wt=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=Kn(o),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=ui((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(c.toString()),r=(u=l.precision)+3;;)if(a=n,n=a.plus(tn(s,a,r+2,1)).times(.5),Kn(a.d).slice(0,r)===(e=Kn(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Tt(a,u+1,0),a.times(a).eq(s))){n=a;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Tt(n,u+1,1),t=!n.times(n).eq(s));break}return Wt=!0,Tt(n,u,l.rounding,t)};Le.tangent=Le.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=tn(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Tt(js==2||js==4?r.neg():r,t,e,!0)):new n(NaN)};Le.times=Le.mul=function(t){var e,r,n,i,a,s,o,u,c,l=this,d=l.constructor,f=l.d,h=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(r=ui(l.e/Ot)+ui(t.e/Ot),u=f.length,c=h.length,u<c&&(a=f,f=h,h=a,s=u,u=c,c=s),a=[],s=u+c,n=s;n--;)a.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)o=a[i]+h[n]*f[i-n-1]+e,a[i--]=o%Ba|0,e=o/Ba|0;a[i]=(a[i]+e)%Ba|0}for(;!a[--s];)a.pop();return e?++r:a.shift(),t.d=a,t.e=Ey(a,r),Wt?Tt(t,d.precision,d.rounding):t};Le.toBinary=function(t,e){return zx(this,2,t,e)};Le.toDecimalPlaces=Le.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Mi(t,0,nu),e===void 0?e=n.rounding:Mi(e,0,8),Tt(r,t+r.e+1,e))};Le.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ys(n,!0):(Mi(t,0,nu),e===void 0?e=i.rounding:Mi(e,0,8),n=Tt(new i(n),t+1,e),r=ys(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};Le.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=ys(i):(Mi(t,0,nu),e===void 0?e=a.rounding:Mi(e,0,8),n=Tt(new a(i),t+i.e+1,e),r=ys(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};Le.toFraction=function(t){var e,r,n,i,a,s,o,u,c,l,d,f,h=this,p=h.d,m=h.constructor;if(!p)return new m(h);if(c=r=new m(1),n=u=new m(0),e=new m(n),a=e.e=MP(p)-h.e-1,s=a%Ot,e.d[0]=An(10,s<0?Ot+s:s),t==null)t=a>0?e:c;else{if(o=new m(t),!o.isInt()||o.lt(c))throw Error(Yo+o);t=o.gt(e)?a>0?e:c:o}for(Wt=!1,o=new m(Kn(p)),l=m.precision,m.precision=a=p.length*Ot*2;d=tn(o,e,0,1,1),i=r.plus(d.times(n)),i.cmp(t)!=1;)r=n,n=i,i=c,c=u.plus(d.times(i)),u=i,i=e,e=o.minus(d.times(i)),o=i;return i=tn(t.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=h.s,f=tn(c,n,a,1).minus(h).abs().cmp(tn(u,r,a,1).minus(h).abs())<1?[c,n]:[u,r],m.precision=l,Wt=!0,f};Le.toHexadecimal=Le.toHex=function(t,e){return zx(this,16,t,e)};Le.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:Mi(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(Wt=!1,r=tn(r,t,0,e,1).times(t),Wt=!0,Tt(r)):(t.s=r.s,r=t),r};Le.toNumber=function(){return+this};Le.toOctal=function(t,e){return zx(this,8,t,e)};Le.toPower=Le.pow=function(t){var e,r,n,i,a,s,o=this,u=o.constructor,c=+(t=new u(t));if(!o.d||!t.d||!o.d[0]||!t.d[0])return new u(An(+o,c));if(o=new u(o),o.eq(1))return o;if(n=u.precision,a=u.rounding,t.eq(1))return Tt(o,n,a);if(e=ui(t.e/Ot),e>=t.d.length-1&&(r=c<0?-c:c)<=xce)return i=kP(u,o,r,n),t.s<0?new u(1).div(i):Tt(i,n,a);if(s=o.s,s<0){if(e<t.d.length-1)return new u(NaN);if(t.d[e]&1||(s=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=s,o}return r=An(+o,c),e=r==0||!isFinite(r)?ui(c*(Math.log("0."+Kn(o.d))/Math.LN10+o.e+1)):new u(r+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(Wt=!1,u.rounding=o.s=1,r=Math.min(12,(e+"").length),i=r_(t.times(Ao(o,n+r)),n),i.d&&(i=Tt(i,n+5,1),Nh(i.d,n,a)&&(e=n+10,i=Tt(r_(t.times(Ao(o,e+r)),e),e+5,1),+Kn(i.d).slice(n+1,n+15)+1==1e14&&(i=Tt(i,n+1,0)))),i.s=s,Wt=!0,u.rounding=a,Tt(i,n,a))};Le.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ys(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Mi(t,1,nu),e===void 0?e=i.rounding:Mi(e,0,8),n=Tt(new i(n),t,e),r=ys(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};Le.toSignificantDigits=Le.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Mi(t,1,nu),e===void 0?e=n.rounding:Mi(e,0,8)),Tt(new n(r),t,e)};Le.toString=function(){var t=this,e=t.constructor,r=ys(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};Le.truncated=Le.trunc=function(){return Tt(new this.constructor(this),this.e+1,1)};Le.valueOf=Le.toJSON=function(){var t=this,e=t.constructor,r=ys(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function Kn(t){var e,r,n,i=t.length-1,a="",s=t[0];if(i>0){for(a+=s,e=1;e<i;e++)n=t[e]+"",r=Ot-n.length,r&&(a+=bo(r)),a+=n;s=t[e],n=s+"",r=Ot-n.length,r&&(a+=bo(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}function Mi(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Yo+t)}function Nh(t,e,r,n){var i,a,s,o;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=Ot,i=0):(i=Math.ceil((e+1)/Ot),e%=Ot),a=An(10,Ot-e),o=t[i]%a|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),s=r<4&&o==99999||r>3&&o==49999||o==5e4||o==0):s=(r<4&&o+1==a||r>3&&o+1==a/2)&&(t[i+1]/a/100|0)==An(10,e-2)-1||(o==a/2||o==0)&&(t[i+1]/a/100|0)==0:e<4?(e==0?o=o/1e3|0:e==1?o=o/100|0:e==2&&(o=o/10|0),s=(n||r<4)&&o==9999||!n&&r>3&&o==4999):s=((n||r<4)&&o+1==a||!n&&r>3&&o+1==a/2)&&(t[i+1]/a/1e3|0)==An(10,e-3)-1,s}function Um(t,e,r){for(var n,i=[0],a,s=0,o=t.length;s<o;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Qw.indexOf(t.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function Sce(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Sy(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=Pl(t,1,e.times(i),new t(1));for(var a=r;a--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=r,e}var tn=function(){function t(n,i,a){var s,o=0,u=n.length;for(n=n.slice();u--;)s=n[u]*i+o,n[u]=s%a|0,o=s/a|0;return o&&n.unshift(o),n}function e(n,i,a,s){var o,u;if(a!=s)u=a>s?1:-1;else for(o=u=0;o<a;o++)if(n[o]!=i[o]){u=n[o]>i[o]?1:-1;break}return u}function r(n,i,a,s){for(var o=0;a--;)n[a]-=o,o=n[a]<i[a]?1:0,n[a]=o*s+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,s,o,u){var c,l,d,f,h,p,m,y,g,v,w,x,_,A,M,F,k,$,T,N,b=n.constructor,E=n.s==i.s?1:-1,D=n.d,C=i.d;if(!D||!D[0]||!C||!C[0])return new b(!n.s||!i.s||(D?C&&D[0]==C[0]:!C)?NaN:D&&D[0]==0||!C?E*0:E/0);for(u?(h=1,l=n.e-i.e):(u=Ba,h=Ot,l=ui(n.e/h)-ui(i.e/h)),T=C.length,k=D.length,g=new b(E),v=g.d=[],d=0;C[d]==(D[d]||0);d++);if(C[d]>(D[d]||0)&&l--,a==null?(A=a=b.precision,s=b.rounding):o?A=a+(n.e-i.e)+1:A=a,A<0)v.push(1),p=!0;else{if(A=A/h+2|0,d=0,T==1){for(f=0,C=C[0],A++;(d<k||f)&&A--;d++)M=f*u+(D[d]||0),v[d]=M/C|0,f=M%C|0;p=f||d<k}else{for(f=u/(C[0]+1)|0,f>1&&(C=t(C,f,u),D=t(D,f,u),T=C.length,k=D.length),F=T,w=D.slice(0,T),x=w.length;x<T;)w[x++]=0;N=C.slice(),N.unshift(0),$=C[0],C[1]>=u/2&&++$;do f=0,c=e(C,w,T,x),c<0?(_=w[0],T!=x&&(_=_*u+(w[1]||0)),f=_/$|0,f>1?(f>=u&&(f=u-1),m=t(C,f,u),y=m.length,x=w.length,c=e(m,w,y,x),c==1&&(f--,r(m,T<y?N:C,y,u))):(f==0&&(c=f=1),m=C.slice()),y=m.length,y<x&&m.unshift(0),r(w,m,x,u),c==-1&&(x=w.length,c=e(C,w,T,x),c<1&&(f++,r(w,T<x?N:C,x,u))),x=w.length):c===0&&(f++,w=[0]),v[d++]=f,c&&w[0]?w[x++]=D[F]||0:(w=[D[F]],x=1);while((F++<k||w[0]!==void 0)&&A--);p=w[0]!==void 0}v[0]||v.shift()}if(h==1)g.e=l,AP=p;else{for(d=1,f=v[0];f>=10;f/=10)d++;g.e=d+l*h-1,Tt(g,o?a+g.e+1:a,s,p)}return g}}();function Tt(t,e,r,n){var i,a,s,o,u,c,l,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,o=d[0];o>=10;o/=10)i++;if(a=e-i,a<0)a+=Ot,s=e,l=d[f=0],u=l/An(10,i-s-1)%10|0;else if(f=Math.ceil((a+1)/Ot),o=d.length,f>=o)if(n){for(;o++<=f;)d.push(0);l=u=0,i=1,a%=Ot,s=a-Ot+1}else break e;else{for(l=o=d[f],i=1;o>=10;o/=10)i++;a%=Ot,s=a-Ot+i,u=s<0?0:l/An(10,i-s-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(s<0?l:l%An(10,i-s-1)),c=r<4?(u||n)&&(r==0||r==(t.s<0?3:2)):u>5||u==5&&(r==4||n||r==6&&(a>0?s>0?l/An(10,i-s):0:d[f-1])%10&1||r==(t.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=t.e+1,d[0]=An(10,(Ot-e%Ot)%Ot),t.e=-e||0):d[0]=t.e=0,t;if(a==0?(d.length=f,o=1,f--):(d.length=f+1,o=An(10,Ot-a),d[f]=s>0?(l/An(10,i-s)%An(10,s)|0)*o:0),c)for(;;)if(f==0){for(a=1,s=d[0];s>=10;s/=10)a++;for(s=d[0]+=o,o=1;s>=10;s/=10)o++;a!=o&&(t.e++,d[0]==Ba&&(d[0]=1));break}else{if(d[f]+=o,d[f]!=Ba)break;d[f--]=0,o=1}for(a=d.length;d[--a]===0;)d.pop()}return Wt&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function ys(t,e,r){if(!t.isFinite())return FP(t);var n,i=t.e,a=Kn(t.d),s=a.length;return e?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+bo(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+bo(-i-1)+a,r&&(n=r-s)>0&&(a+=bo(n))):i>=s?(a+=bo(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+bo(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=bo(n))),a}function Ey(t,e){var r=t[0];for(e*=Ot;r>=10;r/=10)e++;return e}function t0(t,e,r){if(e>Ece)throw Wt=!0,r&&(t.precision=r),Error(NP);return Tt(new t(Qg),e,1,!0)}function Ia(t,e,r){if(e>t_)throw Error(NP);return Tt(new t(e0),e,r,!0)}function MP(t){var e=t.length-1,r=e*Ot+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function bo(t){for(var e="";t--;)e+="0";return e}function kP(t,e,r,n){var i,a=new t(1),s=Math.ceil(n/Ot+4);for(Wt=!1;;){if(r%2&&(a=a.times(e),l6(a.d,s)&&(i=!0)),r=ui(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),l6(e.d,s)}return Wt=!0,a}function c6(t){return t.d[t.d.length-1]&1}function RP(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;)if(n=new t(e[a]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function r_(t,e){var r,n,i,a,s,o,u,c=0,l=0,d=0,f=t.constructor,h=f.rounding,p=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(Wt=!1,u=p):u=e,o=new f(.03125);t.e>-2;)t=t.times(o),d+=5;for(n=Math.log(An(2,d))/Math.LN10*2+5|0,u+=n,r=a=s=new f(1),f.precision=u;;){if(a=Tt(a.times(t),u,1),r=r.times(++l),o=s.plus(tn(a,r,u,1)),Kn(o.d).slice(0,u)===Kn(s.d).slice(0,u)){for(i=d;i--;)s=Tt(s.times(s),u,1);if(e==null)if(c<3&&Nh(s.d,u-n,h,c))f.precision=u+=10,r=a=o=new f(1),l=0,c++;else return Tt(s,f.precision=p,h,Wt=!0);else return f.precision=p,s}s=o}}function Ao(t,e){var r,n,i,a,s,o,u,c,l,d,f,h=1,p=10,m=t,y=m.d,g=m.constructor,v=g.rounding,w=g.precision;if(m.s<0||!y||!y[0]||!m.e&&y[0]==1&&y.length==1)return new g(y&&!y[0]?-1/0:m.s!=1?NaN:y?0:m);if(e==null?(Wt=!1,l=w):l=e,g.precision=l+=p,r=Kn(y),n=r.charAt(0),Math.abs(a=m.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(t),r=Kn(m.d),n=r.charAt(0),h++;a=m.e,n>1?(m=new g("0."+r),a++):m=new g(n+"."+r.slice(1))}else return c=t0(g,l+2,w).times(a+""),m=Ao(new g(n+"."+r.slice(1)),l-p).plus(c),g.precision=w,e==null?Tt(m,w,v,Wt=!0):m;for(d=m,u=s=m=tn(m.minus(1),m.plus(1),l,1),f=Tt(m.times(m),l,1),i=3;;){if(s=Tt(s.times(f),l,1),c=u.plus(tn(s,new g(i),l,1)),Kn(c.d).slice(0,l)===Kn(u.d).slice(0,l))if(u=u.times(2),a!==0&&(u=u.plus(t0(g,l+2,w).times(a+""))),u=tn(u,new g(h),l,1),e==null)if(Nh(u.d,l-p,v,o))g.precision=l+=p,c=s=m=tn(d.minus(1),d.plus(1),l,1),f=Tt(m.times(m),l,1),i=o=1;else return Tt(u,g.precision=w,v,Wt=!0);else return g.precision=w,u;u=c,i+=2}}function FP(t){return String(t.s*t.s/0)}function n_(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%Ot,r<0&&(n+=Ot),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Ot;n<i;)t.d.push(+e.slice(n,n+=Ot));e=e.slice(n),n=Ot-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),Wt&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Tce(t,e){var r,n,i,a,s,o,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),OP.test(e))return n_(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(wce.test(e))r=16,e=e.toLowerCase();else if(bce.test(e))r=2;else if(_ce.test(e))r=8;else throw Error(Yo+e);for(a=e.search(/p/i),a>0?(u=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),s=a>=0,n=t.constructor,s&&(e=e.replace(".",""),o=e.length,a=o-a,i=kP(n,new n(r),a,a*2)),c=Um(e,r,Ba),l=c.length-1,a=l;c[a]===0;--a)c.pop();return a<0?new n(t.s*0):(t.e=Ey(c,l),t.d=c,Wt=!1,s&&(t=tn(t,i,o*4)),u&&(t=t.times(Math.abs(u)<54?An(2,u):Jo.pow(2,u))),Wt=!0,t)}function Dce(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:Pl(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Sy(5,r)),e=Pl(t,2,e,e);for(var i,a=new t(5),s=new t(16),o=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(s.times(i).minus(o))));return e}function Pl(t,e,r,n,i){var a,s,o,u,c=t.precision,l=Math.ceil(c/Ot);for(Wt=!1,u=r.times(r),o=new t(n);;){if(s=tn(o.times(u),new t(e++*e++),c,1),o=i?n.plus(s):n.minus(s),n=tn(s.times(u),new t(e++*e++),c,1),s=o.plus(n),s.d[l]!==void 0){for(a=l;s.d[a]===o.d[a]&&a--;);if(a==-1)break}a=o,o=n,n=s,s=a}return Wt=!0,s.d.length=l+1,s}function Sy(t,e){for(var r=t;--e;)r*=t;return r}function PP(t,e){var r,n=e.s<0,i=Ia(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return js=n?4:1,e;if(r=e.divToInt(i),r.isZero())js=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return js=c6(r)?n?2:3:n?4:1,e;js=c6(r)?n?1:4:n?3:2}return e.minus(i).abs()}function zx(t,e,r,n){var i,a,s,o,u,c,l,d,f,h=t.constructor,p=r!==void 0;if(p?(Mi(r,1,nu),n===void 0?n=h.rounding:Mi(n,0,8)):(r=h.precision,n=h.rounding),!t.isFinite())l=FP(t);else{for(l=ys(t),s=l.indexOf("."),p?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new h(1),f.e=l.length-s,f.d=Um(ys(f),10,i),f.e=f.d.length),d=Um(l,10,i),a=u=d.length;d[--u]==0;)d.pop();if(!d[0])l=p?"0p+0":"0";else{if(s<0?a--:(t=new h(t),t.d=d,t.e=a,t=tn(t,f,r,n,0,i),d=t.d,a=t.e,c=AP),s=d[r],o=i/2,c=c||d[r+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(t.s<0?3:2)):s>o||s===o&&(n===4||c||n===6&&d[r-1]&1||n===(t.s<0?8:7)),d.length=r,c)for(;++d[--r]>i-1;)d[r]=0,r||(++a,d.unshift(1));for(u=d.length;!d[u-1];--u);for(s=0,l="";s<u;s++)l+=Qw.charAt(d[s]);if(p){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(d=Um(l,i,e),u=d.length;!d[u-1];--u);for(s=1,l="1.";s<u;s++)l+=Qw.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function l6(t,e){if(t.length>e)return t.length=e,!0}function Ace(t){return new this(t).abs()}function Nce(t){return new this(t).acos()}function Ice(t){return new this(t).acosh()}function Cce(t,e){return new this(t).plus(e)}function Oce(t){return new this(t).asin()}function Mce(t){return new this(t).asinh()}function kce(t){return new this(t).atan()}function Rce(t){return new this(t).atanh()}function Fce(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=Ia(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Ia(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Ia(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(tn(t,e,a,1)),e=Ia(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(tn(t,e,a,1)),r}function Pce(t){return new this(t).cbrt()}function Bce(t){return Tt(t=new this(t),t.e+1,2)}function Lce(t,e,r){return new this(t).clamp(e,r)}function jce(t){if(!t||typeof t!="object")throw Error(xy+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,nu,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,Xw,"maxE",0,Xw,"minE",-9e15,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=e_[r]),(n=t[r])!==void 0)if(ui(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(Yo+r+": "+n);if(r="crypto",i&&(this[r]=e_[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(IP);else this[r]=!1;else throw Error(Yo+r+": "+n);return this}function $ce(t){return new this(t).cos()}function Uce(t){return new this(t).cosh()}function BP(t){var e,r,n;function i(a){var s,o,u,c=this;if(!(c instanceof i))return new i(a);if(c.constructor=i,d6(a)){c.s=a.s,Wt?!a.d||a.e>i.maxE?(c.e=NaN,c.d=null):a.e<i.minE?(c.e=0,c.d=[0]):(c.e=a.e,c.d=a.d.slice()):(c.e=a.e,c.d=a.d?a.d.slice():a.d);return}if(u=typeof a,u==="number"){if(a===0){c.s=1/a<0?-1:1,c.e=0,c.d=[0];return}if(a<0?(a=-a,c.s=-1):c.s=1,a===~~a&&a<1e7){for(s=0,o=a;o>=10;o/=10)s++;Wt?s>i.maxE?(c.e=NaN,c.d=null):s<i.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[a]):(c.e=s,c.d=[a]);return}else if(a*0!==0){a||(c.s=NaN),c.e=NaN,c.d=null;return}return n_(c,a.toString())}else if(u!=="string")throw Error(Yo+a);return(o=a.charCodeAt(0))===45?(a=a.slice(1),c.s=-1):(o===43&&(a=a.slice(1)),c.s=1),OP.test(a)?n_(c,a):Tce(c,a)}if(i.prototype=Le,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=jce,i.clone=BP,i.isDecimal=d6,i.abs=Ace,i.acos=Nce,i.acosh=Ice,i.add=Cce,i.asin=Oce,i.asinh=Mce,i.atan=kce,i.atanh=Rce,i.atan2=Fce,i.cbrt=Pce,i.ceil=Bce,i.clamp=Lce,i.cos=$ce,i.cosh=Uce,i.div=zce,i.exp=qce,i.floor=Vce,i.hypot=Zce,i.ln=Hce,i.log=Wce,i.log10=Jce,i.log2=Yce,i.max=Kce,i.min=Gce,i.mod=Xce,i.mul=Qce,i.pow=ele,i.random=tle,i.round=rle,i.sign=nle,i.sin=ile,i.sinh=ale,i.sqrt=sle,i.sub=ole,i.sum=ule,i.tan=cle,i.tanh=lle,i.trunc=dle,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function zce(t,e){return new this(t).div(e)}function qce(t){return new this(t).exp()}function Vce(t){return Tt(t=new this(t),t.e+1,3)}function Zce(){var t,e,r=new this(0);for(Wt=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return Wt=!0,new this(1/0);r=e}return Wt=!0,r.sqrt()}function d6(t){return t instanceof Jo||t&&t.toStringTag===CP||!1}function Hce(t){return new this(t).ln()}function Wce(t,e){return new this(t).log(e)}function Yce(t){return new this(t).log(2)}function Jce(t){return new this(t).log(10)}function Kce(){return RP(this,arguments,"lt")}function Gce(){return RP(this,arguments,"gt")}function Xce(t,e){return new this(t).mod(e)}function Qce(t,e){return new this(t).mul(e)}function ele(t,e){return new this(t).pow(e)}function tle(t){var e,r,n,i,a=0,s=new this(1),o=[];if(t===void 0?t=this.precision:Mi(t,1,nu),n=Math.ceil(t/Ot),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:o[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);a<n;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(o.push(i%1e7),a+=4);a=n/4}else throw Error(IP);else for(;a<n;)o[a++]=Math.random()*1e7|0;for(n=o[--a],t%=Ot,n&&t&&(i=An(10,Ot-t),o[a]=(n/i|0)*i);o[a]===0;a--)o.pop();if(a<0)r=0,o=[0];else{for(r=-1;o[0]===0;r-=Ot)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<Ot&&(r-=Ot-n)}return s.e=r,s.d=o,s}function rle(t){return Tt(t=new this(t),t.e+1,this.rounding)}function nle(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function ile(t){return new this(t).sin()}function ale(t){return new this(t).sinh()}function sle(t){return new this(t).sqrt()}function ole(t,e){return new this(t).sub(e)}function ule(){var t=0,e=arguments,r=new this(e[t]);for(Wt=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return Wt=!0,Tt(r,this.precision,this.rounding)}function cle(t){return new this(t).tan()}function lle(t){return new this(t).tanh()}function dle(t){return Tt(t=new this(t),t.e+1,1)}Le[Symbol.for("nodejs.util.inspect.custom")]=Le.toString;Le[Symbol.toStringTag]="Decimal";var Jo=Le.constructor=BP(e_);Qg=new Jo(Qg);e0=new Jo(e0);var fle="BigNumber",hle=["?on","config"],ple=se(fle,hle,t=>{var{on:e,config:r}=t,n=Jo.clone({precision:r.precision,modulo:Jo.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(i){return new n(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});const ri=Math.cosh||function(t){return Math.abs(t)<1e-9?1-t:(Math.exp(t)+Math.exp(-t))*.5},Qi=Math.sinh||function(t){return Math.abs(t)<1e-9?t:(Math.exp(t)-Math.exp(-t))*.5},mle=function(t){const e=Math.PI/4;if(-e>t||t>e)return Math.cos(t)-1;const r=t*t;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},I1=function(t,e){return t=Math.abs(t),e=Math.abs(e),t<e&&([t,e]=[e,t]),t<1e8?Math.sqrt(t*t+e*e):(e/=t,t*Math.sqrt(1+e*e))},xc=function(){throw SyntaxError("Invalid Param")};function C1(t,e){const r=Math.abs(t),n=Math.abs(e);return t===0?Math.log(n):e===0?Math.log(r):r<3e3&&n<3e3?Math.log(t*t+e*e)*.5:(t=t*.5,e=e*.5,.5*Math.log(t*t+e*e)+Math.LN2)}const gle={re:0,im:0},yu=function(t,e){const r=gle;if(t==null)r.re=r.im=0;else if(e!==void 0)r.re=t,r.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)r.re=t.re,r.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return ke.INFINITY;r.re=t.abs*Math.cos(t.arg),r.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return ke.INFINITY;r.re=t.r*Math.cos(t.phi),r.im=t.r*Math.sin(t.phi)}else t.length===2?(r.re=t[0],r.im=t[1]):xc();break;case"string":r.im=r.re=0;const n=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let i=1,a=0;n===null&&xc();for(let s=0;s<n.length;s++){const o=n[s];o===" "||o===" "||o===`
1052
+ */var Xw=9e15,nu=1e9,Qw="0123456789abcdef",Qg="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",e0="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",e_={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:Xw,crypto:!1},AP,js,Wt=!0,xy="[DecimalError] ",Yo=xy+"Invalid argument: ",NP=xy+"Precision limit exceeded",IP=xy+"crypto unavailable",CP="[object Decimal]",ui=Math.floor,An=Math.pow,bce=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,wce=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,_ce=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,OP=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ba=1e7,Ot=7,xce=9007199254740991,Ece=Qg.length-1,t_=e0.length-1,Le={toStringTag:CP};Le.absoluteValue=Le.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Tt(t)};Le.ceil=function(){return Tt(new this.constructor(this),this.e+1,2)};Le.clampedTo=Le.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(Yo+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};Le.comparedTo=Le.cmp=function(t){var e,r,n,i,a=this,s=a.d,o=(t=new a.constructor(t)).d,u=a.s,c=t.s;if(!s||!o)return!u||!c?NaN:u!==c?u:s===o?0:!s^u<0?1:-1;if(!s[0]||!o[0])return s[0]?u:o[0]?-c:0;if(u!==c)return u;if(a.e!==t.e)return a.e>t.e^u<0?1:-1;for(n=s.length,i=o.length,e=0,r=n<i?n:i;e<r;++e)if(s[e]!==o[e])return s[e]>o[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};Le.cosine=Le.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=Sce(n,PP(n,r)),n.precision=t,n.rounding=e,Tt(js==2||js==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};Le.cubeRoot=Le.cbrt=function(){var t,e,r,n,i,a,s,o,u,c,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(Wt=!1,a=l.s*An(l.s*l,1/3),!a||Math.abs(a)==1/0?(r=Jn(l.d),t=l.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=An(r,1/3),t=ui((t+1)/3)-(t%3==(t<0?-1:2)),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new d(r),n.s=l.s):n=new d(a.toString()),s=(t=d.precision)+3;;)if(o=n,u=o.times(o).times(o),c=u.plus(l),n=tn(c.plus(l).times(o),c.plus(u),s+2,1),Jn(o.d).slice(0,s)===(r=Jn(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(Tt(o,t+1,0),o.times(o).times(o).eq(l))){n=o;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Tt(n,t+1,1),e=!n.times(n).times(n).eq(l));break}return Wt=!0,Tt(n,t,d.rounding,e)};Le.decimalPlaces=Le.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-ui(this.e/Ot))*Ot,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};Le.dividedBy=Le.div=function(t){return tn(this,new this.constructor(t))};Le.dividedToIntegerBy=Le.divToInt=function(t){var e=this,r=e.constructor;return Tt(tn(e,new r(t),0,1,1),r.precision,r.rounding)};Le.equals=Le.eq=function(t){return this.cmp(t)===0};Le.floor=function(){return Tt(new this.constructor(this),this.e+1,3)};Le.greaterThan=Le.gt=function(t){return this.cmp(t)>0};Le.greaterThanOrEqualTo=Le.gte=function(t){var e=this.cmp(t);return e==1||e===0};Le.hyperbolicCosine=Le.cosh=function(){var t,e,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,i<32?(t=Math.ceil(i/3),e=(1/Sy(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=Pl(s,1,a.times(e),new s(1),!0);for(var u,c=t,l=new s(8);c--;)u=a.times(a),a=o.minus(u.times(l.minus(u.times(l))));return Tt(a,s.precision=r,s.rounding=n,!0)};Le.hyperbolicSine=Le.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Pl(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Sy(5,t)),i=Pl(a,2,i,i,!0);for(var s,o=new a(5),u=new a(16),c=new a(20);t--;)s=i.times(i),i=i.times(o.plus(s.times(u.times(s).plus(c))))}return a.precision=e,a.rounding=r,Tt(i,e,r,!0)};Le.hyperbolicTangent=Le.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,tn(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};Le.inverseCosine=Le.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?e.isNeg()?Ia(r,i,a):new r(0):new r(NaN):e.isZero()?Ia(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=Ia(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))};Le.inverseHyperbolicCosine=Le.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Wt=!1,r=r.times(r).minus(1).sqrt().plus(r),Wt=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};Le.inverseHyperbolicSine=Le.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Wt=!1,r=r.times(r).plus(1).sqrt().plus(r),Wt=!0,n.precision=t,n.rounding=e,r.ln())};Le.inverseHyperbolicTangent=Le.atanh=function(){var t,e,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):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Tt(new a(i),t,e,!0):(a.precision=r=n-i.e,i=tn(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)};Le.inverseSine=Le.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,e!==-1?e===0?(t=Ia(a,r+4,n).times(.5),t.s=i.s,t):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)))};Le.inverseTangent=Le.atan=function(){var t,e,r,n,i,a,s,o,u,c=this,l=c.constructor,d=l.precision,f=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&d+4<=t_)return s=Ia(l,d+4,f).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(d+4<=t_)return s=Ia(l,d+4,f).times(.5),s.s=c.s,s}for(l.precision=o=d+10,l.rounding=1,r=Math.min(28,o/Ot+2|0),t=r;t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Wt=!1,e=Math.ceil(o/Ot),n=1,u=c.times(c),s=new l(c),i=c;t!==-1;)if(i=i.times(u),a=s.minus(i.div(n+=2)),i=i.times(u),s=a.plus(i.div(n+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===a.d[t]&&t--;);return r&&(s=s.times(2<<r-1)),Wt=!0,Tt(s,l.precision=d,l.rounding=f,!0)};Le.isFinite=function(){return!!this.d};Le.isInteger=Le.isInt=function(){return!!this.d&&ui(this.e/Ot)>this.d.length-2};Le.isNaN=function(){return!this.s};Le.isNegative=Le.isNeg=function(){return this.s<0};Le.isPositive=Le.isPos=function(){return this.s>0};Le.isZero=function(){return!!this.d&&this.d[0]===0};Le.lessThan=Le.lt=function(t){return this.cmp(t)<0};Le.lessThanOrEqualTo=Le.lte=function(t){return this.cmp(t)<1};Le.logarithm=Le.log=function(t){var e,r,n,i,a,s,o,u,c=this,l=c.constructor,d=l.precision,f=l.rounding,h=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new l(r&&!r[0]?-1/0:c.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(Wt=!1,o=d+h,s=Ao(c,o),n=e?t0(l,o+10):Ao(t,o),u=tn(s,n,o,1),Nh(u.d,i=d,f))do if(o+=10,s=Ao(c,o),n=e?t0(l,o+10):Ao(t,o),u=tn(s,n,o,1),!a){+Jn(u.d).slice(i+1,i+15)+1==1e14&&(u=Tt(u,d+1,0));break}while(Nh(u.d,i+=10,f));return Wt=!0,Tt(u,d,f)};Le.minus=Le.sub=function(t){var e,r,n,i,a,s,o,u,c,l,d,f,h=this,p=h.constructor;if(t=new p(t),!h.d||!t.d)return!h.s||!t.s?t=new p(NaN):h.d?t.s=-t.s:t=new p(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(c=h.d,f=t.d,o=p.precision,u=p.rounding,!c[0]||!f[0]){if(f[0])t.s=-t.s;else if(c[0])t=new p(h);else return new p(u===3?-0:0);return Wt?Tt(t,o,u):t}if(r=ui(t.e/Ot),l=ui(h.e/Ot),c=c.slice(),a=l-r,a){for(d=a<0,d?(e=c,a=-a,s=f.length):(e=f,r=l,s=c.length),n=Math.max(Math.ceil(o/Ot),s)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=f.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(c[n]!=f[n]){d=c[n]<f[n];break}a=0}for(d&&(e=c,c=f,f=e,t.s=-t.s),s=c.length,n=f.length-s;n>0;--n)c[s++]=0;for(n=f.length;n>a;){if(c[--n]<f[n]){for(i=n;i&&c[--i]===0;)c[i]=Ba-1;--c[i],c[n]+=Ba}c[n]-=f[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=Ey(c,r),Wt?Tt(t,o,u):t):new p(u===3?-0:0)};Le.modulo=Le.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Tt(new n(r),n.precision,n.rounding):(Wt=!1,n.modulo==9?(e=tn(r,t.abs(),0,3,1),e.s*=t.s):e=tn(r,t,0,n.modulo,1),e=e.times(t),Wt=!0,r.minus(e))};Le.naturalExponential=Le.exp=function(){return r_(this)};Le.naturalLogarithm=Le.ln=function(){return Ao(this)};Le.negated=Le.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Tt(t)};Le.plus=Le.add=function(t){var e,r,n,i,a,s,o,u,c,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(c=d.d,l=t.d,o=f.precision,u=f.rounding,!c[0]||!l[0])return l[0]||(t=new f(d)),Wt?Tt(t,o,u):t;if(a=ui(d.e/Ot),n=ui(t.e/Ot),c=c.slice(),i=a-n,i){for(i<0?(r=c,i=-i,s=l.length):(r=l,n=a,s=c.length),a=Math.ceil(o/Ot),s=a>s?a+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=c.length,i=l.length,s-i<0&&(i=s,r=l,l=c,c=r),e=0;i;)e=(c[--i]=c[i]+l[i]+e)/Ba|0,c[i]%=Ba;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return t.d=c,t.e=Ey(c,n),Wt?Tt(t,o,u):t};Le.precision=Le.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Yo+t);return r.d?(e=MP(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};Le.round=function(){var t=this,e=t.constructor;return Tt(new e(t),t.e+1,e.rounding)};Le.sine=Le.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=Dce(n,PP(n,r)),n.precision=t,n.rounding=e,Tt(js>2?r.neg():r,t,e,!0)):new n(NaN)};Le.squareRoot=Le.sqrt=function(){var t,e,r,n,i,a,s=this,o=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!o||!o[0])return new l(!c||c<0&&(!o||o[0])?NaN:o?s:1/0);for(Wt=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=Jn(o),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=ui((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(c.toString()),r=(u=l.precision)+3;;)if(a=n,n=a.plus(tn(s,a,r+2,1)).times(.5),Jn(a.d).slice(0,r)===(e=Jn(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Tt(a,u+1,0),a.times(a).eq(s))){n=a;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Tt(n,u+1,1),t=!n.times(n).eq(s));break}return Wt=!0,Tt(n,u,l.rounding,t)};Le.tangent=Le.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=tn(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Tt(js==2||js==4?r.neg():r,t,e,!0)):new n(NaN)};Le.times=Le.mul=function(t){var e,r,n,i,a,s,o,u,c,l=this,d=l.constructor,f=l.d,h=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(r=ui(l.e/Ot)+ui(t.e/Ot),u=f.length,c=h.length,u<c&&(a=f,f=h,h=a,s=u,u=c,c=s),a=[],s=u+c,n=s;n--;)a.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)o=a[i]+h[n]*f[i-n-1]+e,a[i--]=o%Ba|0,e=o/Ba|0;a[i]=(a[i]+e)%Ba|0}for(;!a[--s];)a.pop();return e?++r:a.shift(),t.d=a,t.e=Ey(a,r),Wt?Tt(t,d.precision,d.rounding):t};Le.toBinary=function(t,e){return zx(this,2,t,e)};Le.toDecimalPlaces=Le.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Mi(t,0,nu),e===void 0?e=n.rounding:Mi(e,0,8),Tt(r,t+r.e+1,e))};Le.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ys(n,!0):(Mi(t,0,nu),e===void 0?e=i.rounding:Mi(e,0,8),n=Tt(new i(n),t+1,e),r=ys(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};Le.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=ys(i):(Mi(t,0,nu),e===void 0?e=a.rounding:Mi(e,0,8),n=Tt(new a(i),t+i.e+1,e),r=ys(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};Le.toFraction=function(t){var e,r,n,i,a,s,o,u,c,l,d,f,h=this,p=h.d,m=h.constructor;if(!p)return new m(h);if(c=r=new m(1),n=u=new m(0),e=new m(n),a=e.e=MP(p)-h.e-1,s=a%Ot,e.d[0]=An(10,s<0?Ot+s:s),t==null)t=a>0?e:c;else{if(o=new m(t),!o.isInt()||o.lt(c))throw Error(Yo+o);t=o.gt(e)?a>0?e:c:o}for(Wt=!1,o=new m(Jn(p)),l=m.precision,m.precision=a=p.length*Ot*2;d=tn(o,e,0,1,1),i=r.plus(d.times(n)),i.cmp(t)!=1;)r=n,n=i,i=c,c=u.plus(d.times(i)),u=i,i=e,e=o.minus(d.times(i)),o=i;return i=tn(t.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=h.s,f=tn(c,n,a,1).minus(h).abs().cmp(tn(u,r,a,1).minus(h).abs())<1?[c,n]:[u,r],m.precision=l,Wt=!0,f};Le.toHexadecimal=Le.toHex=function(t,e){return zx(this,16,t,e)};Le.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:Mi(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(Wt=!1,r=tn(r,t,0,e,1).times(t),Wt=!0,Tt(r)):(t.s=r.s,r=t),r};Le.toNumber=function(){return+this};Le.toOctal=function(t,e){return zx(this,8,t,e)};Le.toPower=Le.pow=function(t){var e,r,n,i,a,s,o=this,u=o.constructor,c=+(t=new u(t));if(!o.d||!t.d||!o.d[0]||!t.d[0])return new u(An(+o,c));if(o=new u(o),o.eq(1))return o;if(n=u.precision,a=u.rounding,t.eq(1))return Tt(o,n,a);if(e=ui(t.e/Ot),e>=t.d.length-1&&(r=c<0?-c:c)<=xce)return i=kP(u,o,r,n),t.s<0?new u(1).div(i):Tt(i,n,a);if(s=o.s,s<0){if(e<t.d.length-1)return new u(NaN);if(t.d[e]&1||(s=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=s,o}return r=An(+o,c),e=r==0||!isFinite(r)?ui(c*(Math.log("0."+Jn(o.d))/Math.LN10+o.e+1)):new u(r+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(Wt=!1,u.rounding=o.s=1,r=Math.min(12,(e+"").length),i=r_(t.times(Ao(o,n+r)),n),i.d&&(i=Tt(i,n+5,1),Nh(i.d,n,a)&&(e=n+10,i=Tt(r_(t.times(Ao(o,e+r)),e),e+5,1),+Jn(i.d).slice(n+1,n+15)+1==1e14&&(i=Tt(i,n+1,0)))),i.s=s,Wt=!0,u.rounding=a,Tt(i,n,a))};Le.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ys(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Mi(t,1,nu),e===void 0?e=i.rounding:Mi(e,0,8),n=Tt(new i(n),t,e),r=ys(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};Le.toSignificantDigits=Le.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Mi(t,1,nu),e===void 0?e=n.rounding:Mi(e,0,8)),Tt(new n(r),t,e)};Le.toString=function(){var t=this,e=t.constructor,r=ys(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};Le.truncated=Le.trunc=function(){return Tt(new this.constructor(this),this.e+1,1)};Le.valueOf=Le.toJSON=function(){var t=this,e=t.constructor,r=ys(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function Jn(t){var e,r,n,i=t.length-1,a="",s=t[0];if(i>0){for(a+=s,e=1;e<i;e++)n=t[e]+"",r=Ot-n.length,r&&(a+=bo(r)),a+=n;s=t[e],n=s+"",r=Ot-n.length,r&&(a+=bo(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}function Mi(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Yo+t)}function Nh(t,e,r,n){var i,a,s,o;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=Ot,i=0):(i=Math.ceil((e+1)/Ot),e%=Ot),a=An(10,Ot-e),o=t[i]%a|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),s=r<4&&o==99999||r>3&&o==49999||o==5e4||o==0):s=(r<4&&o+1==a||r>3&&o+1==a/2)&&(t[i+1]/a/100|0)==An(10,e-2)-1||(o==a/2||o==0)&&(t[i+1]/a/100|0)==0:e<4?(e==0?o=o/1e3|0:e==1?o=o/100|0:e==2&&(o=o/10|0),s=(n||r<4)&&o==9999||!n&&r>3&&o==4999):s=((n||r<4)&&o+1==a||!n&&r>3&&o+1==a/2)&&(t[i+1]/a/1e3|0)==An(10,e-3)-1,s}function Um(t,e,r){for(var n,i=[0],a,s=0,o=t.length;s<o;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Qw.indexOf(t.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function Sce(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Sy(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=Pl(t,1,e.times(i),new t(1));for(var a=r;a--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=r,e}var tn=function(){function t(n,i,a){var s,o=0,u=n.length;for(n=n.slice();u--;)s=n[u]*i+o,n[u]=s%a|0,o=s/a|0;return o&&n.unshift(o),n}function e(n,i,a,s){var o,u;if(a!=s)u=a>s?1:-1;else for(o=u=0;o<a;o++)if(n[o]!=i[o]){u=n[o]>i[o]?1:-1;break}return u}function r(n,i,a,s){for(var o=0;a--;)n[a]-=o,o=n[a]<i[a]?1:0,n[a]=o*s+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,s,o,u){var c,l,d,f,h,p,m,y,g,v,w,x,_,A,M,F,k,$,T,N,b=n.constructor,E=n.s==i.s?1:-1,D=n.d,C=i.d;if(!D||!D[0]||!C||!C[0])return new b(!n.s||!i.s||(D?C&&D[0]==C[0]:!C)?NaN:D&&D[0]==0||!C?E*0:E/0);for(u?(h=1,l=n.e-i.e):(u=Ba,h=Ot,l=ui(n.e/h)-ui(i.e/h)),T=C.length,k=D.length,g=new b(E),v=g.d=[],d=0;C[d]==(D[d]||0);d++);if(C[d]>(D[d]||0)&&l--,a==null?(A=a=b.precision,s=b.rounding):o?A=a+(n.e-i.e)+1:A=a,A<0)v.push(1),p=!0;else{if(A=A/h+2|0,d=0,T==1){for(f=0,C=C[0],A++;(d<k||f)&&A--;d++)M=f*u+(D[d]||0),v[d]=M/C|0,f=M%C|0;p=f||d<k}else{for(f=u/(C[0]+1)|0,f>1&&(C=t(C,f,u),D=t(D,f,u),T=C.length,k=D.length),F=T,w=D.slice(0,T),x=w.length;x<T;)w[x++]=0;N=C.slice(),N.unshift(0),$=C[0],C[1]>=u/2&&++$;do f=0,c=e(C,w,T,x),c<0?(_=w[0],T!=x&&(_=_*u+(w[1]||0)),f=_/$|0,f>1?(f>=u&&(f=u-1),m=t(C,f,u),y=m.length,x=w.length,c=e(m,w,y,x),c==1&&(f--,r(m,T<y?N:C,y,u))):(f==0&&(c=f=1),m=C.slice()),y=m.length,y<x&&m.unshift(0),r(w,m,x,u),c==-1&&(x=w.length,c=e(C,w,T,x),c<1&&(f++,r(w,T<x?N:C,x,u))),x=w.length):c===0&&(f++,w=[0]),v[d++]=f,c&&w[0]?w[x++]=D[F]||0:(w=[D[F]],x=1);while((F++<k||w[0]!==void 0)&&A--);p=w[0]!==void 0}v[0]||v.shift()}if(h==1)g.e=l,AP=p;else{for(d=1,f=v[0];f>=10;f/=10)d++;g.e=d+l*h-1,Tt(g,o?a+g.e+1:a,s,p)}return g}}();function Tt(t,e,r,n){var i,a,s,o,u,c,l,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,o=d[0];o>=10;o/=10)i++;if(a=e-i,a<0)a+=Ot,s=e,l=d[f=0],u=l/An(10,i-s-1)%10|0;else if(f=Math.ceil((a+1)/Ot),o=d.length,f>=o)if(n){for(;o++<=f;)d.push(0);l=u=0,i=1,a%=Ot,s=a-Ot+1}else break e;else{for(l=o=d[f],i=1;o>=10;o/=10)i++;a%=Ot,s=a-Ot+i,u=s<0?0:l/An(10,i-s-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(s<0?l:l%An(10,i-s-1)),c=r<4?(u||n)&&(r==0||r==(t.s<0?3:2)):u>5||u==5&&(r==4||n||r==6&&(a>0?s>0?l/An(10,i-s):0:d[f-1])%10&1||r==(t.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=t.e+1,d[0]=An(10,(Ot-e%Ot)%Ot),t.e=-e||0):d[0]=t.e=0,t;if(a==0?(d.length=f,o=1,f--):(d.length=f+1,o=An(10,Ot-a),d[f]=s>0?(l/An(10,i-s)%An(10,s)|0)*o:0),c)for(;;)if(f==0){for(a=1,s=d[0];s>=10;s/=10)a++;for(s=d[0]+=o,o=1;s>=10;s/=10)o++;a!=o&&(t.e++,d[0]==Ba&&(d[0]=1));break}else{if(d[f]+=o,d[f]!=Ba)break;d[f--]=0,o=1}for(a=d.length;d[--a]===0;)d.pop()}return Wt&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function ys(t,e,r){if(!t.isFinite())return FP(t);var n,i=t.e,a=Jn(t.d),s=a.length;return e?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+bo(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+bo(-i-1)+a,r&&(n=r-s)>0&&(a+=bo(n))):i>=s?(a+=bo(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+bo(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=bo(n))),a}function Ey(t,e){var r=t[0];for(e*=Ot;r>=10;r/=10)e++;return e}function t0(t,e,r){if(e>Ece)throw Wt=!0,r&&(t.precision=r),Error(NP);return Tt(new t(Qg),e,1,!0)}function Ia(t,e,r){if(e>t_)throw Error(NP);return Tt(new t(e0),e,r,!0)}function MP(t){var e=t.length-1,r=e*Ot+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function bo(t){for(var e="";t--;)e+="0";return e}function kP(t,e,r,n){var i,a=new t(1),s=Math.ceil(n/Ot+4);for(Wt=!1;;){if(r%2&&(a=a.times(e),l6(a.d,s)&&(i=!0)),r=ui(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),l6(e.d,s)}return Wt=!0,a}function c6(t){return t.d[t.d.length-1]&1}function RP(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;)if(n=new t(e[a]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function r_(t,e){var r,n,i,a,s,o,u,c=0,l=0,d=0,f=t.constructor,h=f.rounding,p=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(Wt=!1,u=p):u=e,o=new f(.03125);t.e>-2;)t=t.times(o),d+=5;for(n=Math.log(An(2,d))/Math.LN10*2+5|0,u+=n,r=a=s=new f(1),f.precision=u;;){if(a=Tt(a.times(t),u,1),r=r.times(++l),o=s.plus(tn(a,r,u,1)),Jn(o.d).slice(0,u)===Jn(s.d).slice(0,u)){for(i=d;i--;)s=Tt(s.times(s),u,1);if(e==null)if(c<3&&Nh(s.d,u-n,h,c))f.precision=u+=10,r=a=o=new f(1),l=0,c++;else return Tt(s,f.precision=p,h,Wt=!0);else return f.precision=p,s}s=o}}function Ao(t,e){var r,n,i,a,s,o,u,c,l,d,f,h=1,p=10,m=t,y=m.d,g=m.constructor,v=g.rounding,w=g.precision;if(m.s<0||!y||!y[0]||!m.e&&y[0]==1&&y.length==1)return new g(y&&!y[0]?-1/0:m.s!=1?NaN:y?0:m);if(e==null?(Wt=!1,l=w):l=e,g.precision=l+=p,r=Jn(y),n=r.charAt(0),Math.abs(a=m.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(t),r=Jn(m.d),n=r.charAt(0),h++;a=m.e,n>1?(m=new g("0."+r),a++):m=new g(n+"."+r.slice(1))}else return c=t0(g,l+2,w).times(a+""),m=Ao(new g(n+"."+r.slice(1)),l-p).plus(c),g.precision=w,e==null?Tt(m,w,v,Wt=!0):m;for(d=m,u=s=m=tn(m.minus(1),m.plus(1),l,1),f=Tt(m.times(m),l,1),i=3;;){if(s=Tt(s.times(f),l,1),c=u.plus(tn(s,new g(i),l,1)),Jn(c.d).slice(0,l)===Jn(u.d).slice(0,l))if(u=u.times(2),a!==0&&(u=u.plus(t0(g,l+2,w).times(a+""))),u=tn(u,new g(h),l,1),e==null)if(Nh(u.d,l-p,v,o))g.precision=l+=p,c=s=m=tn(d.minus(1),d.plus(1),l,1),f=Tt(m.times(m),l,1),i=o=1;else return Tt(u,g.precision=w,v,Wt=!0);else return g.precision=w,u;u=c,i+=2}}function FP(t){return String(t.s*t.s/0)}function n_(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%Ot,r<0&&(n+=Ot),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Ot;n<i;)t.d.push(+e.slice(n,n+=Ot));e=e.slice(n),n=Ot-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),Wt&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Tce(t,e){var r,n,i,a,s,o,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),OP.test(e))return n_(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(wce.test(e))r=16,e=e.toLowerCase();else if(bce.test(e))r=2;else if(_ce.test(e))r=8;else throw Error(Yo+e);for(a=e.search(/p/i),a>0?(u=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),s=a>=0,n=t.constructor,s&&(e=e.replace(".",""),o=e.length,a=o-a,i=kP(n,new n(r),a,a*2)),c=Um(e,r,Ba),l=c.length-1,a=l;c[a]===0;--a)c.pop();return a<0?new n(t.s*0):(t.e=Ey(c,l),t.d=c,Wt=!1,s&&(t=tn(t,i,o*4)),u&&(t=t.times(Math.abs(u)<54?An(2,u):Jo.pow(2,u))),Wt=!0,t)}function Dce(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:Pl(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Sy(5,r)),e=Pl(t,2,e,e);for(var i,a=new t(5),s=new t(16),o=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(s.times(i).minus(o))));return e}function Pl(t,e,r,n,i){var a,s,o,u,c=t.precision,l=Math.ceil(c/Ot);for(Wt=!1,u=r.times(r),o=new t(n);;){if(s=tn(o.times(u),new t(e++*e++),c,1),o=i?n.plus(s):n.minus(s),n=tn(s.times(u),new t(e++*e++),c,1),s=o.plus(n),s.d[l]!==void 0){for(a=l;s.d[a]===o.d[a]&&a--;);if(a==-1)break}a=o,o=n,n=s,s=a}return Wt=!0,s.d.length=l+1,s}function Sy(t,e){for(var r=t;--e;)r*=t;return r}function PP(t,e){var r,n=e.s<0,i=Ia(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return js=n?4:1,e;if(r=e.divToInt(i),r.isZero())js=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return js=c6(r)?n?2:3:n?4:1,e;js=c6(r)?n?1:4:n?3:2}return e.minus(i).abs()}function zx(t,e,r,n){var i,a,s,o,u,c,l,d,f,h=t.constructor,p=r!==void 0;if(p?(Mi(r,1,nu),n===void 0?n=h.rounding:Mi(n,0,8)):(r=h.precision,n=h.rounding),!t.isFinite())l=FP(t);else{for(l=ys(t),s=l.indexOf("."),p?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new h(1),f.e=l.length-s,f.d=Um(ys(f),10,i),f.e=f.d.length),d=Um(l,10,i),a=u=d.length;d[--u]==0;)d.pop();if(!d[0])l=p?"0p+0":"0";else{if(s<0?a--:(t=new h(t),t.d=d,t.e=a,t=tn(t,f,r,n,0,i),d=t.d,a=t.e,c=AP),s=d[r],o=i/2,c=c||d[r+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(t.s<0?3:2)):s>o||s===o&&(n===4||c||n===6&&d[r-1]&1||n===(t.s<0?8:7)),d.length=r,c)for(;++d[--r]>i-1;)d[r]=0,r||(++a,d.unshift(1));for(u=d.length;!d[u-1];--u);for(s=0,l="";s<u;s++)l+=Qw.charAt(d[s]);if(p){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(d=Um(l,i,e),u=d.length;!d[u-1];--u);for(s=1,l="1.";s<u;s++)l+=Qw.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function l6(t,e){if(t.length>e)return t.length=e,!0}function Ace(t){return new this(t).abs()}function Nce(t){return new this(t).acos()}function Ice(t){return new this(t).acosh()}function Cce(t,e){return new this(t).plus(e)}function Oce(t){return new this(t).asin()}function Mce(t){return new this(t).asinh()}function kce(t){return new this(t).atan()}function Rce(t){return new this(t).atanh()}function Fce(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=Ia(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Ia(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Ia(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(tn(t,e,a,1)),e=Ia(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(tn(t,e,a,1)),r}function Pce(t){return new this(t).cbrt()}function Bce(t){return Tt(t=new this(t),t.e+1,2)}function Lce(t,e,r){return new this(t).clamp(e,r)}function jce(t){if(!t||typeof t!="object")throw Error(xy+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,nu,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,Xw,"maxE",0,Xw,"minE",-9e15,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=e_[r]),(n=t[r])!==void 0)if(ui(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(Yo+r+": "+n);if(r="crypto",i&&(this[r]=e_[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(IP);else this[r]=!1;else throw Error(Yo+r+": "+n);return this}function $ce(t){return new this(t).cos()}function Uce(t){return new this(t).cosh()}function BP(t){var e,r,n;function i(a){var s,o,u,c=this;if(!(c instanceof i))return new i(a);if(c.constructor=i,d6(a)){c.s=a.s,Wt?!a.d||a.e>i.maxE?(c.e=NaN,c.d=null):a.e<i.minE?(c.e=0,c.d=[0]):(c.e=a.e,c.d=a.d.slice()):(c.e=a.e,c.d=a.d?a.d.slice():a.d);return}if(u=typeof a,u==="number"){if(a===0){c.s=1/a<0?-1:1,c.e=0,c.d=[0];return}if(a<0?(a=-a,c.s=-1):c.s=1,a===~~a&&a<1e7){for(s=0,o=a;o>=10;o/=10)s++;Wt?s>i.maxE?(c.e=NaN,c.d=null):s<i.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[a]):(c.e=s,c.d=[a]);return}else if(a*0!==0){a||(c.s=NaN),c.e=NaN,c.d=null;return}return n_(c,a.toString())}else if(u!=="string")throw Error(Yo+a);return(o=a.charCodeAt(0))===45?(a=a.slice(1),c.s=-1):(o===43&&(a=a.slice(1)),c.s=1),OP.test(a)?n_(c,a):Tce(c,a)}if(i.prototype=Le,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=jce,i.clone=BP,i.isDecimal=d6,i.abs=Ace,i.acos=Nce,i.acosh=Ice,i.add=Cce,i.asin=Oce,i.asinh=Mce,i.atan=kce,i.atanh=Rce,i.atan2=Fce,i.cbrt=Pce,i.ceil=Bce,i.clamp=Lce,i.cos=$ce,i.cosh=Uce,i.div=zce,i.exp=qce,i.floor=Vce,i.hypot=Zce,i.ln=Hce,i.log=Wce,i.log10=Jce,i.log2=Yce,i.max=Kce,i.min=Gce,i.mod=Xce,i.mul=Qce,i.pow=ele,i.random=tle,i.round=rle,i.sign=nle,i.sin=ile,i.sinh=ale,i.sqrt=sle,i.sub=ole,i.sum=ule,i.tan=cle,i.tanh=lle,i.trunc=dle,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function zce(t,e){return new this(t).div(e)}function qce(t){return new this(t).exp()}function Vce(t){return Tt(t=new this(t),t.e+1,3)}function Zce(){var t,e,r=new this(0);for(Wt=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return Wt=!0,new this(1/0);r=e}return Wt=!0,r.sqrt()}function d6(t){return t instanceof Jo||t&&t.toStringTag===CP||!1}function Hce(t){return new this(t).ln()}function Wce(t,e){return new this(t).log(e)}function Yce(t){return new this(t).log(2)}function Jce(t){return new this(t).log(10)}function Kce(){return RP(this,arguments,"lt")}function Gce(){return RP(this,arguments,"gt")}function Xce(t,e){return new this(t).mod(e)}function Qce(t,e){return new this(t).mul(e)}function ele(t,e){return new this(t).pow(e)}function tle(t){var e,r,n,i,a=0,s=new this(1),o=[];if(t===void 0?t=this.precision:Mi(t,1,nu),n=Math.ceil(t/Ot),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:o[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);a<n;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(o.push(i%1e7),a+=4);a=n/4}else throw Error(IP);else for(;a<n;)o[a++]=Math.random()*1e7|0;for(n=o[--a],t%=Ot,n&&t&&(i=An(10,Ot-t),o[a]=(n/i|0)*i);o[a]===0;a--)o.pop();if(a<0)r=0,o=[0];else{for(r=-1;o[0]===0;r-=Ot)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<Ot&&(r-=Ot-n)}return s.e=r,s.d=o,s}function rle(t){return Tt(t=new this(t),t.e+1,this.rounding)}function nle(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function ile(t){return new this(t).sin()}function ale(t){return new this(t).sinh()}function sle(t){return new this(t).sqrt()}function ole(t,e){return new this(t).sub(e)}function ule(){var t=0,e=arguments,r=new this(e[t]);for(Wt=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return Wt=!0,Tt(r,this.precision,this.rounding)}function cle(t){return new this(t).tan()}function lle(t){return new this(t).tanh()}function dle(t){return Tt(t=new this(t),t.e+1,1)}Le[Symbol.for("nodejs.util.inspect.custom")]=Le.toString;Le[Symbol.toStringTag]="Decimal";var Jo=Le.constructor=BP(e_);Qg=new Jo(Qg);e0=new Jo(e0);var fle="BigNumber",hle=["?on","config"],ple=se(fle,hle,t=>{var{on:e,config:r}=t,n=Jo.clone({precision:r.precision,modulo:Jo.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(i){return new n(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});const ri=Math.cosh||function(t){return Math.abs(t)<1e-9?1-t:(Math.exp(t)+Math.exp(-t))*.5},Qi=Math.sinh||function(t){return Math.abs(t)<1e-9?t:(Math.exp(t)-Math.exp(-t))*.5},mle=function(t){const e=Math.PI/4;if(-e>t||t>e)return Math.cos(t)-1;const r=t*t;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},I1=function(t,e){return t=Math.abs(t),e=Math.abs(e),t<e&&([t,e]=[e,t]),t<1e8?Math.sqrt(t*t+e*e):(e/=t,t*Math.sqrt(1+e*e))},xc=function(){throw SyntaxError("Invalid Param")};function C1(t,e){const r=Math.abs(t),n=Math.abs(e);return t===0?Math.log(n):e===0?Math.log(r):r<3e3&&n<3e3?Math.log(t*t+e*e)*.5:(t=t*.5,e=e*.5,.5*Math.log(t*t+e*e)+Math.LN2)}const gle={re:0,im:0},yu=function(t,e){const r=gle;if(t==null)r.re=r.im=0;else if(e!==void 0)r.re=t,r.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)r.re=t.re,r.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return ke.INFINITY;r.re=t.abs*Math.cos(t.arg),r.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return ke.INFINITY;r.re=t.r*Math.cos(t.phi),r.im=t.r*Math.sin(t.phi)}else t.length===2?(r.re=t[0],r.im=t[1]):xc();break;case"string":r.im=r.re=0;const n=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let i=1,a=0;n===null&&xc();for(let s=0;s<n.length;s++){const o=n[s];o===" "||o===" "||o===`
1053
1053
  `||(o==="+"?i++:o==="-"?a++:o==="i"||o==="I"?(i+a===0&&xc(),n[s+1]!==" "&&!isNaN(n[s+1])?(r.im+=parseFloat((a%2?"-":"")+n[s+1]),s++):r.im+=parseFloat((a%2?"-":"")+"1"),i=a=0):((i+a===0||isNaN(o))&&xc(),n[s+1]==="i"||n[s+1]==="I"?(r.im+=parseFloat((a%2?"-":"")+o),s++):r.re+=parseFloat((a%2?"-":"")+o),i=a=0))}i+a>0&&xc();break;case"number":r.im=0,r.re=t;break;default:xc()}return isNaN(r.re)||isNaN(r.im),r};function ke(t,e){if(!(this instanceof ke))return new ke(t,e);const r=yu(t,e);this.re=r.re,this.im=r.im}ke.prototype={re:0,im:0,sign:function(){const t=I1(this.re,this.im);return new ke(this.re/t,this.im/t)},add:function(t,e){const r=yu(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?ke.NAN:ke.INFINITY:new ke(this.re+r.re,this.im+r.im)},sub:function(t,e){const r=yu(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?ke.NAN:ke.INFINITY:new ke(this.re-r.re,this.im-r.im)},mul:function(t,e){const r=yu(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,s=r.re===0&&r.im===0;return n&&s||i&&a?ke.NAN:n||i?ke.INFINITY:r.im===0&&this.im===0?new ke(this.re*r.re,0):new ke(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){const r=yu(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,s=r.re===0&&r.im===0;if(a&&s||n&&i)return ke.NAN;if(s||n)return ke.INFINITY;if(a||i)return ke.ZERO;if(r.im===0)return new ke(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){const o=r.re/r.im,u=r.re*o+r.im;return new ke((this.re*o+this.im)/u,(this.im*o-this.re)/u)}else{const o=r.im/r.re,u=r.im*o+r.re;return new ke((this.re+this.im*o)/u,(this.im-this.re*o)/u)}},pow:function(t,e){const r=yu(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return ke.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new ke(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new ke(Math.pow(this.im,r.re),0);case 1:return new ke(0,Math.pow(this.im,r.re));case 2:return new ke(-Math.pow(this.im,r.re),0);case 3:return new ke(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return ke.ZERO;const i=Math.atan2(this.im,this.re),a=C1(this.re,this.im);let s=Math.exp(r.re*a-r.im*i),o=r.im*a+r.re*i;return new ke(s*Math.cos(o),s*Math.sin(o))},sqrt:function(){const t=this.re,e=this.im;if(e===0)return t>=0?new ke(Math.sqrt(t),0):new ke(0,Math.sqrt(-t));const r=I1(t,e);let n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new ke(n,e<0?-i:i):new ke(i,e<0?-n:n)},exp:function(){const t=Math.exp(this.re);return this.im===0?new ke(t,0):new ke(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){const t=this.re,e=this.im;return new ke(Math.expm1(t)*Math.cos(e)+mle(e),Math.exp(t)*Math.sin(e))},log:function(){const t=this.re,e=this.im;return e===0&&t>0?new ke(Math.log(t),0):new ke(C1(t,e),Math.atan2(e,t))},abs:function(){return I1(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const t=this.re,e=this.im;return new ke(Math.sin(t)*ri(e),Math.cos(t)*Qi(e))},cos:function(){const t=this.re,e=this.im;return new ke(Math.cos(t)*ri(e),-Math.sin(t)*Qi(e))},tan:function(){const t=2*this.re,e=2*this.im,r=Math.cos(t)+ri(e);return new ke(Math.sin(t)/r,Qi(e)/r)},cot:function(){const t=2*this.re,e=2*this.im,r=Math.cos(t)-ri(e);return new ke(-Math.sin(t)/r,Qi(e)/r)},sec:function(){const t=this.re,e=this.im,r=.5*ri(2*e)+.5*Math.cos(2*t);return new ke(Math.cos(t)*ri(e)/r,Math.sin(t)*Qi(e)/r)},csc:function(){const t=this.re,e=this.im,r=.5*ri(2*e)-.5*Math.cos(2*t);return new ke(Math.sin(t)*ri(e)/r,-Math.cos(t)*Qi(e)/r)},asin:function(){const t=this.re,e=this.im,r=new ke(e*e-t*t+1,-2*t*e).sqrt(),n=new ke(r.re-e,r.im+t).log();return new ke(n.im,-n.re)},acos:function(){const t=this.re,e=this.im,r=new ke(e*e-t*t+1,-2*t*e).sqrt(),n=new ke(r.re-e,r.im+t).log();return new ke(Math.PI/2-n.im,n.re)},atan:function(){const t=this.re,e=this.im;if(t===0){if(e===1)return new ke(0,1/0);if(e===-1)return new ke(0,-1/0)}const r=t*t+(1-e)*(1-e),n=new ke((1-e*e-t*t)/r,-2*t/r).log();return new ke(-.5*n.im,.5*n.re)},acot:function(){const t=this.re,e=this.im;if(e===0)return new ke(Math.atan2(1,t),0);const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).atan():new ke(t!==0?t/0:0,e!==0?-e/0:0).atan()},asec:function(){const t=this.re,e=this.im;if(t===0&&e===0)return new ke(0,1/0);const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).acos():new ke(t!==0?t/0:0,e!==0?-e/0:0).acos()},acsc:function(){const t=this.re,e=this.im;if(t===0&&e===0)return new ke(Math.PI/2,1/0);const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).asin():new ke(t!==0?t/0:0,e!==0?-e/0:0).asin()},sinh:function(){const t=this.re,e=this.im;return new ke(Qi(t)*Math.cos(e),ri(t)*Math.sin(e))},cosh:function(){const t=this.re,e=this.im;return new ke(ri(t)*Math.cos(e),Qi(t)*Math.sin(e))},tanh:function(){const t=2*this.re,e=2*this.im,r=ri(t)+Math.cos(e);return new ke(Qi(t)/r,Math.sin(e)/r)},coth:function(){const t=2*this.re,e=2*this.im,r=ri(t)-Math.cos(e);return new ke(Qi(t)/r,-Math.sin(e)/r)},csch:function(){const t=this.re,e=this.im,r=Math.cos(2*e)-ri(2*t);return new ke(-2*Qi(t)*Math.cos(e)/r,2*ri(t)*Math.sin(e)/r)},sech:function(){const t=this.re,e=this.im,r=Math.cos(2*e)+ri(2*t);return new ke(2*ri(t)*Math.cos(e)/r,-2*Qi(t)*Math.sin(e)/r)},asinh:function(){let t=this.im;this.im=-this.re,this.re=t;const e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){const t=this.acos();if(t.im<=0){const e=t.re;t.re=-t.im,t.im=e}else{const e=t.im;t.im=-t.re,t.re=e}return t},atanh:function(){const t=this.re,e=this.im,r=t>1&&e===0,n=1-t,i=1+t,a=n*n+e*e,s=a!==0?new ke((i*n-e*e)/a,(e*n+i*e)/a):new ke(t!==-1?t/0:0,e!==0?e/0:0),o=s.re;return s.re=C1(s.re,s.im)/2,s.im=Math.atan2(s.im,o)/2,r&&(s.im=-s.im),s},acoth:function(){const t=this.re,e=this.im;if(t===0&&e===0)return new ke(0,Math.PI/2);const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).atanh():new ke(t!==0?t/0:0,e!==0?-e/0:0).atanh()},acsch:function(){const t=this.re,e=this.im;if(e===0)return new ke(t!==0?Math.log(t+Math.sqrt(t*t+1)):1/0,0);const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).asinh():new ke(t!==0?t/0:0,e!==0?-e/0:0).asinh()},asech:function(){const t=this.re,e=this.im;if(this.isZero())return ke.INFINITY;const r=t*t+e*e;return r!==0?new ke(t/r,-e/r).acosh():new ke(t!==0?t/0:0,e!==0?-e/0:0).acosh()},inverse:function(){if(this.isZero())return ke.INFINITY;if(this.isInfinite())return ke.ZERO;const t=this.re,e=this.im,r=t*t+e*e;return new ke(t/r,-e/r)},conjugate:function(){return new ke(this.re,-this.im)},neg:function(){return new ke(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new ke(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new ke(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new ke(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){const r=yu(t,e);return Math.abs(r.re-this.re)<=ke.EPSILON&&Math.abs(r.im-this.im)<=ke.EPSILON},clone:function(){return new ke(this.re,this.im)},toString:function(){let t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<ke.EPSILON&&(t=0),Math.abs(e)<ke.EPSILON&&(e=0),e===0?r+t:(t!==0?(r+=t,r+=" ",e<0?(e=-e,r+="-"):r+="+",r+=" "):e<0&&(e=-e,r+="-"),e!==1&&(r+=e),r+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}};ke.ZERO=new ke(0,0);ke.ONE=new ke(1,0);ke.I=new ke(0,1);ke.PI=new ke(Math.PI,0);ke.E=new ke(Math.E,0);ke.INFINITY=new ke(1/0,1/0);ke.NAN=new ke(NaN,NaN);ke.EPSILON=1e-15;var yle="Complex",vle=[],ble=se(yle,vle,()=>(Object.defineProperty(ke,"name",{value:"Complex"}),ke.prototype.constructor=ke,ke.prototype.type="Complex",ke.prototype.isComplex=!0,ke.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},ke.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},ke.prototype.format=function(t){var e="",r=this.im,n=this.re,i=Ru(this.re,t),a=Ru(this.im,t),s=Ht(t)?t:t?t.precision:null;if(s!==null){var o=Math.pow(10,-s);Math.abs(n/r)<o&&(n=0),Math.abs(r/n)<o&&(r=0)}return r===0?e=i:n===0?r===1?e="i":r===-1?e="-i":e=a+"i":r<0?r===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":r===1?e=i+" + i":e=i+" + "+a+"i",e},ke.fromPolar=function(t){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return ke(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var r=arguments[0],n=arguments[1];if(Ht(r)){if(Ai(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),Ht(n))return new ke({r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},ke.prototype.valueOf=ke.prototype.toString,ke.fromJSON=function(t){return new ke(t)},ke.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},ke),{isClass:!0});/**
1054
1054
  * @license Fraction.js v4.3.7 31/08/2023
1055
1055
  * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
@@ -1107,7 +1107,7 @@ In case of a (multi dimensional) array or matrix, the prob order quantile of all
1107
1107
  * @author Feross Aboukhadijeh <https://feross.org>
1108
1108
  * @license MIT
1109
1109
  */var v5;function mc(){return v5||(v5=1,function(t){var e=jEe(),r=$Ee(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=a(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{var B=new Uint8Array(1),j={foo:function(){return 42}};return Object.setPrototypeOf(j,Uint8Array.prototype),Object.setPrototypeOf(B,j),B.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(B){if(B>i)throw new RangeError('The value "'+B+'" is invalid for option "size"');var j=new Uint8Array(B);return Object.setPrototypeOf(j,o.prototype),j}function o(B,j,U){if(typeof B=="number"){if(typeof j=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(B)}return u(B,j,U)}o.poolSize=8192;function u(B,j,U){if(typeof B=="string")return f(B,j);if(ArrayBuffer.isView(B))return p(B);if(B==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(he(B,ArrayBuffer)||B&&he(B.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(B,SharedArrayBuffer)||B&&he(B.buffer,SharedArrayBuffer)))return m(B,j,U);if(typeof B=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var W=B.valueOf&&B.valueOf();if(W!=null&&W!==B)return o.from(W,j,U);var ee=y(B);if(ee)return ee;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]=="function")return o.from(B[Symbol.toPrimitive]("string"),j,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}o.from=function(B,j,U){return u(B,j,U)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function c(B){if(typeof B!="number")throw new TypeError('"size" argument must be of type number');if(B<0)throw new RangeError('The value "'+B+'" is invalid for option "size"')}function l(B,j,U){return c(B),B<=0?s(B):j!==void 0?typeof U=="string"?s(B).fill(j,U):s(B).fill(j):s(B)}o.alloc=function(B,j,U){return l(B,j,U)};function d(B){return c(B),s(B<0?0:g(B)|0)}o.allocUnsafe=function(B){return d(B)},o.allocUnsafeSlow=function(B){return d(B)};function f(B,j){if((typeof j!="string"||j==="")&&(j="utf8"),!o.isEncoding(j))throw new TypeError("Unknown encoding: "+j);var U=w(B,j)|0,W=s(U),ee=W.write(B,j);return ee!==U&&(W=W.slice(0,ee)),W}function h(B){for(var j=B.length<0?0:g(B.length)|0,U=s(j),W=0;W<j;W+=1)U[W]=B[W]&255;return U}function p(B){if(he(B,Uint8Array)){var j=new Uint8Array(B);return m(j.buffer,j.byteOffset,j.byteLength)}return h(B)}function m(B,j,U){if(j<0||B.byteLength<j)throw new RangeError('"offset" is outside of buffer bounds');if(B.byteLength<j+(U||0))throw new RangeError('"length" is outside of buffer bounds');var W;return j===void 0&&U===void 0?W=new Uint8Array(B):U===void 0?W=new Uint8Array(B,j):W=new Uint8Array(B,j,U),Object.setPrototypeOf(W,o.prototype),W}function y(B){if(o.isBuffer(B)){var j=g(B.length)|0,U=s(j);return U.length===0||B.copy(U,0,0,j),U}if(B.length!==void 0)return typeof B.length!="number"||Z(B.length)?s(0):h(B);if(B.type==="Buffer"&&Array.isArray(B.data))return h(B.data)}function g(B){if(B>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return B|0}function v(B){return+B!=B&&(B=0),o.alloc(+B)}o.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==o.prototype},o.compare=function(B,j){if(he(B,Uint8Array)&&(B=o.from(B,B.offset,B.byteLength)),he(j,Uint8Array)&&(j=o.from(j,j.offset,j.byteLength)),!o.isBuffer(B)||!o.isBuffer(j))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===j)return 0;for(var U=B.length,W=j.length,ee=0,te=Math.min(U,W);ee<te;++ee)if(B[ee]!==j[ee]){U=B[ee],W=j[ee];break}return U<W?-1:W<U?1:0},o.isEncoding=function(B){switch(String(B).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(B,j){if(!Array.isArray(B))throw new TypeError('"list" argument must be an Array of Buffers');if(B.length===0)return o.alloc(0);var U;if(j===void 0)for(j=0,U=0;U<B.length;++U)j+=B[U].length;var W=o.allocUnsafe(j),ee=0;for(U=0;U<B.length;++U){var te=B[U];if(he(te,Uint8Array))ee+te.length>W.length?o.from(te).copy(W,ee):Uint8Array.prototype.set.call(W,te,ee);else if(o.isBuffer(te))te.copy(W,ee);else throw new TypeError('"list" argument must be an Array of Buffers');ee+=te.length}return W};function w(B,j){if(o.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||he(B,ArrayBuffer))return B.byteLength;if(typeof B!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);var U=B.length,W=arguments.length>2&&arguments[2]===!0;if(!W&&U===0)return 0;for(var ee=!1;;)switch(j){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return V(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return oe(B).length;default:if(ee)return W?-1:V(B).length;j=(""+j).toLowerCase(),ee=!0}}o.byteLength=w;function x(B,j,U){var W=!1;if((j===void 0||j<0)&&(j=0),j>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,j>>>=0,U<=j))return"";for(B||(B="utf8");;)switch(B){case"hex":return S(this,j,U);case"utf8":case"utf-8":return E(this,j,U);case"ascii":return I(this,j,U);case"latin1":case"binary":return O(this,j,U);case"base64":return b(this,j,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,j,U);default:if(W)throw new TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),W=!0}}o.prototype._isBuffer=!0;function _(B,j,U){var W=B[j];B[j]=B[U],B[U]=W}o.prototype.swap16=function(){var B=this.length;if(B%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var j=0;j<B;j+=2)_(this,j,j+1);return this},o.prototype.swap32=function(){var B=this.length;if(B%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var j=0;j<B;j+=4)_(this,j,j+3),_(this,j+1,j+2);return this},o.prototype.swap64=function(){var B=this.length;if(B%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var j=0;j<B;j+=8)_(this,j,j+7),_(this,j+1,j+6),_(this,j+2,j+5),_(this,j+3,j+4);return this},o.prototype.toString=function(){var B=this.length;return B===0?"":arguments.length===0?E(this,0,B):x.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(B){if(!o.isBuffer(B))throw new TypeError("Argument must be a Buffer");return this===B?!0:o.compare(this,B)===0},o.prototype.inspect=function(){var B="",j=t.INSPECT_MAX_BYTES;return B=this.toString("hex",0,j).replace(/(.{2})/g,"$1 ").trim(),this.length>j&&(B+=" ... "),"<Buffer "+B+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(B,j,U,W,ee){if(he(B,Uint8Array)&&(B=o.from(B,B.offset,B.byteLength)),!o.isBuffer(B))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(j===void 0&&(j=0),U===void 0&&(U=B?B.length:0),W===void 0&&(W=0),ee===void 0&&(ee=this.length),j<0||U>B.length||W<0||ee>this.length)throw new RangeError("out of range index");if(W>=ee&&j>=U)return 0;if(W>=ee)return-1;if(j>=U)return 1;if(j>>>=0,U>>>=0,W>>>=0,ee>>>=0,this===B)return 0;for(var te=ee-W,ne=U-j,Y=Math.min(te,ne),re=this.slice(W,ee),ce=B.slice(j,U),de=0;de<Y;++de)if(re[de]!==ce[de]){te=re[de],ne=ce[de];break}return te<ne?-1:ne<te?1:0};function A(B,j,U,W,ee){if(B.length===0)return-1;if(typeof U=="string"?(W=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,Z(U)&&(U=ee?0:B.length-1),U<0&&(U=B.length+U),U>=B.length){if(ee)return-1;U=B.length-1}else if(U<0)if(ee)U=0;else return-1;if(typeof j=="string"&&(j=o.from(j,W)),o.isBuffer(j))return j.length===0?-1:M(B,j,U,W,ee);if(typeof j=="number")return j=j&255,typeof Uint8Array.prototype.indexOf=="function"?ee?Uint8Array.prototype.indexOf.call(B,j,U):Uint8Array.prototype.lastIndexOf.call(B,j,U):M(B,[j],U,W,ee);throw new TypeError("val must be string, number or Buffer")}function M(B,j,U,W,ee){var te=1,ne=B.length,Y=j.length;if(W!==void 0&&(W=String(W).toLowerCase(),W==="ucs2"||W==="ucs-2"||W==="utf16le"||W==="utf-16le")){if(B.length<2||j.length<2)return-1;te=2,ne/=2,Y/=2,U/=2}function re(Ae,Ne){return te===1?Ae[Ne]:Ae.readUInt16BE(Ne*te)}var ce;if(ee){var de=-1;for(ce=U;ce<ne;ce++)if(re(B,ce)===re(j,de===-1?0:ce-de)){if(de===-1&&(de=ce),ce-de+1===Y)return de*te}else de!==-1&&(ce-=ce-de),de=-1}else for(U+Y>ne&&(U=ne-Y),ce=U;ce>=0;ce--){for(var ve=!0,we=0;we<Y;we++)if(re(B,ce+we)!==re(j,we)){ve=!1;break}if(ve)return ce}return-1}o.prototype.includes=function(B,j,U){return this.indexOf(B,j,U)!==-1},o.prototype.indexOf=function(B,j,U){return A(this,B,j,U,!0)},o.prototype.lastIndexOf=function(B,j,U){return A(this,B,j,U,!1)};function F(B,j,U,W){U=Number(U)||0;var ee=B.length-U;W?(W=Number(W),W>ee&&(W=ee)):W=ee;var te=j.length;W>te/2&&(W=te/2);for(var ne=0;ne<W;++ne){var Y=parseInt(j.substr(ne*2,2),16);if(Z(Y))return ne;B[U+ne]=Y}return ne}function k(B,j,U,W){return le(V(j,B.length-U),B,U,W)}function $(B,j,U,W){return le(Q(j),B,U,W)}function T(B,j,U,W){return le(oe(j),B,U,W)}function N(B,j,U,W){return le(ae(j,B.length-U),B,U,W)}o.prototype.write=function(B,j,U,W){if(j===void 0)W="utf8",U=this.length,j=0;else if(U===void 0&&typeof j=="string")W=j,U=this.length,j=0;else if(isFinite(j))j=j>>>0,isFinite(U)?(U=U>>>0,W===void 0&&(W="utf8")):(W=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ee=this.length-j;if((U===void 0||U>ee)&&(U=ee),B.length>0&&(U<0||j<0)||j>this.length)throw new RangeError("Attempt to write outside buffer bounds");W||(W="utf8");for(var te=!1;;)switch(W){case"hex":return F(this,B,j,U);case"utf8":case"utf-8":return k(this,B,j,U);case"ascii":case"latin1":case"binary":return $(this,B,j,U);case"base64":return T(this,B,j,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,B,j,U);default:if(te)throw new TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),te=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function b(B,j,U){return j===0&&U===B.length?e.fromByteArray(B):e.fromByteArray(B.slice(j,U))}function E(B,j,U){U=Math.min(B.length,U);for(var W=[],ee=j;ee<U;){var te=B[ee],ne=null,Y=te>239?4:te>223?3:te>191?2:1;if(ee+Y<=U){var re,ce,de,ve;switch(Y){case 1:te<128&&(ne=te);break;case 2:re=B[ee+1],(re&192)===128&&(ve=(te&31)<<6|re&63,ve>127&&(ne=ve));break;case 3:re=B[ee+1],ce=B[ee+2],(re&192)===128&&(ce&192)===128&&(ve=(te&15)<<12|(re&63)<<6|ce&63,ve>2047&&(ve<55296||ve>57343)&&(ne=ve));break;case 4:re=B[ee+1],ce=B[ee+2],de=B[ee+3],(re&192)===128&&(ce&192)===128&&(de&192)===128&&(ve=(te&15)<<18|(re&63)<<12|(ce&63)<<6|de&63,ve>65535&&ve<1114112&&(ne=ve))}}ne===null?(ne=65533,Y=1):ne>65535&&(ne-=65536,W.push(ne>>>10&1023|55296),ne=56320|ne&1023),W.push(ne),ee+=Y}return C(W)}var D=4096;function C(B){var j=B.length;if(j<=D)return String.fromCharCode.apply(String,B);for(var U="",W=0;W<j;)U+=String.fromCharCode.apply(String,B.slice(W,W+=D));return U}function I(B,j,U){var W="";U=Math.min(B.length,U);for(var ee=j;ee<U;++ee)W+=String.fromCharCode(B[ee]&127);return W}function O(B,j,U){var W="";U=Math.min(B.length,U);for(var ee=j;ee<U;++ee)W+=String.fromCharCode(B[ee]);return W}function S(B,j,U){var W=B.length;(!j||j<0)&&(j=0),(!U||U<0||U>W)&&(U=W);for(var ee="",te=j;te<U;++te)ee+=K[B[te]];return ee}function P(B,j,U){for(var W=B.slice(j,U),ee="",te=0;te<W.length-1;te+=2)ee+=String.fromCharCode(W[te]+W[te+1]*256);return ee}o.prototype.slice=function(B,j){var U=this.length;B=~~B,j=j===void 0?U:~~j,B<0?(B+=U,B<0&&(B=0)):B>U&&(B=U),j<0?(j+=U,j<0&&(j=0)):j>U&&(j=U),j<B&&(j=B);var W=this.subarray(B,j);return Object.setPrototypeOf(W,o.prototype),W};function R(B,j,U){if(B%1!==0||B<0)throw new RangeError("offset is not uint");if(B+j>U)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(B,j,U){B=B>>>0,j=j>>>0,U||R(B,j,this.length);for(var W=this[B],ee=1,te=0;++te<j&&(ee*=256);)W+=this[B+te]*ee;return W},o.prototype.readUintBE=o.prototype.readUIntBE=function(B,j,U){B=B>>>0,j=j>>>0,U||R(B,j,this.length);for(var W=this[B+--j],ee=1;j>0&&(ee*=256);)W+=this[B+--j]*ee;return W},o.prototype.readUint8=o.prototype.readUInt8=function(B,j){return B=B>>>0,j||R(B,1,this.length),this[B]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(B,j){return B=B>>>0,j||R(B,2,this.length),this[B]|this[B+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(B,j){return B=B>>>0,j||R(B,2,this.length),this[B]<<8|this[B+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(B,j){return B=B>>>0,j||R(B,4,this.length),(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(B,j){return B=B>>>0,j||R(B,4,this.length),this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])},o.prototype.readIntLE=function(B,j,U){B=B>>>0,j=j>>>0,U||R(B,j,this.length);for(var W=this[B],ee=1,te=0;++te<j&&(ee*=256);)W+=this[B+te]*ee;return ee*=128,W>=ee&&(W-=Math.pow(2,8*j)),W},o.prototype.readIntBE=function(B,j,U){B=B>>>0,j=j>>>0,U||R(B,j,this.length);for(var W=j,ee=1,te=this[B+--W];W>0&&(ee*=256);)te+=this[B+--W]*ee;return ee*=128,te>=ee&&(te-=Math.pow(2,8*j)),te},o.prototype.readInt8=function(B,j){return B=B>>>0,j||R(B,1,this.length),this[B]&128?(255-this[B]+1)*-1:this[B]},o.prototype.readInt16LE=function(B,j){B=B>>>0,j||R(B,2,this.length);var U=this[B]|this[B+1]<<8;return U&32768?U|4294901760:U},o.prototype.readInt16BE=function(B,j){B=B>>>0,j||R(B,2,this.length);var U=this[B+1]|this[B]<<8;return U&32768?U|4294901760:U},o.prototype.readInt32LE=function(B,j){return B=B>>>0,j||R(B,4,this.length),this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24},o.prototype.readInt32BE=function(B,j){return B=B>>>0,j||R(B,4,this.length),this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]},o.prototype.readFloatLE=function(B,j){return B=B>>>0,j||R(B,4,this.length),r.read(this,B,!0,23,4)},o.prototype.readFloatBE=function(B,j){return B=B>>>0,j||R(B,4,this.length),r.read(this,B,!1,23,4)},o.prototype.readDoubleLE=function(B,j){return B=B>>>0,j||R(B,8,this.length),r.read(this,B,!0,52,8)},o.prototype.readDoubleBE=function(B,j){return B=B>>>0,j||R(B,8,this.length),r.read(this,B,!1,52,8)};function L(B,j,U,W,ee,te){if(!o.isBuffer(B))throw new TypeError('"buffer" argument must be a Buffer instance');if(j>ee||j<te)throw new RangeError('"value" argument is out of bounds');if(U+W>B.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(B,j,U,W){if(B=+B,j=j>>>0,U=U>>>0,!W){var ee=Math.pow(2,8*U)-1;L(this,B,j,U,ee,0)}var te=1,ne=0;for(this[j]=B&255;++ne<U&&(te*=256);)this[j+ne]=B/te&255;return j+U},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(B,j,U,W){if(B=+B,j=j>>>0,U=U>>>0,!W){var ee=Math.pow(2,8*U)-1;L(this,B,j,U,ee,0)}var te=U-1,ne=1;for(this[j+te]=B&255;--te>=0&&(ne*=256);)this[j+te]=B/ne&255;return j+U},o.prototype.writeUint8=o.prototype.writeUInt8=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,1,255,0),this[j]=B&255,j+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,2,65535,0),this[j]=B&255,this[j+1]=B>>>8,j+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,2,65535,0),this[j]=B>>>8,this[j+1]=B&255,j+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,4,4294967295,0),this[j+3]=B>>>24,this[j+2]=B>>>16,this[j+1]=B>>>8,this[j]=B&255,j+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,4,4294967295,0),this[j]=B>>>24,this[j+1]=B>>>16,this[j+2]=B>>>8,this[j+3]=B&255,j+4},o.prototype.writeIntLE=function(B,j,U,W){if(B=+B,j=j>>>0,!W){var ee=Math.pow(2,8*U-1);L(this,B,j,U,ee-1,-ee)}var te=0,ne=1,Y=0;for(this[j]=B&255;++te<U&&(ne*=256);)B<0&&Y===0&&this[j+te-1]!==0&&(Y=1),this[j+te]=(B/ne>>0)-Y&255;return j+U},o.prototype.writeIntBE=function(B,j,U,W){if(B=+B,j=j>>>0,!W){var ee=Math.pow(2,8*U-1);L(this,B,j,U,ee-1,-ee)}var te=U-1,ne=1,Y=0;for(this[j+te]=B&255;--te>=0&&(ne*=256);)B<0&&Y===0&&this[j+te+1]!==0&&(Y=1),this[j+te]=(B/ne>>0)-Y&255;return j+U},o.prototype.writeInt8=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,1,127,-128),B<0&&(B=255+B+1),this[j]=B&255,j+1},o.prototype.writeInt16LE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,2,32767,-32768),this[j]=B&255,this[j+1]=B>>>8,j+2},o.prototype.writeInt16BE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,2,32767,-32768),this[j]=B>>>8,this[j+1]=B&255,j+2},o.prototype.writeInt32LE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,4,2147483647,-2147483648),this[j]=B&255,this[j+1]=B>>>8,this[j+2]=B>>>16,this[j+3]=B>>>24,j+4},o.prototype.writeInt32BE=function(B,j,U){return B=+B,j=j>>>0,U||L(this,B,j,4,2147483647,-2147483648),B<0&&(B=4294967295+B+1),this[j]=B>>>24,this[j+1]=B>>>16,this[j+2]=B>>>8,this[j+3]=B&255,j+4};function q(B,j,U,W,ee,te){if(U+W>B.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function J(B,j,U,W,ee){return j=+j,U=U>>>0,ee||q(B,j,U,4),r.write(B,j,U,W,23,4),U+4}o.prototype.writeFloatLE=function(B,j,U){return J(this,B,j,!0,U)},o.prototype.writeFloatBE=function(B,j,U){return J(this,B,j,!1,U)};function G(B,j,U,W,ee){return j=+j,U=U>>>0,ee||q(B,j,U,8),r.write(B,j,U,W,52,8),U+8}o.prototype.writeDoubleLE=function(B,j,U){return G(this,B,j,!0,U)},o.prototype.writeDoubleBE=function(B,j,U){return G(this,B,j,!1,U)},o.prototype.copy=function(B,j,U,W){if(!o.isBuffer(B))throw new TypeError("argument should be a Buffer");if(U||(U=0),!W&&W!==0&&(W=this.length),j>=B.length&&(j=B.length),j||(j=0),W>0&&W<U&&(W=U),W===U||B.length===0||this.length===0)return 0;if(j<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(W<0)throw new RangeError("sourceEnd out of bounds");W>this.length&&(W=this.length),B.length-j<W-U&&(W=B.length-j+U);var ee=W-U;return this===B&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(j,U,W):Uint8Array.prototype.set.call(B,this.subarray(U,W),j),ee},o.prototype.fill=function(B,j,U,W){if(typeof B=="string"){if(typeof j=="string"?(W=j,j=0,U=this.length):typeof U=="string"&&(W=U,U=this.length),W!==void 0&&typeof W!="string")throw new TypeError("encoding must be a string");if(typeof W=="string"&&!o.isEncoding(W))throw new TypeError("Unknown encoding: "+W);if(B.length===1){var ee=B.charCodeAt(0);(W==="utf8"&&ee<128||W==="latin1")&&(B=ee)}}else typeof B=="number"?B=B&255:typeof B=="boolean"&&(B=Number(B));if(j<0||this.length<j||this.length<U)throw new RangeError("Out of range index");if(U<=j)return this;j=j>>>0,U=U===void 0?this.length:U>>>0,B||(B=0);var te;if(typeof B=="number")for(te=j;te<U;++te)this[te]=B;else{var ne=o.isBuffer(B)?B:o.from(B,W),Y=ne.length;if(Y===0)throw new TypeError('The value "'+B+'" is invalid for argument "value"');for(te=0;te<U-j;++te)this[te+j]=ne[te%Y]}return this};var ie=/[^+/0-9A-Za-z-_]/g;function z(B){if(B=B.split("=")[0],B=B.trim().replace(ie,""),B.length<2)return"";for(;B.length%4!==0;)B=B+"=";return B}function V(B,j){j=j||1/0;for(var U,W=B.length,ee=null,te=[],ne=0;ne<W;++ne){if(U=B.charCodeAt(ne),U>55295&&U<57344){if(!ee){if(U>56319){(j-=3)>-1&&te.push(239,191,189);continue}else if(ne+1===W){(j-=3)>-1&&te.push(239,191,189);continue}ee=U;continue}if(U<56320){(j-=3)>-1&&te.push(239,191,189),ee=U;continue}U=(ee-55296<<10|U-56320)+65536}else ee&&(j-=3)>-1&&te.push(239,191,189);if(ee=null,U<128){if((j-=1)<0)break;te.push(U)}else if(U<2048){if((j-=2)<0)break;te.push(U>>6|192,U&63|128)}else if(U<65536){if((j-=3)<0)break;te.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((j-=4)<0)break;te.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return te}function Q(B){for(var j=[],U=0;U<B.length;++U)j.push(B.charCodeAt(U)&255);return j}function ae(B,j){for(var U,W,ee,te=[],ne=0;ne<B.length&&!((j-=2)<0);++ne)U=B.charCodeAt(ne),W=U>>8,ee=U%256,te.push(ee),te.push(W);return te}function oe(B){return e.toByteArray(z(B))}function le(B,j,U,W){for(var ee=0;ee<W&&!(ee+U>=j.length||ee>=B.length);++ee)j[ee+U]=B[ee];return ee}function he(B,j){return B instanceof j||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===j.name}function Z(B){return B!==B}var K=function(){for(var B="0123456789abcdef",j=new Array(256),U=0;U<16;++U)for(var W=U*16,ee=0;ee<16;++ee)j[W+ee]=B[U]+B[ee];return j}()}(m5)),m5}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var b5;function ur(){return b5||(b5=1,function(t,e){var r=mc(),n=r.Buffer;function i(s,o){for(var u in s)o[u]=s[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=a);function a(s,o,u){return n(s,o,u)}a.prototype=Object.create(n.prototype),i(n,a),a.from=function(s,o,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,o,u)},a.alloc=function(s,o,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=n(s);return o!==void 0?typeof u=="string"?c.fill(o,u):c.fill(o):c.fill(0),c},a.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},a.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}}(L1,L1.exports)),L1.exports}var w5;function ld(){if(w5)return dm.exports;w5=1;var t=65536,e=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
1110
- Use Chrome, Firefox or Internet Explorer 11`)}var n=ur().Buffer,i=qr.crypto||qr.msCrypto;i&&i.getRandomValues?dm.exports=a:dm.exports=r;function a(s,o){if(s>e)throw new RangeError("requested too many random bytes");var u=n.allocUnsafe(s);if(s>0)if(s>t)for(var c=0;c<s;c+=t)i.getRandomValues(u.slice(c,c+t));else i.getRandomValues(u);return typeof o=="function"?process.nextTick(function(){o(null,u)}):u}return dm.exports}var $1={exports:{}},_5;function gr(){return _5||(_5=1,typeof Object.create=="function"?$1.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:$1.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),$1.exports}const UEe={},zEe=Object.freeze(Object.defineProperty({__proto__:null,default:UEe},Symbol.toStringTag,{value:"Module"})),gc=Age(zEe);var U1,x5;function bL(){if(x5)return U1;x5=1;var t=ur().Buffer,e=gc.Transform,r=gr();function n(o){e.call(this),this._block=t.allocUnsafe(o),this._blockSize=o,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(n,e),n.prototype._transform=function(o,u,c){var l=null;try{this.update(o,u)}catch(d){l=d}c(l)},n.prototype._flush=function(o){var u=null;try{this.push(this.digest())}catch(c){u=c}o(u)};var i=typeof Uint8Array<"u",a=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);function s(o,u){if(o instanceof t)return o;if(typeof o=="string")return t.from(o,u);if(a&&ArrayBuffer.isView(o)){if(o.byteLength===0)return t.alloc(0);var c=t.from(o.buffer,o.byteOffset,o.byteLength);if(c.byteLength===o.byteLength)return c}if(i&&o instanceof Uint8Array||t.isBuffer(o)&&o.constructor&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o))return t.from(o);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return n.prototype.update=function(o,u){if(this._finalized)throw new Error("Digest already called");o=s(o,u);for(var c=this._block,l=0;this._blockOffset+o.length-l>=this._blockSize;){for(var d=this._blockOffset;d<this._blockSize;)c[d++]=o[l++];this._update(),this._blockOffset=0}for(;l<o.length;)c[this._blockOffset++]=o[l++];for(var f=0,h=o.length*8;h>0;++f)this._length[f]+=h,h=this._length[f]/4294967296|0,h>0&&(this._length[f]-=4294967296*h);return this},n.prototype._update=function(){throw new Error("_update is not implemented")},n.prototype.digest=function(o){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var u=this._digest();o!==void 0&&(u=u.toString(o)),this._block.fill(0),this._blockOffset=0;for(var c=0;c<4;++c)this._length[c]=0;return u},n.prototype._digest=function(){throw new Error("_digest is not implemented")},U1=n,U1}var z1,E5;function iE(){if(E5)return z1;E5=1;var t=gr(),e=bL(),r=ur().Buffer,n=new Array(16);function i(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}t(i,e),i.prototype._update=function(){for(var l=n,d=0;d<16;++d)l[d]=this._block.readInt32LE(d*4);var f=this._a,h=this._b,p=this._c,m=this._d;f=s(f,h,p,m,l[0],3614090360,7),m=s(m,f,h,p,l[1],3905402710,12),p=s(p,m,f,h,l[2],606105819,17),h=s(h,p,m,f,l[3],3250441966,22),f=s(f,h,p,m,l[4],4118548399,7),m=s(m,f,h,p,l[5],1200080426,12),p=s(p,m,f,h,l[6],2821735955,17),h=s(h,p,m,f,l[7],4249261313,22),f=s(f,h,p,m,l[8],1770035416,7),m=s(m,f,h,p,l[9],2336552879,12),p=s(p,m,f,h,l[10],4294925233,17),h=s(h,p,m,f,l[11],2304563134,22),f=s(f,h,p,m,l[12],1804603682,7),m=s(m,f,h,p,l[13],4254626195,12),p=s(p,m,f,h,l[14],2792965006,17),h=s(h,p,m,f,l[15],1236535329,22),f=o(f,h,p,m,l[1],4129170786,5),m=o(m,f,h,p,l[6],3225465664,9),p=o(p,m,f,h,l[11],643717713,14),h=o(h,p,m,f,l[0],3921069994,20),f=o(f,h,p,m,l[5],3593408605,5),m=o(m,f,h,p,l[10],38016083,9),p=o(p,m,f,h,l[15],3634488961,14),h=o(h,p,m,f,l[4],3889429448,20),f=o(f,h,p,m,l[9],568446438,5),m=o(m,f,h,p,l[14],3275163606,9),p=o(p,m,f,h,l[3],4107603335,14),h=o(h,p,m,f,l[8],1163531501,20),f=o(f,h,p,m,l[13],2850285829,5),m=o(m,f,h,p,l[2],4243563512,9),p=o(p,m,f,h,l[7],1735328473,14),h=o(h,p,m,f,l[12],2368359562,20),f=u(f,h,p,m,l[5],4294588738,4),m=u(m,f,h,p,l[8],2272392833,11),p=u(p,m,f,h,l[11],1839030562,16),h=u(h,p,m,f,l[14],4259657740,23),f=u(f,h,p,m,l[1],2763975236,4),m=u(m,f,h,p,l[4],1272893353,11),p=u(p,m,f,h,l[7],4139469664,16),h=u(h,p,m,f,l[10],3200236656,23),f=u(f,h,p,m,l[13],681279174,4),m=u(m,f,h,p,l[0],3936430074,11),p=u(p,m,f,h,l[3],3572445317,16),h=u(h,p,m,f,l[6],76029189,23),f=u(f,h,p,m,l[9],3654602809,4),m=u(m,f,h,p,l[12],3873151461,11),p=u(p,m,f,h,l[15],530742520,16),h=u(h,p,m,f,l[2],3299628645,23),f=c(f,h,p,m,l[0],4096336452,6),m=c(m,f,h,p,l[7],1126891415,10),p=c(p,m,f,h,l[14],2878612391,15),h=c(h,p,m,f,l[5],4237533241,21),f=c(f,h,p,m,l[12],1700485571,6),m=c(m,f,h,p,l[3],2399980690,10),p=c(p,m,f,h,l[10],4293915773,15),h=c(h,p,m,f,l[1],2240044497,21),f=c(f,h,p,m,l[8],1873313359,6),m=c(m,f,h,p,l[15],4264355552,10),p=c(p,m,f,h,l[6],2734768916,15),h=c(h,p,m,f,l[13],1309151649,21),f=c(f,h,p,m,l[4],4149444226,6),m=c(m,f,h,p,l[11],3174756917,10),p=c(p,m,f,h,l[2],718787259,15),h=c(h,p,m,f,l[9],3951481745,21),this._a=this._a+f|0,this._b=this._b+h|0,this._c=this._c+p|0,this._d=this._d+m|0},i.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var l=r.allocUnsafe(16);return l.writeInt32LE(this._a,0),l.writeInt32LE(this._b,4),l.writeInt32LE(this._c,8),l.writeInt32LE(this._d,12),l};function a(l,d){return l<<d|l>>>32-d}function s(l,d,f,h,p,m,y){return a(l+(d&f|~d&h)+p+m|0,y)+d|0}function o(l,d,f,h,p,m,y){return a(l+(d&h|f&~h)+p+m|0,y)+d|0}function u(l,d,f,h,p,m,y){return a(l+(d^f^h)+p+m|0,y)+d|0}function c(l,d,f,h,p,m,y){return a(l+(f^(d|~h))+p+m|0,y)+d|0}return z1=i,z1}var q1,S5;function aE(){if(S5)return q1;S5=1;var t=mc().Buffer,e=gr(),r=bL(),n=new Array(16),i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],a=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],o=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],u=[0,1518500249,1859775393,2400959708,2840853838],c=[1352829926,1548603684,1836072691,2053994217,0];function l(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}e(l,r),l.prototype._update=function(){for(var g=n,v=0;v<16;++v)g[v]=this._block.readInt32LE(v*4);for(var w=this._a|0,x=this._b|0,_=this._c|0,A=this._d|0,M=this._e|0,F=this._a|0,k=this._b|0,$=this._c|0,T=this._d|0,N=this._e|0,b=0;b<80;b+=1){var E,D;b<16?(E=f(w,x,_,A,M,g[i[b]],u[0],s[b]),D=y(F,k,$,T,N,g[a[b]],c[0],o[b])):b<32?(E=h(w,x,_,A,M,g[i[b]],u[1],s[b]),D=m(F,k,$,T,N,g[a[b]],c[1],o[b])):b<48?(E=p(w,x,_,A,M,g[i[b]],u[2],s[b]),D=p(F,k,$,T,N,g[a[b]],c[2],o[b])):b<64?(E=m(w,x,_,A,M,g[i[b]],u[3],s[b]),D=h(F,k,$,T,N,g[a[b]],c[3],o[b])):(E=y(w,x,_,A,M,g[i[b]],u[4],s[b]),D=f(F,k,$,T,N,g[a[b]],c[4],o[b])),w=M,M=A,A=d(_,10),_=x,x=E,F=N,N=T,T=d($,10),$=k,k=D}var C=this._b+_+T|0;this._b=this._c+A+N|0,this._c=this._d+M+F|0,this._d=this._e+w+k|0,this._e=this._a+x+$|0,this._a=C},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var g=t.alloc?t.alloc(20):new t(20);return g.writeInt32LE(this._a,0),g.writeInt32LE(this._b,4),g.writeInt32LE(this._c,8),g.writeInt32LE(this._d,12),g.writeInt32LE(this._e,16),g};function d(g,v){return g<<v|g>>>32-v}function f(g,v,w,x,_,A,M,F){return d(g+(v^w^x)+A+M|0,F)+_|0}function h(g,v,w,x,_,A,M,F){return d(g+(v&w|~v&x)+A+M|0,F)+_|0}function p(g,v,w,x,_,A,M,F){return d(g+((v|~w)^x)+A+M|0,F)+_|0}function m(g,v,w,x,_,A,M,F){return d(g+(v&x|w&~x)+A+M|0,F)+_|0}function y(g,v,w,x,_,A,M,F){return d(g+(v^(w|~x))+A+M|0,F)+_|0}return q1=l,q1}var V1={exports:{}},Z1,T5;function dd(){if(T5)return Z1;T5=1;var t=ur().Buffer;function e(r,n){this._block=t.alloc(r),this._finalSize=n,this._blockSize=r,this._len=0}return e.prototype.update=function(r,n){typeof r=="string"&&(n=n||"utf8",r=t.from(r,n));for(var i=this._block,a=this._blockSize,s=r.length,o=this._len,u=0;u<s;){for(var c=o%a,l=Math.min(s-u,a-c),d=0;d<l;d++)i[c+d]=r[u+d];o+=l,u+=l,o%a===0&&this._update(i)}return this._len+=s,this},e.prototype.digest=function(r){var n=this._len%this._blockSize;this._block[n]=128,this._block.fill(0,n+1),n>=this._finalSize&&(this._update(this._block),this._block.fill(0));var i=this._len*8;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var a=(i&4294967295)>>>0,s=(i-a)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return r?o.toString(r):o},e.prototype._update=function(){throw new Error("_update must be implemented by subclass")},Z1=e,Z1}var H1,D5;function qEe(){if(D5)return H1;D5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(c){return c<<5|c>>>27}function o(c){return c<<30|c>>>2}function u(c,l,d,f){return c===0?l&d|~l&f:c===2?l&d|l&f|d&f:l^d^f}return a.prototype._update=function(c){for(var l=this._w,d=this._a|0,f=this._b|0,h=this._c|0,p=this._d|0,m=this._e|0,y=0;y<16;++y)l[y]=c.readInt32BE(y*4);for(;y<80;++y)l[y]=l[y-3]^l[y-8]^l[y-14]^l[y-16];for(var g=0;g<80;++g){var v=~~(g/20),w=s(d)+u(v,f,h,p)+m+l[g]+n[v]|0;m=p,p=h,h=o(f),f=d,d=w}this._a=d+this._a|0,this._b=f+this._b|0,this._c=h+this._c|0,this._d=p+this._d|0,this._e=m+this._e|0},a.prototype._hash=function(){var c=r.allocUnsafe(20);return c.writeInt32BE(this._a|0,0),c.writeInt32BE(this._b|0,4),c.writeInt32BE(this._c|0,8),c.writeInt32BE(this._d|0,12),c.writeInt32BE(this._e|0,16),c},H1=a,H1}var W1,A5;function VEe(){if(A5)return W1;A5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(l){return l<<1|l>>>31}function o(l){return l<<5|l>>>27}function u(l){return l<<30|l>>>2}function c(l,d,f,h){return l===0?d&f|~d&h:l===2?d&f|d&h|f&h:d^f^h}return a.prototype._update=function(l){for(var d=this._w,f=this._a|0,h=this._b|0,p=this._c|0,m=this._d|0,y=this._e|0,g=0;g<16;++g)d[g]=l.readInt32BE(g*4);for(;g<80;++g)d[g]=s(d[g-3]^d[g-8]^d[g-14]^d[g-16]);for(var v=0;v<80;++v){var w=~~(v/20),x=o(f)+c(w,h,p,m)+y+d[v]+n[w]|0;y=m,m=p,p=u(h),h=f,f=x}this._a=f+this._a|0,this._b=h+this._b|0,this._c=p+this._c|0,this._d=m+this._d|0,this._e=y+this._e|0},a.prototype._hash=function(){var l=r.allocUnsafe(20);return l.writeInt32BE(this._a|0,0),l.writeInt32BE(this._b|0,4),l.writeInt32BE(this._c|0,8),l.writeInt32BE(this._d|0,12),l.writeInt32BE(this._e|0,16),l},W1=a,W1}var Y1,N5;function wL(){if(N5)return Y1;N5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],i=new Array(64);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function s(f,h,p){return p^f&(h^p)}function o(f,h,p){return f&h|p&(f|h)}function u(f){return(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10)}function c(f){return(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7)}function l(f){return(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3}function d(f){return(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10}return a.prototype._update=function(f){for(var h=this._w,p=this._a|0,m=this._b|0,y=this._c|0,g=this._d|0,v=this._e|0,w=this._f|0,x=this._g|0,_=this._h|0,A=0;A<16;++A)h[A]=f.readInt32BE(A*4);for(;A<64;++A)h[A]=d(h[A-2])+h[A-7]+l(h[A-15])+h[A-16]|0;for(var M=0;M<64;++M){var F=_+c(v)+s(v,w,x)+n[M]+h[M]|0,k=u(p)+o(p,m,y)|0;_=x,x=w,w=v,v=g+F|0,g=y,y=m,m=p,p=F+k|0}this._a=p+this._a|0,this._b=m+this._b|0,this._c=y+this._c|0,this._d=g+this._d|0,this._e=v+this._e|0,this._f=w+this._f|0,this._g=x+this._g|0,this._h=_+this._h|0},a.prototype._hash=function(){var f=r.allocUnsafe(32);return f.writeInt32BE(this._a,0),f.writeInt32BE(this._b,4),f.writeInt32BE(this._c,8),f.writeInt32BE(this._d,12),f.writeInt32BE(this._e,16),f.writeInt32BE(this._f,20),f.writeInt32BE(this._g,24),f.writeInt32BE(this._h,28),f},Y1=a,Y1}var J1,I5;function ZEe(){if(I5)return J1;I5=1;var t=gr(),e=wL(),r=dd(),n=ur().Buffer,i=new Array(64);function a(){this.init(),this._w=i,r.call(this,64,56)}return t(a,e),a.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},a.prototype._hash=function(){var s=n.allocUnsafe(28);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s},J1=a,J1}var K1,C5;function _L(){if(C5)return K1;C5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],i=new Array(160);function a(){this.init(),this._w=i,e.call(this,128,112)}t(a,e),a.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function s(m,y,g){return g^m&(y^g)}function o(m,y,g){return m&y|g&(m|y)}function u(m,y){return(m>>>28|y<<4)^(y>>>2|m<<30)^(y>>>7|m<<25)}function c(m,y){return(m>>>14|y<<18)^(m>>>18|y<<14)^(y>>>9|m<<23)}function l(m,y){return(m>>>1|y<<31)^(m>>>8|y<<24)^m>>>7}function d(m,y){return(m>>>1|y<<31)^(m>>>8|y<<24)^(m>>>7|y<<25)}function f(m,y){return(m>>>19|y<<13)^(y>>>29|m<<3)^m>>>6}function h(m,y){return(m>>>19|y<<13)^(y>>>29|m<<3)^(m>>>6|y<<26)}function p(m,y){return m>>>0<y>>>0?1:0}return a.prototype._update=function(m){for(var y=this._w,g=this._ah|0,v=this._bh|0,w=this._ch|0,x=this._dh|0,_=this._eh|0,A=this._fh|0,M=this._gh|0,F=this._hh|0,k=this._al|0,$=this._bl|0,T=this._cl|0,N=this._dl|0,b=this._el|0,E=this._fl|0,D=this._gl|0,C=this._hl|0,I=0;I<32;I+=2)y[I]=m.readInt32BE(I*4),y[I+1]=m.readInt32BE(I*4+4);for(;I<160;I+=2){var O=y[I-30],S=y[I-15*2+1],P=l(O,S),R=d(S,O);O=y[I-2*2],S=y[I-2*2+1];var L=f(O,S),q=h(S,O),J=y[I-7*2],G=y[I-7*2+1],ie=y[I-16*2],z=y[I-16*2+1],V=R+G|0,Q=P+J+p(V,R)|0;V=V+q|0,Q=Q+L+p(V,q)|0,V=V+z|0,Q=Q+ie+p(V,z)|0,y[I]=Q,y[I+1]=V}for(var ae=0;ae<160;ae+=2){Q=y[ae],V=y[ae+1];var oe=o(g,v,w),le=o(k,$,T),he=u(g,k),Z=u(k,g),K=c(_,b),B=c(b,_),j=n[ae],U=n[ae+1],W=s(_,A,M),ee=s(b,E,D),te=C+B|0,ne=F+K+p(te,C)|0;te=te+ee|0,ne=ne+W+p(te,ee)|0,te=te+U|0,ne=ne+j+p(te,U)|0,te=te+V|0,ne=ne+Q+p(te,V)|0;var Y=Z+le|0,re=he+oe+p(Y,Z)|0;F=M,C=D,M=A,D=E,A=_,E=b,b=N+te|0,_=x+ne+p(b,N)|0,x=w,N=T,w=v,T=$,v=g,$=k,k=te+Y|0,g=ne+re+p(k,te)|0}this._al=this._al+k|0,this._bl=this._bl+$|0,this._cl=this._cl+T|0,this._dl=this._dl+N|0,this._el=this._el+b|0,this._fl=this._fl+E|0,this._gl=this._gl+D|0,this._hl=this._hl+C|0,this._ah=this._ah+g+p(this._al,k)|0,this._bh=this._bh+v+p(this._bl,$)|0,this._ch=this._ch+w+p(this._cl,T)|0,this._dh=this._dh+x+p(this._dl,N)|0,this._eh=this._eh+_+p(this._el,b)|0,this._fh=this._fh+A+p(this._fl,E)|0,this._gh=this._gh+M+p(this._gl,D)|0,this._hh=this._hh+F+p(this._hl,C)|0},a.prototype._hash=function(){var m=r.allocUnsafe(64);function y(g,v,w){m.writeInt32BE(g,w),m.writeInt32BE(v,w+4)}return y(this._ah,this._al,0),y(this._bh,this._bl,8),y(this._ch,this._cl,16),y(this._dh,this._dl,24),y(this._eh,this._el,32),y(this._fh,this._fl,40),y(this._gh,this._gl,48),y(this._hh,this._hl,56),m},K1=a,K1}var G1,O5;function HEe(){if(O5)return G1;O5=1;var t=gr(),e=_L(),r=dd(),n=ur().Buffer,i=new Array(160);function a(){this.init(),this._w=i,r.call(this,128,112)}return t(a,e),a.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},a.prototype._hash=function(){var s=n.allocUnsafe(48);function o(u,c,l){s.writeInt32BE(u,l),s.writeInt32BE(c,l+4)}return o(this._ah,this._al,0),o(this._bh,this._bl,8),o(this._ch,this._cl,16),o(this._dh,this._dl,24),o(this._eh,this._el,32),o(this._fh,this._fl,40),s},G1=a,G1}var M5;function sE(){if(M5)return V1.exports;M5=1;var t=V1.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};return t.sha=qEe(),t.sha1=VEe(),t.sha224=ZEe(),t.sha256=wL(),t.sha384=HEe(),t.sha512=_L(),V1.exports}var X1={},k5;function WEe(){if(k5)return X1;k5=1;var t=ur().Buffer,e=t.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(g){if(!g)return"utf8";for(var v;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(v)return;g=(""+g).toLowerCase(),v=!0}}function n(g){var v=r(g);if(typeof v!="string"&&(t.isEncoding===e||!e(g)))throw new Error("Unknown encoding: "+g);return v||g}X1.StringDecoder=i;function i(g){this.encoding=n(g);var v;switch(this.encoding){case"utf16le":this.text=d,this.end=f,v=4;break;case"utf8":this.fillLast=u,v=4;break;case"base64":this.text=h,this.end=p,v=3;break;default:this.write=m,this.end=y;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}i.prototype.write=function(g){if(g.length===0)return"";var v,w;if(this.lastNeed){if(v=this.fillLast(g),v===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?v?v+this.text(g,w):this.text(g,w):v||""},i.prototype.end=l,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function a(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,v,w){var x=v.length-1;if(x<w)return 0;var _=a(v[x]);return _>=0?(_>0&&(g.lastNeed=_-1),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(g.lastNeed=_-2),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(_===2?_=0:g.lastNeed=_-3),_):0))}function o(g,v,w){if((v[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return g.lastNeed=2,"�"}}function u(g){var v=this.lastTotal-this.lastNeed,w=o(this,g);if(w!==void 0)return w;if(this.lastNeed<=g.length)return g.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,v,0,g.length),this.lastNeed-=g.length}function c(g,v){var w=s(this,g,v);if(!this.lastNeed)return g.toString("utf8",v);this.lastTotal=w;var x=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,x),g.toString("utf8",v,x)}function l(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+"�":v}function d(g,v){if((g.length-v)%2===0){var w=g.toString("utf16le",v);if(w){var x=w.charCodeAt(w.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",v,g.length-1)}function f(g){var v=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,w)}return v}function h(g,v){var w=(g.length-v)%3;return w===0?g.toString("base64",v):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",v,g.length-w))}function p(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function m(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}return X1}var Q1,R5;function au(){if(R5)return Q1;R5=1;var t=ur().Buffer,e=gc.Transform,r=WEe().StringDecoder,n=gr();function i(u){e.call(this),this.hashMode=typeof u=="string",this.hashMode?this[u]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(i,e);var a=typeof Uint8Array<"u",s=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);function o(u,c){if(u instanceof t)return u;if(typeof u=="string")return t.from(u,c);if(s&&ArrayBuffer.isView(u)){if(u.byteLength===0)return t.alloc(0);var l=t.from(u.buffer,u.byteOffset,u.byteLength);if(l.byteLength===u.byteLength)return l}if(a&&u instanceof Uint8Array||t.isBuffer(u)&&u.constructor&&typeof u.constructor.isBuffer=="function"&&u.constructor.isBuffer(u))return t.from(u);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return i.prototype.update=function(u,c,l){var d=o(u,c),f=this._update(d);return this.hashMode?this:(l&&(f=this._toString(f,l)),f)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(u,c,l){var d;try{this.hashMode?this._update(u):this.push(this._update(u))}catch(f){d=f}finally{l(d)}},i.prototype._flush=function(u){var c;try{this.push(this.__final())}catch(l){c=l}u(c)},i.prototype._finalOrDigest=function(u){var c=this.__final()||t.alloc(0);return u&&(c=this._toString(c,u,!0)),c},i.prototype._toString=function(u,c,l){if(this._decoder||(this._decoder=new r(c),this._encoding=c),this._encoding!==c)throw new Error("can’t switch encodings");var d=this._decoder.write(u);return l&&(d+=this._decoder.end()),d},Q1=i,Q1}var ev,F5;function fp(){if(F5)return ev;F5=1;var t=gr(),e=iE(),r=aE(),n=sE(),i=au();function a(s){i.call(this,"digest"),this._hash=s}return t(a,i),a.prototype._update=function(s){this._hash.update(s)},a.prototype._final=function(){return this._hash.digest()},ev=function(s){return s=s.toLowerCase(),s==="md5"?new e:s==="rmd160"||s==="ripemd160"?new r:new a(n(s))},ev}var tv,P5;function YEe(){if(P5)return tv;P5=1;var t=gr(),e=ur().Buffer,r=au(),n=e.alloc(128),i=64;function a(s,o){r.call(this,"digest"),typeof o=="string"&&(o=e.from(o)),this._alg=s,this._key=o,o.length>i?o=s(o):o.length<i&&(o=e.concat([o,n],i));for(var u=this._ipad=e.allocUnsafe(i),c=this._opad=e.allocUnsafe(i),l=0;l<i;l++)u[l]=o[l]^54,c[l]=o[l]^92;this._hash=[u]}return t(a,r),a.prototype._update=function(s){this._hash.push(s)},a.prototype._final=function(){var s=this._alg(e.concat(this._hash));return this._alg(e.concat([this._opad,s]))},tv=a,tv}var rv,B5;function xL(){if(B5)return rv;B5=1;var t=iE();return rv=function(e){return new t().update(e).digest()},rv}var nv,L5;function EL(){if(L5)return nv;L5=1;var t=gr(),e=YEe(),r=au(),n=ur().Buffer,i=xL(),a=aE(),s=sE(),o=n.alloc(128);function u(c,l){r.call(this,"digest"),typeof l=="string"&&(l=n.from(l));var d=c==="sha512"||c==="sha384"?128:64;if(this._alg=c,this._key=l,l.length>d){var f=c==="rmd160"?new a:s(c);l=f.update(l).digest()}else l.length<d&&(l=n.concat([l,o],d));for(var h=this._ipad=n.allocUnsafe(d),p=this._opad=n.allocUnsafe(d),m=0;m<d;m++)h[m]=l[m]^54,p[m]=l[m]^92;this._hash=c==="rmd160"?new a:s(c),this._hash.update(h)}return t(u,r),u.prototype._update=function(c){this._hash.update(c)},u.prototype._final=function(){var c=this._hash.digest(),l=this._alg==="rmd160"?new a:s(this._alg);return l.update(this._opad).update(c).digest()},nv=function(c,l){return c=c.toLowerCase(),c==="rmd160"||c==="ripemd160"?new u("rmd160",l):c==="md5"?new e(i,l):new u(c,l)},nv}const JEe={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},KEe={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},GEe={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},XEe={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},QEe={sign:"ecdsa",hash:"sha256",id:""},eSe={sign:"ecdsa",hash:"sha224",id:""},tSe={sign:"ecdsa",hash:"sha384",id:""},rSe={sign:"ecdsa",hash:"sha512",id:""},nSe={sign:"dsa",hash:"sha1",id:""},iSe={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},aSe={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},SL={sha224WithRSAEncryption:JEe,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:KEe,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:GEe,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:XEe,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:QEe,sha224:eSe,sha384:tSe,sha512:rSe,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:nSe,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:iSe,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:aSe,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var j5,$5;function sSe(){return $5||($5=1,j5=SL),j5}var iv={},av,U5;function TL(){if(U5)return av;U5=1;var t=Math.pow(2,30)-1;return av=function(e,r){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if(typeof r!="number")throw new TypeError("Key length not a number");if(r<0||r>t||r!==r)throw new TypeError("Bad key length")},av}var sv,z5;function DL(){if(z5)return sv;z5=1;var t;if(qr.process&&qr.process.browser)t="utf-8";else if(qr.process&&qr.process.version){var e=parseInt(process.version.split(".")[0].slice(1),10);t=e>=6?"utf-8":"binary"}else t="utf-8";return sv=t,sv}var ov,q5;function AL(){if(q5)return ov;q5=1;var t=ur().Buffer;return ov=function(e,r,n){if(t.isBuffer(e))return e;if(typeof e=="string")return t.from(e,r);if(ArrayBuffer.isView(e))return t.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},ov}var uv,V5;function NL(){if(V5)return uv;V5=1;var t=xL(),e=aE(),r=sE(),n=ur().Buffer,i=TL(),a=DL(),s=AL(),o=n.alloc(128),u={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(f,h,p){var m=l(f),y=f==="sha512"||f==="sha384"?128:64;h.length>y?h=m(h):h.length<y&&(h=n.concat([h,o],y));for(var g=n.allocUnsafe(y+u[f]),v=n.allocUnsafe(y+u[f]),w=0;w<y;w++)g[w]=h[w]^54,v[w]=h[w]^92;var x=n.allocUnsafe(y+p+4);g.copy(x,0,0,y),this.ipad1=x,this.ipad2=g,this.opad=v,this.alg=f,this.blocksize=y,this.hash=m,this.size=u[f]}c.prototype.run=function(f,h){f.copy(h,this.blocksize);var p=this.hash(h);return p.copy(this.opad,this.blocksize),this.hash(this.opad)};function l(f){function h(m){return r(f).update(m).digest()}function p(m){return new e().update(m).digest()}return f==="rmd160"||f==="ripemd160"?p:f==="md5"?t:h}function d(f,h,p,m,y){i(p,m),f=s(f,a,"Password"),h=s(h,a,"Salt"),y=y||"sha1";var g=new c(y,f,h.length),v=n.allocUnsafe(m),w=n.allocUnsafe(h.length+4);h.copy(w,0,0,h.length);for(var x=0,_=u[y],A=Math.ceil(m/_),M=1;M<=A;M++){w.writeUInt32BE(M,h.length);for(var F=g.run(w,g.ipad1),k=F,$=1;$<p;$++){k=g.run(k,g.ipad2);for(var T=0;T<_;T++)F[T]^=k[T]}F.copy(v,x),x+=_}return v}return uv=d,uv}var cv,Z5;function oSe(){if(Z5)return cv;Z5=1;var t=ur().Buffer,e=TL(),r=DL(),n=NL(),i=AL(),a,s=qr.crypto&&qr.crypto.subtle,o={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},u=[];function c(p){if(qr.process&&!qr.process.browser||!s||!s.importKey||!s.deriveBits)return Promise.resolve(!1);if(u[p]!==void 0)return u[p];a=a||t.alloc(8);var m=f(a,a,10,128,p).then(function(){return!0}).catch(function(){return!1});return u[p]=m,m}var l;function d(){return l||(qr.process&&qr.process.nextTick?l=qr.process.nextTick:qr.queueMicrotask?l=qr.queueMicrotask:qr.setImmediate?l=qr.setImmediate:l=qr.setTimeout,l)}function f(p,m,y,g,v){return s.importKey("raw",p,{name:"PBKDF2"},!1,["deriveBits"]).then(function(w){return s.deriveBits({name:"PBKDF2",salt:m,iterations:y,hash:{name:v}},w,g<<3)}).then(function(w){return t.from(w)})}function h(p,m){p.then(function(y){d()(function(){m(null,y)})},function(y){d()(function(){m(y)})})}return cv=function(p,m,y,g,v,w){typeof v=="function"&&(w=v,v=void 0),v=v||"sha1";var x=o[v.toLowerCase()];if(!x||typeof qr.Promise!="function"){d()(function(){var _;try{_=n(p,m,y,g,v)}catch(A){return w(A)}w(null,_)});return}if(e(y,g),p=i(p,r,"Password"),m=i(m,r,"Salt"),typeof w!="function")throw new Error("No callback provided to pbkdf2");h(c(x).then(function(_){return _?f(p,m,y,g,x):n(p,m,y,g,v)}),w)},cv}var H5;function IL(){return H5||(H5=1,iv.pbkdf2=oSe(),iv.pbkdf2Sync=NL()),iv}var ea={},Dc={},Ri={},W5;function CL(){if(W5)return Ri;W5=1,Ri.readUInt32BE=function(n,i){var a=n[0+i]<<24|n[1+i]<<16|n[2+i]<<8|n[3+i];return a>>>0},Ri.writeUInt32BE=function(n,i,a){n[0+a]=i>>>24,n[1+a]=i>>>16&255,n[2+a]=i>>>8&255,n[3+a]=i&255},Ri.ip=function(n,i,a,s){for(var o=0,u=0,c=6;c>=0;c-=2){for(var l=0;l<=24;l+=8)o<<=1,o|=i>>>l+c&1;for(var l=0;l<=24;l+=8)o<<=1,o|=n>>>l+c&1}for(var c=6;c>=0;c-=2){for(var l=1;l<=25;l+=8)u<<=1,u|=i>>>l+c&1;for(var l=1;l<=25;l+=8)u<<=1,u|=n>>>l+c&1}a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.rip=function(n,i,a,s){for(var o=0,u=0,c=0;c<4;c++)for(var l=24;l>=0;l-=8)o<<=1,o|=i>>>l+c&1,o<<=1,o|=n>>>l+c&1;for(var c=4;c<8;c++)for(var l=24;l>=0;l-=8)u<<=1,u|=i>>>l+c&1,u<<=1,u|=n>>>l+c&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.pc1=function(n,i,a,s){for(var o=0,u=0,c=7;c>=5;c--){for(var l=0;l<=24;l+=8)o<<=1,o|=i>>l+c&1;for(var l=0;l<=24;l+=8)o<<=1,o|=n>>l+c&1}for(var l=0;l<=24;l+=8)o<<=1,o|=i>>l+c&1;for(var c=1;c<=3;c++){for(var l=0;l<=24;l+=8)u<<=1,u|=i>>l+c&1;for(var l=0;l<=24;l+=8)u<<=1,u|=n>>l+c&1}for(var l=0;l<=24;l+=8)u<<=1,u|=n>>l+c&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.r28shl=function(n,i){return n<<i&268435455|n>>>28-i};var t=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Ri.pc2=function(n,i,a,s){for(var o=0,u=0,c=t.length>>>1,l=0;l<c;l++)o<<=1,o|=n>>>t[l]&1;for(var l=c;l<t.length;l++)u<<=1,u|=i>>>t[l]&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.expand=function(n,i,a){var s=0,o=0;s=(n&1)<<5|n>>>27;for(var u=23;u>=15;u-=4)s<<=6,s|=n>>>u&63;for(var u=11;u>=3;u-=4)o|=n>>>u&63,o<<=6;o|=(n&31)<<1|n>>>31,i[a+0]=s>>>0,i[a+1]=o>>>0};var e=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Ri.substitute=function(n,i){for(var a=0,s=0;s<4;s++){var o=n>>>18-s*6&63,u=e[s*64+o];a<<=4,a|=u}for(var s=0;s<4;s++){var o=i>>>18-s*6&63,u=e[4*64+s*64+o];a<<=4,a|=u}return a>>>0};var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return Ri.permute=function(n){for(var i=0,a=0;a<r.length;a++)i<<=1,i|=n>>>r[a]&1;return i>>>0},Ri.padSplit=function(n,i,a){for(var s=n.toString(2);s.length<i;)s="0"+s;for(var o=[],u=0;u<i;u+=a)o.push(s.slice(u,u+a));return o.join(" ")},Ri}var lv,Y5;function ha(){if(Y5)return lv;Y5=1,lv=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)},lv}var dv,J5;function oE(){if(J5)return dv;J5=1;var t=ha();function e(r){this.options=r,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=r.padding!==!1}return dv=e,e.prototype._init=function(){},e.prototype.update=function(r){return r.length===0?[]:this.type==="decrypt"?this._updateDecrypt(r):this._updateEncrypt(r)},e.prototype._buffer=function(r,n){for(var i=Math.min(this.buffer.length-this.bufferOff,r.length-n),a=0;a<i;a++)this.buffer[this.bufferOff+a]=r[n+a];return this.bufferOff+=i,i},e.prototype._flushBuffer=function(r,n){return this._update(this.buffer,0,r,n),this.bufferOff=0,this.blockSize},e.prototype._updateEncrypt=function(r){var n=0,i=0,a=(this.bufferOff+r.length)/this.blockSize|0,s=new Array(a*this.blockSize);this.bufferOff!==0&&(n+=this._buffer(r,n),this.bufferOff===this.buffer.length&&(i+=this._flushBuffer(s,i)));for(var o=r.length-(r.length-n)%this.blockSize;n<o;n+=this.blockSize)this._update(r,n,s,i),i+=this.blockSize;for(;n<r.length;n++,this.bufferOff++)this.buffer[this.bufferOff]=r[n];return s},e.prototype._updateDecrypt=function(r){for(var n=0,i=0,a=Math.ceil((this.bufferOff+r.length)/this.blockSize)-1,s=new Array(a*this.blockSize);a>0;a--)n+=this._buffer(r,n),i+=this._flushBuffer(s,i);return n+=this._buffer(r,n),s},e.prototype.final=function(r){var n;r&&(n=this.update(r));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),n?n.concat(i):i},e.prototype._pad=function(r,n){if(n===0)return!1;for(;n<r.length;)r[n++]=0;return!0},e.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var r=new Array(this.blockSize);return this._update(this.buffer,0,r,0),r},e.prototype._unpad=function(r){return r},e.prototype._finalDecrypt=function(){t.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var r=new Array(this.blockSize);return this._flushBuffer(r,0),this._unpad(r)},dv}var fv,K5;function OL(){if(K5)return fv;K5=1;var t=ha(),e=gr(),r=CL(),n=oE();function i(){this.tmp=new Array(2),this.keys=null}function a(o){n.call(this,o);var u=new i;this._desState=u,this.deriveKeys(u,o.key)}e(a,n),fv=a,a.create=function(o){return new a(o)};var s=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return a.prototype.deriveKeys=function(o,u){o.keys=new Array(16*2),t.equal(u.length,this.blockSize,"Invalid key length");var c=r.readUInt32BE(u,0),l=r.readUInt32BE(u,4);r.pc1(c,l,o.tmp,0),c=o.tmp[0],l=o.tmp[1];for(var d=0;d<o.keys.length;d+=2){var f=s[d>>>1];c=r.r28shl(c,f),l=r.r28shl(l,f),r.pc2(c,l,o.keys,d)}},a.prototype._update=function(o,u,c,l){var d=this._desState,f=r.readUInt32BE(o,u),h=r.readUInt32BE(o,u+4);r.ip(f,h,d.tmp,0),f=d.tmp[0],h=d.tmp[1],this.type==="encrypt"?this._encrypt(d,f,h,d.tmp,0):this._decrypt(d,f,h,d.tmp,0),f=d.tmp[0],h=d.tmp[1],r.writeUInt32BE(c,f,l),r.writeUInt32BE(c,h,l+4)},a.prototype._pad=function(o,u){if(this.padding===!1)return!1;for(var c=o.length-u,l=u;l<o.length;l++)o[l]=c;return!0},a.prototype._unpad=function(o){if(this.padding===!1)return o;for(var u=o[o.length-1],c=o.length-u;c<o.length;c++)t.equal(o[c],u);return o.slice(0,o.length-u)},a.prototype._encrypt=function(o,u,c,l,d){for(var f=u,h=c,p=0;p<o.keys.length;p+=2){var m=o.keys[p],y=o.keys[p+1];r.expand(h,o.tmp,0),m^=o.tmp[0],y^=o.tmp[1];var g=r.substitute(m,y),v=r.permute(g),w=h;h=(f^v)>>>0,f=w}r.rip(h,f,l,d)},a.prototype._decrypt=function(o,u,c,l,d){for(var f=c,h=u,p=o.keys.length-2;p>=0;p-=2){var m=o.keys[p],y=o.keys[p+1];r.expand(f,o.tmp,0),m^=o.tmp[0],y^=o.tmp[1];var g=r.substitute(m,y),v=r.permute(g),w=f;f=(h^v)>>>0,h=w}r.rip(f,h,l,d)},fv}var hv={},G5;function uSe(){if(G5)return hv;G5=1;var t=ha(),e=gr(),r={};function n(a){t.equal(a.length,8,"Invalid IV length"),this.iv=new Array(8);for(var s=0;s<this.iv.length;s++)this.iv[s]=a[s]}function i(a){function s(l){a.call(this,l),this._cbcInit()}e(s,a);for(var o=Object.keys(r),u=0;u<o.length;u++){var c=o[u];s.prototype[c]=r[c]}return s.create=function(l){return new s(l)},s}return hv.instantiate=i,r._cbcInit=function(){var a=new n(this.options.iv);this._cbcState=a},r._update=function(a,s,o,u){var c=this._cbcState,l=this.constructor.super_.prototype,d=c.iv;if(this.type==="encrypt"){for(var f=0;f<this.blockSize;f++)d[f]^=a[s+f];l._update.call(this,d,0,o,u);for(var f=0;f<this.blockSize;f++)d[f]=o[u+f]}else{l._update.call(this,a,s,o,u);for(var f=0;f<this.blockSize;f++)o[u+f]^=d[f];for(var f=0;f<this.blockSize;f++)d[f]=a[s+f]}},hv}var pv,X5;function cSe(){if(X5)return pv;X5=1;var t=ha(),e=gr(),r=oE(),n=OL();function i(s,o){t.equal(o.length,24,"Invalid key length");var u=o.slice(0,8),c=o.slice(8,16),l=o.slice(16,24);s==="encrypt"?this.ciphers=[n.create({type:"encrypt",key:u}),n.create({type:"decrypt",key:c}),n.create({type:"encrypt",key:l})]:this.ciphers=[n.create({type:"decrypt",key:l}),n.create({type:"encrypt",key:c}),n.create({type:"decrypt",key:u})]}function a(s){r.call(this,s);var o=new i(this.type,this.options.key);this._edeState=o}return e(a,r),pv=a,a.create=function(s){return new a(s)},a.prototype._update=function(s,o,u,c){var l=this._edeState;l.ciphers[0]._update(s,o,u,c),l.ciphers[1]._update(u,c,u,c),l.ciphers[2]._update(u,c,u,c)},a.prototype._pad=n.prototype._pad,a.prototype._unpad=n.prototype._unpad,pv}var Q5;function lSe(){return Q5||(Q5=1,Dc.utils=CL(),Dc.Cipher=oE(),Dc.DES=OL(),Dc.CBC=uSe(),Dc.EDE=cSe()),Dc}var mv,eD;function dSe(){if(eD)return mv;eD=1;var t=au(),e=lSe(),r=gr(),n=ur().Buffer,i={"des-ede3-cbc":e.CBC.instantiate(e.EDE),"des-ede3":e.EDE,"des-ede-cbc":e.CBC.instantiate(e.EDE),"des-ede":e.EDE,"des-cbc":e.CBC.instantiate(e.DES),"des-ecb":e.DES};i.des=i["des-cbc"],i.des3=i["des-ede3-cbc"],mv=a,r(a,t);function a(s){t.call(this);var o=s.mode.toLowerCase(),u=i[o],c;s.decrypt?c="decrypt":c="encrypt";var l=s.key;n.isBuffer(l)||(l=n.from(l)),(o==="des-ede"||o==="des-ede-cbc")&&(l=n.concat([l,l.slice(0,8)]));var d=s.iv;n.isBuffer(d)||(d=n.from(d)),this._des=u.create({key:l,iv:d,type:c})}return a.prototype._update=function(s){return n.from(this._des.update(s))},a.prototype._final=function(){return n.from(this._des.final())},mv}var ta={},fm={},gv={},tD;function fSe(){return tD||(tD=1,gv.encrypt=function(t,e){return t._cipher.encryptBlock(e)},gv.decrypt=function(t,e){return t._cipher.decryptBlock(e)}),gv}var hm={},rD,nD;function hp(){return nD||(nD=1,rD=function(t,e){for(var r=Math.min(t.length,e.length),n=new Buffer(r),i=0;i<r;++i)n[i]=t[i]^e[i];return n}),rD}var iD;function hSe(){if(iD)return hm;iD=1;var t=hp();return hm.encrypt=function(e,r){var n=t(r,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},hm.decrypt=function(e,r){var n=e._prev;e._prev=r;var i=e._cipher.decryptBlock(r);return t(i,n)},hm}var yv={},aD;function pSe(){if(aD)return yv;aD=1;var t=ur().Buffer,e=hp();function r(n,i,a){var s=i.length,o=e(i,n._cache);return n._cache=n._cache.slice(s),n._prev=t.concat([n._prev,a?i:o]),o}return yv.encrypt=function(n,i,a){for(var s=t.allocUnsafe(0),o;i.length;)if(n._cache.length===0&&(n._cache=n._cipher.encryptBlock(n._prev),n._prev=t.allocUnsafe(0)),n._cache.length<=i.length)o=n._cache.length,s=t.concat([s,r(n,i.slice(0,o),a)]),i=i.slice(o);else{s=t.concat([s,r(n,i,a)]);break}return s},yv}var vv={},sD;function mSe(){if(sD)return vv;sD=1;var t=ur().Buffer;function e(r,n,i){var a=r._cipher.encryptBlock(r._prev),s=a[0]^n;return r._prev=t.concat([r._prev.slice(1),t.from([i?n:s])]),s}return vv.encrypt=function(r,n,i){for(var a=n.length,s=t.allocUnsafe(a),o=-1;++o<a;)s[o]=e(r,n[o],i);return s},vv}var bv={},oD;function gSe(){if(oD)return bv;oD=1;var t=ur().Buffer;function e(n,i,a){for(var s,o=-1,u=8,c=0,l,d;++o<u;)s=n._cipher.encryptBlock(n._prev),l=i&1<<7-o?128:0,d=s[0]^l,c+=(d&128)>>o%8,n._prev=r(n._prev,a?l:d);return c}function r(n,i){var a=n.length,s=-1,o=t.allocUnsafe(n.length);for(n=t.concat([n,t.from([i])]);++s<a;)o[s]=n[s]<<1|n[s+1]>>7;return o}return bv.encrypt=function(n,i,a){for(var s=i.length,o=t.allocUnsafe(s),u=-1;++u<s;)o[u]=e(n,i[u],a);return o},bv}var wv={},uD;function ySe(){if(uD)return wv;uD=1;var t=hp();function e(r){return r._prev=r._cipher.encryptBlock(r._prev),r._prev}return wv.encrypt=function(r,n){for(;r._cache.length<n.length;)r._cache=Buffer.concat([r._cache,e(r)]);var i=r._cache.slice(0,n.length);return r._cache=r._cache.slice(n.length),t(n,i)},wv}var _v={},xv,cD;function ML(){if(cD)return xv;cD=1;function t(e){for(var r=e.length,n;r--;)if(n=e.readUInt8(r),n===255)e.writeUInt8(0,r);else{n++,e.writeUInt8(n,r);break}}return xv=t,xv}var lD;function dD(){if(lD)return _v;lD=1;var t=hp(),e=ur().Buffer,r=ML();function n(a){var s=a._cipher.encryptBlockRaw(a._prev);return r(a._prev),s}var i=16;return _v.encrypt=function(a,s){var o=Math.ceil(s.length/i),u=a._cache.length;a._cache=e.concat([a._cache,e.allocUnsafe(o*i)]);for(var c=0;c<o;c++){var l=n(a),d=u+c*i;a._cache.writeUInt32BE(l[0],d+0),a._cache.writeUInt32BE(l[1],d+4),a._cache.writeUInt32BE(l[2],d+8),a._cache.writeUInt32BE(l[3],d+12)}var f=a._cache.slice(0,s.length);return a._cache=a._cache.slice(s.length),t(s,f)},_v}const vSe={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},bSe={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},wSe={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},kL={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:vSe,aes192:bSe,aes256:wSe,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var Ev,fD;function uE(){if(fD)return Ev;fD=1;var t={ECB:fSe(),CBC:hSe(),CFB:pSe(),CFB8:mSe(),CFB1:gSe(),OFB:ySe(),CTR:dD(),GCM:dD()},e=kL;for(var r in e)e[r].module=t[e[r].mode];return Ev=e,Ev}var Sv={},hD;function Oy(){if(hD)return Sv;hD=1;var t=ur().Buffer;function e(o){t.isBuffer(o)||(o=t.from(o));for(var u=o.length/4|0,c=new Array(u),l=0;l<u;l++)c[l]=o.readUInt32BE(l*4);return c}function r(o){for(var u=0;u<o.length;o++)o[u]=0}function n(o,u,c,l,d){for(var f=c[0],h=c[1],p=c[2],m=c[3],y=o[0]^u[0],g=o[1]^u[1],v=o[2]^u[2],w=o[3]^u[3],x,_,A,M,F=4,k=1;k<d;k++)x=f[y>>>24]^h[g>>>16&255]^p[v>>>8&255]^m[w&255]^u[F++],_=f[g>>>24]^h[v>>>16&255]^p[w>>>8&255]^m[y&255]^u[F++],A=f[v>>>24]^h[w>>>16&255]^p[y>>>8&255]^m[g&255]^u[F++],M=f[w>>>24]^h[y>>>16&255]^p[g>>>8&255]^m[v&255]^u[F++],y=x,g=_,v=A,w=M;return x=(l[y>>>24]<<24|l[g>>>16&255]<<16|l[v>>>8&255]<<8|l[w&255])^u[F++],_=(l[g>>>24]<<24|l[v>>>16&255]<<16|l[w>>>8&255]<<8|l[y&255])^u[F++],A=(l[v>>>24]<<24|l[w>>>16&255]<<16|l[y>>>8&255]<<8|l[g&255])^u[F++],M=(l[w>>>24]<<24|l[y>>>16&255]<<16|l[g>>>8&255]<<8|l[v&255])^u[F++],x=x>>>0,_=_>>>0,A=A>>>0,M=M>>>0,[x,_,A,M]}var i=[0,1,2,4,8,16,32,64,128,27,54],a=function(){for(var o=new Array(256),u=0;u<256;u++)u<128?o[u]=u<<1:o[u]=u<<1^283;for(var c=[],l=[],d=[[],[],[],[]],f=[[],[],[],[]],h=0,p=0,m=0;m<256;++m){var y=p^p<<1^p<<2^p<<3^p<<4;y=y>>>8^y&255^99,c[h]=y,l[y]=h;var g=o[h],v=o[g],w=o[v],x=o[y]*257^y*16843008;d[0][h]=x<<24|x>>>8,d[1][h]=x<<16|x>>>16,d[2][h]=x<<8|x>>>24,d[3][h]=x,x=w*16843009^v*65537^g*257^h*16843008,f[0][y]=x<<24|x>>>8,f[1][y]=x<<16|x>>>16,f[2][y]=x<<8|x>>>24,f[3][y]=x,h===0?h=p=1:(h=g^o[o[o[w^g]]],p^=o[o[p]])}return{SBOX:c,INV_SBOX:l,SUB_MIX:d,INV_SUB_MIX:f}}();function s(o){this._key=e(o),this._reset()}return s.blockSize=4*4,s.keySize=256/8,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var o=this._key,u=o.length,c=u+6,l=(c+1)*4,d=[],f=0;f<u;f++)d[f]=o[f];for(f=u;f<l;f++){var h=d[f-1];f%u===0?(h=h<<8|h>>>24,h=a.SBOX[h>>>24]<<24|a.SBOX[h>>>16&255]<<16|a.SBOX[h>>>8&255]<<8|a.SBOX[h&255],h^=i[f/u|0]<<24):u>6&&f%u===4&&(h=a.SBOX[h>>>24]<<24|a.SBOX[h>>>16&255]<<16|a.SBOX[h>>>8&255]<<8|a.SBOX[h&255]),d[f]=d[f-u]^h}for(var p=[],m=0;m<l;m++){var y=l-m,g=d[y-(m%4?0:4)];m<4||y<=4?p[m]=g:p[m]=a.INV_SUB_MIX[0][a.SBOX[g>>>24]]^a.INV_SUB_MIX[1][a.SBOX[g>>>16&255]]^a.INV_SUB_MIX[2][a.SBOX[g>>>8&255]]^a.INV_SUB_MIX[3][a.SBOX[g&255]]}this._nRounds=c,this._keySchedule=d,this._invKeySchedule=p},s.prototype.encryptBlockRaw=function(o){return o=e(o),n(o,this._keySchedule,a.SUB_MIX,a.SBOX,this._nRounds)},s.prototype.encryptBlock=function(o){var u=this.encryptBlockRaw(o),c=t.allocUnsafe(16);return c.writeUInt32BE(u[0],0),c.writeUInt32BE(u[1],4),c.writeUInt32BE(u[2],8),c.writeUInt32BE(u[3],12),c},s.prototype.decryptBlock=function(o){o=e(o);var u=o[1];o[1]=o[3],o[3]=u;var c=n(o,this._invKeySchedule,a.INV_SUB_MIX,a.INV_SBOX,this._nRounds),l=t.allocUnsafe(16);return l.writeUInt32BE(c[0],0),l.writeUInt32BE(c[3],4),l.writeUInt32BE(c[2],8),l.writeUInt32BE(c[1],12),l},s.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},Sv.AES=s,Sv}var Tv,pD;function _Se(){if(pD)return Tv;pD=1;var t=ur().Buffer,e=t.alloc(16,0);function r(a){return[a.readUInt32BE(0),a.readUInt32BE(4),a.readUInt32BE(8),a.readUInt32BE(12)]}function n(a){var s=t.allocUnsafe(16);return s.writeUInt32BE(a[0]>>>0,0),s.writeUInt32BE(a[1]>>>0,4),s.writeUInt32BE(a[2]>>>0,8),s.writeUInt32BE(a[3]>>>0,12),s}function i(a){this.h=a,this.state=t.alloc(16,0),this.cache=t.allocUnsafe(0)}return i.prototype.ghash=function(a){for(var s=-1;++s<a.length;)this.state[s]^=a[s];this._multiply()},i.prototype._multiply=function(){for(var a=r(this.h),s=[0,0,0,0],o,u,c,l=-1;++l<128;){for(u=(this.state[~~(l/8)]&1<<7-l%8)!==0,u&&(s[0]^=a[0],s[1]^=a[1],s[2]^=a[2],s[3]^=a[3]),c=(a[3]&1)!==0,o=3;o>0;o--)a[o]=a[o]>>>1|(a[o-1]&1)<<31;a[0]=a[0]>>>1,c&&(a[0]=a[0]^225<<24)}this.state=n(s)},i.prototype.update=function(a){this.cache=t.concat([this.cache,a]);for(var s;this.cache.length>=16;)s=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(s)},i.prototype.final=function(a,s){return this.cache.length&&this.ghash(t.concat([this.cache,e],16)),this.ghash(n([0,a,0,s])),this.state},Tv=i,Tv}var Dv,mD;function RL(){if(mD)return Dv;mD=1;var t=Oy(),e=ur().Buffer,r=au(),n=gr(),i=_Se(),a=hp(),s=ML();function o(l,d){var f=0;l.length!==d.length&&f++;for(var h=Math.min(l.length,d.length),p=0;p<h;++p)f+=l[p]^d[p];return f}function u(l,d,f){if(d.length===12)return l._finID=e.concat([d,e.from([0,0,0,1])]),e.concat([d,e.from([0,0,0,2])]);var h=new i(f),p=d.length,m=p%16;h.update(d),m&&(m=16-m,h.update(e.alloc(m,0))),h.update(e.alloc(8,0));var y=p*8,g=e.alloc(8);g.writeUIntBE(y,0,8),h.update(g),l._finID=h.state;var v=e.from(l._finID);return s(v),v}function c(l,d,f,h){r.call(this);var p=e.alloc(4,0);this._cipher=new t.AES(d);var m=this._cipher.encryptBlock(p);this._ghash=new i(m),f=u(this,f,m),this._prev=e.from(f),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=h,this._alen=0,this._len=0,this._mode=l,this._authTag=null,this._called=!1}return n(c,r),c.prototype._update=function(l){if(!this._called&&this._alen){var d=16-this._alen%16;d<16&&(d=e.alloc(d,0),this._ghash.update(d))}this._called=!0;var f=this._mode.encrypt(this,l);return this._decrypt?this._ghash.update(l):this._ghash.update(f),this._len+=l.length,f},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var l=a(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&o(l,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=l,this._cipher.scrub()},c.prototype.getAuthTag=function(){if(this._decrypt||!e.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},c.prototype.setAuthTag=function(l){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=l},c.prototype.setAAD=function(l){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(l),this._alen+=l.length},Dv=c,Dv}var Av,gD;function FL(){if(gD)return Av;gD=1;var t=Oy(),e=ur().Buffer,r=au(),n=gr();function i(a,s,o,u){r.call(this),this._cipher=new t.AES(s),this._prev=e.from(o),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=u,this._mode=a}return n(i,r),i.prototype._update=function(a){return this._mode.encrypt(this,a,this._decrypt)},i.prototype._final=function(){this._cipher.scrub()},Av=i,Av}var Nv,yD;function My(){if(yD)return Nv;yD=1;var t=ur().Buffer,e=iE();function r(n,i,a,s){if(t.isBuffer(n)||(n=t.from(n,"binary")),i&&(t.isBuffer(i)||(i=t.from(i,"binary")),i.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=a/8,u=t.alloc(o),c=t.alloc(s||0),l=t.alloc(0);o>0||s>0;){var d=new e;d.update(l),d.update(n),i&&d.update(i),l=d.digest();var f=0;if(o>0){var h=u.length-o;f=Math.min(o,l.length),l.copy(u,h,0,f),o-=f}if(f<l.length&&s>0){var p=c.length-s,m=Math.min(s,l.length-f);l.copy(c,p,f,f+m),s-=m}}return l.fill(0),{key:u,iv:c}}return Nv=r,Nv}var vD;function xSe(){if(vD)return fm;vD=1;var t=uE(),e=RL(),r=ur().Buffer,n=FL(),i=au(),a=Oy(),s=My(),o=gr();function u(h,p,m){i.call(this),this._cache=new l,this._cipher=new a.AES(p),this._prev=r.from(m),this._mode=h,this._autopadding=!0}o(u,i),u.prototype._update=function(h){this._cache.add(h);for(var p,m,y=[];p=this._cache.get();)m=this._mode.encrypt(this,p),y.push(m);return r.concat(y)};var c=r.alloc(16,16);u.prototype._final=function(){var h=this._cache.flush();if(this._autopadding)return h=this._mode.encrypt(this,h),this._cipher.scrub(),h;if(!h.equals(c))throw this._cipher.scrub(),new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(h){return this._autopadding=!!h,this};function l(){this.cache=r.allocUnsafe(0)}l.prototype.add=function(h){this.cache=r.concat([this.cache,h])},l.prototype.get=function(){if(this.cache.length>15){var h=this.cache.slice(0,16);return this.cache=this.cache.slice(16),h}return null},l.prototype.flush=function(){for(var h=16-this.cache.length,p=r.allocUnsafe(h),m=-1;++m<h;)p.writeUInt8(h,m);return r.concat([this.cache,p])};function d(h,p,m){var y=t[h.toLowerCase()];if(!y)throw new TypeError("invalid suite type");if(typeof p=="string"&&(p=r.from(p)),p.length!==y.key/8)throw new TypeError("invalid key length "+p.length);if(typeof m=="string"&&(m=r.from(m)),y.mode!=="GCM"&&m.length!==y.iv)throw new TypeError("invalid iv length "+m.length);return y.type==="stream"?new n(y.module,p,m):y.type==="auth"?new e(y.module,p,m):new u(y.module,p,m)}function f(h,p){var m=t[h.toLowerCase()];if(!m)throw new TypeError("invalid suite type");var y=s(p,!1,m.key,m.iv);return d(h,y.key,y.iv)}return fm.createCipheriv=d,fm.createCipher=f,fm}var pm={},bD;function ESe(){if(bD)return pm;bD=1;var t=RL(),e=ur().Buffer,r=uE(),n=FL(),i=au(),a=Oy(),s=My(),o=gr();function u(h,p,m){i.call(this),this._cache=new c,this._last=void 0,this._cipher=new a.AES(p),this._prev=e.from(m),this._mode=h,this._autopadding=!0}o(u,i),u.prototype._update=function(h){this._cache.add(h);for(var p,m,y=[];p=this._cache.get(this._autopadding);)m=this._mode.decrypt(this,p),y.push(m);return e.concat(y)},u.prototype._final=function(){var h=this._cache.flush();if(this._autopadding)return l(this._mode.decrypt(this,h));if(h)throw new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(h){return this._autopadding=!!h,this};function c(){this.cache=e.allocUnsafe(0)}c.prototype.add=function(h){this.cache=e.concat([this.cache,h])},c.prototype.get=function(h){var p;if(h){if(this.cache.length>16)return p=this.cache.slice(0,16),this.cache=this.cache.slice(16),p}else if(this.cache.length>=16)return p=this.cache.slice(0,16),this.cache=this.cache.slice(16),p;return null},c.prototype.flush=function(){if(this.cache.length)return this.cache};function l(h){var p=h[15];if(p<1||p>16)throw new Error("unable to decrypt data");for(var m=-1;++m<p;)if(h[m+(16-p)]!==p)throw new Error("unable to decrypt data");if(p!==16)return h.slice(0,16-p)}function d(h,p,m){var y=r[h.toLowerCase()];if(!y)throw new TypeError("invalid suite type");if(typeof m=="string"&&(m=e.from(m)),y.mode!=="GCM"&&m.length!==y.iv)throw new TypeError("invalid iv length "+m.length);if(typeof p=="string"&&(p=e.from(p)),p.length!==y.key/8)throw new TypeError("invalid key length "+p.length);return y.type==="stream"?new n(y.module,p,m,!0):y.type==="auth"?new t(y.module,p,m,!0):new u(y.module,p,m)}function f(h,p){var m=r[h.toLowerCase()];if(!m)throw new TypeError("invalid suite type");var y=s(p,!1,m.key,m.iv);return d(h,y.key,y.iv)}return pm.createDecipher=f,pm.createDecipheriv=d,pm}var wD;function cE(){if(wD)return ta;wD=1;var t=xSe(),e=ESe(),r=kL;function n(){return Object.keys(r)}return ta.createCipher=ta.Cipher=t.createCipher,ta.createCipheriv=ta.Cipheriv=t.createCipheriv,ta.createDecipher=ta.Decipher=e.createDecipher,ta.createDecipheriv=ta.Decipheriv=e.createDecipheriv,ta.listCiphers=ta.getCiphers=n,ta}var _D={},xD;function SSe(){return xD||(xD=1,function(t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}}(_D)),_D}var ED;function TSe(){if(ED)return ea;ED=1;var t=dSe(),e=cE(),r=uE(),n=SSe(),i=My();function a(l,d){l=l.toLowerCase();var f,h;if(r[l])f=r[l].key,h=r[l].iv;else if(n[l])f=n[l].key*8,h=n[l].iv;else throw new TypeError("invalid suite type");var p=i(d,!1,f,h);return o(l,p.key,p.iv)}function s(l,d){l=l.toLowerCase();var f,h;if(r[l])f=r[l].key,h=r[l].iv;else if(n[l])f=n[l].key*8,h=n[l].iv;else throw new TypeError("invalid suite type");var p=i(d,!1,f,h);return u(l,p.key,p.iv)}function o(l,d,f){if(l=l.toLowerCase(),r[l])return e.createCipheriv(l,d,f);if(n[l])return new t({key:d,iv:f,mode:l});throw new TypeError("invalid suite type")}function u(l,d,f){if(l=l.toLowerCase(),r[l])return e.createDecipheriv(l,d,f);if(n[l])return new t({key:d,iv:f,mode:l,decrypt:!0});throw new TypeError("invalid suite type")}function c(){return Object.keys(n).concat(e.getCiphers())}return ea.createCipher=ea.Cipher=a,ea.createCipheriv=ea.Cipheriv=o,ea.createDecipher=ea.Decipher=s,ea.createDecipheriv=ea.Decipheriv=u,ea.listCiphers=ea.getCiphers=c,ea}var fu={},S_={exports:{}},DSe=S_.exports,SD;function ei(){return SD||(SD=1,function(t){(function(e,r){function n(T,N){if(!T)throw new Error(N||"Assertion failed")}function i(T,N){T.super_=N;var b=function(){};b.prototype=N.prototype,T.prototype=new b,T.prototype.constructor=T}function a(T,N,b){if(a.isBN(T))return T;this.negative=0,this.words=null,this.length=0,this.red=null,T!==null&&((N==="le"||N==="be")&&(b=N,N=10),this._init(T||0,N||10,b||"be"))}typeof e=="object"?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=gc.Buffer}catch{}a.isBN=function(T){return T instanceof a?!0:T!==null&&typeof T=="object"&&T.constructor.wordSize===a.wordSize&&Array.isArray(T.words)},a.max=function(T,N){return T.cmp(N)>0?T:N},a.min=function(T,N){return T.cmp(N)<0?T:N},a.prototype._init=function(T,N,b){if(typeof T=="number")return this._initNumber(T,N,b);if(typeof T=="object")return this._initArray(T,N,b);N==="hex"&&(N=16),n(N===(N|0)&&N>=2&&N<=36),T=T.toString().replace(/\s+/g,"");var E=0;T[0]==="-"&&(E++,this.negative=1),E<T.length&&(N===16?this._parseHex(T,E,b):(this._parseBase(T,N,E),b==="le"&&this._initArray(this.toArray(),N,b)))},a.prototype._initNumber=function(T,N,b){T<0&&(this.negative=1,T=-T),T<67108864?(this.words=[T&67108863],this.length=1):T<4503599627370496?(this.words=[T&67108863,T/67108864&67108863],this.length=2):(n(T<9007199254740992),this.words=[T&67108863,T/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),N,b)},a.prototype._initArray=function(T,N,b){if(n(typeof T.length=="number"),T.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(T.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var D,C,I=0;if(b==="be")for(E=T.length-1,D=0;E>=0;E-=3)C=T[E]|T[E-1]<<8|T[E-2]<<16,this.words[D]|=C<<I&67108863,this.words[D+1]=C>>>26-I&67108863,I+=24,I>=26&&(I-=26,D++);else if(b==="le")for(E=0,D=0;E<T.length;E+=3)C=T[E]|T[E+1]<<8|T[E+2]<<16,this.words[D]|=C<<I&67108863,this.words[D+1]=C>>>26-I&67108863,I+=24,I>=26&&(I-=26,D++);return this.strip()};function o(T,N){var b=T.charCodeAt(N);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function u(T,N,b){var E=o(T,b);return b-1>=N&&(E|=o(T,b-1)<<4),E}a.prototype._parseHex=function(T,N,b){this.length=Math.ceil((T.length-N)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var D=0,C=0,I;if(b==="be")for(E=T.length-1;E>=N;E-=2)I=u(T,N,E)<<D,this.words[C]|=I&67108863,D>=18?(D-=18,C+=1,this.words[C]|=I>>>26):D+=8;else{var O=T.length-N;for(E=O%2===0?N+1:N;E<T.length;E+=2)I=u(T,N,E)<<D,this.words[C]|=I&67108863,D>=18?(D-=18,C+=1,this.words[C]|=I>>>26):D+=8}this.strip()};function c(T,N,b,E){for(var D=0,C=Math.min(T.length,b),I=N;I<C;I++){var O=T.charCodeAt(I)-48;D*=E,O>=49?D+=O-49+10:O>=17?D+=O-17+10:D+=O}return D}a.prototype._parseBase=function(T,N,b){this.words=[0],this.length=1;for(var E=0,D=1;D<=67108863;D*=N)E++;E--,D=D/N|0;for(var C=T.length-b,I=C%E,O=Math.min(C,C-I)+b,S=0,P=b;P<O;P+=E)S=c(T,P,P+E,N),this.imuln(D),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S);if(I!==0){var R=1;for(S=c(T,P,T.length,N),P=0;P<I;P++)R*=N;this.imuln(R),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S)}this.strip()},a.prototype.copy=function(T){T.words=new Array(this.length);for(var N=0;N<this.length;N++)T.words[N]=this.words[N];T.length=this.length,T.negative=this.negative,T.red=this.red},a.prototype.clone=function(){var T=new a(null);return this.copy(T),T},a.prototype._expand=function(T){for(;this.length<T;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(T,N){T=T||10,N=N|0||1;var b;if(T===16||T==="hex"){b="";for(var E=0,D=0,C=0;C<this.length;C++){var I=this.words[C],O=((I<<E|D)&16777215).toString(16);D=I>>>24-E&16777215,E+=2,E>=26&&(E-=26,C--),D!==0||C!==this.length-1?b=l[6-O.length]+O+b:b=O+b}for(D!==0&&(b=D.toString(16)+b);b.length%N!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(T===(T|0)&&T>=2&&T<=36){var S=d[T],P=f[T];b="";var R=this.clone();for(R.negative=0;!R.isZero();){var L=R.modn(P).toString(T);R=R.idivn(P),R.isZero()?b=L+b:b=l[S-L.length]+L+b}for(this.isZero()&&(b="0"+b);b.length%N!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var T=this.words[0];return this.length===2?T+=this.words[1]*67108864:this.length===3&&this.words[2]===1?T+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-T:T},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(T,N){return n(typeof s<"u"),this.toArrayLike(s,T,N)},a.prototype.toArray=function(T,N){return this.toArrayLike(Array,T,N)},a.prototype.toArrayLike=function(T,N,b){var E=this.byteLength(),D=b||Math.max(1,E);n(E<=D,"byte array longer than desired length"),n(D>0,"Requested array length <= 0"),this.strip();var C=N==="le",I=new T(D),O,S,P=this.clone();if(C){for(S=0;!P.isZero();S++)O=P.andln(255),P.iushrn(8),I[S]=O;for(;S<D;S++)I[S]=0}else{for(S=0;S<D-E;S++)I[S]=0;for(S=0;!P.isZero();S++)O=P.andln(255),P.iushrn(8),I[D-S-1]=O}return I},Math.clz32?a.prototype._countBits=function(T){return 32-Math.clz32(T)}:a.prototype._countBits=function(T){var N=T,b=0;return N>=4096&&(b+=13,N>>>=13),N>=64&&(b+=7,N>>>=7),N>=8&&(b+=4,N>>>=4),N>=2&&(b+=2,N>>>=2),b+N},a.prototype._zeroBits=function(T){if(T===0)return 26;var N=T,b=0;return N&8191||(b+=13,N>>>=13),N&127||(b+=7,N>>>=7),N&15||(b+=4,N>>>=4),N&3||(b+=2,N>>>=2),N&1||b++,b},a.prototype.bitLength=function(){var T=this.words[this.length-1],N=this._countBits(T);return(this.length-1)*26+N};function h(T){for(var N=new Array(T.bitLength()),b=0;b<N.length;b++){var E=b/26|0,D=b%26;N[b]=(T.words[E]&1<<D)>>>D}return N}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var T=0,N=0;N<this.length;N++){var b=this._zeroBits(this.words[N]);if(T+=b,b!==26)break}return T},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(T){return this.negative!==0?this.abs().inotn(T).iaddn(1):this.clone()},a.prototype.fromTwos=function(T){return this.testn(T-1)?this.notn(T).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(T){for(;this.length<T.length;)this.words[this.length++]=0;for(var N=0;N<T.length;N++)this.words[N]=this.words[N]|T.words[N];return this.strip()},a.prototype.ior=function(T){return n((this.negative|T.negative)===0),this.iuor(T)},a.prototype.or=function(T){return this.length>T.length?this.clone().ior(T):T.clone().ior(this)},a.prototype.uor=function(T){return this.length>T.length?this.clone().iuor(T):T.clone().iuor(this)},a.prototype.iuand=function(T){var N;this.length>T.length?N=T:N=this;for(var b=0;b<N.length;b++)this.words[b]=this.words[b]&T.words[b];return this.length=N.length,this.strip()},a.prototype.iand=function(T){return n((this.negative|T.negative)===0),this.iuand(T)},a.prototype.and=function(T){return this.length>T.length?this.clone().iand(T):T.clone().iand(this)},a.prototype.uand=function(T){return this.length>T.length?this.clone().iuand(T):T.clone().iuand(this)},a.prototype.iuxor=function(T){var N,b;this.length>T.length?(N=this,b=T):(N=T,b=this);for(var E=0;E<b.length;E++)this.words[E]=N.words[E]^b.words[E];if(this!==N)for(;E<N.length;E++)this.words[E]=N.words[E];return this.length=N.length,this.strip()},a.prototype.ixor=function(T){return n((this.negative|T.negative)===0),this.iuxor(T)},a.prototype.xor=function(T){return this.length>T.length?this.clone().ixor(T):T.clone().ixor(this)},a.prototype.uxor=function(T){return this.length>T.length?this.clone().iuxor(T):T.clone().iuxor(this)},a.prototype.inotn=function(T){n(typeof T=="number"&&T>=0);var N=Math.ceil(T/26)|0,b=T%26;this._expand(N),b>0&&N--;for(var E=0;E<N;E++)this.words[E]=~this.words[E]&67108863;return b>0&&(this.words[E]=~this.words[E]&67108863>>26-b),this.strip()},a.prototype.notn=function(T){return this.clone().inotn(T)},a.prototype.setn=function(T,N){n(typeof T=="number"&&T>=0);var b=T/26|0,E=T%26;return this._expand(b+1),N?this.words[b]=this.words[b]|1<<E:this.words[b]=this.words[b]&~(1<<E),this.strip()},a.prototype.iadd=function(T){var N;if(this.negative!==0&&T.negative===0)return this.negative=0,N=this.isub(T),this.negative^=1,this._normSign();if(this.negative===0&&T.negative!==0)return T.negative=0,N=this.isub(T),T.negative=1,N._normSign();var b,E;this.length>T.length?(b=this,E=T):(b=T,E=this);for(var D=0,C=0;C<E.length;C++)N=(b.words[C]|0)+(E.words[C]|0)+D,this.words[C]=N&67108863,D=N>>>26;for(;D!==0&&C<b.length;C++)N=(b.words[C]|0)+D,this.words[C]=N&67108863,D=N>>>26;if(this.length=b.length,D!==0)this.words[this.length]=D,this.length++;else if(b!==this)for(;C<b.length;C++)this.words[C]=b.words[C];return this},a.prototype.add=function(T){var N;return T.negative!==0&&this.negative===0?(T.negative=0,N=this.sub(T),T.negative^=1,N):T.negative===0&&this.negative!==0?(this.negative=0,N=T.sub(this),this.negative=1,N):this.length>T.length?this.clone().iadd(T):T.clone().iadd(this)},a.prototype.isub=function(T){if(T.negative!==0){T.negative=0;var N=this.iadd(T);return T.negative=1,N._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(T),this.negative=1,this._normSign();var b=this.cmp(T);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,D;b>0?(E=this,D=T):(E=T,D=this);for(var C=0,I=0;I<D.length;I++)N=(E.words[I]|0)-(D.words[I]|0)+C,C=N>>26,this.words[I]=N&67108863;for(;C!==0&&I<E.length;I++)N=(E.words[I]|0)+C,C=N>>26,this.words[I]=N&67108863;if(C===0&&I<E.length&&E!==this)for(;I<E.length;I++)this.words[I]=E.words[I];return this.length=Math.max(this.length,I),E!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(T){return this.clone().isub(T)};function p(T,N,b){b.negative=N.negative^T.negative;var E=T.length+N.length|0;b.length=E,E=E-1|0;var D=T.words[0]|0,C=N.words[0]|0,I=D*C,O=I&67108863,S=I/67108864|0;b.words[0]=O;for(var P=1;P<E;P++){for(var R=S>>>26,L=S&67108863,q=Math.min(P,N.length-1),J=Math.max(0,P-T.length+1);J<=q;J++){var G=P-J|0;D=T.words[G]|0,C=N.words[J]|0,I=D*C+L,R+=I/67108864|0,L=I&67108863}b.words[P]=L|0,S=R|0}return S!==0?b.words[P]=S|0:b.length--,b.strip()}var m=function(T,N,b){var E=T.words,D=N.words,C=b.words,I=0,O,S,P,R=E[0]|0,L=R&8191,q=R>>>13,J=E[1]|0,G=J&8191,ie=J>>>13,z=E[2]|0,V=z&8191,Q=z>>>13,ae=E[3]|0,oe=ae&8191,le=ae>>>13,he=E[4]|0,Z=he&8191,K=he>>>13,B=E[5]|0,j=B&8191,U=B>>>13,W=E[6]|0,ee=W&8191,te=W>>>13,ne=E[7]|0,Y=ne&8191,re=ne>>>13,ce=E[8]|0,de=ce&8191,ve=ce>>>13,we=E[9]|0,Ae=we&8191,Ne=we>>>13,Pe=D[0]|0,Ce=Pe&8191,Qe=Pe>>>13,ft=D[1]|0,$e=ft&8191,Et=ft>>>13,H=D[2]|0,pe=H&8191,Ee=H>>>13,Oe=D[3]|0,je=Oe&8191,it=Oe>>>13,jt=D[4]|0,Ft=jt&8191,Br=jt>>>13,Or=D[5]|0,Mt=Or&8191,jr=Or>>>13,$r=D[6]|0,me=$r&8191,be=$r>>>13,De=D[7]|0,Ie=De&8191,Ze=De>>>13,tt=D[8]|0,Ye=tt&8191,We=tt>>>13,Je=D[9]|0,Be=Je&8191,rt=Je>>>13;b.negative=T.negative^N.negative,b.length=19,O=Math.imul(L,Ce),S=Math.imul(L,Qe),S=S+Math.imul(q,Ce)|0,P=Math.imul(q,Qe);var ht=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(ht>>>26)|0,ht&=67108863,O=Math.imul(G,Ce),S=Math.imul(G,Qe),S=S+Math.imul(ie,Ce)|0,P=Math.imul(ie,Qe),O=O+Math.imul(L,$e)|0,S=S+Math.imul(L,Et)|0,S=S+Math.imul(q,$e)|0,P=P+Math.imul(q,Et)|0;var gt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(V,Ce),S=Math.imul(V,Qe),S=S+Math.imul(Q,Ce)|0,P=Math.imul(Q,Qe),O=O+Math.imul(G,$e)|0,S=S+Math.imul(G,Et)|0,S=S+Math.imul(ie,$e)|0,P=P+Math.imul(ie,Et)|0,O=O+Math.imul(L,pe)|0,S=S+Math.imul(L,Ee)|0,S=S+Math.imul(q,pe)|0,P=P+Math.imul(q,Ee)|0;var Ur=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,O=Math.imul(oe,Ce),S=Math.imul(oe,Qe),S=S+Math.imul(le,Ce)|0,P=Math.imul(le,Qe),O=O+Math.imul(V,$e)|0,S=S+Math.imul(V,Et)|0,S=S+Math.imul(Q,$e)|0,P=P+Math.imul(Q,Et)|0,O=O+Math.imul(G,pe)|0,S=S+Math.imul(G,Ee)|0,S=S+Math.imul(ie,pe)|0,P=P+Math.imul(ie,Ee)|0,O=O+Math.imul(L,je)|0,S=S+Math.imul(L,it)|0,S=S+Math.imul(q,je)|0,P=P+Math.imul(q,it)|0;var fr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(fr>>>26)|0,fr&=67108863,O=Math.imul(Z,Ce),S=Math.imul(Z,Qe),S=S+Math.imul(K,Ce)|0,P=Math.imul(K,Qe),O=O+Math.imul(oe,$e)|0,S=S+Math.imul(oe,Et)|0,S=S+Math.imul(le,$e)|0,P=P+Math.imul(le,Et)|0,O=O+Math.imul(V,pe)|0,S=S+Math.imul(V,Ee)|0,S=S+Math.imul(Q,pe)|0,P=P+Math.imul(Q,Ee)|0,O=O+Math.imul(G,je)|0,S=S+Math.imul(G,it)|0,S=S+Math.imul(ie,je)|0,P=P+Math.imul(ie,it)|0,O=O+Math.imul(L,Ft)|0,S=S+Math.imul(L,Br)|0,S=S+Math.imul(q,Ft)|0,P=P+Math.imul(q,Br)|0;var Jt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,O=Math.imul(j,Ce),S=Math.imul(j,Qe),S=S+Math.imul(U,Ce)|0,P=Math.imul(U,Qe),O=O+Math.imul(Z,$e)|0,S=S+Math.imul(Z,Et)|0,S=S+Math.imul(K,$e)|0,P=P+Math.imul(K,Et)|0,O=O+Math.imul(oe,pe)|0,S=S+Math.imul(oe,Ee)|0,S=S+Math.imul(le,pe)|0,P=P+Math.imul(le,Ee)|0,O=O+Math.imul(V,je)|0,S=S+Math.imul(V,it)|0,S=S+Math.imul(Q,je)|0,P=P+Math.imul(Q,it)|0,O=O+Math.imul(G,Ft)|0,S=S+Math.imul(G,Br)|0,S=S+Math.imul(ie,Ft)|0,P=P+Math.imul(ie,Br)|0,O=O+Math.imul(L,Mt)|0,S=S+Math.imul(L,jr)|0,S=S+Math.imul(q,Mt)|0,P=P+Math.imul(q,jr)|0;var Sr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,O=Math.imul(ee,Ce),S=Math.imul(ee,Qe),S=S+Math.imul(te,Ce)|0,P=Math.imul(te,Qe),O=O+Math.imul(j,$e)|0,S=S+Math.imul(j,Et)|0,S=S+Math.imul(U,$e)|0,P=P+Math.imul(U,Et)|0,O=O+Math.imul(Z,pe)|0,S=S+Math.imul(Z,Ee)|0,S=S+Math.imul(K,pe)|0,P=P+Math.imul(K,Ee)|0,O=O+Math.imul(oe,je)|0,S=S+Math.imul(oe,it)|0,S=S+Math.imul(le,je)|0,P=P+Math.imul(le,it)|0,O=O+Math.imul(V,Ft)|0,S=S+Math.imul(V,Br)|0,S=S+Math.imul(Q,Ft)|0,P=P+Math.imul(Q,Br)|0,O=O+Math.imul(G,Mt)|0,S=S+Math.imul(G,jr)|0,S=S+Math.imul(ie,Mt)|0,P=P+Math.imul(ie,jr)|0,O=O+Math.imul(L,me)|0,S=S+Math.imul(L,be)|0,S=S+Math.imul(q,me)|0,P=P+Math.imul(q,be)|0;var Fn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(Y,Ce),S=Math.imul(Y,Qe),S=S+Math.imul(re,Ce)|0,P=Math.imul(re,Qe),O=O+Math.imul(ee,$e)|0,S=S+Math.imul(ee,Et)|0,S=S+Math.imul(te,$e)|0,P=P+Math.imul(te,Et)|0,O=O+Math.imul(j,pe)|0,S=S+Math.imul(j,Ee)|0,S=S+Math.imul(U,pe)|0,P=P+Math.imul(U,Ee)|0,O=O+Math.imul(Z,je)|0,S=S+Math.imul(Z,it)|0,S=S+Math.imul(K,je)|0,P=P+Math.imul(K,it)|0,O=O+Math.imul(oe,Ft)|0,S=S+Math.imul(oe,Br)|0,S=S+Math.imul(le,Ft)|0,P=P+Math.imul(le,Br)|0,O=O+Math.imul(V,Mt)|0,S=S+Math.imul(V,jr)|0,S=S+Math.imul(Q,Mt)|0,P=P+Math.imul(Q,jr)|0,O=O+Math.imul(G,me)|0,S=S+Math.imul(G,be)|0,S=S+Math.imul(ie,me)|0,P=P+Math.imul(ie,be)|0,O=O+Math.imul(L,Ie)|0,S=S+Math.imul(L,Ze)|0,S=S+Math.imul(q,Ie)|0,P=P+Math.imul(q,Ze)|0;var qn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(qn>>>26)|0,qn&=67108863,O=Math.imul(de,Ce),S=Math.imul(de,Qe),S=S+Math.imul(ve,Ce)|0,P=Math.imul(ve,Qe),O=O+Math.imul(Y,$e)|0,S=S+Math.imul(Y,Et)|0,S=S+Math.imul(re,$e)|0,P=P+Math.imul(re,Et)|0,O=O+Math.imul(ee,pe)|0,S=S+Math.imul(ee,Ee)|0,S=S+Math.imul(te,pe)|0,P=P+Math.imul(te,Ee)|0,O=O+Math.imul(j,je)|0,S=S+Math.imul(j,it)|0,S=S+Math.imul(U,je)|0,P=P+Math.imul(U,it)|0,O=O+Math.imul(Z,Ft)|0,S=S+Math.imul(Z,Br)|0,S=S+Math.imul(K,Ft)|0,P=P+Math.imul(K,Br)|0,O=O+Math.imul(oe,Mt)|0,S=S+Math.imul(oe,jr)|0,S=S+Math.imul(le,Mt)|0,P=P+Math.imul(le,jr)|0,O=O+Math.imul(V,me)|0,S=S+Math.imul(V,be)|0,S=S+Math.imul(Q,me)|0,P=P+Math.imul(Q,be)|0,O=O+Math.imul(G,Ie)|0,S=S+Math.imul(G,Ze)|0,S=S+Math.imul(ie,Ie)|0,P=P+Math.imul(ie,Ze)|0,O=O+Math.imul(L,Ye)|0,S=S+Math.imul(L,We)|0,S=S+Math.imul(q,Ye)|0,P=P+Math.imul(q,We)|0;var bn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(bn>>>26)|0,bn&=67108863,O=Math.imul(Ae,Ce),S=Math.imul(Ae,Qe),S=S+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,Qe),O=O+Math.imul(de,$e)|0,S=S+Math.imul(de,Et)|0,S=S+Math.imul(ve,$e)|0,P=P+Math.imul(ve,Et)|0,O=O+Math.imul(Y,pe)|0,S=S+Math.imul(Y,Ee)|0,S=S+Math.imul(re,pe)|0,P=P+Math.imul(re,Ee)|0,O=O+Math.imul(ee,je)|0,S=S+Math.imul(ee,it)|0,S=S+Math.imul(te,je)|0,P=P+Math.imul(te,it)|0,O=O+Math.imul(j,Ft)|0,S=S+Math.imul(j,Br)|0,S=S+Math.imul(U,Ft)|0,P=P+Math.imul(U,Br)|0,O=O+Math.imul(Z,Mt)|0,S=S+Math.imul(Z,jr)|0,S=S+Math.imul(K,Mt)|0,P=P+Math.imul(K,jr)|0,O=O+Math.imul(oe,me)|0,S=S+Math.imul(oe,be)|0,S=S+Math.imul(le,me)|0,P=P+Math.imul(le,be)|0,O=O+Math.imul(V,Ie)|0,S=S+Math.imul(V,Ze)|0,S=S+Math.imul(Q,Ie)|0,P=P+Math.imul(Q,Ze)|0,O=O+Math.imul(G,Ye)|0,S=S+Math.imul(G,We)|0,S=S+Math.imul(ie,Ye)|0,P=P+Math.imul(ie,We)|0,O=O+Math.imul(L,Be)|0,S=S+Math.imul(L,rt)|0,S=S+Math.imul(q,Be)|0,P=P+Math.imul(q,rt)|0;var Qr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,O=Math.imul(Ae,$e),S=Math.imul(Ae,Et),S=S+Math.imul(Ne,$e)|0,P=Math.imul(Ne,Et),O=O+Math.imul(de,pe)|0,S=S+Math.imul(de,Ee)|0,S=S+Math.imul(ve,pe)|0,P=P+Math.imul(ve,Ee)|0,O=O+Math.imul(Y,je)|0,S=S+Math.imul(Y,it)|0,S=S+Math.imul(re,je)|0,P=P+Math.imul(re,it)|0,O=O+Math.imul(ee,Ft)|0,S=S+Math.imul(ee,Br)|0,S=S+Math.imul(te,Ft)|0,P=P+Math.imul(te,Br)|0,O=O+Math.imul(j,Mt)|0,S=S+Math.imul(j,jr)|0,S=S+Math.imul(U,Mt)|0,P=P+Math.imul(U,jr)|0,O=O+Math.imul(Z,me)|0,S=S+Math.imul(Z,be)|0,S=S+Math.imul(K,me)|0,P=P+Math.imul(K,be)|0,O=O+Math.imul(oe,Ie)|0,S=S+Math.imul(oe,Ze)|0,S=S+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ze)|0,O=O+Math.imul(V,Ye)|0,S=S+Math.imul(V,We)|0,S=S+Math.imul(Q,Ye)|0,P=P+Math.imul(Q,We)|0,O=O+Math.imul(G,Be)|0,S=S+Math.imul(G,rt)|0,S=S+Math.imul(ie,Be)|0,P=P+Math.imul(ie,rt)|0;var kt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(kt>>>26)|0,kt&=67108863,O=Math.imul(Ae,pe),S=Math.imul(Ae,Ee),S=S+Math.imul(Ne,pe)|0,P=Math.imul(Ne,Ee),O=O+Math.imul(de,je)|0,S=S+Math.imul(de,it)|0,S=S+Math.imul(ve,je)|0,P=P+Math.imul(ve,it)|0,O=O+Math.imul(Y,Ft)|0,S=S+Math.imul(Y,Br)|0,S=S+Math.imul(re,Ft)|0,P=P+Math.imul(re,Br)|0,O=O+Math.imul(ee,Mt)|0,S=S+Math.imul(ee,jr)|0,S=S+Math.imul(te,Mt)|0,P=P+Math.imul(te,jr)|0,O=O+Math.imul(j,me)|0,S=S+Math.imul(j,be)|0,S=S+Math.imul(U,me)|0,P=P+Math.imul(U,be)|0,O=O+Math.imul(Z,Ie)|0,S=S+Math.imul(Z,Ze)|0,S=S+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ze)|0,O=O+Math.imul(oe,Ye)|0,S=S+Math.imul(oe,We)|0,S=S+Math.imul(le,Ye)|0,P=P+Math.imul(le,We)|0,O=O+Math.imul(V,Be)|0,S=S+Math.imul(V,rt)|0,S=S+Math.imul(Q,Be)|0,P=P+Math.imul(Q,rt)|0;var rn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(rn>>>26)|0,rn&=67108863,O=Math.imul(Ae,je),S=Math.imul(Ae,it),S=S+Math.imul(Ne,je)|0,P=Math.imul(Ne,it),O=O+Math.imul(de,Ft)|0,S=S+Math.imul(de,Br)|0,S=S+Math.imul(ve,Ft)|0,P=P+Math.imul(ve,Br)|0,O=O+Math.imul(Y,Mt)|0,S=S+Math.imul(Y,jr)|0,S=S+Math.imul(re,Mt)|0,P=P+Math.imul(re,jr)|0,O=O+Math.imul(ee,me)|0,S=S+Math.imul(ee,be)|0,S=S+Math.imul(te,me)|0,P=P+Math.imul(te,be)|0,O=O+Math.imul(j,Ie)|0,S=S+Math.imul(j,Ze)|0,S=S+Math.imul(U,Ie)|0,P=P+Math.imul(U,Ze)|0,O=O+Math.imul(Z,Ye)|0,S=S+Math.imul(Z,We)|0,S=S+Math.imul(K,Ye)|0,P=P+Math.imul(K,We)|0,O=O+Math.imul(oe,Be)|0,S=S+Math.imul(oe,rt)|0,S=S+Math.imul(le,Be)|0,P=P+Math.imul(le,rt)|0;var un=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(un>>>26)|0,un&=67108863,O=Math.imul(Ae,Ft),S=Math.imul(Ae,Br),S=S+Math.imul(Ne,Ft)|0,P=Math.imul(Ne,Br),O=O+Math.imul(de,Mt)|0,S=S+Math.imul(de,jr)|0,S=S+Math.imul(ve,Mt)|0,P=P+Math.imul(ve,jr)|0,O=O+Math.imul(Y,me)|0,S=S+Math.imul(Y,be)|0,S=S+Math.imul(re,me)|0,P=P+Math.imul(re,be)|0,O=O+Math.imul(ee,Ie)|0,S=S+Math.imul(ee,Ze)|0,S=S+Math.imul(te,Ie)|0,P=P+Math.imul(te,Ze)|0,O=O+Math.imul(j,Ye)|0,S=S+Math.imul(j,We)|0,S=S+Math.imul(U,Ye)|0,P=P+Math.imul(U,We)|0,O=O+Math.imul(Z,Be)|0,S=S+Math.imul(Z,rt)|0,S=S+Math.imul(K,Be)|0,P=P+Math.imul(K,rt)|0;var Dn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,O=Math.imul(Ae,Mt),S=Math.imul(Ae,jr),S=S+Math.imul(Ne,Mt)|0,P=Math.imul(Ne,jr),O=O+Math.imul(de,me)|0,S=S+Math.imul(de,be)|0,S=S+Math.imul(ve,me)|0,P=P+Math.imul(ve,be)|0,O=O+Math.imul(Y,Ie)|0,S=S+Math.imul(Y,Ze)|0,S=S+Math.imul(re,Ie)|0,P=P+Math.imul(re,Ze)|0,O=O+Math.imul(ee,Ye)|0,S=S+Math.imul(ee,We)|0,S=S+Math.imul(te,Ye)|0,P=P+Math.imul(te,We)|0,O=O+Math.imul(j,Be)|0,S=S+Math.imul(j,rt)|0,S=S+Math.imul(U,Be)|0,P=P+Math.imul(U,rt)|0;var fn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(fn>>>26)|0,fn&=67108863,O=Math.imul(Ae,me),S=Math.imul(Ae,be),S=S+Math.imul(Ne,me)|0,P=Math.imul(Ne,be),O=O+Math.imul(de,Ie)|0,S=S+Math.imul(de,Ze)|0,S=S+Math.imul(ve,Ie)|0,P=P+Math.imul(ve,Ze)|0,O=O+Math.imul(Y,Ye)|0,S=S+Math.imul(Y,We)|0,S=S+Math.imul(re,Ye)|0,P=P+Math.imul(re,We)|0,O=O+Math.imul(ee,Be)|0,S=S+Math.imul(ee,rt)|0,S=S+Math.imul(te,Be)|0,P=P+Math.imul(te,rt)|0;var Zt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(Ae,Ie),S=Math.imul(Ae,Ze),S=S+Math.imul(Ne,Ie)|0,P=Math.imul(Ne,Ze),O=O+Math.imul(de,Ye)|0,S=S+Math.imul(de,We)|0,S=S+Math.imul(ve,Ye)|0,P=P+Math.imul(ve,We)|0,O=O+Math.imul(Y,Be)|0,S=S+Math.imul(Y,rt)|0,S=S+Math.imul(re,Be)|0,P=P+Math.imul(re,rt)|0;var Mr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,O=Math.imul(Ae,Ye),S=Math.imul(Ae,We),S=S+Math.imul(Ne,Ye)|0,P=Math.imul(Ne,We),O=O+Math.imul(de,Be)|0,S=S+Math.imul(de,rt)|0,S=S+Math.imul(ve,Be)|0,P=P+Math.imul(ve,rt)|0;var ti=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(ti>>>26)|0,ti&=67108863,O=Math.imul(Ae,Be),S=Math.imul(Ae,rt),S=S+Math.imul(Ne,Be)|0,P=Math.imul(Ne,rt);var Vn=(I+O|0)+((S&8191)<<13)|0;return I=(P+(S>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,C[0]=ht,C[1]=gt,C[2]=Ur,C[3]=fr,C[4]=Jt,C[5]=Sr,C[6]=Fn,C[7]=qn,C[8]=bn,C[9]=Qr,C[10]=kt,C[11]=rn,C[12]=un,C[13]=Dn,C[14]=fn,C[15]=Zt,C[16]=Mr,C[17]=ti,C[18]=Vn,I!==0&&(C[19]=I,b.length++),b};Math.imul||(m=p);function y(T,N,b){b.negative=N.negative^T.negative,b.length=T.length+N.length;for(var E=0,D=0,C=0;C<b.length-1;C++){var I=D;D=0;for(var O=E&67108863,S=Math.min(C,N.length-1),P=Math.max(0,C-T.length+1);P<=S;P++){var R=C-P,L=T.words[R]|0,q=N.words[P]|0,J=L*q,G=J&67108863;I=I+(J/67108864|0)|0,G=G+O|0,O=G&67108863,I=I+(G>>>26)|0,D+=I>>>26,I&=67108863}b.words[C]=O,E=I,I=D}return E!==0?b.words[C]=E:b.length--,b.strip()}function g(T,N,b){var E=new v;return E.mulp(T,N,b)}a.prototype.mulTo=function(T,N){var b,E=this.length+T.length;return this.length===10&&T.length===10?b=m(this,T,N):E<63?b=p(this,T,N):E<1024?b=y(this,T,N):b=g(this,T,N),b};function v(T,N){this.x=T,this.y=N}v.prototype.makeRBT=function(T){for(var N=new Array(T),b=a.prototype._countBits(T)-1,E=0;E<T;E++)N[E]=this.revBin(E,b,T);return N},v.prototype.revBin=function(T,N,b){if(T===0||T===b-1)return T;for(var E=0,D=0;D<N;D++)E|=(T&1)<<N-D-1,T>>=1;return E},v.prototype.permute=function(T,N,b,E,D,C){for(var I=0;I<C;I++)E[I]=N[T[I]],D[I]=b[T[I]]},v.prototype.transform=function(T,N,b,E,D,C){this.permute(C,T,N,b,E,D);for(var I=1;I<D;I<<=1)for(var O=I<<1,S=Math.cos(2*Math.PI/O),P=Math.sin(2*Math.PI/O),R=0;R<D;R+=O)for(var L=S,q=P,J=0;J<I;J++){var G=b[R+J],ie=E[R+J],z=b[R+J+I],V=E[R+J+I],Q=L*z-q*V;V=L*V+q*z,z=Q,b[R+J]=G+z,E[R+J]=ie+V,b[R+J+I]=G-z,E[R+J+I]=ie-V,J!==O&&(Q=S*L-P*q,q=S*q+P*L,L=Q)}},v.prototype.guessLen13b=function(T,N){var b=Math.max(N,T)|1,E=b&1,D=0;for(b=b/2|0;b;b=b>>>1)D++;return 1<<D+1+E},v.prototype.conjugate=function(T,N,b){if(!(b<=1))for(var E=0;E<b/2;E++){var D=T[E];T[E]=T[b-E-1],T[b-E-1]=D,D=N[E],N[E]=-N[b-E-1],N[b-E-1]=-D}},v.prototype.normalize13b=function(T,N){for(var b=0,E=0;E<N/2;E++){var D=Math.round(T[2*E+1]/N)*8192+Math.round(T[2*E]/N)+b;T[E]=D&67108863,D<67108864?b=0:b=D/67108864|0}return T},v.prototype.convert13b=function(T,N,b,E){for(var D=0,C=0;C<N;C++)D=D+(T[C]|0),b[2*C]=D&8191,D=D>>>13,b[2*C+1]=D&8191,D=D>>>13;for(C=2*N;C<E;++C)b[C]=0;n(D===0),n((D&-8192)===0)},v.prototype.stub=function(T){for(var N=new Array(T),b=0;b<T;b++)N[b]=0;return N},v.prototype.mulp=function(T,N,b){var E=2*this.guessLen13b(T.length,N.length),D=this.makeRBT(E),C=this.stub(E),I=new Array(E),O=new Array(E),S=new Array(E),P=new Array(E),R=new Array(E),L=new Array(E),q=b.words;q.length=E,this.convert13b(T.words,T.length,I,E),this.convert13b(N.words,N.length,P,E),this.transform(I,C,O,S,E,D),this.transform(P,C,R,L,E,D);for(var J=0;J<E;J++){var G=O[J]*R[J]-S[J]*L[J];S[J]=O[J]*L[J]+S[J]*R[J],O[J]=G}return this.conjugate(O,S,E),this.transform(O,S,q,C,E,D),this.conjugate(q,C,E),this.normalize13b(q,E),b.negative=T.negative^N.negative,b.length=T.length+N.length,b.strip()},a.prototype.mul=function(T){var N=new a(null);return N.words=new Array(this.length+T.length),this.mulTo(T,N)},a.prototype.mulf=function(T){var N=new a(null);return N.words=new Array(this.length+T.length),g(this,T,N)},a.prototype.imul=function(T){return this.clone().mulTo(T,this)},a.prototype.imuln=function(T){n(typeof T=="number"),n(T<67108864);for(var N=0,b=0;b<this.length;b++){var E=(this.words[b]|0)*T,D=(E&67108863)+(N&67108863);N>>=26,N+=E/67108864|0,N+=D>>>26,this.words[b]=D&67108863}return N!==0&&(this.words[b]=N,this.length++),this},a.prototype.muln=function(T){return this.clone().imuln(T)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(T){var N=h(T);if(N.length===0)return new a(1);for(var b=this,E=0;E<N.length&&N[E]===0;E++,b=b.sqr());if(++E<N.length)for(var D=b.sqr();E<N.length;E++,D=D.sqr())N[E]!==0&&(b=b.mul(D));return b},a.prototype.iushln=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26,E=67108863>>>26-N<<26-N,D;if(N!==0){var C=0;for(D=0;D<this.length;D++){var I=this.words[D]&E,O=(this.words[D]|0)-I<<N;this.words[D]=O|C,C=I>>>26-N}C&&(this.words[D]=C,this.length++)}if(b!==0){for(D=this.length-1;D>=0;D--)this.words[D+b]=this.words[D];for(D=0;D<b;D++)this.words[D]=0;this.length+=b}return this.strip()},a.prototype.ishln=function(T){return n(this.negative===0),this.iushln(T)},a.prototype.iushrn=function(T,N,b){n(typeof T=="number"&&T>=0);var E;N?E=(N-N%26)/26:E=0;var D=T%26,C=Math.min((T-D)/26,this.length),I=67108863^67108863>>>D<<D,O=b;if(E-=C,E=Math.max(0,E),O){for(var S=0;S<C;S++)O.words[S]=this.words[S];O.length=C}if(C!==0)if(this.length>C)for(this.length-=C,S=0;S<this.length;S++)this.words[S]=this.words[S+C];else this.words[0]=0,this.length=1;var P=0;for(S=this.length-1;S>=0&&(P!==0||S>=E);S--){var R=this.words[S]|0;this.words[S]=P<<26-D|R>>>D,P=R&I}return O&&P!==0&&(O.words[O.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(T,N,b){return n(this.negative===0),this.iushrn(T,N,b)},a.prototype.shln=function(T){return this.clone().ishln(T)},a.prototype.ushln=function(T){return this.clone().iushln(T)},a.prototype.shrn=function(T){return this.clone().ishrn(T)},a.prototype.ushrn=function(T){return this.clone().iushrn(T)},a.prototype.testn=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26,E=1<<N;if(this.length<=b)return!1;var D=this.words[b];return!!(D&E)},a.prototype.imaskn=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(N!==0&&b++,this.length=Math.min(b,this.length),N!==0){var E=67108863^67108863>>>N<<N;this.words[this.length-1]&=E}return this.strip()},a.prototype.maskn=function(T){return this.clone().imaskn(T)},a.prototype.iaddn=function(T){return n(typeof T=="number"),n(T<67108864),T<0?this.isubn(-T):this.negative!==0?this.length===1&&(this.words[0]|0)<T?(this.words[0]=T-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(T),this.negative=1,this):this._iaddn(T)},a.prototype._iaddn=function(T){this.words[0]+=T;for(var N=0;N<this.length&&this.words[N]>=67108864;N++)this.words[N]-=67108864,N===this.length-1?this.words[N+1]=1:this.words[N+1]++;return this.length=Math.max(this.length,N+1),this},a.prototype.isubn=function(T){if(n(typeof T=="number"),n(T<67108864),T<0)return this.iaddn(-T);if(this.negative!==0)return this.negative=0,this.iaddn(T),this.negative=1,this;if(this.words[0]-=T,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var N=0;N<this.length&&this.words[N]<0;N++)this.words[N]+=67108864,this.words[N+1]-=1;return this.strip()},a.prototype.addn=function(T){return this.clone().iaddn(T)},a.prototype.subn=function(T){return this.clone().isubn(T)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(T,N,b){var E=T.length+b,D;this._expand(E);var C,I=0;for(D=0;D<T.length;D++){C=(this.words[D+b]|0)+I;var O=(T.words[D]|0)*N;C-=O&67108863,I=(C>>26)-(O/67108864|0),this.words[D+b]=C&67108863}for(;D<this.length-b;D++)C=(this.words[D+b]|0)+I,I=C>>26,this.words[D+b]=C&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,D=0;D<this.length;D++)C=-(this.words[D]|0)+I,I=C>>26,this.words[D]=C&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(T,N){var b=this.length-T.length,E=this.clone(),D=T,C=D.words[D.length-1]|0,I=this._countBits(C);b=26-I,b!==0&&(D=D.ushln(b),E.iushln(b),C=D.words[D.length-1]|0);var O=E.length-D.length,S;if(N!=="mod"){S=new a(null),S.length=O+1,S.words=new Array(S.length);for(var P=0;P<S.length;P++)S.words[P]=0}var R=E.clone()._ishlnsubmul(D,1,O);R.negative===0&&(E=R,S&&(S.words[O]=1));for(var L=O-1;L>=0;L--){var q=(E.words[D.length+L]|0)*67108864+(E.words[D.length+L-1]|0);for(q=Math.min(q/C|0,67108863),E._ishlnsubmul(D,q,L);E.negative!==0;)q--,E.negative=0,E._ishlnsubmul(D,1,L),E.isZero()||(E.negative^=1);S&&(S.words[L]=q)}return S&&S.strip(),E.strip(),N!=="div"&&b!==0&&E.iushrn(b),{div:S||null,mod:E}},a.prototype.divmod=function(T,N,b){if(n(!T.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var E,D,C;return this.negative!==0&&T.negative===0?(C=this.neg().divmod(T,N),N!=="mod"&&(E=C.div.neg()),N!=="div"&&(D=C.mod.neg(),b&&D.negative!==0&&D.iadd(T)),{div:E,mod:D}):this.negative===0&&T.negative!==0?(C=this.divmod(T.neg(),N),N!=="mod"&&(E=C.div.neg()),{div:E,mod:C.mod}):this.negative&T.negative?(C=this.neg().divmod(T.neg(),N),N!=="div"&&(D=C.mod.neg(),b&&D.negative!==0&&D.isub(T)),{div:C.div,mod:D}):T.length>this.length||this.cmp(T)<0?{div:new a(0),mod:this}:T.length===1?N==="div"?{div:this.divn(T.words[0]),mod:null}:N==="mod"?{div:null,mod:new a(this.modn(T.words[0]))}:{div:this.divn(T.words[0]),mod:new a(this.modn(T.words[0]))}:this._wordDiv(T,N)},a.prototype.div=function(T){return this.divmod(T,"div",!1).div},a.prototype.mod=function(T){return this.divmod(T,"mod",!1).mod},a.prototype.umod=function(T){return this.divmod(T,"mod",!0).mod},a.prototype.divRound=function(T){var N=this.divmod(T);if(N.mod.isZero())return N.div;var b=N.div.negative!==0?N.mod.isub(T):N.mod,E=T.ushrn(1),D=T.andln(1),C=b.cmp(E);return C<0||D===1&&C===0?N.div:N.div.negative!==0?N.div.isubn(1):N.div.iaddn(1)},a.prototype.modn=function(T){n(T<=67108863);for(var N=(1<<26)%T,b=0,E=this.length-1;E>=0;E--)b=(N*b+(this.words[E]|0))%T;return b},a.prototype.idivn=function(T){n(T<=67108863);for(var N=0,b=this.length-1;b>=0;b--){var E=(this.words[b]|0)+N*67108864;this.words[b]=E/T|0,N=E%T}return this.strip()},a.prototype.divn=function(T){return this.clone().idivn(T)},a.prototype.egcd=function(T){n(T.negative===0),n(!T.isZero());var N=this,b=T.clone();N.negative!==0?N=N.umod(T):N=N.clone();for(var E=new a(1),D=new a(0),C=new a(0),I=new a(1),O=0;N.isEven()&&b.isEven();)N.iushrn(1),b.iushrn(1),++O;for(var S=b.clone(),P=N.clone();!N.isZero();){for(var R=0,L=1;!(N.words[0]&L)&&R<26;++R,L<<=1);if(R>0)for(N.iushrn(R);R-- >0;)(E.isOdd()||D.isOdd())&&(E.iadd(S),D.isub(P)),E.iushrn(1),D.iushrn(1);for(var q=0,J=1;!(b.words[0]&J)&&q<26;++q,J<<=1);if(q>0)for(b.iushrn(q);q-- >0;)(C.isOdd()||I.isOdd())&&(C.iadd(S),I.isub(P)),C.iushrn(1),I.iushrn(1);N.cmp(b)>=0?(N.isub(b),E.isub(C),D.isub(I)):(b.isub(N),C.isub(E),I.isub(D))}return{a:C,b:I,gcd:b.iushln(O)}},a.prototype._invmp=function(T){n(T.negative===0),n(!T.isZero());var N=this,b=T.clone();N.negative!==0?N=N.umod(T):N=N.clone();for(var E=new a(1),D=new a(0),C=b.clone();N.cmpn(1)>0&&b.cmpn(1)>0;){for(var I=0,O=1;!(N.words[0]&O)&&I<26;++I,O<<=1);if(I>0)for(N.iushrn(I);I-- >0;)E.isOdd()&&E.iadd(C),E.iushrn(1);for(var S=0,P=1;!(b.words[0]&P)&&S<26;++S,P<<=1);if(S>0)for(b.iushrn(S);S-- >0;)D.isOdd()&&D.iadd(C),D.iushrn(1);N.cmp(b)>=0?(N.isub(b),E.isub(D)):(b.isub(N),D.isub(E))}var R;return N.cmpn(1)===0?R=E:R=D,R.cmpn(0)<0&&R.iadd(T),R},a.prototype.gcd=function(T){if(this.isZero())return T.abs();if(T.isZero())return this.abs();var N=this.clone(),b=T.clone();N.negative=0,b.negative=0;for(var E=0;N.isEven()&&b.isEven();E++)N.iushrn(1),b.iushrn(1);do{for(;N.isEven();)N.iushrn(1);for(;b.isEven();)b.iushrn(1);var D=N.cmp(b);if(D<0){var C=N;N=b,b=C}else if(D===0||b.cmpn(1)===0)break;N.isub(b)}while(!0);return b.iushln(E)},a.prototype.invm=function(T){return this.egcd(T).a.umod(T)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(T){return this.words[0]&T},a.prototype.bincn=function(T){n(typeof T=="number");var N=T%26,b=(T-N)/26,E=1<<N;if(this.length<=b)return this._expand(b+1),this.words[b]|=E,this;for(var D=E,C=b;D!==0&&C<this.length;C++){var I=this.words[C]|0;I+=D,D=I>>>26,I&=67108863,this.words[C]=I}return D!==0&&(this.words[C]=D,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(T){var N=T<0;if(this.negative!==0&&!N)return-1;if(this.negative===0&&N)return 1;this.strip();var b;if(this.length>1)b=1;else{N&&(T=-T),n(T<=67108863,"Number is too big");var E=this.words[0]|0;b=E===T?0:E<T?-1:1}return this.negative!==0?-b|0:b},a.prototype.cmp=function(T){if(this.negative!==0&&T.negative===0)return-1;if(this.negative===0&&T.negative!==0)return 1;var N=this.ucmp(T);return this.negative!==0?-N|0:N},a.prototype.ucmp=function(T){if(this.length>T.length)return 1;if(this.length<T.length)return-1;for(var N=0,b=this.length-1;b>=0;b--){var E=this.words[b]|0,D=T.words[b]|0;if(E!==D){E<D?N=-1:E>D&&(N=1);break}}return N},a.prototype.gtn=function(T){return this.cmpn(T)===1},a.prototype.gt=function(T){return this.cmp(T)===1},a.prototype.gten=function(T){return this.cmpn(T)>=0},a.prototype.gte=function(T){return this.cmp(T)>=0},a.prototype.ltn=function(T){return this.cmpn(T)===-1},a.prototype.lt=function(T){return this.cmp(T)===-1},a.prototype.lten=function(T){return this.cmpn(T)<=0},a.prototype.lte=function(T){return this.cmp(T)<=0},a.prototype.eqn=function(T){return this.cmpn(T)===0},a.prototype.eq=function(T){return this.cmp(T)===0},a.red=function(T){return new k(T)},a.prototype.toRed=function(T){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),T.convertTo(this)._forceRed(T)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(T){return this.red=T,this},a.prototype.forceRed=function(T){return n(!this.red,"Already a number in reduction context"),this._forceRed(T)},a.prototype.redAdd=function(T){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,T)},a.prototype.redIAdd=function(T){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,T)},a.prototype.redSub=function(T){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,T)},a.prototype.redISub=function(T){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,T)},a.prototype.redShl=function(T){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,T)},a.prototype.redMul=function(T){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.mul(this,T)},a.prototype.redIMul=function(T){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.imul(this,T)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(T){return n(this.red&&!T.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,T)};var w={k256:null,p224:null,p192:null,p25519:null};function x(T,N){this.name=T,this.p=new a(N,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}x.prototype._tmp=function(){var T=new a(null);return T.words=new Array(Math.ceil(this.n/13)),T},x.prototype.ireduce=function(T){var N=T,b;do this.split(N,this.tmp),N=this.imulK(N),N=N.iadd(this.tmp),b=N.bitLength();while(b>this.n);var E=b<this.n?-1:N.ucmp(this.p);return E===0?(N.words[0]=0,N.length=1):E>0?N.isub(this.p):N.strip!==void 0?N.strip():N._strip(),N},x.prototype.split=function(T,N){T.iushrn(this.n,0,N)},x.prototype.imulK=function(T){return T.imul(this.k)};function _(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(_,x),_.prototype.split=function(T,N){for(var b=4194303,E=Math.min(T.length,9),D=0;D<E;D++)N.words[D]=T.words[D];if(N.length=E,T.length<=9){T.words[0]=0,T.length=1;return}var C=T.words[9];for(N.words[N.length++]=C&b,D=10;D<T.length;D++){var I=T.words[D]|0;T.words[D-10]=(I&b)<<4|C>>>22,C=I}C>>>=22,T.words[D-10]=C,C===0&&T.length>10?T.length-=10:T.length-=9},_.prototype.imulK=function(T){T.words[T.length]=0,T.words[T.length+1]=0,T.length+=2;for(var N=0,b=0;b<T.length;b++){var E=T.words[b]|0;N+=E*977,T.words[b]=N&67108863,N=E*64+(N/67108864|0)}return T.words[T.length-1]===0&&(T.length--,T.words[T.length-1]===0&&T.length--),T};function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(A,x);function M(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(M,x);function F(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(F,x),F.prototype.imulK=function(T){for(var N=0,b=0;b<T.length;b++){var E=(T.words[b]|0)*19+N,D=E&67108863;E>>>=26,T.words[b]=D,N=E}return N!==0&&(T.words[T.length++]=N),T},a._prime=function(T){if(w[T])return w[T];var N;if(T==="k256")N=new _;else if(T==="p224")N=new A;else if(T==="p192")N=new M;else if(T==="p25519")N=new F;else throw new Error("Unknown prime "+T);return w[T]=N,N};function k(T){if(typeof T=="string"){var N=a._prime(T);this.m=N.p,this.prime=N}else n(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}k.prototype._verify1=function(T){n(T.negative===0,"red works only with positives"),n(T.red,"red works only with red numbers")},k.prototype._verify2=function(T,N){n((T.negative|N.negative)===0,"red works only with positives"),n(T.red&&T.red===N.red,"red works only with red numbers")},k.prototype.imod=function(T){return this.prime?this.prime.ireduce(T)._forceRed(this):T.umod(this.m)._forceRed(this)},k.prototype.neg=function(T){return T.isZero()?T.clone():this.m.sub(T)._forceRed(this)},k.prototype.add=function(T,N){this._verify2(T,N);var b=T.add(N);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},k.prototype.iadd=function(T,N){this._verify2(T,N);var b=T.iadd(N);return b.cmp(this.m)>=0&&b.isub(this.m),b},k.prototype.sub=function(T,N){this._verify2(T,N);var b=T.sub(N);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},k.prototype.isub=function(T,N){this._verify2(T,N);var b=T.isub(N);return b.cmpn(0)<0&&b.iadd(this.m),b},k.prototype.shl=function(T,N){return this._verify1(T),this.imod(T.ushln(N))},k.prototype.imul=function(T,N){return this._verify2(T,N),this.imod(T.imul(N))},k.prototype.mul=function(T,N){return this._verify2(T,N),this.imod(T.mul(N))},k.prototype.isqr=function(T){return this.imul(T,T.clone())},k.prototype.sqr=function(T){return this.mul(T,T)},k.prototype.sqrt=function(T){if(T.isZero())return T.clone();var N=this.m.andln(3);if(n(N%2===1),N===3){var b=this.m.add(new a(1)).iushrn(2);return this.pow(T,b)}for(var E=this.m.subn(1),D=0;!E.isZero()&&E.andln(1)===0;)D++,E.iushrn(1);n(!E.isZero());var C=new a(1).toRed(this),I=C.redNeg(),O=this.m.subn(1).iushrn(1),S=this.m.bitLength();for(S=new a(2*S*S).toRed(this);this.pow(S,O).cmp(I)!==0;)S.redIAdd(I);for(var P=this.pow(S,E),R=this.pow(T,E.addn(1).iushrn(1)),L=this.pow(T,E),q=D;L.cmp(C)!==0;){for(var J=L,G=0;J.cmp(C)!==0;G++)J=J.redSqr();n(G<q);var ie=this.pow(P,new a(1).iushln(q-G-1));R=R.redMul(ie),P=ie.redSqr(),L=L.redMul(P),q=G}return R},k.prototype.invm=function(T){var N=T._invmp(this.m);return N.negative!==0?(N.negative=0,this.imod(N).redNeg()):this.imod(N)},k.prototype.pow=function(T,N){if(N.isZero())return new a(1).toRed(this);if(N.cmpn(1)===0)return T.clone();var b=4,E=new Array(1<<b);E[0]=new a(1).toRed(this),E[1]=T;for(var D=2;D<E.length;D++)E[D]=this.mul(E[D-1],T);var C=E[0],I=0,O=0,S=N.bitLength()%26;for(S===0&&(S=26),D=N.length-1;D>=0;D--){for(var P=N.words[D],R=S-1;R>=0;R--){var L=P>>R&1;if(C!==E[0]&&(C=this.sqr(C)),L===0&&I===0){O=0;continue}I<<=1,I|=L,O++,!(O!==b&&(D!==0||R!==0))&&(C=this.mul(C,E[I]),O=0,I=0)}S=26}return C},k.prototype.convertTo=function(T){var N=T.umod(this.m);return N===T?N.clone():N},k.prototype.convertFrom=function(T){var N=T.clone();return N.red=null,N},a.mont=function(T){return new $(T)};function $(T){k.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i($,k),$.prototype.convertTo=function(T){return this.imod(T.ushln(this.shift))},$.prototype.convertFrom=function(T){var N=this.imod(T.mul(this.rinv));return N.red=null,N},$.prototype.imul=function(T,N){if(T.isZero()||N.isZero())return T.words[0]=0,T.length=1,T;var b=T.imul(N),E=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=b.isub(E).iushrn(this.shift),C=D;return D.cmp(this.m)>=0?C=D.isub(this.m):D.cmpn(0)<0&&(C=D.iadd(this.m)),C._forceRed(this)},$.prototype.mul=function(T,N){if(T.isZero()||N.isZero())return new a(0)._forceRed(this);var b=T.mul(N),E=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=b.isub(E).iushrn(this.shift),C=D;return D.cmp(this.m)>=0?C=D.isub(this.m):D.cmpn(0)<0&&(C=D.iadd(this.m)),C._forceRed(this)},$.prototype.invm=function(T){var N=this.imod(T._invmp(this.m).mul(this.r2));return N._forceRed(this)}})(t,DSe)}(S_)),S_.exports}var mm={exports:{}},TD;function lE(){if(TD)return mm.exports;TD=1;var t;mm.exports=function(n){return t||(t=new e(null)),t.generate(n)};function e(n){this.rand=n}if(mm.exports.Rand=e,e.prototype.generate=function(n){return this._rand(n)},e.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var i=new Uint8Array(n),a=0;a<i.length;a++)i[a]=this.rand.getByte();return i},typeof self=="object")self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(n){var i=new Uint8Array(n);return self.crypto.getRandomValues(i),i}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(n){var i=new Uint8Array(n);return self.msCrypto.getRandomValues(i),i}:typeof window=="object"&&(e.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=rj();if(typeof r.randomBytes!="function")throw new Error("Not supported");e.prototype._rand=function(n){return r.randomBytes(n)}}catch{}return mm.exports}var Iv,DD;function PL(){if(DD)return Iv;DD=1;var t=ei(),e=lE();function r(n){this.rand=n||new e.Rand}return Iv=r,r.create=function(n){return new r(n)},r.prototype._randbelow=function(n){var i=n.bitLength(),a=Math.ceil(i/8);do var s=new t(this.rand.generate(a));while(s.cmp(n)>=0);return s},r.prototype._randrange=function(n,i){var a=i.sub(n);return n.add(this._randbelow(a))},r.prototype.test=function(n,i,a){var s=n.bitLength(),o=t.mont(n),u=new t(1).toRed(o);i||(i=Math.max(1,s/48|0));for(var c=n.subn(1),l=0;!c.testn(l);l++);for(var d=n.shrn(l),f=c.toRed(o),h=!0;i>0;i--){var p=this._randrange(new t(2),c);a&&a(p);var m=p.toRed(o).redPow(d);if(!(m.cmp(u)===0||m.cmp(f)===0)){for(var y=1;y<l;y++){if(m=m.redSqr(),m.cmp(u)===0)return!1;if(m.cmp(f)===0)break}if(y===l)return!1}}return h},r.prototype.getDivisor=function(n,i){var a=n.bitLength(),s=t.mont(n),o=new t(1).toRed(s);i||(i=Math.max(1,a/48|0));for(var u=n.subn(1),c=0;!u.testn(c);c++);for(var l=n.shrn(c),d=u.toRed(s);i>0;i--){var f=this._randrange(new t(2),u),h=n.gcd(f);if(h.cmpn(1)!==0)return h;var p=f.toRed(s).redPow(l);if(!(p.cmp(o)===0||p.cmp(d)===0)){for(var m=1;m<c;m++){if(p=p.redSqr(),p.cmp(o)===0)return p.fromRed().subn(1).gcd(n);if(p.cmp(d)===0)break}if(m===c)return p=p.redSqr(),p.fromRed().subn(1).gcd(n)}}return!1},Iv}var Cv,AD;function BL(){if(AD)return Cv;AD=1;var t=ld();Cv=y,y.simpleSieve=p,y.fermatTest=m;var e=ei(),r=new e(24),n=PL(),i=new n,a=new e(1),s=new e(2),o=new e(5);new e(16),new e(8);var u=new e(10),c=new e(3);new e(7);var l=new e(11),d=new e(4);new e(12);var f=null;function h(){if(f!==null)return f;var g=1048576,v=[];v[0]=2;for(var w=1,x=3;x<g;x+=2){for(var _=Math.ceil(Math.sqrt(x)),A=0;A<w&&v[A]<=_&&x%v[A]!==0;A++);w!==A&&v[A]<=_||(v[w++]=x)}return f=v,v}function p(g){for(var v=h(),w=0;w<v.length;w++)if(g.modn(v[w])===0)return g.cmpn(v[w])===0;return!0}function m(g){var v=e.mont(g);return s.toRed(v).redPow(g.subn(1)).fromRed().cmpn(1)===0}function y(g,v){if(g<16)return v===2||v===5?new e([140,123]):new e([140,39]);v=new e(v);for(var w,x;;){for(w=new e(t(Math.ceil(g/8)));w.bitLength()>g;)w.ishrn(1);if(w.isEven()&&w.iadd(a),w.testn(1)||w.iadd(s),v.cmp(s)){if(!v.cmp(o))for(;w.mod(u).cmp(c);)w.iadd(d)}else for(;w.mod(r).cmp(l);)w.iadd(d);if(x=w.shrn(1),p(x)&&p(w)&&m(x)&&m(w)&&i.test(x)&&i.test(w))return w}}return Cv}const ASe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},NSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},ISe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},CSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},OSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},MSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},kSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},RSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},FSe={modp1:ASe,modp2:NSe,modp5:ISe,modp14:CSe,modp15:OSe,modp16:MSe,modp17:kSe,modp18:RSe};var Ov,ND;function PSe(){if(ND)return Ov;ND=1;var t=ei(),e=PL(),r=new e,n=new t(24),i=new t(11),a=new t(10),s=new t(3),o=new t(7),u=BL(),c=ld();Ov=p;function l(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this._pub=new t(y),this}function d(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this._priv=new t(y),this}var f={};function h(y,g){var v=g.toString("hex"),w=[v,y.toString(16)].join("_");if(w in f)return f[w];var x=0;if(y.isEven()||!u.simpleSieve||!u.fermatTest(y)||!r.test(y))return x+=1,v==="02"||v==="05"?x+=8:x+=4,f[w]=x,x;r.test(y.shrn(1))||(x+=2);var _;switch(v){case"02":y.mod(n).cmp(i)&&(x+=8);break;case"05":_=y.mod(a),_.cmp(s)&&_.cmp(o)&&(x+=8);break;default:x+=4}return f[w]=x,x}function p(y,g,v){this.setGenerator(g),this.__prime=new t(y),this._prime=t.mont(this.__prime),this._primeLen=y.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,v?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=h(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new t(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(y){y=new t(y),y=y.toRed(this._prime);var g=y.redPow(this._priv).fromRed(),v=new Buffer(g.toArray()),w=this.getPrime();if(v.length<w.length){var x=new Buffer(w.length-v.length);x.fill(0),v=Buffer.concat([x,v])}return v},p.prototype.getPublicKey=function(y){return m(this._pub,y)},p.prototype.getPrivateKey=function(y){return m(this._priv,y)},p.prototype.getPrime=function(y){return m(this.__prime,y)},p.prototype.getGenerator=function(y){return m(this._gen,y)},p.prototype.setGenerator=function(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this.__gen=y,this._gen=new t(y),this};function m(y,g){var v=new Buffer(y.toArray());return g?v.toString(g):v}return Ov}var ID;function BSe(){if(ID)return fu;ID=1;var t=BL(),e=FSe,r=PSe();function n(s){var o=new Buffer(e[s].prime,"hex"),u=new Buffer(e[s].gen,"hex");return new r(o,u)}var i={binary:!0,hex:!0,base64:!0};function a(s,o,u,c){return Buffer.isBuffer(o)||i[o]===void 0?a(s,"binary",o,u):(o=o||"binary",c=c||"binary",u=u||new Buffer([2]),Buffer.isBuffer(u)||(u=new Buffer(u,c)),typeof s=="number"?new r(t(s,u),u,!0):(Buffer.isBuffer(s)||(s=new Buffer(s,o)),new r(s,u,!0)))}return fu.DiffieHellmanGroup=fu.createDiffieHellmanGroup=fu.getDiffieHellman=n,fu.createDiffieHellman=fu.DiffieHellman=a,fu}var Mv={exports:{}},gm={exports:{}},CD;function ky(){if(CD)return gm.exports;CD=1,typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?gm.exports={nextTick:t}:gm.exports=process;function t(e,r,n,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var a=arguments.length,s,o;switch(a){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,r)});case 3:return process.nextTick(function(){e.call(null,r,n)});case 4:return process.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o<s.length;)s[o++]=arguments[o];return process.nextTick(function(){e.apply(null,s)})}}return gm.exports}var kv,OD;function LSe(){if(OD)return kv;OD=1;var t={}.toString;return kv=Array.isArray||function(e){return t.call(e)=="[object Array]"},kv}var ym={exports:{}},MD;function LL(){if(MD)return ym.exports;MD=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(x,_,A){return Function.prototype.apply.call(x,_,A)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:r=function(x){return Object.getOwnPropertyNames(x)};function n(x){console&&console.warn&&console.warn(x)}var i=Number.isNaN||function(x){return x!==x};function a(){a.init.call(this)}ym.exports=a,ym.exports.once=g,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(x){if(typeof x!="number"||x<0||i(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");s=x}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||i(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function u(x){return x._maxListeners===void 0?a.defaultMaxListeners:x._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(x){for(var _=[],A=1;A<arguments.length;A++)_.push(arguments[A]);var M=x==="error",F=this._events;if(F!==void 0)M=M&&F.error===void 0;else if(!M)return!1;if(M){var k;if(_.length>0&&(k=_[0]),k instanceof Error)throw k;var $=new Error("Unhandled error."+(k?" ("+k.message+")":""));throw $.context=k,$}var T=F[x];if(T===void 0)return!1;if(typeof T=="function")e(T,this,_);else for(var N=T.length,b=p(T,N),A=0;A<N;++A)e(b[A],this,_);return!0};function c(x,_,A,M){var F,k,$;if(o(A),k=x._events,k===void 0?(k=x._events=Object.create(null),x._eventsCount=0):(k.newListener!==void 0&&(x.emit("newListener",_,A.listener?A.listener:A),k=x._events),$=k[_]),$===void 0)$=k[_]=A,++x._eventsCount;else if(typeof $=="function"?$=k[_]=M?[A,$]:[$,A]:M?$.unshift(A):$.push(A),F=u(x),F>0&&$.length>F&&!$.warned){$.warned=!0;var T=new Error("Possible EventEmitter memory leak detected. "+$.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");T.name="MaxListenersExceededWarning",T.emitter=x,T.type=_,T.count=$.length,n(T)}return x}a.prototype.addListener=function(x,_){return c(this,x,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(x,_){return c(this,x,_,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(x,_,A){var M={fired:!1,wrapFn:void 0,target:x,type:_,listener:A},F=l.bind(M);return F.listener=A,M.wrapFn=F,F}a.prototype.once=function(x,_){return o(_),this.on(x,d(this,x,_)),this},a.prototype.prependOnceListener=function(x,_){return o(_),this.prependListener(x,d(this,x,_)),this},a.prototype.removeListener=function(x,_){var A,M,F,k,$;if(o(_),M=this._events,M===void 0)return this;if(A=M[x],A===void 0)return this;if(A===_||A.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete M[x],M.removeListener&&this.emit("removeListener",x,A.listener||_));else if(typeof A!="function"){for(F=-1,k=A.length-1;k>=0;k--)if(A[k]===_||A[k].listener===_){$=A[k].listener,F=k;break}if(F<0)return this;F===0?A.shift():m(A,F),A.length===1&&(M[x]=A[0]),M.removeListener!==void 0&&this.emit("removeListener",x,$||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(x){var _,A,M;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[x]),this;if(arguments.length===0){var F=Object.keys(A),k;for(M=0;M<F.length;++M)k=F[M],k!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=A[x],typeof _=="function")this.removeListener(x,_);else if(_!==void 0)for(M=_.length-1;M>=0;M--)this.removeListener(x,_[M]);return this};function f(x,_,A){var M=x._events;if(M===void 0)return[];var F=M[_];return F===void 0?[]:typeof F=="function"?A?[F.listener||F]:[F]:A?y(F):p(F,F.length)}a.prototype.listeners=function(x){return f(this,x,!0)},a.prototype.rawListeners=function(x){return f(this,x,!1)},a.listenerCount=function(x,_){return typeof x.listenerCount=="function"?x.listenerCount(_):h.call(x,_)},a.prototype.listenerCount=h;function h(x){var _=this._events;if(_!==void 0){var A=_[x];if(typeof A=="function")return 1;if(A!==void 0)return A.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function p(x,_){for(var A=new Array(_),M=0;M<_;++M)A[M]=x[M];return A}function m(x,_){for(;_+1<x.length;_++)x[_]=x[_+1];x.pop()}function y(x){for(var _=new Array(x.length),A=0;A<_.length;++A)_[A]=x[A].listener||x[A];return _}function g(x,_){return new Promise(function(A,M){function F($){x.removeListener(_,k),M($)}function k(){typeof x.removeListener=="function"&&x.removeListener("error",F),A([].slice.call(arguments))}w(x,_,k,{once:!0}),_!=="error"&&v(x,F,{once:!0})})}function v(x,_,A){typeof x.on=="function"&&w(x,"error",_,A)}function w(x,_,A,M){if(typeof x.on=="function")M.once?x.once(_,A):x.on(_,A);else if(typeof x.addEventListener=="function")x.addEventListener(_,function F(k){M.once&&x.removeEventListener(_,F),A(k)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return ym.exports}var kD,RD;function jL(){return RD||(RD=1,kD=LL().EventEmitter),kD}var Rv={exports:{}},FD;function Ry(){return FD||(FD=1,function(t,e){var r=mc(),n=r.Buffer;function i(s,o){for(var u in s)o[u]=s[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=a);function a(s,o,u){return n(s,o,u)}i(n,a),a.from=function(s,o,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,o,u)},a.alloc=function(s,o,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=n(s);return o!==void 0?typeof u=="string"?c.fill(o,u):c.fill(o):c.fill(0),c},a.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},a.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}}(Rv,Rv.exports)),Rv.exports}var Zn={},PD;function pp(){if(PD)return Zn;PD=1;function t(m){return Array.isArray?Array.isArray(m):p(m)==="[object Array]"}Zn.isArray=t;function e(m){return typeof m=="boolean"}Zn.isBoolean=e;function r(m){return m===null}Zn.isNull=r;function n(m){return m==null}Zn.isNullOrUndefined=n;function i(m){return typeof m=="number"}Zn.isNumber=i;function a(m){return typeof m=="string"}Zn.isString=a;function s(m){return typeof m=="symbol"}Zn.isSymbol=s;function o(m){return m===void 0}Zn.isUndefined=o;function u(m){return p(m)==="[object RegExp]"}Zn.isRegExp=u;function c(m){return typeof m=="object"&&m!==null}Zn.isObject=c;function l(m){return p(m)==="[object Date]"}Zn.isDate=l;function d(m){return p(m)==="[object Error]"||m instanceof Error}Zn.isError=d;function f(m){return typeof m=="function"}Zn.isFunction=f;function h(m){return m===null||typeof m=="boolean"||typeof m=="number"||typeof m=="string"||typeof m=="symbol"||typeof m>"u"}Zn.isPrimitive=h,Zn.isBuffer=mc().Buffer.isBuffer;function p(m){return Object.prototype.toString.call(m)}return Zn}var BD={exports:{}},LD;function jSe(){return LD||(LD=1,function(t){function e(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}var r=Ry().Buffer,n=gc;function i(a,s,o){a.copy(s,o)}t.exports=function(){function a(){e(this,a),this.head=null,this.tail=null,this.length=0}return a.prototype.push=function(s){var o={data:s,next:null};this.length>0?this.tail.next=o:this.head=o,this.tail=o,++this.length},a.prototype.unshift=function(s){var o={data:s,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length},a.prototype.shift=function(){if(this.length!==0){var s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}},a.prototype.clear=function(){this.head=this.tail=null,this.length=0},a.prototype.join=function(s){if(this.length===0)return"";for(var o=this.head,u=""+o.data;o=o.next;)u+=s+o.data;return u},a.prototype.concat=function(s){if(this.length===0)return r.alloc(0);for(var o=r.allocUnsafe(s>>>0),u=this.head,c=0;u;)i(u.data,o,c),c+=u.data.length,u=u.next;return o},a}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var a=n.inspect({length:this.length});return this.constructor.name+" "+a})}(BD)),BD.exports}var Fv,jD;function $L(){if(jD)return Fv;jD=1;var t=ky();function e(i,a){var s=this,o=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return o||u?(a?a(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(n,this,i)):t.nextTick(n,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(c){!a&&c?s._writableState?s._writableState.errorEmitted||(s._writableState.errorEmitted=!0,t.nextTick(n,s,c)):t.nextTick(n,s,c):a&&a(c)}),this)}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function n(i,a){i.emit("error",a)}return Fv={destroy:e,undestroy:r},Fv}var Pv,$D;function $Se(){if($D)return Pv;$D=1,Pv=t;function t(r,n){if(e("noDeprecation"))return r;var i=!1;function a(){if(!i){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),i=!0}return r.apply(this,arguments)}return a}function e(r){try{if(!qr.localStorage)return!1}catch{return!1}var n=qr.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return Pv}var Bv,UD;function UL(){if(UD)return Bv;UD=1;var t=ky();Bv=m;function e(I){var O=this;this.next=null,this.entry=null,this.finish=function(){C(O,I)}}var r=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick,n;m.WritableState=h;var i=Object.create(pp());i.inherits=gr();var a={deprecate:$Se()},s=jL(),o=Ry().Buffer,u=(typeof qr<"u"?qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function c(I){return o.from(I)}function l(I){return o.isBuffer(I)||I instanceof u}var d=$L();i.inherits(m,s);function f(){}function h(I,O){n=n||$l(),I=I||{};var S=O instanceof n;this.objectMode=!!I.objectMode,S&&(this.objectMode=this.objectMode||!!I.writableObjectMode);var P=I.highWaterMark,R=I.writableHighWaterMark,L=this.objectMode?16:16*1024;P||P===0?this.highWaterMark=P:S&&(R||R===0)?this.highWaterMark=R:this.highWaterMark=L,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var q=I.decodeStrings===!1;this.decodeStrings=!q,this.defaultEncoding=I.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(J){M(O,J)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}h.prototype.getBuffer=function(){for(var I=this.bufferedRequest,O=[];I;)O.push(I),I=I.next;return O},function(){try{Object.defineProperty(h.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var p;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(I){return p.call(this,I)?!0:this!==m?!1:I&&I._writableState instanceof h}})):p=function(I){return I instanceof this};function m(I){if(n=n||$l(),!p.call(m,this)&&!(this instanceof n))return new m(I);this._writableState=new h(I,this),this.writable=!0,I&&(typeof I.write=="function"&&(this._write=I.write),typeof I.writev=="function"&&(this._writev=I.writev),typeof I.destroy=="function"&&(this._destroy=I.destroy),typeof I.final=="function"&&(this._final=I.final)),s.call(this)}m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function y(I,O){var S=new Error("write after end");I.emit("error",S),t.nextTick(O,S)}function g(I,O,S,P){var R=!0,L=!1;return S===null?L=new TypeError("May not write null values to stream"):typeof S!="string"&&S!==void 0&&!O.objectMode&&(L=new TypeError("Invalid non-string/buffer chunk")),L&&(I.emit("error",L),t.nextTick(P,L),R=!1),R}m.prototype.write=function(I,O,S){var P=this._writableState,R=!1,L=!P.objectMode&&l(I);return L&&!o.isBuffer(I)&&(I=c(I)),typeof O=="function"&&(S=O,O=null),L?O="buffer":O||(O=P.defaultEncoding),typeof S!="function"&&(S=f),P.ended?y(this,S):(L||g(this,P,I,S))&&(P.pendingcb++,R=w(this,P,L,I,O,S)),R},m.prototype.cork=function(){var I=this._writableState;I.corked++},m.prototype.uncork=function(){var I=this._writableState;I.corked&&(I.corked--,!I.writing&&!I.corked&&!I.bufferProcessing&&I.bufferedRequest&&$(this,I))},m.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+I);return this._writableState.defaultEncoding=I,this};function v(I,O,S){return!I.objectMode&&I.decodeStrings!==!1&&typeof O=="string"&&(O=o.from(O,S)),O}Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function w(I,O,S,P,R,L){if(!S){var q=v(O,P,R);P!==q&&(S=!0,R="buffer",P=q)}var J=O.objectMode?1:P.length;O.length+=J;var G=O.length<O.highWaterMark;if(G||(O.needDrain=!0),O.writing||O.corked){var ie=O.lastBufferedRequest;O.lastBufferedRequest={chunk:P,encoding:R,isBuf:S,callback:L,next:null},ie?ie.next=O.lastBufferedRequest:O.bufferedRequest=O.lastBufferedRequest,O.bufferedRequestCount+=1}else x(I,O,!1,J,P,R,L);return G}function x(I,O,S,P,R,L,q){O.writelen=P,O.writecb=q,O.writing=!0,O.sync=!0,S?I._writev(R,O.onwrite):I._write(R,L,O.onwrite),O.sync=!1}function _(I,O,S,P,R){--O.pendingcb,S?(t.nextTick(R,P),t.nextTick(E,I,O),I._writableState.errorEmitted=!0,I.emit("error",P)):(R(P),I._writableState.errorEmitted=!0,I.emit("error",P),E(I,O))}function A(I){I.writing=!1,I.writecb=null,I.length-=I.writelen,I.writelen=0}function M(I,O){var S=I._writableState,P=S.sync,R=S.writecb;if(A(S),O)_(I,S,P,O,R);else{var L=T(S);!L&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest&&$(I,S),P?r(F,I,S,L,R):F(I,S,L,R)}}function F(I,O,S,P){S||k(I,O),O.pendingcb--,P(),E(I,O)}function k(I,O){O.length===0&&O.needDrain&&(O.needDrain=!1,I.emit("drain"))}function $(I,O){O.bufferProcessing=!0;var S=O.bufferedRequest;if(I._writev&&S&&S.next){var P=O.bufferedRequestCount,R=new Array(P),L=O.corkedRequestsFree;L.entry=S;for(var q=0,J=!0;S;)R[q]=S,S.isBuf||(J=!1),S=S.next,q+=1;R.allBuffers=J,x(I,O,!0,O.length,R,"",L.finish),O.pendingcb++,O.lastBufferedRequest=null,L.next?(O.corkedRequestsFree=L.next,L.next=null):O.corkedRequestsFree=new e(O),O.bufferedRequestCount=0}else{for(;S;){var G=S.chunk,ie=S.encoding,z=S.callback,V=O.objectMode?1:G.length;if(x(I,O,!1,V,G,ie,z),S=S.next,O.bufferedRequestCount--,O.writing)break}S===null&&(O.lastBufferedRequest=null)}O.bufferedRequest=S,O.bufferProcessing=!1}m.prototype._write=function(I,O,S){S(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(I,O,S){var P=this._writableState;typeof I=="function"?(S=I,I=null,O=null):typeof O=="function"&&(S=O,O=null),I!=null&&this.write(I,O),P.corked&&(P.corked=1,this.uncork()),P.ending||D(this,P,S)};function T(I){return I.ending&&I.length===0&&I.bufferedRequest===null&&!I.finished&&!I.writing}function N(I,O){I._final(function(S){O.pendingcb--,S&&I.emit("error",S),O.prefinished=!0,I.emit("prefinish"),E(I,O)})}function b(I,O){!O.prefinished&&!O.finalCalled&&(typeof I._final=="function"?(O.pendingcb++,O.finalCalled=!0,t.nextTick(N,I,O)):(O.prefinished=!0,I.emit("prefinish")))}function E(I,O){var S=T(O);return S&&(b(I,O),O.pendingcb===0&&(O.finished=!0,I.emit("finish"))),S}function D(I,O,S){O.ending=!0,E(I,O),S&&(O.finished?t.nextTick(S):I.once("finish",S)),O.ended=!0,I.writable=!1}function C(I,O,S){var P=I.entry;for(I.entry=null;P;){var R=P.callback;O.pendingcb--,R(S),P=P.next}O.corkedRequestsFree.next=I}return Object.defineProperty(m.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(I,O){this.end(),O(I)},Bv}var Lv,zD;function $l(){if(zD)return Lv;zD=1;var t=ky(),e=Object.keys||function(d){var f=[];for(var h in d)f.push(h);return f};Lv=u;var r=Object.create(pp());r.inherits=gr();var n=zL(),i=UL();r.inherits(u,n);for(var a=e(i.prototype),s=0;s<a.length;s++){var o=a[s];u.prototype[o]||(u.prototype[o]=i.prototype[o])}function u(d){if(!(this instanceof u))return new u(d);n.call(this,d),i.call(this,d),d&&d.readable===!1&&(this.readable=!1),d&&d.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,d&&d.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",c)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(d){d.end()}return Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),u.prototype._destroy=function(d,f){this.push(null),this.end(),t.nextTick(f,d)},Lv}var jv={},qD;function VD(){if(qD)return jv;qD=1;var t=Ry().Buffer,e=t.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(g){if(!g)return"utf8";for(var v;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(v)return;g=(""+g).toLowerCase(),v=!0}}function n(g){var v=r(g);if(typeof v!="string"&&(t.isEncoding===e||!e(g)))throw new Error("Unknown encoding: "+g);return v||g}jv.StringDecoder=i;function i(g){this.encoding=n(g);var v;switch(this.encoding){case"utf16le":this.text=d,this.end=f,v=4;break;case"utf8":this.fillLast=u,v=4;break;case"base64":this.text=h,this.end=p,v=3;break;default:this.write=m,this.end=y;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}i.prototype.write=function(g){if(g.length===0)return"";var v,w;if(this.lastNeed){if(v=this.fillLast(g),v===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?v?v+this.text(g,w):this.text(g,w):v||""},i.prototype.end=l,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function a(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,v,w){var x=v.length-1;if(x<w)return 0;var _=a(v[x]);return _>=0?(_>0&&(g.lastNeed=_-1),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(g.lastNeed=_-2),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(_===2?_=0:g.lastNeed=_-3),_):0))}function o(g,v,w){if((v[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return g.lastNeed=2,"�"}}function u(g){var v=this.lastTotal-this.lastNeed,w=o(this,g);if(w!==void 0)return w;if(this.lastNeed<=g.length)return g.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,v,0,g.length),this.lastNeed-=g.length}function c(g,v){var w=s(this,g,v);if(!this.lastNeed)return g.toString("utf8",v);this.lastTotal=w;var x=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,x),g.toString("utf8",v,x)}function l(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+"�":v}function d(g,v){if((g.length-v)%2===0){var w=g.toString("utf16le",v);if(w){var x=w.charCodeAt(w.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",v,g.length-1)}function f(g){var v=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,w)}return v}function h(g,v){var w=(g.length-v)%3;return w===0?g.toString("base64",v):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",v,g.length-w))}function p(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function m(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}return jv}var $v,ZD;function zL(){if(ZD)return $v;ZD=1;var t=ky();$v=v;var e=LSe(),r;v.ReadableState=g,LL().EventEmitter;var n=function(z,V){return z.listeners(V).length},i=jL(),a=Ry().Buffer,s=(typeof qr<"u"?qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(z){return a.from(z)}function u(z){return a.isBuffer(z)||z instanceof s}var c=Object.create(pp());c.inherits=gr();var l=gc,d=void 0;l&&l.debuglog?d=l.debuglog("stream"):d=function(){};var f=jSe(),h=$L(),p;c.inherits(v,i);var m=["error","close","destroy","pause","resume"];function y(z,V,Q){if(typeof z.prependListener=="function")return z.prependListener(V,Q);!z._events||!z._events[V]?z.on(V,Q):e(z._events[V])?z._events[V].unshift(Q):z._events[V]=[Q,z._events[V]]}function g(z,V){r=r||$l(),z=z||{};var Q=V instanceof r;this.objectMode=!!z.objectMode,Q&&(this.objectMode=this.objectMode||!!z.readableObjectMode);var ae=z.highWaterMark,oe=z.readableHighWaterMark,le=this.objectMode?16:16*1024;ae||ae===0?this.highWaterMark=ae:Q&&(oe||oe===0)?this.highWaterMark=oe:this.highWaterMark=le,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=z.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,z.encoding&&(p||(p=VD().StringDecoder),this.decoder=new p(z.encoding),this.encoding=z.encoding)}function v(z){if(r=r||$l(),!(this instanceof v))return new v(z);this._readableState=new g(z,this),this.readable=!0,z&&(typeof z.read=="function"&&(this._read=z.read),typeof z.destroy=="function"&&(this._destroy=z.destroy)),i.call(this)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(z){this._readableState&&(this._readableState.destroyed=z)}}),v.prototype.destroy=h.destroy,v.prototype._undestroy=h.undestroy,v.prototype._destroy=function(z,V){this.push(null),V(z)},v.prototype.push=function(z,V){var Q=this._readableState,ae;return Q.objectMode?ae=!0:typeof z=="string"&&(V=V||Q.defaultEncoding,V!==Q.encoding&&(z=a.from(z,V),V=""),ae=!0),w(this,z,V,!1,ae)},v.prototype.unshift=function(z){return w(this,z,null,!0,!1)};function w(z,V,Q,ae,oe){var le=z._readableState;if(V===null)le.reading=!1,$(z,le);else{var he;oe||(he=_(le,V)),he?z.emit("error",he):le.objectMode||V&&V.length>0?(typeof V!="string"&&!le.objectMode&&Object.getPrototypeOf(V)!==a.prototype&&(V=o(V)),ae?le.endEmitted?z.emit("error",new Error("stream.unshift() after end event")):x(z,le,V,!0):le.ended?z.emit("error",new Error("stream.push() after EOF")):(le.reading=!1,le.decoder&&!Q?(V=le.decoder.write(V),le.objectMode||V.length!==0?x(z,le,V,!1):b(z,le)):x(z,le,V,!1))):ae||(le.reading=!1)}return A(le)}function x(z,V,Q,ae){V.flowing&&V.length===0&&!V.sync?(z.emit("data",Q),z.read(0)):(V.length+=V.objectMode?1:Q.length,ae?V.buffer.unshift(Q):V.buffer.push(Q),V.needReadable&&T(z)),b(z,V)}function _(z,V){var Q;return!u(V)&&typeof V!="string"&&V!==void 0&&!z.objectMode&&(Q=new TypeError("Invalid non-string/buffer chunk")),Q}function A(z){return!z.ended&&(z.needReadable||z.length<z.highWaterMark||z.length===0)}v.prototype.isPaused=function(){return this._readableState.flowing===!1},v.prototype.setEncoding=function(z){return p||(p=VD().StringDecoder),this._readableState.decoder=new p(z),this._readableState.encoding=z,this};var M=8388608;function F(z){return z>=M?z=M:(z--,z|=z>>>1,z|=z>>>2,z|=z>>>4,z|=z>>>8,z|=z>>>16,z++),z}function k(z,V){return z<=0||V.length===0&&V.ended?0:V.objectMode?1:z!==z?V.flowing&&V.length?V.buffer.head.data.length:V.length:(z>V.highWaterMark&&(V.highWaterMark=F(z)),z<=V.length?z:V.ended?V.length:(V.needReadable=!0,0))}v.prototype.read=function(z){d("read",z),z=parseInt(z,10);var V=this._readableState,Q=z;if(z!==0&&(V.emittedReadable=!1),z===0&&V.needReadable&&(V.length>=V.highWaterMark||V.ended))return d("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?J(this):T(this),null;if(z=k(z,V),z===0&&V.ended)return V.length===0&&J(this),null;var ae=V.needReadable;d("need readable",ae),(V.length===0||V.length-z<V.highWaterMark)&&(ae=!0,d("length less than watermark",ae)),V.ended||V.reading?(ae=!1,d("reading or ended",ae)):ae&&(d("do read"),V.reading=!0,V.sync=!0,V.length===0&&(V.needReadable=!0),this._read(V.highWaterMark),V.sync=!1,V.reading||(z=k(Q,V)));var oe;return z>0?oe=P(z,V):oe=null,oe===null?(V.needReadable=!0,z=0):V.length-=z,V.length===0&&(V.ended||(V.needReadable=!0),Q!==z&&V.ended&&J(this)),oe!==null&&this.emit("data",oe),oe};function $(z,V){if(!V.ended){if(V.decoder){var Q=V.decoder.end();Q&&Q.length&&(V.buffer.push(Q),V.length+=V.objectMode?1:Q.length)}V.ended=!0,T(z)}}function T(z){var V=z._readableState;V.needReadable=!1,V.emittedReadable||(d("emitReadable",V.flowing),V.emittedReadable=!0,V.sync?t.nextTick(N,z):N(z))}function N(z){d("emit readable"),z.emit("readable"),S(z)}function b(z,V){V.readingMore||(V.readingMore=!0,t.nextTick(E,z,V))}function E(z,V){for(var Q=V.length;!V.reading&&!V.flowing&&!V.ended&&V.length<V.highWaterMark&&(d("maybeReadMore read 0"),z.read(0),Q!==V.length);)Q=V.length;V.readingMore=!1}v.prototype._read=function(z){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(z,V){var Q=this,ae=this._readableState;switch(ae.pipesCount){case 0:ae.pipes=z;break;case 1:ae.pipes=[ae.pipes,z];break;default:ae.pipes.push(z);break}ae.pipesCount+=1,d("pipe count=%d opts=%j",ae.pipesCount,V);var oe=(!V||V.end!==!1)&&z!==process.stdout&&z!==process.stderr,le=oe?Z:Y;ae.endEmitted?t.nextTick(le):Q.once("end",le),z.on("unpipe",he);function he(re,ce){d("onunpipe"),re===Q&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,j())}function Z(){d("onend"),z.end()}var K=D(Q);z.on("drain",K);var B=!1;function j(){d("cleanup"),z.removeListener("close",te),z.removeListener("finish",ne),z.removeListener("drain",K),z.removeListener("error",ee),z.removeListener("unpipe",he),Q.removeListener("end",Z),Q.removeListener("end",Y),Q.removeListener("data",W),B=!0,ae.awaitDrain&&(!z._writableState||z._writableState.needDrain)&&K()}var U=!1;Q.on("data",W);function W(re){d("ondata"),U=!1;var ce=z.write(re);ce===!1&&!U&&((ae.pipesCount===1&&ae.pipes===z||ae.pipesCount>1&&ie(ae.pipes,z)!==-1)&&!B&&(d("false write response, pause",ae.awaitDrain),ae.awaitDrain++,U=!0),Q.pause())}function ee(re){d("onerror",re),Y(),z.removeListener("error",ee),n(z,"error")===0&&z.emit("error",re)}y(z,"error",ee);function te(){z.removeListener("finish",ne),Y()}z.once("close",te);function ne(){d("onfinish"),z.removeListener("close",te),Y()}z.once("finish",ne);function Y(){d("unpipe"),Q.unpipe(z)}return z.emit("pipe",Q),ae.flowing||(d("pipe resume"),Q.resume()),z};function D(z){return function(){var V=z._readableState;d("pipeOnDrain",V.awaitDrain),V.awaitDrain&&V.awaitDrain--,V.awaitDrain===0&&n(z,"data")&&(V.flowing=!0,S(z))}}v.prototype.unpipe=function(z){var V=this._readableState,Q={hasUnpiped:!1};if(V.pipesCount===0)return this;if(V.pipesCount===1)return z&&z!==V.pipes?this:(z||(z=V.pipes),V.pipes=null,V.pipesCount=0,V.flowing=!1,z&&z.emit("unpipe",this,Q),this);if(!z){var ae=V.pipes,oe=V.pipesCount;V.pipes=null,V.pipesCount=0,V.flowing=!1;for(var le=0;le<oe;le++)ae[le].emit("unpipe",this,{hasUnpiped:!1});return this}var he=ie(V.pipes,z);return he===-1?this:(V.pipes.splice(he,1),V.pipesCount-=1,V.pipesCount===1&&(V.pipes=V.pipes[0]),z.emit("unpipe",this,Q),this)},v.prototype.on=function(z,V){var Q=i.prototype.on.call(this,z,V);if(z==="data")this._readableState.flowing!==!1&&this.resume();else if(z==="readable"){var ae=this._readableState;!ae.endEmitted&&!ae.readableListening&&(ae.readableListening=ae.needReadable=!0,ae.emittedReadable=!1,ae.reading?ae.length&&T(this):t.nextTick(C,this))}return Q},v.prototype.addListener=v.prototype.on;function C(z){d("readable nexttick read 0"),z.read(0)}v.prototype.resume=function(){var z=this._readableState;return z.flowing||(d("resume"),z.flowing=!0,I(this,z)),this};function I(z,V){V.resumeScheduled||(V.resumeScheduled=!0,t.nextTick(O,z,V))}function O(z,V){V.reading||(d("resume read 0"),z.read(0)),V.resumeScheduled=!1,V.awaitDrain=0,z.emit("resume"),S(z),V.flowing&&!V.reading&&z.read(0)}v.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function S(z){var V=z._readableState;for(d("flow",V.flowing);V.flowing&&z.read()!==null;);}v.prototype.wrap=function(z){var V=this,Q=this._readableState,ae=!1;z.on("end",function(){if(d("wrapped end"),Q.decoder&&!Q.ended){var he=Q.decoder.end();he&&he.length&&V.push(he)}V.push(null)}),z.on("data",function(he){if(d("wrapped data"),Q.decoder&&(he=Q.decoder.write(he)),!(Q.objectMode&&he==null)&&!(!Q.objectMode&&(!he||!he.length))){var Z=V.push(he);Z||(ae=!0,z.pause())}});for(var oe in z)this[oe]===void 0&&typeof z[oe]=="function"&&(this[oe]=function(he){return function(){return z[he].apply(z,arguments)}}(oe));for(var le=0;le<m.length;le++)z.on(m[le],this.emit.bind(this,m[le]));return this._read=function(he){d("wrapped _read",he),ae&&(ae=!1,z.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=P;function P(z,V){if(V.length===0)return null;var Q;return V.objectMode?Q=V.buffer.shift():!z||z>=V.length?(V.decoder?Q=V.buffer.join(""):V.buffer.length===1?Q=V.buffer.head.data:Q=V.buffer.concat(V.length),V.buffer.clear()):Q=R(z,V.buffer,V.decoder),Q}function R(z,V,Q){var ae;return z<V.head.data.length?(ae=V.head.data.slice(0,z),V.head.data=V.head.data.slice(z)):z===V.head.data.length?ae=V.shift():ae=Q?L(z,V):q(z,V),ae}function L(z,V){var Q=V.head,ae=1,oe=Q.data;for(z-=oe.length;Q=Q.next;){var le=Q.data,he=z>le.length?le.length:z;if(he===le.length?oe+=le:oe+=le.slice(0,z),z-=he,z===0){he===le.length?(++ae,Q.next?V.head=Q.next:V.head=V.tail=null):(V.head=Q,Q.data=le.slice(he));break}++ae}return V.length-=ae,oe}function q(z,V){var Q=a.allocUnsafe(z),ae=V.head,oe=1;for(ae.data.copy(Q),z-=ae.data.length;ae=ae.next;){var le=ae.data,he=z>le.length?le.length:z;if(le.copy(Q,Q.length-z,0,he),z-=he,z===0){he===le.length?(++oe,ae.next?V.head=ae.next:V.head=V.tail=null):(V.head=ae,ae.data=le.slice(he));break}++oe}return V.length-=oe,Q}function J(z){var V=z._readableState;if(V.length>0)throw new Error('"endReadable()" called on non-empty stream');V.endEmitted||(V.ended=!0,t.nextTick(G,V,z))}function G(z,V){!z.endEmitted&&z.length===0&&(z.endEmitted=!0,V.readable=!1,V.emit("end"))}function ie(z,V){for(var Q=0,ae=z.length;Q<ae;Q++)if(z[Q]===V)return Q;return-1}return $v}var Uv,HD;function qL(){if(HD)return Uv;HD=1,Uv=n;var t=$l(),e=Object.create(pp());e.inherits=gr(),e.inherits(n,t);function r(s,o){var u=this._transformState;u.transforming=!1;var c=u.writecb;if(!c)return this.emit("error",new Error("write callback called multiple times"));u.writechunk=null,u.writecb=null,o!=null&&this.push(o),c(s);var l=this._readableState;l.reading=!1,(l.needReadable||l.length<l.highWaterMark)&&this._read(l.highWaterMark)}function n(s){if(!(this instanceof n))return new n(s);t.call(this,s),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,s&&(typeof s.transform=="function"&&(this._transform=s.transform),typeof s.flush=="function"&&(this._flush=s.flush)),this.on("prefinish",i)}function i(){var s=this;typeof this._flush=="function"?this._flush(function(o,u){a(s,o,u)}):a(this,null,null)}n.prototype.push=function(s,o){return this._transformState.needTransform=!1,t.prototype.push.call(this,s,o)},n.prototype._transform=function(s,o,u){throw new Error("_transform() is not implemented")},n.prototype._write=function(s,o,u){var c=this._transformState;if(c.writecb=u,c.writechunk=s,c.writeencoding=o,!c.transforming){var l=this._readableState;(c.needTransform||l.needReadable||l.length<l.highWaterMark)&&this._read(l.highWaterMark)}},n.prototype._read=function(s){var o=this._transformState;o.writechunk!==null&&o.writecb&&!o.transforming?(o.transforming=!0,this._transform(o.writechunk,o.writeencoding,o.afterTransform)):o.needTransform=!0},n.prototype._destroy=function(s,o){var u=this;t.prototype._destroy.call(this,s,function(c){o(c),u.emit("close")})};function a(s,o,u){if(o)return s.emit("error",o);if(u!=null&&s.push(u),s._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(s._transformState.transforming)throw new Error("Calling transform done when still transforming");return s.push(null)}return Uv}var zv,WD;function USe(){if(WD)return zv;WD=1,zv=r;var t=qL(),e=Object.create(pp());e.inherits=gr(),e.inherits(r,t);function r(n){if(!(this instanceof r))return new r(n);t.call(this,n)}return r.prototype._transform=function(n,i,a){a(null,n)},zv}var YD;function zSe(){return YD||(YD=1,function(t,e){e=t.exports=zL(),e.Stream=e,e.Readable=e,e.Writable=UL(),e.Duplex=$l(),e.Transform=qL(),e.PassThrough=USe()}(Mv,Mv.exports)),Mv.exports}var Dd={exports:{}},T_={exports:{}},qSe=T_.exports,JD;function dE(){return JD||(JD=1,function(t){(function(e,r){function n(b,E){if(!b)throw new Error(E||"Assertion failed")}function i(b,E){b.super_=E;var D=function(){};D.prototype=E.prototype,b.prototype=new D,b.prototype.constructor=b}function a(b,E,D){if(a.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((E==="le"||E==="be")&&(D=E,E=10),this._init(b||0,E||10,D||"be"))}typeof e=="object"?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=gc.Buffer}catch{}a.isBN=function(b){return b instanceof a?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===a.wordSize&&Array.isArray(b.words)},a.max=function(b,E){return b.cmp(E)>0?b:E},a.min=function(b,E){return b.cmp(E)<0?b:E},a.prototype._init=function(b,E,D){if(typeof b=="number")return this._initNumber(b,E,D);if(typeof b=="object")return this._initArray(b,E,D);E==="hex"&&(E=16),n(E===(E|0)&&E>=2&&E<=36),b=b.toString().replace(/\s+/g,"");var C=0;b[0]==="-"&&(C++,this.negative=1),C<b.length&&(E===16?this._parseHex(b,C,D):(this._parseBase(b,E,C),D==="le"&&this._initArray(this.toArray(),E,D)))},a.prototype._initNumber=function(b,E,D){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(n(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),D==="le"&&this._initArray(this.toArray(),E,D)},a.prototype._initArray=function(b,E,D){if(n(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var I,O,S=0;if(D==="be")for(C=b.length-1,I=0;C>=0;C-=3)O=b[C]|b[C-1]<<8|b[C-2]<<16,this.words[I]|=O<<S&67108863,this.words[I+1]=O>>>26-S&67108863,S+=24,S>=26&&(S-=26,I++);else if(D==="le")for(C=0,I=0;C<b.length;C+=3)O=b[C]|b[C+1]<<8|b[C+2]<<16,this.words[I]|=O<<S&67108863,this.words[I+1]=O>>>26-S&67108863,S+=24,S>=26&&(S-=26,I++);return this._strip()};function o(b,E){var D=b.charCodeAt(E);if(D>=48&&D<=57)return D-48;if(D>=65&&D<=70)return D-55;if(D>=97&&D<=102)return D-87;n(!1,"Invalid character in "+b)}function u(b,E,D){var C=o(b,D);return D-1>=E&&(C|=o(b,D-1)<<4),C}a.prototype._parseHex=function(b,E,D){this.length=Math.ceil((b.length-E)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var I=0,O=0,S;if(D==="be")for(C=b.length-1;C>=E;C-=2)S=u(b,E,C)<<I,this.words[O]|=S&67108863,I>=18?(I-=18,O+=1,this.words[O]|=S>>>26):I+=8;else{var P=b.length-E;for(C=P%2===0?E+1:E;C<b.length;C+=2)S=u(b,E,C)<<I,this.words[O]|=S&67108863,I>=18?(I-=18,O+=1,this.words[O]|=S>>>26):I+=8}this._strip()};function c(b,E,D,C){for(var I=0,O=0,S=Math.min(b.length,D),P=E;P<S;P++){var R=b.charCodeAt(P)-48;I*=C,R>=49?O=R-49+10:R>=17?O=R-17+10:O=R,n(R>=0&&O<C,"Invalid character"),I+=O}return I}a.prototype._parseBase=function(b,E,D){this.words=[0],this.length=1;for(var C=0,I=1;I<=67108863;I*=E)C++;C--,I=I/E|0;for(var O=b.length-D,S=O%C,P=Math.min(O,O-S)+D,R=0,L=D;L<P;L+=C)R=c(b,L,L+C,E),this.imuln(I),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R);if(S!==0){var q=1;for(R=c(b,L,b.length,E),L=0;L<S;L++)q*=E;this.imuln(q),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R)}this._strip()},a.prototype.copy=function(b){b.words=new Array(this.length);for(var E=0;E<this.length;E++)b.words[E]=this.words[E];b.length=this.length,b.negative=this.negative,b.red=this.red};function l(b,E){b.words=E.words,b.length=E.length,b.negative=E.negative,b.red=E.red}if(a.prototype._move=function(b){l(b,this)},a.prototype.clone=function(){var b=new a(null);return this.copy(b),b},a.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{a.prototype.inspect=d}else a.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(b,E){b=b||10,E=E|0||1;var D;if(b===16||b==="hex"){D="";for(var C=0,I=0,O=0;O<this.length;O++){var S=this.words[O],P=((S<<C|I)&16777215).toString(16);I=S>>>24-C&16777215,C+=2,C>=26&&(C-=26,O--),I!==0||O!==this.length-1?D=f[6-P.length]+P+D:D=P+D}for(I!==0&&(D=I.toString(16)+D);D.length%E!==0;)D="0"+D;return this.negative!==0&&(D="-"+D),D}if(b===(b|0)&&b>=2&&b<=36){var R=h[b],L=p[b];D="";var q=this.clone();for(q.negative=0;!q.isZero();){var J=q.modrn(L).toString(b);q=q.idivn(L),q.isZero()?D=J+D:D=f[R-J.length]+J+D}for(this.isZero()&&(D="0"+D);D.length%E!==0;)D="0"+D;return this.negative!==0&&(D="-"+D),D}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(b,E){return this.toArrayLike(s,b,E)}),a.prototype.toArray=function(b,E){return this.toArrayLike(Array,b,E)};var m=function(b,E){return b.allocUnsafe?b.allocUnsafe(E):new b(E)};a.prototype.toArrayLike=function(b,E,D){this._strip();var C=this.byteLength(),I=D||Math.max(1,C);n(C<=I,"byte array longer than desired length"),n(I>0,"Requested array length <= 0");var O=m(b,I),S=E==="le"?"LE":"BE";return this["_toArrayLike"+S](O,C),O},a.prototype._toArrayLikeLE=function(b,E){for(var D=0,C=0,I=0,O=0;I<this.length;I++){var S=this.words[I]<<O|C;b[D++]=S&255,D<b.length&&(b[D++]=S>>8&255),D<b.length&&(b[D++]=S>>16&255),O===6?(D<b.length&&(b[D++]=S>>24&255),C=0,O=0):(C=S>>>24,O+=2)}if(D<b.length)for(b[D++]=C;D<b.length;)b[D++]=0},a.prototype._toArrayLikeBE=function(b,E){for(var D=b.length-1,C=0,I=0,O=0;I<this.length;I++){var S=this.words[I]<<O|C;b[D--]=S&255,D>=0&&(b[D--]=S>>8&255),D>=0&&(b[D--]=S>>16&255),O===6?(D>=0&&(b[D--]=S>>24&255),C=0,O=0):(C=S>>>24,O+=2)}if(D>=0)for(b[D--]=C;D>=0;)b[D--]=0},Math.clz32?a.prototype._countBits=function(b){return 32-Math.clz32(b)}:a.prototype._countBits=function(b){var E=b,D=0;return E>=4096&&(D+=13,E>>>=13),E>=64&&(D+=7,E>>>=7),E>=8&&(D+=4,E>>>=4),E>=2&&(D+=2,E>>>=2),D+E},a.prototype._zeroBits=function(b){if(b===0)return 26;var E=b,D=0;return E&8191||(D+=13,E>>>=13),E&127||(D+=7,E>>>=7),E&15||(D+=4,E>>>=4),E&3||(D+=2,E>>>=2),E&1||D++,D},a.prototype.bitLength=function(){var b=this.words[this.length-1],E=this._countBits(b);return(this.length-1)*26+E};function y(b){for(var E=new Array(b.bitLength()),D=0;D<E.length;D++){var C=D/26|0,I=D%26;E[D]=b.words[C]>>>I&1}return E}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,E=0;E<this.length;E++){var D=this._zeroBits(this.words[E]);if(b+=D,D!==26)break}return b},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},a.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var E=0;E<b.length;E++)this.words[E]=this.words[E]|b.words[E];return this._strip()},a.prototype.ior=function(b){return n((this.negative|b.negative)===0),this.iuor(b)},a.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},a.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},a.prototype.iuand=function(b){var E;this.length>b.length?E=b:E=this;for(var D=0;D<E.length;D++)this.words[D]=this.words[D]&b.words[D];return this.length=E.length,this._strip()},a.prototype.iand=function(b){return n((this.negative|b.negative)===0),this.iuand(b)},a.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},a.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},a.prototype.iuxor=function(b){var E,D;this.length>b.length?(E=this,D=b):(E=b,D=this);for(var C=0;C<D.length;C++)this.words[C]=E.words[C]^D.words[C];if(this!==E)for(;C<E.length;C++)this.words[C]=E.words[C];return this.length=E.length,this._strip()},a.prototype.ixor=function(b){return n((this.negative|b.negative)===0),this.iuxor(b)},a.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},a.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},a.prototype.inotn=function(b){n(typeof b=="number"&&b>=0);var E=Math.ceil(b/26)|0,D=b%26;this._expand(E),D>0&&E--;for(var C=0;C<E;C++)this.words[C]=~this.words[C]&67108863;return D>0&&(this.words[C]=~this.words[C]&67108863>>26-D),this._strip()},a.prototype.notn=function(b){return this.clone().inotn(b)},a.prototype.setn=function(b,E){n(typeof b=="number"&&b>=0);var D=b/26|0,C=b%26;return this._expand(D+1),E?this.words[D]=this.words[D]|1<<C:this.words[D]=this.words[D]&~(1<<C),this._strip()},a.prototype.iadd=function(b){var E;if(this.negative!==0&&b.negative===0)return this.negative=0,E=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,E=this.isub(b),b.negative=1,E._normSign();var D,C;this.length>b.length?(D=this,C=b):(D=b,C=this);for(var I=0,O=0;O<C.length;O++)E=(D.words[O]|0)+(C.words[O]|0)+I,this.words[O]=E&67108863,I=E>>>26;for(;I!==0&&O<D.length;O++)E=(D.words[O]|0)+I,this.words[O]=E&67108863,I=E>>>26;if(this.length=D.length,I!==0)this.words[this.length]=I,this.length++;else if(D!==this)for(;O<D.length;O++)this.words[O]=D.words[O];return this},a.prototype.add=function(b){var E;return b.negative!==0&&this.negative===0?(b.negative=0,E=this.sub(b),b.negative^=1,E):b.negative===0&&this.negative!==0?(this.negative=0,E=b.sub(this),this.negative=1,E):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},a.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var E=this.iadd(b);return b.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var D=this.cmp(b);if(D===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,I;D>0?(C=this,I=b):(C=b,I=this);for(var O=0,S=0;S<I.length;S++)E=(C.words[S]|0)-(I.words[S]|0)+O,O=E>>26,this.words[S]=E&67108863;for(;O!==0&&S<C.length;S++)E=(C.words[S]|0)+O,O=E>>26,this.words[S]=E&67108863;if(O===0&&S<C.length&&C!==this)for(;S<C.length;S++)this.words[S]=C.words[S];return this.length=Math.max(this.length,S),C!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(b){return this.clone().isub(b)};function g(b,E,D){D.negative=E.negative^b.negative;var C=b.length+E.length|0;D.length=C,C=C-1|0;var I=b.words[0]|0,O=E.words[0]|0,S=I*O,P=S&67108863,R=S/67108864|0;D.words[0]=P;for(var L=1;L<C;L++){for(var q=R>>>26,J=R&67108863,G=Math.min(L,E.length-1),ie=Math.max(0,L-b.length+1);ie<=G;ie++){var z=L-ie|0;I=b.words[z]|0,O=E.words[ie]|0,S=I*O+J,q+=S/67108864|0,J=S&67108863}D.words[L]=J|0,R=q|0}return R!==0?D.words[L]=R|0:D.length--,D._strip()}var v=function(b,E,D){var C=b.words,I=E.words,O=D.words,S=0,P,R,L,q=C[0]|0,J=q&8191,G=q>>>13,ie=C[1]|0,z=ie&8191,V=ie>>>13,Q=C[2]|0,ae=Q&8191,oe=Q>>>13,le=C[3]|0,he=le&8191,Z=le>>>13,K=C[4]|0,B=K&8191,j=K>>>13,U=C[5]|0,W=U&8191,ee=U>>>13,te=C[6]|0,ne=te&8191,Y=te>>>13,re=C[7]|0,ce=re&8191,de=re>>>13,ve=C[8]|0,we=ve&8191,Ae=ve>>>13,Ne=C[9]|0,Pe=Ne&8191,Ce=Ne>>>13,Qe=I[0]|0,ft=Qe&8191,$e=Qe>>>13,Et=I[1]|0,H=Et&8191,pe=Et>>>13,Ee=I[2]|0,Oe=Ee&8191,je=Ee>>>13,it=I[3]|0,jt=it&8191,Ft=it>>>13,Br=I[4]|0,Or=Br&8191,Mt=Br>>>13,jr=I[5]|0,$r=jr&8191,me=jr>>>13,be=I[6]|0,De=be&8191,Ie=be>>>13,Ze=I[7]|0,tt=Ze&8191,Ye=Ze>>>13,We=I[8]|0,Je=We&8191,Be=We>>>13,rt=I[9]|0,ht=rt&8191,gt=rt>>>13;D.negative=b.negative^E.negative,D.length=19,P=Math.imul(J,ft),R=Math.imul(J,$e),R=R+Math.imul(G,ft)|0,L=Math.imul(G,$e);var Ur=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,P=Math.imul(z,ft),R=Math.imul(z,$e),R=R+Math.imul(V,ft)|0,L=Math.imul(V,$e),P=P+Math.imul(J,H)|0,R=R+Math.imul(J,pe)|0,R=R+Math.imul(G,H)|0,L=L+Math.imul(G,pe)|0;var fr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(fr>>>26)|0,fr&=67108863,P=Math.imul(ae,ft),R=Math.imul(ae,$e),R=R+Math.imul(oe,ft)|0,L=Math.imul(oe,$e),P=P+Math.imul(z,H)|0,R=R+Math.imul(z,pe)|0,R=R+Math.imul(V,H)|0,L=L+Math.imul(V,pe)|0,P=P+Math.imul(J,Oe)|0,R=R+Math.imul(J,je)|0,R=R+Math.imul(G,Oe)|0,L=L+Math.imul(G,je)|0;var Jt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,P=Math.imul(he,ft),R=Math.imul(he,$e),R=R+Math.imul(Z,ft)|0,L=Math.imul(Z,$e),P=P+Math.imul(ae,H)|0,R=R+Math.imul(ae,pe)|0,R=R+Math.imul(oe,H)|0,L=L+Math.imul(oe,pe)|0,P=P+Math.imul(z,Oe)|0,R=R+Math.imul(z,je)|0,R=R+Math.imul(V,Oe)|0,L=L+Math.imul(V,je)|0,P=P+Math.imul(J,jt)|0,R=R+Math.imul(J,Ft)|0,R=R+Math.imul(G,jt)|0,L=L+Math.imul(G,Ft)|0;var Sr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,P=Math.imul(B,ft),R=Math.imul(B,$e),R=R+Math.imul(j,ft)|0,L=Math.imul(j,$e),P=P+Math.imul(he,H)|0,R=R+Math.imul(he,pe)|0,R=R+Math.imul(Z,H)|0,L=L+Math.imul(Z,pe)|0,P=P+Math.imul(ae,Oe)|0,R=R+Math.imul(ae,je)|0,R=R+Math.imul(oe,Oe)|0,L=L+Math.imul(oe,je)|0,P=P+Math.imul(z,jt)|0,R=R+Math.imul(z,Ft)|0,R=R+Math.imul(V,jt)|0,L=L+Math.imul(V,Ft)|0,P=P+Math.imul(J,Or)|0,R=R+Math.imul(J,Mt)|0,R=R+Math.imul(G,Or)|0,L=L+Math.imul(G,Mt)|0;var Fn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,P=Math.imul(W,ft),R=Math.imul(W,$e),R=R+Math.imul(ee,ft)|0,L=Math.imul(ee,$e),P=P+Math.imul(B,H)|0,R=R+Math.imul(B,pe)|0,R=R+Math.imul(j,H)|0,L=L+Math.imul(j,pe)|0,P=P+Math.imul(he,Oe)|0,R=R+Math.imul(he,je)|0,R=R+Math.imul(Z,Oe)|0,L=L+Math.imul(Z,je)|0,P=P+Math.imul(ae,jt)|0,R=R+Math.imul(ae,Ft)|0,R=R+Math.imul(oe,jt)|0,L=L+Math.imul(oe,Ft)|0,P=P+Math.imul(z,Or)|0,R=R+Math.imul(z,Mt)|0,R=R+Math.imul(V,Or)|0,L=L+Math.imul(V,Mt)|0,P=P+Math.imul(J,$r)|0,R=R+Math.imul(J,me)|0,R=R+Math.imul(G,$r)|0,L=L+Math.imul(G,me)|0;var qn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(qn>>>26)|0,qn&=67108863,P=Math.imul(ne,ft),R=Math.imul(ne,$e),R=R+Math.imul(Y,ft)|0,L=Math.imul(Y,$e),P=P+Math.imul(W,H)|0,R=R+Math.imul(W,pe)|0,R=R+Math.imul(ee,H)|0,L=L+Math.imul(ee,pe)|0,P=P+Math.imul(B,Oe)|0,R=R+Math.imul(B,je)|0,R=R+Math.imul(j,Oe)|0,L=L+Math.imul(j,je)|0,P=P+Math.imul(he,jt)|0,R=R+Math.imul(he,Ft)|0,R=R+Math.imul(Z,jt)|0,L=L+Math.imul(Z,Ft)|0,P=P+Math.imul(ae,Or)|0,R=R+Math.imul(ae,Mt)|0,R=R+Math.imul(oe,Or)|0,L=L+Math.imul(oe,Mt)|0,P=P+Math.imul(z,$r)|0,R=R+Math.imul(z,me)|0,R=R+Math.imul(V,$r)|0,L=L+Math.imul(V,me)|0,P=P+Math.imul(J,De)|0,R=R+Math.imul(J,Ie)|0,R=R+Math.imul(G,De)|0,L=L+Math.imul(G,Ie)|0;var bn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(bn>>>26)|0,bn&=67108863,P=Math.imul(ce,ft),R=Math.imul(ce,$e),R=R+Math.imul(de,ft)|0,L=Math.imul(de,$e),P=P+Math.imul(ne,H)|0,R=R+Math.imul(ne,pe)|0,R=R+Math.imul(Y,H)|0,L=L+Math.imul(Y,pe)|0,P=P+Math.imul(W,Oe)|0,R=R+Math.imul(W,je)|0,R=R+Math.imul(ee,Oe)|0,L=L+Math.imul(ee,je)|0,P=P+Math.imul(B,jt)|0,R=R+Math.imul(B,Ft)|0,R=R+Math.imul(j,jt)|0,L=L+Math.imul(j,Ft)|0,P=P+Math.imul(he,Or)|0,R=R+Math.imul(he,Mt)|0,R=R+Math.imul(Z,Or)|0,L=L+Math.imul(Z,Mt)|0,P=P+Math.imul(ae,$r)|0,R=R+Math.imul(ae,me)|0,R=R+Math.imul(oe,$r)|0,L=L+Math.imul(oe,me)|0,P=P+Math.imul(z,De)|0,R=R+Math.imul(z,Ie)|0,R=R+Math.imul(V,De)|0,L=L+Math.imul(V,Ie)|0,P=P+Math.imul(J,tt)|0,R=R+Math.imul(J,Ye)|0,R=R+Math.imul(G,tt)|0,L=L+Math.imul(G,Ye)|0;var Qr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,P=Math.imul(we,ft),R=Math.imul(we,$e),R=R+Math.imul(Ae,ft)|0,L=Math.imul(Ae,$e),P=P+Math.imul(ce,H)|0,R=R+Math.imul(ce,pe)|0,R=R+Math.imul(de,H)|0,L=L+Math.imul(de,pe)|0,P=P+Math.imul(ne,Oe)|0,R=R+Math.imul(ne,je)|0,R=R+Math.imul(Y,Oe)|0,L=L+Math.imul(Y,je)|0,P=P+Math.imul(W,jt)|0,R=R+Math.imul(W,Ft)|0,R=R+Math.imul(ee,jt)|0,L=L+Math.imul(ee,Ft)|0,P=P+Math.imul(B,Or)|0,R=R+Math.imul(B,Mt)|0,R=R+Math.imul(j,Or)|0,L=L+Math.imul(j,Mt)|0,P=P+Math.imul(he,$r)|0,R=R+Math.imul(he,me)|0,R=R+Math.imul(Z,$r)|0,L=L+Math.imul(Z,me)|0,P=P+Math.imul(ae,De)|0,R=R+Math.imul(ae,Ie)|0,R=R+Math.imul(oe,De)|0,L=L+Math.imul(oe,Ie)|0,P=P+Math.imul(z,tt)|0,R=R+Math.imul(z,Ye)|0,R=R+Math.imul(V,tt)|0,L=L+Math.imul(V,Ye)|0,P=P+Math.imul(J,Je)|0,R=R+Math.imul(J,Be)|0,R=R+Math.imul(G,Je)|0,L=L+Math.imul(G,Be)|0;var kt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(kt>>>26)|0,kt&=67108863,P=Math.imul(Pe,ft),R=Math.imul(Pe,$e),R=R+Math.imul(Ce,ft)|0,L=Math.imul(Ce,$e),P=P+Math.imul(we,H)|0,R=R+Math.imul(we,pe)|0,R=R+Math.imul(Ae,H)|0,L=L+Math.imul(Ae,pe)|0,P=P+Math.imul(ce,Oe)|0,R=R+Math.imul(ce,je)|0,R=R+Math.imul(de,Oe)|0,L=L+Math.imul(de,je)|0,P=P+Math.imul(ne,jt)|0,R=R+Math.imul(ne,Ft)|0,R=R+Math.imul(Y,jt)|0,L=L+Math.imul(Y,Ft)|0,P=P+Math.imul(W,Or)|0,R=R+Math.imul(W,Mt)|0,R=R+Math.imul(ee,Or)|0,L=L+Math.imul(ee,Mt)|0,P=P+Math.imul(B,$r)|0,R=R+Math.imul(B,me)|0,R=R+Math.imul(j,$r)|0,L=L+Math.imul(j,me)|0,P=P+Math.imul(he,De)|0,R=R+Math.imul(he,Ie)|0,R=R+Math.imul(Z,De)|0,L=L+Math.imul(Z,Ie)|0,P=P+Math.imul(ae,tt)|0,R=R+Math.imul(ae,Ye)|0,R=R+Math.imul(oe,tt)|0,L=L+Math.imul(oe,Ye)|0,P=P+Math.imul(z,Je)|0,R=R+Math.imul(z,Be)|0,R=R+Math.imul(V,Je)|0,L=L+Math.imul(V,Be)|0,P=P+Math.imul(J,ht)|0,R=R+Math.imul(J,gt)|0,R=R+Math.imul(G,ht)|0,L=L+Math.imul(G,gt)|0;var rn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(rn>>>26)|0,rn&=67108863,P=Math.imul(Pe,H),R=Math.imul(Pe,pe),R=R+Math.imul(Ce,H)|0,L=Math.imul(Ce,pe),P=P+Math.imul(we,Oe)|0,R=R+Math.imul(we,je)|0,R=R+Math.imul(Ae,Oe)|0,L=L+Math.imul(Ae,je)|0,P=P+Math.imul(ce,jt)|0,R=R+Math.imul(ce,Ft)|0,R=R+Math.imul(de,jt)|0,L=L+Math.imul(de,Ft)|0,P=P+Math.imul(ne,Or)|0,R=R+Math.imul(ne,Mt)|0,R=R+Math.imul(Y,Or)|0,L=L+Math.imul(Y,Mt)|0,P=P+Math.imul(W,$r)|0,R=R+Math.imul(W,me)|0,R=R+Math.imul(ee,$r)|0,L=L+Math.imul(ee,me)|0,P=P+Math.imul(B,De)|0,R=R+Math.imul(B,Ie)|0,R=R+Math.imul(j,De)|0,L=L+Math.imul(j,Ie)|0,P=P+Math.imul(he,tt)|0,R=R+Math.imul(he,Ye)|0,R=R+Math.imul(Z,tt)|0,L=L+Math.imul(Z,Ye)|0,P=P+Math.imul(ae,Je)|0,R=R+Math.imul(ae,Be)|0,R=R+Math.imul(oe,Je)|0,L=L+Math.imul(oe,Be)|0,P=P+Math.imul(z,ht)|0,R=R+Math.imul(z,gt)|0,R=R+Math.imul(V,ht)|0,L=L+Math.imul(V,gt)|0;var un=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(un>>>26)|0,un&=67108863,P=Math.imul(Pe,Oe),R=Math.imul(Pe,je),R=R+Math.imul(Ce,Oe)|0,L=Math.imul(Ce,je),P=P+Math.imul(we,jt)|0,R=R+Math.imul(we,Ft)|0,R=R+Math.imul(Ae,jt)|0,L=L+Math.imul(Ae,Ft)|0,P=P+Math.imul(ce,Or)|0,R=R+Math.imul(ce,Mt)|0,R=R+Math.imul(de,Or)|0,L=L+Math.imul(de,Mt)|0,P=P+Math.imul(ne,$r)|0,R=R+Math.imul(ne,me)|0,R=R+Math.imul(Y,$r)|0,L=L+Math.imul(Y,me)|0,P=P+Math.imul(W,De)|0,R=R+Math.imul(W,Ie)|0,R=R+Math.imul(ee,De)|0,L=L+Math.imul(ee,Ie)|0,P=P+Math.imul(B,tt)|0,R=R+Math.imul(B,Ye)|0,R=R+Math.imul(j,tt)|0,L=L+Math.imul(j,Ye)|0,P=P+Math.imul(he,Je)|0,R=R+Math.imul(he,Be)|0,R=R+Math.imul(Z,Je)|0,L=L+Math.imul(Z,Be)|0,P=P+Math.imul(ae,ht)|0,R=R+Math.imul(ae,gt)|0,R=R+Math.imul(oe,ht)|0,L=L+Math.imul(oe,gt)|0;var Dn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,P=Math.imul(Pe,jt),R=Math.imul(Pe,Ft),R=R+Math.imul(Ce,jt)|0,L=Math.imul(Ce,Ft),P=P+Math.imul(we,Or)|0,R=R+Math.imul(we,Mt)|0,R=R+Math.imul(Ae,Or)|0,L=L+Math.imul(Ae,Mt)|0,P=P+Math.imul(ce,$r)|0,R=R+Math.imul(ce,me)|0,R=R+Math.imul(de,$r)|0,L=L+Math.imul(de,me)|0,P=P+Math.imul(ne,De)|0,R=R+Math.imul(ne,Ie)|0,R=R+Math.imul(Y,De)|0,L=L+Math.imul(Y,Ie)|0,P=P+Math.imul(W,tt)|0,R=R+Math.imul(W,Ye)|0,R=R+Math.imul(ee,tt)|0,L=L+Math.imul(ee,Ye)|0,P=P+Math.imul(B,Je)|0,R=R+Math.imul(B,Be)|0,R=R+Math.imul(j,Je)|0,L=L+Math.imul(j,Be)|0,P=P+Math.imul(he,ht)|0,R=R+Math.imul(he,gt)|0,R=R+Math.imul(Z,ht)|0,L=L+Math.imul(Z,gt)|0;var fn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(fn>>>26)|0,fn&=67108863,P=Math.imul(Pe,Or),R=Math.imul(Pe,Mt),R=R+Math.imul(Ce,Or)|0,L=Math.imul(Ce,Mt),P=P+Math.imul(we,$r)|0,R=R+Math.imul(we,me)|0,R=R+Math.imul(Ae,$r)|0,L=L+Math.imul(Ae,me)|0,P=P+Math.imul(ce,De)|0,R=R+Math.imul(ce,Ie)|0,R=R+Math.imul(de,De)|0,L=L+Math.imul(de,Ie)|0,P=P+Math.imul(ne,tt)|0,R=R+Math.imul(ne,Ye)|0,R=R+Math.imul(Y,tt)|0,L=L+Math.imul(Y,Ye)|0,P=P+Math.imul(W,Je)|0,R=R+Math.imul(W,Be)|0,R=R+Math.imul(ee,Je)|0,L=L+Math.imul(ee,Be)|0,P=P+Math.imul(B,ht)|0,R=R+Math.imul(B,gt)|0,R=R+Math.imul(j,ht)|0,L=L+Math.imul(j,gt)|0;var Zt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,P=Math.imul(Pe,$r),R=Math.imul(Pe,me),R=R+Math.imul(Ce,$r)|0,L=Math.imul(Ce,me),P=P+Math.imul(we,De)|0,R=R+Math.imul(we,Ie)|0,R=R+Math.imul(Ae,De)|0,L=L+Math.imul(Ae,Ie)|0,P=P+Math.imul(ce,tt)|0,R=R+Math.imul(ce,Ye)|0,R=R+Math.imul(de,tt)|0,L=L+Math.imul(de,Ye)|0,P=P+Math.imul(ne,Je)|0,R=R+Math.imul(ne,Be)|0,R=R+Math.imul(Y,Je)|0,L=L+Math.imul(Y,Be)|0,P=P+Math.imul(W,ht)|0,R=R+Math.imul(W,gt)|0,R=R+Math.imul(ee,ht)|0,L=L+Math.imul(ee,gt)|0;var Mr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,P=Math.imul(Pe,De),R=Math.imul(Pe,Ie),R=R+Math.imul(Ce,De)|0,L=Math.imul(Ce,Ie),P=P+Math.imul(we,tt)|0,R=R+Math.imul(we,Ye)|0,R=R+Math.imul(Ae,tt)|0,L=L+Math.imul(Ae,Ye)|0,P=P+Math.imul(ce,Je)|0,R=R+Math.imul(ce,Be)|0,R=R+Math.imul(de,Je)|0,L=L+Math.imul(de,Be)|0,P=P+Math.imul(ne,ht)|0,R=R+Math.imul(ne,gt)|0,R=R+Math.imul(Y,ht)|0,L=L+Math.imul(Y,gt)|0;var ti=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(ti>>>26)|0,ti&=67108863,P=Math.imul(Pe,tt),R=Math.imul(Pe,Ye),R=R+Math.imul(Ce,tt)|0,L=Math.imul(Ce,Ye),P=P+Math.imul(we,Je)|0,R=R+Math.imul(we,Be)|0,R=R+Math.imul(Ae,Je)|0,L=L+Math.imul(Ae,Be)|0,P=P+Math.imul(ce,ht)|0,R=R+Math.imul(ce,gt)|0,R=R+Math.imul(de,ht)|0,L=L+Math.imul(de,gt)|0;var Vn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,P=Math.imul(Pe,Je),R=Math.imul(Pe,Be),R=R+Math.imul(Ce,Je)|0,L=Math.imul(Ce,Be),P=P+Math.imul(we,ht)|0,R=R+Math.imul(we,gt)|0,R=R+Math.imul(Ae,ht)|0,L=L+Math.imul(Ae,gt)|0;var nn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(nn>>>26)|0,nn&=67108863,P=Math.imul(Pe,ht),R=Math.imul(Pe,gt),R=R+Math.imul(Ce,ht)|0,L=Math.imul(Ce,gt);var Ji=(S+P|0)+((R&8191)<<13)|0;return S=(L+(R>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,O[0]=Ur,O[1]=fr,O[2]=Jt,O[3]=Sr,O[4]=Fn,O[5]=qn,O[6]=bn,O[7]=Qr,O[8]=kt,O[9]=rn,O[10]=un,O[11]=Dn,O[12]=fn,O[13]=Zt,O[14]=Mr,O[15]=ti,O[16]=Vn,O[17]=nn,O[18]=Ji,S!==0&&(O[19]=S,D.length++),D};Math.imul||(v=g);function w(b,E,D){D.negative=E.negative^b.negative,D.length=b.length+E.length;for(var C=0,I=0,O=0;O<D.length-1;O++){var S=I;I=0;for(var P=C&67108863,R=Math.min(O,E.length-1),L=Math.max(0,O-b.length+1);L<=R;L++){var q=O-L,J=b.words[q]|0,G=E.words[L]|0,ie=J*G,z=ie&67108863;S=S+(ie/67108864|0)|0,z=z+P|0,P=z&67108863,S=S+(z>>>26)|0,I+=S>>>26,S&=67108863}D.words[O]=P,C=S,S=I}return C!==0?D.words[O]=C:D.length--,D._strip()}function x(b,E,D){return w(b,E,D)}a.prototype.mulTo=function(b,E){var D,C=this.length+b.length;return this.length===10&&b.length===10?D=v(this,b,E):C<63?D=g(this,b,E):C<1024?D=w(this,b,E):D=x(this,b,E),D},a.prototype.mul=function(b){var E=new a(null);return E.words=new Array(this.length+b.length),this.mulTo(b,E)},a.prototype.mulf=function(b){var E=new a(null);return E.words=new Array(this.length+b.length),x(this,b,E)},a.prototype.imul=function(b){return this.clone().mulTo(b,this)},a.prototype.imuln=function(b){var E=b<0;E&&(b=-b),n(typeof b=="number"),n(b<67108864);for(var D=0,C=0;C<this.length;C++){var I=(this.words[C]|0)*b,O=(I&67108863)+(D&67108863);D>>=26,D+=I/67108864|0,D+=O>>>26,this.words[C]=O&67108863}return D!==0&&(this.words[C]=D,this.length++),E?this.ineg():this},a.prototype.muln=function(b){return this.clone().imuln(b)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(b){var E=y(b);if(E.length===0)return new a(1);for(var D=this,C=0;C<E.length&&E[C]===0;C++,D=D.sqr());if(++C<E.length)for(var I=D.sqr();C<E.length;C++,I=I.sqr())E[C]!==0&&(D=D.mul(I));return D},a.prototype.iushln=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26,C=67108863>>>26-E<<26-E,I;if(E!==0){var O=0;for(I=0;I<this.length;I++){var S=this.words[I]&C,P=(this.words[I]|0)-S<<E;this.words[I]=P|O,O=S>>>26-E}O&&(this.words[I]=O,this.length++)}if(D!==0){for(I=this.length-1;I>=0;I--)this.words[I+D]=this.words[I];for(I=0;I<D;I++)this.words[I]=0;this.length+=D}return this._strip()},a.prototype.ishln=function(b){return n(this.negative===0),this.iushln(b)},a.prototype.iushrn=function(b,E,D){n(typeof b=="number"&&b>=0);var C;E?C=(E-E%26)/26:C=0;var I=b%26,O=Math.min((b-I)/26,this.length),S=67108863^67108863>>>I<<I,P=D;if(C-=O,C=Math.max(0,C),P){for(var R=0;R<O;R++)P.words[R]=this.words[R];P.length=O}if(O!==0)if(this.length>O)for(this.length-=O,R=0;R<this.length;R++)this.words[R]=this.words[R+O];else this.words[0]=0,this.length=1;var L=0;for(R=this.length-1;R>=0&&(L!==0||R>=C);R--){var q=this.words[R]|0;this.words[R]=L<<26-I|q>>>I,L=q&S}return P&&L!==0&&(P.words[P.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(b,E,D){return n(this.negative===0),this.iushrn(b,E,D)},a.prototype.shln=function(b){return this.clone().ishln(b)},a.prototype.ushln=function(b){return this.clone().iushln(b)},a.prototype.shrn=function(b){return this.clone().ishrn(b)},a.prototype.ushrn=function(b){return this.clone().iushrn(b)},a.prototype.testn=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26,C=1<<E;if(this.length<=D)return!1;var I=this.words[D];return!!(I&C)},a.prototype.imaskn=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=D)return this;if(E!==0&&D++,this.length=Math.min(D,this.length),E!==0){var C=67108863^67108863>>>E<<E;this.words[this.length-1]&=C}return this._strip()},a.prototype.maskn=function(b){return this.clone().imaskn(b)},a.prototype.iaddn=function(b){return n(typeof b=="number"),n(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<=b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},a.prototype._iaddn=function(b){this.words[0]+=b;for(var E=0;E<this.length&&this.words[E]>=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},a.prototype.isubn=function(b){if(n(typeof b=="number"),n(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E<this.length&&this.words[E]<0;E++)this.words[E]+=67108864,this.words[E+1]-=1;return this._strip()},a.prototype.addn=function(b){return this.clone().iaddn(b)},a.prototype.subn=function(b){return this.clone().isubn(b)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(b,E,D){var C=b.length+D,I;this._expand(C);var O,S=0;for(I=0;I<b.length;I++){O=(this.words[I+D]|0)+S;var P=(b.words[I]|0)*E;O-=P&67108863,S=(O>>26)-(P/67108864|0),this.words[I+D]=O&67108863}for(;I<this.length-D;I++)O=(this.words[I+D]|0)+S,S=O>>26,this.words[I+D]=O&67108863;if(S===0)return this._strip();for(n(S===-1),S=0,I=0;I<this.length;I++)O=-(this.words[I]|0)+S,S=O>>26,this.words[I]=O&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(b,E){var D=this.length-b.length,C=this.clone(),I=b,O=I.words[I.length-1]|0,S=this._countBits(O);D=26-S,D!==0&&(I=I.ushln(D),C.iushln(D),O=I.words[I.length-1]|0);var P=C.length-I.length,R;if(E!=="mod"){R=new a(null),R.length=P+1,R.words=new Array(R.length);for(var L=0;L<R.length;L++)R.words[L]=0}var q=C.clone()._ishlnsubmul(I,1,P);q.negative===0&&(C=q,R&&(R.words[P]=1));for(var J=P-1;J>=0;J--){var G=(C.words[I.length+J]|0)*67108864+(C.words[I.length+J-1]|0);for(G=Math.min(G/O|0,67108863),C._ishlnsubmul(I,G,J);C.negative!==0;)G--,C.negative=0,C._ishlnsubmul(I,1,J),C.isZero()||(C.negative^=1);R&&(R.words[J]=G)}return R&&R._strip(),C._strip(),E!=="div"&&D!==0&&C.iushrn(D),{div:R||null,mod:C}},a.prototype.divmod=function(b,E,D){if(n(!b.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var C,I,O;return this.negative!==0&&b.negative===0?(O=this.neg().divmod(b,E),E!=="mod"&&(C=O.div.neg()),E!=="div"&&(I=O.mod.neg(),D&&I.negative!==0&&I.iadd(b)),{div:C,mod:I}):this.negative===0&&b.negative!==0?(O=this.divmod(b.neg(),E),E!=="mod"&&(C=O.div.neg()),{div:C,mod:O.mod}):this.negative&b.negative?(O=this.neg().divmod(b.neg(),E),E!=="div"&&(I=O.mod.neg(),D&&I.negative!==0&&I.isub(b)),{div:O.div,mod:I}):b.length>this.length||this.cmp(b)<0?{div:new a(0),mod:this}:b.length===1?E==="div"?{div:this.divn(b.words[0]),mod:null}:E==="mod"?{div:null,mod:new a(this.modrn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new a(this.modrn(b.words[0]))}:this._wordDiv(b,E)},a.prototype.div=function(b){return this.divmod(b,"div",!1).div},a.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},a.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},a.prototype.divRound=function(b){var E=this.divmod(b);if(E.mod.isZero())return E.div;var D=E.div.negative!==0?E.mod.isub(b):E.mod,C=b.ushrn(1),I=b.andln(1),O=D.cmp(C);return O<0||I===1&&O===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},a.prototype.modrn=function(b){var E=b<0;E&&(b=-b),n(b<=67108863);for(var D=(1<<26)%b,C=0,I=this.length-1;I>=0;I--)C=(D*C+(this.words[I]|0))%b;return E?-C:C},a.prototype.modn=function(b){return this.modrn(b)},a.prototype.idivn=function(b){var E=b<0;E&&(b=-b),n(b<=67108863);for(var D=0,C=this.length-1;C>=0;C--){var I=(this.words[C]|0)+D*67108864;this.words[C]=I/b|0,D=I%b}return this._strip(),E?this.ineg():this},a.prototype.divn=function(b){return this.clone().idivn(b)},a.prototype.egcd=function(b){n(b.negative===0),n(!b.isZero());var E=this,D=b.clone();E.negative!==0?E=E.umod(b):E=E.clone();for(var C=new a(1),I=new a(0),O=new a(0),S=new a(1),P=0;E.isEven()&&D.isEven();)E.iushrn(1),D.iushrn(1),++P;for(var R=D.clone(),L=E.clone();!E.isZero();){for(var q=0,J=1;!(E.words[0]&J)&&q<26;++q,J<<=1);if(q>0)for(E.iushrn(q);q-- >0;)(C.isOdd()||I.isOdd())&&(C.iadd(R),I.isub(L)),C.iushrn(1),I.iushrn(1);for(var G=0,ie=1;!(D.words[0]&ie)&&G<26;++G,ie<<=1);if(G>0)for(D.iushrn(G);G-- >0;)(O.isOdd()||S.isOdd())&&(O.iadd(R),S.isub(L)),O.iushrn(1),S.iushrn(1);E.cmp(D)>=0?(E.isub(D),C.isub(O),I.isub(S)):(D.isub(E),O.isub(C),S.isub(I))}return{a:O,b:S,gcd:D.iushln(P)}},a.prototype._invmp=function(b){n(b.negative===0),n(!b.isZero());var E=this,D=b.clone();E.negative!==0?E=E.umod(b):E=E.clone();for(var C=new a(1),I=new a(0),O=D.clone();E.cmpn(1)>0&&D.cmpn(1)>0;){for(var S=0,P=1;!(E.words[0]&P)&&S<26;++S,P<<=1);if(S>0)for(E.iushrn(S);S-- >0;)C.isOdd()&&C.iadd(O),C.iushrn(1);for(var R=0,L=1;!(D.words[0]&L)&&R<26;++R,L<<=1);if(R>0)for(D.iushrn(R);R-- >0;)I.isOdd()&&I.iadd(O),I.iushrn(1);E.cmp(D)>=0?(E.isub(D),C.isub(I)):(D.isub(E),I.isub(C))}var q;return E.cmpn(1)===0?q=C:q=I,q.cmpn(0)<0&&q.iadd(b),q},a.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var E=this.clone(),D=b.clone();E.negative=0,D.negative=0;for(var C=0;E.isEven()&&D.isEven();C++)E.iushrn(1),D.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;D.isEven();)D.iushrn(1);var I=E.cmp(D);if(I<0){var O=E;E=D,D=O}else if(I===0||D.cmpn(1)===0)break;E.isub(D)}while(!0);return D.iushln(C)},a.prototype.invm=function(b){return this.egcd(b).a.umod(b)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(b){return this.words[0]&b},a.prototype.bincn=function(b){n(typeof b=="number");var E=b%26,D=(b-E)/26,C=1<<E;if(this.length<=D)return this._expand(D+1),this.words[D]|=C,this;for(var I=C,O=D;I!==0&&O<this.length;O++){var S=this.words[O]|0;S+=I,I=S>>>26,S&=67108863,this.words[O]=S}return I!==0&&(this.words[O]=I,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(b){var E=b<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var D;if(this.length>1)D=1;else{E&&(b=-b),n(b<=67108863,"Number is too big");var C=this.words[0]|0;D=C===b?0:C<b?-1:1}return this.negative!==0?-D|0:D},a.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var E=this.ucmp(b);return this.negative!==0?-E|0:E},a.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var E=0,D=this.length-1;D>=0;D--){var C=this.words[D]|0,I=b.words[D]|0;if(C!==I){C<I?E=-1:C>I&&(E=1);break}}return E},a.prototype.gtn=function(b){return this.cmpn(b)===1},a.prototype.gt=function(b){return this.cmp(b)===1},a.prototype.gten=function(b){return this.cmpn(b)>=0},a.prototype.gte=function(b){return this.cmp(b)>=0},a.prototype.ltn=function(b){return this.cmpn(b)===-1},a.prototype.lt=function(b){return this.cmp(b)===-1},a.prototype.lten=function(b){return this.cmpn(b)<=0},a.prototype.lte=function(b){return this.cmp(b)<=0},a.prototype.eqn=function(b){return this.cmpn(b)===0},a.prototype.eq=function(b){return this.cmp(b)===0},a.red=function(b){return new T(b)},a.prototype.toRed=function(b){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(b){return this.red=b,this},a.prototype.forceRed=function(b){return n(!this.red,"Already a number in reduction context"),this._forceRed(b)},a.prototype.redAdd=function(b){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},a.prototype.redIAdd=function(b){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},a.prototype.redSub=function(b){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},a.prototype.redISub=function(b){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},a.prototype.redShl=function(b){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},a.prototype.redMul=function(b){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},a.prototype.redIMul=function(b){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(b){return n(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var _={k256:null,p224:null,p192:null,p25519:null};function A(b,E){this.name=b,this.p=new a(E,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}A.prototype._tmp=function(){var b=new a(null);return b.words=new Array(Math.ceil(this.n/13)),b},A.prototype.ireduce=function(b){var E=b,D;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),D=E.bitLength();while(D>this.n);var C=D<this.n?-1:E.ucmp(this.p);return C===0?(E.words[0]=0,E.length=1):C>0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},A.prototype.split=function(b,E){b.iushrn(this.n,0,E)},A.prototype.imulK=function(b){return b.imul(this.k)};function M(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(M,A),M.prototype.split=function(b,E){for(var D=4194303,C=Math.min(b.length,9),I=0;I<C;I++)E.words[I]=b.words[I];if(E.length=C,b.length<=9){b.words[0]=0,b.length=1;return}var O=b.words[9];for(E.words[E.length++]=O&D,I=10;I<b.length;I++){var S=b.words[I]|0;b.words[I-10]=(S&D)<<4|O>>>22,O=S}O>>>=22,b.words[I-10]=O,O===0&&b.length>10?b.length-=10:b.length-=9},M.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var E=0,D=0;D<b.length;D++){var C=b.words[D]|0;E+=C*977,b.words[D]=E&67108863,E=C*64+(E/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function F(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(F,A);function k(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(k,A);function $(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i($,A),$.prototype.imulK=function(b){for(var E=0,D=0;D<b.length;D++){var C=(b.words[D]|0)*19+E,I=C&67108863;C>>>=26,b.words[D]=I,E=C}return E!==0&&(b.words[b.length++]=E),b},a._prime=function(b){if(_[b])return _[b];var E;if(b==="k256")E=new M;else if(b==="p224")E=new F;else if(b==="p192")E=new k;else if(b==="p25519")E=new $;else throw new Error("Unknown prime "+b);return _[b]=E,E};function T(b){if(typeof b=="string"){var E=a._prime(b);this.m=E.p,this.prime=E}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}T.prototype._verify1=function(b){n(b.negative===0,"red works only with positives"),n(b.red,"red works only with red numbers")},T.prototype._verify2=function(b,E){n((b.negative|E.negative)===0,"red works only with positives"),n(b.red&&b.red===E.red,"red works only with red numbers")},T.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):(l(b,b.umod(this.m)._forceRed(this)),b)},T.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},T.prototype.add=function(b,E){this._verify2(b,E);var D=b.add(E);return D.cmp(this.m)>=0&&D.isub(this.m),D._forceRed(this)},T.prototype.iadd=function(b,E){this._verify2(b,E);var D=b.iadd(E);return D.cmp(this.m)>=0&&D.isub(this.m),D},T.prototype.sub=function(b,E){this._verify2(b,E);var D=b.sub(E);return D.cmpn(0)<0&&D.iadd(this.m),D._forceRed(this)},T.prototype.isub=function(b,E){this._verify2(b,E);var D=b.isub(E);return D.cmpn(0)<0&&D.iadd(this.m),D},T.prototype.shl=function(b,E){return this._verify1(b),this.imod(b.ushln(E))},T.prototype.imul=function(b,E){return this._verify2(b,E),this.imod(b.imul(E))},T.prototype.mul=function(b,E){return this._verify2(b,E),this.imod(b.mul(E))},T.prototype.isqr=function(b){return this.imul(b,b.clone())},T.prototype.sqr=function(b){return this.mul(b,b)},T.prototype.sqrt=function(b){if(b.isZero())return b.clone();var E=this.m.andln(3);if(n(E%2===1),E===3){var D=this.m.add(new a(1)).iushrn(2);return this.pow(b,D)}for(var C=this.m.subn(1),I=0;!C.isZero()&&C.andln(1)===0;)I++,C.iushrn(1);n(!C.isZero());var O=new a(1).toRed(this),S=O.redNeg(),P=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new a(2*R*R).toRed(this);this.pow(R,P).cmp(S)!==0;)R.redIAdd(S);for(var L=this.pow(R,C),q=this.pow(b,C.addn(1).iushrn(1)),J=this.pow(b,C),G=I;J.cmp(O)!==0;){for(var ie=J,z=0;ie.cmp(O)!==0;z++)ie=ie.redSqr();n(z<G);var V=this.pow(L,new a(1).iushln(G-z-1));q=q.redMul(V),L=V.redSqr(),J=J.redMul(L),G=z}return q},T.prototype.invm=function(b){var E=b._invmp(this.m);return E.negative!==0?(E.negative=0,this.imod(E).redNeg()):this.imod(E)},T.prototype.pow=function(b,E){if(E.isZero())return new a(1).toRed(this);if(E.cmpn(1)===0)return b.clone();var D=4,C=new Array(1<<D);C[0]=new a(1).toRed(this),C[1]=b;for(var I=2;I<C.length;I++)C[I]=this.mul(C[I-1],b);var O=C[0],S=0,P=0,R=E.bitLength()%26;for(R===0&&(R=26),I=E.length-1;I>=0;I--){for(var L=E.words[I],q=R-1;q>=0;q--){var J=L>>q&1;if(O!==C[0]&&(O=this.sqr(O)),J===0&&S===0){P=0;continue}S<<=1,S|=J,P++,!(P!==D&&(I!==0||q!==0))&&(O=this.mul(O,C[S]),P=0,S=0)}R=26}return O},T.prototype.convertTo=function(b){var E=b.umod(this.m);return E===b?E.clone():E},T.prototype.convertFrom=function(b){var E=b.clone();return E.red=null,E},a.mont=function(b){return new N(b)};function N(b){T.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(N,T),N.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},N.prototype.convertFrom=function(b){var E=this.imod(b.mul(this.rinv));return E.red=null,E},N.prototype.imul=function(b,E){if(b.isZero()||E.isZero())return b.words[0]=0,b.length=1,b;var D=b.imul(E),C=D.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=D.isub(C).iushrn(this.shift),O=I;return I.cmp(this.m)>=0?O=I.isub(this.m):I.cmpn(0)<0&&(O=I.iadd(this.m)),O._forceRed(this)},N.prototype.mul=function(b,E){if(b.isZero()||E.isZero())return new a(0)._forceRed(this);var D=b.mul(E),C=D.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=D.isub(C).iushrn(this.shift),O=I;return I.cmp(this.m)>=0?O=I.isub(this.m):I.cmpn(0)<0&&(O=I.iadd(this.m)),O._forceRed(this)},N.prototype.invm=function(b){var E=this.imod(b._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(t,qSe)}(T_)),T_.exports}var qv,KD;function fE(){if(KD)return qv;KD=1;var t=dE(),e=ld(),r=ur().Buffer;function n(s){var o=s.modulus.byteLength(),u;do u=new t(e(o));while(u.cmp(s.modulus)>=0||!u.umod(s.prime1)||!u.umod(s.prime2));return u}function i(s){var o=n(s),u=o.toRed(t.mont(s.modulus)).redPow(new t(s.publicExponent)).fromRed();return{blinder:u,unblinder:o.invm(s.modulus)}}function a(s,o){var u=i(o),c=o.modulus.byteLength(),l=new t(s).mul(u.blinder).umod(o.modulus),d=l.toRed(t.mont(o.prime1)),f=l.toRed(t.mont(o.prime2)),h=o.coefficient,p=o.prime1,m=o.prime2,y=d.redPow(o.exponent1).fromRed(),g=f.redPow(o.exponent2).fromRed(),v=y.isub(g).imul(h).umod(p).imul(m);return g.iadd(v).imul(u.unblinder).umod(o.modulus).toArrayLike(r,"be",c)}return a.getr=n,qv=a,qv}var GD={};const VSe="elliptic",ZSe="6.6.1",HSe="EC cryptography",WSe="lib/elliptic.js",YSe=["lib"],JSe={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},KSe={type:"git",url:"git@github.com:indutny/elliptic"},GSe=["EC","Elliptic","curve","Cryptography"],XSe="Fedor Indutny <fedor@indutny.com>",QSe="MIT",e3e={url:"https://github.com/indutny/elliptic/issues"},t3e="https://github.com/indutny/elliptic",r3e={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},n3e={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},i3e={name:VSe,version:ZSe,description:HSe,main:WSe,files:YSe,scripts:JSe,repository:KSe,keywords:GSe,author:XSe,license:QSe,bugs:e3e,homepage:t3e,devDependencies:r3e,dependencies:n3e};var XD={},QD={},eA;function VL(){return eA||(eA=1,function(t){var e=t;function r(a,s){if(Array.isArray(a))return a.slice();if(!a)return[];var o=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)o[u]=a[u]|0;return o}if(s==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)o.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var c=a.charCodeAt(u),l=c>>8,d=c&255;l?o.push(l,d):o.push(d)}return o}e.toArray=r;function n(a){return a.length===1?"0"+a:a}e.zero2=n;function i(a){for(var s="",o=0;o<a.length;o++)s+=n(a[o].toString(16));return s}e.toHex=i,e.encode=function(a,s){return s==="hex"?i(a):a}}(QD)),QD}var tA;function pa(){return tA||(tA=1,function(t){var e=t,r=ei(),n=ha(),i=VL();e.assert=n,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode;function a(l,d,f){var h=new Array(Math.max(l.bitLength(),f)+1),p;for(p=0;p<h.length;p+=1)h[p]=0;var m=1<<d+1,y=l.clone();for(p=0;p<h.length;p++){var g,v=y.andln(m-1);y.isOdd()?(v>(m>>1)-1?g=(m>>1)-v:g=v,y.isubn(g)):g=0,h[p]=g,y.iushrn(1)}return h}e.getNAF=a;function s(l,d){var f=[[],[]];l=l.clone(),d=d.clone();for(var h=0,p=0,m;l.cmpn(-h)>0||d.cmpn(-p)>0;){var y=l.andln(3)+h&3,g=d.andln(3)+p&3;y===3&&(y=-1),g===3&&(g=-1);var v;y&1?(m=l.andln(7)+h&7,(m===3||m===5)&&g===2?v=-y:v=y):v=0,f[0].push(v);var w;g&1?(m=d.andln(7)+p&7,(m===3||m===5)&&y===2?w=-g:w=g):w=0,f[1].push(w),2*h===v+1&&(h=1-h),2*p===w+1&&(p=1-p),l.iushrn(1),d.iushrn(1)}return f}e.getJSF=s;function o(l,d,f){var h="_"+d;l.prototype[d]=function(){return this[h]!==void 0?this[h]:this[h]=f.call(this)}}e.cachedProperty=o;function u(l){return typeof l=="string"?e.toArray(l,"hex"):l}e.parseBytes=u;function c(l){return new r(l,"hex","le")}e.intFromLE=c}(XD)),XD}var rA={},Vv,nA;function Fy(){if(nA)return Vv;nA=1;var t=ei(),e=pa(),r=e.getNAF,n=e.getJSF,i=e.assert;function a(o,u){this.type=o,this.p=new t(u.p,16),this.red=u.prime?t.red(u.prime):t.mont(this.p),this.zero=new t(0).toRed(this.red),this.one=new t(1).toRed(this.red),this.two=new t(2).toRed(this.red),this.n=u.n&&new t(u.n,16),this.g=u.g&&this.pointFromJSON(u.g,u.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}Vv=a,a.prototype.point=function(){throw new Error("Not implemented")},a.prototype.validate=function(){throw new Error("Not implemented")},a.prototype._fixedNafMul=function(o,u){i(o.precomputed);var c=o._getDoubles(),l=r(u,1,this._bitLength),d=(1<<c.step+1)-(c.step%2===0?2:1);d/=3;var f=[],h,p;for(h=0;h<l.length;h+=c.step){p=0;for(var m=h+c.step-1;m>=h;m--)p=(p<<1)+l[m];f.push(p)}for(var y=this.jpoint(null,null,null),g=this.jpoint(null,null,null),v=d;v>0;v--){for(h=0;h<f.length;h++)p=f[h],p===v?g=g.mixedAdd(c.points[h]):p===-v&&(g=g.mixedAdd(c.points[h].neg()));y=y.add(g)}return y.toP()},a.prototype._wnafMul=function(o,u){var c=4,l=o._getNAFPoints(c);c=l.wnd;for(var d=l.points,f=r(u,c,this._bitLength),h=this.jpoint(null,null,null),p=f.length-1;p>=0;p--){for(var m=0;p>=0&&f[p]===0;p--)m++;if(p>=0&&m++,h=h.dblp(m),p<0)break;var y=f[p];i(y!==0),o.type==="affine"?y>0?h=h.mixedAdd(d[y-1>>1]):h=h.mixedAdd(d[-y-1>>1].neg()):y>0?h=h.add(d[y-1>>1]):h=h.add(d[-y-1>>1].neg())}return o.type==="affine"?h.toP():h},a.prototype._wnafMulAdd=function(o,u,c,l,d){var f=this._wnafT1,h=this._wnafT2,p=this._wnafT3,m=0,y,g,v;for(y=0;y<l;y++){v=u[y];var w=v._getNAFPoints(o);f[y]=w.wnd,h[y]=w.points}for(y=l-1;y>=1;y-=2){var x=y-1,_=y;if(f[x]!==1||f[_]!==1){p[x]=r(c[x],f[x],this._bitLength),p[_]=r(c[_],f[_],this._bitLength),m=Math.max(p[x].length,m),m=Math.max(p[_].length,m);continue}var A=[u[x],null,null,u[_]];u[x].y.cmp(u[_].y)===0?(A[1]=u[x].add(u[_]),A[2]=u[x].toJ().mixedAdd(u[_].neg())):u[x].y.cmp(u[_].y.redNeg())===0?(A[1]=u[x].toJ().mixedAdd(u[_]),A[2]=u[x].add(u[_].neg())):(A[1]=u[x].toJ().mixedAdd(u[_]),A[2]=u[x].toJ().mixedAdd(u[_].neg()));var M=[-3,-1,-5,-7,0,7,5,1,3],F=n(c[x],c[_]);for(m=Math.max(F[0].length,m),p[x]=new Array(m),p[_]=new Array(m),g=0;g<m;g++){var k=F[0][g]|0,$=F[1][g]|0;p[x][g]=M[(k+1)*3+($+1)],p[_][g]=0,h[x]=A}}var T=this.jpoint(null,null,null),N=this._wnafT4;for(y=m;y>=0;y--){for(var b=0;y>=0;){var E=!0;for(g=0;g<l;g++)N[g]=p[g][y]|0,N[g]!==0&&(E=!1);if(!E)break;b++,y--}if(y>=0&&b++,T=T.dblp(b),y<0)break;for(g=0;g<l;g++){var D=N[g];D!==0&&(D>0?v=h[g][D-1>>1]:D<0&&(v=h[g][-D-1>>1].neg()),v.type==="affine"?T=T.mixedAdd(v):T=T.add(v))}}for(y=0;y<l;y++)h[y]=null;return d?T:T.toP()};function s(o,u){this.curve=o,this.type=u,this.precomputed=null}return a.BasePoint=s,s.prototype.eq=function(){throw new Error("Not implemented")},s.prototype.validate=function(){return this.curve.validate(this)},a.prototype.decodePoint=function(o,u){o=e.toArray(o,u);var c=this.p.byteLength();if((o[0]===4||o[0]===6||o[0]===7)&&o.length-1===2*c){o[0]===6?i(o[o.length-1]%2===0):o[0]===7&&i(o[o.length-1]%2===1);var l=this.point(o.slice(1,1+c),o.slice(1+c,1+2*c));return l}else if((o[0]===2||o[0]===3)&&o.length-1===c)return this.pointFromX(o.slice(1,1+c),o[0]===3);throw new Error("Unknown point format")},s.prototype.encodeCompressed=function(o){return this.encode(o,!0)},s.prototype._encode=function(o){var u=this.curve.p.byteLength(),c=this.getX().toArray("be",u);return o?[this.getY().isEven()?2:3].concat(c):[4].concat(c,this.getY().toArray("be",u))},s.prototype.encode=function(o,u){return e.encode(this._encode(u),o)},s.prototype.precompute=function(o){if(this.precomputed)return this;var u={doubles:null,naf:null,beta:null};return u.naf=this._getNAFPoints(8),u.doubles=this._getDoubles(4,o),u.beta=this._getBeta(),this.precomputed=u,this},s.prototype._hasDoubles=function(o){if(!this.precomputed)return!1;var u=this.precomputed.doubles;return u?u.points.length>=Math.ceil((o.bitLength()+1)/u.step):!1},s.prototype._getDoubles=function(o,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],l=this,d=0;d<u;d+=o){for(var f=0;f<o;f++)l=l.dbl();c.push(l)}return{step:o,points:c}},s.prototype._getNAFPoints=function(o){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var u=[this],c=(1<<o)-1,l=c===1?null:this.dbl(),d=1;d<c;d++)u[d]=u[d-1].add(l);return{wnd:o,points:u}},s.prototype._getBeta=function(){return null},s.prototype.dblp=function(o){for(var u=this,c=0;c<o;c++)u=u.dbl();return u},Vv}var Zv,iA;function a3e(){if(iA)return Zv;iA=1;var t=pa(),e=ei(),r=gr(),n=Fy(),i=t.assert;function a(u){n.call(this,"short",u),this.a=new e(u.a,16).toRed(this.red),this.b=new e(u.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(u),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}r(a,n),Zv=a,a.prototype._getEndomorphism=function(u){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var c,l;if(u.beta)c=new e(u.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);c=d[0].cmp(d[1])<0?d[0]:d[1],c=c.toRed(this.red)}if(u.lambda)l=new e(u.lambda,16);else{var f=this._getEndoRoots(this.n);this.g.mul(f[0]).x.cmp(this.g.x.redMul(c))===0?l=f[0]:(l=f[1],i(this.g.mul(l).x.cmp(this.g.x.redMul(c))===0))}var h;return u.basis?h=u.basis.map(function(p){return{a:new e(p.a,16),b:new e(p.b,16)}}):h=this._getEndoBasis(l),{beta:c,lambda:l,basis:h}}},a.prototype._getEndoRoots=function(u){var c=u===this.p?this.red:e.mont(u),l=new e(2).toRed(c).redInvm(),d=l.redNeg(),f=new e(3).toRed(c).redNeg().redSqrt().redMul(l),h=d.redAdd(f).fromRed(),p=d.redSub(f).fromRed();return[h,p]},a.prototype._getEndoBasis=function(u){for(var c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=u,d=this.n.clone(),f=new e(1),h=new e(0),p=new e(0),m=new e(1),y,g,v,w,x,_,A,M=0,F,k;l.cmpn(0)!==0;){var $=d.div(l);F=d.sub($.mul(l)),k=p.sub($.mul(f));var T=m.sub($.mul(h));if(!v&&F.cmp(c)<0)y=A.neg(),g=f,v=F.neg(),w=k;else if(v&&++M===2)break;A=F,d=l,l=F,p=f,f=k,m=h,h=T}x=F.neg(),_=k;var N=v.sqr().add(w.sqr()),b=x.sqr().add(_.sqr());return b.cmp(N)>=0&&(x=y,_=g),v.negative&&(v=v.neg(),w=w.neg()),x.negative&&(x=x.neg(),_=_.neg()),[{a:v,b:w},{a:x,b:_}]},a.prototype._endoSplit=function(u){var c=this.endo.basis,l=c[0],d=c[1],f=d.b.mul(u).divRound(this.n),h=l.b.neg().mul(u).divRound(this.n),p=f.mul(l.a),m=h.mul(d.a),y=f.mul(l.b),g=h.mul(d.b),v=u.sub(p).sub(m),w=y.add(g).neg();return{k1:v,k2:w}},a.prototype.pointFromX=function(u,c){u=new e(u,16),u.red||(u=u.toRed(this.red));var l=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),d=l.redSqrt();if(d.redSqr().redSub(l).cmp(this.zero)!==0)throw new Error("invalid point");var f=d.fromRed().isOdd();return(c&&!f||!c&&f)&&(d=d.redNeg()),this.point(u,d)},a.prototype.validate=function(u){if(u.inf)return!0;var c=u.x,l=u.y,d=this.a.redMul(c),f=c.redSqr().redMul(c).redIAdd(d).redIAdd(this.b);return l.redSqr().redISub(f).cmpn(0)===0},a.prototype._endoWnafMulAdd=function(u,c,l){for(var d=this._endoWnafT1,f=this._endoWnafT2,h=0;h<u.length;h++){var p=this._endoSplit(c[h]),m=u[h],y=m._getBeta();p.k1.negative&&(p.k1.ineg(),m=m.neg(!0)),p.k2.negative&&(p.k2.ineg(),y=y.neg(!0)),d[h*2]=m,d[h*2+1]=y,f[h*2]=p.k1,f[h*2+1]=p.k2}for(var g=this._wnafMulAdd(1,d,f,h*2,l),v=0;v<h*2;v++)d[v]=null,f[v]=null;return g};function s(u,c,l,d){n.BasePoint.call(this,u,"affine"),c===null&&l===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new e(c,16),this.y=new e(l,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}r(s,n.BasePoint),a.prototype.point=function(u,c,l){return new s(this,u,c,l)},a.prototype.pointFromJSON=function(u,c){return s.fromJSON(this,u,c)},s.prototype._getBeta=function(){if(this.curve.endo){var u=this.precomputed;if(u&&u.beta)return u.beta;var c=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(u){var l=this.curve,d=function(f){return l.point(f.x.redMul(l.endo.beta),f.y)};u.beta=c,c.precomputed={beta:null,naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(d)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(d)}}}return c}},s.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},s.fromJSON=function(u,c,l){typeof c=="string"&&(c=JSON.parse(c));var d=u.point(c[0],c[1],l);if(!c[2])return d;function f(p){return u.point(p[0],p[1],l)}var h=c[2];return d.precomputed={beta:null,doubles:h.doubles&&{step:h.doubles.step,points:[d].concat(h.doubles.points.map(f))},naf:h.naf&&{wnd:h.naf.wnd,points:[d].concat(h.naf.points.map(f))}},d},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.inf},s.prototype.add=function(u){if(this.inf)return u;if(u.inf)return this;if(this.eq(u))return this.dbl();if(this.neg().eq(u))return this.curve.point(null,null);if(this.x.cmp(u.x)===0)return this.curve.point(null,null);var c=this.y.redSub(u.y);c.cmpn(0)!==0&&(c=c.redMul(this.x.redSub(u.x).redInvm()));var l=c.redSqr().redISub(this.x).redISub(u.x),d=c.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,d)},s.prototype.dbl=function(){if(this.inf)return this;var u=this.y.redAdd(this.y);if(u.cmpn(0)===0)return this.curve.point(null,null);var c=this.curve.a,l=this.x.redSqr(),d=u.redInvm(),f=l.redAdd(l).redIAdd(l).redIAdd(c).redMul(d),h=f.redSqr().redISub(this.x.redAdd(this.x)),p=f.redMul(this.x.redSub(h)).redISub(this.y);return this.curve.point(h,p)},s.prototype.getX=function(){return this.x.fromRed()},s.prototype.getY=function(){return this.y.fromRed()},s.prototype.mul=function(u){return u=new e(u,16),this.isInfinity()?this:this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve.endo?this.curve._endoWnafMulAdd([this],[u]):this.curve._wnafMul(this,u)},s.prototype.mulAdd=function(u,c,l){var d=[this,c],f=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(d,f):this.curve._wnafMulAdd(1,d,f,2)},s.prototype.jmulAdd=function(u,c,l){var d=[this,c],f=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(d,f,!0):this.curve._wnafMulAdd(1,d,f,2,!0)},s.prototype.eq=function(u){return this===u||this.inf===u.inf&&(this.inf||this.x.cmp(u.x)===0&&this.y.cmp(u.y)===0)},s.prototype.neg=function(u){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var l=this.precomputed,d=function(f){return f.neg()};c.precomputed={naf:l.naf&&{wnd:l.naf.wnd,points:l.naf.points.map(d)},doubles:l.doubles&&{step:l.doubles.step,points:l.doubles.points.map(d)}}}return c},s.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var u=this.curve.jpoint(this.x,this.y,this.curve.one);return u};function o(u,c,l,d){n.BasePoint.call(this,u,"jacobian"),c===null&&l===null&&d===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(c,16),this.y=new e(l,16),this.z=new e(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return r(o,n.BasePoint),a.prototype.jpoint=function(u,c,l){return new o(this,u,c,l)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),c=u.redSqr(),l=this.x.redMul(c),d=this.y.redMul(c).redMul(u);return this.curve.point(l,d)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var c=u.z.redSqr(),l=this.z.redSqr(),d=this.x.redMul(c),f=u.x.redMul(l),h=this.y.redMul(c.redMul(u.z)),p=u.y.redMul(l.redMul(this.z)),m=d.redSub(f),y=h.redSub(p);if(m.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=m.redSqr(),v=g.redMul(m),w=d.redMul(g),x=y.redSqr().redIAdd(v).redISub(w).redISub(w),_=y.redMul(w.redISub(x)).redISub(h.redMul(v)),A=this.z.redMul(u.z).redMul(m);return this.curve.jpoint(x,_,A)},o.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var c=this.z.redSqr(),l=this.x,d=u.x.redMul(c),f=this.y,h=u.y.redMul(c).redMul(this.z),p=l.redSub(d),m=f.redSub(h);if(p.cmpn(0)===0)return m.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var y=p.redSqr(),g=y.redMul(p),v=l.redMul(y),w=m.redSqr().redIAdd(g).redISub(v).redISub(v),x=m.redMul(v.redISub(w)).redISub(f.redMul(g)),_=this.z.redMul(p);return this.curve.jpoint(w,x,_)},o.prototype.dblp=function(u){if(u===0)return this;if(this.isInfinity())return this;if(!u)return this.dbl();var c;if(this.curve.zeroA||this.curve.threeA){var l=this;for(c=0;c<u;c++)l=l.dbl();return l}var d=this.curve.a,f=this.curve.tinv,h=this.x,p=this.y,m=this.z,y=m.redSqr().redSqr(),g=p.redAdd(p);for(c=0;c<u;c++){var v=h.redSqr(),w=g.redSqr(),x=w.redSqr(),_=v.redAdd(v).redIAdd(v).redIAdd(d.redMul(y)),A=h.redMul(w),M=_.redSqr().redISub(A.redAdd(A)),F=A.redISub(M),k=_.redMul(F);k=k.redIAdd(k).redISub(x);var $=g.redMul(m);c+1<u&&(y=y.redMul(x)),h=M,m=$,g=k}return this.curve.jpoint(h,g.redMul(f),m)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.prototype._zeroDbl=function(){var u,c,l;if(this.zOne){var d=this.x.redSqr(),f=this.y.redSqr(),h=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(d).redISub(h);p=p.redIAdd(p);var m=d.redAdd(d).redIAdd(d),y=m.redSqr().redISub(p).redISub(p),g=h.redIAdd(h);g=g.redIAdd(g),g=g.redIAdd(g),u=y,c=m.redMul(p.redISub(y)).redISub(g),l=this.y.redAdd(this.y)}else{var v=this.x.redSqr(),w=this.y.redSqr(),x=w.redSqr(),_=this.x.redAdd(w).redSqr().redISub(v).redISub(x);_=_.redIAdd(_);var A=v.redAdd(v).redIAdd(v),M=A.redSqr(),F=x.redIAdd(x);F=F.redIAdd(F),F=F.redIAdd(F),u=M.redISub(_).redISub(_),c=A.redMul(_.redISub(u)).redISub(F),l=this.y.redMul(this.z),l=l.redIAdd(l)}return this.curve.jpoint(u,c,l)},o.prototype._threeDbl=function(){var u,c,l;if(this.zOne){var d=this.x.redSqr(),f=this.y.redSqr(),h=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(d).redISub(h);p=p.redIAdd(p);var m=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),y=m.redSqr().redISub(p).redISub(p);u=y;var g=h.redIAdd(h);g=g.redIAdd(g),g=g.redIAdd(g),c=m.redMul(p.redISub(y)).redISub(g),l=this.y.redAdd(this.y)}else{var v=this.z.redSqr(),w=this.y.redSqr(),x=this.x.redMul(w),_=this.x.redSub(v).redMul(this.x.redAdd(v));_=_.redAdd(_).redIAdd(_);var A=x.redIAdd(x);A=A.redIAdd(A);var M=A.redAdd(A);u=_.redSqr().redISub(M),l=this.y.redAdd(this.z).redSqr().redISub(w).redISub(v);var F=w.redSqr();F=F.redIAdd(F),F=F.redIAdd(F),F=F.redIAdd(F),c=_.redMul(A.redISub(u)).redISub(F)}return this.curve.jpoint(u,c,l)},o.prototype._dbl=function(){var u=this.curve.a,c=this.x,l=this.y,d=this.z,f=d.redSqr().redSqr(),h=c.redSqr(),p=l.redSqr(),m=h.redAdd(h).redIAdd(h).redIAdd(u.redMul(f)),y=c.redAdd(c);y=y.redIAdd(y);var g=y.redMul(p),v=m.redSqr().redISub(g.redAdd(g)),w=g.redISub(v),x=p.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var _=m.redMul(w).redISub(x),A=l.redAdd(l).redMul(d);return this.curve.jpoint(v,_,A)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var u=this.x.redSqr(),c=this.y.redSqr(),l=this.z.redSqr(),d=c.redSqr(),f=u.redAdd(u).redIAdd(u),h=f.redSqr(),p=this.x.redAdd(c).redSqr().redISub(u).redISub(d);p=p.redIAdd(p),p=p.redAdd(p).redIAdd(p),p=p.redISub(h);var m=p.redSqr(),y=d.redIAdd(d);y=y.redIAdd(y),y=y.redIAdd(y),y=y.redIAdd(y);var g=f.redIAdd(p).redSqr().redISub(h).redISub(m).redISub(y),v=c.redMul(g);v=v.redIAdd(v),v=v.redIAdd(v);var w=this.x.redMul(m).redISub(v);w=w.redIAdd(w),w=w.redIAdd(w);var x=this.y.redMul(g.redMul(y.redISub(g)).redISub(p.redMul(m)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var _=this.z.redAdd(p).redSqr().redISub(l).redISub(m);return this.curve.jpoint(w,x,_)},o.prototype.mul=function(u,c){return u=new e(u,c),this.curve._wnafMul(this,u)},o.prototype.eq=function(u){if(u.type==="affine")return this.eq(u.toJ());if(this===u)return!0;var c=this.z.redSqr(),l=u.z.redSqr();if(this.x.redMul(l).redISub(u.x.redMul(c)).cmpn(0)!==0)return!1;var d=c.redMul(this.z),f=l.redMul(u.z);return this.y.redMul(f).redISub(u.y.redMul(d)).cmpn(0)===0},o.prototype.eqXToP=function(u){var c=this.z.redSqr(),l=u.toRed(this.curve.red).redMul(c);if(this.x.cmp(l)===0)return!0;for(var d=u.clone(),f=this.curve.redN.redMul(c);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(l.redIAdd(f),this.x.cmp(l)===0)return!0}},o.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},o.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Zv}var Hv,aA;function s3e(){if(aA)return Hv;aA=1;var t=ei(),e=gr(),r=Fy(),n=pa();function i(s){r.call(this,"mont",s),this.a=new t(s.a,16).toRed(this.red),this.b=new t(s.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}e(i,r),Hv=i,i.prototype.validate=function(s){var o=s.normalize().x,u=o.redSqr(),c=u.redMul(o).redAdd(u.redMul(this.a)).redAdd(o),l=c.redSqrt();return l.redSqr().cmp(c)===0};function a(s,o,u){r.BasePoint.call(this,s,"projective"),o===null&&u===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(o,16),this.z=new t(u,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return e(a,r.BasePoint),i.prototype.decodePoint=function(s,o){return this.point(n.toArray(s,o),1)},i.prototype.point=function(s,o){return new a(this,s,o)},i.prototype.pointFromJSON=function(s){return a.fromJSON(this,s)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},a.fromJSON=function(s,o){return new a(s,o[0],o[1]||s.one)},a.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},a.prototype.isInfinity=function(){return this.z.cmpn(0)===0},a.prototype.dbl=function(){var s=this.x.redAdd(this.z),o=s.redSqr(),u=this.x.redSub(this.z),c=u.redSqr(),l=o.redSub(c),d=o.redMul(c),f=l.redMul(c.redAdd(this.curve.a24.redMul(l)));return this.curve.point(d,f)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(s,o){var u=this.x.redAdd(this.z),c=this.x.redSub(this.z),l=s.x.redAdd(s.z),d=s.x.redSub(s.z),f=d.redMul(u),h=l.redMul(c),p=o.z.redMul(f.redAdd(h).redSqr()),m=o.x.redMul(f.redISub(h).redSqr());return this.curve.point(p,m)},a.prototype.mul=function(s){for(var o=s.clone(),u=this,c=this.curve.point(null,null),l=this,d=[];o.cmpn(0)!==0;o.iushrn(1))d.push(o.andln(1));for(var f=d.length-1;f>=0;f--)d[f]===0?(u=u.diffAdd(c,l),c=c.dbl()):(c=u.diffAdd(c,l),u=u.dbl());return c},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.eq=function(s){return this.getX().cmp(s.getX())===0},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hv}var Wv,sA;function o3e(){if(sA)return Wv;sA=1;var t=pa(),e=ei(),r=gr(),n=Fy(),i=t.assert;function a(o){this.twisted=(o.a|0)!==1,this.mOneA=this.twisted&&(o.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",o),this.a=new e(o.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(o.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(o.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),i(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(o.c|0)===1}r(a,n),Wv=a,a.prototype._mulA=function(o){return this.mOneA?o.redNeg():this.a.redMul(o)},a.prototype._mulC=function(o){return this.oneC?o:this.c.redMul(o)},a.prototype.jpoint=function(o,u,c,l){return this.point(o,u,c,l)},a.prototype.pointFromX=function(o,u){o=new e(o,16),o.red||(o=o.toRed(this.red));var c=o.redSqr(),l=this.c2.redSub(this.a.redMul(c)),d=this.one.redSub(this.c2.redMul(this.d).redMul(c)),f=l.redMul(d.redInvm()),h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var p=h.fromRed().isOdd();return(u&&!p||!u&&p)&&(h=h.redNeg()),this.point(o,h)},a.prototype.pointFromY=function(o,u){o=new e(o,16),o.red||(o=o.toRed(this.red));var c=o.redSqr(),l=c.redSub(this.c2),d=c.redMul(this.d).redMul(this.c2).redSub(this.a),f=l.redMul(d.redInvm());if(f.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,o)}var h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==u&&(h=h.redNeg()),this.point(h,o)},a.prototype.validate=function(o){if(o.isInfinity())return!0;o.normalize();var u=o.x.redSqr(),c=o.y.redSqr(),l=u.redMul(this.a).redAdd(c),d=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(c)));return l.cmp(d)===0};function s(o,u,c,l,d){n.BasePoint.call(this,o,"projective"),u===null&&c===null&&l===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(u,16),this.y=new e(c,16),this.z=l?new e(l,16):this.curve.one,this.t=d&&new e(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return r(s,n.BasePoint),a.prototype.pointFromJSON=function(o){return s.fromJSON(this,o)},a.prototype.point=function(o,u,c,l){return new s(this,o,u,c,l)},s.fromJSON=function(o,u){return new s(o,u[0],u[1],u[2])},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},s.prototype._extDbl=function(){var o=this.x.redSqr(),u=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var l=this.curve._mulA(o),d=this.x.redAdd(this.y).redSqr().redISub(o).redISub(u),f=l.redAdd(u),h=f.redSub(c),p=l.redSub(u),m=d.redMul(h),y=f.redMul(p),g=d.redMul(p),v=h.redMul(f);return this.curve.point(m,y,v,g)},s.prototype._projDbl=function(){var o=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),c=this.y.redSqr(),l,d,f,h,p,m;if(this.curve.twisted){h=this.curve._mulA(u);var y=h.redAdd(c);this.zOne?(l=o.redSub(u).redSub(c).redMul(y.redSub(this.curve.two)),d=y.redMul(h.redSub(c)),f=y.redSqr().redSub(y).redSub(y)):(p=this.z.redSqr(),m=y.redSub(p).redISub(p),l=o.redSub(u).redISub(c).redMul(m),d=y.redMul(h.redSub(c)),f=y.redMul(m))}else h=u.redAdd(c),p=this.curve._mulC(this.z).redSqr(),m=h.redSub(p).redSub(p),l=this.curve._mulC(o.redISub(h)).redMul(m),d=this.curve._mulC(h).redMul(u.redISub(c)),f=h.redMul(m);return this.curve.point(l,d,f)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},s.prototype._extAdd=function(o){var u=this.y.redSub(this.x).redMul(o.y.redSub(o.x)),c=this.y.redAdd(this.x).redMul(o.y.redAdd(o.x)),l=this.t.redMul(this.curve.dd).redMul(o.t),d=this.z.redMul(o.z.redAdd(o.z)),f=c.redSub(u),h=d.redSub(l),p=d.redAdd(l),m=c.redAdd(u),y=f.redMul(h),g=p.redMul(m),v=f.redMul(m),w=h.redMul(p);return this.curve.point(y,g,w,v)},s.prototype._projAdd=function(o){var u=this.z.redMul(o.z),c=u.redSqr(),l=this.x.redMul(o.x),d=this.y.redMul(o.y),f=this.curve.d.redMul(l).redMul(d),h=c.redSub(f),p=c.redAdd(f),m=this.x.redAdd(this.y).redMul(o.x.redAdd(o.y)).redISub(l).redISub(d),y=u.redMul(h).redMul(m),g,v;return this.curve.twisted?(g=u.redMul(p).redMul(d.redSub(this.curve._mulA(l))),v=h.redMul(p)):(g=u.redMul(p).redMul(d.redSub(l)),v=this.curve._mulC(h).redMul(p)),this.curve.point(y,g,v)},s.prototype.add=function(o){return this.isInfinity()?o:o.isInfinity()?this:this.curve.extended?this._extAdd(o):this._projAdd(o)},s.prototype.mul=function(o){return this._hasDoubles(o)?this.curve._fixedNafMul(this,o):this.curve._wnafMul(this,o)},s.prototype.mulAdd=function(o,u,c){return this.curve._wnafMulAdd(1,[this,u],[o,c],2,!1)},s.prototype.jmulAdd=function(o,u,c){return this.curve._wnafMulAdd(1,[this,u],[o,c],2,!0)},s.prototype.normalize=function(){if(this.zOne)return this;var o=this.z.redInvm();return this.x=this.x.redMul(o),this.y=this.y.redMul(o),this.t&&(this.t=this.t.redMul(o)),this.z=this.curve.one,this.zOne=!0,this},s.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()},s.prototype.getY=function(){return this.normalize(),this.y.fromRed()},s.prototype.eq=function(o){return this===o||this.getX().cmp(o.getX())===0&&this.getY().cmp(o.getY())===0},s.prototype.eqXToP=function(o){var u=o.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var c=o.clone(),l=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(l),this.x.cmp(u)===0)return!0}},s.prototype.toP=s.prototype.normalize,s.prototype.mixedAdd=s.prototype.add,Wv}var oA;function ZL(){return oA||(oA=1,function(t){var e=t;e.base=Fy(),e.short=a3e(),e.mont=s3e(),e.edwards=o3e()}(rA)),rA}var uA={},cA={},Wr={},lA;function ws(){if(lA)return Wr;lA=1;var t=ha(),e=gr();Wr.inherits=e;function r(N,b){return(N.charCodeAt(b)&64512)!==55296||b<0||b+1>=N.length?!1:(N.charCodeAt(b+1)&64512)===56320}function n(N,b){if(Array.isArray(N))return N.slice();if(!N)return[];var E=[];if(typeof N=="string")if(b){if(b==="hex")for(N=N.replace(/[^a-z0-9]+/ig,""),N.length%2!==0&&(N="0"+N),C=0;C<N.length;C+=2)E.push(parseInt(N[C]+N[C+1],16))}else for(var D=0,C=0;C<N.length;C++){var I=N.charCodeAt(C);I<128?E[D++]=I:I<2048?(E[D++]=I>>6|192,E[D++]=I&63|128):r(N,C)?(I=65536+((I&1023)<<10)+(N.charCodeAt(++C)&1023),E[D++]=I>>18|240,E[D++]=I>>12&63|128,E[D++]=I>>6&63|128,E[D++]=I&63|128):(E[D++]=I>>12|224,E[D++]=I>>6&63|128,E[D++]=I&63|128)}else for(C=0;C<N.length;C++)E[C]=N[C]|0;return E}Wr.toArray=n;function i(N){for(var b="",E=0;E<N.length;E++)b+=o(N[E].toString(16));return b}Wr.toHex=i;function a(N){var b=N>>>24|N>>>8&65280|N<<8&16711680|(N&255)<<24;return b>>>0}Wr.htonl=a;function s(N,b){for(var E="",D=0;D<N.length;D++){var C=N[D];b==="little"&&(C=a(C)),E+=u(C.toString(16))}return E}Wr.toHex32=s;function o(N){return N.length===1?"0"+N:N}Wr.zero2=o;function u(N){return N.length===7?"0"+N:N.length===6?"00"+N:N.length===5?"000"+N:N.length===4?"0000"+N:N.length===3?"00000"+N:N.length===2?"000000"+N:N.length===1?"0000000"+N:N}Wr.zero8=u;function c(N,b,E,D){var C=E-b;t(C%4===0);for(var I=new Array(C/4),O=0,S=b;O<I.length;O++,S+=4){var P;D==="big"?P=N[S]<<24|N[S+1]<<16|N[S+2]<<8|N[S+3]:P=N[S+3]<<24|N[S+2]<<16|N[S+1]<<8|N[S],I[O]=P>>>0}return I}Wr.join32=c;function l(N,b){for(var E=new Array(N.length*4),D=0,C=0;D<N.length;D++,C+=4){var I=N[D];b==="big"?(E[C]=I>>>24,E[C+1]=I>>>16&255,E[C+2]=I>>>8&255,E[C+3]=I&255):(E[C+3]=I>>>24,E[C+2]=I>>>16&255,E[C+1]=I>>>8&255,E[C]=I&255)}return E}Wr.split32=l;function d(N,b){return N>>>b|N<<32-b}Wr.rotr32=d;function f(N,b){return N<<b|N>>>32-b}Wr.rotl32=f;function h(N,b){return N+b>>>0}Wr.sum32=h;function p(N,b,E){return N+b+E>>>0}Wr.sum32_3=p;function m(N,b,E,D){return N+b+E+D>>>0}Wr.sum32_4=m;function y(N,b,E,D,C){return N+b+E+D+C>>>0}Wr.sum32_5=y;function g(N,b,E,D){var C=N[b],I=N[b+1],O=D+I>>>0,S=(O<D?1:0)+E+C;N[b]=S>>>0,N[b+1]=O}Wr.sum64=g;function v(N,b,E,D){var C=b+D>>>0,I=(C<b?1:0)+N+E;return I>>>0}Wr.sum64_hi=v;function w(N,b,E,D){var C=b+D;return C>>>0}Wr.sum64_lo=w;function x(N,b,E,D,C,I,O,S){var P=0,R=b;R=R+D>>>0,P+=R<b?1:0,R=R+I>>>0,P+=R<I?1:0,R=R+S>>>0,P+=R<S?1:0;var L=N+E+C+O+P;return L>>>0}Wr.sum64_4_hi=x;function _(N,b,E,D,C,I,O,S){var P=b+D+I+S;return P>>>0}Wr.sum64_4_lo=_;function A(N,b,E,D,C,I,O,S,P,R){var L=0,q=b;q=q+D>>>0,L+=q<b?1:0,q=q+I>>>0,L+=q<I?1:0,q=q+S>>>0,L+=q<S?1:0,q=q+R>>>0,L+=q<R?1:0;var J=N+E+C+O+P+L;return J>>>0}Wr.sum64_5_hi=A;function M(N,b,E,D,C,I,O,S,P,R){var L=b+D+I+S+R;return L>>>0}Wr.sum64_5_lo=M;function F(N,b,E){var D=b<<32-E|N>>>E;return D>>>0}Wr.rotr64_hi=F;function k(N,b,E){var D=N<<32-E|b>>>E;return D>>>0}Wr.rotr64_lo=k;function $(N,b,E){return N>>>E}Wr.shr64_hi=$;function T(N,b,E){var D=N<<32-E|b>>>E;return D>>>0}return Wr.shr64_lo=T,Wr}var Yv={},dA;function mp(){if(dA)return Yv;dA=1;var t=ws(),e=ha();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return Yv.BlockHash=r,r.prototype.update=function(n,i){if(n=t.toArray(n,i),this.pending?this.pending=this.pending.concat(n):this.pending=n,this.pendingTotal+=n.length,this.pending.length>=this._delta8){n=this.pending;var a=n.length%this._delta8;this.pending=n.slice(n.length-a,n.length),this.pending.length===0&&(this.pending=null),n=t.join32(n,0,n.length-a,this.endian);for(var s=0;s<n.length;s+=this._delta32)this._update(n,s,s+this._delta32)}return this},r.prototype.digest=function(n){return this.update(this._pad()),e(this.pending===null),this._digest(n)},r.prototype._pad=function(){var n=this.pendingTotal,i=this._delta8,a=i-(n+this.padLength)%i,s=new Array(a+this.padLength);s[0]=128;for(var o=1;o<a;o++)s[o]=0;if(n<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)s[o++]=0;s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=n>>>24&255,s[o++]=n>>>16&255,s[o++]=n>>>8&255,s[o++]=n&255}else for(s[o++]=n&255,s[o++]=n>>>8&255,s[o++]=n>>>16&255,s[o++]=n>>>24&255,s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=0,u=8;u<this.padLength;u++)s[o++]=0;return s},Yv}var Ac={},Ga={},fA;function HL(){if(fA)return Ga;fA=1;var t=ws(),e=t.rotr32;function r(l,d,f,h){if(l===0)return n(d,f,h);if(l===1||l===3)return a(d,f,h);if(l===2)return i(d,f,h)}Ga.ft_1=r;function n(l,d,f){return l&d^~l&f}Ga.ch32=n;function i(l,d,f){return l&d^l&f^d&f}Ga.maj32=i;function a(l,d,f){return l^d^f}Ga.p32=a;function s(l){return e(l,2)^e(l,13)^e(l,22)}Ga.s0_256=s;function o(l){return e(l,6)^e(l,11)^e(l,25)}Ga.s1_256=o;function u(l){return e(l,7)^e(l,18)^l>>>3}Ga.g0_256=u;function c(l){return e(l,17)^e(l,19)^l>>>10}return Ga.g1_256=c,Ga}var Jv,hA;function u3e(){if(hA)return Jv;hA=1;var t=ws(),e=mp(),r=HL(),n=t.rotl32,i=t.sum32,a=t.sum32_5,s=r.ft_1,o=e.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(c,o),Jv=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(l,d){for(var f=this.W,h=0;h<16;h++)f[h]=l[d+h];for(;h<f.length;h++)f[h]=n(f[h-3]^f[h-8]^f[h-14]^f[h-16],1);var p=this.h[0],m=this.h[1],y=this.h[2],g=this.h[3],v=this.h[4];for(h=0;h<f.length;h++){var w=~~(h/20),x=a(n(p,5),s(w,m,y,g),v,f[h],u[w]);v=g,g=y,y=n(m,30),m=p,p=x}this.h[0]=i(this.h[0],p),this.h[1]=i(this.h[1],m),this.h[2]=i(this.h[2],y),this.h[3]=i(this.h[3],g),this.h[4]=i(this.h[4],v)},c.prototype._digest=function(l){return l==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},Jv}var Kv,pA;function WL(){if(pA)return Kv;pA=1;var t=ws(),e=mp(),r=HL(),n=ha(),i=t.sum32,a=t.sum32_4,s=t.sum32_5,o=r.ch32,u=r.maj32,c=r.s0_256,l=r.s1_256,d=r.g0_256,f=r.g1_256,h=e.BlockHash,p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;h.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=p,this.W=new Array(64)}return t.inherits(m,h),Kv=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(y,g){for(var v=this.W,w=0;w<16;w++)v[w]=y[g+w];for(;w<v.length;w++)v[w]=a(f(v[w-2]),v[w-7],d(v[w-15]),v[w-16]);var x=this.h[0],_=this.h[1],A=this.h[2],M=this.h[3],F=this.h[4],k=this.h[5],$=this.h[6],T=this.h[7];for(n(this.k.length===v.length),w=0;w<v.length;w++){var N=s(T,l(F),o(F,k,$),this.k[w],v[w]),b=i(c(x),u(x,_,A));T=$,$=k,k=F,F=i(M,N),M=A,A=_,_=x,x=i(N,b)}this.h[0]=i(this.h[0],x),this.h[1]=i(this.h[1],_),this.h[2]=i(this.h[2],A),this.h[3]=i(this.h[3],M),this.h[4]=i(this.h[4],F),this.h[5]=i(this.h[5],k),this.h[6]=i(this.h[6],$),this.h[7]=i(this.h[7],T)},m.prototype._digest=function(y){return y==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},Kv}var Gv,mA;function c3e(){if(mA)return Gv;mA=1;var t=ws(),e=WL();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return t.inherits(r,e),Gv=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(n){return n==="hex"?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")},Gv}var Xv,gA;function YL(){if(gA)return Xv;gA=1;var t=ws(),e=mp(),r=ha(),n=t.rotr64_hi,i=t.rotr64_lo,a=t.shr64_hi,s=t.shr64_lo,o=t.sum64,u=t.sum64_hi,c=t.sum64_lo,l=t.sum64_4_hi,d=t.sum64_4_lo,f=t.sum64_5_hi,h=t.sum64_5_lo,p=e.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;p.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}t.inherits(y,p),Xv=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(b,E){for(var D=this.W,C=0;C<32;C++)D[C]=b[E+C];for(;C<D.length;C+=2){var I=T(D[C-4],D[C-3]),O=N(D[C-4],D[C-3]),S=D[C-14],P=D[C-13],R=k(D[C-30],D[C-29]),L=$(D[C-30],D[C-29]),q=D[C-32],J=D[C-31];D[C]=l(I,O,S,P,R,L,q,J),D[C+1]=d(I,O,S,P,R,L,q,J)}},y.prototype._update=function(b,E){this._prepareBlock(b,E);var D=this.W,C=this.h[0],I=this.h[1],O=this.h[2],S=this.h[3],P=this.h[4],R=this.h[5],L=this.h[6],q=this.h[7],J=this.h[8],G=this.h[9],ie=this.h[10],z=this.h[11],V=this.h[12],Q=this.h[13],ae=this.h[14],oe=this.h[15];r(this.k.length===D.length);for(var le=0;le<D.length;le+=2){var he=ae,Z=oe,K=M(J,G),B=F(J,G),j=g(J,G,ie,z,V),U=v(J,G,ie,z,V,Q),W=this.k[le],ee=this.k[le+1],te=D[le],ne=D[le+1],Y=f(he,Z,K,B,j,U,W,ee,te,ne),re=h(he,Z,K,B,j,U,W,ee,te,ne);he=_(C,I),Z=A(C,I),K=w(C,I,O,S,P),B=x(C,I,O,S,P,R);var ce=u(he,Z,K,B),de=c(he,Z,K,B);ae=V,oe=Q,V=ie,Q=z,ie=J,z=G,J=u(L,q,Y,re),G=c(q,q,Y,re),L=P,q=R,P=O,R=S,O=C,S=I,C=u(Y,re,ce,de),I=c(Y,re,ce,de)}o(this.h,0,C,I),o(this.h,2,O,S),o(this.h,4,P,R),o(this.h,6,L,q),o(this.h,8,J,G),o(this.h,10,ie,z),o(this.h,12,V,Q),o(this.h,14,ae,oe)},y.prototype._digest=function(b){return b==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")};function g(b,E,D,C,I){var O=b&D^~b&I;return O<0&&(O+=4294967296),O}function v(b,E,D,C,I,O){var S=E&C^~E&O;return S<0&&(S+=4294967296),S}function w(b,E,D,C,I){var O=b&D^b&I^D&I;return O<0&&(O+=4294967296),O}function x(b,E,D,C,I,O){var S=E&C^E&O^C&O;return S<0&&(S+=4294967296),S}function _(b,E){var D=n(b,E,28),C=n(E,b,2),I=n(E,b,7),O=D^C^I;return O<0&&(O+=4294967296),O}function A(b,E){var D=i(b,E,28),C=i(E,b,2),I=i(E,b,7),O=D^C^I;return O<0&&(O+=4294967296),O}function M(b,E){var D=n(b,E,14),C=n(b,E,18),I=n(E,b,9),O=D^C^I;return O<0&&(O+=4294967296),O}function F(b,E){var D=i(b,E,14),C=i(b,E,18),I=i(E,b,9),O=D^C^I;return O<0&&(O+=4294967296),O}function k(b,E){var D=n(b,E,1),C=n(b,E,8),I=a(b,E,7),O=D^C^I;return O<0&&(O+=4294967296),O}function $(b,E){var D=i(b,E,1),C=i(b,E,8),I=s(b,E,7),O=D^C^I;return O<0&&(O+=4294967296),O}function T(b,E){var D=n(b,E,19),C=n(E,b,29),I=a(b,E,6),O=D^C^I;return O<0&&(O+=4294967296),O}function N(b,E){var D=i(b,E,19),C=i(E,b,29),I=s(b,E,6),O=D^C^I;return O<0&&(O+=4294967296),O}return Xv}var Qv,yA;function l3e(){if(yA)return Qv;yA=1;var t=ws(),e=YL();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return t.inherits(r,e),Qv=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(n){return n==="hex"?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")},Qv}var vA;function d3e(){return vA||(vA=1,Ac.sha1=u3e(),Ac.sha224=c3e(),Ac.sha256=WL(),Ac.sha384=l3e(),Ac.sha512=YL()),Ac}var eb={},bA;function f3e(){if(bA)return eb;bA=1;var t=ws(),e=mp(),r=t.rotl32,n=t.sum32,i=t.sum32_3,a=t.sum32_4,s=e.BlockHash;function o(){if(!(this instanceof o))return new o;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(o,s),eb.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(m,y){for(var g=this.h[0],v=this.h[1],w=this.h[2],x=this.h[3],_=this.h[4],A=g,M=v,F=w,k=x,$=_,T=0;T<80;T++){var N=n(r(a(g,u(T,v,w,x),m[d[T]+y],c(T)),h[T]),_);g=_,_=x,x=r(w,10),w=v,v=N,N=n(r(a(A,u(79-T,M,F,k),m[f[T]+y],l(T)),p[T]),$),A=$,$=k,k=r(F,10),F=M,M=N}N=i(this.h[1],w,k),this.h[1]=i(this.h[2],x,$),this.h[2]=i(this.h[3],_,A),this.h[3]=i(this.h[4],g,M),this.h[4]=i(this.h[0],v,F),this.h[0]=N},o.prototype._digest=function(m){return m==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function u(m,y,g,v){return m<=15?y^g^v:m<=31?y&g|~y&v:m<=47?(y|~g)^v:m<=63?y&v|g&~v:y^(g|~v)}function c(m){return m<=15?0:m<=31?1518500249:m<=47?1859775393:m<=63?2400959708:2840853838}function l(m){return m<=15?1352829926:m<=31?1548603684:m<=47?1836072691:m<=63?2053994217:0}var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],h=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];return eb}var tb,wA;function h3e(){if(wA)return tb;wA=1;var t=ws(),e=ha();function r(n,i,a){if(!(this instanceof r))return new r(n,i,a);this.Hash=n,this.blockSize=n.blockSize/8,this.outSize=n.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(i,a))}return tb=r,r.prototype._init=function(n){n.length>this.blockSize&&(n=new this.Hash().update(n).digest()),e(n.length<=this.blockSize);for(var i=n.length;i<this.blockSize;i++)n.push(0);for(i=0;i<n.length;i++)n[i]^=54;for(this.inner=new this.Hash().update(n),i=0;i<n.length;i++)n[i]^=106;this.outer=new this.Hash().update(n)},r.prototype.update=function(n,i){return this.inner.update(n,i),this},r.prototype.digest=function(n){return this.outer.update(this.inner.digest()),this.outer.digest(n)},tb}var _A;function hE(){return _A||(_A=1,function(t){var e=t;e.utils=ws(),e.common=mp(),e.sha=d3e(),e.ripemd=f3e(),e.hmac=h3e(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(cA)),cA}var xA,EA;function p3e(){return EA||(EA=1,xA={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),xA}var SA;function pE(){return SA||(SA=1,function(t){var e=t,r=hE(),n=ZL(),i=pa(),a=i.assert;function s(c){c.type==="short"?this.curve=new n.short(c):c.type==="edwards"?this.curve=new n.edwards(c):this.curve=new n.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=s;function o(c,l){Object.defineProperty(e,c,{configurable:!0,enumerable:!0,get:function(){var d=new s(l);return Object.defineProperty(e,c,{configurable:!0,enumerable:!0,value:d}),d}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=p3e()}catch{u=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})}(uA)),uA}var rb,TA;function m3e(){if(TA)return rb;TA=1;var t=hE(),e=VL(),r=ha();function n(i){if(!(this instanceof n))return new n(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=e.toArray(i.entropy,i.entropyEnc||"hex"),s=e.toArray(i.nonce,i.nonceEnc||"hex"),o=e.toArray(i.pers,i.persEnc||"hex");r(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,s,o)}return rb=n,n.prototype._init=function(i,a,s){var o=i.concat(a).concat(s);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var u=0;u<this.V.length;u++)this.K[u]=0,this.V[u]=1;this._update(o),this._reseed=1,this.reseedInterval=281474976710656},n.prototype._hmac=function(){return new t.hmac(this.hash,this.K)},n.prototype._update=function(i){var a=this._hmac().update(this.V).update([0]);i&&(a=a.update(i)),this.K=a.digest(),this.V=this._hmac().update(this.V).digest(),i&&(this.K=this._hmac().update(this.V).update([1]).update(i).digest(),this.V=this._hmac().update(this.V).digest())},n.prototype.reseed=function(i,a,s,o){typeof a!="string"&&(o=s,s=a,a=null),i=e.toArray(i,a),s=e.toArray(s,o),r(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(s||[])),this._reseed=1},n.prototype.generate=function(i,a,s,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(o=s,s=a,a=null),s&&(s=e.toArray(s,o||"hex"),this._update(s));for(var u=[];u.length<i;)this.V=this._hmac().update(this.V).digest(),u=u.concat(this.V);var c=u.slice(0,i);return this._update(s),this._reseed++,e.encode(c,a)},rb}var nb,DA;function g3e(){if(DA)return nb;DA=1;var t=ei(),e=pa(),r=e.assert;function n(i,a){this.ec=i,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}return nb=n,n.fromPublic=function(i,a,s){return a instanceof n?a:new n(i,{pub:a,pubEnc:s})},n.fromPrivate=function(i,a,s){return a instanceof n?a:new n(i,{priv:a,privEnc:s})},n.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},n.prototype.getPublic=function(i,a){return typeof i=="string"&&(a=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),a?this.pub.encode(a,i):this.pub},n.prototype.getPrivate=function(i){return i==="hex"?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(i,a){this.priv=new t(i,a||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(i,a){if(i.x||i.y){this.ec.curve.type==="mont"?r(i.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&r(i.x&&i.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(i.x,i.y);return}this.pub=this.ec.curve.decodePoint(i,a)},n.prototype.derive=function(i){return i.validate()||r(i.validate(),"public point not validated"),i.mul(this.priv).getX()},n.prototype.sign=function(i,a,s){return this.ec.sign(i,this,a,s)},n.prototype.verify=function(i,a,s){return this.ec.verify(i,a,this,void 0,s)},n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},nb}var ib,AA;function y3e(){if(AA)return ib;AA=1;var t=ei(),e=pa(),r=e.assert;function n(u,c){if(u instanceof n)return u;this._importDER(u,c)||(r(u.r&&u.s,"Signature without r or s"),this.r=new t(u.r,16),this.s=new t(u.s,16),u.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=u.recoveryParam)}ib=n;function i(){this.place=0}function a(u,c){var l=u[c.place++];if(!(l&128))return l;var d=l&15;if(d===0||d>4||u[c.place]===0)return!1;for(var f=0,h=0,p=c.place;h<d;h++,p++)f<<=8,f|=u[p],f>>>=0;return f<=127?!1:(c.place=p,f)}function s(u){for(var c=0,l=u.length-1;!u[c]&&!(u[c+1]&128)&&c<l;)c++;return c===0?u:u.slice(c)}n.prototype._importDER=function(u,c){u=e.toArray(u,c);var l=new i;if(u[l.place++]!==48)return!1;var d=a(u,l);if(d===!1||d+l.place!==u.length||u[l.place++]!==2)return!1;var f=a(u,l);if(f===!1||u[l.place]&128)return!1;var h=u.slice(l.place,f+l.place);if(l.place+=f,u[l.place++]!==2)return!1;var p=a(u,l);if(p===!1||u.length!==p+l.place||u[l.place]&128)return!1;var m=u.slice(l.place,p+l.place);if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;if(m[0]===0)if(m[1]&128)m=m.slice(1);else return!1;return this.r=new t(h),this.s=new t(m),this.recoveryParam=null,!0};function o(u,c){if(c<128){u.push(c);return}var l=1+(Math.log(c)/Math.LN2>>>3);for(u.push(l|128);--l;)u.push(c>>>(l<<3)&255);u.push(c)}return n.prototype.toDER=function(u){var c=this.r.toArray(),l=this.s.toArray();for(c[0]&128&&(c=[0].concat(c)),l[0]&128&&(l=[0].concat(l)),c=s(c),l=s(l);!l[0]&&!(l[1]&128);)l=l.slice(1);var d=[2];o(d,c.length),d=d.concat(c),d.push(2),o(d,l.length);var f=d.concat(l),h=[48];return o(h,f.length),h=h.concat(f),e.encode(h,u)},ib}var ab,NA;function v3e(){if(NA)return ab;NA=1;var t=ei(),e=m3e(),r=pa(),n=pE(),i=lE(),a=r.assert,s=g3e(),o=y3e();function u(c){if(!(this instanceof u))return new u(c);typeof c=="string"&&(a(Object.prototype.hasOwnProperty.call(n,c),"Unknown curve "+c),c=n[c]),c instanceof n.PresetCurve&&(c={curve:c}),this.curve=c.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=c.curve.g,this.g.precompute(c.curve.n.bitLength()+1),this.hash=c.hash||c.curve.hash}return ab=u,u.prototype.keyPair=function(c){return new s(this,c)},u.prototype.keyFromPrivate=function(c,l){return s.fromPrivate(this,c,l)},u.prototype.keyFromPublic=function(c,l){return s.fromPublic(this,c,l)},u.prototype.genKeyPair=function(c){c||(c={});for(var l=new e({hash:this.hash,pers:c.pers,persEnc:c.persEnc||"utf8",entropy:c.entropy||i(this.hash.hmacStrength),entropyEnc:c.entropy&&c.entropyEnc||"utf8",nonce:this.n.toArray()}),d=this.n.byteLength(),f=this.n.sub(new t(2));;){var h=new t(l.generate(d));if(!(h.cmp(f)>0))return h.iaddn(1),this.keyFromPrivate(h)}},u.prototype._truncateToN=function(c,l,d){var f;if(t.isBN(c)||typeof c=="number")c=new t(c,16),f=c.byteLength();else if(typeof c=="object")f=c.length,c=new t(c,16);else{var h=c.toString();f=h.length+1>>>1,c=new t(h,16)}typeof d!="number"&&(d=f*8);var p=d-this.n.bitLength();return p>0&&(c=c.ushrn(p)),!l&&c.cmp(this.n)>=0?c.sub(this.n):c},u.prototype.sign=function(c,l,d,f){if(typeof d=="object"&&(f=d,d=null),f||(f={}),typeof c!="string"&&typeof c!="number"&&!t.isBN(c)){a(typeof c=="object"&&c&&typeof c.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),a(c.length>>>0===c.length);for(var h=0;h<c.length;h++)a((c[h]&255)===c[h])}l=this.keyFromPrivate(l,d),c=this._truncateToN(c,!1,f.msgBitLength),a(!c.isNeg(),"Can not sign a negative message");var p=this.n.byteLength(),m=l.getPrivate().toArray("be",p),y=c.toArray("be",p);a(new t(y).eq(c),"Can not sign message");for(var g=new e({hash:this.hash,entropy:m,nonce:y,pers:f.pers,persEnc:f.persEnc||"utf8"}),v=this.n.sub(new t(1)),w=0;;w++){var x=f.k?f.k(w):new t(g.generate(this.n.byteLength()));if(x=this._truncateToN(x,!0),!(x.cmpn(1)<=0||x.cmp(v)>=0)){var _=this.g.mul(x);if(!_.isInfinity()){var A=_.getX(),M=A.umod(this.n);if(M.cmpn(0)!==0){var F=x.invm(this.n).mul(M.mul(l.getPrivate()).iadd(c));if(F=F.umod(this.n),F.cmpn(0)!==0){var k=(_.getY().isOdd()?1:0)|(A.cmp(M)!==0?2:0);return f.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),k^=1),new o({r:M,s:F,recoveryParam:k})}}}}}},u.prototype.verify=function(c,l,d,f,h){h||(h={}),c=this._truncateToN(c,!1,h.msgBitLength),d=this.keyFromPublic(d,f),l=new o(l,"hex");var p=l.r,m=l.s;if(p.cmpn(1)<0||p.cmp(this.n)>=0||m.cmpn(1)<0||m.cmp(this.n)>=0)return!1;var y=m.invm(this.n),g=y.mul(c).umod(this.n),v=y.mul(p).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(g,d.getPublic(),v),w.isInfinity()?!1:w.eqXToP(p)):(w=this.g.mulAdd(g,d.getPublic(),v),w.isInfinity()?!1:w.getX().umod(this.n).cmp(p)===0)},u.prototype.recoverPubKey=function(c,l,d,f){a((3&d)===d,"The recovery param is more than two bits"),l=new o(l,f);var h=this.n,p=new t(c),m=l.r,y=l.s,g=d&1,v=d>>1;if(m.cmp(this.curve.p.umod(this.curve.n))>=0&&v)throw new Error("Unable to find sencond key candinate");v?m=this.curve.pointFromX(m.add(this.curve.n),g):m=this.curve.pointFromX(m,g);var w=l.r.invm(h),x=h.sub(p).mul(w).umod(h),_=y.mul(w).umod(h);return this.g.mulAdd(x,m,_)},u.prototype.getKeyRecoveryParam=function(c,l,d,f){if(l=new o(l,f),l.recoveryParam!==null)return l.recoveryParam;for(var h=0;h<4;h++){var p;try{p=this.recoverPubKey(c,l,h)}catch{continue}if(p.eq(d))return h}throw new Error("Unable to find valid recovery factor")},ab}var sb,IA;function b3e(){if(IA)return sb;IA=1;var t=pa(),e=t.assert,r=t.parseBytes,n=t.cachedProperty;function i(a,s){this.eddsa=a,this._secret=r(s.secret),a.isPoint(s.pub)?this._pub=s.pub:this._pubBytes=r(s.pub)}return i.fromPublic=function(a,s){return s instanceof i?s:new i(a,{pub:s})},i.fromSecret=function(a,s){return s instanceof i?s:new i(a,{secret:s})},i.prototype.secret=function(){return this._secret},n(i,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(i,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(i,"privBytes",function(){var a=this.eddsa,s=this.hash(),o=a.encodingLength-1,u=s.slice(0,a.encodingLength);return u[0]&=248,u[o]&=127,u[o]|=64,u}),n(i,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(i,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(i,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),i.prototype.sign=function(a){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)},i.prototype.verify=function(a,s){return this.eddsa.verify(a,s,this)},i.prototype.getSecret=function(a){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),a)},i.prototype.getPublic=function(a){return t.encode(this.pubBytes(),a)},sb=i,sb}var ob,CA;function w3e(){if(CA)return ob;CA=1;var t=ei(),e=pa(),r=e.assert,n=e.cachedProperty,i=e.parseBytes;function a(s,o){this.eddsa=s,typeof o!="object"&&(o=i(o)),Array.isArray(o)&&(r(o.length===s.encodingLength*2,"Signature has invalid size"),o={R:o.slice(0,s.encodingLength),S:o.slice(s.encodingLength)}),r(o.R&&o.S,"Signature without R or S"),s.isPoint(o.R)&&(this._R=o.R),o.S instanceof t&&(this._S=o.S),this._Rencoded=Array.isArray(o.R)?o.R:o.Rencoded,this._Sencoded=Array.isArray(o.S)?o.S:o.Sencoded}return n(a,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(a,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(a,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(a,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),a.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},a.prototype.toHex=function(){return e.encode(this.toBytes(),"hex").toUpperCase()},ob=a,ob}var ub,OA;function _3e(){if(OA)return ub;OA=1;var t=hE(),e=pE(),r=pa(),n=r.assert,i=r.parseBytes,a=b3e(),s=w3e();function o(u){if(n(u==="ed25519","only tested with ed25519 so far"),!(this instanceof o))return new o(u);u=e[u].curve,this.curve=u,this.g=u.g,this.g.precompute(u.n.bitLength()+1),this.pointClass=u.point().constructor,this.encodingLength=Math.ceil(u.n.bitLength()/8),this.hash=t.sha512}return ub=o,o.prototype.sign=function(u,c){u=i(u);var l=this.keyFromSecret(c),d=this.hashInt(l.messagePrefix(),u),f=this.g.mul(d),h=this.encodePoint(f),p=this.hashInt(h,l.pubBytes(),u).mul(l.priv()),m=d.add(p).umod(this.curve.n);return this.makeSignature({R:f,S:m,Rencoded:h})},o.prototype.verify=function(u,c,l){if(u=i(u),c=this.makeSignature(c),c.S().gte(c.eddsa.curve.n)||c.S().isNeg())return!1;var d=this.keyFromPublic(l),f=this.hashInt(c.Rencoded(),d.pubBytes(),u),h=this.g.mul(c.S()),p=c.R().add(d.pub().mul(f));return p.eq(h)},o.prototype.hashInt=function(){for(var u=this.hash(),c=0;c<arguments.length;c++)u.update(arguments[c]);return r.intFromLE(u.digest()).umod(this.curve.n)},o.prototype.keyFromPublic=function(u){return a.fromPublic(this,u)},o.prototype.keyFromSecret=function(u){return a.fromSecret(this,u)},o.prototype.makeSignature=function(u){return u instanceof s?u:new s(this,u)},o.prototype.encodePoint=function(u){var c=u.getY().toArray("le",this.encodingLength);return c[this.encodingLength-1]|=u.getX().isOdd()?128:0,c},o.prototype.decodePoint=function(u){u=r.parseBytes(u);var c=u.length-1,l=u.slice(0,c).concat(u[c]&-129),d=(u[c]&128)!==0,f=r.intFromLE(l);return this.curve.pointFromY(f,d)},o.prototype.encodeInt=function(u){return u.toArray("le",this.encodingLength)},o.prototype.decodeInt=function(u){return r.intFromLE(u)},o.prototype.isPoint=function(u){return u instanceof this.pointClass},ub}var MA;function mE(){return MA||(MA=1,function(t){var e=t;e.version=i3e.version,e.utils=pa(),e.rand=lE(),e.curve=ZL(),e.curves=pE(),e.ec=v3e(),e.eddsa=_3e()}(GD)),GD}var ra={},kA={},RA={},FA;function x3e(){return FA||(FA=1,function(t){var e=gp(),r=gr(),n=t;n.define=function(a,s){return new i(a,s)};function i(a,s){this.name=a,this.body=s,this.decoders={},this.encoders={}}i.prototype._createNamed=function(a){var s;try{s=gc.runInThisContext("(function "+this.name+`(entity) {
1110
+ Use Chrome, Firefox or Internet Explorer 11`)}var n=ur().Buffer,i=qr.crypto||qr.msCrypto;i&&i.getRandomValues?dm.exports=a:dm.exports=r;function a(s,o){if(s>e)throw new RangeError("requested too many random bytes");var u=n.allocUnsafe(s);if(s>0)if(s>t)for(var c=0;c<s;c+=t)i.getRandomValues(u.slice(c,c+t));else i.getRandomValues(u);return typeof o=="function"?process.nextTick(function(){o(null,u)}):u}return dm.exports}var $1={exports:{}},_5;function gr(){return _5||(_5=1,typeof Object.create=="function"?$1.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:$1.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),$1.exports}const UEe={},zEe=Object.freeze(Object.defineProperty({__proto__:null,default:UEe},Symbol.toStringTag,{value:"Module"})),gc=Age(zEe);var U1,x5;function bL(){if(x5)return U1;x5=1;var t=ur().Buffer,e=gc.Transform,r=gr();function n(o){e.call(this),this._block=t.allocUnsafe(o),this._blockSize=o,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(n,e),n.prototype._transform=function(o,u,c){var l=null;try{this.update(o,u)}catch(d){l=d}c(l)},n.prototype._flush=function(o){var u=null;try{this.push(this.digest())}catch(c){u=c}o(u)};var i=typeof Uint8Array<"u",a=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);function s(o,u){if(o instanceof t)return o;if(typeof o=="string")return t.from(o,u);if(a&&ArrayBuffer.isView(o)){if(o.byteLength===0)return t.alloc(0);var c=t.from(o.buffer,o.byteOffset,o.byteLength);if(c.byteLength===o.byteLength)return c}if(i&&o instanceof Uint8Array||t.isBuffer(o)&&o.constructor&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o))return t.from(o);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return n.prototype.update=function(o,u){if(this._finalized)throw new Error("Digest already called");o=s(o,u);for(var c=this._block,l=0;this._blockOffset+o.length-l>=this._blockSize;){for(var d=this._blockOffset;d<this._blockSize;)c[d++]=o[l++];this._update(),this._blockOffset=0}for(;l<o.length;)c[this._blockOffset++]=o[l++];for(var f=0,h=o.length*8;h>0;++f)this._length[f]+=h,h=this._length[f]/4294967296|0,h>0&&(this._length[f]-=4294967296*h);return this},n.prototype._update=function(){throw new Error("_update is not implemented")},n.prototype.digest=function(o){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var u=this._digest();o!==void 0&&(u=u.toString(o)),this._block.fill(0),this._blockOffset=0;for(var c=0;c<4;++c)this._length[c]=0;return u},n.prototype._digest=function(){throw new Error("_digest is not implemented")},U1=n,U1}var z1,E5;function iE(){if(E5)return z1;E5=1;var t=gr(),e=bL(),r=ur().Buffer,n=new Array(16);function i(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}t(i,e),i.prototype._update=function(){for(var l=n,d=0;d<16;++d)l[d]=this._block.readInt32LE(d*4);var f=this._a,h=this._b,p=this._c,m=this._d;f=s(f,h,p,m,l[0],3614090360,7),m=s(m,f,h,p,l[1],3905402710,12),p=s(p,m,f,h,l[2],606105819,17),h=s(h,p,m,f,l[3],3250441966,22),f=s(f,h,p,m,l[4],4118548399,7),m=s(m,f,h,p,l[5],1200080426,12),p=s(p,m,f,h,l[6],2821735955,17),h=s(h,p,m,f,l[7],4249261313,22),f=s(f,h,p,m,l[8],1770035416,7),m=s(m,f,h,p,l[9],2336552879,12),p=s(p,m,f,h,l[10],4294925233,17),h=s(h,p,m,f,l[11],2304563134,22),f=s(f,h,p,m,l[12],1804603682,7),m=s(m,f,h,p,l[13],4254626195,12),p=s(p,m,f,h,l[14],2792965006,17),h=s(h,p,m,f,l[15],1236535329,22),f=o(f,h,p,m,l[1],4129170786,5),m=o(m,f,h,p,l[6],3225465664,9),p=o(p,m,f,h,l[11],643717713,14),h=o(h,p,m,f,l[0],3921069994,20),f=o(f,h,p,m,l[5],3593408605,5),m=o(m,f,h,p,l[10],38016083,9),p=o(p,m,f,h,l[15],3634488961,14),h=o(h,p,m,f,l[4],3889429448,20),f=o(f,h,p,m,l[9],568446438,5),m=o(m,f,h,p,l[14],3275163606,9),p=o(p,m,f,h,l[3],4107603335,14),h=o(h,p,m,f,l[8],1163531501,20),f=o(f,h,p,m,l[13],2850285829,5),m=o(m,f,h,p,l[2],4243563512,9),p=o(p,m,f,h,l[7],1735328473,14),h=o(h,p,m,f,l[12],2368359562,20),f=u(f,h,p,m,l[5],4294588738,4),m=u(m,f,h,p,l[8],2272392833,11),p=u(p,m,f,h,l[11],1839030562,16),h=u(h,p,m,f,l[14],4259657740,23),f=u(f,h,p,m,l[1],2763975236,4),m=u(m,f,h,p,l[4],1272893353,11),p=u(p,m,f,h,l[7],4139469664,16),h=u(h,p,m,f,l[10],3200236656,23),f=u(f,h,p,m,l[13],681279174,4),m=u(m,f,h,p,l[0],3936430074,11),p=u(p,m,f,h,l[3],3572445317,16),h=u(h,p,m,f,l[6],76029189,23),f=u(f,h,p,m,l[9],3654602809,4),m=u(m,f,h,p,l[12],3873151461,11),p=u(p,m,f,h,l[15],530742520,16),h=u(h,p,m,f,l[2],3299628645,23),f=c(f,h,p,m,l[0],4096336452,6),m=c(m,f,h,p,l[7],1126891415,10),p=c(p,m,f,h,l[14],2878612391,15),h=c(h,p,m,f,l[5],4237533241,21),f=c(f,h,p,m,l[12],1700485571,6),m=c(m,f,h,p,l[3],2399980690,10),p=c(p,m,f,h,l[10],4293915773,15),h=c(h,p,m,f,l[1],2240044497,21),f=c(f,h,p,m,l[8],1873313359,6),m=c(m,f,h,p,l[15],4264355552,10),p=c(p,m,f,h,l[6],2734768916,15),h=c(h,p,m,f,l[13],1309151649,21),f=c(f,h,p,m,l[4],4149444226,6),m=c(m,f,h,p,l[11],3174756917,10),p=c(p,m,f,h,l[2],718787259,15),h=c(h,p,m,f,l[9],3951481745,21),this._a=this._a+f|0,this._b=this._b+h|0,this._c=this._c+p|0,this._d=this._d+m|0},i.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var l=r.allocUnsafe(16);return l.writeInt32LE(this._a,0),l.writeInt32LE(this._b,4),l.writeInt32LE(this._c,8),l.writeInt32LE(this._d,12),l};function a(l,d){return l<<d|l>>>32-d}function s(l,d,f,h,p,m,y){return a(l+(d&f|~d&h)+p+m|0,y)+d|0}function o(l,d,f,h,p,m,y){return a(l+(d&h|f&~h)+p+m|0,y)+d|0}function u(l,d,f,h,p,m,y){return a(l+(d^f^h)+p+m|0,y)+d|0}function c(l,d,f,h,p,m,y){return a(l+(f^(d|~h))+p+m|0,y)+d|0}return z1=i,z1}var q1,S5;function aE(){if(S5)return q1;S5=1;var t=mc().Buffer,e=gr(),r=bL(),n=new Array(16),i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],a=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],o=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],u=[0,1518500249,1859775393,2400959708,2840853838],c=[1352829926,1548603684,1836072691,2053994217,0];function l(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}e(l,r),l.prototype._update=function(){for(var g=n,v=0;v<16;++v)g[v]=this._block.readInt32LE(v*4);for(var w=this._a|0,x=this._b|0,_=this._c|0,A=this._d|0,M=this._e|0,F=this._a|0,k=this._b|0,$=this._c|0,T=this._d|0,N=this._e|0,b=0;b<80;b+=1){var E,D;b<16?(E=f(w,x,_,A,M,g[i[b]],u[0],s[b]),D=y(F,k,$,T,N,g[a[b]],c[0],o[b])):b<32?(E=h(w,x,_,A,M,g[i[b]],u[1],s[b]),D=m(F,k,$,T,N,g[a[b]],c[1],o[b])):b<48?(E=p(w,x,_,A,M,g[i[b]],u[2],s[b]),D=p(F,k,$,T,N,g[a[b]],c[2],o[b])):b<64?(E=m(w,x,_,A,M,g[i[b]],u[3],s[b]),D=h(F,k,$,T,N,g[a[b]],c[3],o[b])):(E=y(w,x,_,A,M,g[i[b]],u[4],s[b]),D=f(F,k,$,T,N,g[a[b]],c[4],o[b])),w=M,M=A,A=d(_,10),_=x,x=E,F=N,N=T,T=d($,10),$=k,k=D}var C=this._b+_+T|0;this._b=this._c+A+N|0,this._c=this._d+M+F|0,this._d=this._e+w+k|0,this._e=this._a+x+$|0,this._a=C},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var g=t.alloc?t.alloc(20):new t(20);return g.writeInt32LE(this._a,0),g.writeInt32LE(this._b,4),g.writeInt32LE(this._c,8),g.writeInt32LE(this._d,12),g.writeInt32LE(this._e,16),g};function d(g,v){return g<<v|g>>>32-v}function f(g,v,w,x,_,A,M,F){return d(g+(v^w^x)+A+M|0,F)+_|0}function h(g,v,w,x,_,A,M,F){return d(g+(v&w|~v&x)+A+M|0,F)+_|0}function p(g,v,w,x,_,A,M,F){return d(g+((v|~w)^x)+A+M|0,F)+_|0}function m(g,v,w,x,_,A,M,F){return d(g+(v&x|w&~x)+A+M|0,F)+_|0}function y(g,v,w,x,_,A,M,F){return d(g+(v^(w|~x))+A+M|0,F)+_|0}return q1=l,q1}var V1={exports:{}},Z1,T5;function dd(){if(T5)return Z1;T5=1;var t=ur().Buffer;function e(r,n){this._block=t.alloc(r),this._finalSize=n,this._blockSize=r,this._len=0}return e.prototype.update=function(r,n){typeof r=="string"&&(n=n||"utf8",r=t.from(r,n));for(var i=this._block,a=this._blockSize,s=r.length,o=this._len,u=0;u<s;){for(var c=o%a,l=Math.min(s-u,a-c),d=0;d<l;d++)i[c+d]=r[u+d];o+=l,u+=l,o%a===0&&this._update(i)}return this._len+=s,this},e.prototype.digest=function(r){var n=this._len%this._blockSize;this._block[n]=128,this._block.fill(0,n+1),n>=this._finalSize&&(this._update(this._block),this._block.fill(0));var i=this._len*8;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var a=(i&4294967295)>>>0,s=(i-a)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return r?o.toString(r):o},e.prototype._update=function(){throw new Error("_update must be implemented by subclass")},Z1=e,Z1}var H1,D5;function qEe(){if(D5)return H1;D5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(c){return c<<5|c>>>27}function o(c){return c<<30|c>>>2}function u(c,l,d,f){return c===0?l&d|~l&f:c===2?l&d|l&f|d&f:l^d^f}return a.prototype._update=function(c){for(var l=this._w,d=this._a|0,f=this._b|0,h=this._c|0,p=this._d|0,m=this._e|0,y=0;y<16;++y)l[y]=c.readInt32BE(y*4);for(;y<80;++y)l[y]=l[y-3]^l[y-8]^l[y-14]^l[y-16];for(var g=0;g<80;++g){var v=~~(g/20),w=s(d)+u(v,f,h,p)+m+l[g]+n[v]|0;m=p,p=h,h=o(f),f=d,d=w}this._a=d+this._a|0,this._b=f+this._b|0,this._c=h+this._c|0,this._d=p+this._d|0,this._e=m+this._e|0},a.prototype._hash=function(){var c=r.allocUnsafe(20);return c.writeInt32BE(this._a|0,0),c.writeInt32BE(this._b|0,4),c.writeInt32BE(this._c|0,8),c.writeInt32BE(this._d|0,12),c.writeInt32BE(this._e|0,16),c},H1=a,H1}var W1,A5;function VEe(){if(A5)return W1;A5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(l){return l<<1|l>>>31}function o(l){return l<<5|l>>>27}function u(l){return l<<30|l>>>2}function c(l,d,f,h){return l===0?d&f|~d&h:l===2?d&f|d&h|f&h:d^f^h}return a.prototype._update=function(l){for(var d=this._w,f=this._a|0,h=this._b|0,p=this._c|0,m=this._d|0,y=this._e|0,g=0;g<16;++g)d[g]=l.readInt32BE(g*4);for(;g<80;++g)d[g]=s(d[g-3]^d[g-8]^d[g-14]^d[g-16]);for(var v=0;v<80;++v){var w=~~(v/20),x=o(f)+c(w,h,p,m)+y+d[v]+n[w]|0;y=m,m=p,p=u(h),h=f,f=x}this._a=f+this._a|0,this._b=h+this._b|0,this._c=p+this._c|0,this._d=m+this._d|0,this._e=y+this._e|0},a.prototype._hash=function(){var l=r.allocUnsafe(20);return l.writeInt32BE(this._a|0,0),l.writeInt32BE(this._b|0,4),l.writeInt32BE(this._c|0,8),l.writeInt32BE(this._d|0,12),l.writeInt32BE(this._e|0,16),l},W1=a,W1}var Y1,N5;function wL(){if(N5)return Y1;N5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],i=new Array(64);function a(){this.init(),this._w=i,e.call(this,64,56)}t(a,e),a.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function s(f,h,p){return p^f&(h^p)}function o(f,h,p){return f&h|p&(f|h)}function u(f){return(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10)}function c(f){return(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7)}function l(f){return(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3}function d(f){return(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10}return a.prototype._update=function(f){for(var h=this._w,p=this._a|0,m=this._b|0,y=this._c|0,g=this._d|0,v=this._e|0,w=this._f|0,x=this._g|0,_=this._h|0,A=0;A<16;++A)h[A]=f.readInt32BE(A*4);for(;A<64;++A)h[A]=d(h[A-2])+h[A-7]+l(h[A-15])+h[A-16]|0;for(var M=0;M<64;++M){var F=_+c(v)+s(v,w,x)+n[M]+h[M]|0,k=u(p)+o(p,m,y)|0;_=x,x=w,w=v,v=g+F|0,g=y,y=m,m=p,p=F+k|0}this._a=p+this._a|0,this._b=m+this._b|0,this._c=y+this._c|0,this._d=g+this._d|0,this._e=v+this._e|0,this._f=w+this._f|0,this._g=x+this._g|0,this._h=_+this._h|0},a.prototype._hash=function(){var f=r.allocUnsafe(32);return f.writeInt32BE(this._a,0),f.writeInt32BE(this._b,4),f.writeInt32BE(this._c,8),f.writeInt32BE(this._d,12),f.writeInt32BE(this._e,16),f.writeInt32BE(this._f,20),f.writeInt32BE(this._g,24),f.writeInt32BE(this._h,28),f},Y1=a,Y1}var J1,I5;function ZEe(){if(I5)return J1;I5=1;var t=gr(),e=wL(),r=dd(),n=ur().Buffer,i=new Array(64);function a(){this.init(),this._w=i,r.call(this,64,56)}return t(a,e),a.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},a.prototype._hash=function(){var s=n.allocUnsafe(28);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s},J1=a,J1}var K1,C5;function _L(){if(C5)return K1;C5=1;var t=gr(),e=dd(),r=ur().Buffer,n=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],i=new Array(160);function a(){this.init(),this._w=i,e.call(this,128,112)}t(a,e),a.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function s(m,y,g){return g^m&(y^g)}function o(m,y,g){return m&y|g&(m|y)}function u(m,y){return(m>>>28|y<<4)^(y>>>2|m<<30)^(y>>>7|m<<25)}function c(m,y){return(m>>>14|y<<18)^(m>>>18|y<<14)^(y>>>9|m<<23)}function l(m,y){return(m>>>1|y<<31)^(m>>>8|y<<24)^m>>>7}function d(m,y){return(m>>>1|y<<31)^(m>>>8|y<<24)^(m>>>7|y<<25)}function f(m,y){return(m>>>19|y<<13)^(y>>>29|m<<3)^m>>>6}function h(m,y){return(m>>>19|y<<13)^(y>>>29|m<<3)^(m>>>6|y<<26)}function p(m,y){return m>>>0<y>>>0?1:0}return a.prototype._update=function(m){for(var y=this._w,g=this._ah|0,v=this._bh|0,w=this._ch|0,x=this._dh|0,_=this._eh|0,A=this._fh|0,M=this._gh|0,F=this._hh|0,k=this._al|0,$=this._bl|0,T=this._cl|0,N=this._dl|0,b=this._el|0,E=this._fl|0,D=this._gl|0,C=this._hl|0,I=0;I<32;I+=2)y[I]=m.readInt32BE(I*4),y[I+1]=m.readInt32BE(I*4+4);for(;I<160;I+=2){var O=y[I-30],S=y[I-15*2+1],P=l(O,S),R=d(S,O);O=y[I-2*2],S=y[I-2*2+1];var L=f(O,S),q=h(S,O),J=y[I-7*2],G=y[I-7*2+1],ie=y[I-16*2],z=y[I-16*2+1],V=R+G|0,Q=P+J+p(V,R)|0;V=V+q|0,Q=Q+L+p(V,q)|0,V=V+z|0,Q=Q+ie+p(V,z)|0,y[I]=Q,y[I+1]=V}for(var ae=0;ae<160;ae+=2){Q=y[ae],V=y[ae+1];var oe=o(g,v,w),le=o(k,$,T),he=u(g,k),Z=u(k,g),K=c(_,b),B=c(b,_),j=n[ae],U=n[ae+1],W=s(_,A,M),ee=s(b,E,D),te=C+B|0,ne=F+K+p(te,C)|0;te=te+ee|0,ne=ne+W+p(te,ee)|0,te=te+U|0,ne=ne+j+p(te,U)|0,te=te+V|0,ne=ne+Q+p(te,V)|0;var Y=Z+le|0,re=he+oe+p(Y,Z)|0;F=M,C=D,M=A,D=E,A=_,E=b,b=N+te|0,_=x+ne+p(b,N)|0,x=w,N=T,w=v,T=$,v=g,$=k,k=te+Y|0,g=ne+re+p(k,te)|0}this._al=this._al+k|0,this._bl=this._bl+$|0,this._cl=this._cl+T|0,this._dl=this._dl+N|0,this._el=this._el+b|0,this._fl=this._fl+E|0,this._gl=this._gl+D|0,this._hl=this._hl+C|0,this._ah=this._ah+g+p(this._al,k)|0,this._bh=this._bh+v+p(this._bl,$)|0,this._ch=this._ch+w+p(this._cl,T)|0,this._dh=this._dh+x+p(this._dl,N)|0,this._eh=this._eh+_+p(this._el,b)|0,this._fh=this._fh+A+p(this._fl,E)|0,this._gh=this._gh+M+p(this._gl,D)|0,this._hh=this._hh+F+p(this._hl,C)|0},a.prototype._hash=function(){var m=r.allocUnsafe(64);function y(g,v,w){m.writeInt32BE(g,w),m.writeInt32BE(v,w+4)}return y(this._ah,this._al,0),y(this._bh,this._bl,8),y(this._ch,this._cl,16),y(this._dh,this._dl,24),y(this._eh,this._el,32),y(this._fh,this._fl,40),y(this._gh,this._gl,48),y(this._hh,this._hl,56),m},K1=a,K1}var G1,O5;function HEe(){if(O5)return G1;O5=1;var t=gr(),e=_L(),r=dd(),n=ur().Buffer,i=new Array(160);function a(){this.init(),this._w=i,r.call(this,128,112)}return t(a,e),a.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},a.prototype._hash=function(){var s=n.allocUnsafe(48);function o(u,c,l){s.writeInt32BE(u,l),s.writeInt32BE(c,l+4)}return o(this._ah,this._al,0),o(this._bh,this._bl,8),o(this._ch,this._cl,16),o(this._dh,this._dl,24),o(this._eh,this._el,32),o(this._fh,this._fl,40),s},G1=a,G1}var M5;function sE(){if(M5)return V1.exports;M5=1;var t=V1.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};return t.sha=qEe(),t.sha1=VEe(),t.sha224=ZEe(),t.sha256=wL(),t.sha384=HEe(),t.sha512=_L(),V1.exports}var X1={},k5;function WEe(){if(k5)return X1;k5=1;var t=ur().Buffer,e=t.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(g){if(!g)return"utf8";for(var v;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(v)return;g=(""+g).toLowerCase(),v=!0}}function n(g){var v=r(g);if(typeof v!="string"&&(t.isEncoding===e||!e(g)))throw new Error("Unknown encoding: "+g);return v||g}X1.StringDecoder=i;function i(g){this.encoding=n(g);var v;switch(this.encoding){case"utf16le":this.text=d,this.end=f,v=4;break;case"utf8":this.fillLast=u,v=4;break;case"base64":this.text=h,this.end=p,v=3;break;default:this.write=m,this.end=y;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}i.prototype.write=function(g){if(g.length===0)return"";var v,w;if(this.lastNeed){if(v=this.fillLast(g),v===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?v?v+this.text(g,w):this.text(g,w):v||""},i.prototype.end=l,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function a(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,v,w){var x=v.length-1;if(x<w)return 0;var _=a(v[x]);return _>=0?(_>0&&(g.lastNeed=_-1),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(g.lastNeed=_-2),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(_===2?_=0:g.lastNeed=_-3),_):0))}function o(g,v,w){if((v[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return g.lastNeed=2,"�"}}function u(g){var v=this.lastTotal-this.lastNeed,w=o(this,g);if(w!==void 0)return w;if(this.lastNeed<=g.length)return g.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,v,0,g.length),this.lastNeed-=g.length}function c(g,v){var w=s(this,g,v);if(!this.lastNeed)return g.toString("utf8",v);this.lastTotal=w;var x=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,x),g.toString("utf8",v,x)}function l(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+"�":v}function d(g,v){if((g.length-v)%2===0){var w=g.toString("utf16le",v);if(w){var x=w.charCodeAt(w.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",v,g.length-1)}function f(g){var v=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,w)}return v}function h(g,v){var w=(g.length-v)%3;return w===0?g.toString("base64",v):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",v,g.length-w))}function p(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function m(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}return X1}var Q1,R5;function au(){if(R5)return Q1;R5=1;var t=ur().Buffer,e=gc.Transform,r=WEe().StringDecoder,n=gr();function i(u){e.call(this),this.hashMode=typeof u=="string",this.hashMode?this[u]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(i,e);var a=typeof Uint8Array<"u",s=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);function o(u,c){if(u instanceof t)return u;if(typeof u=="string")return t.from(u,c);if(s&&ArrayBuffer.isView(u)){if(u.byteLength===0)return t.alloc(0);var l=t.from(u.buffer,u.byteOffset,u.byteLength);if(l.byteLength===u.byteLength)return l}if(a&&u instanceof Uint8Array||t.isBuffer(u)&&u.constructor&&typeof u.constructor.isBuffer=="function"&&u.constructor.isBuffer(u))return t.from(u);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return i.prototype.update=function(u,c,l){var d=o(u,c),f=this._update(d);return this.hashMode?this:(l&&(f=this._toString(f,l)),f)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(u,c,l){var d;try{this.hashMode?this._update(u):this.push(this._update(u))}catch(f){d=f}finally{l(d)}},i.prototype._flush=function(u){var c;try{this.push(this.__final())}catch(l){c=l}u(c)},i.prototype._finalOrDigest=function(u){var c=this.__final()||t.alloc(0);return u&&(c=this._toString(c,u,!0)),c},i.prototype._toString=function(u,c,l){if(this._decoder||(this._decoder=new r(c),this._encoding=c),this._encoding!==c)throw new Error("can’t switch encodings");var d=this._decoder.write(u);return l&&(d+=this._decoder.end()),d},Q1=i,Q1}var ev,F5;function fp(){if(F5)return ev;F5=1;var t=gr(),e=iE(),r=aE(),n=sE(),i=au();function a(s){i.call(this,"digest"),this._hash=s}return t(a,i),a.prototype._update=function(s){this._hash.update(s)},a.prototype._final=function(){return this._hash.digest()},ev=function(s){return s=s.toLowerCase(),s==="md5"?new e:s==="rmd160"||s==="ripemd160"?new r:new a(n(s))},ev}var tv,P5;function YEe(){if(P5)return tv;P5=1;var t=gr(),e=ur().Buffer,r=au(),n=e.alloc(128),i=64;function a(s,o){r.call(this,"digest"),typeof o=="string"&&(o=e.from(o)),this._alg=s,this._key=o,o.length>i?o=s(o):o.length<i&&(o=e.concat([o,n],i));for(var u=this._ipad=e.allocUnsafe(i),c=this._opad=e.allocUnsafe(i),l=0;l<i;l++)u[l]=o[l]^54,c[l]=o[l]^92;this._hash=[u]}return t(a,r),a.prototype._update=function(s){this._hash.push(s)},a.prototype._final=function(){var s=this._alg(e.concat(this._hash));return this._alg(e.concat([this._opad,s]))},tv=a,tv}var rv,B5;function xL(){if(B5)return rv;B5=1;var t=iE();return rv=function(e){return new t().update(e).digest()},rv}var nv,L5;function EL(){if(L5)return nv;L5=1;var t=gr(),e=YEe(),r=au(),n=ur().Buffer,i=xL(),a=aE(),s=sE(),o=n.alloc(128);function u(c,l){r.call(this,"digest"),typeof l=="string"&&(l=n.from(l));var d=c==="sha512"||c==="sha384"?128:64;if(this._alg=c,this._key=l,l.length>d){var f=c==="rmd160"?new a:s(c);l=f.update(l).digest()}else l.length<d&&(l=n.concat([l,o],d));for(var h=this._ipad=n.allocUnsafe(d),p=this._opad=n.allocUnsafe(d),m=0;m<d;m++)h[m]=l[m]^54,p[m]=l[m]^92;this._hash=c==="rmd160"?new a:s(c),this._hash.update(h)}return t(u,r),u.prototype._update=function(c){this._hash.update(c)},u.prototype._final=function(){var c=this._hash.digest(),l=this._alg==="rmd160"?new a:s(this._alg);return l.update(this._opad).update(c).digest()},nv=function(c,l){return c=c.toLowerCase(),c==="rmd160"||c==="ripemd160"?new u("rmd160",l):c==="md5"?new e(i,l):new u(c,l)},nv}const JEe={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},KEe={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},GEe={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},XEe={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},QEe={sign:"ecdsa",hash:"sha256",id:""},eSe={sign:"ecdsa",hash:"sha224",id:""},tSe={sign:"ecdsa",hash:"sha384",id:""},rSe={sign:"ecdsa",hash:"sha512",id:""},nSe={sign:"dsa",hash:"sha1",id:""},iSe={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},aSe={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},SL={sha224WithRSAEncryption:JEe,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:KEe,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:GEe,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:XEe,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:QEe,sha224:eSe,sha384:tSe,sha512:rSe,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:nSe,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:iSe,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:aSe,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var j5,$5;function sSe(){return $5||($5=1,j5=SL),j5}var iv={},av,U5;function TL(){if(U5)return av;U5=1;var t=Math.pow(2,30)-1;return av=function(e,r){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if(typeof r!="number")throw new TypeError("Key length not a number");if(r<0||r>t||r!==r)throw new TypeError("Bad key length")},av}var sv,z5;function DL(){if(z5)return sv;z5=1;var t;if(qr.process&&qr.process.browser)t="utf-8";else if(qr.process&&qr.process.version){var e=parseInt(process.version.split(".")[0].slice(1),10);t=e>=6?"utf-8":"binary"}else t="utf-8";return sv=t,sv}var ov,q5;function AL(){if(q5)return ov;q5=1;var t=ur().Buffer;return ov=function(e,r,n){if(t.isBuffer(e))return e;if(typeof e=="string")return t.from(e,r);if(ArrayBuffer.isView(e))return t.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},ov}var uv,V5;function NL(){if(V5)return uv;V5=1;var t=xL(),e=aE(),r=sE(),n=ur().Buffer,i=TL(),a=DL(),s=AL(),o=n.alloc(128),u={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(f,h,p){var m=l(f),y=f==="sha512"||f==="sha384"?128:64;h.length>y?h=m(h):h.length<y&&(h=n.concat([h,o],y));for(var g=n.allocUnsafe(y+u[f]),v=n.allocUnsafe(y+u[f]),w=0;w<y;w++)g[w]=h[w]^54,v[w]=h[w]^92;var x=n.allocUnsafe(y+p+4);g.copy(x,0,0,y),this.ipad1=x,this.ipad2=g,this.opad=v,this.alg=f,this.blocksize=y,this.hash=m,this.size=u[f]}c.prototype.run=function(f,h){f.copy(h,this.blocksize);var p=this.hash(h);return p.copy(this.opad,this.blocksize),this.hash(this.opad)};function l(f){function h(m){return r(f).update(m).digest()}function p(m){return new e().update(m).digest()}return f==="rmd160"||f==="ripemd160"?p:f==="md5"?t:h}function d(f,h,p,m,y){i(p,m),f=s(f,a,"Password"),h=s(h,a,"Salt"),y=y||"sha1";var g=new c(y,f,h.length),v=n.allocUnsafe(m),w=n.allocUnsafe(h.length+4);h.copy(w,0,0,h.length);for(var x=0,_=u[y],A=Math.ceil(m/_),M=1;M<=A;M++){w.writeUInt32BE(M,h.length);for(var F=g.run(w,g.ipad1),k=F,$=1;$<p;$++){k=g.run(k,g.ipad2);for(var T=0;T<_;T++)F[T]^=k[T]}F.copy(v,x),x+=_}return v}return uv=d,uv}var cv,Z5;function oSe(){if(Z5)return cv;Z5=1;var t=ur().Buffer,e=TL(),r=DL(),n=NL(),i=AL(),a,s=qr.crypto&&qr.crypto.subtle,o={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},u=[];function c(p){if(qr.process&&!qr.process.browser||!s||!s.importKey||!s.deriveBits)return Promise.resolve(!1);if(u[p]!==void 0)return u[p];a=a||t.alloc(8);var m=f(a,a,10,128,p).then(function(){return!0}).catch(function(){return!1});return u[p]=m,m}var l;function d(){return l||(qr.process&&qr.process.nextTick?l=qr.process.nextTick:qr.queueMicrotask?l=qr.queueMicrotask:qr.setImmediate?l=qr.setImmediate:l=qr.setTimeout,l)}function f(p,m,y,g,v){return s.importKey("raw",p,{name:"PBKDF2"},!1,["deriveBits"]).then(function(w){return s.deriveBits({name:"PBKDF2",salt:m,iterations:y,hash:{name:v}},w,g<<3)}).then(function(w){return t.from(w)})}function h(p,m){p.then(function(y){d()(function(){m(null,y)})},function(y){d()(function(){m(y)})})}return cv=function(p,m,y,g,v,w){typeof v=="function"&&(w=v,v=void 0),v=v||"sha1";var x=o[v.toLowerCase()];if(!x||typeof qr.Promise!="function"){d()(function(){var _;try{_=n(p,m,y,g,v)}catch(A){return w(A)}w(null,_)});return}if(e(y,g),p=i(p,r,"Password"),m=i(m,r,"Salt"),typeof w!="function")throw new Error("No callback provided to pbkdf2");h(c(x).then(function(_){return _?f(p,m,y,g,x):n(p,m,y,g,v)}),w)},cv}var H5;function IL(){return H5||(H5=1,iv.pbkdf2=oSe(),iv.pbkdf2Sync=NL()),iv}var ea={},Dc={},Ri={},W5;function CL(){if(W5)return Ri;W5=1,Ri.readUInt32BE=function(n,i){var a=n[0+i]<<24|n[1+i]<<16|n[2+i]<<8|n[3+i];return a>>>0},Ri.writeUInt32BE=function(n,i,a){n[0+a]=i>>>24,n[1+a]=i>>>16&255,n[2+a]=i>>>8&255,n[3+a]=i&255},Ri.ip=function(n,i,a,s){for(var o=0,u=0,c=6;c>=0;c-=2){for(var l=0;l<=24;l+=8)o<<=1,o|=i>>>l+c&1;for(var l=0;l<=24;l+=8)o<<=1,o|=n>>>l+c&1}for(var c=6;c>=0;c-=2){for(var l=1;l<=25;l+=8)u<<=1,u|=i>>>l+c&1;for(var l=1;l<=25;l+=8)u<<=1,u|=n>>>l+c&1}a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.rip=function(n,i,a,s){for(var o=0,u=0,c=0;c<4;c++)for(var l=24;l>=0;l-=8)o<<=1,o|=i>>>l+c&1,o<<=1,o|=n>>>l+c&1;for(var c=4;c<8;c++)for(var l=24;l>=0;l-=8)u<<=1,u|=i>>>l+c&1,u<<=1,u|=n>>>l+c&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.pc1=function(n,i,a,s){for(var o=0,u=0,c=7;c>=5;c--){for(var l=0;l<=24;l+=8)o<<=1,o|=i>>l+c&1;for(var l=0;l<=24;l+=8)o<<=1,o|=n>>l+c&1}for(var l=0;l<=24;l+=8)o<<=1,o|=i>>l+c&1;for(var c=1;c<=3;c++){for(var l=0;l<=24;l+=8)u<<=1,u|=i>>l+c&1;for(var l=0;l<=24;l+=8)u<<=1,u|=n>>l+c&1}for(var l=0;l<=24;l+=8)u<<=1,u|=n>>l+c&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.r28shl=function(n,i){return n<<i&268435455|n>>>28-i};var t=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Ri.pc2=function(n,i,a,s){for(var o=0,u=0,c=t.length>>>1,l=0;l<c;l++)o<<=1,o|=n>>>t[l]&1;for(var l=c;l<t.length;l++)u<<=1,u|=i>>>t[l]&1;a[s+0]=o>>>0,a[s+1]=u>>>0},Ri.expand=function(n,i,a){var s=0,o=0;s=(n&1)<<5|n>>>27;for(var u=23;u>=15;u-=4)s<<=6,s|=n>>>u&63;for(var u=11;u>=3;u-=4)o|=n>>>u&63,o<<=6;o|=(n&31)<<1|n>>>31,i[a+0]=s>>>0,i[a+1]=o>>>0};var e=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Ri.substitute=function(n,i){for(var a=0,s=0;s<4;s++){var o=n>>>18-s*6&63,u=e[s*64+o];a<<=4,a|=u}for(var s=0;s<4;s++){var o=i>>>18-s*6&63,u=e[4*64+s*64+o];a<<=4,a|=u}return a>>>0};var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return Ri.permute=function(n){for(var i=0,a=0;a<r.length;a++)i<<=1,i|=n>>>r[a]&1;return i>>>0},Ri.padSplit=function(n,i,a){for(var s=n.toString(2);s.length<i;)s="0"+s;for(var o=[],u=0;u<i;u+=a)o.push(s.slice(u,u+a));return o.join(" ")},Ri}var lv,Y5;function ha(){if(Y5)return lv;Y5=1,lv=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)},lv}var dv,J5;function oE(){if(J5)return dv;J5=1;var t=ha();function e(r){this.options=r,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=r.padding!==!1}return dv=e,e.prototype._init=function(){},e.prototype.update=function(r){return r.length===0?[]:this.type==="decrypt"?this._updateDecrypt(r):this._updateEncrypt(r)},e.prototype._buffer=function(r,n){for(var i=Math.min(this.buffer.length-this.bufferOff,r.length-n),a=0;a<i;a++)this.buffer[this.bufferOff+a]=r[n+a];return this.bufferOff+=i,i},e.prototype._flushBuffer=function(r,n){return this._update(this.buffer,0,r,n),this.bufferOff=0,this.blockSize},e.prototype._updateEncrypt=function(r){var n=0,i=0,a=(this.bufferOff+r.length)/this.blockSize|0,s=new Array(a*this.blockSize);this.bufferOff!==0&&(n+=this._buffer(r,n),this.bufferOff===this.buffer.length&&(i+=this._flushBuffer(s,i)));for(var o=r.length-(r.length-n)%this.blockSize;n<o;n+=this.blockSize)this._update(r,n,s,i),i+=this.blockSize;for(;n<r.length;n++,this.bufferOff++)this.buffer[this.bufferOff]=r[n];return s},e.prototype._updateDecrypt=function(r){for(var n=0,i=0,a=Math.ceil((this.bufferOff+r.length)/this.blockSize)-1,s=new Array(a*this.blockSize);a>0;a--)n+=this._buffer(r,n),i+=this._flushBuffer(s,i);return n+=this._buffer(r,n),s},e.prototype.final=function(r){var n;r&&(n=this.update(r));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),n?n.concat(i):i},e.prototype._pad=function(r,n){if(n===0)return!1;for(;n<r.length;)r[n++]=0;return!0},e.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var r=new Array(this.blockSize);return this._update(this.buffer,0,r,0),r},e.prototype._unpad=function(r){return r},e.prototype._finalDecrypt=function(){t.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var r=new Array(this.blockSize);return this._flushBuffer(r,0),this._unpad(r)},dv}var fv,K5;function OL(){if(K5)return fv;K5=1;var t=ha(),e=gr(),r=CL(),n=oE();function i(){this.tmp=new Array(2),this.keys=null}function a(o){n.call(this,o);var u=new i;this._desState=u,this.deriveKeys(u,o.key)}e(a,n),fv=a,a.create=function(o){return new a(o)};var s=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return a.prototype.deriveKeys=function(o,u){o.keys=new Array(16*2),t.equal(u.length,this.blockSize,"Invalid key length");var c=r.readUInt32BE(u,0),l=r.readUInt32BE(u,4);r.pc1(c,l,o.tmp,0),c=o.tmp[0],l=o.tmp[1];for(var d=0;d<o.keys.length;d+=2){var f=s[d>>>1];c=r.r28shl(c,f),l=r.r28shl(l,f),r.pc2(c,l,o.keys,d)}},a.prototype._update=function(o,u,c,l){var d=this._desState,f=r.readUInt32BE(o,u),h=r.readUInt32BE(o,u+4);r.ip(f,h,d.tmp,0),f=d.tmp[0],h=d.tmp[1],this.type==="encrypt"?this._encrypt(d,f,h,d.tmp,0):this._decrypt(d,f,h,d.tmp,0),f=d.tmp[0],h=d.tmp[1],r.writeUInt32BE(c,f,l),r.writeUInt32BE(c,h,l+4)},a.prototype._pad=function(o,u){if(this.padding===!1)return!1;for(var c=o.length-u,l=u;l<o.length;l++)o[l]=c;return!0},a.prototype._unpad=function(o){if(this.padding===!1)return o;for(var u=o[o.length-1],c=o.length-u;c<o.length;c++)t.equal(o[c],u);return o.slice(0,o.length-u)},a.prototype._encrypt=function(o,u,c,l,d){for(var f=u,h=c,p=0;p<o.keys.length;p+=2){var m=o.keys[p],y=o.keys[p+1];r.expand(h,o.tmp,0),m^=o.tmp[0],y^=o.tmp[1];var g=r.substitute(m,y),v=r.permute(g),w=h;h=(f^v)>>>0,f=w}r.rip(h,f,l,d)},a.prototype._decrypt=function(o,u,c,l,d){for(var f=c,h=u,p=o.keys.length-2;p>=0;p-=2){var m=o.keys[p],y=o.keys[p+1];r.expand(f,o.tmp,0),m^=o.tmp[0],y^=o.tmp[1];var g=r.substitute(m,y),v=r.permute(g),w=f;f=(h^v)>>>0,h=w}r.rip(f,h,l,d)},fv}var hv={},G5;function uSe(){if(G5)return hv;G5=1;var t=ha(),e=gr(),r={};function n(a){t.equal(a.length,8,"Invalid IV length"),this.iv=new Array(8);for(var s=0;s<this.iv.length;s++)this.iv[s]=a[s]}function i(a){function s(l){a.call(this,l),this._cbcInit()}e(s,a);for(var o=Object.keys(r),u=0;u<o.length;u++){var c=o[u];s.prototype[c]=r[c]}return s.create=function(l){return new s(l)},s}return hv.instantiate=i,r._cbcInit=function(){var a=new n(this.options.iv);this._cbcState=a},r._update=function(a,s,o,u){var c=this._cbcState,l=this.constructor.super_.prototype,d=c.iv;if(this.type==="encrypt"){for(var f=0;f<this.blockSize;f++)d[f]^=a[s+f];l._update.call(this,d,0,o,u);for(var f=0;f<this.blockSize;f++)d[f]=o[u+f]}else{l._update.call(this,a,s,o,u);for(var f=0;f<this.blockSize;f++)o[u+f]^=d[f];for(var f=0;f<this.blockSize;f++)d[f]=a[s+f]}},hv}var pv,X5;function cSe(){if(X5)return pv;X5=1;var t=ha(),e=gr(),r=oE(),n=OL();function i(s,o){t.equal(o.length,24,"Invalid key length");var u=o.slice(0,8),c=o.slice(8,16),l=o.slice(16,24);s==="encrypt"?this.ciphers=[n.create({type:"encrypt",key:u}),n.create({type:"decrypt",key:c}),n.create({type:"encrypt",key:l})]:this.ciphers=[n.create({type:"decrypt",key:l}),n.create({type:"encrypt",key:c}),n.create({type:"decrypt",key:u})]}function a(s){r.call(this,s);var o=new i(this.type,this.options.key);this._edeState=o}return e(a,r),pv=a,a.create=function(s){return new a(s)},a.prototype._update=function(s,o,u,c){var l=this._edeState;l.ciphers[0]._update(s,o,u,c),l.ciphers[1]._update(u,c,u,c),l.ciphers[2]._update(u,c,u,c)},a.prototype._pad=n.prototype._pad,a.prototype._unpad=n.prototype._unpad,pv}var Q5;function lSe(){return Q5||(Q5=1,Dc.utils=CL(),Dc.Cipher=oE(),Dc.DES=OL(),Dc.CBC=uSe(),Dc.EDE=cSe()),Dc}var mv,eD;function dSe(){if(eD)return mv;eD=1;var t=au(),e=lSe(),r=gr(),n=ur().Buffer,i={"des-ede3-cbc":e.CBC.instantiate(e.EDE),"des-ede3":e.EDE,"des-ede-cbc":e.CBC.instantiate(e.EDE),"des-ede":e.EDE,"des-cbc":e.CBC.instantiate(e.DES),"des-ecb":e.DES};i.des=i["des-cbc"],i.des3=i["des-ede3-cbc"],mv=a,r(a,t);function a(s){t.call(this);var o=s.mode.toLowerCase(),u=i[o],c;s.decrypt?c="decrypt":c="encrypt";var l=s.key;n.isBuffer(l)||(l=n.from(l)),(o==="des-ede"||o==="des-ede-cbc")&&(l=n.concat([l,l.slice(0,8)]));var d=s.iv;n.isBuffer(d)||(d=n.from(d)),this._des=u.create({key:l,iv:d,type:c})}return a.prototype._update=function(s){return n.from(this._des.update(s))},a.prototype._final=function(){return n.from(this._des.final())},mv}var ta={},fm={},gv={},tD;function fSe(){return tD||(tD=1,gv.encrypt=function(t,e){return t._cipher.encryptBlock(e)},gv.decrypt=function(t,e){return t._cipher.decryptBlock(e)}),gv}var hm={},rD,nD;function hp(){return nD||(nD=1,rD=function(t,e){for(var r=Math.min(t.length,e.length),n=new Buffer(r),i=0;i<r;++i)n[i]=t[i]^e[i];return n}),rD}var iD;function hSe(){if(iD)return hm;iD=1;var t=hp();return hm.encrypt=function(e,r){var n=t(r,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},hm.decrypt=function(e,r){var n=e._prev;e._prev=r;var i=e._cipher.decryptBlock(r);return t(i,n)},hm}var yv={},aD;function pSe(){if(aD)return yv;aD=1;var t=ur().Buffer,e=hp();function r(n,i,a){var s=i.length,o=e(i,n._cache);return n._cache=n._cache.slice(s),n._prev=t.concat([n._prev,a?i:o]),o}return yv.encrypt=function(n,i,a){for(var s=t.allocUnsafe(0),o;i.length;)if(n._cache.length===0&&(n._cache=n._cipher.encryptBlock(n._prev),n._prev=t.allocUnsafe(0)),n._cache.length<=i.length)o=n._cache.length,s=t.concat([s,r(n,i.slice(0,o),a)]),i=i.slice(o);else{s=t.concat([s,r(n,i,a)]);break}return s},yv}var vv={},sD;function mSe(){if(sD)return vv;sD=1;var t=ur().Buffer;function e(r,n,i){var a=r._cipher.encryptBlock(r._prev),s=a[0]^n;return r._prev=t.concat([r._prev.slice(1),t.from([i?n:s])]),s}return vv.encrypt=function(r,n,i){for(var a=n.length,s=t.allocUnsafe(a),o=-1;++o<a;)s[o]=e(r,n[o],i);return s},vv}var bv={},oD;function gSe(){if(oD)return bv;oD=1;var t=ur().Buffer;function e(n,i,a){for(var s,o=-1,u=8,c=0,l,d;++o<u;)s=n._cipher.encryptBlock(n._prev),l=i&1<<7-o?128:0,d=s[0]^l,c+=(d&128)>>o%8,n._prev=r(n._prev,a?l:d);return c}function r(n,i){var a=n.length,s=-1,o=t.allocUnsafe(n.length);for(n=t.concat([n,t.from([i])]);++s<a;)o[s]=n[s]<<1|n[s+1]>>7;return o}return bv.encrypt=function(n,i,a){for(var s=i.length,o=t.allocUnsafe(s),u=-1;++u<s;)o[u]=e(n,i[u],a);return o},bv}var wv={},uD;function ySe(){if(uD)return wv;uD=1;var t=hp();function e(r){return r._prev=r._cipher.encryptBlock(r._prev),r._prev}return wv.encrypt=function(r,n){for(;r._cache.length<n.length;)r._cache=Buffer.concat([r._cache,e(r)]);var i=r._cache.slice(0,n.length);return r._cache=r._cache.slice(n.length),t(n,i)},wv}var _v={},xv,cD;function ML(){if(cD)return xv;cD=1;function t(e){for(var r=e.length,n;r--;)if(n=e.readUInt8(r),n===255)e.writeUInt8(0,r);else{n++,e.writeUInt8(n,r);break}}return xv=t,xv}var lD;function dD(){if(lD)return _v;lD=1;var t=hp(),e=ur().Buffer,r=ML();function n(a){var s=a._cipher.encryptBlockRaw(a._prev);return r(a._prev),s}var i=16;return _v.encrypt=function(a,s){var o=Math.ceil(s.length/i),u=a._cache.length;a._cache=e.concat([a._cache,e.allocUnsafe(o*i)]);for(var c=0;c<o;c++){var l=n(a),d=u+c*i;a._cache.writeUInt32BE(l[0],d+0),a._cache.writeUInt32BE(l[1],d+4),a._cache.writeUInt32BE(l[2],d+8),a._cache.writeUInt32BE(l[3],d+12)}var f=a._cache.slice(0,s.length);return a._cache=a._cache.slice(s.length),t(s,f)},_v}const vSe={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},bSe={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},wSe={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},kL={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:vSe,aes192:bSe,aes256:wSe,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var Ev,fD;function uE(){if(fD)return Ev;fD=1;var t={ECB:fSe(),CBC:hSe(),CFB:pSe(),CFB8:mSe(),CFB1:gSe(),OFB:ySe(),CTR:dD(),GCM:dD()},e=kL;for(var r in e)e[r].module=t[e[r].mode];return Ev=e,Ev}var Sv={},hD;function Oy(){if(hD)return Sv;hD=1;var t=ur().Buffer;function e(o){t.isBuffer(o)||(o=t.from(o));for(var u=o.length/4|0,c=new Array(u),l=0;l<u;l++)c[l]=o.readUInt32BE(l*4);return c}function r(o){for(var u=0;u<o.length;o++)o[u]=0}function n(o,u,c,l,d){for(var f=c[0],h=c[1],p=c[2],m=c[3],y=o[0]^u[0],g=o[1]^u[1],v=o[2]^u[2],w=o[3]^u[3],x,_,A,M,F=4,k=1;k<d;k++)x=f[y>>>24]^h[g>>>16&255]^p[v>>>8&255]^m[w&255]^u[F++],_=f[g>>>24]^h[v>>>16&255]^p[w>>>8&255]^m[y&255]^u[F++],A=f[v>>>24]^h[w>>>16&255]^p[y>>>8&255]^m[g&255]^u[F++],M=f[w>>>24]^h[y>>>16&255]^p[g>>>8&255]^m[v&255]^u[F++],y=x,g=_,v=A,w=M;return x=(l[y>>>24]<<24|l[g>>>16&255]<<16|l[v>>>8&255]<<8|l[w&255])^u[F++],_=(l[g>>>24]<<24|l[v>>>16&255]<<16|l[w>>>8&255]<<8|l[y&255])^u[F++],A=(l[v>>>24]<<24|l[w>>>16&255]<<16|l[y>>>8&255]<<8|l[g&255])^u[F++],M=(l[w>>>24]<<24|l[y>>>16&255]<<16|l[g>>>8&255]<<8|l[v&255])^u[F++],x=x>>>0,_=_>>>0,A=A>>>0,M=M>>>0,[x,_,A,M]}var i=[0,1,2,4,8,16,32,64,128,27,54],a=function(){for(var o=new Array(256),u=0;u<256;u++)u<128?o[u]=u<<1:o[u]=u<<1^283;for(var c=[],l=[],d=[[],[],[],[]],f=[[],[],[],[]],h=0,p=0,m=0;m<256;++m){var y=p^p<<1^p<<2^p<<3^p<<4;y=y>>>8^y&255^99,c[h]=y,l[y]=h;var g=o[h],v=o[g],w=o[v],x=o[y]*257^y*16843008;d[0][h]=x<<24|x>>>8,d[1][h]=x<<16|x>>>16,d[2][h]=x<<8|x>>>24,d[3][h]=x,x=w*16843009^v*65537^g*257^h*16843008,f[0][y]=x<<24|x>>>8,f[1][y]=x<<16|x>>>16,f[2][y]=x<<8|x>>>24,f[3][y]=x,h===0?h=p=1:(h=g^o[o[o[w^g]]],p^=o[o[p]])}return{SBOX:c,INV_SBOX:l,SUB_MIX:d,INV_SUB_MIX:f}}();function s(o){this._key=e(o),this._reset()}return s.blockSize=4*4,s.keySize=256/8,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var o=this._key,u=o.length,c=u+6,l=(c+1)*4,d=[],f=0;f<u;f++)d[f]=o[f];for(f=u;f<l;f++){var h=d[f-1];f%u===0?(h=h<<8|h>>>24,h=a.SBOX[h>>>24]<<24|a.SBOX[h>>>16&255]<<16|a.SBOX[h>>>8&255]<<8|a.SBOX[h&255],h^=i[f/u|0]<<24):u>6&&f%u===4&&(h=a.SBOX[h>>>24]<<24|a.SBOX[h>>>16&255]<<16|a.SBOX[h>>>8&255]<<8|a.SBOX[h&255]),d[f]=d[f-u]^h}for(var p=[],m=0;m<l;m++){var y=l-m,g=d[y-(m%4?0:4)];m<4||y<=4?p[m]=g:p[m]=a.INV_SUB_MIX[0][a.SBOX[g>>>24]]^a.INV_SUB_MIX[1][a.SBOX[g>>>16&255]]^a.INV_SUB_MIX[2][a.SBOX[g>>>8&255]]^a.INV_SUB_MIX[3][a.SBOX[g&255]]}this._nRounds=c,this._keySchedule=d,this._invKeySchedule=p},s.prototype.encryptBlockRaw=function(o){return o=e(o),n(o,this._keySchedule,a.SUB_MIX,a.SBOX,this._nRounds)},s.prototype.encryptBlock=function(o){var u=this.encryptBlockRaw(o),c=t.allocUnsafe(16);return c.writeUInt32BE(u[0],0),c.writeUInt32BE(u[1],4),c.writeUInt32BE(u[2],8),c.writeUInt32BE(u[3],12),c},s.prototype.decryptBlock=function(o){o=e(o);var u=o[1];o[1]=o[3],o[3]=u;var c=n(o,this._invKeySchedule,a.INV_SUB_MIX,a.INV_SBOX,this._nRounds),l=t.allocUnsafe(16);return l.writeUInt32BE(c[0],0),l.writeUInt32BE(c[3],4),l.writeUInt32BE(c[2],8),l.writeUInt32BE(c[1],12),l},s.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},Sv.AES=s,Sv}var Tv,pD;function _Se(){if(pD)return Tv;pD=1;var t=ur().Buffer,e=t.alloc(16,0);function r(a){return[a.readUInt32BE(0),a.readUInt32BE(4),a.readUInt32BE(8),a.readUInt32BE(12)]}function n(a){var s=t.allocUnsafe(16);return s.writeUInt32BE(a[0]>>>0,0),s.writeUInt32BE(a[1]>>>0,4),s.writeUInt32BE(a[2]>>>0,8),s.writeUInt32BE(a[3]>>>0,12),s}function i(a){this.h=a,this.state=t.alloc(16,0),this.cache=t.allocUnsafe(0)}return i.prototype.ghash=function(a){for(var s=-1;++s<a.length;)this.state[s]^=a[s];this._multiply()},i.prototype._multiply=function(){for(var a=r(this.h),s=[0,0,0,0],o,u,c,l=-1;++l<128;){for(u=(this.state[~~(l/8)]&1<<7-l%8)!==0,u&&(s[0]^=a[0],s[1]^=a[1],s[2]^=a[2],s[3]^=a[3]),c=(a[3]&1)!==0,o=3;o>0;o--)a[o]=a[o]>>>1|(a[o-1]&1)<<31;a[0]=a[0]>>>1,c&&(a[0]=a[0]^225<<24)}this.state=n(s)},i.prototype.update=function(a){this.cache=t.concat([this.cache,a]);for(var s;this.cache.length>=16;)s=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(s)},i.prototype.final=function(a,s){return this.cache.length&&this.ghash(t.concat([this.cache,e],16)),this.ghash(n([0,a,0,s])),this.state},Tv=i,Tv}var Dv,mD;function RL(){if(mD)return Dv;mD=1;var t=Oy(),e=ur().Buffer,r=au(),n=gr(),i=_Se(),a=hp(),s=ML();function o(l,d){var f=0;l.length!==d.length&&f++;for(var h=Math.min(l.length,d.length),p=0;p<h;++p)f+=l[p]^d[p];return f}function u(l,d,f){if(d.length===12)return l._finID=e.concat([d,e.from([0,0,0,1])]),e.concat([d,e.from([0,0,0,2])]);var h=new i(f),p=d.length,m=p%16;h.update(d),m&&(m=16-m,h.update(e.alloc(m,0))),h.update(e.alloc(8,0));var y=p*8,g=e.alloc(8);g.writeUIntBE(y,0,8),h.update(g),l._finID=h.state;var v=e.from(l._finID);return s(v),v}function c(l,d,f,h){r.call(this);var p=e.alloc(4,0);this._cipher=new t.AES(d);var m=this._cipher.encryptBlock(p);this._ghash=new i(m),f=u(this,f,m),this._prev=e.from(f),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=h,this._alen=0,this._len=0,this._mode=l,this._authTag=null,this._called=!1}return n(c,r),c.prototype._update=function(l){if(!this._called&&this._alen){var d=16-this._alen%16;d<16&&(d=e.alloc(d,0),this._ghash.update(d))}this._called=!0;var f=this._mode.encrypt(this,l);return this._decrypt?this._ghash.update(l):this._ghash.update(f),this._len+=l.length,f},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var l=a(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&o(l,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=l,this._cipher.scrub()},c.prototype.getAuthTag=function(){if(this._decrypt||!e.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},c.prototype.setAuthTag=function(l){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=l},c.prototype.setAAD=function(l){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(l),this._alen+=l.length},Dv=c,Dv}var Av,gD;function FL(){if(gD)return Av;gD=1;var t=Oy(),e=ur().Buffer,r=au(),n=gr();function i(a,s,o,u){r.call(this),this._cipher=new t.AES(s),this._prev=e.from(o),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=u,this._mode=a}return n(i,r),i.prototype._update=function(a){return this._mode.encrypt(this,a,this._decrypt)},i.prototype._final=function(){this._cipher.scrub()},Av=i,Av}var Nv,yD;function My(){if(yD)return Nv;yD=1;var t=ur().Buffer,e=iE();function r(n,i,a,s){if(t.isBuffer(n)||(n=t.from(n,"binary")),i&&(t.isBuffer(i)||(i=t.from(i,"binary")),i.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=a/8,u=t.alloc(o),c=t.alloc(s||0),l=t.alloc(0);o>0||s>0;){var d=new e;d.update(l),d.update(n),i&&d.update(i),l=d.digest();var f=0;if(o>0){var h=u.length-o;f=Math.min(o,l.length),l.copy(u,h,0,f),o-=f}if(f<l.length&&s>0){var p=c.length-s,m=Math.min(s,l.length-f);l.copy(c,p,f,f+m),s-=m}}return l.fill(0),{key:u,iv:c}}return Nv=r,Nv}var vD;function xSe(){if(vD)return fm;vD=1;var t=uE(),e=RL(),r=ur().Buffer,n=FL(),i=au(),a=Oy(),s=My(),o=gr();function u(h,p,m){i.call(this),this._cache=new l,this._cipher=new a.AES(p),this._prev=r.from(m),this._mode=h,this._autopadding=!0}o(u,i),u.prototype._update=function(h){this._cache.add(h);for(var p,m,y=[];p=this._cache.get();)m=this._mode.encrypt(this,p),y.push(m);return r.concat(y)};var c=r.alloc(16,16);u.prototype._final=function(){var h=this._cache.flush();if(this._autopadding)return h=this._mode.encrypt(this,h),this._cipher.scrub(),h;if(!h.equals(c))throw this._cipher.scrub(),new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(h){return this._autopadding=!!h,this};function l(){this.cache=r.allocUnsafe(0)}l.prototype.add=function(h){this.cache=r.concat([this.cache,h])},l.prototype.get=function(){if(this.cache.length>15){var h=this.cache.slice(0,16);return this.cache=this.cache.slice(16),h}return null},l.prototype.flush=function(){for(var h=16-this.cache.length,p=r.allocUnsafe(h),m=-1;++m<h;)p.writeUInt8(h,m);return r.concat([this.cache,p])};function d(h,p,m){var y=t[h.toLowerCase()];if(!y)throw new TypeError("invalid suite type");if(typeof p=="string"&&(p=r.from(p)),p.length!==y.key/8)throw new TypeError("invalid key length "+p.length);if(typeof m=="string"&&(m=r.from(m)),y.mode!=="GCM"&&m.length!==y.iv)throw new TypeError("invalid iv length "+m.length);return y.type==="stream"?new n(y.module,p,m):y.type==="auth"?new e(y.module,p,m):new u(y.module,p,m)}function f(h,p){var m=t[h.toLowerCase()];if(!m)throw new TypeError("invalid suite type");var y=s(p,!1,m.key,m.iv);return d(h,y.key,y.iv)}return fm.createCipheriv=d,fm.createCipher=f,fm}var pm={},bD;function ESe(){if(bD)return pm;bD=1;var t=RL(),e=ur().Buffer,r=uE(),n=FL(),i=au(),a=Oy(),s=My(),o=gr();function u(h,p,m){i.call(this),this._cache=new c,this._last=void 0,this._cipher=new a.AES(p),this._prev=e.from(m),this._mode=h,this._autopadding=!0}o(u,i),u.prototype._update=function(h){this._cache.add(h);for(var p,m,y=[];p=this._cache.get(this._autopadding);)m=this._mode.decrypt(this,p),y.push(m);return e.concat(y)},u.prototype._final=function(){var h=this._cache.flush();if(this._autopadding)return l(this._mode.decrypt(this,h));if(h)throw new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(h){return this._autopadding=!!h,this};function c(){this.cache=e.allocUnsafe(0)}c.prototype.add=function(h){this.cache=e.concat([this.cache,h])},c.prototype.get=function(h){var p;if(h){if(this.cache.length>16)return p=this.cache.slice(0,16),this.cache=this.cache.slice(16),p}else if(this.cache.length>=16)return p=this.cache.slice(0,16),this.cache=this.cache.slice(16),p;return null},c.prototype.flush=function(){if(this.cache.length)return this.cache};function l(h){var p=h[15];if(p<1||p>16)throw new Error("unable to decrypt data");for(var m=-1;++m<p;)if(h[m+(16-p)]!==p)throw new Error("unable to decrypt data");if(p!==16)return h.slice(0,16-p)}function d(h,p,m){var y=r[h.toLowerCase()];if(!y)throw new TypeError("invalid suite type");if(typeof m=="string"&&(m=e.from(m)),y.mode!=="GCM"&&m.length!==y.iv)throw new TypeError("invalid iv length "+m.length);if(typeof p=="string"&&(p=e.from(p)),p.length!==y.key/8)throw new TypeError("invalid key length "+p.length);return y.type==="stream"?new n(y.module,p,m,!0):y.type==="auth"?new t(y.module,p,m,!0):new u(y.module,p,m)}function f(h,p){var m=r[h.toLowerCase()];if(!m)throw new TypeError("invalid suite type");var y=s(p,!1,m.key,m.iv);return d(h,y.key,y.iv)}return pm.createDecipher=f,pm.createDecipheriv=d,pm}var wD;function cE(){if(wD)return ta;wD=1;var t=xSe(),e=ESe(),r=kL;function n(){return Object.keys(r)}return ta.createCipher=ta.Cipher=t.createCipher,ta.createCipheriv=ta.Cipheriv=t.createCipheriv,ta.createDecipher=ta.Decipher=e.createDecipher,ta.createDecipheriv=ta.Decipheriv=e.createDecipheriv,ta.listCiphers=ta.getCiphers=n,ta}var _D={},xD;function SSe(){return xD||(xD=1,function(t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}}(_D)),_D}var ED;function TSe(){if(ED)return ea;ED=1;var t=dSe(),e=cE(),r=uE(),n=SSe(),i=My();function a(l,d){l=l.toLowerCase();var f,h;if(r[l])f=r[l].key,h=r[l].iv;else if(n[l])f=n[l].key*8,h=n[l].iv;else throw new TypeError("invalid suite type");var p=i(d,!1,f,h);return o(l,p.key,p.iv)}function s(l,d){l=l.toLowerCase();var f,h;if(r[l])f=r[l].key,h=r[l].iv;else if(n[l])f=n[l].key*8,h=n[l].iv;else throw new TypeError("invalid suite type");var p=i(d,!1,f,h);return u(l,p.key,p.iv)}function o(l,d,f){if(l=l.toLowerCase(),r[l])return e.createCipheriv(l,d,f);if(n[l])return new t({key:d,iv:f,mode:l});throw new TypeError("invalid suite type")}function u(l,d,f){if(l=l.toLowerCase(),r[l])return e.createDecipheriv(l,d,f);if(n[l])return new t({key:d,iv:f,mode:l,decrypt:!0});throw new TypeError("invalid suite type")}function c(){return Object.keys(n).concat(e.getCiphers())}return ea.createCipher=ea.Cipher=a,ea.createCipheriv=ea.Cipheriv=o,ea.createDecipher=ea.Decipher=s,ea.createDecipheriv=ea.Decipheriv=u,ea.listCiphers=ea.getCiphers=c,ea}var fu={},S_={exports:{}},DSe=S_.exports,SD;function ei(){return SD||(SD=1,function(t){(function(e,r){function n(T,N){if(!T)throw new Error(N||"Assertion failed")}function i(T,N){T.super_=N;var b=function(){};b.prototype=N.prototype,T.prototype=new b,T.prototype.constructor=T}function a(T,N,b){if(a.isBN(T))return T;this.negative=0,this.words=null,this.length=0,this.red=null,T!==null&&((N==="le"||N==="be")&&(b=N,N=10),this._init(T||0,N||10,b||"be"))}typeof e=="object"?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=gc.Buffer}catch{}a.isBN=function(T){return T instanceof a?!0:T!==null&&typeof T=="object"&&T.constructor.wordSize===a.wordSize&&Array.isArray(T.words)},a.max=function(T,N){return T.cmp(N)>0?T:N},a.min=function(T,N){return T.cmp(N)<0?T:N},a.prototype._init=function(T,N,b){if(typeof T=="number")return this._initNumber(T,N,b);if(typeof T=="object")return this._initArray(T,N,b);N==="hex"&&(N=16),n(N===(N|0)&&N>=2&&N<=36),T=T.toString().replace(/\s+/g,"");var E=0;T[0]==="-"&&(E++,this.negative=1),E<T.length&&(N===16?this._parseHex(T,E,b):(this._parseBase(T,N,E),b==="le"&&this._initArray(this.toArray(),N,b)))},a.prototype._initNumber=function(T,N,b){T<0&&(this.negative=1,T=-T),T<67108864?(this.words=[T&67108863],this.length=1):T<4503599627370496?(this.words=[T&67108863,T/67108864&67108863],this.length=2):(n(T<9007199254740992),this.words=[T&67108863,T/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),N,b)},a.prototype._initArray=function(T,N,b){if(n(typeof T.length=="number"),T.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(T.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var D,C,I=0;if(b==="be")for(E=T.length-1,D=0;E>=0;E-=3)C=T[E]|T[E-1]<<8|T[E-2]<<16,this.words[D]|=C<<I&67108863,this.words[D+1]=C>>>26-I&67108863,I+=24,I>=26&&(I-=26,D++);else if(b==="le")for(E=0,D=0;E<T.length;E+=3)C=T[E]|T[E+1]<<8|T[E+2]<<16,this.words[D]|=C<<I&67108863,this.words[D+1]=C>>>26-I&67108863,I+=24,I>=26&&(I-=26,D++);return this.strip()};function o(T,N){var b=T.charCodeAt(N);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function u(T,N,b){var E=o(T,b);return b-1>=N&&(E|=o(T,b-1)<<4),E}a.prototype._parseHex=function(T,N,b){this.length=Math.ceil((T.length-N)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var D=0,C=0,I;if(b==="be")for(E=T.length-1;E>=N;E-=2)I=u(T,N,E)<<D,this.words[C]|=I&67108863,D>=18?(D-=18,C+=1,this.words[C]|=I>>>26):D+=8;else{var O=T.length-N;for(E=O%2===0?N+1:N;E<T.length;E+=2)I=u(T,N,E)<<D,this.words[C]|=I&67108863,D>=18?(D-=18,C+=1,this.words[C]|=I>>>26):D+=8}this.strip()};function c(T,N,b,E){for(var D=0,C=Math.min(T.length,b),I=N;I<C;I++){var O=T.charCodeAt(I)-48;D*=E,O>=49?D+=O-49+10:O>=17?D+=O-17+10:D+=O}return D}a.prototype._parseBase=function(T,N,b){this.words=[0],this.length=1;for(var E=0,D=1;D<=67108863;D*=N)E++;E--,D=D/N|0;for(var C=T.length-b,I=C%E,O=Math.min(C,C-I)+b,S=0,P=b;P<O;P+=E)S=c(T,P,P+E,N),this.imuln(D),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S);if(I!==0){var R=1;for(S=c(T,P,T.length,N),P=0;P<I;P++)R*=N;this.imuln(R),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S)}this.strip()},a.prototype.copy=function(T){T.words=new Array(this.length);for(var N=0;N<this.length;N++)T.words[N]=this.words[N];T.length=this.length,T.negative=this.negative,T.red=this.red},a.prototype.clone=function(){var T=new a(null);return this.copy(T),T},a.prototype._expand=function(T){for(;this.length<T;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(T,N){T=T||10,N=N|0||1;var b;if(T===16||T==="hex"){b="";for(var E=0,D=0,C=0;C<this.length;C++){var I=this.words[C],O=((I<<E|D)&16777215).toString(16);D=I>>>24-E&16777215,E+=2,E>=26&&(E-=26,C--),D!==0||C!==this.length-1?b=l[6-O.length]+O+b:b=O+b}for(D!==0&&(b=D.toString(16)+b);b.length%N!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(T===(T|0)&&T>=2&&T<=36){var S=d[T],P=f[T];b="";var R=this.clone();for(R.negative=0;!R.isZero();){var L=R.modn(P).toString(T);R=R.idivn(P),R.isZero()?b=L+b:b=l[S-L.length]+L+b}for(this.isZero()&&(b="0"+b);b.length%N!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var T=this.words[0];return this.length===2?T+=this.words[1]*67108864:this.length===3&&this.words[2]===1?T+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-T:T},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(T,N){return n(typeof s<"u"),this.toArrayLike(s,T,N)},a.prototype.toArray=function(T,N){return this.toArrayLike(Array,T,N)},a.prototype.toArrayLike=function(T,N,b){var E=this.byteLength(),D=b||Math.max(1,E);n(E<=D,"byte array longer than desired length"),n(D>0,"Requested array length <= 0"),this.strip();var C=N==="le",I=new T(D),O,S,P=this.clone();if(C){for(S=0;!P.isZero();S++)O=P.andln(255),P.iushrn(8),I[S]=O;for(;S<D;S++)I[S]=0}else{for(S=0;S<D-E;S++)I[S]=0;for(S=0;!P.isZero();S++)O=P.andln(255),P.iushrn(8),I[D-S-1]=O}return I},Math.clz32?a.prototype._countBits=function(T){return 32-Math.clz32(T)}:a.prototype._countBits=function(T){var N=T,b=0;return N>=4096&&(b+=13,N>>>=13),N>=64&&(b+=7,N>>>=7),N>=8&&(b+=4,N>>>=4),N>=2&&(b+=2,N>>>=2),b+N},a.prototype._zeroBits=function(T){if(T===0)return 26;var N=T,b=0;return N&8191||(b+=13,N>>>=13),N&127||(b+=7,N>>>=7),N&15||(b+=4,N>>>=4),N&3||(b+=2,N>>>=2),N&1||b++,b},a.prototype.bitLength=function(){var T=this.words[this.length-1],N=this._countBits(T);return(this.length-1)*26+N};function h(T){for(var N=new Array(T.bitLength()),b=0;b<N.length;b++){var E=b/26|0,D=b%26;N[b]=(T.words[E]&1<<D)>>>D}return N}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var T=0,N=0;N<this.length;N++){var b=this._zeroBits(this.words[N]);if(T+=b,b!==26)break}return T},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(T){return this.negative!==0?this.abs().inotn(T).iaddn(1):this.clone()},a.prototype.fromTwos=function(T){return this.testn(T-1)?this.notn(T).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(T){for(;this.length<T.length;)this.words[this.length++]=0;for(var N=0;N<T.length;N++)this.words[N]=this.words[N]|T.words[N];return this.strip()},a.prototype.ior=function(T){return n((this.negative|T.negative)===0),this.iuor(T)},a.prototype.or=function(T){return this.length>T.length?this.clone().ior(T):T.clone().ior(this)},a.prototype.uor=function(T){return this.length>T.length?this.clone().iuor(T):T.clone().iuor(this)},a.prototype.iuand=function(T){var N;this.length>T.length?N=T:N=this;for(var b=0;b<N.length;b++)this.words[b]=this.words[b]&T.words[b];return this.length=N.length,this.strip()},a.prototype.iand=function(T){return n((this.negative|T.negative)===0),this.iuand(T)},a.prototype.and=function(T){return this.length>T.length?this.clone().iand(T):T.clone().iand(this)},a.prototype.uand=function(T){return this.length>T.length?this.clone().iuand(T):T.clone().iuand(this)},a.prototype.iuxor=function(T){var N,b;this.length>T.length?(N=this,b=T):(N=T,b=this);for(var E=0;E<b.length;E++)this.words[E]=N.words[E]^b.words[E];if(this!==N)for(;E<N.length;E++)this.words[E]=N.words[E];return this.length=N.length,this.strip()},a.prototype.ixor=function(T){return n((this.negative|T.negative)===0),this.iuxor(T)},a.prototype.xor=function(T){return this.length>T.length?this.clone().ixor(T):T.clone().ixor(this)},a.prototype.uxor=function(T){return this.length>T.length?this.clone().iuxor(T):T.clone().iuxor(this)},a.prototype.inotn=function(T){n(typeof T=="number"&&T>=0);var N=Math.ceil(T/26)|0,b=T%26;this._expand(N),b>0&&N--;for(var E=0;E<N;E++)this.words[E]=~this.words[E]&67108863;return b>0&&(this.words[E]=~this.words[E]&67108863>>26-b),this.strip()},a.prototype.notn=function(T){return this.clone().inotn(T)},a.prototype.setn=function(T,N){n(typeof T=="number"&&T>=0);var b=T/26|0,E=T%26;return this._expand(b+1),N?this.words[b]=this.words[b]|1<<E:this.words[b]=this.words[b]&~(1<<E),this.strip()},a.prototype.iadd=function(T){var N;if(this.negative!==0&&T.negative===0)return this.negative=0,N=this.isub(T),this.negative^=1,this._normSign();if(this.negative===0&&T.negative!==0)return T.negative=0,N=this.isub(T),T.negative=1,N._normSign();var b,E;this.length>T.length?(b=this,E=T):(b=T,E=this);for(var D=0,C=0;C<E.length;C++)N=(b.words[C]|0)+(E.words[C]|0)+D,this.words[C]=N&67108863,D=N>>>26;for(;D!==0&&C<b.length;C++)N=(b.words[C]|0)+D,this.words[C]=N&67108863,D=N>>>26;if(this.length=b.length,D!==0)this.words[this.length]=D,this.length++;else if(b!==this)for(;C<b.length;C++)this.words[C]=b.words[C];return this},a.prototype.add=function(T){var N;return T.negative!==0&&this.negative===0?(T.negative=0,N=this.sub(T),T.negative^=1,N):T.negative===0&&this.negative!==0?(this.negative=0,N=T.sub(this),this.negative=1,N):this.length>T.length?this.clone().iadd(T):T.clone().iadd(this)},a.prototype.isub=function(T){if(T.negative!==0){T.negative=0;var N=this.iadd(T);return T.negative=1,N._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(T),this.negative=1,this._normSign();var b=this.cmp(T);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,D;b>0?(E=this,D=T):(E=T,D=this);for(var C=0,I=0;I<D.length;I++)N=(E.words[I]|0)-(D.words[I]|0)+C,C=N>>26,this.words[I]=N&67108863;for(;C!==0&&I<E.length;I++)N=(E.words[I]|0)+C,C=N>>26,this.words[I]=N&67108863;if(C===0&&I<E.length&&E!==this)for(;I<E.length;I++)this.words[I]=E.words[I];return this.length=Math.max(this.length,I),E!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(T){return this.clone().isub(T)};function p(T,N,b){b.negative=N.negative^T.negative;var E=T.length+N.length|0;b.length=E,E=E-1|0;var D=T.words[0]|0,C=N.words[0]|0,I=D*C,O=I&67108863,S=I/67108864|0;b.words[0]=O;for(var P=1;P<E;P++){for(var R=S>>>26,L=S&67108863,q=Math.min(P,N.length-1),J=Math.max(0,P-T.length+1);J<=q;J++){var G=P-J|0;D=T.words[G]|0,C=N.words[J]|0,I=D*C+L,R+=I/67108864|0,L=I&67108863}b.words[P]=L|0,S=R|0}return S!==0?b.words[P]=S|0:b.length--,b.strip()}var m=function(T,N,b){var E=T.words,D=N.words,C=b.words,I=0,O,S,P,R=E[0]|0,L=R&8191,q=R>>>13,J=E[1]|0,G=J&8191,ie=J>>>13,z=E[2]|0,V=z&8191,Q=z>>>13,ae=E[3]|0,oe=ae&8191,le=ae>>>13,he=E[4]|0,Z=he&8191,K=he>>>13,B=E[5]|0,j=B&8191,U=B>>>13,W=E[6]|0,ee=W&8191,te=W>>>13,ne=E[7]|0,Y=ne&8191,re=ne>>>13,ce=E[8]|0,de=ce&8191,ve=ce>>>13,we=E[9]|0,Ae=we&8191,Ne=we>>>13,Pe=D[0]|0,Ce=Pe&8191,Qe=Pe>>>13,ft=D[1]|0,$e=ft&8191,Et=ft>>>13,H=D[2]|0,pe=H&8191,Ee=H>>>13,Oe=D[3]|0,je=Oe&8191,it=Oe>>>13,jt=D[4]|0,Ft=jt&8191,Br=jt>>>13,Or=D[5]|0,Mt=Or&8191,jr=Or>>>13,$r=D[6]|0,me=$r&8191,be=$r>>>13,De=D[7]|0,Ie=De&8191,Ze=De>>>13,tt=D[8]|0,Ye=tt&8191,We=tt>>>13,Je=D[9]|0,Be=Je&8191,rt=Je>>>13;b.negative=T.negative^N.negative,b.length=19,O=Math.imul(L,Ce),S=Math.imul(L,Qe),S=S+Math.imul(q,Ce)|0,P=Math.imul(q,Qe);var ht=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(ht>>>26)|0,ht&=67108863,O=Math.imul(G,Ce),S=Math.imul(G,Qe),S=S+Math.imul(ie,Ce)|0,P=Math.imul(ie,Qe),O=O+Math.imul(L,$e)|0,S=S+Math.imul(L,Et)|0,S=S+Math.imul(q,$e)|0,P=P+Math.imul(q,Et)|0;var gt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(V,Ce),S=Math.imul(V,Qe),S=S+Math.imul(Q,Ce)|0,P=Math.imul(Q,Qe),O=O+Math.imul(G,$e)|0,S=S+Math.imul(G,Et)|0,S=S+Math.imul(ie,$e)|0,P=P+Math.imul(ie,Et)|0,O=O+Math.imul(L,pe)|0,S=S+Math.imul(L,Ee)|0,S=S+Math.imul(q,pe)|0,P=P+Math.imul(q,Ee)|0;var Ur=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,O=Math.imul(oe,Ce),S=Math.imul(oe,Qe),S=S+Math.imul(le,Ce)|0,P=Math.imul(le,Qe),O=O+Math.imul(V,$e)|0,S=S+Math.imul(V,Et)|0,S=S+Math.imul(Q,$e)|0,P=P+Math.imul(Q,Et)|0,O=O+Math.imul(G,pe)|0,S=S+Math.imul(G,Ee)|0,S=S+Math.imul(ie,pe)|0,P=P+Math.imul(ie,Ee)|0,O=O+Math.imul(L,je)|0,S=S+Math.imul(L,it)|0,S=S+Math.imul(q,je)|0,P=P+Math.imul(q,it)|0;var fr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(fr>>>26)|0,fr&=67108863,O=Math.imul(Z,Ce),S=Math.imul(Z,Qe),S=S+Math.imul(K,Ce)|0,P=Math.imul(K,Qe),O=O+Math.imul(oe,$e)|0,S=S+Math.imul(oe,Et)|0,S=S+Math.imul(le,$e)|0,P=P+Math.imul(le,Et)|0,O=O+Math.imul(V,pe)|0,S=S+Math.imul(V,Ee)|0,S=S+Math.imul(Q,pe)|0,P=P+Math.imul(Q,Ee)|0,O=O+Math.imul(G,je)|0,S=S+Math.imul(G,it)|0,S=S+Math.imul(ie,je)|0,P=P+Math.imul(ie,it)|0,O=O+Math.imul(L,Ft)|0,S=S+Math.imul(L,Br)|0,S=S+Math.imul(q,Ft)|0,P=P+Math.imul(q,Br)|0;var Jt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,O=Math.imul(j,Ce),S=Math.imul(j,Qe),S=S+Math.imul(U,Ce)|0,P=Math.imul(U,Qe),O=O+Math.imul(Z,$e)|0,S=S+Math.imul(Z,Et)|0,S=S+Math.imul(K,$e)|0,P=P+Math.imul(K,Et)|0,O=O+Math.imul(oe,pe)|0,S=S+Math.imul(oe,Ee)|0,S=S+Math.imul(le,pe)|0,P=P+Math.imul(le,Ee)|0,O=O+Math.imul(V,je)|0,S=S+Math.imul(V,it)|0,S=S+Math.imul(Q,je)|0,P=P+Math.imul(Q,it)|0,O=O+Math.imul(G,Ft)|0,S=S+Math.imul(G,Br)|0,S=S+Math.imul(ie,Ft)|0,P=P+Math.imul(ie,Br)|0,O=O+Math.imul(L,Mt)|0,S=S+Math.imul(L,jr)|0,S=S+Math.imul(q,Mt)|0,P=P+Math.imul(q,jr)|0;var Sr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,O=Math.imul(ee,Ce),S=Math.imul(ee,Qe),S=S+Math.imul(te,Ce)|0,P=Math.imul(te,Qe),O=O+Math.imul(j,$e)|0,S=S+Math.imul(j,Et)|0,S=S+Math.imul(U,$e)|0,P=P+Math.imul(U,Et)|0,O=O+Math.imul(Z,pe)|0,S=S+Math.imul(Z,Ee)|0,S=S+Math.imul(K,pe)|0,P=P+Math.imul(K,Ee)|0,O=O+Math.imul(oe,je)|0,S=S+Math.imul(oe,it)|0,S=S+Math.imul(le,je)|0,P=P+Math.imul(le,it)|0,O=O+Math.imul(V,Ft)|0,S=S+Math.imul(V,Br)|0,S=S+Math.imul(Q,Ft)|0,P=P+Math.imul(Q,Br)|0,O=O+Math.imul(G,Mt)|0,S=S+Math.imul(G,jr)|0,S=S+Math.imul(ie,Mt)|0,P=P+Math.imul(ie,jr)|0,O=O+Math.imul(L,me)|0,S=S+Math.imul(L,be)|0,S=S+Math.imul(q,me)|0,P=P+Math.imul(q,be)|0;var Fn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(Y,Ce),S=Math.imul(Y,Qe),S=S+Math.imul(re,Ce)|0,P=Math.imul(re,Qe),O=O+Math.imul(ee,$e)|0,S=S+Math.imul(ee,Et)|0,S=S+Math.imul(te,$e)|0,P=P+Math.imul(te,Et)|0,O=O+Math.imul(j,pe)|0,S=S+Math.imul(j,Ee)|0,S=S+Math.imul(U,pe)|0,P=P+Math.imul(U,Ee)|0,O=O+Math.imul(Z,je)|0,S=S+Math.imul(Z,it)|0,S=S+Math.imul(K,je)|0,P=P+Math.imul(K,it)|0,O=O+Math.imul(oe,Ft)|0,S=S+Math.imul(oe,Br)|0,S=S+Math.imul(le,Ft)|0,P=P+Math.imul(le,Br)|0,O=O+Math.imul(V,Mt)|0,S=S+Math.imul(V,jr)|0,S=S+Math.imul(Q,Mt)|0,P=P+Math.imul(Q,jr)|0,O=O+Math.imul(G,me)|0,S=S+Math.imul(G,be)|0,S=S+Math.imul(ie,me)|0,P=P+Math.imul(ie,be)|0,O=O+Math.imul(L,Ie)|0,S=S+Math.imul(L,Ze)|0,S=S+Math.imul(q,Ie)|0,P=P+Math.imul(q,Ze)|0;var zn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(zn>>>26)|0,zn&=67108863,O=Math.imul(de,Ce),S=Math.imul(de,Qe),S=S+Math.imul(ve,Ce)|0,P=Math.imul(ve,Qe),O=O+Math.imul(Y,$e)|0,S=S+Math.imul(Y,Et)|0,S=S+Math.imul(re,$e)|0,P=P+Math.imul(re,Et)|0,O=O+Math.imul(ee,pe)|0,S=S+Math.imul(ee,Ee)|0,S=S+Math.imul(te,pe)|0,P=P+Math.imul(te,Ee)|0,O=O+Math.imul(j,je)|0,S=S+Math.imul(j,it)|0,S=S+Math.imul(U,je)|0,P=P+Math.imul(U,it)|0,O=O+Math.imul(Z,Ft)|0,S=S+Math.imul(Z,Br)|0,S=S+Math.imul(K,Ft)|0,P=P+Math.imul(K,Br)|0,O=O+Math.imul(oe,Mt)|0,S=S+Math.imul(oe,jr)|0,S=S+Math.imul(le,Mt)|0,P=P+Math.imul(le,jr)|0,O=O+Math.imul(V,me)|0,S=S+Math.imul(V,be)|0,S=S+Math.imul(Q,me)|0,P=P+Math.imul(Q,be)|0,O=O+Math.imul(G,Ie)|0,S=S+Math.imul(G,Ze)|0,S=S+Math.imul(ie,Ie)|0,P=P+Math.imul(ie,Ze)|0,O=O+Math.imul(L,Ye)|0,S=S+Math.imul(L,We)|0,S=S+Math.imul(q,Ye)|0,P=P+Math.imul(q,We)|0;var bn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(bn>>>26)|0,bn&=67108863,O=Math.imul(Ae,Ce),S=Math.imul(Ae,Qe),S=S+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,Qe),O=O+Math.imul(de,$e)|0,S=S+Math.imul(de,Et)|0,S=S+Math.imul(ve,$e)|0,P=P+Math.imul(ve,Et)|0,O=O+Math.imul(Y,pe)|0,S=S+Math.imul(Y,Ee)|0,S=S+Math.imul(re,pe)|0,P=P+Math.imul(re,Ee)|0,O=O+Math.imul(ee,je)|0,S=S+Math.imul(ee,it)|0,S=S+Math.imul(te,je)|0,P=P+Math.imul(te,it)|0,O=O+Math.imul(j,Ft)|0,S=S+Math.imul(j,Br)|0,S=S+Math.imul(U,Ft)|0,P=P+Math.imul(U,Br)|0,O=O+Math.imul(Z,Mt)|0,S=S+Math.imul(Z,jr)|0,S=S+Math.imul(K,Mt)|0,P=P+Math.imul(K,jr)|0,O=O+Math.imul(oe,me)|0,S=S+Math.imul(oe,be)|0,S=S+Math.imul(le,me)|0,P=P+Math.imul(le,be)|0,O=O+Math.imul(V,Ie)|0,S=S+Math.imul(V,Ze)|0,S=S+Math.imul(Q,Ie)|0,P=P+Math.imul(Q,Ze)|0,O=O+Math.imul(G,Ye)|0,S=S+Math.imul(G,We)|0,S=S+Math.imul(ie,Ye)|0,P=P+Math.imul(ie,We)|0,O=O+Math.imul(L,Be)|0,S=S+Math.imul(L,rt)|0,S=S+Math.imul(q,Be)|0,P=P+Math.imul(q,rt)|0;var Qr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,O=Math.imul(Ae,$e),S=Math.imul(Ae,Et),S=S+Math.imul(Ne,$e)|0,P=Math.imul(Ne,Et),O=O+Math.imul(de,pe)|0,S=S+Math.imul(de,Ee)|0,S=S+Math.imul(ve,pe)|0,P=P+Math.imul(ve,Ee)|0,O=O+Math.imul(Y,je)|0,S=S+Math.imul(Y,it)|0,S=S+Math.imul(re,je)|0,P=P+Math.imul(re,it)|0,O=O+Math.imul(ee,Ft)|0,S=S+Math.imul(ee,Br)|0,S=S+Math.imul(te,Ft)|0,P=P+Math.imul(te,Br)|0,O=O+Math.imul(j,Mt)|0,S=S+Math.imul(j,jr)|0,S=S+Math.imul(U,Mt)|0,P=P+Math.imul(U,jr)|0,O=O+Math.imul(Z,me)|0,S=S+Math.imul(Z,be)|0,S=S+Math.imul(K,me)|0,P=P+Math.imul(K,be)|0,O=O+Math.imul(oe,Ie)|0,S=S+Math.imul(oe,Ze)|0,S=S+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ze)|0,O=O+Math.imul(V,Ye)|0,S=S+Math.imul(V,We)|0,S=S+Math.imul(Q,Ye)|0,P=P+Math.imul(Q,We)|0,O=O+Math.imul(G,Be)|0,S=S+Math.imul(G,rt)|0,S=S+Math.imul(ie,Be)|0,P=P+Math.imul(ie,rt)|0;var kt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(kt>>>26)|0,kt&=67108863,O=Math.imul(Ae,pe),S=Math.imul(Ae,Ee),S=S+Math.imul(Ne,pe)|0,P=Math.imul(Ne,Ee),O=O+Math.imul(de,je)|0,S=S+Math.imul(de,it)|0,S=S+Math.imul(ve,je)|0,P=P+Math.imul(ve,it)|0,O=O+Math.imul(Y,Ft)|0,S=S+Math.imul(Y,Br)|0,S=S+Math.imul(re,Ft)|0,P=P+Math.imul(re,Br)|0,O=O+Math.imul(ee,Mt)|0,S=S+Math.imul(ee,jr)|0,S=S+Math.imul(te,Mt)|0,P=P+Math.imul(te,jr)|0,O=O+Math.imul(j,me)|0,S=S+Math.imul(j,be)|0,S=S+Math.imul(U,me)|0,P=P+Math.imul(U,be)|0,O=O+Math.imul(Z,Ie)|0,S=S+Math.imul(Z,Ze)|0,S=S+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ze)|0,O=O+Math.imul(oe,Ye)|0,S=S+Math.imul(oe,We)|0,S=S+Math.imul(le,Ye)|0,P=P+Math.imul(le,We)|0,O=O+Math.imul(V,Be)|0,S=S+Math.imul(V,rt)|0,S=S+Math.imul(Q,Be)|0,P=P+Math.imul(Q,rt)|0;var rn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(rn>>>26)|0,rn&=67108863,O=Math.imul(Ae,je),S=Math.imul(Ae,it),S=S+Math.imul(Ne,je)|0,P=Math.imul(Ne,it),O=O+Math.imul(de,Ft)|0,S=S+Math.imul(de,Br)|0,S=S+Math.imul(ve,Ft)|0,P=P+Math.imul(ve,Br)|0,O=O+Math.imul(Y,Mt)|0,S=S+Math.imul(Y,jr)|0,S=S+Math.imul(re,Mt)|0,P=P+Math.imul(re,jr)|0,O=O+Math.imul(ee,me)|0,S=S+Math.imul(ee,be)|0,S=S+Math.imul(te,me)|0,P=P+Math.imul(te,be)|0,O=O+Math.imul(j,Ie)|0,S=S+Math.imul(j,Ze)|0,S=S+Math.imul(U,Ie)|0,P=P+Math.imul(U,Ze)|0,O=O+Math.imul(Z,Ye)|0,S=S+Math.imul(Z,We)|0,S=S+Math.imul(K,Ye)|0,P=P+Math.imul(K,We)|0,O=O+Math.imul(oe,Be)|0,S=S+Math.imul(oe,rt)|0,S=S+Math.imul(le,Be)|0,P=P+Math.imul(le,rt)|0;var un=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(un>>>26)|0,un&=67108863,O=Math.imul(Ae,Ft),S=Math.imul(Ae,Br),S=S+Math.imul(Ne,Ft)|0,P=Math.imul(Ne,Br),O=O+Math.imul(de,Mt)|0,S=S+Math.imul(de,jr)|0,S=S+Math.imul(ve,Mt)|0,P=P+Math.imul(ve,jr)|0,O=O+Math.imul(Y,me)|0,S=S+Math.imul(Y,be)|0,S=S+Math.imul(re,me)|0,P=P+Math.imul(re,be)|0,O=O+Math.imul(ee,Ie)|0,S=S+Math.imul(ee,Ze)|0,S=S+Math.imul(te,Ie)|0,P=P+Math.imul(te,Ze)|0,O=O+Math.imul(j,Ye)|0,S=S+Math.imul(j,We)|0,S=S+Math.imul(U,Ye)|0,P=P+Math.imul(U,We)|0,O=O+Math.imul(Z,Be)|0,S=S+Math.imul(Z,rt)|0,S=S+Math.imul(K,Be)|0,P=P+Math.imul(K,rt)|0;var Dn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,O=Math.imul(Ae,Mt),S=Math.imul(Ae,jr),S=S+Math.imul(Ne,Mt)|0,P=Math.imul(Ne,jr),O=O+Math.imul(de,me)|0,S=S+Math.imul(de,be)|0,S=S+Math.imul(ve,me)|0,P=P+Math.imul(ve,be)|0,O=O+Math.imul(Y,Ie)|0,S=S+Math.imul(Y,Ze)|0,S=S+Math.imul(re,Ie)|0,P=P+Math.imul(re,Ze)|0,O=O+Math.imul(ee,Ye)|0,S=S+Math.imul(ee,We)|0,S=S+Math.imul(te,Ye)|0,P=P+Math.imul(te,We)|0,O=O+Math.imul(j,Be)|0,S=S+Math.imul(j,rt)|0,S=S+Math.imul(U,Be)|0,P=P+Math.imul(U,rt)|0;var fn=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(fn>>>26)|0,fn&=67108863,O=Math.imul(Ae,me),S=Math.imul(Ae,be),S=S+Math.imul(Ne,me)|0,P=Math.imul(Ne,be),O=O+Math.imul(de,Ie)|0,S=S+Math.imul(de,Ze)|0,S=S+Math.imul(ve,Ie)|0,P=P+Math.imul(ve,Ze)|0,O=O+Math.imul(Y,Ye)|0,S=S+Math.imul(Y,We)|0,S=S+Math.imul(re,Ye)|0,P=P+Math.imul(re,We)|0,O=O+Math.imul(ee,Be)|0,S=S+Math.imul(ee,rt)|0,S=S+Math.imul(te,Be)|0,P=P+Math.imul(te,rt)|0;var Zt=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(Ae,Ie),S=Math.imul(Ae,Ze),S=S+Math.imul(Ne,Ie)|0,P=Math.imul(Ne,Ze),O=O+Math.imul(de,Ye)|0,S=S+Math.imul(de,We)|0,S=S+Math.imul(ve,Ye)|0,P=P+Math.imul(ve,We)|0,O=O+Math.imul(Y,Be)|0,S=S+Math.imul(Y,rt)|0,S=S+Math.imul(re,Be)|0,P=P+Math.imul(re,rt)|0;var Mr=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,O=Math.imul(Ae,Ye),S=Math.imul(Ae,We),S=S+Math.imul(Ne,Ye)|0,P=Math.imul(Ne,We),O=O+Math.imul(de,Be)|0,S=S+Math.imul(de,rt)|0,S=S+Math.imul(ve,Be)|0,P=P+Math.imul(ve,rt)|0;var ti=(I+O|0)+((S&8191)<<13)|0;I=(P+(S>>>13)|0)+(ti>>>26)|0,ti&=67108863,O=Math.imul(Ae,Be),S=Math.imul(Ae,rt),S=S+Math.imul(Ne,Be)|0,P=Math.imul(Ne,rt);var qn=(I+O|0)+((S&8191)<<13)|0;return I=(P+(S>>>13)|0)+(qn>>>26)|0,qn&=67108863,C[0]=ht,C[1]=gt,C[2]=Ur,C[3]=fr,C[4]=Jt,C[5]=Sr,C[6]=Fn,C[7]=zn,C[8]=bn,C[9]=Qr,C[10]=kt,C[11]=rn,C[12]=un,C[13]=Dn,C[14]=fn,C[15]=Zt,C[16]=Mr,C[17]=ti,C[18]=qn,I!==0&&(C[19]=I,b.length++),b};Math.imul||(m=p);function y(T,N,b){b.negative=N.negative^T.negative,b.length=T.length+N.length;for(var E=0,D=0,C=0;C<b.length-1;C++){var I=D;D=0;for(var O=E&67108863,S=Math.min(C,N.length-1),P=Math.max(0,C-T.length+1);P<=S;P++){var R=C-P,L=T.words[R]|0,q=N.words[P]|0,J=L*q,G=J&67108863;I=I+(J/67108864|0)|0,G=G+O|0,O=G&67108863,I=I+(G>>>26)|0,D+=I>>>26,I&=67108863}b.words[C]=O,E=I,I=D}return E!==0?b.words[C]=E:b.length--,b.strip()}function g(T,N,b){var E=new v;return E.mulp(T,N,b)}a.prototype.mulTo=function(T,N){var b,E=this.length+T.length;return this.length===10&&T.length===10?b=m(this,T,N):E<63?b=p(this,T,N):E<1024?b=y(this,T,N):b=g(this,T,N),b};function v(T,N){this.x=T,this.y=N}v.prototype.makeRBT=function(T){for(var N=new Array(T),b=a.prototype._countBits(T)-1,E=0;E<T;E++)N[E]=this.revBin(E,b,T);return N},v.prototype.revBin=function(T,N,b){if(T===0||T===b-1)return T;for(var E=0,D=0;D<N;D++)E|=(T&1)<<N-D-1,T>>=1;return E},v.prototype.permute=function(T,N,b,E,D,C){for(var I=0;I<C;I++)E[I]=N[T[I]],D[I]=b[T[I]]},v.prototype.transform=function(T,N,b,E,D,C){this.permute(C,T,N,b,E,D);for(var I=1;I<D;I<<=1)for(var O=I<<1,S=Math.cos(2*Math.PI/O),P=Math.sin(2*Math.PI/O),R=0;R<D;R+=O)for(var L=S,q=P,J=0;J<I;J++){var G=b[R+J],ie=E[R+J],z=b[R+J+I],V=E[R+J+I],Q=L*z-q*V;V=L*V+q*z,z=Q,b[R+J]=G+z,E[R+J]=ie+V,b[R+J+I]=G-z,E[R+J+I]=ie-V,J!==O&&(Q=S*L-P*q,q=S*q+P*L,L=Q)}},v.prototype.guessLen13b=function(T,N){var b=Math.max(N,T)|1,E=b&1,D=0;for(b=b/2|0;b;b=b>>>1)D++;return 1<<D+1+E},v.prototype.conjugate=function(T,N,b){if(!(b<=1))for(var E=0;E<b/2;E++){var D=T[E];T[E]=T[b-E-1],T[b-E-1]=D,D=N[E],N[E]=-N[b-E-1],N[b-E-1]=-D}},v.prototype.normalize13b=function(T,N){for(var b=0,E=0;E<N/2;E++){var D=Math.round(T[2*E+1]/N)*8192+Math.round(T[2*E]/N)+b;T[E]=D&67108863,D<67108864?b=0:b=D/67108864|0}return T},v.prototype.convert13b=function(T,N,b,E){for(var D=0,C=0;C<N;C++)D=D+(T[C]|0),b[2*C]=D&8191,D=D>>>13,b[2*C+1]=D&8191,D=D>>>13;for(C=2*N;C<E;++C)b[C]=0;n(D===0),n((D&-8192)===0)},v.prototype.stub=function(T){for(var N=new Array(T),b=0;b<T;b++)N[b]=0;return N},v.prototype.mulp=function(T,N,b){var E=2*this.guessLen13b(T.length,N.length),D=this.makeRBT(E),C=this.stub(E),I=new Array(E),O=new Array(E),S=new Array(E),P=new Array(E),R=new Array(E),L=new Array(E),q=b.words;q.length=E,this.convert13b(T.words,T.length,I,E),this.convert13b(N.words,N.length,P,E),this.transform(I,C,O,S,E,D),this.transform(P,C,R,L,E,D);for(var J=0;J<E;J++){var G=O[J]*R[J]-S[J]*L[J];S[J]=O[J]*L[J]+S[J]*R[J],O[J]=G}return this.conjugate(O,S,E),this.transform(O,S,q,C,E,D),this.conjugate(q,C,E),this.normalize13b(q,E),b.negative=T.negative^N.negative,b.length=T.length+N.length,b.strip()},a.prototype.mul=function(T){var N=new a(null);return N.words=new Array(this.length+T.length),this.mulTo(T,N)},a.prototype.mulf=function(T){var N=new a(null);return N.words=new Array(this.length+T.length),g(this,T,N)},a.prototype.imul=function(T){return this.clone().mulTo(T,this)},a.prototype.imuln=function(T){n(typeof T=="number"),n(T<67108864);for(var N=0,b=0;b<this.length;b++){var E=(this.words[b]|0)*T,D=(E&67108863)+(N&67108863);N>>=26,N+=E/67108864|0,N+=D>>>26,this.words[b]=D&67108863}return N!==0&&(this.words[b]=N,this.length++),this},a.prototype.muln=function(T){return this.clone().imuln(T)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(T){var N=h(T);if(N.length===0)return new a(1);for(var b=this,E=0;E<N.length&&N[E]===0;E++,b=b.sqr());if(++E<N.length)for(var D=b.sqr();E<N.length;E++,D=D.sqr())N[E]!==0&&(b=b.mul(D));return b},a.prototype.iushln=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26,E=67108863>>>26-N<<26-N,D;if(N!==0){var C=0;for(D=0;D<this.length;D++){var I=this.words[D]&E,O=(this.words[D]|0)-I<<N;this.words[D]=O|C,C=I>>>26-N}C&&(this.words[D]=C,this.length++)}if(b!==0){for(D=this.length-1;D>=0;D--)this.words[D+b]=this.words[D];for(D=0;D<b;D++)this.words[D]=0;this.length+=b}return this.strip()},a.prototype.ishln=function(T){return n(this.negative===0),this.iushln(T)},a.prototype.iushrn=function(T,N,b){n(typeof T=="number"&&T>=0);var E;N?E=(N-N%26)/26:E=0;var D=T%26,C=Math.min((T-D)/26,this.length),I=67108863^67108863>>>D<<D,O=b;if(E-=C,E=Math.max(0,E),O){for(var S=0;S<C;S++)O.words[S]=this.words[S];O.length=C}if(C!==0)if(this.length>C)for(this.length-=C,S=0;S<this.length;S++)this.words[S]=this.words[S+C];else this.words[0]=0,this.length=1;var P=0;for(S=this.length-1;S>=0&&(P!==0||S>=E);S--){var R=this.words[S]|0;this.words[S]=P<<26-D|R>>>D,P=R&I}return O&&P!==0&&(O.words[O.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(T,N,b){return n(this.negative===0),this.iushrn(T,N,b)},a.prototype.shln=function(T){return this.clone().ishln(T)},a.prototype.ushln=function(T){return this.clone().iushln(T)},a.prototype.shrn=function(T){return this.clone().ishrn(T)},a.prototype.ushrn=function(T){return this.clone().iushrn(T)},a.prototype.testn=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26,E=1<<N;if(this.length<=b)return!1;var D=this.words[b];return!!(D&E)},a.prototype.imaskn=function(T){n(typeof T=="number"&&T>=0);var N=T%26,b=(T-N)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(N!==0&&b++,this.length=Math.min(b,this.length),N!==0){var E=67108863^67108863>>>N<<N;this.words[this.length-1]&=E}return this.strip()},a.prototype.maskn=function(T){return this.clone().imaskn(T)},a.prototype.iaddn=function(T){return n(typeof T=="number"),n(T<67108864),T<0?this.isubn(-T):this.negative!==0?this.length===1&&(this.words[0]|0)<T?(this.words[0]=T-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(T),this.negative=1,this):this._iaddn(T)},a.prototype._iaddn=function(T){this.words[0]+=T;for(var N=0;N<this.length&&this.words[N]>=67108864;N++)this.words[N]-=67108864,N===this.length-1?this.words[N+1]=1:this.words[N+1]++;return this.length=Math.max(this.length,N+1),this},a.prototype.isubn=function(T){if(n(typeof T=="number"),n(T<67108864),T<0)return this.iaddn(-T);if(this.negative!==0)return this.negative=0,this.iaddn(T),this.negative=1,this;if(this.words[0]-=T,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var N=0;N<this.length&&this.words[N]<0;N++)this.words[N]+=67108864,this.words[N+1]-=1;return this.strip()},a.prototype.addn=function(T){return this.clone().iaddn(T)},a.prototype.subn=function(T){return this.clone().isubn(T)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(T,N,b){var E=T.length+b,D;this._expand(E);var C,I=0;for(D=0;D<T.length;D++){C=(this.words[D+b]|0)+I;var O=(T.words[D]|0)*N;C-=O&67108863,I=(C>>26)-(O/67108864|0),this.words[D+b]=C&67108863}for(;D<this.length-b;D++)C=(this.words[D+b]|0)+I,I=C>>26,this.words[D+b]=C&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,D=0;D<this.length;D++)C=-(this.words[D]|0)+I,I=C>>26,this.words[D]=C&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(T,N){var b=this.length-T.length,E=this.clone(),D=T,C=D.words[D.length-1]|0,I=this._countBits(C);b=26-I,b!==0&&(D=D.ushln(b),E.iushln(b),C=D.words[D.length-1]|0);var O=E.length-D.length,S;if(N!=="mod"){S=new a(null),S.length=O+1,S.words=new Array(S.length);for(var P=0;P<S.length;P++)S.words[P]=0}var R=E.clone()._ishlnsubmul(D,1,O);R.negative===0&&(E=R,S&&(S.words[O]=1));for(var L=O-1;L>=0;L--){var q=(E.words[D.length+L]|0)*67108864+(E.words[D.length+L-1]|0);for(q=Math.min(q/C|0,67108863),E._ishlnsubmul(D,q,L);E.negative!==0;)q--,E.negative=0,E._ishlnsubmul(D,1,L),E.isZero()||(E.negative^=1);S&&(S.words[L]=q)}return S&&S.strip(),E.strip(),N!=="div"&&b!==0&&E.iushrn(b),{div:S||null,mod:E}},a.prototype.divmod=function(T,N,b){if(n(!T.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var E,D,C;return this.negative!==0&&T.negative===0?(C=this.neg().divmod(T,N),N!=="mod"&&(E=C.div.neg()),N!=="div"&&(D=C.mod.neg(),b&&D.negative!==0&&D.iadd(T)),{div:E,mod:D}):this.negative===0&&T.negative!==0?(C=this.divmod(T.neg(),N),N!=="mod"&&(E=C.div.neg()),{div:E,mod:C.mod}):this.negative&T.negative?(C=this.neg().divmod(T.neg(),N),N!=="div"&&(D=C.mod.neg(),b&&D.negative!==0&&D.isub(T)),{div:C.div,mod:D}):T.length>this.length||this.cmp(T)<0?{div:new a(0),mod:this}:T.length===1?N==="div"?{div:this.divn(T.words[0]),mod:null}:N==="mod"?{div:null,mod:new a(this.modn(T.words[0]))}:{div:this.divn(T.words[0]),mod:new a(this.modn(T.words[0]))}:this._wordDiv(T,N)},a.prototype.div=function(T){return this.divmod(T,"div",!1).div},a.prototype.mod=function(T){return this.divmod(T,"mod",!1).mod},a.prototype.umod=function(T){return this.divmod(T,"mod",!0).mod},a.prototype.divRound=function(T){var N=this.divmod(T);if(N.mod.isZero())return N.div;var b=N.div.negative!==0?N.mod.isub(T):N.mod,E=T.ushrn(1),D=T.andln(1),C=b.cmp(E);return C<0||D===1&&C===0?N.div:N.div.negative!==0?N.div.isubn(1):N.div.iaddn(1)},a.prototype.modn=function(T){n(T<=67108863);for(var N=(1<<26)%T,b=0,E=this.length-1;E>=0;E--)b=(N*b+(this.words[E]|0))%T;return b},a.prototype.idivn=function(T){n(T<=67108863);for(var N=0,b=this.length-1;b>=0;b--){var E=(this.words[b]|0)+N*67108864;this.words[b]=E/T|0,N=E%T}return this.strip()},a.prototype.divn=function(T){return this.clone().idivn(T)},a.prototype.egcd=function(T){n(T.negative===0),n(!T.isZero());var N=this,b=T.clone();N.negative!==0?N=N.umod(T):N=N.clone();for(var E=new a(1),D=new a(0),C=new a(0),I=new a(1),O=0;N.isEven()&&b.isEven();)N.iushrn(1),b.iushrn(1),++O;for(var S=b.clone(),P=N.clone();!N.isZero();){for(var R=0,L=1;!(N.words[0]&L)&&R<26;++R,L<<=1);if(R>0)for(N.iushrn(R);R-- >0;)(E.isOdd()||D.isOdd())&&(E.iadd(S),D.isub(P)),E.iushrn(1),D.iushrn(1);for(var q=0,J=1;!(b.words[0]&J)&&q<26;++q,J<<=1);if(q>0)for(b.iushrn(q);q-- >0;)(C.isOdd()||I.isOdd())&&(C.iadd(S),I.isub(P)),C.iushrn(1),I.iushrn(1);N.cmp(b)>=0?(N.isub(b),E.isub(C),D.isub(I)):(b.isub(N),C.isub(E),I.isub(D))}return{a:C,b:I,gcd:b.iushln(O)}},a.prototype._invmp=function(T){n(T.negative===0),n(!T.isZero());var N=this,b=T.clone();N.negative!==0?N=N.umod(T):N=N.clone();for(var E=new a(1),D=new a(0),C=b.clone();N.cmpn(1)>0&&b.cmpn(1)>0;){for(var I=0,O=1;!(N.words[0]&O)&&I<26;++I,O<<=1);if(I>0)for(N.iushrn(I);I-- >0;)E.isOdd()&&E.iadd(C),E.iushrn(1);for(var S=0,P=1;!(b.words[0]&P)&&S<26;++S,P<<=1);if(S>0)for(b.iushrn(S);S-- >0;)D.isOdd()&&D.iadd(C),D.iushrn(1);N.cmp(b)>=0?(N.isub(b),E.isub(D)):(b.isub(N),D.isub(E))}var R;return N.cmpn(1)===0?R=E:R=D,R.cmpn(0)<0&&R.iadd(T),R},a.prototype.gcd=function(T){if(this.isZero())return T.abs();if(T.isZero())return this.abs();var N=this.clone(),b=T.clone();N.negative=0,b.negative=0;for(var E=0;N.isEven()&&b.isEven();E++)N.iushrn(1),b.iushrn(1);do{for(;N.isEven();)N.iushrn(1);for(;b.isEven();)b.iushrn(1);var D=N.cmp(b);if(D<0){var C=N;N=b,b=C}else if(D===0||b.cmpn(1)===0)break;N.isub(b)}while(!0);return b.iushln(E)},a.prototype.invm=function(T){return this.egcd(T).a.umod(T)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(T){return this.words[0]&T},a.prototype.bincn=function(T){n(typeof T=="number");var N=T%26,b=(T-N)/26,E=1<<N;if(this.length<=b)return this._expand(b+1),this.words[b]|=E,this;for(var D=E,C=b;D!==0&&C<this.length;C++){var I=this.words[C]|0;I+=D,D=I>>>26,I&=67108863,this.words[C]=I}return D!==0&&(this.words[C]=D,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(T){var N=T<0;if(this.negative!==0&&!N)return-1;if(this.negative===0&&N)return 1;this.strip();var b;if(this.length>1)b=1;else{N&&(T=-T),n(T<=67108863,"Number is too big");var E=this.words[0]|0;b=E===T?0:E<T?-1:1}return this.negative!==0?-b|0:b},a.prototype.cmp=function(T){if(this.negative!==0&&T.negative===0)return-1;if(this.negative===0&&T.negative!==0)return 1;var N=this.ucmp(T);return this.negative!==0?-N|0:N},a.prototype.ucmp=function(T){if(this.length>T.length)return 1;if(this.length<T.length)return-1;for(var N=0,b=this.length-1;b>=0;b--){var E=this.words[b]|0,D=T.words[b]|0;if(E!==D){E<D?N=-1:E>D&&(N=1);break}}return N},a.prototype.gtn=function(T){return this.cmpn(T)===1},a.prototype.gt=function(T){return this.cmp(T)===1},a.prototype.gten=function(T){return this.cmpn(T)>=0},a.prototype.gte=function(T){return this.cmp(T)>=0},a.prototype.ltn=function(T){return this.cmpn(T)===-1},a.prototype.lt=function(T){return this.cmp(T)===-1},a.prototype.lten=function(T){return this.cmpn(T)<=0},a.prototype.lte=function(T){return this.cmp(T)<=0},a.prototype.eqn=function(T){return this.cmpn(T)===0},a.prototype.eq=function(T){return this.cmp(T)===0},a.red=function(T){return new k(T)},a.prototype.toRed=function(T){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),T.convertTo(this)._forceRed(T)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(T){return this.red=T,this},a.prototype.forceRed=function(T){return n(!this.red,"Already a number in reduction context"),this._forceRed(T)},a.prototype.redAdd=function(T){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,T)},a.prototype.redIAdd=function(T){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,T)},a.prototype.redSub=function(T){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,T)},a.prototype.redISub=function(T){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,T)},a.prototype.redShl=function(T){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,T)},a.prototype.redMul=function(T){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.mul(this,T)},a.prototype.redIMul=function(T){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.imul(this,T)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(T){return n(this.red&&!T.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,T)};var w={k256:null,p224:null,p192:null,p25519:null};function x(T,N){this.name=T,this.p=new a(N,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}x.prototype._tmp=function(){var T=new a(null);return T.words=new Array(Math.ceil(this.n/13)),T},x.prototype.ireduce=function(T){var N=T,b;do this.split(N,this.tmp),N=this.imulK(N),N=N.iadd(this.tmp),b=N.bitLength();while(b>this.n);var E=b<this.n?-1:N.ucmp(this.p);return E===0?(N.words[0]=0,N.length=1):E>0?N.isub(this.p):N.strip!==void 0?N.strip():N._strip(),N},x.prototype.split=function(T,N){T.iushrn(this.n,0,N)},x.prototype.imulK=function(T){return T.imul(this.k)};function _(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(_,x),_.prototype.split=function(T,N){for(var b=4194303,E=Math.min(T.length,9),D=0;D<E;D++)N.words[D]=T.words[D];if(N.length=E,T.length<=9){T.words[0]=0,T.length=1;return}var C=T.words[9];for(N.words[N.length++]=C&b,D=10;D<T.length;D++){var I=T.words[D]|0;T.words[D-10]=(I&b)<<4|C>>>22,C=I}C>>>=22,T.words[D-10]=C,C===0&&T.length>10?T.length-=10:T.length-=9},_.prototype.imulK=function(T){T.words[T.length]=0,T.words[T.length+1]=0,T.length+=2;for(var N=0,b=0;b<T.length;b++){var E=T.words[b]|0;N+=E*977,T.words[b]=N&67108863,N=E*64+(N/67108864|0)}return T.words[T.length-1]===0&&(T.length--,T.words[T.length-1]===0&&T.length--),T};function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(A,x);function M(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(M,x);function F(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(F,x),F.prototype.imulK=function(T){for(var N=0,b=0;b<T.length;b++){var E=(T.words[b]|0)*19+N,D=E&67108863;E>>>=26,T.words[b]=D,N=E}return N!==0&&(T.words[T.length++]=N),T},a._prime=function(T){if(w[T])return w[T];var N;if(T==="k256")N=new _;else if(T==="p224")N=new A;else if(T==="p192")N=new M;else if(T==="p25519")N=new F;else throw new Error("Unknown prime "+T);return w[T]=N,N};function k(T){if(typeof T=="string"){var N=a._prime(T);this.m=N.p,this.prime=N}else n(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}k.prototype._verify1=function(T){n(T.negative===0,"red works only with positives"),n(T.red,"red works only with red numbers")},k.prototype._verify2=function(T,N){n((T.negative|N.negative)===0,"red works only with positives"),n(T.red&&T.red===N.red,"red works only with red numbers")},k.prototype.imod=function(T){return this.prime?this.prime.ireduce(T)._forceRed(this):T.umod(this.m)._forceRed(this)},k.prototype.neg=function(T){return T.isZero()?T.clone():this.m.sub(T)._forceRed(this)},k.prototype.add=function(T,N){this._verify2(T,N);var b=T.add(N);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},k.prototype.iadd=function(T,N){this._verify2(T,N);var b=T.iadd(N);return b.cmp(this.m)>=0&&b.isub(this.m),b},k.prototype.sub=function(T,N){this._verify2(T,N);var b=T.sub(N);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},k.prototype.isub=function(T,N){this._verify2(T,N);var b=T.isub(N);return b.cmpn(0)<0&&b.iadd(this.m),b},k.prototype.shl=function(T,N){return this._verify1(T),this.imod(T.ushln(N))},k.prototype.imul=function(T,N){return this._verify2(T,N),this.imod(T.imul(N))},k.prototype.mul=function(T,N){return this._verify2(T,N),this.imod(T.mul(N))},k.prototype.isqr=function(T){return this.imul(T,T.clone())},k.prototype.sqr=function(T){return this.mul(T,T)},k.prototype.sqrt=function(T){if(T.isZero())return T.clone();var N=this.m.andln(3);if(n(N%2===1),N===3){var b=this.m.add(new a(1)).iushrn(2);return this.pow(T,b)}for(var E=this.m.subn(1),D=0;!E.isZero()&&E.andln(1)===0;)D++,E.iushrn(1);n(!E.isZero());var C=new a(1).toRed(this),I=C.redNeg(),O=this.m.subn(1).iushrn(1),S=this.m.bitLength();for(S=new a(2*S*S).toRed(this);this.pow(S,O).cmp(I)!==0;)S.redIAdd(I);for(var P=this.pow(S,E),R=this.pow(T,E.addn(1).iushrn(1)),L=this.pow(T,E),q=D;L.cmp(C)!==0;){for(var J=L,G=0;J.cmp(C)!==0;G++)J=J.redSqr();n(G<q);var ie=this.pow(P,new a(1).iushln(q-G-1));R=R.redMul(ie),P=ie.redSqr(),L=L.redMul(P),q=G}return R},k.prototype.invm=function(T){var N=T._invmp(this.m);return N.negative!==0?(N.negative=0,this.imod(N).redNeg()):this.imod(N)},k.prototype.pow=function(T,N){if(N.isZero())return new a(1).toRed(this);if(N.cmpn(1)===0)return T.clone();var b=4,E=new Array(1<<b);E[0]=new a(1).toRed(this),E[1]=T;for(var D=2;D<E.length;D++)E[D]=this.mul(E[D-1],T);var C=E[0],I=0,O=0,S=N.bitLength()%26;for(S===0&&(S=26),D=N.length-1;D>=0;D--){for(var P=N.words[D],R=S-1;R>=0;R--){var L=P>>R&1;if(C!==E[0]&&(C=this.sqr(C)),L===0&&I===0){O=0;continue}I<<=1,I|=L,O++,!(O!==b&&(D!==0||R!==0))&&(C=this.mul(C,E[I]),O=0,I=0)}S=26}return C},k.prototype.convertTo=function(T){var N=T.umod(this.m);return N===T?N.clone():N},k.prototype.convertFrom=function(T){var N=T.clone();return N.red=null,N},a.mont=function(T){return new $(T)};function $(T){k.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i($,k),$.prototype.convertTo=function(T){return this.imod(T.ushln(this.shift))},$.prototype.convertFrom=function(T){var N=this.imod(T.mul(this.rinv));return N.red=null,N},$.prototype.imul=function(T,N){if(T.isZero()||N.isZero())return T.words[0]=0,T.length=1,T;var b=T.imul(N),E=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=b.isub(E).iushrn(this.shift),C=D;return D.cmp(this.m)>=0?C=D.isub(this.m):D.cmpn(0)<0&&(C=D.iadd(this.m)),C._forceRed(this)},$.prototype.mul=function(T,N){if(T.isZero()||N.isZero())return new a(0)._forceRed(this);var b=T.mul(N),E=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=b.isub(E).iushrn(this.shift),C=D;return D.cmp(this.m)>=0?C=D.isub(this.m):D.cmpn(0)<0&&(C=D.iadd(this.m)),C._forceRed(this)},$.prototype.invm=function(T){var N=this.imod(T._invmp(this.m).mul(this.r2));return N._forceRed(this)}})(t,DSe)}(S_)),S_.exports}var mm={exports:{}},TD;function lE(){if(TD)return mm.exports;TD=1;var t;mm.exports=function(n){return t||(t=new e(null)),t.generate(n)};function e(n){this.rand=n}if(mm.exports.Rand=e,e.prototype.generate=function(n){return this._rand(n)},e.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var i=new Uint8Array(n),a=0;a<i.length;a++)i[a]=this.rand.getByte();return i},typeof self=="object")self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(n){var i=new Uint8Array(n);return self.crypto.getRandomValues(i),i}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(n){var i=new Uint8Array(n);return self.msCrypto.getRandomValues(i),i}:typeof window=="object"&&(e.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=rj();if(typeof r.randomBytes!="function")throw new Error("Not supported");e.prototype._rand=function(n){return r.randomBytes(n)}}catch{}return mm.exports}var Iv,DD;function PL(){if(DD)return Iv;DD=1;var t=ei(),e=lE();function r(n){this.rand=n||new e.Rand}return Iv=r,r.create=function(n){return new r(n)},r.prototype._randbelow=function(n){var i=n.bitLength(),a=Math.ceil(i/8);do var s=new t(this.rand.generate(a));while(s.cmp(n)>=0);return s},r.prototype._randrange=function(n,i){var a=i.sub(n);return n.add(this._randbelow(a))},r.prototype.test=function(n,i,a){var s=n.bitLength(),o=t.mont(n),u=new t(1).toRed(o);i||(i=Math.max(1,s/48|0));for(var c=n.subn(1),l=0;!c.testn(l);l++);for(var d=n.shrn(l),f=c.toRed(o),h=!0;i>0;i--){var p=this._randrange(new t(2),c);a&&a(p);var m=p.toRed(o).redPow(d);if(!(m.cmp(u)===0||m.cmp(f)===0)){for(var y=1;y<l;y++){if(m=m.redSqr(),m.cmp(u)===0)return!1;if(m.cmp(f)===0)break}if(y===l)return!1}}return h},r.prototype.getDivisor=function(n,i){var a=n.bitLength(),s=t.mont(n),o=new t(1).toRed(s);i||(i=Math.max(1,a/48|0));for(var u=n.subn(1),c=0;!u.testn(c);c++);for(var l=n.shrn(c),d=u.toRed(s);i>0;i--){var f=this._randrange(new t(2),u),h=n.gcd(f);if(h.cmpn(1)!==0)return h;var p=f.toRed(s).redPow(l);if(!(p.cmp(o)===0||p.cmp(d)===0)){for(var m=1;m<c;m++){if(p=p.redSqr(),p.cmp(o)===0)return p.fromRed().subn(1).gcd(n);if(p.cmp(d)===0)break}if(m===c)return p=p.redSqr(),p.fromRed().subn(1).gcd(n)}}return!1},Iv}var Cv,AD;function BL(){if(AD)return Cv;AD=1;var t=ld();Cv=y,y.simpleSieve=p,y.fermatTest=m;var e=ei(),r=new e(24),n=PL(),i=new n,a=new e(1),s=new e(2),o=new e(5);new e(16),new e(8);var u=new e(10),c=new e(3);new e(7);var l=new e(11),d=new e(4);new e(12);var f=null;function h(){if(f!==null)return f;var g=1048576,v=[];v[0]=2;for(var w=1,x=3;x<g;x+=2){for(var _=Math.ceil(Math.sqrt(x)),A=0;A<w&&v[A]<=_&&x%v[A]!==0;A++);w!==A&&v[A]<=_||(v[w++]=x)}return f=v,v}function p(g){for(var v=h(),w=0;w<v.length;w++)if(g.modn(v[w])===0)return g.cmpn(v[w])===0;return!0}function m(g){var v=e.mont(g);return s.toRed(v).redPow(g.subn(1)).fromRed().cmpn(1)===0}function y(g,v){if(g<16)return v===2||v===5?new e([140,123]):new e([140,39]);v=new e(v);for(var w,x;;){for(w=new e(t(Math.ceil(g/8)));w.bitLength()>g;)w.ishrn(1);if(w.isEven()&&w.iadd(a),w.testn(1)||w.iadd(s),v.cmp(s)){if(!v.cmp(o))for(;w.mod(u).cmp(c);)w.iadd(d)}else for(;w.mod(r).cmp(l);)w.iadd(d);if(x=w.shrn(1),p(x)&&p(w)&&m(x)&&m(w)&&i.test(x)&&i.test(w))return w}}return Cv}const ASe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},NSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},ISe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},CSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},OSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},MSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},kSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},RSe={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},FSe={modp1:ASe,modp2:NSe,modp5:ISe,modp14:CSe,modp15:OSe,modp16:MSe,modp17:kSe,modp18:RSe};var Ov,ND;function PSe(){if(ND)return Ov;ND=1;var t=ei(),e=PL(),r=new e,n=new t(24),i=new t(11),a=new t(10),s=new t(3),o=new t(7),u=BL(),c=ld();Ov=p;function l(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this._pub=new t(y),this}function d(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this._priv=new t(y),this}var f={};function h(y,g){var v=g.toString("hex"),w=[v,y.toString(16)].join("_");if(w in f)return f[w];var x=0;if(y.isEven()||!u.simpleSieve||!u.fermatTest(y)||!r.test(y))return x+=1,v==="02"||v==="05"?x+=8:x+=4,f[w]=x,x;r.test(y.shrn(1))||(x+=2);var _;switch(v){case"02":y.mod(n).cmp(i)&&(x+=8);break;case"05":_=y.mod(a),_.cmp(s)&&_.cmp(o)&&(x+=8);break;default:x+=4}return f[w]=x,x}function p(y,g,v){this.setGenerator(g),this.__prime=new t(y),this._prime=t.mont(this.__prime),this._primeLen=y.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,v?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=h(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new t(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(y){y=new t(y),y=y.toRed(this._prime);var g=y.redPow(this._priv).fromRed(),v=new Buffer(g.toArray()),w=this.getPrime();if(v.length<w.length){var x=new Buffer(w.length-v.length);x.fill(0),v=Buffer.concat([x,v])}return v},p.prototype.getPublicKey=function(y){return m(this._pub,y)},p.prototype.getPrivateKey=function(y){return m(this._priv,y)},p.prototype.getPrime=function(y){return m(this.__prime,y)},p.prototype.getGenerator=function(y){return m(this._gen,y)},p.prototype.setGenerator=function(y,g){return g=g||"utf8",Buffer.isBuffer(y)||(y=new Buffer(y,g)),this.__gen=y,this._gen=new t(y),this};function m(y,g){var v=new Buffer(y.toArray());return g?v.toString(g):v}return Ov}var ID;function BSe(){if(ID)return fu;ID=1;var t=BL(),e=FSe,r=PSe();function n(s){var o=new Buffer(e[s].prime,"hex"),u=new Buffer(e[s].gen,"hex");return new r(o,u)}var i={binary:!0,hex:!0,base64:!0};function a(s,o,u,c){return Buffer.isBuffer(o)||i[o]===void 0?a(s,"binary",o,u):(o=o||"binary",c=c||"binary",u=u||new Buffer([2]),Buffer.isBuffer(u)||(u=new Buffer(u,c)),typeof s=="number"?new r(t(s,u),u,!0):(Buffer.isBuffer(s)||(s=new Buffer(s,o)),new r(s,u,!0)))}return fu.DiffieHellmanGroup=fu.createDiffieHellmanGroup=fu.getDiffieHellman=n,fu.createDiffieHellman=fu.DiffieHellman=a,fu}var Mv={exports:{}},gm={exports:{}},CD;function ky(){if(CD)return gm.exports;CD=1,typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?gm.exports={nextTick:t}:gm.exports=process;function t(e,r,n,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var a=arguments.length,s,o;switch(a){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,r)});case 3:return process.nextTick(function(){e.call(null,r,n)});case 4:return process.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o<s.length;)s[o++]=arguments[o];return process.nextTick(function(){e.apply(null,s)})}}return gm.exports}var kv,OD;function LSe(){if(OD)return kv;OD=1;var t={}.toString;return kv=Array.isArray||function(e){return t.call(e)=="[object Array]"},kv}var ym={exports:{}},MD;function LL(){if(MD)return ym.exports;MD=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(x,_,A){return Function.prototype.apply.call(x,_,A)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:r=function(x){return Object.getOwnPropertyNames(x)};function n(x){console&&console.warn&&console.warn(x)}var i=Number.isNaN||function(x){return x!==x};function a(){a.init.call(this)}ym.exports=a,ym.exports.once=g,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(x){if(typeof x!="number"||x<0||i(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");s=x}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||i(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function u(x){return x._maxListeners===void 0?a.defaultMaxListeners:x._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(x){for(var _=[],A=1;A<arguments.length;A++)_.push(arguments[A]);var M=x==="error",F=this._events;if(F!==void 0)M=M&&F.error===void 0;else if(!M)return!1;if(M){var k;if(_.length>0&&(k=_[0]),k instanceof Error)throw k;var $=new Error("Unhandled error."+(k?" ("+k.message+")":""));throw $.context=k,$}var T=F[x];if(T===void 0)return!1;if(typeof T=="function")e(T,this,_);else for(var N=T.length,b=p(T,N),A=0;A<N;++A)e(b[A],this,_);return!0};function c(x,_,A,M){var F,k,$;if(o(A),k=x._events,k===void 0?(k=x._events=Object.create(null),x._eventsCount=0):(k.newListener!==void 0&&(x.emit("newListener",_,A.listener?A.listener:A),k=x._events),$=k[_]),$===void 0)$=k[_]=A,++x._eventsCount;else if(typeof $=="function"?$=k[_]=M?[A,$]:[$,A]:M?$.unshift(A):$.push(A),F=u(x),F>0&&$.length>F&&!$.warned){$.warned=!0;var T=new Error("Possible EventEmitter memory leak detected. "+$.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");T.name="MaxListenersExceededWarning",T.emitter=x,T.type=_,T.count=$.length,n(T)}return x}a.prototype.addListener=function(x,_){return c(this,x,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(x,_){return c(this,x,_,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(x,_,A){var M={fired:!1,wrapFn:void 0,target:x,type:_,listener:A},F=l.bind(M);return F.listener=A,M.wrapFn=F,F}a.prototype.once=function(x,_){return o(_),this.on(x,d(this,x,_)),this},a.prototype.prependOnceListener=function(x,_){return o(_),this.prependListener(x,d(this,x,_)),this},a.prototype.removeListener=function(x,_){var A,M,F,k,$;if(o(_),M=this._events,M===void 0)return this;if(A=M[x],A===void 0)return this;if(A===_||A.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete M[x],M.removeListener&&this.emit("removeListener",x,A.listener||_));else if(typeof A!="function"){for(F=-1,k=A.length-1;k>=0;k--)if(A[k]===_||A[k].listener===_){$=A[k].listener,F=k;break}if(F<0)return this;F===0?A.shift():m(A,F),A.length===1&&(M[x]=A[0]),M.removeListener!==void 0&&this.emit("removeListener",x,$||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(x){var _,A,M;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[x]),this;if(arguments.length===0){var F=Object.keys(A),k;for(M=0;M<F.length;++M)k=F[M],k!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=A[x],typeof _=="function")this.removeListener(x,_);else if(_!==void 0)for(M=_.length-1;M>=0;M--)this.removeListener(x,_[M]);return this};function f(x,_,A){var M=x._events;if(M===void 0)return[];var F=M[_];return F===void 0?[]:typeof F=="function"?A?[F.listener||F]:[F]:A?y(F):p(F,F.length)}a.prototype.listeners=function(x){return f(this,x,!0)},a.prototype.rawListeners=function(x){return f(this,x,!1)},a.listenerCount=function(x,_){return typeof x.listenerCount=="function"?x.listenerCount(_):h.call(x,_)},a.prototype.listenerCount=h;function h(x){var _=this._events;if(_!==void 0){var A=_[x];if(typeof A=="function")return 1;if(A!==void 0)return A.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function p(x,_){for(var A=new Array(_),M=0;M<_;++M)A[M]=x[M];return A}function m(x,_){for(;_+1<x.length;_++)x[_]=x[_+1];x.pop()}function y(x){for(var _=new Array(x.length),A=0;A<_.length;++A)_[A]=x[A].listener||x[A];return _}function g(x,_){return new Promise(function(A,M){function F($){x.removeListener(_,k),M($)}function k(){typeof x.removeListener=="function"&&x.removeListener("error",F),A([].slice.call(arguments))}w(x,_,k,{once:!0}),_!=="error"&&v(x,F,{once:!0})})}function v(x,_,A){typeof x.on=="function"&&w(x,"error",_,A)}function w(x,_,A,M){if(typeof x.on=="function")M.once?x.once(_,A):x.on(_,A);else if(typeof x.addEventListener=="function")x.addEventListener(_,function F(k){M.once&&x.removeEventListener(_,F),A(k)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return ym.exports}var kD,RD;function jL(){return RD||(RD=1,kD=LL().EventEmitter),kD}var Rv={exports:{}},FD;function Ry(){return FD||(FD=1,function(t,e){var r=mc(),n=r.Buffer;function i(s,o){for(var u in s)o[u]=s[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=a);function a(s,o,u){return n(s,o,u)}i(n,a),a.from=function(s,o,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,o,u)},a.alloc=function(s,o,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=n(s);return o!==void 0?typeof u=="string"?c.fill(o,u):c.fill(o):c.fill(0),c},a.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},a.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}}(Rv,Rv.exports)),Rv.exports}var Vn={},PD;function pp(){if(PD)return Vn;PD=1;function t(m){return Array.isArray?Array.isArray(m):p(m)==="[object Array]"}Vn.isArray=t;function e(m){return typeof m=="boolean"}Vn.isBoolean=e;function r(m){return m===null}Vn.isNull=r;function n(m){return m==null}Vn.isNullOrUndefined=n;function i(m){return typeof m=="number"}Vn.isNumber=i;function a(m){return typeof m=="string"}Vn.isString=a;function s(m){return typeof m=="symbol"}Vn.isSymbol=s;function o(m){return m===void 0}Vn.isUndefined=o;function u(m){return p(m)==="[object RegExp]"}Vn.isRegExp=u;function c(m){return typeof m=="object"&&m!==null}Vn.isObject=c;function l(m){return p(m)==="[object Date]"}Vn.isDate=l;function d(m){return p(m)==="[object Error]"||m instanceof Error}Vn.isError=d;function f(m){return typeof m=="function"}Vn.isFunction=f;function h(m){return m===null||typeof m=="boolean"||typeof m=="number"||typeof m=="string"||typeof m=="symbol"||typeof m>"u"}Vn.isPrimitive=h,Vn.isBuffer=mc().Buffer.isBuffer;function p(m){return Object.prototype.toString.call(m)}return Vn}var BD={exports:{}},LD;function jSe(){return LD||(LD=1,function(t){function e(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}var r=Ry().Buffer,n=gc;function i(a,s,o){a.copy(s,o)}t.exports=function(){function a(){e(this,a),this.head=null,this.tail=null,this.length=0}return a.prototype.push=function(s){var o={data:s,next:null};this.length>0?this.tail.next=o:this.head=o,this.tail=o,++this.length},a.prototype.unshift=function(s){var o={data:s,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length},a.prototype.shift=function(){if(this.length!==0){var s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}},a.prototype.clear=function(){this.head=this.tail=null,this.length=0},a.prototype.join=function(s){if(this.length===0)return"";for(var o=this.head,u=""+o.data;o=o.next;)u+=s+o.data;return u},a.prototype.concat=function(s){if(this.length===0)return r.alloc(0);for(var o=r.allocUnsafe(s>>>0),u=this.head,c=0;u;)i(u.data,o,c),c+=u.data.length,u=u.next;return o},a}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var a=n.inspect({length:this.length});return this.constructor.name+" "+a})}(BD)),BD.exports}var Fv,jD;function $L(){if(jD)return Fv;jD=1;var t=ky();function e(i,a){var s=this,o=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return o||u?(a?a(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(n,this,i)):t.nextTick(n,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(c){!a&&c?s._writableState?s._writableState.errorEmitted||(s._writableState.errorEmitted=!0,t.nextTick(n,s,c)):t.nextTick(n,s,c):a&&a(c)}),this)}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function n(i,a){i.emit("error",a)}return Fv={destroy:e,undestroy:r},Fv}var Pv,$D;function $Se(){if($D)return Pv;$D=1,Pv=t;function t(r,n){if(e("noDeprecation"))return r;var i=!1;function a(){if(!i){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),i=!0}return r.apply(this,arguments)}return a}function e(r){try{if(!qr.localStorage)return!1}catch{return!1}var n=qr.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return Pv}var Bv,UD;function UL(){if(UD)return Bv;UD=1;var t=ky();Bv=m;function e(I){var O=this;this.next=null,this.entry=null,this.finish=function(){C(O,I)}}var r=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick,n;m.WritableState=h;var i=Object.create(pp());i.inherits=gr();var a={deprecate:$Se()},s=jL(),o=Ry().Buffer,u=(typeof qr<"u"?qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function c(I){return o.from(I)}function l(I){return o.isBuffer(I)||I instanceof u}var d=$L();i.inherits(m,s);function f(){}function h(I,O){n=n||$l(),I=I||{};var S=O instanceof n;this.objectMode=!!I.objectMode,S&&(this.objectMode=this.objectMode||!!I.writableObjectMode);var P=I.highWaterMark,R=I.writableHighWaterMark,L=this.objectMode?16:16*1024;P||P===0?this.highWaterMark=P:S&&(R||R===0)?this.highWaterMark=R:this.highWaterMark=L,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var q=I.decodeStrings===!1;this.decodeStrings=!q,this.defaultEncoding=I.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(J){M(O,J)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}h.prototype.getBuffer=function(){for(var I=this.bufferedRequest,O=[];I;)O.push(I),I=I.next;return O},function(){try{Object.defineProperty(h.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var p;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(I){return p.call(this,I)?!0:this!==m?!1:I&&I._writableState instanceof h}})):p=function(I){return I instanceof this};function m(I){if(n=n||$l(),!p.call(m,this)&&!(this instanceof n))return new m(I);this._writableState=new h(I,this),this.writable=!0,I&&(typeof I.write=="function"&&(this._write=I.write),typeof I.writev=="function"&&(this._writev=I.writev),typeof I.destroy=="function"&&(this._destroy=I.destroy),typeof I.final=="function"&&(this._final=I.final)),s.call(this)}m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function y(I,O){var S=new Error("write after end");I.emit("error",S),t.nextTick(O,S)}function g(I,O,S,P){var R=!0,L=!1;return S===null?L=new TypeError("May not write null values to stream"):typeof S!="string"&&S!==void 0&&!O.objectMode&&(L=new TypeError("Invalid non-string/buffer chunk")),L&&(I.emit("error",L),t.nextTick(P,L),R=!1),R}m.prototype.write=function(I,O,S){var P=this._writableState,R=!1,L=!P.objectMode&&l(I);return L&&!o.isBuffer(I)&&(I=c(I)),typeof O=="function"&&(S=O,O=null),L?O="buffer":O||(O=P.defaultEncoding),typeof S!="function"&&(S=f),P.ended?y(this,S):(L||g(this,P,I,S))&&(P.pendingcb++,R=w(this,P,L,I,O,S)),R},m.prototype.cork=function(){var I=this._writableState;I.corked++},m.prototype.uncork=function(){var I=this._writableState;I.corked&&(I.corked--,!I.writing&&!I.corked&&!I.bufferProcessing&&I.bufferedRequest&&$(this,I))},m.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+I);return this._writableState.defaultEncoding=I,this};function v(I,O,S){return!I.objectMode&&I.decodeStrings!==!1&&typeof O=="string"&&(O=o.from(O,S)),O}Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function w(I,O,S,P,R,L){if(!S){var q=v(O,P,R);P!==q&&(S=!0,R="buffer",P=q)}var J=O.objectMode?1:P.length;O.length+=J;var G=O.length<O.highWaterMark;if(G||(O.needDrain=!0),O.writing||O.corked){var ie=O.lastBufferedRequest;O.lastBufferedRequest={chunk:P,encoding:R,isBuf:S,callback:L,next:null},ie?ie.next=O.lastBufferedRequest:O.bufferedRequest=O.lastBufferedRequest,O.bufferedRequestCount+=1}else x(I,O,!1,J,P,R,L);return G}function x(I,O,S,P,R,L,q){O.writelen=P,O.writecb=q,O.writing=!0,O.sync=!0,S?I._writev(R,O.onwrite):I._write(R,L,O.onwrite),O.sync=!1}function _(I,O,S,P,R){--O.pendingcb,S?(t.nextTick(R,P),t.nextTick(E,I,O),I._writableState.errorEmitted=!0,I.emit("error",P)):(R(P),I._writableState.errorEmitted=!0,I.emit("error",P),E(I,O))}function A(I){I.writing=!1,I.writecb=null,I.length-=I.writelen,I.writelen=0}function M(I,O){var S=I._writableState,P=S.sync,R=S.writecb;if(A(S),O)_(I,S,P,O,R);else{var L=T(S);!L&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest&&$(I,S),P?r(F,I,S,L,R):F(I,S,L,R)}}function F(I,O,S,P){S||k(I,O),O.pendingcb--,P(),E(I,O)}function k(I,O){O.length===0&&O.needDrain&&(O.needDrain=!1,I.emit("drain"))}function $(I,O){O.bufferProcessing=!0;var S=O.bufferedRequest;if(I._writev&&S&&S.next){var P=O.bufferedRequestCount,R=new Array(P),L=O.corkedRequestsFree;L.entry=S;for(var q=0,J=!0;S;)R[q]=S,S.isBuf||(J=!1),S=S.next,q+=1;R.allBuffers=J,x(I,O,!0,O.length,R,"",L.finish),O.pendingcb++,O.lastBufferedRequest=null,L.next?(O.corkedRequestsFree=L.next,L.next=null):O.corkedRequestsFree=new e(O),O.bufferedRequestCount=0}else{for(;S;){var G=S.chunk,ie=S.encoding,z=S.callback,V=O.objectMode?1:G.length;if(x(I,O,!1,V,G,ie,z),S=S.next,O.bufferedRequestCount--,O.writing)break}S===null&&(O.lastBufferedRequest=null)}O.bufferedRequest=S,O.bufferProcessing=!1}m.prototype._write=function(I,O,S){S(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(I,O,S){var P=this._writableState;typeof I=="function"?(S=I,I=null,O=null):typeof O=="function"&&(S=O,O=null),I!=null&&this.write(I,O),P.corked&&(P.corked=1,this.uncork()),P.ending||D(this,P,S)};function T(I){return I.ending&&I.length===0&&I.bufferedRequest===null&&!I.finished&&!I.writing}function N(I,O){I._final(function(S){O.pendingcb--,S&&I.emit("error",S),O.prefinished=!0,I.emit("prefinish"),E(I,O)})}function b(I,O){!O.prefinished&&!O.finalCalled&&(typeof I._final=="function"?(O.pendingcb++,O.finalCalled=!0,t.nextTick(N,I,O)):(O.prefinished=!0,I.emit("prefinish")))}function E(I,O){var S=T(O);return S&&(b(I,O),O.pendingcb===0&&(O.finished=!0,I.emit("finish"))),S}function D(I,O,S){O.ending=!0,E(I,O),S&&(O.finished?t.nextTick(S):I.once("finish",S)),O.ended=!0,I.writable=!1}function C(I,O,S){var P=I.entry;for(I.entry=null;P;){var R=P.callback;O.pendingcb--,R(S),P=P.next}O.corkedRequestsFree.next=I}return Object.defineProperty(m.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(I,O){this.end(),O(I)},Bv}var Lv,zD;function $l(){if(zD)return Lv;zD=1;var t=ky(),e=Object.keys||function(d){var f=[];for(var h in d)f.push(h);return f};Lv=u;var r=Object.create(pp());r.inherits=gr();var n=zL(),i=UL();r.inherits(u,n);for(var a=e(i.prototype),s=0;s<a.length;s++){var o=a[s];u.prototype[o]||(u.prototype[o]=i.prototype[o])}function u(d){if(!(this instanceof u))return new u(d);n.call(this,d),i.call(this,d),d&&d.readable===!1&&(this.readable=!1),d&&d.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,d&&d.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",c)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(d){d.end()}return Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),u.prototype._destroy=function(d,f){this.push(null),this.end(),t.nextTick(f,d)},Lv}var jv={},qD;function VD(){if(qD)return jv;qD=1;var t=Ry().Buffer,e=t.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(g){if(!g)return"utf8";for(var v;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(v)return;g=(""+g).toLowerCase(),v=!0}}function n(g){var v=r(g);if(typeof v!="string"&&(t.isEncoding===e||!e(g)))throw new Error("Unknown encoding: "+g);return v||g}jv.StringDecoder=i;function i(g){this.encoding=n(g);var v;switch(this.encoding){case"utf16le":this.text=d,this.end=f,v=4;break;case"utf8":this.fillLast=u,v=4;break;case"base64":this.text=h,this.end=p,v=3;break;default:this.write=m,this.end=y;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}i.prototype.write=function(g){if(g.length===0)return"";var v,w;if(this.lastNeed){if(v=this.fillLast(g),v===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?v?v+this.text(g,w):this.text(g,w):v||""},i.prototype.end=l,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function a(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,v,w){var x=v.length-1;if(x<w)return 0;var _=a(v[x]);return _>=0?(_>0&&(g.lastNeed=_-1),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(g.lastNeed=_-2),_):--x<w||_===-2?0:(_=a(v[x]),_>=0?(_>0&&(_===2?_=0:g.lastNeed=_-3),_):0))}function o(g,v,w){if((v[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return g.lastNeed=2,"�"}}function u(g){var v=this.lastTotal-this.lastNeed,w=o(this,g);if(w!==void 0)return w;if(this.lastNeed<=g.length)return g.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,v,0,g.length),this.lastNeed-=g.length}function c(g,v){var w=s(this,g,v);if(!this.lastNeed)return g.toString("utf8",v);this.lastTotal=w;var x=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,x),g.toString("utf8",v,x)}function l(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+"�":v}function d(g,v){if((g.length-v)%2===0){var w=g.toString("utf16le",v);if(w){var x=w.charCodeAt(w.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",v,g.length-1)}function f(g){var v=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,w)}return v}function h(g,v){var w=(g.length-v)%3;return w===0?g.toString("base64",v):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",v,g.length-w))}function p(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function m(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}return jv}var $v,ZD;function zL(){if(ZD)return $v;ZD=1;var t=ky();$v=v;var e=LSe(),r;v.ReadableState=g,LL().EventEmitter;var n=function(z,V){return z.listeners(V).length},i=jL(),a=Ry().Buffer,s=(typeof qr<"u"?qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(z){return a.from(z)}function u(z){return a.isBuffer(z)||z instanceof s}var c=Object.create(pp());c.inherits=gr();var l=gc,d=void 0;l&&l.debuglog?d=l.debuglog("stream"):d=function(){};var f=jSe(),h=$L(),p;c.inherits(v,i);var m=["error","close","destroy","pause","resume"];function y(z,V,Q){if(typeof z.prependListener=="function")return z.prependListener(V,Q);!z._events||!z._events[V]?z.on(V,Q):e(z._events[V])?z._events[V].unshift(Q):z._events[V]=[Q,z._events[V]]}function g(z,V){r=r||$l(),z=z||{};var Q=V instanceof r;this.objectMode=!!z.objectMode,Q&&(this.objectMode=this.objectMode||!!z.readableObjectMode);var ae=z.highWaterMark,oe=z.readableHighWaterMark,le=this.objectMode?16:16*1024;ae||ae===0?this.highWaterMark=ae:Q&&(oe||oe===0)?this.highWaterMark=oe:this.highWaterMark=le,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=z.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,z.encoding&&(p||(p=VD().StringDecoder),this.decoder=new p(z.encoding),this.encoding=z.encoding)}function v(z){if(r=r||$l(),!(this instanceof v))return new v(z);this._readableState=new g(z,this),this.readable=!0,z&&(typeof z.read=="function"&&(this._read=z.read),typeof z.destroy=="function"&&(this._destroy=z.destroy)),i.call(this)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(z){this._readableState&&(this._readableState.destroyed=z)}}),v.prototype.destroy=h.destroy,v.prototype._undestroy=h.undestroy,v.prototype._destroy=function(z,V){this.push(null),V(z)},v.prototype.push=function(z,V){var Q=this._readableState,ae;return Q.objectMode?ae=!0:typeof z=="string"&&(V=V||Q.defaultEncoding,V!==Q.encoding&&(z=a.from(z,V),V=""),ae=!0),w(this,z,V,!1,ae)},v.prototype.unshift=function(z){return w(this,z,null,!0,!1)};function w(z,V,Q,ae,oe){var le=z._readableState;if(V===null)le.reading=!1,$(z,le);else{var he;oe||(he=_(le,V)),he?z.emit("error",he):le.objectMode||V&&V.length>0?(typeof V!="string"&&!le.objectMode&&Object.getPrototypeOf(V)!==a.prototype&&(V=o(V)),ae?le.endEmitted?z.emit("error",new Error("stream.unshift() after end event")):x(z,le,V,!0):le.ended?z.emit("error",new Error("stream.push() after EOF")):(le.reading=!1,le.decoder&&!Q?(V=le.decoder.write(V),le.objectMode||V.length!==0?x(z,le,V,!1):b(z,le)):x(z,le,V,!1))):ae||(le.reading=!1)}return A(le)}function x(z,V,Q,ae){V.flowing&&V.length===0&&!V.sync?(z.emit("data",Q),z.read(0)):(V.length+=V.objectMode?1:Q.length,ae?V.buffer.unshift(Q):V.buffer.push(Q),V.needReadable&&T(z)),b(z,V)}function _(z,V){var Q;return!u(V)&&typeof V!="string"&&V!==void 0&&!z.objectMode&&(Q=new TypeError("Invalid non-string/buffer chunk")),Q}function A(z){return!z.ended&&(z.needReadable||z.length<z.highWaterMark||z.length===0)}v.prototype.isPaused=function(){return this._readableState.flowing===!1},v.prototype.setEncoding=function(z){return p||(p=VD().StringDecoder),this._readableState.decoder=new p(z),this._readableState.encoding=z,this};var M=8388608;function F(z){return z>=M?z=M:(z--,z|=z>>>1,z|=z>>>2,z|=z>>>4,z|=z>>>8,z|=z>>>16,z++),z}function k(z,V){return z<=0||V.length===0&&V.ended?0:V.objectMode?1:z!==z?V.flowing&&V.length?V.buffer.head.data.length:V.length:(z>V.highWaterMark&&(V.highWaterMark=F(z)),z<=V.length?z:V.ended?V.length:(V.needReadable=!0,0))}v.prototype.read=function(z){d("read",z),z=parseInt(z,10);var V=this._readableState,Q=z;if(z!==0&&(V.emittedReadable=!1),z===0&&V.needReadable&&(V.length>=V.highWaterMark||V.ended))return d("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?J(this):T(this),null;if(z=k(z,V),z===0&&V.ended)return V.length===0&&J(this),null;var ae=V.needReadable;d("need readable",ae),(V.length===0||V.length-z<V.highWaterMark)&&(ae=!0,d("length less than watermark",ae)),V.ended||V.reading?(ae=!1,d("reading or ended",ae)):ae&&(d("do read"),V.reading=!0,V.sync=!0,V.length===0&&(V.needReadable=!0),this._read(V.highWaterMark),V.sync=!1,V.reading||(z=k(Q,V)));var oe;return z>0?oe=P(z,V):oe=null,oe===null?(V.needReadable=!0,z=0):V.length-=z,V.length===0&&(V.ended||(V.needReadable=!0),Q!==z&&V.ended&&J(this)),oe!==null&&this.emit("data",oe),oe};function $(z,V){if(!V.ended){if(V.decoder){var Q=V.decoder.end();Q&&Q.length&&(V.buffer.push(Q),V.length+=V.objectMode?1:Q.length)}V.ended=!0,T(z)}}function T(z){var V=z._readableState;V.needReadable=!1,V.emittedReadable||(d("emitReadable",V.flowing),V.emittedReadable=!0,V.sync?t.nextTick(N,z):N(z))}function N(z){d("emit readable"),z.emit("readable"),S(z)}function b(z,V){V.readingMore||(V.readingMore=!0,t.nextTick(E,z,V))}function E(z,V){for(var Q=V.length;!V.reading&&!V.flowing&&!V.ended&&V.length<V.highWaterMark&&(d("maybeReadMore read 0"),z.read(0),Q!==V.length);)Q=V.length;V.readingMore=!1}v.prototype._read=function(z){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(z,V){var Q=this,ae=this._readableState;switch(ae.pipesCount){case 0:ae.pipes=z;break;case 1:ae.pipes=[ae.pipes,z];break;default:ae.pipes.push(z);break}ae.pipesCount+=1,d("pipe count=%d opts=%j",ae.pipesCount,V);var oe=(!V||V.end!==!1)&&z!==process.stdout&&z!==process.stderr,le=oe?Z:Y;ae.endEmitted?t.nextTick(le):Q.once("end",le),z.on("unpipe",he);function he(re,ce){d("onunpipe"),re===Q&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,j())}function Z(){d("onend"),z.end()}var K=D(Q);z.on("drain",K);var B=!1;function j(){d("cleanup"),z.removeListener("close",te),z.removeListener("finish",ne),z.removeListener("drain",K),z.removeListener("error",ee),z.removeListener("unpipe",he),Q.removeListener("end",Z),Q.removeListener("end",Y),Q.removeListener("data",W),B=!0,ae.awaitDrain&&(!z._writableState||z._writableState.needDrain)&&K()}var U=!1;Q.on("data",W);function W(re){d("ondata"),U=!1;var ce=z.write(re);ce===!1&&!U&&((ae.pipesCount===1&&ae.pipes===z||ae.pipesCount>1&&ie(ae.pipes,z)!==-1)&&!B&&(d("false write response, pause",ae.awaitDrain),ae.awaitDrain++,U=!0),Q.pause())}function ee(re){d("onerror",re),Y(),z.removeListener("error",ee),n(z,"error")===0&&z.emit("error",re)}y(z,"error",ee);function te(){z.removeListener("finish",ne),Y()}z.once("close",te);function ne(){d("onfinish"),z.removeListener("close",te),Y()}z.once("finish",ne);function Y(){d("unpipe"),Q.unpipe(z)}return z.emit("pipe",Q),ae.flowing||(d("pipe resume"),Q.resume()),z};function D(z){return function(){var V=z._readableState;d("pipeOnDrain",V.awaitDrain),V.awaitDrain&&V.awaitDrain--,V.awaitDrain===0&&n(z,"data")&&(V.flowing=!0,S(z))}}v.prototype.unpipe=function(z){var V=this._readableState,Q={hasUnpiped:!1};if(V.pipesCount===0)return this;if(V.pipesCount===1)return z&&z!==V.pipes?this:(z||(z=V.pipes),V.pipes=null,V.pipesCount=0,V.flowing=!1,z&&z.emit("unpipe",this,Q),this);if(!z){var ae=V.pipes,oe=V.pipesCount;V.pipes=null,V.pipesCount=0,V.flowing=!1;for(var le=0;le<oe;le++)ae[le].emit("unpipe",this,{hasUnpiped:!1});return this}var he=ie(V.pipes,z);return he===-1?this:(V.pipes.splice(he,1),V.pipesCount-=1,V.pipesCount===1&&(V.pipes=V.pipes[0]),z.emit("unpipe",this,Q),this)},v.prototype.on=function(z,V){var Q=i.prototype.on.call(this,z,V);if(z==="data")this._readableState.flowing!==!1&&this.resume();else if(z==="readable"){var ae=this._readableState;!ae.endEmitted&&!ae.readableListening&&(ae.readableListening=ae.needReadable=!0,ae.emittedReadable=!1,ae.reading?ae.length&&T(this):t.nextTick(C,this))}return Q},v.prototype.addListener=v.prototype.on;function C(z){d("readable nexttick read 0"),z.read(0)}v.prototype.resume=function(){var z=this._readableState;return z.flowing||(d("resume"),z.flowing=!0,I(this,z)),this};function I(z,V){V.resumeScheduled||(V.resumeScheduled=!0,t.nextTick(O,z,V))}function O(z,V){V.reading||(d("resume read 0"),z.read(0)),V.resumeScheduled=!1,V.awaitDrain=0,z.emit("resume"),S(z),V.flowing&&!V.reading&&z.read(0)}v.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function S(z){var V=z._readableState;for(d("flow",V.flowing);V.flowing&&z.read()!==null;);}v.prototype.wrap=function(z){var V=this,Q=this._readableState,ae=!1;z.on("end",function(){if(d("wrapped end"),Q.decoder&&!Q.ended){var he=Q.decoder.end();he&&he.length&&V.push(he)}V.push(null)}),z.on("data",function(he){if(d("wrapped data"),Q.decoder&&(he=Q.decoder.write(he)),!(Q.objectMode&&he==null)&&!(!Q.objectMode&&(!he||!he.length))){var Z=V.push(he);Z||(ae=!0,z.pause())}});for(var oe in z)this[oe]===void 0&&typeof z[oe]=="function"&&(this[oe]=function(he){return function(){return z[he].apply(z,arguments)}}(oe));for(var le=0;le<m.length;le++)z.on(m[le],this.emit.bind(this,m[le]));return this._read=function(he){d("wrapped _read",he),ae&&(ae=!1,z.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=P;function P(z,V){if(V.length===0)return null;var Q;return V.objectMode?Q=V.buffer.shift():!z||z>=V.length?(V.decoder?Q=V.buffer.join(""):V.buffer.length===1?Q=V.buffer.head.data:Q=V.buffer.concat(V.length),V.buffer.clear()):Q=R(z,V.buffer,V.decoder),Q}function R(z,V,Q){var ae;return z<V.head.data.length?(ae=V.head.data.slice(0,z),V.head.data=V.head.data.slice(z)):z===V.head.data.length?ae=V.shift():ae=Q?L(z,V):q(z,V),ae}function L(z,V){var Q=V.head,ae=1,oe=Q.data;for(z-=oe.length;Q=Q.next;){var le=Q.data,he=z>le.length?le.length:z;if(he===le.length?oe+=le:oe+=le.slice(0,z),z-=he,z===0){he===le.length?(++ae,Q.next?V.head=Q.next:V.head=V.tail=null):(V.head=Q,Q.data=le.slice(he));break}++ae}return V.length-=ae,oe}function q(z,V){var Q=a.allocUnsafe(z),ae=V.head,oe=1;for(ae.data.copy(Q),z-=ae.data.length;ae=ae.next;){var le=ae.data,he=z>le.length?le.length:z;if(le.copy(Q,Q.length-z,0,he),z-=he,z===0){he===le.length?(++oe,ae.next?V.head=ae.next:V.head=V.tail=null):(V.head=ae,ae.data=le.slice(he));break}++oe}return V.length-=oe,Q}function J(z){var V=z._readableState;if(V.length>0)throw new Error('"endReadable()" called on non-empty stream');V.endEmitted||(V.ended=!0,t.nextTick(G,V,z))}function G(z,V){!z.endEmitted&&z.length===0&&(z.endEmitted=!0,V.readable=!1,V.emit("end"))}function ie(z,V){for(var Q=0,ae=z.length;Q<ae;Q++)if(z[Q]===V)return Q;return-1}return $v}var Uv,HD;function qL(){if(HD)return Uv;HD=1,Uv=n;var t=$l(),e=Object.create(pp());e.inherits=gr(),e.inherits(n,t);function r(s,o){var u=this._transformState;u.transforming=!1;var c=u.writecb;if(!c)return this.emit("error",new Error("write callback called multiple times"));u.writechunk=null,u.writecb=null,o!=null&&this.push(o),c(s);var l=this._readableState;l.reading=!1,(l.needReadable||l.length<l.highWaterMark)&&this._read(l.highWaterMark)}function n(s){if(!(this instanceof n))return new n(s);t.call(this,s),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,s&&(typeof s.transform=="function"&&(this._transform=s.transform),typeof s.flush=="function"&&(this._flush=s.flush)),this.on("prefinish",i)}function i(){var s=this;typeof this._flush=="function"?this._flush(function(o,u){a(s,o,u)}):a(this,null,null)}n.prototype.push=function(s,o){return this._transformState.needTransform=!1,t.prototype.push.call(this,s,o)},n.prototype._transform=function(s,o,u){throw new Error("_transform() is not implemented")},n.prototype._write=function(s,o,u){var c=this._transformState;if(c.writecb=u,c.writechunk=s,c.writeencoding=o,!c.transforming){var l=this._readableState;(c.needTransform||l.needReadable||l.length<l.highWaterMark)&&this._read(l.highWaterMark)}},n.prototype._read=function(s){var o=this._transformState;o.writechunk!==null&&o.writecb&&!o.transforming?(o.transforming=!0,this._transform(o.writechunk,o.writeencoding,o.afterTransform)):o.needTransform=!0},n.prototype._destroy=function(s,o){var u=this;t.prototype._destroy.call(this,s,function(c){o(c),u.emit("close")})};function a(s,o,u){if(o)return s.emit("error",o);if(u!=null&&s.push(u),s._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(s._transformState.transforming)throw new Error("Calling transform done when still transforming");return s.push(null)}return Uv}var zv,WD;function USe(){if(WD)return zv;WD=1,zv=r;var t=qL(),e=Object.create(pp());e.inherits=gr(),e.inherits(r,t);function r(n){if(!(this instanceof r))return new r(n);t.call(this,n)}return r.prototype._transform=function(n,i,a){a(null,n)},zv}var YD;function zSe(){return YD||(YD=1,function(t,e){e=t.exports=zL(),e.Stream=e,e.Readable=e,e.Writable=UL(),e.Duplex=$l(),e.Transform=qL(),e.PassThrough=USe()}(Mv,Mv.exports)),Mv.exports}var Dd={exports:{}},T_={exports:{}},qSe=T_.exports,JD;function dE(){return JD||(JD=1,function(t){(function(e,r){function n(b,E){if(!b)throw new Error(E||"Assertion failed")}function i(b,E){b.super_=E;var D=function(){};D.prototype=E.prototype,b.prototype=new D,b.prototype.constructor=b}function a(b,E,D){if(a.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((E==="le"||E==="be")&&(D=E,E=10),this._init(b||0,E||10,D||"be"))}typeof e=="object"?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=gc.Buffer}catch{}a.isBN=function(b){return b instanceof a?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===a.wordSize&&Array.isArray(b.words)},a.max=function(b,E){return b.cmp(E)>0?b:E},a.min=function(b,E){return b.cmp(E)<0?b:E},a.prototype._init=function(b,E,D){if(typeof b=="number")return this._initNumber(b,E,D);if(typeof b=="object")return this._initArray(b,E,D);E==="hex"&&(E=16),n(E===(E|0)&&E>=2&&E<=36),b=b.toString().replace(/\s+/g,"");var C=0;b[0]==="-"&&(C++,this.negative=1),C<b.length&&(E===16?this._parseHex(b,C,D):(this._parseBase(b,E,C),D==="le"&&this._initArray(this.toArray(),E,D)))},a.prototype._initNumber=function(b,E,D){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(n(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),D==="le"&&this._initArray(this.toArray(),E,D)},a.prototype._initArray=function(b,E,D){if(n(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var I,O,S=0;if(D==="be")for(C=b.length-1,I=0;C>=0;C-=3)O=b[C]|b[C-1]<<8|b[C-2]<<16,this.words[I]|=O<<S&67108863,this.words[I+1]=O>>>26-S&67108863,S+=24,S>=26&&(S-=26,I++);else if(D==="le")for(C=0,I=0;C<b.length;C+=3)O=b[C]|b[C+1]<<8|b[C+2]<<16,this.words[I]|=O<<S&67108863,this.words[I+1]=O>>>26-S&67108863,S+=24,S>=26&&(S-=26,I++);return this._strip()};function o(b,E){var D=b.charCodeAt(E);if(D>=48&&D<=57)return D-48;if(D>=65&&D<=70)return D-55;if(D>=97&&D<=102)return D-87;n(!1,"Invalid character in "+b)}function u(b,E,D){var C=o(b,D);return D-1>=E&&(C|=o(b,D-1)<<4),C}a.prototype._parseHex=function(b,E,D){this.length=Math.ceil((b.length-E)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var I=0,O=0,S;if(D==="be")for(C=b.length-1;C>=E;C-=2)S=u(b,E,C)<<I,this.words[O]|=S&67108863,I>=18?(I-=18,O+=1,this.words[O]|=S>>>26):I+=8;else{var P=b.length-E;for(C=P%2===0?E+1:E;C<b.length;C+=2)S=u(b,E,C)<<I,this.words[O]|=S&67108863,I>=18?(I-=18,O+=1,this.words[O]|=S>>>26):I+=8}this._strip()};function c(b,E,D,C){for(var I=0,O=0,S=Math.min(b.length,D),P=E;P<S;P++){var R=b.charCodeAt(P)-48;I*=C,R>=49?O=R-49+10:R>=17?O=R-17+10:O=R,n(R>=0&&O<C,"Invalid character"),I+=O}return I}a.prototype._parseBase=function(b,E,D){this.words=[0],this.length=1;for(var C=0,I=1;I<=67108863;I*=E)C++;C--,I=I/E|0;for(var O=b.length-D,S=O%C,P=Math.min(O,O-S)+D,R=0,L=D;L<P;L+=C)R=c(b,L,L+C,E),this.imuln(I),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R);if(S!==0){var q=1;for(R=c(b,L,b.length,E),L=0;L<S;L++)q*=E;this.imuln(q),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R)}this._strip()},a.prototype.copy=function(b){b.words=new Array(this.length);for(var E=0;E<this.length;E++)b.words[E]=this.words[E];b.length=this.length,b.negative=this.negative,b.red=this.red};function l(b,E){b.words=E.words,b.length=E.length,b.negative=E.negative,b.red=E.red}if(a.prototype._move=function(b){l(b,this)},a.prototype.clone=function(){var b=new a(null);return this.copy(b),b},a.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{a.prototype.inspect=d}else a.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(b,E){b=b||10,E=E|0||1;var D;if(b===16||b==="hex"){D="";for(var C=0,I=0,O=0;O<this.length;O++){var S=this.words[O],P=((S<<C|I)&16777215).toString(16);I=S>>>24-C&16777215,C+=2,C>=26&&(C-=26,O--),I!==0||O!==this.length-1?D=f[6-P.length]+P+D:D=P+D}for(I!==0&&(D=I.toString(16)+D);D.length%E!==0;)D="0"+D;return this.negative!==0&&(D="-"+D),D}if(b===(b|0)&&b>=2&&b<=36){var R=h[b],L=p[b];D="";var q=this.clone();for(q.negative=0;!q.isZero();){var J=q.modrn(L).toString(b);q=q.idivn(L),q.isZero()?D=J+D:D=f[R-J.length]+J+D}for(this.isZero()&&(D="0"+D);D.length%E!==0;)D="0"+D;return this.negative!==0&&(D="-"+D),D}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(b,E){return this.toArrayLike(s,b,E)}),a.prototype.toArray=function(b,E){return this.toArrayLike(Array,b,E)};var m=function(b,E){return b.allocUnsafe?b.allocUnsafe(E):new b(E)};a.prototype.toArrayLike=function(b,E,D){this._strip();var C=this.byteLength(),I=D||Math.max(1,C);n(C<=I,"byte array longer than desired length"),n(I>0,"Requested array length <= 0");var O=m(b,I),S=E==="le"?"LE":"BE";return this["_toArrayLike"+S](O,C),O},a.prototype._toArrayLikeLE=function(b,E){for(var D=0,C=0,I=0,O=0;I<this.length;I++){var S=this.words[I]<<O|C;b[D++]=S&255,D<b.length&&(b[D++]=S>>8&255),D<b.length&&(b[D++]=S>>16&255),O===6?(D<b.length&&(b[D++]=S>>24&255),C=0,O=0):(C=S>>>24,O+=2)}if(D<b.length)for(b[D++]=C;D<b.length;)b[D++]=0},a.prototype._toArrayLikeBE=function(b,E){for(var D=b.length-1,C=0,I=0,O=0;I<this.length;I++){var S=this.words[I]<<O|C;b[D--]=S&255,D>=0&&(b[D--]=S>>8&255),D>=0&&(b[D--]=S>>16&255),O===6?(D>=0&&(b[D--]=S>>24&255),C=0,O=0):(C=S>>>24,O+=2)}if(D>=0)for(b[D--]=C;D>=0;)b[D--]=0},Math.clz32?a.prototype._countBits=function(b){return 32-Math.clz32(b)}:a.prototype._countBits=function(b){var E=b,D=0;return E>=4096&&(D+=13,E>>>=13),E>=64&&(D+=7,E>>>=7),E>=8&&(D+=4,E>>>=4),E>=2&&(D+=2,E>>>=2),D+E},a.prototype._zeroBits=function(b){if(b===0)return 26;var E=b,D=0;return E&8191||(D+=13,E>>>=13),E&127||(D+=7,E>>>=7),E&15||(D+=4,E>>>=4),E&3||(D+=2,E>>>=2),E&1||D++,D},a.prototype.bitLength=function(){var b=this.words[this.length-1],E=this._countBits(b);return(this.length-1)*26+E};function y(b){for(var E=new Array(b.bitLength()),D=0;D<E.length;D++){var C=D/26|0,I=D%26;E[D]=b.words[C]>>>I&1}return E}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,E=0;E<this.length;E++){var D=this._zeroBits(this.words[E]);if(b+=D,D!==26)break}return b},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},a.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var E=0;E<b.length;E++)this.words[E]=this.words[E]|b.words[E];return this._strip()},a.prototype.ior=function(b){return n((this.negative|b.negative)===0),this.iuor(b)},a.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},a.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},a.prototype.iuand=function(b){var E;this.length>b.length?E=b:E=this;for(var D=0;D<E.length;D++)this.words[D]=this.words[D]&b.words[D];return this.length=E.length,this._strip()},a.prototype.iand=function(b){return n((this.negative|b.negative)===0),this.iuand(b)},a.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},a.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},a.prototype.iuxor=function(b){var E,D;this.length>b.length?(E=this,D=b):(E=b,D=this);for(var C=0;C<D.length;C++)this.words[C]=E.words[C]^D.words[C];if(this!==E)for(;C<E.length;C++)this.words[C]=E.words[C];return this.length=E.length,this._strip()},a.prototype.ixor=function(b){return n((this.negative|b.negative)===0),this.iuxor(b)},a.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},a.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},a.prototype.inotn=function(b){n(typeof b=="number"&&b>=0);var E=Math.ceil(b/26)|0,D=b%26;this._expand(E),D>0&&E--;for(var C=0;C<E;C++)this.words[C]=~this.words[C]&67108863;return D>0&&(this.words[C]=~this.words[C]&67108863>>26-D),this._strip()},a.prototype.notn=function(b){return this.clone().inotn(b)},a.prototype.setn=function(b,E){n(typeof b=="number"&&b>=0);var D=b/26|0,C=b%26;return this._expand(D+1),E?this.words[D]=this.words[D]|1<<C:this.words[D]=this.words[D]&~(1<<C),this._strip()},a.prototype.iadd=function(b){var E;if(this.negative!==0&&b.negative===0)return this.negative=0,E=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,E=this.isub(b),b.negative=1,E._normSign();var D,C;this.length>b.length?(D=this,C=b):(D=b,C=this);for(var I=0,O=0;O<C.length;O++)E=(D.words[O]|0)+(C.words[O]|0)+I,this.words[O]=E&67108863,I=E>>>26;for(;I!==0&&O<D.length;O++)E=(D.words[O]|0)+I,this.words[O]=E&67108863,I=E>>>26;if(this.length=D.length,I!==0)this.words[this.length]=I,this.length++;else if(D!==this)for(;O<D.length;O++)this.words[O]=D.words[O];return this},a.prototype.add=function(b){var E;return b.negative!==0&&this.negative===0?(b.negative=0,E=this.sub(b),b.negative^=1,E):b.negative===0&&this.negative!==0?(this.negative=0,E=b.sub(this),this.negative=1,E):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},a.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var E=this.iadd(b);return b.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var D=this.cmp(b);if(D===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,I;D>0?(C=this,I=b):(C=b,I=this);for(var O=0,S=0;S<I.length;S++)E=(C.words[S]|0)-(I.words[S]|0)+O,O=E>>26,this.words[S]=E&67108863;for(;O!==0&&S<C.length;S++)E=(C.words[S]|0)+O,O=E>>26,this.words[S]=E&67108863;if(O===0&&S<C.length&&C!==this)for(;S<C.length;S++)this.words[S]=C.words[S];return this.length=Math.max(this.length,S),C!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(b){return this.clone().isub(b)};function g(b,E,D){D.negative=E.negative^b.negative;var C=b.length+E.length|0;D.length=C,C=C-1|0;var I=b.words[0]|0,O=E.words[0]|0,S=I*O,P=S&67108863,R=S/67108864|0;D.words[0]=P;for(var L=1;L<C;L++){for(var q=R>>>26,J=R&67108863,G=Math.min(L,E.length-1),ie=Math.max(0,L-b.length+1);ie<=G;ie++){var z=L-ie|0;I=b.words[z]|0,O=E.words[ie]|0,S=I*O+J,q+=S/67108864|0,J=S&67108863}D.words[L]=J|0,R=q|0}return R!==0?D.words[L]=R|0:D.length--,D._strip()}var v=function(b,E,D){var C=b.words,I=E.words,O=D.words,S=0,P,R,L,q=C[0]|0,J=q&8191,G=q>>>13,ie=C[1]|0,z=ie&8191,V=ie>>>13,Q=C[2]|0,ae=Q&8191,oe=Q>>>13,le=C[3]|0,he=le&8191,Z=le>>>13,K=C[4]|0,B=K&8191,j=K>>>13,U=C[5]|0,W=U&8191,ee=U>>>13,te=C[6]|0,ne=te&8191,Y=te>>>13,re=C[7]|0,ce=re&8191,de=re>>>13,ve=C[8]|0,we=ve&8191,Ae=ve>>>13,Ne=C[9]|0,Pe=Ne&8191,Ce=Ne>>>13,Qe=I[0]|0,ft=Qe&8191,$e=Qe>>>13,Et=I[1]|0,H=Et&8191,pe=Et>>>13,Ee=I[2]|0,Oe=Ee&8191,je=Ee>>>13,it=I[3]|0,jt=it&8191,Ft=it>>>13,Br=I[4]|0,Or=Br&8191,Mt=Br>>>13,jr=I[5]|0,$r=jr&8191,me=jr>>>13,be=I[6]|0,De=be&8191,Ie=be>>>13,Ze=I[7]|0,tt=Ze&8191,Ye=Ze>>>13,We=I[8]|0,Je=We&8191,Be=We>>>13,rt=I[9]|0,ht=rt&8191,gt=rt>>>13;D.negative=b.negative^E.negative,D.length=19,P=Math.imul(J,ft),R=Math.imul(J,$e),R=R+Math.imul(G,ft)|0,L=Math.imul(G,$e);var Ur=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,P=Math.imul(z,ft),R=Math.imul(z,$e),R=R+Math.imul(V,ft)|0,L=Math.imul(V,$e),P=P+Math.imul(J,H)|0,R=R+Math.imul(J,pe)|0,R=R+Math.imul(G,H)|0,L=L+Math.imul(G,pe)|0;var fr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(fr>>>26)|0,fr&=67108863,P=Math.imul(ae,ft),R=Math.imul(ae,$e),R=R+Math.imul(oe,ft)|0,L=Math.imul(oe,$e),P=P+Math.imul(z,H)|0,R=R+Math.imul(z,pe)|0,R=R+Math.imul(V,H)|0,L=L+Math.imul(V,pe)|0,P=P+Math.imul(J,Oe)|0,R=R+Math.imul(J,je)|0,R=R+Math.imul(G,Oe)|0,L=L+Math.imul(G,je)|0;var Jt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,P=Math.imul(he,ft),R=Math.imul(he,$e),R=R+Math.imul(Z,ft)|0,L=Math.imul(Z,$e),P=P+Math.imul(ae,H)|0,R=R+Math.imul(ae,pe)|0,R=R+Math.imul(oe,H)|0,L=L+Math.imul(oe,pe)|0,P=P+Math.imul(z,Oe)|0,R=R+Math.imul(z,je)|0,R=R+Math.imul(V,Oe)|0,L=L+Math.imul(V,je)|0,P=P+Math.imul(J,jt)|0,R=R+Math.imul(J,Ft)|0,R=R+Math.imul(G,jt)|0,L=L+Math.imul(G,Ft)|0;var Sr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,P=Math.imul(B,ft),R=Math.imul(B,$e),R=R+Math.imul(j,ft)|0,L=Math.imul(j,$e),P=P+Math.imul(he,H)|0,R=R+Math.imul(he,pe)|0,R=R+Math.imul(Z,H)|0,L=L+Math.imul(Z,pe)|0,P=P+Math.imul(ae,Oe)|0,R=R+Math.imul(ae,je)|0,R=R+Math.imul(oe,Oe)|0,L=L+Math.imul(oe,je)|0,P=P+Math.imul(z,jt)|0,R=R+Math.imul(z,Ft)|0,R=R+Math.imul(V,jt)|0,L=L+Math.imul(V,Ft)|0,P=P+Math.imul(J,Or)|0,R=R+Math.imul(J,Mt)|0,R=R+Math.imul(G,Or)|0,L=L+Math.imul(G,Mt)|0;var Fn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,P=Math.imul(W,ft),R=Math.imul(W,$e),R=R+Math.imul(ee,ft)|0,L=Math.imul(ee,$e),P=P+Math.imul(B,H)|0,R=R+Math.imul(B,pe)|0,R=R+Math.imul(j,H)|0,L=L+Math.imul(j,pe)|0,P=P+Math.imul(he,Oe)|0,R=R+Math.imul(he,je)|0,R=R+Math.imul(Z,Oe)|0,L=L+Math.imul(Z,je)|0,P=P+Math.imul(ae,jt)|0,R=R+Math.imul(ae,Ft)|0,R=R+Math.imul(oe,jt)|0,L=L+Math.imul(oe,Ft)|0,P=P+Math.imul(z,Or)|0,R=R+Math.imul(z,Mt)|0,R=R+Math.imul(V,Or)|0,L=L+Math.imul(V,Mt)|0,P=P+Math.imul(J,$r)|0,R=R+Math.imul(J,me)|0,R=R+Math.imul(G,$r)|0,L=L+Math.imul(G,me)|0;var zn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(zn>>>26)|0,zn&=67108863,P=Math.imul(ne,ft),R=Math.imul(ne,$e),R=R+Math.imul(Y,ft)|0,L=Math.imul(Y,$e),P=P+Math.imul(W,H)|0,R=R+Math.imul(W,pe)|0,R=R+Math.imul(ee,H)|0,L=L+Math.imul(ee,pe)|0,P=P+Math.imul(B,Oe)|0,R=R+Math.imul(B,je)|0,R=R+Math.imul(j,Oe)|0,L=L+Math.imul(j,je)|0,P=P+Math.imul(he,jt)|0,R=R+Math.imul(he,Ft)|0,R=R+Math.imul(Z,jt)|0,L=L+Math.imul(Z,Ft)|0,P=P+Math.imul(ae,Or)|0,R=R+Math.imul(ae,Mt)|0,R=R+Math.imul(oe,Or)|0,L=L+Math.imul(oe,Mt)|0,P=P+Math.imul(z,$r)|0,R=R+Math.imul(z,me)|0,R=R+Math.imul(V,$r)|0,L=L+Math.imul(V,me)|0,P=P+Math.imul(J,De)|0,R=R+Math.imul(J,Ie)|0,R=R+Math.imul(G,De)|0,L=L+Math.imul(G,Ie)|0;var bn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(bn>>>26)|0,bn&=67108863,P=Math.imul(ce,ft),R=Math.imul(ce,$e),R=R+Math.imul(de,ft)|0,L=Math.imul(de,$e),P=P+Math.imul(ne,H)|0,R=R+Math.imul(ne,pe)|0,R=R+Math.imul(Y,H)|0,L=L+Math.imul(Y,pe)|0,P=P+Math.imul(W,Oe)|0,R=R+Math.imul(W,je)|0,R=R+Math.imul(ee,Oe)|0,L=L+Math.imul(ee,je)|0,P=P+Math.imul(B,jt)|0,R=R+Math.imul(B,Ft)|0,R=R+Math.imul(j,jt)|0,L=L+Math.imul(j,Ft)|0,P=P+Math.imul(he,Or)|0,R=R+Math.imul(he,Mt)|0,R=R+Math.imul(Z,Or)|0,L=L+Math.imul(Z,Mt)|0,P=P+Math.imul(ae,$r)|0,R=R+Math.imul(ae,me)|0,R=R+Math.imul(oe,$r)|0,L=L+Math.imul(oe,me)|0,P=P+Math.imul(z,De)|0,R=R+Math.imul(z,Ie)|0,R=R+Math.imul(V,De)|0,L=L+Math.imul(V,Ie)|0,P=P+Math.imul(J,tt)|0,R=R+Math.imul(J,Ye)|0,R=R+Math.imul(G,tt)|0,L=L+Math.imul(G,Ye)|0;var Qr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,P=Math.imul(we,ft),R=Math.imul(we,$e),R=R+Math.imul(Ae,ft)|0,L=Math.imul(Ae,$e),P=P+Math.imul(ce,H)|0,R=R+Math.imul(ce,pe)|0,R=R+Math.imul(de,H)|0,L=L+Math.imul(de,pe)|0,P=P+Math.imul(ne,Oe)|0,R=R+Math.imul(ne,je)|0,R=R+Math.imul(Y,Oe)|0,L=L+Math.imul(Y,je)|0,P=P+Math.imul(W,jt)|0,R=R+Math.imul(W,Ft)|0,R=R+Math.imul(ee,jt)|0,L=L+Math.imul(ee,Ft)|0,P=P+Math.imul(B,Or)|0,R=R+Math.imul(B,Mt)|0,R=R+Math.imul(j,Or)|0,L=L+Math.imul(j,Mt)|0,P=P+Math.imul(he,$r)|0,R=R+Math.imul(he,me)|0,R=R+Math.imul(Z,$r)|0,L=L+Math.imul(Z,me)|0,P=P+Math.imul(ae,De)|0,R=R+Math.imul(ae,Ie)|0,R=R+Math.imul(oe,De)|0,L=L+Math.imul(oe,Ie)|0,P=P+Math.imul(z,tt)|0,R=R+Math.imul(z,Ye)|0,R=R+Math.imul(V,tt)|0,L=L+Math.imul(V,Ye)|0,P=P+Math.imul(J,Je)|0,R=R+Math.imul(J,Be)|0,R=R+Math.imul(G,Je)|0,L=L+Math.imul(G,Be)|0;var kt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(kt>>>26)|0,kt&=67108863,P=Math.imul(Pe,ft),R=Math.imul(Pe,$e),R=R+Math.imul(Ce,ft)|0,L=Math.imul(Ce,$e),P=P+Math.imul(we,H)|0,R=R+Math.imul(we,pe)|0,R=R+Math.imul(Ae,H)|0,L=L+Math.imul(Ae,pe)|0,P=P+Math.imul(ce,Oe)|0,R=R+Math.imul(ce,je)|0,R=R+Math.imul(de,Oe)|0,L=L+Math.imul(de,je)|0,P=P+Math.imul(ne,jt)|0,R=R+Math.imul(ne,Ft)|0,R=R+Math.imul(Y,jt)|0,L=L+Math.imul(Y,Ft)|0,P=P+Math.imul(W,Or)|0,R=R+Math.imul(W,Mt)|0,R=R+Math.imul(ee,Or)|0,L=L+Math.imul(ee,Mt)|0,P=P+Math.imul(B,$r)|0,R=R+Math.imul(B,me)|0,R=R+Math.imul(j,$r)|0,L=L+Math.imul(j,me)|0,P=P+Math.imul(he,De)|0,R=R+Math.imul(he,Ie)|0,R=R+Math.imul(Z,De)|0,L=L+Math.imul(Z,Ie)|0,P=P+Math.imul(ae,tt)|0,R=R+Math.imul(ae,Ye)|0,R=R+Math.imul(oe,tt)|0,L=L+Math.imul(oe,Ye)|0,P=P+Math.imul(z,Je)|0,R=R+Math.imul(z,Be)|0,R=R+Math.imul(V,Je)|0,L=L+Math.imul(V,Be)|0,P=P+Math.imul(J,ht)|0,R=R+Math.imul(J,gt)|0,R=R+Math.imul(G,ht)|0,L=L+Math.imul(G,gt)|0;var rn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(rn>>>26)|0,rn&=67108863,P=Math.imul(Pe,H),R=Math.imul(Pe,pe),R=R+Math.imul(Ce,H)|0,L=Math.imul(Ce,pe),P=P+Math.imul(we,Oe)|0,R=R+Math.imul(we,je)|0,R=R+Math.imul(Ae,Oe)|0,L=L+Math.imul(Ae,je)|0,P=P+Math.imul(ce,jt)|0,R=R+Math.imul(ce,Ft)|0,R=R+Math.imul(de,jt)|0,L=L+Math.imul(de,Ft)|0,P=P+Math.imul(ne,Or)|0,R=R+Math.imul(ne,Mt)|0,R=R+Math.imul(Y,Or)|0,L=L+Math.imul(Y,Mt)|0,P=P+Math.imul(W,$r)|0,R=R+Math.imul(W,me)|0,R=R+Math.imul(ee,$r)|0,L=L+Math.imul(ee,me)|0,P=P+Math.imul(B,De)|0,R=R+Math.imul(B,Ie)|0,R=R+Math.imul(j,De)|0,L=L+Math.imul(j,Ie)|0,P=P+Math.imul(he,tt)|0,R=R+Math.imul(he,Ye)|0,R=R+Math.imul(Z,tt)|0,L=L+Math.imul(Z,Ye)|0,P=P+Math.imul(ae,Je)|0,R=R+Math.imul(ae,Be)|0,R=R+Math.imul(oe,Je)|0,L=L+Math.imul(oe,Be)|0,P=P+Math.imul(z,ht)|0,R=R+Math.imul(z,gt)|0,R=R+Math.imul(V,ht)|0,L=L+Math.imul(V,gt)|0;var un=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(un>>>26)|0,un&=67108863,P=Math.imul(Pe,Oe),R=Math.imul(Pe,je),R=R+Math.imul(Ce,Oe)|0,L=Math.imul(Ce,je),P=P+Math.imul(we,jt)|0,R=R+Math.imul(we,Ft)|0,R=R+Math.imul(Ae,jt)|0,L=L+Math.imul(Ae,Ft)|0,P=P+Math.imul(ce,Or)|0,R=R+Math.imul(ce,Mt)|0,R=R+Math.imul(de,Or)|0,L=L+Math.imul(de,Mt)|0,P=P+Math.imul(ne,$r)|0,R=R+Math.imul(ne,me)|0,R=R+Math.imul(Y,$r)|0,L=L+Math.imul(Y,me)|0,P=P+Math.imul(W,De)|0,R=R+Math.imul(W,Ie)|0,R=R+Math.imul(ee,De)|0,L=L+Math.imul(ee,Ie)|0,P=P+Math.imul(B,tt)|0,R=R+Math.imul(B,Ye)|0,R=R+Math.imul(j,tt)|0,L=L+Math.imul(j,Ye)|0,P=P+Math.imul(he,Je)|0,R=R+Math.imul(he,Be)|0,R=R+Math.imul(Z,Je)|0,L=L+Math.imul(Z,Be)|0,P=P+Math.imul(ae,ht)|0,R=R+Math.imul(ae,gt)|0,R=R+Math.imul(oe,ht)|0,L=L+Math.imul(oe,gt)|0;var Dn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,P=Math.imul(Pe,jt),R=Math.imul(Pe,Ft),R=R+Math.imul(Ce,jt)|0,L=Math.imul(Ce,Ft),P=P+Math.imul(we,Or)|0,R=R+Math.imul(we,Mt)|0,R=R+Math.imul(Ae,Or)|0,L=L+Math.imul(Ae,Mt)|0,P=P+Math.imul(ce,$r)|0,R=R+Math.imul(ce,me)|0,R=R+Math.imul(de,$r)|0,L=L+Math.imul(de,me)|0,P=P+Math.imul(ne,De)|0,R=R+Math.imul(ne,Ie)|0,R=R+Math.imul(Y,De)|0,L=L+Math.imul(Y,Ie)|0,P=P+Math.imul(W,tt)|0,R=R+Math.imul(W,Ye)|0,R=R+Math.imul(ee,tt)|0,L=L+Math.imul(ee,Ye)|0,P=P+Math.imul(B,Je)|0,R=R+Math.imul(B,Be)|0,R=R+Math.imul(j,Je)|0,L=L+Math.imul(j,Be)|0,P=P+Math.imul(he,ht)|0,R=R+Math.imul(he,gt)|0,R=R+Math.imul(Z,ht)|0,L=L+Math.imul(Z,gt)|0;var fn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(fn>>>26)|0,fn&=67108863,P=Math.imul(Pe,Or),R=Math.imul(Pe,Mt),R=R+Math.imul(Ce,Or)|0,L=Math.imul(Ce,Mt),P=P+Math.imul(we,$r)|0,R=R+Math.imul(we,me)|0,R=R+Math.imul(Ae,$r)|0,L=L+Math.imul(Ae,me)|0,P=P+Math.imul(ce,De)|0,R=R+Math.imul(ce,Ie)|0,R=R+Math.imul(de,De)|0,L=L+Math.imul(de,Ie)|0,P=P+Math.imul(ne,tt)|0,R=R+Math.imul(ne,Ye)|0,R=R+Math.imul(Y,tt)|0,L=L+Math.imul(Y,Ye)|0,P=P+Math.imul(W,Je)|0,R=R+Math.imul(W,Be)|0,R=R+Math.imul(ee,Je)|0,L=L+Math.imul(ee,Be)|0,P=P+Math.imul(B,ht)|0,R=R+Math.imul(B,gt)|0,R=R+Math.imul(j,ht)|0,L=L+Math.imul(j,gt)|0;var Zt=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,P=Math.imul(Pe,$r),R=Math.imul(Pe,me),R=R+Math.imul(Ce,$r)|0,L=Math.imul(Ce,me),P=P+Math.imul(we,De)|0,R=R+Math.imul(we,Ie)|0,R=R+Math.imul(Ae,De)|0,L=L+Math.imul(Ae,Ie)|0,P=P+Math.imul(ce,tt)|0,R=R+Math.imul(ce,Ye)|0,R=R+Math.imul(de,tt)|0,L=L+Math.imul(de,Ye)|0,P=P+Math.imul(ne,Je)|0,R=R+Math.imul(ne,Be)|0,R=R+Math.imul(Y,Je)|0,L=L+Math.imul(Y,Be)|0,P=P+Math.imul(W,ht)|0,R=R+Math.imul(W,gt)|0,R=R+Math.imul(ee,ht)|0,L=L+Math.imul(ee,gt)|0;var Mr=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,P=Math.imul(Pe,De),R=Math.imul(Pe,Ie),R=R+Math.imul(Ce,De)|0,L=Math.imul(Ce,Ie),P=P+Math.imul(we,tt)|0,R=R+Math.imul(we,Ye)|0,R=R+Math.imul(Ae,tt)|0,L=L+Math.imul(Ae,Ye)|0,P=P+Math.imul(ce,Je)|0,R=R+Math.imul(ce,Be)|0,R=R+Math.imul(de,Je)|0,L=L+Math.imul(de,Be)|0,P=P+Math.imul(ne,ht)|0,R=R+Math.imul(ne,gt)|0,R=R+Math.imul(Y,ht)|0,L=L+Math.imul(Y,gt)|0;var ti=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(ti>>>26)|0,ti&=67108863,P=Math.imul(Pe,tt),R=Math.imul(Pe,Ye),R=R+Math.imul(Ce,tt)|0,L=Math.imul(Ce,Ye),P=P+Math.imul(we,Je)|0,R=R+Math.imul(we,Be)|0,R=R+Math.imul(Ae,Je)|0,L=L+Math.imul(Ae,Be)|0,P=P+Math.imul(ce,ht)|0,R=R+Math.imul(ce,gt)|0,R=R+Math.imul(de,ht)|0,L=L+Math.imul(de,gt)|0;var qn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(qn>>>26)|0,qn&=67108863,P=Math.imul(Pe,Je),R=Math.imul(Pe,Be),R=R+Math.imul(Ce,Je)|0,L=Math.imul(Ce,Be),P=P+Math.imul(we,ht)|0,R=R+Math.imul(we,gt)|0,R=R+Math.imul(Ae,ht)|0,L=L+Math.imul(Ae,gt)|0;var nn=(S+P|0)+((R&8191)<<13)|0;S=(L+(R>>>13)|0)+(nn>>>26)|0,nn&=67108863,P=Math.imul(Pe,ht),R=Math.imul(Pe,gt),R=R+Math.imul(Ce,ht)|0,L=Math.imul(Ce,gt);var Ji=(S+P|0)+((R&8191)<<13)|0;return S=(L+(R>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,O[0]=Ur,O[1]=fr,O[2]=Jt,O[3]=Sr,O[4]=Fn,O[5]=zn,O[6]=bn,O[7]=Qr,O[8]=kt,O[9]=rn,O[10]=un,O[11]=Dn,O[12]=fn,O[13]=Zt,O[14]=Mr,O[15]=ti,O[16]=qn,O[17]=nn,O[18]=Ji,S!==0&&(O[19]=S,D.length++),D};Math.imul||(v=g);function w(b,E,D){D.negative=E.negative^b.negative,D.length=b.length+E.length;for(var C=0,I=0,O=0;O<D.length-1;O++){var S=I;I=0;for(var P=C&67108863,R=Math.min(O,E.length-1),L=Math.max(0,O-b.length+1);L<=R;L++){var q=O-L,J=b.words[q]|0,G=E.words[L]|0,ie=J*G,z=ie&67108863;S=S+(ie/67108864|0)|0,z=z+P|0,P=z&67108863,S=S+(z>>>26)|0,I+=S>>>26,S&=67108863}D.words[O]=P,C=S,S=I}return C!==0?D.words[O]=C:D.length--,D._strip()}function x(b,E,D){return w(b,E,D)}a.prototype.mulTo=function(b,E){var D,C=this.length+b.length;return this.length===10&&b.length===10?D=v(this,b,E):C<63?D=g(this,b,E):C<1024?D=w(this,b,E):D=x(this,b,E),D},a.prototype.mul=function(b){var E=new a(null);return E.words=new Array(this.length+b.length),this.mulTo(b,E)},a.prototype.mulf=function(b){var E=new a(null);return E.words=new Array(this.length+b.length),x(this,b,E)},a.prototype.imul=function(b){return this.clone().mulTo(b,this)},a.prototype.imuln=function(b){var E=b<0;E&&(b=-b),n(typeof b=="number"),n(b<67108864);for(var D=0,C=0;C<this.length;C++){var I=(this.words[C]|0)*b,O=(I&67108863)+(D&67108863);D>>=26,D+=I/67108864|0,D+=O>>>26,this.words[C]=O&67108863}return D!==0&&(this.words[C]=D,this.length++),E?this.ineg():this},a.prototype.muln=function(b){return this.clone().imuln(b)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(b){var E=y(b);if(E.length===0)return new a(1);for(var D=this,C=0;C<E.length&&E[C]===0;C++,D=D.sqr());if(++C<E.length)for(var I=D.sqr();C<E.length;C++,I=I.sqr())E[C]!==0&&(D=D.mul(I));return D},a.prototype.iushln=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26,C=67108863>>>26-E<<26-E,I;if(E!==0){var O=0;for(I=0;I<this.length;I++){var S=this.words[I]&C,P=(this.words[I]|0)-S<<E;this.words[I]=P|O,O=S>>>26-E}O&&(this.words[I]=O,this.length++)}if(D!==0){for(I=this.length-1;I>=0;I--)this.words[I+D]=this.words[I];for(I=0;I<D;I++)this.words[I]=0;this.length+=D}return this._strip()},a.prototype.ishln=function(b){return n(this.negative===0),this.iushln(b)},a.prototype.iushrn=function(b,E,D){n(typeof b=="number"&&b>=0);var C;E?C=(E-E%26)/26:C=0;var I=b%26,O=Math.min((b-I)/26,this.length),S=67108863^67108863>>>I<<I,P=D;if(C-=O,C=Math.max(0,C),P){for(var R=0;R<O;R++)P.words[R]=this.words[R];P.length=O}if(O!==0)if(this.length>O)for(this.length-=O,R=0;R<this.length;R++)this.words[R]=this.words[R+O];else this.words[0]=0,this.length=1;var L=0;for(R=this.length-1;R>=0&&(L!==0||R>=C);R--){var q=this.words[R]|0;this.words[R]=L<<26-I|q>>>I,L=q&S}return P&&L!==0&&(P.words[P.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(b,E,D){return n(this.negative===0),this.iushrn(b,E,D)},a.prototype.shln=function(b){return this.clone().ishln(b)},a.prototype.ushln=function(b){return this.clone().iushln(b)},a.prototype.shrn=function(b){return this.clone().ishrn(b)},a.prototype.ushrn=function(b){return this.clone().iushrn(b)},a.prototype.testn=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26,C=1<<E;if(this.length<=D)return!1;var I=this.words[D];return!!(I&C)},a.prototype.imaskn=function(b){n(typeof b=="number"&&b>=0);var E=b%26,D=(b-E)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=D)return this;if(E!==0&&D++,this.length=Math.min(D,this.length),E!==0){var C=67108863^67108863>>>E<<E;this.words[this.length-1]&=C}return this._strip()},a.prototype.maskn=function(b){return this.clone().imaskn(b)},a.prototype.iaddn=function(b){return n(typeof b=="number"),n(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<=b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},a.prototype._iaddn=function(b){this.words[0]+=b;for(var E=0;E<this.length&&this.words[E]>=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},a.prototype.isubn=function(b){if(n(typeof b=="number"),n(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E<this.length&&this.words[E]<0;E++)this.words[E]+=67108864,this.words[E+1]-=1;return this._strip()},a.prototype.addn=function(b){return this.clone().iaddn(b)},a.prototype.subn=function(b){return this.clone().isubn(b)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(b,E,D){var C=b.length+D,I;this._expand(C);var O,S=0;for(I=0;I<b.length;I++){O=(this.words[I+D]|0)+S;var P=(b.words[I]|0)*E;O-=P&67108863,S=(O>>26)-(P/67108864|0),this.words[I+D]=O&67108863}for(;I<this.length-D;I++)O=(this.words[I+D]|0)+S,S=O>>26,this.words[I+D]=O&67108863;if(S===0)return this._strip();for(n(S===-1),S=0,I=0;I<this.length;I++)O=-(this.words[I]|0)+S,S=O>>26,this.words[I]=O&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(b,E){var D=this.length-b.length,C=this.clone(),I=b,O=I.words[I.length-1]|0,S=this._countBits(O);D=26-S,D!==0&&(I=I.ushln(D),C.iushln(D),O=I.words[I.length-1]|0);var P=C.length-I.length,R;if(E!=="mod"){R=new a(null),R.length=P+1,R.words=new Array(R.length);for(var L=0;L<R.length;L++)R.words[L]=0}var q=C.clone()._ishlnsubmul(I,1,P);q.negative===0&&(C=q,R&&(R.words[P]=1));for(var J=P-1;J>=0;J--){var G=(C.words[I.length+J]|0)*67108864+(C.words[I.length+J-1]|0);for(G=Math.min(G/O|0,67108863),C._ishlnsubmul(I,G,J);C.negative!==0;)G--,C.negative=0,C._ishlnsubmul(I,1,J),C.isZero()||(C.negative^=1);R&&(R.words[J]=G)}return R&&R._strip(),C._strip(),E!=="div"&&D!==0&&C.iushrn(D),{div:R||null,mod:C}},a.prototype.divmod=function(b,E,D){if(n(!b.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var C,I,O;return this.negative!==0&&b.negative===0?(O=this.neg().divmod(b,E),E!=="mod"&&(C=O.div.neg()),E!=="div"&&(I=O.mod.neg(),D&&I.negative!==0&&I.iadd(b)),{div:C,mod:I}):this.negative===0&&b.negative!==0?(O=this.divmod(b.neg(),E),E!=="mod"&&(C=O.div.neg()),{div:C,mod:O.mod}):this.negative&b.negative?(O=this.neg().divmod(b.neg(),E),E!=="div"&&(I=O.mod.neg(),D&&I.negative!==0&&I.isub(b)),{div:O.div,mod:I}):b.length>this.length||this.cmp(b)<0?{div:new a(0),mod:this}:b.length===1?E==="div"?{div:this.divn(b.words[0]),mod:null}:E==="mod"?{div:null,mod:new a(this.modrn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new a(this.modrn(b.words[0]))}:this._wordDiv(b,E)},a.prototype.div=function(b){return this.divmod(b,"div",!1).div},a.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},a.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},a.prototype.divRound=function(b){var E=this.divmod(b);if(E.mod.isZero())return E.div;var D=E.div.negative!==0?E.mod.isub(b):E.mod,C=b.ushrn(1),I=b.andln(1),O=D.cmp(C);return O<0||I===1&&O===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},a.prototype.modrn=function(b){var E=b<0;E&&(b=-b),n(b<=67108863);for(var D=(1<<26)%b,C=0,I=this.length-1;I>=0;I--)C=(D*C+(this.words[I]|0))%b;return E?-C:C},a.prototype.modn=function(b){return this.modrn(b)},a.prototype.idivn=function(b){var E=b<0;E&&(b=-b),n(b<=67108863);for(var D=0,C=this.length-1;C>=0;C--){var I=(this.words[C]|0)+D*67108864;this.words[C]=I/b|0,D=I%b}return this._strip(),E?this.ineg():this},a.prototype.divn=function(b){return this.clone().idivn(b)},a.prototype.egcd=function(b){n(b.negative===0),n(!b.isZero());var E=this,D=b.clone();E.negative!==0?E=E.umod(b):E=E.clone();for(var C=new a(1),I=new a(0),O=new a(0),S=new a(1),P=0;E.isEven()&&D.isEven();)E.iushrn(1),D.iushrn(1),++P;for(var R=D.clone(),L=E.clone();!E.isZero();){for(var q=0,J=1;!(E.words[0]&J)&&q<26;++q,J<<=1);if(q>0)for(E.iushrn(q);q-- >0;)(C.isOdd()||I.isOdd())&&(C.iadd(R),I.isub(L)),C.iushrn(1),I.iushrn(1);for(var G=0,ie=1;!(D.words[0]&ie)&&G<26;++G,ie<<=1);if(G>0)for(D.iushrn(G);G-- >0;)(O.isOdd()||S.isOdd())&&(O.iadd(R),S.isub(L)),O.iushrn(1),S.iushrn(1);E.cmp(D)>=0?(E.isub(D),C.isub(O),I.isub(S)):(D.isub(E),O.isub(C),S.isub(I))}return{a:O,b:S,gcd:D.iushln(P)}},a.prototype._invmp=function(b){n(b.negative===0),n(!b.isZero());var E=this,D=b.clone();E.negative!==0?E=E.umod(b):E=E.clone();for(var C=new a(1),I=new a(0),O=D.clone();E.cmpn(1)>0&&D.cmpn(1)>0;){for(var S=0,P=1;!(E.words[0]&P)&&S<26;++S,P<<=1);if(S>0)for(E.iushrn(S);S-- >0;)C.isOdd()&&C.iadd(O),C.iushrn(1);for(var R=0,L=1;!(D.words[0]&L)&&R<26;++R,L<<=1);if(R>0)for(D.iushrn(R);R-- >0;)I.isOdd()&&I.iadd(O),I.iushrn(1);E.cmp(D)>=0?(E.isub(D),C.isub(I)):(D.isub(E),I.isub(C))}var q;return E.cmpn(1)===0?q=C:q=I,q.cmpn(0)<0&&q.iadd(b),q},a.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var E=this.clone(),D=b.clone();E.negative=0,D.negative=0;for(var C=0;E.isEven()&&D.isEven();C++)E.iushrn(1),D.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;D.isEven();)D.iushrn(1);var I=E.cmp(D);if(I<0){var O=E;E=D,D=O}else if(I===0||D.cmpn(1)===0)break;E.isub(D)}while(!0);return D.iushln(C)},a.prototype.invm=function(b){return this.egcd(b).a.umod(b)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(b){return this.words[0]&b},a.prototype.bincn=function(b){n(typeof b=="number");var E=b%26,D=(b-E)/26,C=1<<E;if(this.length<=D)return this._expand(D+1),this.words[D]|=C,this;for(var I=C,O=D;I!==0&&O<this.length;O++){var S=this.words[O]|0;S+=I,I=S>>>26,S&=67108863,this.words[O]=S}return I!==0&&(this.words[O]=I,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(b){var E=b<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var D;if(this.length>1)D=1;else{E&&(b=-b),n(b<=67108863,"Number is too big");var C=this.words[0]|0;D=C===b?0:C<b?-1:1}return this.negative!==0?-D|0:D},a.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var E=this.ucmp(b);return this.negative!==0?-E|0:E},a.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var E=0,D=this.length-1;D>=0;D--){var C=this.words[D]|0,I=b.words[D]|0;if(C!==I){C<I?E=-1:C>I&&(E=1);break}}return E},a.prototype.gtn=function(b){return this.cmpn(b)===1},a.prototype.gt=function(b){return this.cmp(b)===1},a.prototype.gten=function(b){return this.cmpn(b)>=0},a.prototype.gte=function(b){return this.cmp(b)>=0},a.prototype.ltn=function(b){return this.cmpn(b)===-1},a.prototype.lt=function(b){return this.cmp(b)===-1},a.prototype.lten=function(b){return this.cmpn(b)<=0},a.prototype.lte=function(b){return this.cmp(b)<=0},a.prototype.eqn=function(b){return this.cmpn(b)===0},a.prototype.eq=function(b){return this.cmp(b)===0},a.red=function(b){return new T(b)},a.prototype.toRed=function(b){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(b){return this.red=b,this},a.prototype.forceRed=function(b){return n(!this.red,"Already a number in reduction context"),this._forceRed(b)},a.prototype.redAdd=function(b){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},a.prototype.redIAdd=function(b){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},a.prototype.redSub=function(b){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},a.prototype.redISub=function(b){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},a.prototype.redShl=function(b){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},a.prototype.redMul=function(b){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},a.prototype.redIMul=function(b){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(b){return n(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var _={k256:null,p224:null,p192:null,p25519:null};function A(b,E){this.name=b,this.p=new a(E,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}A.prototype._tmp=function(){var b=new a(null);return b.words=new Array(Math.ceil(this.n/13)),b},A.prototype.ireduce=function(b){var E=b,D;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),D=E.bitLength();while(D>this.n);var C=D<this.n?-1:E.ucmp(this.p);return C===0?(E.words[0]=0,E.length=1):C>0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},A.prototype.split=function(b,E){b.iushrn(this.n,0,E)},A.prototype.imulK=function(b){return b.imul(this.k)};function M(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(M,A),M.prototype.split=function(b,E){for(var D=4194303,C=Math.min(b.length,9),I=0;I<C;I++)E.words[I]=b.words[I];if(E.length=C,b.length<=9){b.words[0]=0,b.length=1;return}var O=b.words[9];for(E.words[E.length++]=O&D,I=10;I<b.length;I++){var S=b.words[I]|0;b.words[I-10]=(S&D)<<4|O>>>22,O=S}O>>>=22,b.words[I-10]=O,O===0&&b.length>10?b.length-=10:b.length-=9},M.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var E=0,D=0;D<b.length;D++){var C=b.words[D]|0;E+=C*977,b.words[D]=E&67108863,E=C*64+(E/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function F(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(F,A);function k(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(k,A);function $(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i($,A),$.prototype.imulK=function(b){for(var E=0,D=0;D<b.length;D++){var C=(b.words[D]|0)*19+E,I=C&67108863;C>>>=26,b.words[D]=I,E=C}return E!==0&&(b.words[b.length++]=E),b},a._prime=function(b){if(_[b])return _[b];var E;if(b==="k256")E=new M;else if(b==="p224")E=new F;else if(b==="p192")E=new k;else if(b==="p25519")E=new $;else throw new Error("Unknown prime "+b);return _[b]=E,E};function T(b){if(typeof b=="string"){var E=a._prime(b);this.m=E.p,this.prime=E}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}T.prototype._verify1=function(b){n(b.negative===0,"red works only with positives"),n(b.red,"red works only with red numbers")},T.prototype._verify2=function(b,E){n((b.negative|E.negative)===0,"red works only with positives"),n(b.red&&b.red===E.red,"red works only with red numbers")},T.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):(l(b,b.umod(this.m)._forceRed(this)),b)},T.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},T.prototype.add=function(b,E){this._verify2(b,E);var D=b.add(E);return D.cmp(this.m)>=0&&D.isub(this.m),D._forceRed(this)},T.prototype.iadd=function(b,E){this._verify2(b,E);var D=b.iadd(E);return D.cmp(this.m)>=0&&D.isub(this.m),D},T.prototype.sub=function(b,E){this._verify2(b,E);var D=b.sub(E);return D.cmpn(0)<0&&D.iadd(this.m),D._forceRed(this)},T.prototype.isub=function(b,E){this._verify2(b,E);var D=b.isub(E);return D.cmpn(0)<0&&D.iadd(this.m),D},T.prototype.shl=function(b,E){return this._verify1(b),this.imod(b.ushln(E))},T.prototype.imul=function(b,E){return this._verify2(b,E),this.imod(b.imul(E))},T.prototype.mul=function(b,E){return this._verify2(b,E),this.imod(b.mul(E))},T.prototype.isqr=function(b){return this.imul(b,b.clone())},T.prototype.sqr=function(b){return this.mul(b,b)},T.prototype.sqrt=function(b){if(b.isZero())return b.clone();var E=this.m.andln(3);if(n(E%2===1),E===3){var D=this.m.add(new a(1)).iushrn(2);return this.pow(b,D)}for(var C=this.m.subn(1),I=0;!C.isZero()&&C.andln(1)===0;)I++,C.iushrn(1);n(!C.isZero());var O=new a(1).toRed(this),S=O.redNeg(),P=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new a(2*R*R).toRed(this);this.pow(R,P).cmp(S)!==0;)R.redIAdd(S);for(var L=this.pow(R,C),q=this.pow(b,C.addn(1).iushrn(1)),J=this.pow(b,C),G=I;J.cmp(O)!==0;){for(var ie=J,z=0;ie.cmp(O)!==0;z++)ie=ie.redSqr();n(z<G);var V=this.pow(L,new a(1).iushln(G-z-1));q=q.redMul(V),L=V.redSqr(),J=J.redMul(L),G=z}return q},T.prototype.invm=function(b){var E=b._invmp(this.m);return E.negative!==0?(E.negative=0,this.imod(E).redNeg()):this.imod(E)},T.prototype.pow=function(b,E){if(E.isZero())return new a(1).toRed(this);if(E.cmpn(1)===0)return b.clone();var D=4,C=new Array(1<<D);C[0]=new a(1).toRed(this),C[1]=b;for(var I=2;I<C.length;I++)C[I]=this.mul(C[I-1],b);var O=C[0],S=0,P=0,R=E.bitLength()%26;for(R===0&&(R=26),I=E.length-1;I>=0;I--){for(var L=E.words[I],q=R-1;q>=0;q--){var J=L>>q&1;if(O!==C[0]&&(O=this.sqr(O)),J===0&&S===0){P=0;continue}S<<=1,S|=J,P++,!(P!==D&&(I!==0||q!==0))&&(O=this.mul(O,C[S]),P=0,S=0)}R=26}return O},T.prototype.convertTo=function(b){var E=b.umod(this.m);return E===b?E.clone():E},T.prototype.convertFrom=function(b){var E=b.clone();return E.red=null,E},a.mont=function(b){return new N(b)};function N(b){T.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(N,T),N.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},N.prototype.convertFrom=function(b){var E=this.imod(b.mul(this.rinv));return E.red=null,E},N.prototype.imul=function(b,E){if(b.isZero()||E.isZero())return b.words[0]=0,b.length=1,b;var D=b.imul(E),C=D.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=D.isub(C).iushrn(this.shift),O=I;return I.cmp(this.m)>=0?O=I.isub(this.m):I.cmpn(0)<0&&(O=I.iadd(this.m)),O._forceRed(this)},N.prototype.mul=function(b,E){if(b.isZero()||E.isZero())return new a(0)._forceRed(this);var D=b.mul(E),C=D.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=D.isub(C).iushrn(this.shift),O=I;return I.cmp(this.m)>=0?O=I.isub(this.m):I.cmpn(0)<0&&(O=I.iadd(this.m)),O._forceRed(this)},N.prototype.invm=function(b){var E=this.imod(b._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(t,qSe)}(T_)),T_.exports}var qv,KD;function fE(){if(KD)return qv;KD=1;var t=dE(),e=ld(),r=ur().Buffer;function n(s){var o=s.modulus.byteLength(),u;do u=new t(e(o));while(u.cmp(s.modulus)>=0||!u.umod(s.prime1)||!u.umod(s.prime2));return u}function i(s){var o=n(s),u=o.toRed(t.mont(s.modulus)).redPow(new t(s.publicExponent)).fromRed();return{blinder:u,unblinder:o.invm(s.modulus)}}function a(s,o){var u=i(o),c=o.modulus.byteLength(),l=new t(s).mul(u.blinder).umod(o.modulus),d=l.toRed(t.mont(o.prime1)),f=l.toRed(t.mont(o.prime2)),h=o.coefficient,p=o.prime1,m=o.prime2,y=d.redPow(o.exponent1).fromRed(),g=f.redPow(o.exponent2).fromRed(),v=y.isub(g).imul(h).umod(p).imul(m);return g.iadd(v).imul(u.unblinder).umod(o.modulus).toArrayLike(r,"be",c)}return a.getr=n,qv=a,qv}var GD={};const VSe="elliptic",ZSe="6.6.1",HSe="EC cryptography",WSe="lib/elliptic.js",YSe=["lib"],JSe={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},KSe={type:"git",url:"git@github.com:indutny/elliptic"},GSe=["EC","Elliptic","curve","Cryptography"],XSe="Fedor Indutny <fedor@indutny.com>",QSe="MIT",e3e={url:"https://github.com/indutny/elliptic/issues"},t3e="https://github.com/indutny/elliptic",r3e={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},n3e={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},i3e={name:VSe,version:ZSe,description:HSe,main:WSe,files:YSe,scripts:JSe,repository:KSe,keywords:GSe,author:XSe,license:QSe,bugs:e3e,homepage:t3e,devDependencies:r3e,dependencies:n3e};var XD={},QD={},eA;function VL(){return eA||(eA=1,function(t){var e=t;function r(a,s){if(Array.isArray(a))return a.slice();if(!a)return[];var o=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)o[u]=a[u]|0;return o}if(s==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)o.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var c=a.charCodeAt(u),l=c>>8,d=c&255;l?o.push(l,d):o.push(d)}return o}e.toArray=r;function n(a){return a.length===1?"0"+a:a}e.zero2=n;function i(a){for(var s="",o=0;o<a.length;o++)s+=n(a[o].toString(16));return s}e.toHex=i,e.encode=function(a,s){return s==="hex"?i(a):a}}(QD)),QD}var tA;function pa(){return tA||(tA=1,function(t){var e=t,r=ei(),n=ha(),i=VL();e.assert=n,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode;function a(l,d,f){var h=new Array(Math.max(l.bitLength(),f)+1),p;for(p=0;p<h.length;p+=1)h[p]=0;var m=1<<d+1,y=l.clone();for(p=0;p<h.length;p++){var g,v=y.andln(m-1);y.isOdd()?(v>(m>>1)-1?g=(m>>1)-v:g=v,y.isubn(g)):g=0,h[p]=g,y.iushrn(1)}return h}e.getNAF=a;function s(l,d){var f=[[],[]];l=l.clone(),d=d.clone();for(var h=0,p=0,m;l.cmpn(-h)>0||d.cmpn(-p)>0;){var y=l.andln(3)+h&3,g=d.andln(3)+p&3;y===3&&(y=-1),g===3&&(g=-1);var v;y&1?(m=l.andln(7)+h&7,(m===3||m===5)&&g===2?v=-y:v=y):v=0,f[0].push(v);var w;g&1?(m=d.andln(7)+p&7,(m===3||m===5)&&y===2?w=-g:w=g):w=0,f[1].push(w),2*h===v+1&&(h=1-h),2*p===w+1&&(p=1-p),l.iushrn(1),d.iushrn(1)}return f}e.getJSF=s;function o(l,d,f){var h="_"+d;l.prototype[d]=function(){return this[h]!==void 0?this[h]:this[h]=f.call(this)}}e.cachedProperty=o;function u(l){return typeof l=="string"?e.toArray(l,"hex"):l}e.parseBytes=u;function c(l){return new r(l,"hex","le")}e.intFromLE=c}(XD)),XD}var rA={},Vv,nA;function Fy(){if(nA)return Vv;nA=1;var t=ei(),e=pa(),r=e.getNAF,n=e.getJSF,i=e.assert;function a(o,u){this.type=o,this.p=new t(u.p,16),this.red=u.prime?t.red(u.prime):t.mont(this.p),this.zero=new t(0).toRed(this.red),this.one=new t(1).toRed(this.red),this.two=new t(2).toRed(this.red),this.n=u.n&&new t(u.n,16),this.g=u.g&&this.pointFromJSON(u.g,u.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}Vv=a,a.prototype.point=function(){throw new Error("Not implemented")},a.prototype.validate=function(){throw new Error("Not implemented")},a.prototype._fixedNafMul=function(o,u){i(o.precomputed);var c=o._getDoubles(),l=r(u,1,this._bitLength),d=(1<<c.step+1)-(c.step%2===0?2:1);d/=3;var f=[],h,p;for(h=0;h<l.length;h+=c.step){p=0;for(var m=h+c.step-1;m>=h;m--)p=(p<<1)+l[m];f.push(p)}for(var y=this.jpoint(null,null,null),g=this.jpoint(null,null,null),v=d;v>0;v--){for(h=0;h<f.length;h++)p=f[h],p===v?g=g.mixedAdd(c.points[h]):p===-v&&(g=g.mixedAdd(c.points[h].neg()));y=y.add(g)}return y.toP()},a.prototype._wnafMul=function(o,u){var c=4,l=o._getNAFPoints(c);c=l.wnd;for(var d=l.points,f=r(u,c,this._bitLength),h=this.jpoint(null,null,null),p=f.length-1;p>=0;p--){for(var m=0;p>=0&&f[p]===0;p--)m++;if(p>=0&&m++,h=h.dblp(m),p<0)break;var y=f[p];i(y!==0),o.type==="affine"?y>0?h=h.mixedAdd(d[y-1>>1]):h=h.mixedAdd(d[-y-1>>1].neg()):y>0?h=h.add(d[y-1>>1]):h=h.add(d[-y-1>>1].neg())}return o.type==="affine"?h.toP():h},a.prototype._wnafMulAdd=function(o,u,c,l,d){var f=this._wnafT1,h=this._wnafT2,p=this._wnafT3,m=0,y,g,v;for(y=0;y<l;y++){v=u[y];var w=v._getNAFPoints(o);f[y]=w.wnd,h[y]=w.points}for(y=l-1;y>=1;y-=2){var x=y-1,_=y;if(f[x]!==1||f[_]!==1){p[x]=r(c[x],f[x],this._bitLength),p[_]=r(c[_],f[_],this._bitLength),m=Math.max(p[x].length,m),m=Math.max(p[_].length,m);continue}var A=[u[x],null,null,u[_]];u[x].y.cmp(u[_].y)===0?(A[1]=u[x].add(u[_]),A[2]=u[x].toJ().mixedAdd(u[_].neg())):u[x].y.cmp(u[_].y.redNeg())===0?(A[1]=u[x].toJ().mixedAdd(u[_]),A[2]=u[x].add(u[_].neg())):(A[1]=u[x].toJ().mixedAdd(u[_]),A[2]=u[x].toJ().mixedAdd(u[_].neg()));var M=[-3,-1,-5,-7,0,7,5,1,3],F=n(c[x],c[_]);for(m=Math.max(F[0].length,m),p[x]=new Array(m),p[_]=new Array(m),g=0;g<m;g++){var k=F[0][g]|0,$=F[1][g]|0;p[x][g]=M[(k+1)*3+($+1)],p[_][g]=0,h[x]=A}}var T=this.jpoint(null,null,null),N=this._wnafT4;for(y=m;y>=0;y--){for(var b=0;y>=0;){var E=!0;for(g=0;g<l;g++)N[g]=p[g][y]|0,N[g]!==0&&(E=!1);if(!E)break;b++,y--}if(y>=0&&b++,T=T.dblp(b),y<0)break;for(g=0;g<l;g++){var D=N[g];D!==0&&(D>0?v=h[g][D-1>>1]:D<0&&(v=h[g][-D-1>>1].neg()),v.type==="affine"?T=T.mixedAdd(v):T=T.add(v))}}for(y=0;y<l;y++)h[y]=null;return d?T:T.toP()};function s(o,u){this.curve=o,this.type=u,this.precomputed=null}return a.BasePoint=s,s.prototype.eq=function(){throw new Error("Not implemented")},s.prototype.validate=function(){return this.curve.validate(this)},a.prototype.decodePoint=function(o,u){o=e.toArray(o,u);var c=this.p.byteLength();if((o[0]===4||o[0]===6||o[0]===7)&&o.length-1===2*c){o[0]===6?i(o[o.length-1]%2===0):o[0]===7&&i(o[o.length-1]%2===1);var l=this.point(o.slice(1,1+c),o.slice(1+c,1+2*c));return l}else if((o[0]===2||o[0]===3)&&o.length-1===c)return this.pointFromX(o.slice(1,1+c),o[0]===3);throw new Error("Unknown point format")},s.prototype.encodeCompressed=function(o){return this.encode(o,!0)},s.prototype._encode=function(o){var u=this.curve.p.byteLength(),c=this.getX().toArray("be",u);return o?[this.getY().isEven()?2:3].concat(c):[4].concat(c,this.getY().toArray("be",u))},s.prototype.encode=function(o,u){return e.encode(this._encode(u),o)},s.prototype.precompute=function(o){if(this.precomputed)return this;var u={doubles:null,naf:null,beta:null};return u.naf=this._getNAFPoints(8),u.doubles=this._getDoubles(4,o),u.beta=this._getBeta(),this.precomputed=u,this},s.prototype._hasDoubles=function(o){if(!this.precomputed)return!1;var u=this.precomputed.doubles;return u?u.points.length>=Math.ceil((o.bitLength()+1)/u.step):!1},s.prototype._getDoubles=function(o,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],l=this,d=0;d<u;d+=o){for(var f=0;f<o;f++)l=l.dbl();c.push(l)}return{step:o,points:c}},s.prototype._getNAFPoints=function(o){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var u=[this],c=(1<<o)-1,l=c===1?null:this.dbl(),d=1;d<c;d++)u[d]=u[d-1].add(l);return{wnd:o,points:u}},s.prototype._getBeta=function(){return null},s.prototype.dblp=function(o){for(var u=this,c=0;c<o;c++)u=u.dbl();return u},Vv}var Zv,iA;function a3e(){if(iA)return Zv;iA=1;var t=pa(),e=ei(),r=gr(),n=Fy(),i=t.assert;function a(u){n.call(this,"short",u),this.a=new e(u.a,16).toRed(this.red),this.b=new e(u.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(u),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}r(a,n),Zv=a,a.prototype._getEndomorphism=function(u){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var c,l;if(u.beta)c=new e(u.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);c=d[0].cmp(d[1])<0?d[0]:d[1],c=c.toRed(this.red)}if(u.lambda)l=new e(u.lambda,16);else{var f=this._getEndoRoots(this.n);this.g.mul(f[0]).x.cmp(this.g.x.redMul(c))===0?l=f[0]:(l=f[1],i(this.g.mul(l).x.cmp(this.g.x.redMul(c))===0))}var h;return u.basis?h=u.basis.map(function(p){return{a:new e(p.a,16),b:new e(p.b,16)}}):h=this._getEndoBasis(l),{beta:c,lambda:l,basis:h}}},a.prototype._getEndoRoots=function(u){var c=u===this.p?this.red:e.mont(u),l=new e(2).toRed(c).redInvm(),d=l.redNeg(),f=new e(3).toRed(c).redNeg().redSqrt().redMul(l),h=d.redAdd(f).fromRed(),p=d.redSub(f).fromRed();return[h,p]},a.prototype._getEndoBasis=function(u){for(var c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=u,d=this.n.clone(),f=new e(1),h=new e(0),p=new e(0),m=new e(1),y,g,v,w,x,_,A,M=0,F,k;l.cmpn(0)!==0;){var $=d.div(l);F=d.sub($.mul(l)),k=p.sub($.mul(f));var T=m.sub($.mul(h));if(!v&&F.cmp(c)<0)y=A.neg(),g=f,v=F.neg(),w=k;else if(v&&++M===2)break;A=F,d=l,l=F,p=f,f=k,m=h,h=T}x=F.neg(),_=k;var N=v.sqr().add(w.sqr()),b=x.sqr().add(_.sqr());return b.cmp(N)>=0&&(x=y,_=g),v.negative&&(v=v.neg(),w=w.neg()),x.negative&&(x=x.neg(),_=_.neg()),[{a:v,b:w},{a:x,b:_}]},a.prototype._endoSplit=function(u){var c=this.endo.basis,l=c[0],d=c[1],f=d.b.mul(u).divRound(this.n),h=l.b.neg().mul(u).divRound(this.n),p=f.mul(l.a),m=h.mul(d.a),y=f.mul(l.b),g=h.mul(d.b),v=u.sub(p).sub(m),w=y.add(g).neg();return{k1:v,k2:w}},a.prototype.pointFromX=function(u,c){u=new e(u,16),u.red||(u=u.toRed(this.red));var l=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),d=l.redSqrt();if(d.redSqr().redSub(l).cmp(this.zero)!==0)throw new Error("invalid point");var f=d.fromRed().isOdd();return(c&&!f||!c&&f)&&(d=d.redNeg()),this.point(u,d)},a.prototype.validate=function(u){if(u.inf)return!0;var c=u.x,l=u.y,d=this.a.redMul(c),f=c.redSqr().redMul(c).redIAdd(d).redIAdd(this.b);return l.redSqr().redISub(f).cmpn(0)===0},a.prototype._endoWnafMulAdd=function(u,c,l){for(var d=this._endoWnafT1,f=this._endoWnafT2,h=0;h<u.length;h++){var p=this._endoSplit(c[h]),m=u[h],y=m._getBeta();p.k1.negative&&(p.k1.ineg(),m=m.neg(!0)),p.k2.negative&&(p.k2.ineg(),y=y.neg(!0)),d[h*2]=m,d[h*2+1]=y,f[h*2]=p.k1,f[h*2+1]=p.k2}for(var g=this._wnafMulAdd(1,d,f,h*2,l),v=0;v<h*2;v++)d[v]=null,f[v]=null;return g};function s(u,c,l,d){n.BasePoint.call(this,u,"affine"),c===null&&l===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new e(c,16),this.y=new e(l,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}r(s,n.BasePoint),a.prototype.point=function(u,c,l){return new s(this,u,c,l)},a.prototype.pointFromJSON=function(u,c){return s.fromJSON(this,u,c)},s.prototype._getBeta=function(){if(this.curve.endo){var u=this.precomputed;if(u&&u.beta)return u.beta;var c=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(u){var l=this.curve,d=function(f){return l.point(f.x.redMul(l.endo.beta),f.y)};u.beta=c,c.precomputed={beta:null,naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(d)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(d)}}}return c}},s.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},s.fromJSON=function(u,c,l){typeof c=="string"&&(c=JSON.parse(c));var d=u.point(c[0],c[1],l);if(!c[2])return d;function f(p){return u.point(p[0],p[1],l)}var h=c[2];return d.precomputed={beta:null,doubles:h.doubles&&{step:h.doubles.step,points:[d].concat(h.doubles.points.map(f))},naf:h.naf&&{wnd:h.naf.wnd,points:[d].concat(h.naf.points.map(f))}},d},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.inf},s.prototype.add=function(u){if(this.inf)return u;if(u.inf)return this;if(this.eq(u))return this.dbl();if(this.neg().eq(u))return this.curve.point(null,null);if(this.x.cmp(u.x)===0)return this.curve.point(null,null);var c=this.y.redSub(u.y);c.cmpn(0)!==0&&(c=c.redMul(this.x.redSub(u.x).redInvm()));var l=c.redSqr().redISub(this.x).redISub(u.x),d=c.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,d)},s.prototype.dbl=function(){if(this.inf)return this;var u=this.y.redAdd(this.y);if(u.cmpn(0)===0)return this.curve.point(null,null);var c=this.curve.a,l=this.x.redSqr(),d=u.redInvm(),f=l.redAdd(l).redIAdd(l).redIAdd(c).redMul(d),h=f.redSqr().redISub(this.x.redAdd(this.x)),p=f.redMul(this.x.redSub(h)).redISub(this.y);return this.curve.point(h,p)},s.prototype.getX=function(){return this.x.fromRed()},s.prototype.getY=function(){return this.y.fromRed()},s.prototype.mul=function(u){return u=new e(u,16),this.isInfinity()?this:this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve.endo?this.curve._endoWnafMulAdd([this],[u]):this.curve._wnafMul(this,u)},s.prototype.mulAdd=function(u,c,l){var d=[this,c],f=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(d,f):this.curve._wnafMulAdd(1,d,f,2)},s.prototype.jmulAdd=function(u,c,l){var d=[this,c],f=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(d,f,!0):this.curve._wnafMulAdd(1,d,f,2,!0)},s.prototype.eq=function(u){return this===u||this.inf===u.inf&&(this.inf||this.x.cmp(u.x)===0&&this.y.cmp(u.y)===0)},s.prototype.neg=function(u){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var l=this.precomputed,d=function(f){return f.neg()};c.precomputed={naf:l.naf&&{wnd:l.naf.wnd,points:l.naf.points.map(d)},doubles:l.doubles&&{step:l.doubles.step,points:l.doubles.points.map(d)}}}return c},s.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var u=this.curve.jpoint(this.x,this.y,this.curve.one);return u};function o(u,c,l,d){n.BasePoint.call(this,u,"jacobian"),c===null&&l===null&&d===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(c,16),this.y=new e(l,16),this.z=new e(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return r(o,n.BasePoint),a.prototype.jpoint=function(u,c,l){return new o(this,u,c,l)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),c=u.redSqr(),l=this.x.redMul(c),d=this.y.redMul(c).redMul(u);return this.curve.point(l,d)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var c=u.z.redSqr(),l=this.z.redSqr(),d=this.x.redMul(c),f=u.x.redMul(l),h=this.y.redMul(c.redMul(u.z)),p=u.y.redMul(l.redMul(this.z)),m=d.redSub(f),y=h.redSub(p);if(m.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=m.redSqr(),v=g.redMul(m),w=d.redMul(g),x=y.redSqr().redIAdd(v).redISub(w).redISub(w),_=y.redMul(w.redISub(x)).redISub(h.redMul(v)),A=this.z.redMul(u.z).redMul(m);return this.curve.jpoint(x,_,A)},o.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var c=this.z.redSqr(),l=this.x,d=u.x.redMul(c),f=this.y,h=u.y.redMul(c).redMul(this.z),p=l.redSub(d),m=f.redSub(h);if(p.cmpn(0)===0)return m.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var y=p.redSqr(),g=y.redMul(p),v=l.redMul(y),w=m.redSqr().redIAdd(g).redISub(v).redISub(v),x=m.redMul(v.redISub(w)).redISub(f.redMul(g)),_=this.z.redMul(p);return this.curve.jpoint(w,x,_)},o.prototype.dblp=function(u){if(u===0)return this;if(this.isInfinity())return this;if(!u)return this.dbl();var c;if(this.curve.zeroA||this.curve.threeA){var l=this;for(c=0;c<u;c++)l=l.dbl();return l}var d=this.curve.a,f=this.curve.tinv,h=this.x,p=this.y,m=this.z,y=m.redSqr().redSqr(),g=p.redAdd(p);for(c=0;c<u;c++){var v=h.redSqr(),w=g.redSqr(),x=w.redSqr(),_=v.redAdd(v).redIAdd(v).redIAdd(d.redMul(y)),A=h.redMul(w),M=_.redSqr().redISub(A.redAdd(A)),F=A.redISub(M),k=_.redMul(F);k=k.redIAdd(k).redISub(x);var $=g.redMul(m);c+1<u&&(y=y.redMul(x)),h=M,m=$,g=k}return this.curve.jpoint(h,g.redMul(f),m)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.prototype._zeroDbl=function(){var u,c,l;if(this.zOne){var d=this.x.redSqr(),f=this.y.redSqr(),h=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(d).redISub(h);p=p.redIAdd(p);var m=d.redAdd(d).redIAdd(d),y=m.redSqr().redISub(p).redISub(p),g=h.redIAdd(h);g=g.redIAdd(g),g=g.redIAdd(g),u=y,c=m.redMul(p.redISub(y)).redISub(g),l=this.y.redAdd(this.y)}else{var v=this.x.redSqr(),w=this.y.redSqr(),x=w.redSqr(),_=this.x.redAdd(w).redSqr().redISub(v).redISub(x);_=_.redIAdd(_);var A=v.redAdd(v).redIAdd(v),M=A.redSqr(),F=x.redIAdd(x);F=F.redIAdd(F),F=F.redIAdd(F),u=M.redISub(_).redISub(_),c=A.redMul(_.redISub(u)).redISub(F),l=this.y.redMul(this.z),l=l.redIAdd(l)}return this.curve.jpoint(u,c,l)},o.prototype._threeDbl=function(){var u,c,l;if(this.zOne){var d=this.x.redSqr(),f=this.y.redSqr(),h=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(d).redISub(h);p=p.redIAdd(p);var m=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),y=m.redSqr().redISub(p).redISub(p);u=y;var g=h.redIAdd(h);g=g.redIAdd(g),g=g.redIAdd(g),c=m.redMul(p.redISub(y)).redISub(g),l=this.y.redAdd(this.y)}else{var v=this.z.redSqr(),w=this.y.redSqr(),x=this.x.redMul(w),_=this.x.redSub(v).redMul(this.x.redAdd(v));_=_.redAdd(_).redIAdd(_);var A=x.redIAdd(x);A=A.redIAdd(A);var M=A.redAdd(A);u=_.redSqr().redISub(M),l=this.y.redAdd(this.z).redSqr().redISub(w).redISub(v);var F=w.redSqr();F=F.redIAdd(F),F=F.redIAdd(F),F=F.redIAdd(F),c=_.redMul(A.redISub(u)).redISub(F)}return this.curve.jpoint(u,c,l)},o.prototype._dbl=function(){var u=this.curve.a,c=this.x,l=this.y,d=this.z,f=d.redSqr().redSqr(),h=c.redSqr(),p=l.redSqr(),m=h.redAdd(h).redIAdd(h).redIAdd(u.redMul(f)),y=c.redAdd(c);y=y.redIAdd(y);var g=y.redMul(p),v=m.redSqr().redISub(g.redAdd(g)),w=g.redISub(v),x=p.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var _=m.redMul(w).redISub(x),A=l.redAdd(l).redMul(d);return this.curve.jpoint(v,_,A)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var u=this.x.redSqr(),c=this.y.redSqr(),l=this.z.redSqr(),d=c.redSqr(),f=u.redAdd(u).redIAdd(u),h=f.redSqr(),p=this.x.redAdd(c).redSqr().redISub(u).redISub(d);p=p.redIAdd(p),p=p.redAdd(p).redIAdd(p),p=p.redISub(h);var m=p.redSqr(),y=d.redIAdd(d);y=y.redIAdd(y),y=y.redIAdd(y),y=y.redIAdd(y);var g=f.redIAdd(p).redSqr().redISub(h).redISub(m).redISub(y),v=c.redMul(g);v=v.redIAdd(v),v=v.redIAdd(v);var w=this.x.redMul(m).redISub(v);w=w.redIAdd(w),w=w.redIAdd(w);var x=this.y.redMul(g.redMul(y.redISub(g)).redISub(p.redMul(m)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var _=this.z.redAdd(p).redSqr().redISub(l).redISub(m);return this.curve.jpoint(w,x,_)},o.prototype.mul=function(u,c){return u=new e(u,c),this.curve._wnafMul(this,u)},o.prototype.eq=function(u){if(u.type==="affine")return this.eq(u.toJ());if(this===u)return!0;var c=this.z.redSqr(),l=u.z.redSqr();if(this.x.redMul(l).redISub(u.x.redMul(c)).cmpn(0)!==0)return!1;var d=c.redMul(this.z),f=l.redMul(u.z);return this.y.redMul(f).redISub(u.y.redMul(d)).cmpn(0)===0},o.prototype.eqXToP=function(u){var c=this.z.redSqr(),l=u.toRed(this.curve.red).redMul(c);if(this.x.cmp(l)===0)return!0;for(var d=u.clone(),f=this.curve.redN.redMul(c);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(l.redIAdd(f),this.x.cmp(l)===0)return!0}},o.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},o.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Zv}var Hv,aA;function s3e(){if(aA)return Hv;aA=1;var t=ei(),e=gr(),r=Fy(),n=pa();function i(s){r.call(this,"mont",s),this.a=new t(s.a,16).toRed(this.red),this.b=new t(s.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}e(i,r),Hv=i,i.prototype.validate=function(s){var o=s.normalize().x,u=o.redSqr(),c=u.redMul(o).redAdd(u.redMul(this.a)).redAdd(o),l=c.redSqrt();return l.redSqr().cmp(c)===0};function a(s,o,u){r.BasePoint.call(this,s,"projective"),o===null&&u===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(o,16),this.z=new t(u,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return e(a,r.BasePoint),i.prototype.decodePoint=function(s,o){return this.point(n.toArray(s,o),1)},i.prototype.point=function(s,o){return new a(this,s,o)},i.prototype.pointFromJSON=function(s){return a.fromJSON(this,s)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},a.fromJSON=function(s,o){return new a(s,o[0],o[1]||s.one)},a.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},a.prototype.isInfinity=function(){return this.z.cmpn(0)===0},a.prototype.dbl=function(){var s=this.x.redAdd(this.z),o=s.redSqr(),u=this.x.redSub(this.z),c=u.redSqr(),l=o.redSub(c),d=o.redMul(c),f=l.redMul(c.redAdd(this.curve.a24.redMul(l)));return this.curve.point(d,f)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(s,o){var u=this.x.redAdd(this.z),c=this.x.redSub(this.z),l=s.x.redAdd(s.z),d=s.x.redSub(s.z),f=d.redMul(u),h=l.redMul(c),p=o.z.redMul(f.redAdd(h).redSqr()),m=o.x.redMul(f.redISub(h).redSqr());return this.curve.point(p,m)},a.prototype.mul=function(s){for(var o=s.clone(),u=this,c=this.curve.point(null,null),l=this,d=[];o.cmpn(0)!==0;o.iushrn(1))d.push(o.andln(1));for(var f=d.length-1;f>=0;f--)d[f]===0?(u=u.diffAdd(c,l),c=c.dbl()):(c=u.diffAdd(c,l),u=u.dbl());return c},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.eq=function(s){return this.getX().cmp(s.getX())===0},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hv}var Wv,sA;function o3e(){if(sA)return Wv;sA=1;var t=pa(),e=ei(),r=gr(),n=Fy(),i=t.assert;function a(o){this.twisted=(o.a|0)!==1,this.mOneA=this.twisted&&(o.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",o),this.a=new e(o.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(o.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(o.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),i(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(o.c|0)===1}r(a,n),Wv=a,a.prototype._mulA=function(o){return this.mOneA?o.redNeg():this.a.redMul(o)},a.prototype._mulC=function(o){return this.oneC?o:this.c.redMul(o)},a.prototype.jpoint=function(o,u,c,l){return this.point(o,u,c,l)},a.prototype.pointFromX=function(o,u){o=new e(o,16),o.red||(o=o.toRed(this.red));var c=o.redSqr(),l=this.c2.redSub(this.a.redMul(c)),d=this.one.redSub(this.c2.redMul(this.d).redMul(c)),f=l.redMul(d.redInvm()),h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var p=h.fromRed().isOdd();return(u&&!p||!u&&p)&&(h=h.redNeg()),this.point(o,h)},a.prototype.pointFromY=function(o,u){o=new e(o,16),o.red||(o=o.toRed(this.red));var c=o.redSqr(),l=c.redSub(this.c2),d=c.redMul(this.d).redMul(this.c2).redSub(this.a),f=l.redMul(d.redInvm());if(f.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,o)}var h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==u&&(h=h.redNeg()),this.point(h,o)},a.prototype.validate=function(o){if(o.isInfinity())return!0;o.normalize();var u=o.x.redSqr(),c=o.y.redSqr(),l=u.redMul(this.a).redAdd(c),d=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(c)));return l.cmp(d)===0};function s(o,u,c,l,d){n.BasePoint.call(this,o,"projective"),u===null&&c===null&&l===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(u,16),this.y=new e(c,16),this.z=l?new e(l,16):this.curve.one,this.t=d&&new e(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return r(s,n.BasePoint),a.prototype.pointFromJSON=function(o){return s.fromJSON(this,o)},a.prototype.point=function(o,u,c,l){return new s(this,o,u,c,l)},s.fromJSON=function(o,u){return new s(o,u[0],u[1],u[2])},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},s.prototype._extDbl=function(){var o=this.x.redSqr(),u=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var l=this.curve._mulA(o),d=this.x.redAdd(this.y).redSqr().redISub(o).redISub(u),f=l.redAdd(u),h=f.redSub(c),p=l.redSub(u),m=d.redMul(h),y=f.redMul(p),g=d.redMul(p),v=h.redMul(f);return this.curve.point(m,y,v,g)},s.prototype._projDbl=function(){var o=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),c=this.y.redSqr(),l,d,f,h,p,m;if(this.curve.twisted){h=this.curve._mulA(u);var y=h.redAdd(c);this.zOne?(l=o.redSub(u).redSub(c).redMul(y.redSub(this.curve.two)),d=y.redMul(h.redSub(c)),f=y.redSqr().redSub(y).redSub(y)):(p=this.z.redSqr(),m=y.redSub(p).redISub(p),l=o.redSub(u).redISub(c).redMul(m),d=y.redMul(h.redSub(c)),f=y.redMul(m))}else h=u.redAdd(c),p=this.curve._mulC(this.z).redSqr(),m=h.redSub(p).redSub(p),l=this.curve._mulC(o.redISub(h)).redMul(m),d=this.curve._mulC(h).redMul(u.redISub(c)),f=h.redMul(m);return this.curve.point(l,d,f)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},s.prototype._extAdd=function(o){var u=this.y.redSub(this.x).redMul(o.y.redSub(o.x)),c=this.y.redAdd(this.x).redMul(o.y.redAdd(o.x)),l=this.t.redMul(this.curve.dd).redMul(o.t),d=this.z.redMul(o.z.redAdd(o.z)),f=c.redSub(u),h=d.redSub(l),p=d.redAdd(l),m=c.redAdd(u),y=f.redMul(h),g=p.redMul(m),v=f.redMul(m),w=h.redMul(p);return this.curve.point(y,g,w,v)},s.prototype._projAdd=function(o){var u=this.z.redMul(o.z),c=u.redSqr(),l=this.x.redMul(o.x),d=this.y.redMul(o.y),f=this.curve.d.redMul(l).redMul(d),h=c.redSub(f),p=c.redAdd(f),m=this.x.redAdd(this.y).redMul(o.x.redAdd(o.y)).redISub(l).redISub(d),y=u.redMul(h).redMul(m),g,v;return this.curve.twisted?(g=u.redMul(p).redMul(d.redSub(this.curve._mulA(l))),v=h.redMul(p)):(g=u.redMul(p).redMul(d.redSub(l)),v=this.curve._mulC(h).redMul(p)),this.curve.point(y,g,v)},s.prototype.add=function(o){return this.isInfinity()?o:o.isInfinity()?this:this.curve.extended?this._extAdd(o):this._projAdd(o)},s.prototype.mul=function(o){return this._hasDoubles(o)?this.curve._fixedNafMul(this,o):this.curve._wnafMul(this,o)},s.prototype.mulAdd=function(o,u,c){return this.curve._wnafMulAdd(1,[this,u],[o,c],2,!1)},s.prototype.jmulAdd=function(o,u,c){return this.curve._wnafMulAdd(1,[this,u],[o,c],2,!0)},s.prototype.normalize=function(){if(this.zOne)return this;var o=this.z.redInvm();return this.x=this.x.redMul(o),this.y=this.y.redMul(o),this.t&&(this.t=this.t.redMul(o)),this.z=this.curve.one,this.zOne=!0,this},s.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()},s.prototype.getY=function(){return this.normalize(),this.y.fromRed()},s.prototype.eq=function(o){return this===o||this.getX().cmp(o.getX())===0&&this.getY().cmp(o.getY())===0},s.prototype.eqXToP=function(o){var u=o.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var c=o.clone(),l=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(l),this.x.cmp(u)===0)return!0}},s.prototype.toP=s.prototype.normalize,s.prototype.mixedAdd=s.prototype.add,Wv}var oA;function ZL(){return oA||(oA=1,function(t){var e=t;e.base=Fy(),e.short=a3e(),e.mont=s3e(),e.edwards=o3e()}(rA)),rA}var uA={},cA={},Wr={},lA;function ws(){if(lA)return Wr;lA=1;var t=ha(),e=gr();Wr.inherits=e;function r(N,b){return(N.charCodeAt(b)&64512)!==55296||b<0||b+1>=N.length?!1:(N.charCodeAt(b+1)&64512)===56320}function n(N,b){if(Array.isArray(N))return N.slice();if(!N)return[];var E=[];if(typeof N=="string")if(b){if(b==="hex")for(N=N.replace(/[^a-z0-9]+/ig,""),N.length%2!==0&&(N="0"+N),C=0;C<N.length;C+=2)E.push(parseInt(N[C]+N[C+1],16))}else for(var D=0,C=0;C<N.length;C++){var I=N.charCodeAt(C);I<128?E[D++]=I:I<2048?(E[D++]=I>>6|192,E[D++]=I&63|128):r(N,C)?(I=65536+((I&1023)<<10)+(N.charCodeAt(++C)&1023),E[D++]=I>>18|240,E[D++]=I>>12&63|128,E[D++]=I>>6&63|128,E[D++]=I&63|128):(E[D++]=I>>12|224,E[D++]=I>>6&63|128,E[D++]=I&63|128)}else for(C=0;C<N.length;C++)E[C]=N[C]|0;return E}Wr.toArray=n;function i(N){for(var b="",E=0;E<N.length;E++)b+=o(N[E].toString(16));return b}Wr.toHex=i;function a(N){var b=N>>>24|N>>>8&65280|N<<8&16711680|(N&255)<<24;return b>>>0}Wr.htonl=a;function s(N,b){for(var E="",D=0;D<N.length;D++){var C=N[D];b==="little"&&(C=a(C)),E+=u(C.toString(16))}return E}Wr.toHex32=s;function o(N){return N.length===1?"0"+N:N}Wr.zero2=o;function u(N){return N.length===7?"0"+N:N.length===6?"00"+N:N.length===5?"000"+N:N.length===4?"0000"+N:N.length===3?"00000"+N:N.length===2?"000000"+N:N.length===1?"0000000"+N:N}Wr.zero8=u;function c(N,b,E,D){var C=E-b;t(C%4===0);for(var I=new Array(C/4),O=0,S=b;O<I.length;O++,S+=4){var P;D==="big"?P=N[S]<<24|N[S+1]<<16|N[S+2]<<8|N[S+3]:P=N[S+3]<<24|N[S+2]<<16|N[S+1]<<8|N[S],I[O]=P>>>0}return I}Wr.join32=c;function l(N,b){for(var E=new Array(N.length*4),D=0,C=0;D<N.length;D++,C+=4){var I=N[D];b==="big"?(E[C]=I>>>24,E[C+1]=I>>>16&255,E[C+2]=I>>>8&255,E[C+3]=I&255):(E[C+3]=I>>>24,E[C+2]=I>>>16&255,E[C+1]=I>>>8&255,E[C]=I&255)}return E}Wr.split32=l;function d(N,b){return N>>>b|N<<32-b}Wr.rotr32=d;function f(N,b){return N<<b|N>>>32-b}Wr.rotl32=f;function h(N,b){return N+b>>>0}Wr.sum32=h;function p(N,b,E){return N+b+E>>>0}Wr.sum32_3=p;function m(N,b,E,D){return N+b+E+D>>>0}Wr.sum32_4=m;function y(N,b,E,D,C){return N+b+E+D+C>>>0}Wr.sum32_5=y;function g(N,b,E,D){var C=N[b],I=N[b+1],O=D+I>>>0,S=(O<D?1:0)+E+C;N[b]=S>>>0,N[b+1]=O}Wr.sum64=g;function v(N,b,E,D){var C=b+D>>>0,I=(C<b?1:0)+N+E;return I>>>0}Wr.sum64_hi=v;function w(N,b,E,D){var C=b+D;return C>>>0}Wr.sum64_lo=w;function x(N,b,E,D,C,I,O,S){var P=0,R=b;R=R+D>>>0,P+=R<b?1:0,R=R+I>>>0,P+=R<I?1:0,R=R+S>>>0,P+=R<S?1:0;var L=N+E+C+O+P;return L>>>0}Wr.sum64_4_hi=x;function _(N,b,E,D,C,I,O,S){var P=b+D+I+S;return P>>>0}Wr.sum64_4_lo=_;function A(N,b,E,D,C,I,O,S,P,R){var L=0,q=b;q=q+D>>>0,L+=q<b?1:0,q=q+I>>>0,L+=q<I?1:0,q=q+S>>>0,L+=q<S?1:0,q=q+R>>>0,L+=q<R?1:0;var J=N+E+C+O+P+L;return J>>>0}Wr.sum64_5_hi=A;function M(N,b,E,D,C,I,O,S,P,R){var L=b+D+I+S+R;return L>>>0}Wr.sum64_5_lo=M;function F(N,b,E){var D=b<<32-E|N>>>E;return D>>>0}Wr.rotr64_hi=F;function k(N,b,E){var D=N<<32-E|b>>>E;return D>>>0}Wr.rotr64_lo=k;function $(N,b,E){return N>>>E}Wr.shr64_hi=$;function T(N,b,E){var D=N<<32-E|b>>>E;return D>>>0}return Wr.shr64_lo=T,Wr}var Yv={},dA;function mp(){if(dA)return Yv;dA=1;var t=ws(),e=ha();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return Yv.BlockHash=r,r.prototype.update=function(n,i){if(n=t.toArray(n,i),this.pending?this.pending=this.pending.concat(n):this.pending=n,this.pendingTotal+=n.length,this.pending.length>=this._delta8){n=this.pending;var a=n.length%this._delta8;this.pending=n.slice(n.length-a,n.length),this.pending.length===0&&(this.pending=null),n=t.join32(n,0,n.length-a,this.endian);for(var s=0;s<n.length;s+=this._delta32)this._update(n,s,s+this._delta32)}return this},r.prototype.digest=function(n){return this.update(this._pad()),e(this.pending===null),this._digest(n)},r.prototype._pad=function(){var n=this.pendingTotal,i=this._delta8,a=i-(n+this.padLength)%i,s=new Array(a+this.padLength);s[0]=128;for(var o=1;o<a;o++)s[o]=0;if(n<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)s[o++]=0;s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=n>>>24&255,s[o++]=n>>>16&255,s[o++]=n>>>8&255,s[o++]=n&255}else for(s[o++]=n&255,s[o++]=n>>>8&255,s[o++]=n>>>16&255,s[o++]=n>>>24&255,s[o++]=0,s[o++]=0,s[o++]=0,s[o++]=0,u=8;u<this.padLength;u++)s[o++]=0;return s},Yv}var Ac={},Ga={},fA;function HL(){if(fA)return Ga;fA=1;var t=ws(),e=t.rotr32;function r(l,d,f,h){if(l===0)return n(d,f,h);if(l===1||l===3)return a(d,f,h);if(l===2)return i(d,f,h)}Ga.ft_1=r;function n(l,d,f){return l&d^~l&f}Ga.ch32=n;function i(l,d,f){return l&d^l&f^d&f}Ga.maj32=i;function a(l,d,f){return l^d^f}Ga.p32=a;function s(l){return e(l,2)^e(l,13)^e(l,22)}Ga.s0_256=s;function o(l){return e(l,6)^e(l,11)^e(l,25)}Ga.s1_256=o;function u(l){return e(l,7)^e(l,18)^l>>>3}Ga.g0_256=u;function c(l){return e(l,17)^e(l,19)^l>>>10}return Ga.g1_256=c,Ga}var Jv,hA;function u3e(){if(hA)return Jv;hA=1;var t=ws(),e=mp(),r=HL(),n=t.rotl32,i=t.sum32,a=t.sum32_5,s=r.ft_1,o=e.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(c,o),Jv=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(l,d){for(var f=this.W,h=0;h<16;h++)f[h]=l[d+h];for(;h<f.length;h++)f[h]=n(f[h-3]^f[h-8]^f[h-14]^f[h-16],1);var p=this.h[0],m=this.h[1],y=this.h[2],g=this.h[3],v=this.h[4];for(h=0;h<f.length;h++){var w=~~(h/20),x=a(n(p,5),s(w,m,y,g),v,f[h],u[w]);v=g,g=y,y=n(m,30),m=p,p=x}this.h[0]=i(this.h[0],p),this.h[1]=i(this.h[1],m),this.h[2]=i(this.h[2],y),this.h[3]=i(this.h[3],g),this.h[4]=i(this.h[4],v)},c.prototype._digest=function(l){return l==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},Jv}var Kv,pA;function WL(){if(pA)return Kv;pA=1;var t=ws(),e=mp(),r=HL(),n=ha(),i=t.sum32,a=t.sum32_4,s=t.sum32_5,o=r.ch32,u=r.maj32,c=r.s0_256,l=r.s1_256,d=r.g0_256,f=r.g1_256,h=e.BlockHash,p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;h.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=p,this.W=new Array(64)}return t.inherits(m,h),Kv=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(y,g){for(var v=this.W,w=0;w<16;w++)v[w]=y[g+w];for(;w<v.length;w++)v[w]=a(f(v[w-2]),v[w-7],d(v[w-15]),v[w-16]);var x=this.h[0],_=this.h[1],A=this.h[2],M=this.h[3],F=this.h[4],k=this.h[5],$=this.h[6],T=this.h[7];for(n(this.k.length===v.length),w=0;w<v.length;w++){var N=s(T,l(F),o(F,k,$),this.k[w],v[w]),b=i(c(x),u(x,_,A));T=$,$=k,k=F,F=i(M,N),M=A,A=_,_=x,x=i(N,b)}this.h[0]=i(this.h[0],x),this.h[1]=i(this.h[1],_),this.h[2]=i(this.h[2],A),this.h[3]=i(this.h[3],M),this.h[4]=i(this.h[4],F),this.h[5]=i(this.h[5],k),this.h[6]=i(this.h[6],$),this.h[7]=i(this.h[7],T)},m.prototype._digest=function(y){return y==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},Kv}var Gv,mA;function c3e(){if(mA)return Gv;mA=1;var t=ws(),e=WL();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return t.inherits(r,e),Gv=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(n){return n==="hex"?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")},Gv}var Xv,gA;function YL(){if(gA)return Xv;gA=1;var t=ws(),e=mp(),r=ha(),n=t.rotr64_hi,i=t.rotr64_lo,a=t.shr64_hi,s=t.shr64_lo,o=t.sum64,u=t.sum64_hi,c=t.sum64_lo,l=t.sum64_4_hi,d=t.sum64_4_lo,f=t.sum64_5_hi,h=t.sum64_5_lo,p=e.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;p.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}t.inherits(y,p),Xv=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(b,E){for(var D=this.W,C=0;C<32;C++)D[C]=b[E+C];for(;C<D.length;C+=2){var I=T(D[C-4],D[C-3]),O=N(D[C-4],D[C-3]),S=D[C-14],P=D[C-13],R=k(D[C-30],D[C-29]),L=$(D[C-30],D[C-29]),q=D[C-32],J=D[C-31];D[C]=l(I,O,S,P,R,L,q,J),D[C+1]=d(I,O,S,P,R,L,q,J)}},y.prototype._update=function(b,E){this._prepareBlock(b,E);var D=this.W,C=this.h[0],I=this.h[1],O=this.h[2],S=this.h[3],P=this.h[4],R=this.h[5],L=this.h[6],q=this.h[7],J=this.h[8],G=this.h[9],ie=this.h[10],z=this.h[11],V=this.h[12],Q=this.h[13],ae=this.h[14],oe=this.h[15];r(this.k.length===D.length);for(var le=0;le<D.length;le+=2){var he=ae,Z=oe,K=M(J,G),B=F(J,G),j=g(J,G,ie,z,V),U=v(J,G,ie,z,V,Q),W=this.k[le],ee=this.k[le+1],te=D[le],ne=D[le+1],Y=f(he,Z,K,B,j,U,W,ee,te,ne),re=h(he,Z,K,B,j,U,W,ee,te,ne);he=_(C,I),Z=A(C,I),K=w(C,I,O,S,P),B=x(C,I,O,S,P,R);var ce=u(he,Z,K,B),de=c(he,Z,K,B);ae=V,oe=Q,V=ie,Q=z,ie=J,z=G,J=u(L,q,Y,re),G=c(q,q,Y,re),L=P,q=R,P=O,R=S,O=C,S=I,C=u(Y,re,ce,de),I=c(Y,re,ce,de)}o(this.h,0,C,I),o(this.h,2,O,S),o(this.h,4,P,R),o(this.h,6,L,q),o(this.h,8,J,G),o(this.h,10,ie,z),o(this.h,12,V,Q),o(this.h,14,ae,oe)},y.prototype._digest=function(b){return b==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")};function g(b,E,D,C,I){var O=b&D^~b&I;return O<0&&(O+=4294967296),O}function v(b,E,D,C,I,O){var S=E&C^~E&O;return S<0&&(S+=4294967296),S}function w(b,E,D,C,I){var O=b&D^b&I^D&I;return O<0&&(O+=4294967296),O}function x(b,E,D,C,I,O){var S=E&C^E&O^C&O;return S<0&&(S+=4294967296),S}function _(b,E){var D=n(b,E,28),C=n(E,b,2),I=n(E,b,7),O=D^C^I;return O<0&&(O+=4294967296),O}function A(b,E){var D=i(b,E,28),C=i(E,b,2),I=i(E,b,7),O=D^C^I;return O<0&&(O+=4294967296),O}function M(b,E){var D=n(b,E,14),C=n(b,E,18),I=n(E,b,9),O=D^C^I;return O<0&&(O+=4294967296),O}function F(b,E){var D=i(b,E,14),C=i(b,E,18),I=i(E,b,9),O=D^C^I;return O<0&&(O+=4294967296),O}function k(b,E){var D=n(b,E,1),C=n(b,E,8),I=a(b,E,7),O=D^C^I;return O<0&&(O+=4294967296),O}function $(b,E){var D=i(b,E,1),C=i(b,E,8),I=s(b,E,7),O=D^C^I;return O<0&&(O+=4294967296),O}function T(b,E){var D=n(b,E,19),C=n(E,b,29),I=a(b,E,6),O=D^C^I;return O<0&&(O+=4294967296),O}function N(b,E){var D=i(b,E,19),C=i(E,b,29),I=s(b,E,6),O=D^C^I;return O<0&&(O+=4294967296),O}return Xv}var Qv,yA;function l3e(){if(yA)return Qv;yA=1;var t=ws(),e=YL();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return t.inherits(r,e),Qv=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(n){return n==="hex"?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")},Qv}var vA;function d3e(){return vA||(vA=1,Ac.sha1=u3e(),Ac.sha224=c3e(),Ac.sha256=WL(),Ac.sha384=l3e(),Ac.sha512=YL()),Ac}var eb={},bA;function f3e(){if(bA)return eb;bA=1;var t=ws(),e=mp(),r=t.rotl32,n=t.sum32,i=t.sum32_3,a=t.sum32_4,s=e.BlockHash;function o(){if(!(this instanceof o))return new o;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(o,s),eb.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(m,y){for(var g=this.h[0],v=this.h[1],w=this.h[2],x=this.h[3],_=this.h[4],A=g,M=v,F=w,k=x,$=_,T=0;T<80;T++){var N=n(r(a(g,u(T,v,w,x),m[d[T]+y],c(T)),h[T]),_);g=_,_=x,x=r(w,10),w=v,v=N,N=n(r(a(A,u(79-T,M,F,k),m[f[T]+y],l(T)),p[T]),$),A=$,$=k,k=r(F,10),F=M,M=N}N=i(this.h[1],w,k),this.h[1]=i(this.h[2],x,$),this.h[2]=i(this.h[3],_,A),this.h[3]=i(this.h[4],g,M),this.h[4]=i(this.h[0],v,F),this.h[0]=N},o.prototype._digest=function(m){return m==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function u(m,y,g,v){return m<=15?y^g^v:m<=31?y&g|~y&v:m<=47?(y|~g)^v:m<=63?y&v|g&~v:y^(g|~v)}function c(m){return m<=15?0:m<=31?1518500249:m<=47?1859775393:m<=63?2400959708:2840853838}function l(m){return m<=15?1352829926:m<=31?1548603684:m<=47?1836072691:m<=63?2053994217:0}var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],h=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];return eb}var tb,wA;function h3e(){if(wA)return tb;wA=1;var t=ws(),e=ha();function r(n,i,a){if(!(this instanceof r))return new r(n,i,a);this.Hash=n,this.blockSize=n.blockSize/8,this.outSize=n.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(i,a))}return tb=r,r.prototype._init=function(n){n.length>this.blockSize&&(n=new this.Hash().update(n).digest()),e(n.length<=this.blockSize);for(var i=n.length;i<this.blockSize;i++)n.push(0);for(i=0;i<n.length;i++)n[i]^=54;for(this.inner=new this.Hash().update(n),i=0;i<n.length;i++)n[i]^=106;this.outer=new this.Hash().update(n)},r.prototype.update=function(n,i){return this.inner.update(n,i),this},r.prototype.digest=function(n){return this.outer.update(this.inner.digest()),this.outer.digest(n)},tb}var _A;function hE(){return _A||(_A=1,function(t){var e=t;e.utils=ws(),e.common=mp(),e.sha=d3e(),e.ripemd=f3e(),e.hmac=h3e(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(cA)),cA}var xA,EA;function p3e(){return EA||(EA=1,xA={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),xA}var SA;function pE(){return SA||(SA=1,function(t){var e=t,r=hE(),n=ZL(),i=pa(),a=i.assert;function s(c){c.type==="short"?this.curve=new n.short(c):c.type==="edwards"?this.curve=new n.edwards(c):this.curve=new n.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=s;function o(c,l){Object.defineProperty(e,c,{configurable:!0,enumerable:!0,get:function(){var d=new s(l);return Object.defineProperty(e,c,{configurable:!0,enumerable:!0,value:d}),d}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=p3e()}catch{u=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})}(uA)),uA}var rb,TA;function m3e(){if(TA)return rb;TA=1;var t=hE(),e=VL(),r=ha();function n(i){if(!(this instanceof n))return new n(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=e.toArray(i.entropy,i.entropyEnc||"hex"),s=e.toArray(i.nonce,i.nonceEnc||"hex"),o=e.toArray(i.pers,i.persEnc||"hex");r(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,s,o)}return rb=n,n.prototype._init=function(i,a,s){var o=i.concat(a).concat(s);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var u=0;u<this.V.length;u++)this.K[u]=0,this.V[u]=1;this._update(o),this._reseed=1,this.reseedInterval=281474976710656},n.prototype._hmac=function(){return new t.hmac(this.hash,this.K)},n.prototype._update=function(i){var a=this._hmac().update(this.V).update([0]);i&&(a=a.update(i)),this.K=a.digest(),this.V=this._hmac().update(this.V).digest(),i&&(this.K=this._hmac().update(this.V).update([1]).update(i).digest(),this.V=this._hmac().update(this.V).digest())},n.prototype.reseed=function(i,a,s,o){typeof a!="string"&&(o=s,s=a,a=null),i=e.toArray(i,a),s=e.toArray(s,o),r(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(s||[])),this._reseed=1},n.prototype.generate=function(i,a,s,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(o=s,s=a,a=null),s&&(s=e.toArray(s,o||"hex"),this._update(s));for(var u=[];u.length<i;)this.V=this._hmac().update(this.V).digest(),u=u.concat(this.V);var c=u.slice(0,i);return this._update(s),this._reseed++,e.encode(c,a)},rb}var nb,DA;function g3e(){if(DA)return nb;DA=1;var t=ei(),e=pa(),r=e.assert;function n(i,a){this.ec=i,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}return nb=n,n.fromPublic=function(i,a,s){return a instanceof n?a:new n(i,{pub:a,pubEnc:s})},n.fromPrivate=function(i,a,s){return a instanceof n?a:new n(i,{priv:a,privEnc:s})},n.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},n.prototype.getPublic=function(i,a){return typeof i=="string"&&(a=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),a?this.pub.encode(a,i):this.pub},n.prototype.getPrivate=function(i){return i==="hex"?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(i,a){this.priv=new t(i,a||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(i,a){if(i.x||i.y){this.ec.curve.type==="mont"?r(i.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&r(i.x&&i.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(i.x,i.y);return}this.pub=this.ec.curve.decodePoint(i,a)},n.prototype.derive=function(i){return i.validate()||r(i.validate(),"public point not validated"),i.mul(this.priv).getX()},n.prototype.sign=function(i,a,s){return this.ec.sign(i,this,a,s)},n.prototype.verify=function(i,a,s){return this.ec.verify(i,a,this,void 0,s)},n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},nb}var ib,AA;function y3e(){if(AA)return ib;AA=1;var t=ei(),e=pa(),r=e.assert;function n(u,c){if(u instanceof n)return u;this._importDER(u,c)||(r(u.r&&u.s,"Signature without r or s"),this.r=new t(u.r,16),this.s=new t(u.s,16),u.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=u.recoveryParam)}ib=n;function i(){this.place=0}function a(u,c){var l=u[c.place++];if(!(l&128))return l;var d=l&15;if(d===0||d>4||u[c.place]===0)return!1;for(var f=0,h=0,p=c.place;h<d;h++,p++)f<<=8,f|=u[p],f>>>=0;return f<=127?!1:(c.place=p,f)}function s(u){for(var c=0,l=u.length-1;!u[c]&&!(u[c+1]&128)&&c<l;)c++;return c===0?u:u.slice(c)}n.prototype._importDER=function(u,c){u=e.toArray(u,c);var l=new i;if(u[l.place++]!==48)return!1;var d=a(u,l);if(d===!1||d+l.place!==u.length||u[l.place++]!==2)return!1;var f=a(u,l);if(f===!1||u[l.place]&128)return!1;var h=u.slice(l.place,f+l.place);if(l.place+=f,u[l.place++]!==2)return!1;var p=a(u,l);if(p===!1||u.length!==p+l.place||u[l.place]&128)return!1;var m=u.slice(l.place,p+l.place);if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;if(m[0]===0)if(m[1]&128)m=m.slice(1);else return!1;return this.r=new t(h),this.s=new t(m),this.recoveryParam=null,!0};function o(u,c){if(c<128){u.push(c);return}var l=1+(Math.log(c)/Math.LN2>>>3);for(u.push(l|128);--l;)u.push(c>>>(l<<3)&255);u.push(c)}return n.prototype.toDER=function(u){var c=this.r.toArray(),l=this.s.toArray();for(c[0]&128&&(c=[0].concat(c)),l[0]&128&&(l=[0].concat(l)),c=s(c),l=s(l);!l[0]&&!(l[1]&128);)l=l.slice(1);var d=[2];o(d,c.length),d=d.concat(c),d.push(2),o(d,l.length);var f=d.concat(l),h=[48];return o(h,f.length),h=h.concat(f),e.encode(h,u)},ib}var ab,NA;function v3e(){if(NA)return ab;NA=1;var t=ei(),e=m3e(),r=pa(),n=pE(),i=lE(),a=r.assert,s=g3e(),o=y3e();function u(c){if(!(this instanceof u))return new u(c);typeof c=="string"&&(a(Object.prototype.hasOwnProperty.call(n,c),"Unknown curve "+c),c=n[c]),c instanceof n.PresetCurve&&(c={curve:c}),this.curve=c.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=c.curve.g,this.g.precompute(c.curve.n.bitLength()+1),this.hash=c.hash||c.curve.hash}return ab=u,u.prototype.keyPair=function(c){return new s(this,c)},u.prototype.keyFromPrivate=function(c,l){return s.fromPrivate(this,c,l)},u.prototype.keyFromPublic=function(c,l){return s.fromPublic(this,c,l)},u.prototype.genKeyPair=function(c){c||(c={});for(var l=new e({hash:this.hash,pers:c.pers,persEnc:c.persEnc||"utf8",entropy:c.entropy||i(this.hash.hmacStrength),entropyEnc:c.entropy&&c.entropyEnc||"utf8",nonce:this.n.toArray()}),d=this.n.byteLength(),f=this.n.sub(new t(2));;){var h=new t(l.generate(d));if(!(h.cmp(f)>0))return h.iaddn(1),this.keyFromPrivate(h)}},u.prototype._truncateToN=function(c,l,d){var f;if(t.isBN(c)||typeof c=="number")c=new t(c,16),f=c.byteLength();else if(typeof c=="object")f=c.length,c=new t(c,16);else{var h=c.toString();f=h.length+1>>>1,c=new t(h,16)}typeof d!="number"&&(d=f*8);var p=d-this.n.bitLength();return p>0&&(c=c.ushrn(p)),!l&&c.cmp(this.n)>=0?c.sub(this.n):c},u.prototype.sign=function(c,l,d,f){if(typeof d=="object"&&(f=d,d=null),f||(f={}),typeof c!="string"&&typeof c!="number"&&!t.isBN(c)){a(typeof c=="object"&&c&&typeof c.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),a(c.length>>>0===c.length);for(var h=0;h<c.length;h++)a((c[h]&255)===c[h])}l=this.keyFromPrivate(l,d),c=this._truncateToN(c,!1,f.msgBitLength),a(!c.isNeg(),"Can not sign a negative message");var p=this.n.byteLength(),m=l.getPrivate().toArray("be",p),y=c.toArray("be",p);a(new t(y).eq(c),"Can not sign message");for(var g=new e({hash:this.hash,entropy:m,nonce:y,pers:f.pers,persEnc:f.persEnc||"utf8"}),v=this.n.sub(new t(1)),w=0;;w++){var x=f.k?f.k(w):new t(g.generate(this.n.byteLength()));if(x=this._truncateToN(x,!0),!(x.cmpn(1)<=0||x.cmp(v)>=0)){var _=this.g.mul(x);if(!_.isInfinity()){var A=_.getX(),M=A.umod(this.n);if(M.cmpn(0)!==0){var F=x.invm(this.n).mul(M.mul(l.getPrivate()).iadd(c));if(F=F.umod(this.n),F.cmpn(0)!==0){var k=(_.getY().isOdd()?1:0)|(A.cmp(M)!==0?2:0);return f.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),k^=1),new o({r:M,s:F,recoveryParam:k})}}}}}},u.prototype.verify=function(c,l,d,f,h){h||(h={}),c=this._truncateToN(c,!1,h.msgBitLength),d=this.keyFromPublic(d,f),l=new o(l,"hex");var p=l.r,m=l.s;if(p.cmpn(1)<0||p.cmp(this.n)>=0||m.cmpn(1)<0||m.cmp(this.n)>=0)return!1;var y=m.invm(this.n),g=y.mul(c).umod(this.n),v=y.mul(p).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(g,d.getPublic(),v),w.isInfinity()?!1:w.eqXToP(p)):(w=this.g.mulAdd(g,d.getPublic(),v),w.isInfinity()?!1:w.getX().umod(this.n).cmp(p)===0)},u.prototype.recoverPubKey=function(c,l,d,f){a((3&d)===d,"The recovery param is more than two bits"),l=new o(l,f);var h=this.n,p=new t(c),m=l.r,y=l.s,g=d&1,v=d>>1;if(m.cmp(this.curve.p.umod(this.curve.n))>=0&&v)throw new Error("Unable to find sencond key candinate");v?m=this.curve.pointFromX(m.add(this.curve.n),g):m=this.curve.pointFromX(m,g);var w=l.r.invm(h),x=h.sub(p).mul(w).umod(h),_=y.mul(w).umod(h);return this.g.mulAdd(x,m,_)},u.prototype.getKeyRecoveryParam=function(c,l,d,f){if(l=new o(l,f),l.recoveryParam!==null)return l.recoveryParam;for(var h=0;h<4;h++){var p;try{p=this.recoverPubKey(c,l,h)}catch{continue}if(p.eq(d))return h}throw new Error("Unable to find valid recovery factor")},ab}var sb,IA;function b3e(){if(IA)return sb;IA=1;var t=pa(),e=t.assert,r=t.parseBytes,n=t.cachedProperty;function i(a,s){this.eddsa=a,this._secret=r(s.secret),a.isPoint(s.pub)?this._pub=s.pub:this._pubBytes=r(s.pub)}return i.fromPublic=function(a,s){return s instanceof i?s:new i(a,{pub:s})},i.fromSecret=function(a,s){return s instanceof i?s:new i(a,{secret:s})},i.prototype.secret=function(){return this._secret},n(i,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(i,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(i,"privBytes",function(){var a=this.eddsa,s=this.hash(),o=a.encodingLength-1,u=s.slice(0,a.encodingLength);return u[0]&=248,u[o]&=127,u[o]|=64,u}),n(i,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(i,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(i,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),i.prototype.sign=function(a){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)},i.prototype.verify=function(a,s){return this.eddsa.verify(a,s,this)},i.prototype.getSecret=function(a){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),a)},i.prototype.getPublic=function(a){return t.encode(this.pubBytes(),a)},sb=i,sb}var ob,CA;function w3e(){if(CA)return ob;CA=1;var t=ei(),e=pa(),r=e.assert,n=e.cachedProperty,i=e.parseBytes;function a(s,o){this.eddsa=s,typeof o!="object"&&(o=i(o)),Array.isArray(o)&&(r(o.length===s.encodingLength*2,"Signature has invalid size"),o={R:o.slice(0,s.encodingLength),S:o.slice(s.encodingLength)}),r(o.R&&o.S,"Signature without R or S"),s.isPoint(o.R)&&(this._R=o.R),o.S instanceof t&&(this._S=o.S),this._Rencoded=Array.isArray(o.R)?o.R:o.Rencoded,this._Sencoded=Array.isArray(o.S)?o.S:o.Sencoded}return n(a,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(a,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(a,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(a,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),a.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},a.prototype.toHex=function(){return e.encode(this.toBytes(),"hex").toUpperCase()},ob=a,ob}var ub,OA;function _3e(){if(OA)return ub;OA=1;var t=hE(),e=pE(),r=pa(),n=r.assert,i=r.parseBytes,a=b3e(),s=w3e();function o(u){if(n(u==="ed25519","only tested with ed25519 so far"),!(this instanceof o))return new o(u);u=e[u].curve,this.curve=u,this.g=u.g,this.g.precompute(u.n.bitLength()+1),this.pointClass=u.point().constructor,this.encodingLength=Math.ceil(u.n.bitLength()/8),this.hash=t.sha512}return ub=o,o.prototype.sign=function(u,c){u=i(u);var l=this.keyFromSecret(c),d=this.hashInt(l.messagePrefix(),u),f=this.g.mul(d),h=this.encodePoint(f),p=this.hashInt(h,l.pubBytes(),u).mul(l.priv()),m=d.add(p).umod(this.curve.n);return this.makeSignature({R:f,S:m,Rencoded:h})},o.prototype.verify=function(u,c,l){if(u=i(u),c=this.makeSignature(c),c.S().gte(c.eddsa.curve.n)||c.S().isNeg())return!1;var d=this.keyFromPublic(l),f=this.hashInt(c.Rencoded(),d.pubBytes(),u),h=this.g.mul(c.S()),p=c.R().add(d.pub().mul(f));return p.eq(h)},o.prototype.hashInt=function(){for(var u=this.hash(),c=0;c<arguments.length;c++)u.update(arguments[c]);return r.intFromLE(u.digest()).umod(this.curve.n)},o.prototype.keyFromPublic=function(u){return a.fromPublic(this,u)},o.prototype.keyFromSecret=function(u){return a.fromSecret(this,u)},o.prototype.makeSignature=function(u){return u instanceof s?u:new s(this,u)},o.prototype.encodePoint=function(u){var c=u.getY().toArray("le",this.encodingLength);return c[this.encodingLength-1]|=u.getX().isOdd()?128:0,c},o.prototype.decodePoint=function(u){u=r.parseBytes(u);var c=u.length-1,l=u.slice(0,c).concat(u[c]&-129),d=(u[c]&128)!==0,f=r.intFromLE(l);return this.curve.pointFromY(f,d)},o.prototype.encodeInt=function(u){return u.toArray("le",this.encodingLength)},o.prototype.decodeInt=function(u){return r.intFromLE(u)},o.prototype.isPoint=function(u){return u instanceof this.pointClass},ub}var MA;function mE(){return MA||(MA=1,function(t){var e=t;e.version=i3e.version,e.utils=pa(),e.rand=lE(),e.curve=ZL(),e.curves=pE(),e.ec=v3e(),e.eddsa=_3e()}(GD)),GD}var ra={},kA={},RA={},FA;function x3e(){return FA||(FA=1,function(t){var e=gp(),r=gr(),n=t;n.define=function(a,s){return new i(a,s)};function i(a,s){this.name=a,this.body=s,this.decoders={},this.encoders={}}i.prototype._createNamed=function(a){var s;try{s=gc.runInThisContext("(function "+this.name+`(entity) {
1111
1111
  this._initNamed(entity);
1112
1112
  })`)}catch{s=function(o){this._initNamed(o)}}return r(s,a),s.prototype._initNamed=function(o){a.call(this,o)},new s(this)},i.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},i.prototype.decode=function(a,s,o){return this._getDecoder(s).decode(a,o)},i.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},i.prototype.encode=function(a,s,o){return this._getEncoder(s).encode(a,o)}}(RA)),RA}var PA={},cb={},BA;function E3e(){if(BA)return cb;BA=1;var t=gr();function e(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}cb.Reporter=e,e.prototype.isError=function(n){return n instanceof r},e.prototype.save=function(){var n=this._reporterState;return{obj:n.obj,pathLen:n.path.length}},e.prototype.restore=function(n){var i=this._reporterState;i.obj=n.obj,i.path=i.path.slice(0,n.pathLen)},e.prototype.enterKey=function(n){return this._reporterState.path.push(n)},e.prototype.exitKey=function(n){var i=this._reporterState;i.path=i.path.slice(0,n-1)},e.prototype.leaveKey=function(n,i,a){var s=this._reporterState;this.exitKey(n),s.obj!==null&&(s.obj[i]=a)},e.prototype.path=function(){return this._reporterState.path.join("/")},e.prototype.enterObject=function(){var n=this._reporterState,i=n.obj;return n.obj={},i},e.prototype.leaveObject=function(n){var i=this._reporterState,a=i.obj;return i.obj=n,a},e.prototype.error=function(n){var i,a=this._reporterState,s=n instanceof r;if(s?i=n:i=new r(a.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),n.message||n,n.stack),!a.options.partial)throw i;return s||a.errors.push(i),i},e.prototype.wrapResult=function(n){var i=this._reporterState;return i.options.partial?{result:this.isError(n)?null:n,errors:i.errors}:n};function r(n,i){this.path=n,this.rethrow(i)}return t(r,Error),r.prototype.rethrow=function(n){if(this.message=n+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(i){this.stack=i.stack}return this},cb}var vm={},LA;function jA(){if(LA)return vm;LA=1;var t=gr(),e=yf().Reporter,r=mc().Buffer;function n(a,s){if(e.call(this,s),!r.isBuffer(a)){this.error("Input not Buffer");return}this.base=a,this.offset=0,this.length=a.length}t(n,e),vm.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:e.prototype.save.call(this)}},n.prototype.restore=function(a){var s=new n(this.base);return s.offset=a.offset,s.length=this.offset,this.offset=a.offset,e.prototype.restore.call(this,a.reporter),s},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},n.prototype.skip=function(a,s){if(!(this.offset+a<=this.length))return this.error(s||"DecoderBuffer overrun");var o=new n(this.base);return o._reporterState=this._reporterState,o.offset=this.offset,o.length=this.offset+a,this.offset+=a,o},n.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)};function i(a,s){if(Array.isArray(a))this.length=0,this.value=a.map(function(o){return o instanceof i||(o=new i(o,s)),this.length+=o.length,o},this);else if(typeof a=="number"){if(!(0<=a&&a<=255))return s.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if(typeof a=="string")this.value=a,this.length=r.byteLength(a);else if(r.isBuffer(a))this.value=a,this.length=a.length;else return s.error("Unsupported type: "+typeof a)}return vm.EncoderBuffer=i,i.prototype.join=function(a,s){return a||(a=new r(this.length)),s||(s=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(o){o.join(a,s),s+=o.length}):(typeof this.value=="number"?a[s]=this.value:typeof this.value=="string"?a.write(this.value,s):r.isBuffer(this.value)&&this.value.copy(a,s),s+=this.length)),a},vm}var lb,$A;function S3e(){if($A)return lb;$A=1;var t=yf().Reporter,e=yf().EncoderBuffer,r=yf().DecoderBuffer,n=ha(),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],a=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),s=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function o(c,l){var d={};this._baseState=d,d.enc=c,d.parent=l||null,d.children=null,d.tag=null,d.args=null,d.reverseArgs=null,d.choice=null,d.optional=!1,d.any=!1,d.obj=!1,d.use=null,d.useDecoder=null,d.key=null,d.default=null,d.explicit=null,d.implicit=null,d.contains=null,d.parent||(d.children=[],this._wrap())}lb=o;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return o.prototype.clone=function(){var c=this._baseState,l={};u.forEach(function(f){l[f]=c[f]});var d=new this.constructor(l.parent);return d._baseState=l,d},o.prototype._wrap=function(){var c=this._baseState;a.forEach(function(l){this[l]=function(){var d=new this.constructor(this);return c.children.push(d),d[l].apply(d,arguments)}},this)},o.prototype._init=function(c){var l=this._baseState;n(l.parent===null),c.call(this),l.children=l.children.filter(function(d){return d._baseState.parent===this},this),n.equal(l.children.length,1,"Root node can have only one child")},o.prototype._useArgs=function(c){var l=this._baseState,d=c.filter(function(f){return f instanceof this.constructor},this);c=c.filter(function(f){return!(f instanceof this.constructor)},this),d.length!==0&&(n(l.children===null),l.children=d,d.forEach(function(f){f._baseState.parent=this},this)),c.length!==0&&(n(l.args===null),l.args=c,l.reverseArgs=c.map(function(f){if(typeof f!="object"||f.constructor!==Object)return f;var h={};return Object.keys(f).forEach(function(p){p==(p|0)&&(p|=0);var m=f[p];h[m]=p}),h}))},s.forEach(function(c){o.prototype[c]=function(){var l=this._baseState;throw new Error(c+" not implemented for encoding: "+l.enc)}}),i.forEach(function(c){o.prototype[c]=function(){var l=this._baseState,d=Array.prototype.slice.call(arguments);return n(l.tag===null),l.tag=c,this._useArgs(d),this}}),o.prototype.use=function(c){n(c);var l=this._baseState;return n(l.use===null),l.use=c,this},o.prototype.optional=function(){var c=this._baseState;return c.optional=!0,this},o.prototype.def=function(c){var l=this._baseState;return n(l.default===null),l.default=c,l.optional=!0,this},o.prototype.explicit=function(c){var l=this._baseState;return n(l.explicit===null&&l.implicit===null),l.explicit=c,this},o.prototype.implicit=function(c){var l=this._baseState;return n(l.explicit===null&&l.implicit===null),l.implicit=c,this},o.prototype.obj=function(){var c=this._baseState,l=Array.prototype.slice.call(arguments);return c.obj=!0,l.length!==0&&this._useArgs(l),this},o.prototype.key=function(c){var l=this._baseState;return n(l.key===null),l.key=c,this},o.prototype.any=function(){var c=this._baseState;return c.any=!0,this},o.prototype.choice=function(c){var l=this._baseState;return n(l.choice===null),l.choice=c,this._useArgs(Object.keys(c).map(function(d){return c[d]})),this},o.prototype.contains=function(c){var l=this._baseState;return n(l.use===null),l.contains=c,this},o.prototype._decode=function(c,l){var d=this._baseState;if(d.parent===null)return c.wrapResult(d.children[0]._decode(c,l));var f=d.default,h=!0,p=null;if(d.key!==null&&(p=c.enterKey(d.key)),d.optional){var m=null;if(d.explicit!==null?m=d.explicit:d.implicit!==null?m=d.implicit:d.tag!==null&&(m=d.tag),m===null&&!d.any){var y=c.save();try{d.choice===null?this._decodeGeneric(d.tag,c,l):this._decodeChoice(c,l),h=!0}catch{h=!1}c.restore(y)}else if(h=this._peekTag(c,m,d.any),c.isError(h))return h}var g;if(d.obj&&h&&(g=c.enterObject()),h){if(d.explicit!==null){var v=this._decodeTag(c,d.explicit);if(c.isError(v))return v;c=v}var w=c.offset;if(d.use===null&&d.choice===null){if(d.any)var y=c.save();var x=this._decodeTag(c,d.implicit!==null?d.implicit:d.tag,d.any);if(c.isError(x))return x;d.any?f=c.raw(y):c=x}if(l&&l.track&&d.tag!==null&&l.track(c.path(),w,c.length,"tagged"),l&&l.track&&d.tag!==null&&l.track(c.path(),c.offset,c.length,"content"),d.any?f=f:d.choice===null?f=this._decodeGeneric(d.tag,c,l):f=this._decodeChoice(c,l),c.isError(f))return f;if(!d.any&&d.choice===null&&d.children!==null&&d.children.forEach(function(A){A._decode(c,l)}),d.contains&&(d.tag==="octstr"||d.tag==="bitstr")){var _=new r(f);f=this._getUse(d.contains,c._reporterState.obj)._decode(_,l)}}return d.obj&&h&&(f=c.leaveObject(g)),d.key!==null&&(f!==null||h===!0)?c.leaveKey(p,d.key,f):p!==null&&c.exitKey(p),f},o.prototype._decodeGeneric=function(c,l,d){var f=this._baseState;return c==="seq"||c==="set"?null:c==="seqof"||c==="setof"?this._decodeList(l,c,f.args[0],d):/str$/.test(c)?this._decodeStr(l,c,d):c==="objid"&&f.args?this._decodeObjid(l,f.args[0],f.args[1],d):c==="objid"?this._decodeObjid(l,null,null,d):c==="gentime"||c==="utctime"?this._decodeTime(l,c,d):c==="null_"?this._decodeNull(l,d):c==="bool"?this._decodeBool(l,d):c==="objDesc"?this._decodeStr(l,c,d):c==="int"||c==="enum"?this._decodeInt(l,f.args&&f.args[0],d):f.use!==null?this._getUse(f.use,l._reporterState.obj)._decode(l,d):l.error("unknown tag: "+c)},o.prototype._getUse=function(c,l){var d=this._baseState;return d.useDecoder=this._use(c,l),n(d.useDecoder._baseState.parent===null),d.useDecoder=d.useDecoder._baseState.children[0],d.implicit!==d.useDecoder._baseState.implicit&&(d.useDecoder=d.useDecoder.clone(),d.useDecoder._baseState.implicit=d.implicit),d.useDecoder},o.prototype._decodeChoice=function(c,l){var d=this._baseState,f=null,h=!1;return Object.keys(d.choice).some(function(p){var m=c.save(),y=d.choice[p];try{var g=y._decode(c,l);if(c.isError(g))return!1;f={type:p,value:g},h=!0}catch{return c.restore(m),!1}return!0},this),h?f:c.error("Choice not matched")},o.prototype._createEncoderBuffer=function(c){return new e(c,this.reporter)},o.prototype._encode=function(c,l,d){var f=this._baseState;if(!(f.default!==null&&f.default===c)){var h=this._encodeValue(c,l,d);if(h!==void 0&&!this._skipDefault(h,l,d))return h}},o.prototype._encodeValue=function(c,l,d){var f=this._baseState;if(f.parent===null)return f.children[0]._encode(c,l||new t);var y=null;if(this.reporter=l,f.optional&&c===void 0)if(f.default!==null)c=f.default;else return;var h=null,p=!1;if(f.any)y=this._createEncoderBuffer(c);else if(f.choice)y=this._encodeChoice(c,l);else if(f.contains)h=this._getUse(f.contains,d)._encode(c,l),p=!0;else if(f.children)h=f.children.map(function(w){if(w._baseState.tag==="null_")return w._encode(null,l,c);if(w._baseState.key===null)return l.error("Child should have a key");var x=l.enterKey(w._baseState.key);if(typeof c!="object")return l.error("Child expected, but input is not object");var _=w._encode(c[w._baseState.key],l,c);return l.leaveKey(x),_},this).filter(function(w){return w}),h=this._createEncoderBuffer(h);else if(f.tag==="seqof"||f.tag==="setof"){if(!(f.args&&f.args.length===1))return l.error("Too many args for : "+f.tag);if(!Array.isArray(c))return l.error("seqof/setof, but data is not Array");var m=this.clone();m._baseState.implicit=null,h=this._createEncoderBuffer(c.map(function(w){var x=this._baseState;return this._getUse(x.args[0],c)._encode(w,l)},m))}else f.use!==null?y=this._getUse(f.use,d)._encode(c,l):(h=this._encodePrimitive(f.tag,c),p=!0);var y;if(!f.any&&f.choice===null){var g=f.implicit!==null?f.implicit:f.tag,v=f.implicit===null?"universal":"context";g===null?f.use===null&&l.error("Tag could be omitted only for .use()"):f.use===null&&(y=this._encodeComposite(g,p,v,h))}return f.explicit!==null&&(y=this._encodeComposite(f.explicit,!1,"context",y)),y},o.prototype._encodeChoice=function(c,l){var d=this._baseState,f=d.choice[c.type];return f||n(!1,c.type+" not found in "+JSON.stringify(Object.keys(d.choice))),f._encode(c.value,l)},o.prototype._encodePrimitive=function(c,l){var d=this._baseState;if(/str$/.test(c))return this._encodeStr(l,c);if(c==="objid"&&d.args)return this._encodeObjid(l,d.reverseArgs[0],d.args[1]);if(c==="objid")return this._encodeObjid(l,null,null);if(c==="gentime"||c==="utctime")return this._encodeTime(l,c);if(c==="null_")return this._encodeNull();if(c==="int"||c==="enum")return this._encodeInt(l,d.args&&d.reverseArgs[0]);if(c==="bool")return this._encodeBool(l);if(c==="objDesc")return this._encodeStr(l,c);throw new Error("Unsupported tag: "+c)},o.prototype._isNumstr=function(c){return/^[0-9 ]*$/.test(c)},o.prototype._isPrintstr=function(c){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(c)},lb}var UA;function yf(){return UA||(UA=1,function(t){var e=t;e.Reporter=E3e().Reporter,e.DecoderBuffer=jA().DecoderBuffer,e.EncoderBuffer=jA().EncoderBuffer,e.Node=S3e()}(PA)),PA}var zA={},qA={},VA;function T3e(){return VA||(VA=1,function(t){var e=JL();t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e._reverse(t.tag)}(qA)),qA}var ZA;function JL(){return ZA||(ZA=1,function(t){var e=t;e._reverse=function(r){var n={};return Object.keys(r).forEach(function(i){(i|0)==i&&(i=i|0);var a=r[i];n[a]=i}),n},e.der=T3e()}(zA)),zA}var HA={},db,WA;function KL(){if(WA)return db;WA=1;var t=gr(),e=gp(),r=e.base,n=e.bignum,i=e.constants.der;function a(c){this.enc="der",this.name=c.name,this.entity=c,this.tree=new s,this.tree._init(c.body)}db=a,a.prototype.decode=function(c,l){return c instanceof r.DecoderBuffer||(c=new r.DecoderBuffer(c,l)),this.tree._decode(c,l)};function s(c){r.Node.call(this,"der",c)}t(s,r.Node),s.prototype._peekTag=function(c,l,d){if(c.isEmpty())return!1;var f=c.save(),h=o(c,'Failed to peek tag: "'+l+'"');return c.isError(h)?h:(c.restore(f),h.tag===l||h.tagStr===l||h.tagStr+"of"===l||d)},s.prototype._decodeTag=function(c,l,d){var f=o(c,'Failed to decode tag of "'+l+'"');if(c.isError(f))return f;var h=u(c,f.primitive,'Failed to get length of "'+l+'"');if(c.isError(h))return h;if(!d&&f.tag!==l&&f.tagStr!==l&&f.tagStr+"of"!==l)return c.error('Failed to match tag: "'+l+'"');if(f.primitive||h!==null)return c.skip(h,'Failed to match body of: "'+l+'"');var p=c.save(),m=this._skipUntilEnd(c,'Failed to skip indefinite length body: "'+this.tag+'"');return c.isError(m)?m:(h=c.offset-p.offset,c.restore(p),c.skip(h,'Failed to match body of: "'+l+'"'))},s.prototype._skipUntilEnd=function(c,l){for(;;){var d=o(c,l);if(c.isError(d))return d;var f=u(c,d.primitive,l);if(c.isError(f))return f;var h;if(d.primitive||f!==null?h=c.skip(f):h=this._skipUntilEnd(c,l),c.isError(h))return h;if(d.tagStr==="end")break}},s.prototype._decodeList=function(c,l,d,f){for(var h=[];!c.isEmpty();){var p=this._peekTag(c,"end");if(c.isError(p))return p;var m=d.decode(c,"der",f);if(c.isError(m)&&p)break;h.push(m)}return h},s.prototype._decodeStr=function(c,l){if(l==="bitstr"){var d=c.readUInt8();return c.isError(d)?d:{unused:d,data:c.raw()}}else if(l==="bmpstr"){var f=c.raw();if(f.length%2===1)return c.error("Decoding of string type: bmpstr length mismatch");for(var h="",p=0;p<f.length/2;p++)h+=String.fromCharCode(f.readUInt16BE(p*2));return h}else if(l==="numstr"){var m=c.raw().toString("ascii");return this._isNumstr(m)?m:c.error("Decoding of string type: numstr unsupported characters")}else{if(l==="octstr"||l==="objDesc")return c.raw();if(l==="printstr"){var y=c.raw().toString("ascii");return this._isPrintstr(y)?y:c.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(l)?c.raw().toString():c.error("Decoding of string type: "+l+" unsupported")}},s.prototype._decodeObjid=function(c,l,d){for(var f,h=[],p=0;!c.isEmpty();){var m=c.readUInt8();p<<=7,p|=m&127,m&128||(h.push(p),p=0)}m&128&&h.push(p);var y=h[0]/40|0,g=h[0]%40;if(d?f=h:f=[y,g].concat(h.slice(1)),l){var v=l[f.join(" ")];v===void 0&&(v=l[f.join(".")]),v!==void 0&&(f=v)}return f},s.prototype._decodeTime=function(c,l){var d=c.raw().toString();if(l==="gentime")var f=d.slice(0,4)|0,h=d.slice(4,6)|0,p=d.slice(6,8)|0,m=d.slice(8,10)|0,y=d.slice(10,12)|0,g=d.slice(12,14)|0;else if(l==="utctime"){var f=d.slice(0,2)|0,h=d.slice(2,4)|0,p=d.slice(4,6)|0,m=d.slice(6,8)|0,y=d.slice(8,10)|0,g=d.slice(10,12)|0;f<70?f=2e3+f:f=1900+f}else return c.error("Decoding "+l+" time is not supported yet");return Date.UTC(f,h-1,p,m,y,g,0)},s.prototype._decodeNull=function(c){return null},s.prototype._decodeBool=function(c){var l=c.readUInt8();return c.isError(l)?l:l!==0},s.prototype._decodeInt=function(c,l){var d=c.raw(),f=new n(d);return l&&(f=l[f.toString(10)]||f),f},s.prototype._use=function(c,l){return typeof c=="function"&&(c=c(l)),c._getDecoder("der").tree};function o(c,l){var d=c.readUInt8(l);if(c.isError(d))return d;var f=i.tagClass[d>>6],h=(d&32)===0;if((d&31)===31){var p=d;for(d=0;(p&128)===128;){if(p=c.readUInt8(l),c.isError(p))return p;d<<=7,d|=p&127}}else d&=31;var m=i.tag[d];return{cls:f,primitive:h,tag:d,tagStr:m}}function u(c,l,d){var f=c.readUInt8(d);if(c.isError(f))return f;if(!l&&f===128)return null;if(!(f&128))return f;var h=f&127;if(h>4)return c.error("length octect is too long");f=0;for(var p=0;p<h;p++){f<<=8;var m=c.readUInt8(d);if(c.isError(m))return m;f|=m}return f}return db}var fb,YA;function D3e(){if(YA)return fb;YA=1;var t=gr(),e=mc().Buffer,r=KL();function n(i){r.call(this,i),this.enc="pem"}return t(n,r),fb=n,n.prototype.decode=function(i,a){for(var s=i.toString().split(/[\r\n]+/g),o=a.label.toUpperCase(),u=/^-----(BEGIN|END) ([^-]+)-----$/,c=-1,l=-1,d=0;d<s.length;d++){var f=s[d].match(u);if(f!==null&&f[2]===o)if(c===-1){if(f[1]!=="BEGIN")break;c=d}else{if(f[1]!=="END")break;l=d;break}}if(c===-1||l===-1)throw new Error("PEM section not found for: "+o);var h=s.slice(c+1,l).join("");h.replace(/[^a-z0-9\+\/=]+/gi,"");var p=new e(h,"base64");return r.prototype.decode.call(this,p,a)},fb}var JA;function A3e(){return JA||(JA=1,function(t){var e=t;e.der=KL(),e.pem=D3e()}(HA)),HA}var KA={},hb,GA;function GL(){if(GA)return hb;GA=1;var t=gr(),e=mc().Buffer,r=gp(),n=r.base,i=r.constants.der;function a(c){this.enc="der",this.name=c.name,this.entity=c,this.tree=new s,this.tree._init(c.body)}hb=a,a.prototype.encode=function(c,l){return this.tree._encode(c,l).join()};function s(c){n.Node.call(this,"der",c)}t(s,n.Node),s.prototype._encodeComposite=function(c,l,d,f){var h=u(c,l,d,this.reporter);if(f.length<128){var y=new e(2);return y[0]=h,y[1]=f.length,this._createEncoderBuffer([y,f])}for(var p=1,m=f.length;m>=256;m>>=8)p++;var y=new e(2+p);y[0]=h,y[1]=128|p;for(var m=1+p,g=f.length;g>0;m--,g>>=8)y[m]=g&255;return this._createEncoderBuffer([y,f])},s.prototype._encodeStr=function(c,l){if(l==="bitstr")return this._createEncoderBuffer([c.unused|0,c.data]);if(l==="bmpstr"){for(var d=new e(c.length*2),f=0;f<c.length;f++)d.writeUInt16BE(c.charCodeAt(f),f*2);return this._createEncoderBuffer(d)}else return l==="numstr"?this._isNumstr(c)?this._createEncoderBuffer(c):this.reporter.error("Encoding of string type: numstr supports only digits and space"):l==="printstr"?this._isPrintstr(c)?this._createEncoderBuffer(c):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(l)?this._createEncoderBuffer(c):l==="objDesc"?this._createEncoderBuffer(c):this.reporter.error("Encoding of string type: "+l+" unsupported")},s.prototype._encodeObjid=function(c,l,d){if(typeof c=="string"){if(!l)return this.reporter.error("string objid given, but no values map found");if(!l.hasOwnProperty(c))return this.reporter.error("objid not found in values map");c=l[c].split(/[\s\.]+/g);for(var f=0;f<c.length;f++)c[f]|=0}else if(Array.isArray(c)){c=c.slice();for(var f=0;f<c.length;f++)c[f]|=0}if(!Array.isArray(c))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(c));if(!d){if(c[1]>=40)return this.reporter.error("Second objid identifier OOB");c.splice(0,2,c[0]*40+c[1])}for(var h=0,f=0;f<c.length;f++){var p=c[f];for(h++;p>=128;p>>=7)h++}for(var m=new e(h),y=m.length-1,f=c.length-1;f>=0;f--){var p=c[f];for(m[y--]=p&127;(p>>=7)>0;)m[y--]=128|p&127}return this._createEncoderBuffer(m)};function o(c){return c<10?"0"+c:c}s.prototype._encodeTime=function(c,l){var d,f=new Date(c);return l==="gentime"?d=[o(f.getFullYear()),o(f.getUTCMonth()+1),o(f.getUTCDate()),o(f.getUTCHours()),o(f.getUTCMinutes()),o(f.getUTCSeconds()),"Z"].join(""):l==="utctime"?d=[o(f.getFullYear()%100),o(f.getUTCMonth()+1),o(f.getUTCDate()),o(f.getUTCHours()),o(f.getUTCMinutes()),o(f.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+l+" time is not supported yet"),this._encodeStr(d,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(c,l){if(typeof c=="string"){if(!l)return this.reporter.error("String int or enum given, but no values map");if(!l.hasOwnProperty(c))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(c));c=l[c]}if(typeof c!="number"&&!e.isBuffer(c)){var d=c.toArray();!c.sign&&d[0]&128&&d.unshift(0),c=new e(d)}if(e.isBuffer(c)){var f=c.length;c.length===0&&f++;var h=new e(f);return c.copy(h),c.length===0&&(h[0]=0),this._createEncoderBuffer(h)}if(c<128)return this._createEncoderBuffer(c);if(c<256)return this._createEncoderBuffer([0,c]);for(var f=1,p=c;p>=256;p>>=8)f++;for(var h=new Array(f),p=h.length-1;p>=0;p--)h[p]=c&255,c>>=8;return h[0]&128&&h.unshift(0),this._createEncoderBuffer(new e(h))},s.prototype._encodeBool=function(c){return this._createEncoderBuffer(c?255:0)},s.prototype._use=function(c,l){return typeof c=="function"&&(c=c(l)),c._getEncoder("der").tree},s.prototype._skipDefault=function(c,l,d){var f=this._baseState,h;if(f.default===null)return!1;var p=c.join();if(f.defaultBuffer===void 0&&(f.defaultBuffer=this._encodeValue(f.default,l,d).join()),p.length!==f.defaultBuffer.length)return!1;for(h=0;h<p.length;h++)if(p[h]!==f.defaultBuffer[h])return!1;return!0};function u(c,l,d,f){var h;if(c==="seqof"?c="seq":c==="setof"&&(c="set"),i.tagByName.hasOwnProperty(c))h=i.tagByName[c];else if(typeof c=="number"&&(c|0)===c)h=c;else return f.error("Unknown tag: "+c);return h>=31?f.error("Multi-octet tag encoding unsupported"):(l||(h|=32),h|=i.tagClassByName[d||"universal"]<<6,h)}return hb}var pb,XA;function N3e(){if(XA)return pb;XA=1;var t=gr(),e=GL();function r(n){e.call(this,n),this.enc="pem"}return t(r,e),pb=r,r.prototype.encode=function(n,i){for(var a=e.prototype.encode.call(this,n),s=a.toString("base64"),o=["-----BEGIN "+i.label+"-----"],u=0;u<s.length;u+=64)o.push(s.slice(u,u+64));return o.push("-----END "+i.label+"-----"),o.join(`
1113
1113
  `)},pb}var QA;function I3e(){return QA||(QA=1,function(t){var e=t;e.der=GL(),e.pem=N3e()}(KA)),KA}var eN;function gp(){return eN||(eN=1,function(t){var e=t;e.bignum=ei(),e.define=x3e().define,e.base=yf(),e.constants=JL(),e.decoders=A3e(),e.encoders=I3e()}(kA)),kA}var mb,tN;function C3e(){if(tN)return mb;tN=1;var t=gp(),e=t.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),r=t.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),n=t.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),i=t.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())}),a=t.define("RelativeDistinguishedName",function(){this.setof(r)}),s=t.define("RDNSequence",function(){this.seqof(a)}),o=t.define("Name",function(){this.choice({rdnSequence:this.use(s)})}),u=t.define("Validity",function(){this.seq().obj(this.key("notBefore").use(e),this.key("notAfter").use(e))}),c=t.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),l=t.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(n),this.key("issuer").use(o),this.key("validity").use(u),this.key("subject").use(o),this.key("subjectPublicKeyInfo").use(i),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(c).optional())}),d=t.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(n),this.key("signatureValue").bitstr())});return mb=d,mb}var rN;function O3e(){if(rN)return ra;rN=1;var t=gp();ra.certificate=C3e();var e=t.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});ra.RSAPrivateKey=e;var r=t.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});ra.RSAPublicKey=r;var n=t.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),i=t.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())});ra.PublicKey=i;var a=t.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(n),this.key("subjectPrivateKey").octstr())});ra.PrivateKey=a;var s=t.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});ra.EncryptedPrivateKey=s;var o=t.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});ra.DSAPrivateKey=o,ra.DSAparam=t.define("DSAparam",function(){this.int()});var u=t.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),c=t.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(u),this.key("publicKey").optional().explicit(1).bitstr())});return ra.ECPrivateKey=c,ra.signature=t.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}),ra}const M3e={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var gb,nN;function k3e(){if(nN)return gb;nN=1;var t=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,e=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,n=My(),i=cE(),a=ur().Buffer;return gb=function(s,o){var u=s.toString(),c=u.match(t),l;if(c){var d="aes"+c[1],f=a.from(c[2],"hex"),h=a.from(c[3].replace(/[\r\n]/g,""),"base64"),p=n(o,f.slice(0,8),parseInt(c[1],10)).key,m=[],y=i.createDecipheriv(d,p,f);m.push(y.update(h)),m.push(y.final()),l=a.concat(m)}else{var g=u.match(r);l=a.from(g[2].replace(/[\r\n]/g,""),"base64")}var v=u.match(e)[1];return{tag:v,data:l}},gb}var yb,iN;function Py(){if(iN)return yb;iN=1;var t=O3e(),e=M3e,r=k3e(),n=cE(),i=IL(),a=ur().Buffer;function s(u,c){var l=u.algorithm.decrypt.kde.kdeparams.salt,d=parseInt(u.algorithm.decrypt.kde.kdeparams.iters.toString(),10),f=e[u.algorithm.decrypt.cipher.algo.join(".")],h=u.algorithm.decrypt.cipher.iv,p=u.subjectPrivateKey,m=parseInt(f.split("-")[1],10)/8,y=i.pbkdf2Sync(c,l,d,m,"sha1"),g=n.createDecipheriv(f,y,h),v=[];return v.push(g.update(p)),v.push(g.final()),a.concat(v)}function o(u){var c;typeof u=="object"&&!a.isBuffer(u)&&(c=u.passphrase,u=u.key),typeof u=="string"&&(u=a.from(u));var l=r(u,c),d=l.tag,f=l.data,h,p;switch(d){case"CERTIFICATE":p=t.certificate.decode(f,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(p||(p=t.PublicKey.decode(f,"der")),h=p.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return t.RSAPublicKey.decode(p.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return p.subjectPrivateKey=p.subjectPublicKey,{type:"ec",data:p};case"1.2.840.10040.4.1":return p.algorithm.params.pub_key=t.DSAparam.decode(p.subjectPublicKey.data,"der"),{type:"dsa",data:p.algorithm.params};default:throw new Error("unknown key id "+h)}case"ENCRYPTED PRIVATE KEY":f=t.EncryptedPrivateKey.decode(f,"der"),f=s(f,c);case"PRIVATE KEY":switch(p=t.PrivateKey.decode(f,"der"),h=p.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return t.RSAPrivateKey.decode(p.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:p.algorithm.curve,privateKey:t.ECPrivateKey.decode(p.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return p.algorithm.params.priv_key=t.DSAparam.decode(p.subjectPrivateKey,"der"),{type:"dsa",params:p.algorithm.params};default:throw new Error("unknown key id "+h)}case"RSA PUBLIC KEY":return t.RSAPublicKey.decode(f,"der");case"RSA PRIVATE KEY":return t.RSAPrivateKey.decode(f,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:t.DSAPrivateKey.decode(f,"der")};case"EC PRIVATE KEY":return f=t.ECPrivateKey.decode(f,"der"),{curve:f.parameters.value,privateKey:f.privateKey};default:throw new Error("unknown key type "+d)}}return o.signature=t.signature,yb=o,yb}const XL={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var aN;function R3e(){if(aN)return Dd.exports;aN=1;var t=ur().Buffer,e=EL(),r=fE(),n=mE().ec,i=dE(),a=Py(),s=XL,o=1;function u(g,v,w,x,_){var A=a(v);if(A.curve){if(x!=="ecdsa"&&x!=="ecdsa/rsa")throw new Error("wrong private key type");return c(g,A)}else if(A.type==="dsa"){if(x!=="dsa")throw new Error("wrong private key type");return l(g,A,w)}if(x!=="rsa"&&x!=="ecdsa/rsa")throw new Error("wrong private key type");if(v.padding!==void 0&&v.padding!==o)throw new Error("illegal or unsupported padding mode");g=t.concat([_,g]);for(var M=A.modulus.byteLength(),F=[0,1];g.length+F.length+1<M;)F.push(255);F.push(0);for(var k=-1;++k<g.length;)F.push(g[k]);var $=r(F,A);return $}function c(g,v){var w=s[v.curve.join(".")];if(!w)throw new Error("unknown curve "+v.curve.join("."));var x=new n(w),_=x.keyFromPrivate(v.privateKey),A=_.sign(g);return t.from(A.toDER())}function l(g,v,w){for(var x=v.params.priv_key,_=v.params.p,A=v.params.q,M=v.params.g,F=new i(0),k,$=h(g,A).mod(A),T=!1,N=f(x,A,g,w);T===!1;)k=m(A,N,w),F=y(M,k,_,A),T=k.invm(A).imul($.add(x.mul(F))).mod(A),T.cmpn(0)===0&&(T=!1,F=new i(0));return d(F,T)}function d(g,v){g=g.toArray(),v=v.toArray(),g[0]&128&&(g=[0].concat(g)),v[0]&128&&(v=[0].concat(v));var w=g.length+v.length+4,x=[48,w,2,g.length];return x=x.concat(g,[2,v.length],v),t.from(x)}function f(g,v,w,x){if(g=t.from(g.toArray()),g.length<v.byteLength()){var _=t.alloc(v.byteLength()-g.length);g=t.concat([_,g])}var A=w.length,M=p(w,v),F=t.alloc(A);F.fill(1);var k=t.alloc(A);return k=e(x,k).update(F).update(t.from([0])).update(g).update(M).digest(),F=e(x,k).update(F).digest(),k=e(x,k).update(F).update(t.from([1])).update(g).update(M).digest(),F=e(x,k).update(F).digest(),{k,v:F}}function h(g,v){var w=new i(g),x=(g.length<<3)-v.bitLength();return x>0&&w.ishrn(x),w}function p(g,v){g=h(g,v),g=g.mod(v);var w=t.from(g.toArray());if(w.length<v.byteLength()){var x=t.alloc(v.byteLength()-w.length);w=t.concat([x,w])}return w}function m(g,v,w){var x,_;do{for(x=t.alloc(0);x.length*8<g.bitLength();)v.v=e(w,v.k).update(v.v).digest(),x=t.concat([x,v.v]);_=h(x,g),v.k=e(w,v.k).update(v.v).update(t.from([0])).digest(),v.v=e(w,v.k).update(v.v).digest()}while(_.cmp(g)!==-1);return _}function y(g,v,w,x){return g.toRed(i.mont(w)).redPow(v).fromRed().mod(x)}return Dd.exports=u,Dd.exports.getKey=f,Dd.exports.makeKey=m,Dd.exports}var vb,sN;function F3e(){if(sN)return vb;sN=1;var t=ur().Buffer,e=dE(),r=mE().ec,n=Py(),i=XL;function a(c,l,d,f,h){var p=n(d);if(p.type==="ec"){if(f!=="ecdsa"&&f!=="ecdsa/rsa")throw new Error("wrong public key type");return s(c,l,p)}else if(p.type==="dsa"){if(f!=="dsa")throw new Error("wrong public key type");return o(c,l,p)}if(f!=="rsa"&&f!=="ecdsa/rsa")throw new Error("wrong public key type");l=t.concat([h,l]);for(var m=p.modulus.byteLength(),y=[1],g=0;l.length+y.length+2<m;)y.push(255),g+=1;y.push(0);for(var v=-1;++v<l.length;)y.push(l[v]);y=t.from(y);var w=e.mont(p.modulus);c=new e(c).toRed(w),c=c.redPow(new e(p.publicExponent)),c=t.from(c.fromRed().toArray());var x=g<8?1:0;for(m=Math.min(c.length,y.length),c.length!==y.length&&(x=1),v=-1;++v<m;)x|=c[v]^y[v];return x===0}function s(c,l,d){var f=i[d.data.algorithm.curve.join(".")];if(!f)throw new Error("unknown curve "+d.data.algorithm.curve.join("."));var h=new r(f),p=d.data.subjectPrivateKey.data;return h.verify(l,c,p)}function o(c,l,d){var f=d.data.p,h=d.data.q,p=d.data.g,m=d.data.pub_key,y=n.signature.decode(c,"der"),g=y.s,v=y.r;u(g,h),u(v,h);var w=e.mont(f),x=g.invm(h),_=p.toRed(w).redPow(new e(l).mul(x).mod(h)).fromRed().mul(m.toRed(w).redPow(v.mul(x).mod(h)).fromRed()).mod(f).mod(h);return _.cmp(v)===0}function u(c,l){if(c.cmpn(0)<=0)throw new Error("invalid sig");if(c.cmp(l)>=0)throw new Error("invalid sig")}return vb=a,vb}var bb,oN;function P3e(){if(oN)return bb;oN=1;var t=ur().Buffer,e=fp(),r=zSe(),n=gr(),i=R3e(),a=F3e(),s=SL;Object.keys(s).forEach(function(d){s[d].id=t.from(s[d].id,"hex"),s[d.toLowerCase()]=s[d]});function o(d){r.Writable.call(this);var f=s[d];if(!f)throw new Error("Unknown message digest");this._hashType=f.hash,this._hash=e(f.hash),this._tag=f.id,this._signType=f.sign}n(o,r.Writable),o.prototype._write=function(d,f,h){this._hash.update(d),h()},o.prototype.update=function(d,f){return this._hash.update(typeof d=="string"?t.from(d,f):d),this},o.prototype.sign=function(d,f){this.end();var h=this._hash.digest(),p=i(h,d,this._hashType,this._signType,this._tag);return f?p.toString(f):p};function u(d){r.Writable.call(this);var f=s[d];if(!f)throw new Error("Unknown message digest");this._hash=e(f.hash),this._tag=f.id,this._signType=f.sign}n(u,r.Writable),u.prototype._write=function(d,f,h){this._hash.update(d),h()},u.prototype.update=function(d,f){return this._hash.update(typeof d=="string"?t.from(d,f):d),this},u.prototype.verify=function(d,f,h){var p=typeof f=="string"?t.from(f,h):f;this.end();var m=this._hash.digest();return a(p,m,d,this._signType,this._tag)};function c(d){return new o(d)}function l(d){return new u(d)}return bb={Sign:c,Verify:l,createSign:c,createVerify:l},bb}var wb,uN;function B3e(){if(uN)return wb;uN=1;var t=mE(),e=ei();wb=function(a){return new n(a)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1;function n(a){this.curveType=r[a],this.curveType||(this.curveType={name:a}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(a,s){return this.keys=this.curve.genKeyPair(),this.getPublicKey(a,s)},n.prototype.computeSecret=function(a,s,o){s=s||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,s));var u=this.curve.keyFromPublic(a).getPublic(),c=u.mul(this.keys.getPrivate()).getX();return i(c,o,this.curveType.byteLength)},n.prototype.getPublicKey=function(a,s){var o=this.keys.getPublic(s==="compressed",!0);return s==="hybrid"&&(o[o.length-1]%2?o[0]=7:o[0]=6),i(o,a)},n.prototype.getPrivateKey=function(a){return i(this.keys.getPrivate(),a)},n.prototype.setPublicKey=function(a,s){return s=s||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,s)),this.keys._importPublic(a),this},n.prototype.setPrivateKey=function(a,s){s=s||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,s));var o=new e(a);return o=o.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(o),this};function i(a,s,o){Array.isArray(a)||(a=a.toArray());var u=new Buffer(a);if(o&&u.length<o){var c=new Buffer(o-u.length);c.fill(0),u=Buffer.concat([c,u])}return s?u.toString(s):u}return wb}var cN={},_b,lN;function QL(){if(lN)return _b;lN=1;var t=fp(),e=ur().Buffer;_b=function(n,i){for(var a=e.alloc(0),s=0,o;a.length<i;)o=r(s++),a=e.concat([a,t("sha1").update(n).update(o).digest()]);return a.slice(0,i)};function r(n){var i=e.allocUnsafe(4);return i.writeUInt32BE(n,0),i}return _b}var dN,fN;function ej(){return fN||(fN=1,dN=function(t,e){for(var r=t.length,n=-1;++n<r;)t[n]^=e[n];return t}),dN}var xb,hN;function tj(){if(hN)return xb;hN=1;var t=ei(),e=ur().Buffer;function r(n,i){return e.from(n.toRed(t.mont(i.modulus)).redPow(new t(i.publicExponent)).fromRed().toArray())}return xb=r,xb}var Eb,pN;function L3e(){if(pN)return Eb;pN=1;var t=Py(),e=ld(),r=fp(),n=QL(),i=ej(),a=ei(),s=tj(),o=fE(),u=ur().Buffer;Eb=function(f,h,p){var m;f.padding?m=f.padding:p?m=1:m=4;var y=t(f),g;if(m===4)g=c(y,h);else if(m===1)g=l(y,h,p);else if(m===3){if(g=new a(h),g.cmp(y.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return p?o(g,y):s(g,y)};function c(f,h){var p=f.modulus.byteLength(),m=h.length,y=r("sha1").update(u.alloc(0)).digest(),g=y.length,v=2*g;if(m>p-v-2)throw new Error("message too long");var w=u.alloc(p-m-v-2),x=p-g-1,_=e(g),A=i(u.concat([y,w,u.alloc(1,1),h],x),n(_,x)),M=i(_,n(A,g));return new a(u.concat([u.alloc(1),M,A],p))}function l(f,h,p){var m=h.length,y=f.modulus.byteLength();if(m>y-11)throw new Error("message too long");var g;return p?g=u.alloc(y-m-3,255):g=d(y-m-3),new a(u.concat([u.from([0,p?1:2]),g,u.alloc(1),h],y))}function d(f){for(var h=u.allocUnsafe(f),p=0,m=e(f*2),y=0,g;p<f;)y===m.length&&(m=e(f*2),y=0),g=m[y++],g&&(h[p++]=g);return h}return Eb}var Sb,mN;function j3e(){if(mN)return Sb;mN=1;var t=Py(),e=QL(),r=ej(),n=ei(),i=fE(),a=fp(),s=tj(),o=ur().Buffer;Sb=function(d,f,h){var p;d.padding?p=d.padding:h?p=1:p=4;var m=t(d),y=m.modulus.byteLength();if(f.length>y||new n(f).cmp(m.modulus)>=0)throw new Error("decryption error");var g;h?g=s(new n(f),m):g=i(f,m);var v=o.alloc(y-g.length);if(g=o.concat([v,g],y),p===4)return u(m,g);if(p===1)return c(m,g,h);if(p===3)return g;throw new Error("unknown padding")};function u(d,f){var h=d.modulus.byteLength(),p=a("sha1").update(o.alloc(0)).digest(),m=p.length;if(f[0]!==0)throw new Error("decryption error");var y=f.slice(1,m+1),g=f.slice(m+1),v=r(y,e(g,m)),w=r(g,e(v,h-m-1));if(l(p,w.slice(0,m)))throw new Error("decryption error");for(var x=m;w[x]===0;)x++;if(w[x++]!==1)throw new Error("decryption error");return w.slice(x)}function c(d,f,h){for(var p=f.slice(0,2),m=2,y=0;f[m++]!==0;)if(m>=f.length){y++;break}var g=f.slice(2,m-1);if((p.toString("hex")!=="0002"&&!h||p.toString("hex")!=="0001"&&h)&&y++,g.length<8&&y++,y)throw new Error("decryption error");return f.slice(m)}function l(d,f){d=o.from(d),f=o.from(f);var h=0,p=d.length;d.length!==f.length&&(h++,p=Math.min(d.length,f.length));for(var m=-1;++m<p;)h+=d[m]^f[m];return h}return Sb}var gN;function $3e(){return gN||(gN=1,function(t){t.publicEncrypt=L3e(),t.privateDecrypt=j3e(),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}}(cN)),cN}var Nc={},yN;function U3e(){if(yN)return Nc;yN=1;function t(){throw new Error(`secure random number generation not supported by this browser
@@ -1185,7 +1185,7 @@ enum ReactionType {
1185
1185
  "modules": []
1186
1186
  }
1187
1187
  ]
1188
- }`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},T5e=t=>t!=null;Te.any().refine(t=>T5e(t));function D5e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function A5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function N5e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function I5e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function C5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:_$().nullish()})}function O5e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function M5e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function k5e(){return Te.object({id:Te.string()})}function R5e(){return Te.object({id:Te.string()})}function F5e(){return Te.object({id:Te.string()})}function P5e(){return Te.object({id:Te.string()})}function B5e(){return Te.object({scope:Te.string(),id:Te.string()})}function _$(){return Te.literal("global").or(Te.literal("local"))}function L5e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function j5e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function $5e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function U5e(){return Te.object({order:Te.array(Te.string())})}function z5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function q5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function V5e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function Z5e(){return Te.object({authorName:Te.string()})}function H5e(){return Te.object({authorWebsite:Te.string()})}function W5e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function Y5e(){return Te.object({description:Te.string()})}function J5e(){return Te.object({extension:Te.string()})}function K5e(){return Te.object({id:Te.string()})}function G5e(){return Te.object({name:Te.string()})}function X5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function Q5e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function eDe(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function tDe(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function rDe(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function nDe(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function iDe(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function aDe(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function sDe(){return Te.object({id:Te.string(),scope:_$()})}function oDe(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function uDe(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function cDe(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function lDe(){return Te.object({scope:Te.string(),schema:Te.string()})}function dDe(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function fDe(){return Te.object({example:Te.string(),id:Te.string()})}function hDe(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const Cc={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Nd={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},pDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Id={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(pDe(e.input.order))}},mDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},hu={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(mDe(e.input.order))}},gDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},_m={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(gDe(e.input.order))}},yDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Xa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(yDe(e.input.order))}},vDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Oc={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(vDe(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},bDe=(t,e)=>{if(gl(e))return t;switch(e.type){case"SET_MODEL_NAME":G5e().parse(e.input),Cc.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":K5e().parse(e.input),Cc.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":J5e().parse(e.input),Cc.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":Y5e().parse(e.input),Cc.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":Z5e().parse(e.input),Cc.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H5e().parse(e.input),Cc.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":D5e().parse(e.input),Nd.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":dDe().parse(e.input),Nd.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M5e().parse(e.input),Nd.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":j5e().parse(e.input),Nd.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Nd.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":A5e().parse(e.input),Id.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":Q5e().parse(e.input),Id.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":X5e().parse(e.input),Id.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":k5e().parse(e.input),Id.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":U5e().parse(e.input),Id.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":N5e().parse(e.input),hu.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":tDe().parse(e.input),hu.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":nDe().parse(e.input),hu.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":rDe().parse(e.input),hu.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":iDe().parse(e.input),hu.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":R5e().parse(e.input),hu.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":z5e().parse(e.input),hu.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I5e().parse(e.input),_m.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":fDe().parse(e.input),_m.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":F5e().parse(e.input),_m.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":q5e().parse(e.input),_m.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":C5e().parse(e.input),Xa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":aDe().parse(e.input),Xa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":sDe().parse(e.input),Xa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":uDe().parse(e.input),Xa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":eDe().parse(e.input),Xa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":cDe().parse(e.input),Xa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":oDe().parse(e.input),Xa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":L5e().parse(e.input),Xa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":P5e().parse(e.input),Xa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":$5e().parse(e.input),Xa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":lDe().parse(e.input),Oc.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":W5e().parse(e.input),Oc.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":O5e().parse(e.input),Oc.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":hDe().parse(e.input),Oc.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":B5e().parse(e.input),Oc.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V5e().parse(e.input),Oc.reorderStateExamplesOperation(t.global,e);break;default:return t}},x0=m2(bDe),wDe={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},_De={},wf={fileExtension:"phdm",createState(t){return{global:{...wDe,...t==null?void 0:t.global},local:{..._De,...t==null?void 0:t.local}}},createExtendedState(t){return g2({...t,documentType:"powerhouse/document-model"},wf.createState)},createDocument(t){return y2(wf.createExtendedState(t),wf.createState)},saveToFile(t,e,r){return h2(t,e,"phdm",r)},saveToFileHandle(t,e){return yC(t,e)},loadFromFile(t){return lg(t,x0)},loadFromInput(t){return p2(t,x0)}},x$=t=>Rt("SET_MODEL_NAME",{...t}),E$=t=>Rt("SET_MODEL_ID",{...t}),S$=t=>Rt("SET_MODEL_EXTENSION",{...t}),T$=t=>Rt("SET_MODEL_DESCRIPTION",{...t}),D$=t=>Rt("SET_AUTHOR_NAME",{...t}),A$=t=>Rt("SET_AUTHOR_WEBSITE",{...t});class xDe extends Pr{setModelName(e,r){return this.dispatch(x$(e),r)}setModelId(e,r){return this.dispatch(E$(e),r)}setModelExtension(e,r){return this.dispatch(S$(e),r)}setModelDescription(e,r){return this.dispatch(T$(e),r)}setAuthorName(e,r){return this.dispatch(D$(e),r)}setAuthorWebsite(e,r){return this.dispatch(A$(e),r)}}const N$=t=>Rt("ADD_CHANGE_LOG_ITEM",{...t}),I$=t=>Rt("UPDATE_CHANGE_LOG_ITEM",{...t}),C$=t=>Rt("DELETE_CHANGE_LOG_ITEM",{...t}),O$=t=>Rt("REORDER_CHANGE_LOG_ITEMS",{...t}),M$=()=>Rt("RELEASE_NEW_VERSION");class EDe extends Pr{addChangeLogItem(e,r){return this.dispatch(N$(e),r)}updateChangeLogItem(e,r){return this.dispatch(I$(e),r)}deleteChangeLogItem(e,r){return this.dispatch(C$(e),r)}reorderChangeLogItems(e,r){return this.dispatch(O$(e),r)}releaseNewVersion(e){return this.dispatch(M$(),e)}}const k$=t=>Rt("ADD_MODULE",{...t}),R$=t=>Rt("SET_MODULE_NAME",{...t}),F$=t=>Rt("SET_MODULE_DESCRIPTION",{...t}),P$=t=>Rt("DELETE_MODULE",{...t}),B$=t=>Rt("REORDER_MODULES",{...t});class SDe extends Pr{addModule(e,r){return this.dispatch(k$(e),r)}setModuleName(e,r){return this.dispatch(R$(e),r)}setModuleDescription(e,r){return this.dispatch(F$(e),r)}deleteModule(e,r){return this.dispatch(P$(e),r)}reorderModules(e,r){return this.dispatch(B$(e),r)}}const L$=t=>Rt("ADD_OPERATION_ERROR",{...t}),j$=t=>Rt("SET_OPERATION_ERROR_CODE",{...t}),$$=t=>Rt("SET_OPERATION_ERROR_NAME",{...t}),U$=t=>Rt("SET_OPERATION_ERROR_DESCRIPTION",{...t}),z$=t=>Rt("SET_OPERATION_ERROR_TEMPLATE",{...t}),q$=t=>Rt("DELETE_OPERATION_ERROR",{...t}),V$=t=>Rt("REORDER_OPERATION_ERRORS",{...t});class TDe extends Pr{addOperationError(e,r){return this.dispatch(L$(e),r)}setOperationErrorCode(e,r){return this.dispatch(j$(e),r)}setOperationErrorName(e,r){return this.dispatch($$(e),r)}setOperationErrorDescription(e,r){return this.dispatch(U$(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(z$(e),r)}deleteOperationError(e,r){return this.dispatch(q$(e),r)}reorderOperationErrors(e,r){return this.dispatch(V$(e),r)}}const Z$=t=>Rt("ADD_OPERATION_EXAMPLE",{...t}),H$=t=>Rt("UPDATE_OPERATION_EXAMPLE",{...t}),W$=t=>Rt("DELETE_OPERATION_EXAMPLE",{...t}),Y$=t=>Rt("REORDER_OPERATION_EXAMPLES",{...t});class DDe extends Pr{addOperationExample(e,r){return this.dispatch(Z$(e),r)}updateOperationExample(e,r){return this.dispatch(H$(e),r)}deleteOperationExample(e,r){return this.dispatch(W$(e),r)}reorderOperationExamples(e,r){return this.dispatch(Y$(e),r)}}const J$=t=>Rt("ADD_OPERATION",{...t}),K$=t=>Rt("SET_OPERATION_NAME",{...t}),G$=t=>Rt("SET_OPERATION_SCOPE",{...t}),X$=t=>Rt("SET_OPERATION_SCHEMA",{...t}),Q$=t=>Rt("SET_OPERATION_DESCRIPTION",{...t}),eU=t=>Rt("SET_OPERATION_TEMPLATE",{...t}),tU=t=>Rt("SET_OPERATION_REDUCER",{...t}),rU=t=>Rt("MOVE_OPERATION",{...t}),nU=t=>Rt("DELETE_OPERATION",{...t}),iU=t=>Rt("REORDER_MODULE_OPERATIONS",{...t});class ADe extends Pr{addOperation(e,r){return this.dispatch(J$(e),r)}setOperationName(e,r){return this.dispatch(K$(e),r)}setOperationScope(e,r){return this.dispatch(G$(e),r)}setOperationSchema(e,r){return this.dispatch(X$(e),r)}setOperationDescription(e,r){return this.dispatch(Q$(e),r)}setOperationTemplate(e,r){return this.dispatch(eU(e),r)}setOperationReducer(e,r){return this.dispatch(tU(e),r)}moveOperation(e,r){return this.dispatch(rU(e),r)}deleteOperation(e,r){return this.dispatch(nU(e),r)}reorderModuleOperations(e,r){return this.dispatch(iU(e),r)}}const aU=t=>Rt("SET_STATE_SCHEMA",{...t}),sU=t=>Rt("SET_INITIAL_STATE",{...t}),oU=t=>Rt("ADD_STATE_EXAMPLE",{...t}),uU=t=>Rt("UPDATE_STATE_EXAMPLE",{...t}),cU=t=>Rt("DELETE_STATE_EXAMPLE",{...t}),lU=t=>Rt("REORDER_STATE_EXAMPLES",{...t});class NDe extends Pr{setStateSchema(e,r){return this.dispatch(aU(e),r)}setInitialState(e,r){return this.dispatch(sU(e),r)}addStateExample(e,r){return this.dispatch(oU(e),r)}updateStateExample(e,r){return this.dispatch(uU(e),r)}deleteStateExample(e,r){return this.dispatch(cU(e),r)}reorderStateExamples(e,r){return this.dispatch(lU(e),r)}}let dU=(wm=class extends Pr{constructor(t,e){super(x0,wf.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,wm.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},l5e(wm,"fileExtension","phdm"),wm);Go(dU,[xDe,EDe,SDe,TDe,DDe,ADe,NDe]);const IDe=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:N$,addModule:k$,addOperation:J$,addOperationError:L$,addOperationExample:Z$,addStateExample:oU,deleteChangeLogItem:C$,deleteModule:P$,deleteOperation:nU,deleteOperationError:q$,deleteOperationExample:W$,deleteStateExample:cU,moveOperation:rU,releaseNewVersion:M$,reorderChangeLogItems:O$,reorderModuleOperations:iU,reorderModules:B$,reorderOperationErrors:V$,reorderOperationExamples:Y$,reorderStateExamples:lU,setAuthorName:D$,setAuthorWebsite:A$,setInitialState:sU,setModelDescription:T$,setModelExtension:S$,setModelId:E$,setModelName:x$,setModuleDescription:F$,setModuleName:R$,setOperationDescription:Q$,setOperationErrorCode:j$,setOperationErrorDescription:U$,setOperationErrorName:$$,setOperationErrorTemplate:z$,setOperationName:K$,setOperationReducer:tU,setOperationSchema:X$,setOperationScope:G$,setOperationTemplate:eU,setStateSchema:aU,updateChangeLogItem:I$,updateOperationExample:H$,updateStateExample:uU},Symbol.toStringTag,{value:"Module"})),CDe=dU,ODe={...wf,...E5e},MDe={...Ko,...IDe},kDe={Document:CDe,reducer:x0,actions:MDe,utils:ODe,documentModel:S5e},RDe="feature-flags-config",qm=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,FDe=qm==null?void 0:qm.split(","),Vm=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,PDe=Vm==null?void 0:Vm.split(","),fU={editors:{enabledEditors:qm==="*"?"*":FDe,disabledEditors:Vm==="*"?"*":PDe}},BDe=jh(RDe,fU),hU=()=>{const[t,e]=La(BDe);return{config:{...fU,...t},setConfig:e}},LDe=Qz("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Mh=P_(),jDe=jh("sidebar-collapsed",!1);$n(!1);const $De={sidebarCollapsedAtom:jDe,themeAtom:LDe},UDe=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS;async function zDe(){if(!UDe)return[];try{const t=await _f(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const qDe={DocumentModel:kDe,AtlasFeedbackIssues:Poe,...o5e},pU=Object.values(qDe),mU=zDe(),VDe=$n(mU),kh=$n(async t=>{const e=await t(VDe),r=e.map(n=>n.documentModel.id);return[...pU.filter(n=>!r.includes(n.documentModel.id)),...e]}),ZDe=()=>Lh(kh),HDe=RI(kh),gU=()=>Lh(HDe),WDe=()=>mU,YDe=function(t){return Mh.sub(kh,()=>{Mh.get(kh).then(t).catch(e=>{throw e})})};function JDe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const KDe=()=>{const t=gU();return e=>JDe(e,t)},GDe=()=>{const t=gU(),{config:e}=hU(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function XDe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=QDe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function QDe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Yn=class Yn{constructor(e){this.db=W3.ready().then(()=>W3.createInstance({name:e?`${e}:${Yn.DBName}`:Yn.DBName}))}buildKey(...e){return e.join(Yn.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Yn.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_g(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Yn.DRIVES_KEY)).map(n=>n.slice(Yn.DRIVES_KEY.length+Yn.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Yn.DRIVES_KEY,e));if(!n)throw new of(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Yn.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_g(i.operations,r);await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Yn.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=XDe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Yn.DBName="DOCUMENT_DRIVES",Yn.SEP=":",Yn.DRIVES_KEY="DRIVES";let N_=Yn;const KN=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,Ab=KN?KN.split(","):[],eAe=()=>({defaultDrives:{remoteDrives:Ab.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[],pullInterval:3e3}})),removeOldRemoteDrives:Ab.length>0?{strategy:"preserve-by-url-and-detach",urls:Ab}:{strategy:"preserve-all"}}});function tAe(t,e){return new aG(t,new N_(e),new ZO,new WO(1,10),{...eAe()})}async function rAe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&Rs.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:Xe.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(Cn.error)}const IE=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??tAe(pU,Rs.routerBasename);return await rAe(t),t})(),yU=$n(IE),nAe=RI(yU),vU=()=>Lh(nAe),iAe=()=>IE;YDe(async t=>{(await Mh.get(yU)).setDocumentModels(t)});async function aAe(){await WDe();const t=await Mh.get(kh);(await IE).setDocumentModels(t)}aAe().catch(console.error);const Zm=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await _f(async()=>{const{ConnectCrypto:n}=await import("./index-KDfZFawS.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await _f(async()=>{const{BrowserKeyStorage:n}=await import("./browser-BbIPlSaA.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function CE(){return ko(()=>({async regenerateDid(){return(await Zm).regenerateDid()},async did(){return(await Zm).did()},sign:async t=>await(await Zm).sign(t)}),[])}const sAe=$n(void 0);function oAe(){const[t,e]=La(sAe);return vi(()=>{t||Zm.then(r=>r.did()).then(r=>e(r)).catch(Cn.error)}),t}const uAe=$n(window.renown?Promise.resolve(window.renown):void 0);function bU(){const[t,e]=La(uAe),{did:r}=CE();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await _f(async()=>{const{initRenownBrowser:c}=await import("./browser-nO0Wirvo.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let xm=!1;const cAe=$n(void 0),Uy=()=>{const[t,e]=La(cAe),r=bU();return vi(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}RX(n)},[t]),vi(()=>{if(xm)return;xm=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),xm=!1}},[r,xm]),t},lAe=parseInt("50");function U9e(t,e,r=Cn.error){const[n,i]=ii(e),[a,s]=ii(),o=c=>{s(c),r(c)};return vi(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const h=t(f,c),p=c.scope??"global",m=h.operations[p],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...h}}),h}catch(h){return o(h),d==null||d(h),f}})},a]}async function dAe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var h;if(!(l.documentId===e&&l.scope==r))return;const f=(h=l.operations.at(-1))==null?void 0:h.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function fAe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||lAe;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await dAe(1e4,e,d,l.index,n)}}const hAe=async t=>{(await Xe.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(Cn.error)};async function z9e(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await hAe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function pAe(t,e){const r=await Xe.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function mAe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return Cn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await Xe.buildSignedOperation(t,i,n,s,e)}function gAe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const GN=$n(new Map);function yAe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function E0(t){return t.map(yAe).join("&")}const vAe=t=>()=>$n(e=>t?e(GN).get(t)??[]:[],(e,r,n)=>{r(GN,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||E0(a)!==E0(n)?new Map(i).set(t,n):i})}),bAe=Zz(()=>$n("INITIAL"));function wAe(){const t=vU(),[e,r]=La(ko(vAe(t),[t])),n=Cr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){Cn.error(l)}}catch(u){Cn.error(u)}finally{r(o)}},[t]),[i,a]=La(bAe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=Cr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,h,p)=>{p&&Cn.error(p),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return ko(()=>[e,n,s,i],[e,i])}const _Ae=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",xAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",EAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",SAe=$n("initial"),OE=()=>{const[t,e]=La(SAe),r=Uy(),n=bU(),{did:i}=CE(),a=Cr(async()=>{var l;const u=await i(),c=new URL(_Ae);if(c.searchParams.set("connect",u),c.searchParams.set("network",xAe),c.searchParams.set("chain",EAe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=Cr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),Cn.error(c)}},[n]);vi(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=Cr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return ko(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function TAe(){const{user:t,status:e}=OE(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function wU(){const t=TAe();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function ME(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=wU()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Uy()||void 0,n=oAe(),{sign:i}=CE(),a=vU(),s=KDe(),[o,u,,c]=wAe(),l=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,P);if(!R)throw new Error(`There was an error opening file with id ${P} on drive ${S}`);return R},[a]),d=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=Wu(R,gAe(P,n,r));const q=P.scope??"global",G=R.operations[q].findLast(z=>z.type===P.type);if(!G)throw new Error("There was an error applying the operation");const ie=await mAe(G,i,S,L,Wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&Cn.error(z.error),z.operations.length&&await u(),z.document&&!mu(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return Cn.error(z),R}},[o,u,a,i,r,n]),f=Cr(async(S,P,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const J=Xe.hashKey();let G=o.find(V=>V.state.global.id===S);if(!G)throw new Error(`Drive with id ${S} not found`);const ie=V2(G.state.global,{id:J,name:P,parentFolder:L??null,documentType:R,document:q},["global"]);G=await d(S,ie);const z=G==null?void 0:G.state.global.nodes.find(V=>V.id===J);if(!z||!Ni(z))throw new Error("There was an error adding document");return z},[d,o,t]),h=Cr(async(S,P,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(J=>J.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,P,R)).document},[o,e,a]),p=Cr(async(S,P,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await pAe(S,s),J={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},G=await f(P,R||(typeof S=="string"?q.name:S.name),q.documentType,L,J),ie=o.find(V=>V.state.global.id===P),z=ie&&ie.state.local.listeners.length>0;fAe(P,G.id,q,a,h,{waitForSync:z}).catch(V=>{throw V})},[f,h,s,t,a]),m=Cr(async(S,P,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const J=await d(S,Jn.updateFile({id:P,name:L||void 0,parentFolder:q,documentType:R})),G=J==null?void 0:J.state.global.nodes.find(ie=>ie.id===P);if(!G||!Ni(G))throw new Error("There was an error updating document");return G},[d,t]),y=Cr(async(S,P,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=Xe.hashKey(),q=await d(S,Jn.addFolder({id:L,name:P,parentFolder:R})),J=q==null?void 0:q.state.global.nodes.find(G=>G.id===L);if(!J||!P0(J))throw new Error("There was an error adding folder");return J},[d,t]),g=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,Jn.deleteNode({id:P}))},[d,t]),v=Cr(async(S,P,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,Jn.updateNode({id:P,name:R})),q=L==null?void 0:L.state.global.nodes.find(J=>J.id===P);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),w=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to move documents");P.kind===Ob||S.parentFolder===P.id||await d(P.driveId,Jn.moveNode({srcFolder:S.id,targetParentFolder:P.id}))},[d,t]),x=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(P.kind===Ob)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>Xe.hashKey(),J=nh.generateNodesCopy({srcId:S.id,targetParentFolder:P.id,targetName:S.name},L,R.state.global.nodes).map(ie=>Jn.copyNode(ie)),G=await a.addDriveActions(S.driveId,J);G.operations.length?await u():G.status!=="SUCCESS"&&Cn.error(`Error copying files: ${G.status}`,G.error)},[o,t,u,a]),_=Cr(async(S,P,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(J=>J.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,P,R)).document},[o,e,a]),A=Cr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const P=S.global.id||Xe.hashKey();S=nh.createState(S);const R=await a.addDrive({global:{...S.global,id:P},local:S.local});return await u(),R},[t,u,a]),M=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,P);return await u(),R},[u,a]),F=Cr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,Jn.setDriveName({name:P}))},[d,t]),$=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setAvailableOffline({availableOffline:P}))},[d,t]),T=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setSharingType({type:P}))},[d,t]),N=Cr(async(S,P)=>{if(P!==WU){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof HO?"INITIAL_SYNC":R}catch(R){return console.error(R),YU}}},[a]),b=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),E=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),D=Cr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=Cr(async(S,P)=>{const R=await d(S,Jn.removeTrigger({triggerId:P}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===P))throw new Error(`There was an error removing trigger ${P}`)},[d]),I=Cr(async(S,P,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,P,R)},[a]),O=Cr(async(S,P)=>{const R=await d(S,Jn.addTrigger({trigger:P}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${P.id}`)},[d]);return ko(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:p,updateFile:m,addFolder:y,deleteNode:g,renameNode:v,moveNode:w,copyNode:x,addOperation:_,addOperations:h,addDrive:A,addRemoteDrive:M,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:$,setDriveSharingType:T,getSyncStatus:N,onStrandUpdate:b,onSyncStatus:E,clearStorage:D,removeTrigger:C,addTrigger:O,registerNewPullResponderTrigger:I}),[f,A,p,y,_,h,M,O,D,x,F,g,o,c,N,w,b,E,l,I,C,k,v,$,T,m])}function DAe(t){return t.replaceAll(/\s/g,"-")}const AAe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=ME();return et(JU,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:DAe(c.name),kind:Ob,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},NAe=$n(Rs);function kE(){return La(NAe)}let Em;const IAe=new Uint8Array(16);function CAe(){if(!Em&&(Em=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Em))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Em(IAe)}const Wn=[];for(let t=0;t<256;++t)Wn.push((t+256).toString(16).slice(1));function OAe(t,e=0){return Wn[t[e+0]]+Wn[t[e+1]]+Wn[t[e+2]]+Wn[t[e+3]]+"-"+Wn[t[e+4]]+Wn[t[e+5]]+"-"+Wn[t[e+6]]+Wn[t[e+7]]+"-"+Wn[t[e+8]]+Wn[t[e+9]]+"-"+Wn[t[e+10]]+Wn[t[e+11]]+Wn[t[e+12]]+Wn[t[e+13]]+Wn[t[e+14]]+Wn[t[e+15]]}const MAe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),XN={randomUUID:MAe};function QN(t,e,r){if(XN.randomUUID&&!t)return XN.randomUUID();t=t||{};const n=t.random||(t.rng||CAe)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,OAe(n)}const kAe=t=>{var T;const[e]=kE(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=ii(e.appVersion),[o,u]=ii({label:wp.debug?"Enabled":"Disabled",value:wp.debug}),[c,l]=ii(),[d,f]=ii(null),[h,p]=ii(""),[m,y]=ii({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:v,addTrigger:w,registerNewPullResponderTrigger:x}=ME();vi(()=>{wp.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const _=((T=g.find(N=>N.state.global.id===c))==null?void 0:T.state.local.triggers)||[],M=!c||h==="",F=async()=>{!d||!c||(await v(c,d.value),f(null))},k=async(N=!1)=>{if(!(!h||h===""||!c)){if(!N){const b=await x(c,h,{pullInterval:3e3});await w(c,b),p("");return}await w(c,{id:`invalid-trigger-${QN()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${QN()}`,url:h}}),p("")}},$=N=>{y(N),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",N.value)};return et(KU,{open:r,onOpenChange:N=>{if(!N)return n()},contentProps:{className:"rounded-2xl"},children:Yr("div",{className:"w-[700px] rounded-2xl p-6",children:[Yr("div",{className:"mb-6 flex justify-between",children:[et("div",{className:"text-xl font-bold",children:"Debug Tools"}),et("button",{id:"close-modal",onClick:()=>n(),children:et(bp,{name:"Xmark",size:28})})]}),Yr("div",{className:"flex text-sm font-bold",children:[et(bp,{name:"Ring",size:22}),Yr("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(bp,{name:"Hdd",size:22}),et("span",{className:"ml-2",children:"Drive Tools:"})]}),Yr("div",{children:[et("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),et(Md,{id:"selectedDrive",onChange:N=>{if(!N||typeof N!="object"||!("value"in N)){l(void 0),f(null);return}l(N.value),f(null)},options:g.map(N=>({label:N.state.global.name,value:N.state.global.id}))})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),et(Md,{id:"autoRegisterPullResponder",onChange:N=>{$(N)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),et(Md,{id:"driveTrigger",onChange:N=>{f(N)},value:d,options:_.map(N=>({label:`${N.id} - ${N.type}`,value:N.id}))})]}),et("div",{children:et(qc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),et(zE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:et("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:h,onChange:N=>p(N.target.value)})]}),Yr("div",{className:"mb-1 flex items-center justify-center",children:[et(qc,{className:"mr-2",color:M?"light":"blue",size:"small",disabled:M,onClick:()=>k(),children:"Add Trigger"}),et(qc,{color:M?"light":"red",size:"small",disabled:M,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(bp,{name:"Gear",size:22}),et("span",{className:"ml-2",children:"Service Worker Tools:"})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),et(Md,{id:"serviceWorkerDebugMode",onChange:N=>{u(N)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),et(zE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:et("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:N=>s(N.target.value)})]}),et("div",{className:"mb-1 flex items-center justify-center",children:et(qc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{wp.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},RAe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=nc();return et(GU,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},FAe=t=>{const{t:e}=nc(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return et(XU,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},PAe=t=>{const{open:e,onClose:r}=t,{t:n}=nc();return et(_I,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function BAe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return et(QU,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const LAe="defaultDocumentModelEditor",jAe=jh(LAe,{label:"V2",value:"document-model-editor-v2"}),$Ae=()=>La(jAe),UAe=t=>mt.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},mt.createElement("g",{id:"Group 1000003373"},mt.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),mt.createElement("g",{id:"Renown"},mt.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),mt.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),mt.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),mt.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),mt.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),mt.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),zAe=()=>{const[t,e]=ii(0);return vi(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),et("span",{children:new Array(t).fill(".").join("")})},qAe=()=>{const t=Uy(),{openRenown:e,status:r}=OE();return et("div",{children:r==="checking"?Yr("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[et("span",{children:"Checking Authorization"}),et("span",{className:"inline-block w-5 text-left",children:et(zAe,{})})]}):r!=="authorized"?Yr("div",{className:"flex flex-col items-center",children:[et("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),et(UAe,{className:"mb-3"}),et("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),et(qc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:et("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Yr("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},eI=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),VAe=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=ME(),{t:a}=nc(),s=GDe(),o=ZDe(),{setConfig:u}=hU(),{showModal:c}=xU(),[l]=kE(),[d,f]=$Ae(),[h,p]=ii(eI(s)),{logout:m,status:y}=OE(),g=Uy(),v=()=>{u(x=>({...x,editors:{enabledEditors:h.map(_=>_.value)}})),r()},w=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(Cn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Yr(ez,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:v,onOpenChange:x=>{if(!x)return r()},children:[et("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Yr(wI,{children:[Yr("p",{children:["Logged in with address:"," ",et("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),et(qc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):et(qAe,{})}),l.content.showDocumentModelSelectionSetting&&et(tz,{selected:h,onChange:x=>p(x),options:eI(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),et(rz,{onClearStorage:w,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Yr("div",{children:[et("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),et(Md,{id:"default-document-model-editor",value:d,onChange:x=>f(x),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),et(nz,{packageJson:pz})]})},ZAe=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=nc();return et(iz,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},HAe={deleteItem:FAe,upgradeDrive:ZAe,createDocument:AAe,addLocalDrive:aq,addRemoteDrive:UZ,driveSettings:BAe,settingsModal:VAe,confirmationModal:zZ,deleteDriveModal:RAe,debugSettingsModal:kAe,disclaimerModal:PAe,cookiesPolicy:qZ},_U=Us.createContext({showModal:()=>{},closeModal:()=>{}}),xU=()=>Ph(_U),WAe=t=>{const{children:e}=t,[r,n]=ii(),[i,a]=ii(),[s,o]=ii(!1),u=Cr((f,h)=>{o(!0),n(h),a(f)},[]),c=Cr(()=>{o(!1)},[]),l=i?HAe[i]:null,d=ko(()=>({showModal:u,closeModal:c}),[c,u]);return Yr(_U.Provider,{value:d,children:[e,l&&et(l,{...r,open:s,onClose:c})]})},YAe=(t,e)=>t.some(r=>r.id===e&&r.value),JAe=()=>{const{t}=nc(),{showModal:e}=xU(),[r,n]=iq(),[,i]=B_(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),YAe(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Yr("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[et("div",{className:"absolute inset-0 bg-black opacity-15"}),et("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:et(az,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:et("p",{className:"font-semibold text-gray-500",children:et(AI,{i18nKey:"cookieBanner.message",components:{a:et("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var KAe=Object.defineProperty,GAe=Object.getOwnPropertyDescriptor,_s=(t,e,r,n)=>{for(var i=GAe(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&KAe(e,r,i),i};function xs(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function XAe(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Ya{constructor(e){UE(this,"server");XAe(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}_s([xs],Ya.prototype,"migrateReadDrive");_s([xs],Ya.prototype,"addReadDrive");_s([xs],Ya.prototype,"getReadDrives");_s([xs],Ya.prototype,"getReadDriveBySlug");_s([xs],Ya.prototype,"getReadDrive");_s([xs],Ya.prototype,"getReadDriveContext");_s([xs],Ya.prototype,"fetchDrive");_s([xs],Ya.prototype,"fetchDocument");_s([xs],Ya.prototype,"deleteReadDrive");_s([xs],Ya.prototype,"onReadDrivesUpdate");const zc=new Ya,EU=R_({...zc,readDrives:[]});async function QAe(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof gu))}const eNe=t=>{const e=iAe(),[r,n]=ii([]),i=wU(),[a,s]=ii(!1);vi(()=>{e.then(c=>{zc.setDocumentDrive(c),s(!0)}).catch(Cn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);ko(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=zc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(Cn.error)},[o,a]),vi(()=>{if(!a)return;QAe(zc).then(l=>n(l)).catch(Cn.error);const c=zc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||E0(d)!==E0(l)?l:d)}).catch(Cn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(Cn.error)}},[a]);const u=ko(()=>({...zc,readDrives:r}),[r]);return et(EU.Provider,{...t,value:u})},q9e=()=>Ph(EU);/**
1188
+ }`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},T5e=t=>t!=null;Te.any().refine(t=>T5e(t));function D5e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function A5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function N5e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function I5e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function C5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:_$().nullish()})}function O5e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function M5e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function k5e(){return Te.object({id:Te.string()})}function R5e(){return Te.object({id:Te.string()})}function F5e(){return Te.object({id:Te.string()})}function P5e(){return Te.object({id:Te.string()})}function B5e(){return Te.object({scope:Te.string(),id:Te.string()})}function _$(){return Te.literal("global").or(Te.literal("local"))}function L5e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function j5e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function $5e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function U5e(){return Te.object({order:Te.array(Te.string())})}function z5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function q5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function V5e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function Z5e(){return Te.object({authorName:Te.string()})}function H5e(){return Te.object({authorWebsite:Te.string()})}function W5e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function Y5e(){return Te.object({description:Te.string()})}function J5e(){return Te.object({extension:Te.string()})}function K5e(){return Te.object({id:Te.string()})}function G5e(){return Te.object({name:Te.string()})}function X5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function Q5e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function eDe(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function tDe(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function rDe(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function nDe(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function iDe(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function aDe(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function sDe(){return Te.object({id:Te.string(),scope:_$()})}function oDe(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function uDe(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function cDe(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function lDe(){return Te.object({scope:Te.string(),schema:Te.string()})}function dDe(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function fDe(){return Te.object({example:Te.string(),id:Te.string()})}function hDe(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const Cc={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Nd={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},pDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Id={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(pDe(e.input.order))}},mDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},hu={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(mDe(e.input.order))}},gDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},_m={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(gDe(e.input.order))}},yDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Xa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(yDe(e.input.order))}},vDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Oc={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(vDe(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},bDe=(t,e)=>{if(gl(e))return t;switch(e.type){case"SET_MODEL_NAME":G5e().parse(e.input),Cc.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":K5e().parse(e.input),Cc.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":J5e().parse(e.input),Cc.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":Y5e().parse(e.input),Cc.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":Z5e().parse(e.input),Cc.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H5e().parse(e.input),Cc.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":D5e().parse(e.input),Nd.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":dDe().parse(e.input),Nd.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M5e().parse(e.input),Nd.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":j5e().parse(e.input),Nd.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Nd.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":A5e().parse(e.input),Id.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":Q5e().parse(e.input),Id.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":X5e().parse(e.input),Id.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":k5e().parse(e.input),Id.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":U5e().parse(e.input),Id.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":N5e().parse(e.input),hu.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":tDe().parse(e.input),hu.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":nDe().parse(e.input),hu.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":rDe().parse(e.input),hu.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":iDe().parse(e.input),hu.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":R5e().parse(e.input),hu.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":z5e().parse(e.input),hu.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I5e().parse(e.input),_m.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":fDe().parse(e.input),_m.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":F5e().parse(e.input),_m.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":q5e().parse(e.input),_m.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":C5e().parse(e.input),Xa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":aDe().parse(e.input),Xa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":sDe().parse(e.input),Xa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":uDe().parse(e.input),Xa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":eDe().parse(e.input),Xa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":cDe().parse(e.input),Xa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":oDe().parse(e.input),Xa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":L5e().parse(e.input),Xa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":P5e().parse(e.input),Xa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":$5e().parse(e.input),Xa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":lDe().parse(e.input),Oc.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":W5e().parse(e.input),Oc.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":O5e().parse(e.input),Oc.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":hDe().parse(e.input),Oc.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":B5e().parse(e.input),Oc.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V5e().parse(e.input),Oc.reorderStateExamplesOperation(t.global,e);break;default:return t}},x0=m2(bDe),wDe={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},_De={},wf={fileExtension:"phdm",createState(t){return{global:{...wDe,...t==null?void 0:t.global},local:{..._De,...t==null?void 0:t.local}}},createExtendedState(t){return g2({...t,documentType:"powerhouse/document-model"},wf.createState)},createDocument(t){return y2(wf.createExtendedState(t),wf.createState)},saveToFile(t,e,r){return h2(t,e,"phdm",r)},saveToFileHandle(t,e){return yC(t,e)},loadFromFile(t){return lg(t,x0)},loadFromInput(t){return p2(t,x0)}},x$=t=>Rt("SET_MODEL_NAME",{...t}),E$=t=>Rt("SET_MODEL_ID",{...t}),S$=t=>Rt("SET_MODEL_EXTENSION",{...t}),T$=t=>Rt("SET_MODEL_DESCRIPTION",{...t}),D$=t=>Rt("SET_AUTHOR_NAME",{...t}),A$=t=>Rt("SET_AUTHOR_WEBSITE",{...t});class xDe extends Pr{setModelName(e,r){return this.dispatch(x$(e),r)}setModelId(e,r){return this.dispatch(E$(e),r)}setModelExtension(e,r){return this.dispatch(S$(e),r)}setModelDescription(e,r){return this.dispatch(T$(e),r)}setAuthorName(e,r){return this.dispatch(D$(e),r)}setAuthorWebsite(e,r){return this.dispatch(A$(e),r)}}const N$=t=>Rt("ADD_CHANGE_LOG_ITEM",{...t}),I$=t=>Rt("UPDATE_CHANGE_LOG_ITEM",{...t}),C$=t=>Rt("DELETE_CHANGE_LOG_ITEM",{...t}),O$=t=>Rt("REORDER_CHANGE_LOG_ITEMS",{...t}),M$=()=>Rt("RELEASE_NEW_VERSION");class EDe extends Pr{addChangeLogItem(e,r){return this.dispatch(N$(e),r)}updateChangeLogItem(e,r){return this.dispatch(I$(e),r)}deleteChangeLogItem(e,r){return this.dispatch(C$(e),r)}reorderChangeLogItems(e,r){return this.dispatch(O$(e),r)}releaseNewVersion(e){return this.dispatch(M$(),e)}}const k$=t=>Rt("ADD_MODULE",{...t}),R$=t=>Rt("SET_MODULE_NAME",{...t}),F$=t=>Rt("SET_MODULE_DESCRIPTION",{...t}),P$=t=>Rt("DELETE_MODULE",{...t}),B$=t=>Rt("REORDER_MODULES",{...t});class SDe extends Pr{addModule(e,r){return this.dispatch(k$(e),r)}setModuleName(e,r){return this.dispatch(R$(e),r)}setModuleDescription(e,r){return this.dispatch(F$(e),r)}deleteModule(e,r){return this.dispatch(P$(e),r)}reorderModules(e,r){return this.dispatch(B$(e),r)}}const L$=t=>Rt("ADD_OPERATION_ERROR",{...t}),j$=t=>Rt("SET_OPERATION_ERROR_CODE",{...t}),$$=t=>Rt("SET_OPERATION_ERROR_NAME",{...t}),U$=t=>Rt("SET_OPERATION_ERROR_DESCRIPTION",{...t}),z$=t=>Rt("SET_OPERATION_ERROR_TEMPLATE",{...t}),q$=t=>Rt("DELETE_OPERATION_ERROR",{...t}),V$=t=>Rt("REORDER_OPERATION_ERRORS",{...t});class TDe extends Pr{addOperationError(e,r){return this.dispatch(L$(e),r)}setOperationErrorCode(e,r){return this.dispatch(j$(e),r)}setOperationErrorName(e,r){return this.dispatch($$(e),r)}setOperationErrorDescription(e,r){return this.dispatch(U$(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(z$(e),r)}deleteOperationError(e,r){return this.dispatch(q$(e),r)}reorderOperationErrors(e,r){return this.dispatch(V$(e),r)}}const Z$=t=>Rt("ADD_OPERATION_EXAMPLE",{...t}),H$=t=>Rt("UPDATE_OPERATION_EXAMPLE",{...t}),W$=t=>Rt("DELETE_OPERATION_EXAMPLE",{...t}),Y$=t=>Rt("REORDER_OPERATION_EXAMPLES",{...t});class DDe extends Pr{addOperationExample(e,r){return this.dispatch(Z$(e),r)}updateOperationExample(e,r){return this.dispatch(H$(e),r)}deleteOperationExample(e,r){return this.dispatch(W$(e),r)}reorderOperationExamples(e,r){return this.dispatch(Y$(e),r)}}const J$=t=>Rt("ADD_OPERATION",{...t}),K$=t=>Rt("SET_OPERATION_NAME",{...t}),G$=t=>Rt("SET_OPERATION_SCOPE",{...t}),X$=t=>Rt("SET_OPERATION_SCHEMA",{...t}),Q$=t=>Rt("SET_OPERATION_DESCRIPTION",{...t}),eU=t=>Rt("SET_OPERATION_TEMPLATE",{...t}),tU=t=>Rt("SET_OPERATION_REDUCER",{...t}),rU=t=>Rt("MOVE_OPERATION",{...t}),nU=t=>Rt("DELETE_OPERATION",{...t}),iU=t=>Rt("REORDER_MODULE_OPERATIONS",{...t});class ADe extends Pr{addOperation(e,r){return this.dispatch(J$(e),r)}setOperationName(e,r){return this.dispatch(K$(e),r)}setOperationScope(e,r){return this.dispatch(G$(e),r)}setOperationSchema(e,r){return this.dispatch(X$(e),r)}setOperationDescription(e,r){return this.dispatch(Q$(e),r)}setOperationTemplate(e,r){return this.dispatch(eU(e),r)}setOperationReducer(e,r){return this.dispatch(tU(e),r)}moveOperation(e,r){return this.dispatch(rU(e),r)}deleteOperation(e,r){return this.dispatch(nU(e),r)}reorderModuleOperations(e,r){return this.dispatch(iU(e),r)}}const aU=t=>Rt("SET_STATE_SCHEMA",{...t}),sU=t=>Rt("SET_INITIAL_STATE",{...t}),oU=t=>Rt("ADD_STATE_EXAMPLE",{...t}),uU=t=>Rt("UPDATE_STATE_EXAMPLE",{...t}),cU=t=>Rt("DELETE_STATE_EXAMPLE",{...t}),lU=t=>Rt("REORDER_STATE_EXAMPLES",{...t});class NDe extends Pr{setStateSchema(e,r){return this.dispatch(aU(e),r)}setInitialState(e,r){return this.dispatch(sU(e),r)}addStateExample(e,r){return this.dispatch(oU(e),r)}updateStateExample(e,r){return this.dispatch(uU(e),r)}deleteStateExample(e,r){return this.dispatch(cU(e),r)}reorderStateExamples(e,r){return this.dispatch(lU(e),r)}}let dU=(wm=class extends Pr{constructor(t,e){super(x0,wf.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,wm.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},l5e(wm,"fileExtension","phdm"),wm);Go(dU,[xDe,EDe,SDe,TDe,DDe,ADe,NDe]);const IDe=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:N$,addModule:k$,addOperation:J$,addOperationError:L$,addOperationExample:Z$,addStateExample:oU,deleteChangeLogItem:C$,deleteModule:P$,deleteOperation:nU,deleteOperationError:q$,deleteOperationExample:W$,deleteStateExample:cU,moveOperation:rU,releaseNewVersion:M$,reorderChangeLogItems:O$,reorderModuleOperations:iU,reorderModules:B$,reorderOperationErrors:V$,reorderOperationExamples:Y$,reorderStateExamples:lU,setAuthorName:D$,setAuthorWebsite:A$,setInitialState:sU,setModelDescription:T$,setModelExtension:S$,setModelId:E$,setModelName:x$,setModuleDescription:F$,setModuleName:R$,setOperationDescription:Q$,setOperationErrorCode:j$,setOperationErrorDescription:U$,setOperationErrorName:$$,setOperationErrorTemplate:z$,setOperationName:K$,setOperationReducer:tU,setOperationSchema:X$,setOperationScope:G$,setOperationTemplate:eU,setStateSchema:aU,updateChangeLogItem:I$,updateOperationExample:H$,updateStateExample:uU},Symbol.toStringTag,{value:"Module"})),CDe=dU,ODe={...wf,...E5e},MDe={...Ko,...IDe},kDe={Document:CDe,reducer:x0,actions:MDe,utils:ODe,documentModel:S5e},RDe="feature-flags-config",qm=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,FDe=qm==null?void 0:qm.split(","),Vm=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,PDe=Vm==null?void 0:Vm.split(","),fU={editors:{enabledEditors:qm==="*"?"*":FDe,disabledEditors:Vm==="*"?"*":PDe}},BDe=jh(RDe,fU),hU=()=>{const[t,e]=La(BDe);return{config:{...fU,...t},setConfig:e}},LDe=Qz("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Mh=P_(),jDe=jh("sidebar-collapsed",!1);Kn(!1);const $De={sidebarCollapsedAtom:jDe,themeAtom:LDe},UDe=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS;async function zDe(){if(!UDe)return[];try{const t=await _f(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const qDe={DocumentModel:kDe,AtlasFeedbackIssues:Poe,...o5e},pU=Object.values(qDe),mU=zDe(),VDe=Kn(mU),kh=Kn(async t=>{const e=await t(VDe),r=e.map(n=>n.documentModel.id);return[...pU.filter(n=>!r.includes(n.documentModel.id)),...e]}),ZDe=()=>Lh(kh),HDe=RI(kh),gU=()=>Lh(HDe),WDe=()=>mU,YDe=function(t){return Mh.sub(kh,()=>{Mh.get(kh).then(t).catch(e=>{throw e})})};function JDe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const KDe=()=>{const t=gU();return e=>JDe(e,t)},GDe=()=>{const t=gU(),{config:e}=hU(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function XDe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=QDe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function QDe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Wn=class Wn{constructor(e){this.db=W3.ready().then(()=>W3.createInstance({name:e?`${e}:${Wn.DBName}`:Wn.DBName}))}buildKey(...e){return e.join(Wn.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Wn.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_g(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Wn.DRIVES_KEY)).map(n=>n.slice(Wn.DRIVES_KEY.length+Wn.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Wn.DRIVES_KEY,e));if(!n)throw new of(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Wn.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Wn.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_g(i.operations,r);await(await this.db).setItem(this.buildKey(Wn.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Wn.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=XDe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Wn.DBName="DOCUMENT_DRIVES",Wn.SEP=":",Wn.DRIVES_KEY="DRIVES";let N_=Wn;const KN=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,Ab=KN?KN.split(","):[],eAe=()=>({defaultDrives:{remoteDrives:Ab.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[],pullInterval:3e3}})),removeOldRemoteDrives:Ab.length>0?{strategy:"preserve-by-url-and-detach",urls:Ab}:{strategy:"preserve-all"}}});function tAe(t,e){return new aG(t,new N_(e),new ZO,new WO(1,10),{...eAe()})}async function rAe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&Rs.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:Xe.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(Cn.error)}const IE=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??tAe(pU,Rs.routerBasename);return await rAe(t),t})(),yU=Kn(IE),nAe=RI(yU),vU=()=>Lh(nAe),iAe=()=>IE;YDe(async t=>{(await Mh.get(yU)).setDocumentModels(t)});async function aAe(){await WDe();const t=await Mh.get(kh);(await IE).setDocumentModels(t)}aAe().catch(console.error);const Zm=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await _f(async()=>{const{ConnectCrypto:n}=await import("./index-Cgfr30M3.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await _f(async()=>{const{BrowserKeyStorage:n}=await import("./browser-BbIPlSaA.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function CE(){return ko(()=>({async regenerateDid(){return(await Zm).regenerateDid()},async did(){return(await Zm).did()},sign:async t=>await(await Zm).sign(t)}),[])}const sAe=Kn(void 0);function oAe(){const[t,e]=La(sAe);return vi(()=>{t||Zm.then(r=>r.did()).then(r=>e(r)).catch(Cn.error)}),t}const uAe=Kn(window.renown?Promise.resolve(window.renown):void 0);function bU(){const[t,e]=La(uAe),{did:r}=CE();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await _f(async()=>{const{initRenownBrowser:c}=await import("./browser-howbEbax.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let xm=!1;const cAe=Kn(void 0),Uy=()=>{const[t,e]=La(cAe),r=bU();return vi(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}RX(n)},[t]),vi(()=>{if(xm)return;xm=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),xm=!1}},[r,xm]),t},lAe=parseInt("50");function $9e(t,e,r=Cn.error){const[n,i]=ii(e),[a,s]=ii(),o=c=>{s(c),r(c)};return vi(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const h=t(f,c),p=c.scope??"global",m=h.operations[p],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...h}}),h}catch(h){return o(h),d==null||d(h),f}})},a]}async function dAe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var h;if(!(l.documentId===e&&l.scope==r))return;const f=(h=l.operations.at(-1))==null?void 0:h.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function fAe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||lAe;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await dAe(1e4,e,d,l.index,n)}}const hAe=async t=>{(await Xe.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(Cn.error)};async function U9e(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await hAe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function pAe(t,e){const r=await Xe.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function mAe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return Cn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await Xe.buildSignedOperation(t,i,n,s,e)}function gAe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const GN=Kn(new Map);function yAe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function E0(t){return t.map(yAe).join("&")}const vAe=t=>()=>Kn(e=>t?e(GN).get(t)??[]:[],(e,r,n)=>{r(GN,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||E0(a)!==E0(n)?new Map(i).set(t,n):i})}),bAe=Zz(()=>Kn("INITIAL"));function wAe(){const t=vU(),[e,r]=La(ko(vAe(t),[t])),n=Cr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){Cn.error(l)}}catch(u){Cn.error(u)}finally{r(o)}},[t]),[i,a]=La(bAe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=Cr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,h,p)=>{p&&Cn.error(p),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return ko(()=>[e,n,s,i],[e,i])}const _Ae=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",xAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",EAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",SAe=Kn("initial"),OE=()=>{const[t,e]=La(SAe),r=Uy(),n=bU(),{did:i}=CE(),a=Cr(async()=>{var l;const u=await i(),c=new URL(_Ae);if(c.searchParams.set("connect",u),c.searchParams.set("network",xAe),c.searchParams.set("chain",EAe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=Cr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),Cn.error(c)}},[n]);vi(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=Cr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return ko(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function TAe(){const{user:t,status:e}=OE(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function wU(){const t=TAe();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function ME(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=wU()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Uy()||void 0,n=oAe(),{sign:i}=CE(),a=vU(),s=KDe(),[o,u,,c]=wAe(),l=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,P);if(!R)throw new Error(`There was an error opening file with id ${P} on drive ${S}`);return R},[a]),d=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=Wu(R,gAe(P,n,r));const q=P.scope??"global",G=R.operations[q].findLast(z=>z.type===P.type);if(!G)throw new Error("There was an error applying the operation");const ie=await mAe(G,i,S,L,Wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&Cn.error(z.error),z.operations.length&&await u(),z.document&&!mu(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return Cn.error(z),R}},[o,u,a,i,r,n]),f=Cr(async(S,P,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const J=Xe.hashKey();let G=o.find(V=>V.state.global.id===S);if(!G)throw new Error(`Drive with id ${S} not found`);const ie=V2(G.state.global,{id:J,name:P,parentFolder:L??null,documentType:R,document:q},["global"]);G=await d(S,ie);const z=G==null?void 0:G.state.global.nodes.find(V=>V.id===J);if(!z||!Ni(z))throw new Error("There was an error adding document");return z},[d,o,t]),h=Cr(async(S,P,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(J=>J.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,P,R)).document},[o,e,a]),p=Cr(async(S,P,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await pAe(S,s),J={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},G=await f(P,R||(typeof S=="string"?q.name:S.name),q.documentType,L,J),ie=o.find(V=>V.state.global.id===P),z=ie&&ie.state.local.listeners.length>0;fAe(P,G.id,q,a,h,{waitForSync:z}).catch(V=>{throw V})},[f,h,s,t,a]),m=Cr(async(S,P,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const J=await d(S,Yn.updateFile({id:P,name:L||void 0,parentFolder:q,documentType:R})),G=J==null?void 0:J.state.global.nodes.find(ie=>ie.id===P);if(!G||!Ni(G))throw new Error("There was an error updating document");return G},[d,t]),y=Cr(async(S,P,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=Xe.hashKey(),q=await d(S,Yn.addFolder({id:L,name:P,parentFolder:R})),J=q==null?void 0:q.state.global.nodes.find(G=>G.id===L);if(!J||!P0(J))throw new Error("There was an error adding folder");return J},[d,t]),g=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,Yn.deleteNode({id:P}))},[d,t]),v=Cr(async(S,P,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,Yn.updateNode({id:P,name:R})),q=L==null?void 0:L.state.global.nodes.find(J=>J.id===P);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),w=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to move documents");P.kind===Ob||S.parentFolder===P.id||await d(P.driveId,Yn.moveNode({srcFolder:S.id,targetParentFolder:P.id}))},[d,t]),x=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(P.kind===Ob)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>Xe.hashKey(),J=nh.generateNodesCopy({srcId:S.id,targetParentFolder:P.id,targetName:S.name},L,R.state.global.nodes).map(ie=>Yn.copyNode(ie)),G=await a.addDriveActions(S.driveId,J);G.operations.length?await u():G.status!=="SUCCESS"&&Cn.error(`Error copying files: ${G.status}`,G.error)},[o,t,u,a]),_=Cr(async(S,P,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(J=>J.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,P,R)).document},[o,e,a]),A=Cr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const P=S.global.id||Xe.hashKey();S=nh.createState(S);const R=await a.addDrive({global:{...S.global,id:P},local:S.local});return await u(),R},[t,u,a]),M=Cr(async(S,P)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,P);return await u(),R},[u,a]),F=Cr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,Yn.setDriveName({name:P}))},[d,t]),$=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Yn.setAvailableOffline({availableOffline:P}))},[d,t]),T=Cr(async(S,P)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Yn.setSharingType({type:P}))},[d,t]),N=Cr(async(S,P)=>{if(P!==WU){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof HO?"INITIAL_SYNC":R}catch(R){return console.error(R),YU}}},[a]),b=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),E=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),D=Cr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=Cr(async(S,P)=>{const R=await d(S,Yn.removeTrigger({triggerId:P}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===P))throw new Error(`There was an error removing trigger ${P}`)},[d]),I=Cr(async(S,P,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,P,R)},[a]),O=Cr(async(S,P)=>{const R=await d(S,Yn.addTrigger({trigger:P}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${P.id}`)},[d]);return ko(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:p,updateFile:m,addFolder:y,deleteNode:g,renameNode:v,moveNode:w,copyNode:x,addOperation:_,addOperations:h,addDrive:A,addRemoteDrive:M,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:$,setDriveSharingType:T,getSyncStatus:N,onStrandUpdate:b,onSyncStatus:E,clearStorage:D,removeTrigger:C,addTrigger:O,registerNewPullResponderTrigger:I}),[f,A,p,y,_,h,M,O,D,x,F,g,o,c,N,w,b,E,l,I,C,k,v,$,T,m])}function DAe(t){return t.replaceAll(/\s/g,"-")}const AAe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=ME();return et(JU,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:DAe(c.name),kind:Ob,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},NAe=Kn(Rs);function kE(){return La(NAe)}let Em;const IAe=new Uint8Array(16);function CAe(){if(!Em&&(Em=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Em))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Em(IAe)}const Hn=[];for(let t=0;t<256;++t)Hn.push((t+256).toString(16).slice(1));function OAe(t,e=0){return Hn[t[e+0]]+Hn[t[e+1]]+Hn[t[e+2]]+Hn[t[e+3]]+"-"+Hn[t[e+4]]+Hn[t[e+5]]+"-"+Hn[t[e+6]]+Hn[t[e+7]]+"-"+Hn[t[e+8]]+Hn[t[e+9]]+"-"+Hn[t[e+10]]+Hn[t[e+11]]+Hn[t[e+12]]+Hn[t[e+13]]+Hn[t[e+14]]+Hn[t[e+15]]}const MAe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),XN={randomUUID:MAe};function QN(t,e,r){if(XN.randomUUID&&!t)return XN.randomUUID();t=t||{};const n=t.random||(t.rng||CAe)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,OAe(n)}const kAe=t=>{var T;const[e]=kE(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=ii(e.appVersion),[o,u]=ii({label:wp.debug?"Enabled":"Disabled",value:wp.debug}),[c,l]=ii(),[d,f]=ii(null),[h,p]=ii(""),[m,y]=ii({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:v,addTrigger:w,registerNewPullResponderTrigger:x}=ME();vi(()=>{wp.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const _=((T=g.find(N=>N.state.global.id===c))==null?void 0:T.state.local.triggers)||[],M=!c||h==="",F=async()=>{!d||!c||(await v(c,d.value),f(null))},k=async(N=!1)=>{if(!(!h||h===""||!c)){if(!N){const b=await x(c,h,{pullInterval:3e3});await w(c,b),p("");return}await w(c,{id:`invalid-trigger-${QN()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${QN()}`,url:h}}),p("")}},$=N=>{y(N),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",N.value)};return et(KU,{open:r,onOpenChange:N=>{if(!N)return n()},contentProps:{className:"rounded-2xl"},children:Yr("div",{className:"w-[700px] rounded-2xl p-6",children:[Yr("div",{className:"mb-6 flex justify-between",children:[et("div",{className:"text-xl font-bold",children:"Debug Tools"}),et("button",{id:"close-modal",onClick:()=>n(),children:et(bp,{name:"Xmark",size:28})})]}),Yr("div",{className:"flex text-sm font-bold",children:[et(bp,{name:"Ring",size:22}),Yr("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(bp,{name:"Hdd",size:22}),et("span",{className:"ml-2",children:"Drive Tools:"})]}),Yr("div",{children:[et("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),et(Md,{id:"selectedDrive",onChange:N=>{if(!N||typeof N!="object"||!("value"in N)){l(void 0),f(null);return}l(N.value),f(null)},options:g.map(N=>({label:N.state.global.name,value:N.state.global.id}))})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),et(Md,{id:"autoRegisterPullResponder",onChange:N=>{$(N)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),et(Md,{id:"driveTrigger",onChange:N=>{f(N)},value:d,options:_.map(N=>({label:`${N.id} - ${N.type}`,value:N.id}))})]}),et("div",{children:et(qc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),et(zE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:et("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:h,onChange:N=>p(N.target.value)})]}),Yr("div",{className:"mb-1 flex items-center justify-center",children:[et(qc,{className:"mr-2",color:M?"light":"blue",size:"small",disabled:M,onClick:()=>k(),children:"Add Trigger"}),et(qc,{color:M?"light":"red",size:"small",disabled:M,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(bp,{name:"Gear",size:22}),et("span",{className:"ml-2",children:"Service Worker Tools:"})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),et(Md,{id:"serviceWorkerDebugMode",onChange:N=>{u(N)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),et(zE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:et("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:N=>s(N.target.value)})]}),et("div",{className:"mb-1 flex items-center justify-center",children:et(qc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{wp.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},RAe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=nc();return et(GU,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},FAe=t=>{const{t:e}=nc(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return et(XU,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},PAe=t=>{const{open:e,onClose:r}=t,{t:n}=nc();return et(_I,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function BAe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return et(QU,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const LAe="defaultDocumentModelEditor",jAe=jh(LAe,{label:"V2",value:"document-model-editor-v2"}),$Ae=()=>La(jAe),UAe=t=>mt.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},mt.createElement("g",{id:"Group 1000003373"},mt.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),mt.createElement("g",{id:"Renown"},mt.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),mt.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),mt.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),mt.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),mt.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),mt.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),zAe=()=>{const[t,e]=ii(0);return vi(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),et("span",{children:new Array(t).fill(".").join("")})},qAe=()=>{const t=Uy(),{openRenown:e,status:r}=OE();return et("div",{children:r==="checking"?Yr("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[et("span",{children:"Checking Authorization"}),et("span",{className:"inline-block w-5 text-left",children:et(zAe,{})})]}):r!=="authorized"?Yr("div",{className:"flex flex-col items-center",children:[et("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),et(UAe,{className:"mb-3"}),et("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),et(qc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:et("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Yr("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},eI=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),VAe=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=ME(),{t:a}=nc(),s=GDe(),o=ZDe(),{setConfig:u}=hU(),{showModal:c}=xU(),[l]=kE(),[d,f]=$Ae(),[h,p]=ii(eI(s)),{logout:m,status:y}=OE(),g=Uy(),v=()=>{u(x=>({...x,editors:{enabledEditors:h.map(_=>_.value)}})),r()},w=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(Cn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Yr(ez,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:v,onOpenChange:x=>{if(!x)return r()},children:[et("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Yr(wI,{children:[Yr("p",{children:["Logged in with address:"," ",et("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),et(qc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):et(qAe,{})}),l.content.showDocumentModelSelectionSetting&&et(tz,{selected:h,onChange:x=>p(x),options:eI(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),et(rz,{onClearStorage:w,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Yr("div",{children:[et("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),et(Md,{id:"default-document-model-editor",value:d,onChange:x=>f(x),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),et(nz,{packageJson:pz})]})},ZAe=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=nc();return et(iz,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},HAe={deleteItem:FAe,upgradeDrive:ZAe,createDocument:AAe,addLocalDrive:aq,addRemoteDrive:UZ,driveSettings:BAe,settingsModal:VAe,confirmationModal:zZ,deleteDriveModal:RAe,debugSettingsModal:kAe,disclaimerModal:PAe,cookiesPolicy:qZ},_U=Us.createContext({showModal:()=>{},closeModal:()=>{}}),xU=()=>Ph(_U),WAe=t=>{const{children:e}=t,[r,n]=ii(),[i,a]=ii(),[s,o]=ii(!1),u=Cr((f,h)=>{o(!0),n(h),a(f)},[]),c=Cr(()=>{o(!1)},[]),l=i?HAe[i]:null,d=ko(()=>({showModal:u,closeModal:c}),[c,u]);return Yr(_U.Provider,{value:d,children:[e,l&&et(l,{...r,open:s,onClose:c})]})},YAe=(t,e)=>t.some(r=>r.id===e&&r.value),JAe=()=>{const{t}=nc(),{showModal:e}=xU(),[r,n]=iq(),[,i]=B_(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),YAe(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Yr("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[et("div",{className:"absolute inset-0 bg-black opacity-15"}),et("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:et(az,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:et("p",{className:"font-semibold text-gray-500",children:et(AI,{i18nKey:"cookieBanner.message",components:{a:et("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var KAe=Object.defineProperty,GAe=Object.getOwnPropertyDescriptor,_s=(t,e,r,n)=>{for(var i=GAe(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&KAe(e,r,i),i};function xs(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function XAe(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Ya{constructor(e){UE(this,"server");XAe(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}_s([xs],Ya.prototype,"migrateReadDrive");_s([xs],Ya.prototype,"addReadDrive");_s([xs],Ya.prototype,"getReadDrives");_s([xs],Ya.prototype,"getReadDriveBySlug");_s([xs],Ya.prototype,"getReadDrive");_s([xs],Ya.prototype,"getReadDriveContext");_s([xs],Ya.prototype,"fetchDrive");_s([xs],Ya.prototype,"fetchDocument");_s([xs],Ya.prototype,"deleteReadDrive");_s([xs],Ya.prototype,"onReadDrivesUpdate");const zc=new Ya,EU=R_({...zc,readDrives:[]});async function QAe(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof gu))}const eNe=t=>{const e=iAe(),[r,n]=ii([]),i=wU(),[a,s]=ii(!1);vi(()=>{e.then(c=>{zc.setDocumentDrive(c),s(!0)}).catch(Cn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);ko(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=zc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(Cn.error)},[o,a]),vi(()=>{if(!a)return;QAe(zc).then(l=>n(l)).catch(Cn.error);const c=zc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||E0(d)!==E0(l)?l:d)}).catch(Cn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(Cn.error)}},[a]);const u=ko(()=>({...zc,readDrives:r}),[r]);return et(EU.Provider,{...t,value:u})},z9e=()=>Ph(EU);/**
1189
1189
  * @remix-run/router v1.21.0
1190
1190
  *
1191
1191
  * Copyright (c) Remix Software Inc.
@@ -1194,7 +1194,7 @@ enum ReactionType {
1194
1194
  * LICENSE.md file in the root directory of this source tree.
1195
1195
  *
1196
1196
  * @license MIT
1197
- */function ln(){return ln=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ln.apply(this,arguments)}var cn;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(cn||(cn={}));const tI="popstate";function tNe(t){t===void 0&&(t={});let{initialEntries:e=["/"],initialIndex:r,v5Compat:n=!1}=t,i;i=e.map((h,p)=>l(h,typeof h=="string"?null:h.state,p===0?"default":void 0));let a=u(r??i.length-1),s=cn.Pop,o=null;function u(h){return Math.min(Math.max(h,0),i.length-1)}function c(){return i[a]}function l(h,p,m){p===void 0&&(p=null);let y=Vl(i?c().pathname:"/",h,p,m);return tc(y.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(h)),y}function d(h){return typeof h=="string"?h:hd(h)}return{get index(){return a},get action(){return s},get location(){return c()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let p=typeof h=="string"?so(h):h;return{pathname:p.pathname||"",search:p.search||"",hash:p.hash||""}},push(h,p){s=cn.Push;let m=l(h,p);a+=1,i.splice(a,i.length,m),n&&o&&o({action:s,location:m,delta:1})},replace(h,p){s=cn.Replace;let m=l(h,p);i[a]=m,n&&o&&o({action:s,location:m,delta:0})},go(h){s=cn.Pop;let p=u(a+h),m=i[p];a=p,o&&o({action:s,location:m,delta:h})},listen(h){return o=h,()=>{o=null}}}}function V9e(t){t===void 0&&(t={});function e(n,i){let{pathname:a,search:s,hash:o}=n.location;return Vl("",{pathname:a,search:s,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:hd(i)}return nNe(e,r,null,t)}function mr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function tc(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function rNe(){return Math.random().toString(36).substr(2,8)}function rI(t,e){return{usr:t.state,key:t.key,idx:e}}function Vl(t,e,r,n){return r===void 0&&(r=null),ln({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?so(e):e,{state:r,key:e&&e.key||n||rNe()})}function hd(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function so(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function nNe(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:a=!1}=n,s=i.history,o=cn.Pop,u=null,c=l();c==null&&(c=0,s.replaceState(ln({},s.state,{idx:c}),""));function l(){return(s.state||{idx:null}).idx}function d(){o=cn.Pop;let y=l(),g=y==null?null:y-c;c=y,u&&u({action:o,location:m.location,delta:g})}function f(y,g){o=cn.Push;let v=Vl(m.location,y,g);c=l()+1;let w=rI(v,c),x=m.createHref(v);try{s.pushState(w,"",x)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;i.location.assign(x)}a&&u&&u({action:o,location:m.location,delta:1})}function h(y,g){o=cn.Replace;let v=Vl(m.location,y,g);c=l();let w=rI(v,c),x=m.createHref(v);s.replaceState(w,"",x),a&&u&&u({action:o,location:m.location,delta:0})}function p(y){let g=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof y=="string"?y:hd(y);return v=v.replace(/ $/,"%20"),mr(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let m={get action(){return o},get location(){return t(i,s)},listen(y){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(tI,d),u=y,()=>{i.removeEventListener(tI,d),u=null}},createHref(y){return e(i,y)},createURL:p,encodeLocation(y){let g=p(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:h,go(y){return s.go(y)}};return m}var Kr;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Kr||(Kr={}));const iNe=new Set(["lazy","caseSensitive","path","id","index","children"]);function aNe(t){return t.index===!0}function S0(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((i,a)=>{let s=[...r,String(a)],o=typeof i.id=="string"?i.id:s.join("-");if(mr(i.index!==!0||!i.children,"Cannot specify children on an index route"),mr(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),aNe(i)){let u=ln({},i,e(i),{id:o});return n[o]=u,u}else{let u=ln({},i,e(i),{id:o,children:void 0});return n[o]=u,i.children&&(u.children=S0(i.children,e,s,n)),u}})}function Eo(t,e,r){return r===void 0&&(r="/"),Hm(t,e,r,!1)}function Hm(t,e,r,n){let i=typeof e=="string"?so(e):e,a=vp(i.pathname||"/",r);if(a==null)return null;let s=SU(t);oNe(s);let o=null;for(let u=0;o==null&&u<s.length;++u){let c=vNe(a);o=gNe(s[u],c,n)}return o}function sNe(t,e){let{route:r,pathname:n,params:i}=t;return{id:r.id,pathname:n,params:i,data:e[r.id],handle:r.handle}}function SU(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(a,s,o)=>{let u={relativePath:o===void 0?a.path||"":o,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};u.relativePath.startsWith("/")&&(mr(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(n.length));let c=Mo([n,u.relativePath]),l=r.concat(u);a.children&&a.children.length>0&&(mr(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),SU(a.children,e,l,c)),!(a.path==null&&!a.index)&&e.push({path:c,score:pNe(c,a.index),routesMeta:l})};return t.forEach((a,s)=>{var o;if(a.path===""||!((o=a.path)!=null&&o.includes("?")))i(a,s);else for(let u of TU(a.path))i(a,s,u)}),e}function TU(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return i?[a,""]:[a];let s=TU(n.join("/")),o=[];return o.push(...s.map(u=>u===""?a:[a,u].join("/"))),i&&o.push(...s),o.map(u=>t.startsWith("/")&&u===""?"/":u)}function oNe(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:mNe(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const uNe=/^:[\w-]+$/,cNe=3,lNe=2,dNe=1,fNe=10,hNe=-2,nI=t=>t==="*";function pNe(t,e){let r=t.split("/"),n=r.length;return r.some(nI)&&(n+=hNe),e&&(n+=lNe),r.filter(i=>!nI(i)).reduce((i,a)=>i+(uNe.test(a)?cNe:a===""?dNe:fNe),n)}function mNe(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function gNe(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,i={},a="/",s=[];for(let o=0;o<n.length;++o){let u=n[o],c=o===n.length-1,l=a==="/"?e:e.slice(a.length)||"/",d=iI({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},l),f=u.route;if(!d&&c&&r&&!n[n.length-1].route.index&&(d=iI({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),s.push({params:i,pathname:Mo([a,d.pathname]),pathnameBase:_Ne(Mo([a,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(a=Mo([a,d.pathnameBase]))}return s}function iI(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=yNe(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let a=i[0],s=a.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:n.reduce((c,l,d)=>{let{paramName:f,isOptional:h}=l;if(f==="*"){let m=o[d]||"";s=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const p=o[d];return h&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:s,pattern:t}}function yNe(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),tc(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,u)=>(n.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function vNe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return tc(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function vp(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function bNe(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?so(t):t;return{pathname:r?r.startsWith("/")?r:wNe(r,e):e,search:xNe(n),hash:ENe(i)}}function wNe(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Nb(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function DU(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function AU(t,e){let r=DU(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function NU(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=so(t):(i=ln({},t),mr(!i.pathname||!i.pathname.includes("?"),Nb("?","pathname","search",i)),mr(!i.pathname||!i.pathname.includes("#"),Nb("#","pathname","hash",i)),mr(!i.search||!i.search.includes("#"),Nb("#","search","hash",i)));let a=t===""||i.pathname==="",s=a?"/":i.pathname,o;if(s==null)o=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let u=bNe(i,o),c=s&&s!=="/"&&s.endsWith("/"),l=(a||s===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||l)&&(u.pathname+="/"),u}const Mo=t=>t.join("/").replace(/\/\/+/g,"/"),_Ne=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),xNe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ENe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class I_{constructor(e,r,n,i){i===void 0&&(i=!1),this.status=e,this.statusText=r||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function zy(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const IU=["post","put","patch","delete"],SNe=new Set(IU),TNe=["get",...IU],DNe=new Set(TNe),ANe=new Set([301,302,303,307,308]),NNe=new Set([307,308]),Ib={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},INe={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Cd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},RE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,CNe=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),CU="remix-router-transitions";function ONe(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;mr(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let me=t.detectErrorBoundary;i=be=>({hasErrorBoundary:me(be)})}else i=CNe;let a={},s=S0(t.routes,i,void 0,a),o,u=t.basename||"/",c=t.dataStrategy||FNe,l=t.patchRoutesOnNavigation,d=ln({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,h=new Set,p=null,m=null,y=null,g=t.hydrationData!=null,v=Eo(s,t.history.location,u),w=null;if(v==null&&!l){let me=Ti(404,{pathname:t.history.location.pathname}),{matches:be,route:De}=mI(s);v=be,w={[De.id]:me}}v&&!t.hydrationData&&Or(v,s,t.history.location.pathname).active&&(v=null);let x;if(v)if(v.some(me=>me.route.lazy))x=!1;else if(!v.some(me=>me.route.loader))x=!0;else if(d.v7_partialHydration){let me=t.hydrationData?t.hydrationData.loaderData:null,be=t.hydrationData?t.hydrationData.errors:null;if(be){let De=v.findIndex(Ie=>be[Ie.route.id]!==void 0);x=v.slice(0,De+1).every(Ie=>!O_(Ie.route,me,be))}else x=v.every(De=>!O_(De.route,me,be))}else x=t.hydrationData!=null;else if(x=!1,v=[],d.v7_partialHydration){let me=Or(null,s,t.history.location.pathname);me.active&&me.matches&&(v=me.matches)}let _,A={historyAction:t.history.action,location:t.history.location,matches:v,initialized:x,navigation:Ib,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||w,fetchers:new Map,blockers:new Map},M=cn.Pop,F=!1,k,$=!1,T=new Map,N=null,b=!1,E=!1,D=[],C=new Set,I=new Map,O=0,S=-1,P=new Map,R=new Set,L=new Map,q=new Map,J=new Set,G=new Map,ie=new Map,z;function V(){if(f=t.history.listen(me=>{let{action:be,location:De,delta:Ie}=me;if(z){z(),z=void 0;return}tc(ie.size===0||Ie!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ze=Ee({currentLocation:A.location,nextLocation:De,historyAction:be});if(Ze&&Ie!=null){let tt=new Promise(Ye=>{z=Ye});t.history.go(Ie*-1),pe(Ze,{state:"blocked",location:De,proceed(){pe(Ze,{state:"proceeding",proceed:void 0,reset:void 0,location:De}),tt.then(()=>t.history.go(Ie))},reset(){let Ye=new Map(A.blockers);Ye.set(Ze,Cd),oe({blockers:Ye})}});return}return K(be,De)}),r){JNe(e,T);let me=()=>KNe(e,T);e.addEventListener("pagehide",me),N=()=>e.removeEventListener("pagehide",me)}return A.initialized||K(cn.Pop,A.location,{initialHydration:!0}),_}function Q(){f&&f(),N&&N(),h.clear(),k&&k.abort(),A.fetchers.forEach((me,be)=>Ne(be)),A.blockers.forEach((me,be)=>H(be))}function ae(me){return h.add(me),()=>h.delete(me)}function oe(me,be){be===void 0&&(be={}),A=ln({},A,me);let De=[],Ie=[];d.v7_fetcherPersist&&A.fetchers.forEach((Ze,tt)=>{Ze.state==="idle"&&(J.has(tt)?Ie.push(tt):De.push(tt))}),[...h].forEach(Ze=>Ze(A,{deletedFetchers:Ie,viewTransitionOpts:be.viewTransitionOpts,flushSync:be.flushSync===!0})),d.v7_fetcherPersist&&(De.forEach(Ze=>A.fetchers.delete(Ze)),Ie.forEach(Ze=>Ne(Ze)))}function le(me,be,De){var Ie,Ze;let{flushSync:tt}=De===void 0?{}:De,Ye=A.actionData!=null&&A.navigation.formMethod!=null&&_a(A.navigation.formMethod)&&A.navigation.state==="loading"&&((Ie=me.state)==null?void 0:Ie._isRedirect)!==!0,We;be.actionData?Object.keys(be.actionData).length>0?We=be.actionData:We=null:Ye?We=A.actionData:We=null;let Je=be.loaderData?hI(A.loaderData,be.loaderData,be.matches||[],be.errors):A.loaderData,Be=A.blockers;Be.size>0&&(Be=new Map(Be),Be.forEach((gt,Ur)=>Be.set(Ur,Cd)));let rt=F===!0||A.navigation.formMethod!=null&&_a(A.navigation.formMethod)&&((Ze=me.state)==null?void 0:Ze._isRedirect)!==!0;o&&(s=o,o=void 0),b||M===cn.Pop||(M===cn.Push?t.history.push(me,me.state):M===cn.Replace&&t.history.replace(me,me.state));let ht;if(M===cn.Pop){let gt=T.get(A.location.pathname);gt&&gt.has(me.pathname)?ht={currentLocation:A.location,nextLocation:me}:T.has(me.pathname)&&(ht={currentLocation:me,nextLocation:A.location})}else if($){let gt=T.get(A.location.pathname);gt?gt.add(me.pathname):(gt=new Set([me.pathname]),T.set(A.location.pathname,gt)),ht={currentLocation:A.location,nextLocation:me}}oe(ln({},be,{actionData:We,loaderData:Je,historyAction:M,location:me,initialized:!0,navigation:Ib,revalidation:"idle",restoreScrollPosition:Br(me,be.matches||A.matches),preventScrollReset:rt,blockers:Be}),{viewTransitionOpts:ht,flushSync:tt===!0}),M=cn.Pop,F=!1,$=!1,b=!1,E=!1,D=[]}async function he(me,be){if(typeof me=="number"){t.history.go(me);return}let De=C_(A.location,A.matches,u,d.v7_prependBasename,me,d.v7_relativeSplatPath,be==null?void 0:be.fromRouteId,be==null?void 0:be.relative),{path:Ie,submission:Ze,error:tt}=aI(d.v7_normalizeFormMethod,!1,De,be),Ye=A.location,We=Vl(A.location,Ie,be&&be.state);We=ln({},We,t.history.encodeLocation(We));let Je=be&&be.replace!=null?be.replace:void 0,Be=cn.Push;Je===!0?Be=cn.Replace:Je===!1||Ze!=null&&_a(Ze.formMethod)&&Ze.formAction===A.location.pathname+A.location.search&&(Be=cn.Replace);let rt=be&&"preventScrollReset"in be?be.preventScrollReset===!0:void 0,ht=(be&&be.flushSync)===!0,gt=Ee({currentLocation:Ye,nextLocation:We,historyAction:Be});if(gt){pe(gt,{state:"blocked",location:We,proceed(){pe(gt,{state:"proceeding",proceed:void 0,reset:void 0,location:We}),he(me,be)},reset(){let Ur=new Map(A.blockers);Ur.set(gt,Cd),oe({blockers:Ur})}});return}return await K(Be,We,{submission:Ze,pendingError:tt,preventScrollReset:rt,replace:be&&be.replace,enableViewTransition:be&&be.viewTransition,flushSync:ht})}function Z(){if(de(),oe({revalidation:"loading"}),A.navigation.state!=="submitting"){if(A.navigation.state==="idle"){K(A.historyAction,A.location,{startUninterruptedRevalidation:!0});return}K(M||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:$===!0})}}async function K(me,be,De){k&&k.abort(),k=null,M=me,b=(De&&De.startUninterruptedRevalidation)===!0,Ft(A.location,A.matches),F=(De&&De.preventScrollReset)===!0,$=(De&&De.enableViewTransition)===!0;let Ie=o||s,Ze=De&&De.overrideNavigation,tt=Eo(Ie,be,u),Ye=(De&&De.flushSync)===!0,We=Or(tt,Ie,be.pathname);if(We.active&&We.matches&&(tt=We.matches),!tt){let{error:fr,notFoundMatches:Jt,route:Sr}=Oe(be.pathname);le(be,{matches:Jt,loaderData:{},errors:{[Sr.id]:fr}},{flushSync:Ye});return}if(A.initialized&&!E&&UNe(A.location,be)&&!(De&&De.submission&&_a(De.submission.formMethod))){le(be,{matches:tt},{flushSync:Ye});return}k=new AbortController;let Je=Mc(t.history,be,k.signal,De&&De.submission),Be;if(De&&De.pendingError)Be=[bu(tt).route.id,{type:Kr.error,error:De.pendingError}];else if(De&&De.submission&&_a(De.submission.formMethod)){let fr=await B(Je,be,De.submission,tt,We.active,{replace:De.replace,flushSync:Ye});if(fr.shortCircuited)return;if(fr.pendingActionResult){let[Jt,Sr]=fr.pendingActionResult;if(Bi(Sr)&&zy(Sr.error)&&Sr.error.status===404){k=null,le(be,{matches:fr.matches,loaderData:{},errors:{[Jt]:Sr.error}});return}}tt=fr.matches||tt,Be=fr.pendingActionResult,Ze=Cb(be,De.submission),Ye=!1,We.active=!1,Je=Mc(t.history,Je.url,Je.signal)}let{shortCircuited:rt,matches:ht,loaderData:gt,errors:Ur}=await j(Je,be,tt,We.active,Ze,De&&De.submission,De&&De.fetcherSubmission,De&&De.replace,De&&De.initialHydration===!0,Ye,Be);rt||(k=null,le(be,ln({matches:ht||tt},pI(Be),{loaderData:gt,errors:Ur})))}async function B(me,be,De,Ie,Ze,tt){tt===void 0&&(tt={}),de();let Ye=WNe(be,De);if(oe({navigation:Ye},{flushSync:tt.flushSync===!0}),Ze){let Be=await Mt(Ie,be.pathname,me.signal);if(Be.type==="aborted")return{shortCircuited:!0};if(Be.type==="error"){let rt=bu(Be.partialMatches).route.id;return{matches:Be.partialMatches,pendingActionResult:[rt,{type:Kr.error,error:Be.error}]}}else if(Be.matches)Ie=Be.matches;else{let{notFoundMatches:rt,error:ht,route:gt}=Oe(be.pathname);return{matches:rt,pendingActionResult:[gt.id,{type:Kr.error,error:ht}]}}}let We,Je=Qd(Ie,be);if(!Je.route.action&&!Je.route.lazy)We={type:Kr.error,error:Ti(405,{method:me.method,pathname:be.pathname,routeId:Je.route.id})};else if(We=(await re("action",A,me,[Je],Ie,null))[Je.route.id],me.signal.aborted)return{shortCircuited:!0};if(Au(We)){let Be;return tt&&tt.replace!=null?Be=tt.replace:Be=lI(We.response.headers.get("Location"),new URL(me.url),u)===A.location.pathname+A.location.search,await Y(me,We,!0,{submission:De,replace:Be}),{shortCircuited:!0}}if(No(We))throw Ti(400,{type:"defer-action"});if(Bi(We)){let Be=bu(Ie,Je.route.id);return(tt&&tt.replace)!==!0&&(M=cn.Push),{matches:Ie,pendingActionResult:[Be.route.id,We]}}return{matches:Ie,pendingActionResult:[Je.route.id,We]}}async function j(me,be,De,Ie,Ze,tt,Ye,We,Je,Be,rt){let ht=Ze||Cb(be,tt),gt=tt||Ye||yI(ht),Ur=!b&&(!d.v7_partialHydration||!Je);if(Ie){if(Ur){let Mr=U(rt);oe(ln({navigation:ht},Mr!==void 0?{actionData:Mr}:{}),{flushSync:Be})}let Zt=await Mt(De,be.pathname,me.signal);if(Zt.type==="aborted")return{shortCircuited:!0};if(Zt.type==="error"){let Mr=bu(Zt.partialMatches).route.id;return{matches:Zt.partialMatches,loaderData:{},errors:{[Mr]:Zt.error}}}else if(Zt.matches)De=Zt.matches;else{let{error:Mr,notFoundMatches:ti,route:Vn}=Oe(be.pathname);return{matches:ti,loaderData:{},errors:{[Vn.id]:Mr}}}}let fr=o||s,[Jt,Sr]=oI(t.history,A,De,gt,be,d.v7_partialHydration&&Je===!0,d.v7_skipActionErrorRevalidation,E,D,C,J,L,R,fr,u,rt);if(je(Zt=>!(De&&De.some(Mr=>Mr.route.id===Zt))||Jt&&Jt.some(Mr=>Mr.route.id===Zt)),S=++O,Jt.length===0&&Sr.length===0){let Zt=ft();return le(be,ln({matches:De,loaderData:{},errors:rt&&Bi(rt[1])?{[rt[0]]:rt[1].error}:null},pI(rt),Zt?{fetchers:new Map(A.fetchers)}:{}),{flushSync:Be}),{shortCircuited:!0}}if(Ur){let Zt={};if(!Ie){Zt.navigation=ht;let Mr=U(rt);Mr!==void 0&&(Zt.actionData=Mr)}Sr.length>0&&(Zt.fetchers=W(Sr)),oe(Zt,{flushSync:Be})}Sr.forEach(Zt=>{Ce(Zt.key),Zt.controller&&I.set(Zt.key,Zt.controller)});let Fn=()=>Sr.forEach(Zt=>Ce(Zt.key));k&&k.signal.addEventListener("abort",Fn);let{loaderResults:qn,fetcherResults:bn}=await ce(A,De,Jt,Sr,me);if(me.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",Fn),Sr.forEach(Zt=>I.delete(Zt.key));let Qr=Sm(qn);if(Qr)return await Y(me,Qr.result,!0,{replace:We}),{shortCircuited:!0};if(Qr=Sm(bn),Qr)return R.add(Qr.key),await Y(me,Qr.result,!0,{replace:We}),{shortCircuited:!0};let{loaderData:kt,errors:rn}=fI(A,De,qn,rt,Sr,bn,G);G.forEach((Zt,Mr)=>{Zt.subscribe(ti=>{(ti||Zt.done)&&G.delete(Mr)})}),d.v7_partialHydration&&Je&&A.errors&&(rn=ln({},A.errors,rn));let un=ft(),Dn=$e(S),fn=un||Dn||Sr.length>0;return ln({matches:De,loaderData:kt,errors:rn},fn?{fetchers:new Map(A.fetchers)}:{})}function U(me){if(me&&!Bi(me[1]))return{[me[0]]:me[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function W(me){return me.forEach(be=>{let De=A.fetchers.get(be.key),Ie=Od(void 0,De?De.data:void 0);A.fetchers.set(be.key,Ie)}),new Map(A.fetchers)}function ee(me,be,De,Ie){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ce(me);let Ze=(Ie&&Ie.flushSync)===!0,tt=o||s,Ye=C_(A.location,A.matches,u,d.v7_prependBasename,De,d.v7_relativeSplatPath,be,Ie==null?void 0:Ie.relative),We=Eo(tt,Ye,u),Je=Or(We,tt,Ye);if(Je.active&&Je.matches&&(We=Je.matches),!We){we(me,be,Ti(404,{pathname:Ye}),{flushSync:Ze});return}let{path:Be,submission:rt,error:ht}=aI(d.v7_normalizeFormMethod,!0,Ye,Ie);if(ht){we(me,be,ht,{flushSync:Ze});return}let gt=Qd(We,Be),Ur=(Ie&&Ie.preventScrollReset)===!0;if(rt&&_a(rt.formMethod)){te(me,be,Be,gt,We,Je.active,Ze,Ur,rt);return}L.set(me,{routeId:be,path:Be}),ne(me,be,Be,gt,We,Je.active,Ze,Ur,rt)}async function te(me,be,De,Ie,Ze,tt,Ye,We,Je){de(),L.delete(me);function Be(nn){if(!nn.route.action&&!nn.route.lazy){let Ji=Ti(405,{method:Je.formMethod,pathname:De,routeId:be});return we(me,be,Ji,{flushSync:Ye}),!0}return!1}if(!tt&&Be(Ie))return;let rt=A.fetchers.get(me);ve(me,YNe(Je,rt),{flushSync:Ye});let ht=new AbortController,gt=Mc(t.history,De,ht.signal,Je);if(tt){let nn=await Mt(Ze,De,gt.signal);if(nn.type==="aborted")return;if(nn.type==="error"){we(me,be,nn.error,{flushSync:Ye});return}else if(nn.matches){if(Ze=nn.matches,Ie=Qd(Ze,De),Be(Ie))return}else{we(me,be,Ti(404,{pathname:De}),{flushSync:Ye});return}}I.set(me,ht);let Ur=O,Jt=(await re("action",A,gt,[Ie],Ze,me))[Ie.route.id];if(gt.signal.aborted){I.get(me)===ht&&I.delete(me);return}if(d.v7_fetcherPersist&&J.has(me)){if(Au(Jt)||Bi(Jt)){ve(me,ho(void 0));return}}else{if(Au(Jt))if(I.delete(me),S>Ur){ve(me,ho(void 0));return}else return R.add(me),ve(me,Od(Je)),Y(gt,Jt,!1,{fetcherSubmission:Je,preventScrollReset:We});if(Bi(Jt)){we(me,be,Jt.error);return}}if(No(Jt))throw Ti(400,{type:"defer-action"});let Sr=A.navigation.location||A.location,Fn=Mc(t.history,Sr,ht.signal),qn=o||s,bn=A.navigation.state!=="idle"?Eo(qn,A.navigation.location,u):A.matches;mr(bn,"Didn't find any matches after fetcher action");let Qr=++O;P.set(me,Qr);let kt=Od(Je,Jt.data);A.fetchers.set(me,kt);let[rn,un]=oI(t.history,A,bn,Je,Sr,!1,d.v7_skipActionErrorRevalidation,E,D,C,J,L,R,qn,u,[Ie.route.id,Jt]);un.filter(nn=>nn.key!==me).forEach(nn=>{let Ji=nn.key,ue=A.fetchers.get(Ji),ge=Od(void 0,ue?ue.data:void 0);A.fetchers.set(Ji,ge),Ce(Ji),nn.controller&&I.set(Ji,nn.controller)}),oe({fetchers:new Map(A.fetchers)});let Dn=()=>un.forEach(nn=>Ce(nn.key));ht.signal.addEventListener("abort",Dn);let{loaderResults:fn,fetcherResults:Zt}=await ce(A,bn,rn,un,Fn);if(ht.signal.aborted)return;ht.signal.removeEventListener("abort",Dn),P.delete(me),I.delete(me),un.forEach(nn=>I.delete(nn.key));let Mr=Sm(fn);if(Mr)return Y(Fn,Mr.result,!1,{preventScrollReset:We});if(Mr=Sm(Zt),Mr)return R.add(Mr.key),Y(Fn,Mr.result,!1,{preventScrollReset:We});let{loaderData:ti,errors:Vn}=fI(A,bn,fn,void 0,un,Zt,G);if(A.fetchers.has(me)){let nn=ho(Jt.data);A.fetchers.set(me,nn)}$e(Qr),A.navigation.state==="loading"&&Qr>S?(mr(M,"Expected pending action"),k&&k.abort(),le(A.navigation.location,{matches:bn,loaderData:ti,errors:Vn,fetchers:new Map(A.fetchers)})):(oe({errors:Vn,loaderData:hI(A.loaderData,ti,bn,Vn),fetchers:new Map(A.fetchers)}),E=!1)}async function ne(me,be,De,Ie,Ze,tt,Ye,We,Je){let Be=A.fetchers.get(me);ve(me,Od(Je,Be?Be.data:void 0),{flushSync:Ye});let rt=new AbortController,ht=Mc(t.history,De,rt.signal);if(tt){let Jt=await Mt(Ze,De,ht.signal);if(Jt.type==="aborted")return;if(Jt.type==="error"){we(me,be,Jt.error,{flushSync:Ye});return}else if(Jt.matches)Ze=Jt.matches,Ie=Qd(Ze,De);else{we(me,be,Ti(404,{pathname:De}),{flushSync:Ye});return}}I.set(me,rt);let gt=O,fr=(await re("loader",A,ht,[Ie],Ze,me))[Ie.route.id];if(No(fr)&&(fr=await FE(fr,ht.signal,!0)||fr),I.get(me)===rt&&I.delete(me),!ht.signal.aborted){if(J.has(me)){ve(me,ho(void 0));return}if(Au(fr))if(S>gt){ve(me,ho(void 0));return}else{R.add(me),await Y(ht,fr,!1,{preventScrollReset:We});return}if(Bi(fr)){we(me,be,fr.error);return}mr(!No(fr),"Unhandled fetcher deferred data"),ve(me,ho(fr.data))}}async function Y(me,be,De,Ie){let{submission:Ze,fetcherSubmission:tt,preventScrollReset:Ye,replace:We}=Ie===void 0?{}:Ie;be.response.headers.has("X-Remix-Revalidate")&&(E=!0);let Je=be.response.headers.get("Location");mr(Je,"Expected a Location header on the redirect Response"),Je=lI(Je,new URL(me.url),u);let Be=Vl(A.location,Je,{_isRedirect:!0});if(r){let Jt=!1;if(be.response.headers.has("X-Remix-Reload-Document"))Jt=!0;else if(RE.test(Je)){const Sr=t.history.createURL(Je);Jt=Sr.origin!==e.location.origin||vp(Sr.pathname,u)==null}if(Jt){We?e.location.replace(Je):e.location.assign(Je);return}}k=null;let rt=We===!0||be.response.headers.has("X-Remix-Replace")?cn.Replace:cn.Push,{formMethod:ht,formAction:gt,formEncType:Ur}=A.navigation;!Ze&&!tt&&ht&&gt&&Ur&&(Ze=yI(A.navigation));let fr=Ze||tt;if(NNe.has(be.response.status)&&fr&&_a(fr.formMethod))await K(rt,Be,{submission:ln({},fr,{formAction:Je}),preventScrollReset:Ye||F,enableViewTransition:De?$:void 0});else{let Jt=Cb(Be,Ze);await K(rt,Be,{overrideNavigation:Jt,fetcherSubmission:tt,preventScrollReset:Ye||F,enableViewTransition:De?$:void 0})}}async function re(me,be,De,Ie,Ze,tt){let Ye,We={};try{Ye=await PNe(c,me,be,De,Ie,Ze,tt,a,i)}catch(Je){return Ie.forEach(Be=>{We[Be.route.id]={type:Kr.error,error:Je}}),We}for(let[Je,Be]of Object.entries(Ye))if(zNe(Be)){let rt=Be.result;We[Je]={type:Kr.redirect,response:jNe(rt,De,Je,Ze,u,d.v7_relativeSplatPath)}}else We[Je]=await LNe(Be);return We}async function ce(me,be,De,Ie,Ze){let tt=me.matches,Ye=re("loader",me,Ze,De,be,null),We=Promise.all(Ie.map(async rt=>{if(rt.matches&&rt.match&&rt.controller){let gt=(await re("loader",me,Mc(t.history,rt.path,rt.controller.signal),[rt.match],rt.matches,rt.key))[rt.match.route.id];return{[rt.key]:gt}}else return Promise.resolve({[rt.key]:{type:Kr.error,error:Ti(404,{pathname:rt.path})}})})),Je=await Ye,Be=(await We).reduce((rt,ht)=>Object.assign(rt,ht),{});return await Promise.all([ZNe(be,Je,Ze.signal,tt,me.loaderData),HNe(be,Be,Ie)]),{loaderResults:Je,fetcherResults:Be}}function de(){E=!0,D.push(...je()),L.forEach((me,be)=>{I.has(be)&&C.add(be),Ce(be)})}function ve(me,be,De){De===void 0&&(De={}),A.fetchers.set(me,be),oe({fetchers:new Map(A.fetchers)},{flushSync:(De&&De.flushSync)===!0})}function we(me,be,De,Ie){Ie===void 0&&(Ie={});let Ze=bu(A.matches,be);Ne(me),oe({errors:{[Ze.route.id]:De},fetchers:new Map(A.fetchers)},{flushSync:(Ie&&Ie.flushSync)===!0})}function Ae(me){return d.v7_fetcherPersist&&(q.set(me,(q.get(me)||0)+1),J.has(me)&&J.delete(me)),A.fetchers.get(me)||INe}function Ne(me){let be=A.fetchers.get(me);I.has(me)&&!(be&&be.state==="loading"&&P.has(me))&&Ce(me),L.delete(me),P.delete(me),R.delete(me),J.delete(me),C.delete(me),A.fetchers.delete(me)}function Pe(me){if(d.v7_fetcherPersist){let be=(q.get(me)||0)-1;be<=0?(q.delete(me),J.add(me)):q.set(me,be)}else Ne(me);oe({fetchers:new Map(A.fetchers)})}function Ce(me){let be=I.get(me);be&&(be.abort(),I.delete(me))}function Qe(me){for(let be of me){let De=Ae(be),Ie=ho(De.data);A.fetchers.set(be,Ie)}}function ft(){let me=[],be=!1;for(let De of R){let Ie=A.fetchers.get(De);mr(Ie,"Expected fetcher: "+De),Ie.state==="loading"&&(R.delete(De),me.push(De),be=!0)}return Qe(me),be}function $e(me){let be=[];for(let[De,Ie]of P)if(Ie<me){let Ze=A.fetchers.get(De);mr(Ze,"Expected fetcher: "+De),Ze.state==="loading"&&(Ce(De),P.delete(De),be.push(De))}return Qe(be),be.length>0}function Et(me,be){let De=A.blockers.get(me)||Cd;return ie.get(me)!==be&&ie.set(me,be),De}function H(me){A.blockers.delete(me),ie.delete(me)}function pe(me,be){let De=A.blockers.get(me)||Cd;mr(De.state==="unblocked"&&be.state==="blocked"||De.state==="blocked"&&be.state==="blocked"||De.state==="blocked"&&be.state==="proceeding"||De.state==="blocked"&&be.state==="unblocked"||De.state==="proceeding"&&be.state==="unblocked","Invalid blocker state transition: "+De.state+" -> "+be.state);let Ie=new Map(A.blockers);Ie.set(me,be),oe({blockers:Ie})}function Ee(me){let{currentLocation:be,nextLocation:De,historyAction:Ie}=me;if(ie.size===0)return;ie.size>1&&tc(!1,"A router only supports one blocker at a time");let Ze=Array.from(ie.entries()),[tt,Ye]=Ze[Ze.length-1],We=A.blockers.get(tt);if(!(We&&We.state==="proceeding")&&Ye({currentLocation:be,nextLocation:De,historyAction:Ie}))return tt}function Oe(me){let be=Ti(404,{pathname:me}),De=o||s,{matches:Ie,route:Ze}=mI(De);return je(),{notFoundMatches:Ie,route:Ze,error:be}}function je(me){let be=[];return G.forEach((De,Ie)=>{(!me||me(Ie))&&(De.cancel(),be.push(Ie),G.delete(Ie))}),be}function it(me,be,De){if(p=me,y=be,m=De||null,!g&&A.navigation===Ib){g=!0;let Ie=Br(A.location,A.matches);Ie!=null&&oe({restoreScrollPosition:Ie})}return()=>{p=null,y=null,m=null}}function jt(me,be){return m&&m(me,be.map(Ie=>sNe(Ie,A.loaderData)))||me.key}function Ft(me,be){if(p&&y){let De=jt(me,be);p[De]=y()}}function Br(me,be){if(p){let De=jt(me,be),Ie=p[De];if(typeof Ie=="number")return Ie}return null}function Or(me,be,De){if(l)if(me){if(Object.keys(me[0].params).length>0)return{active:!0,matches:Hm(be,De,u,!0)}}else return{active:!0,matches:Hm(be,De,u,!0)||[]};return{active:!1,matches:null}}async function Mt(me,be,De){if(!l)return{type:"success",matches:me};let Ie=me;for(;;){let Ze=o==null,tt=o||s,Ye=a;try{await l({path:be,matches:Ie,patch:(Be,rt)=>{De.aborted||cI(Be,rt,tt,Ye,i)}})}catch(Be){return{type:"error",error:Be,partialMatches:Ie}}finally{Ze&&!De.aborted&&(s=[...s])}if(De.aborted)return{type:"aborted"};let We=Eo(tt,be,u);if(We)return{type:"success",matches:We};let Je=Hm(tt,be,u,!0);if(!Je||Ie.length===Je.length&&Ie.every((Be,rt)=>Be.route.id===Je[rt].route.id))return{type:"success",matches:null};Ie=Je}}function jr(me){a={},o=S0(me,i,void 0,a)}function $r(me,be){let De=o==null;cI(me,be,o||s,a,i),De&&(s=[...s],oe({}))}return _={get basename(){return u},get future(){return d},get state(){return A},get routes(){return s},get window(){return e},initialize:V,subscribe:ae,enableScrollRestoration:it,navigate:he,fetch:ee,revalidate:Z,createHref:me=>t.history.createHref(me),encodeLocation:me=>t.history.encodeLocation(me),getFetcher:Ae,deleteFetcher:Pe,dispose:Q,getBlocker:Et,deleteBlocker:H,patchRoutes:$r,_internalFetchControllers:I,_internalActiveDeferreds:G,_internalSetRoutes:jr},_}function MNe(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function C_(t,e,r,n,i,a,s,o){let u,c;if(s){u=[];for(let d of e)if(u.push(d),d.route.id===s){c=d;break}}else u=e,c=e[e.length-1];let l=NU(i||".",AU(u,a),vp(t.pathname,r)||t.pathname,o==="path");if(i==null&&(l.search=t.search,l.hash=t.hash),(i==null||i===""||i===".")&&c){let d=PE(l.search);if(c.route.index&&!d)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let f=new URLSearchParams(l.search),h=f.getAll("index");f.delete("index"),h.filter(m=>m).forEach(m=>f.append("index",m));let p=f.toString();l.search=p?"?"+p:""}}return n&&r!=="/"&&(l.pathname=l.pathname==="/"?r:Mo([r,l.pathname])),hd(l)}function aI(t,e,r,n){if(!n||!MNe(n))return{path:r};if(n.formMethod&&!VNe(n.formMethod))return{path:r,error:Ti(405,{method:n.formMethod})};let i=()=>({path:r,error:Ti(400,{type:"invalid-body"})}),a=n.formMethod||"get",s=t?a.toUpperCase():a.toLowerCase(),o=kU(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!_a(s))return i();let f=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,p)=>{let[m,y]=p;return""+h+m+"="+y+`
1197
+ */function ln(){return ln=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ln.apply(this,arguments)}var cn;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(cn||(cn={}));const tI="popstate";function tNe(t){t===void 0&&(t={});let{initialEntries:e=["/"],initialIndex:r,v5Compat:n=!1}=t,i;i=e.map((h,p)=>l(h,typeof h=="string"?null:h.state,p===0?"default":void 0));let a=u(r??i.length-1),s=cn.Pop,o=null;function u(h){return Math.min(Math.max(h,0),i.length-1)}function c(){return i[a]}function l(h,p,m){p===void 0&&(p=null);let y=Vl(i?c().pathname:"/",h,p,m);return tc(y.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(h)),y}function d(h){return typeof h=="string"?h:hd(h)}return{get index(){return a},get action(){return s},get location(){return c()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let p=typeof h=="string"?so(h):h;return{pathname:p.pathname||"",search:p.search||"",hash:p.hash||""}},push(h,p){s=cn.Push;let m=l(h,p);a+=1,i.splice(a,i.length,m),n&&o&&o({action:s,location:m,delta:1})},replace(h,p){s=cn.Replace;let m=l(h,p);i[a]=m,n&&o&&o({action:s,location:m,delta:0})},go(h){s=cn.Pop;let p=u(a+h),m=i[p];a=p,o&&o({action:s,location:m,delta:h})},listen(h){return o=h,()=>{o=null}}}}function q9e(t){t===void 0&&(t={});function e(n,i){let{pathname:a,search:s,hash:o}=n.location;return Vl("",{pathname:a,search:s,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:hd(i)}return nNe(e,r,null,t)}function mr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function tc(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function rNe(){return Math.random().toString(36).substr(2,8)}function rI(t,e){return{usr:t.state,key:t.key,idx:e}}function Vl(t,e,r,n){return r===void 0&&(r=null),ln({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?so(e):e,{state:r,key:e&&e.key||n||rNe()})}function hd(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function so(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function nNe(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:a=!1}=n,s=i.history,o=cn.Pop,u=null,c=l();c==null&&(c=0,s.replaceState(ln({},s.state,{idx:c}),""));function l(){return(s.state||{idx:null}).idx}function d(){o=cn.Pop;let y=l(),g=y==null?null:y-c;c=y,u&&u({action:o,location:m.location,delta:g})}function f(y,g){o=cn.Push;let v=Vl(m.location,y,g);c=l()+1;let w=rI(v,c),x=m.createHref(v);try{s.pushState(w,"",x)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;i.location.assign(x)}a&&u&&u({action:o,location:m.location,delta:1})}function h(y,g){o=cn.Replace;let v=Vl(m.location,y,g);c=l();let w=rI(v,c),x=m.createHref(v);s.replaceState(w,"",x),a&&u&&u({action:o,location:m.location,delta:0})}function p(y){let g=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof y=="string"?y:hd(y);return v=v.replace(/ $/,"%20"),mr(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let m={get action(){return o},get location(){return t(i,s)},listen(y){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(tI,d),u=y,()=>{i.removeEventListener(tI,d),u=null}},createHref(y){return e(i,y)},createURL:p,encodeLocation(y){let g=p(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:h,go(y){return s.go(y)}};return m}var Kr;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Kr||(Kr={}));const iNe=new Set(["lazy","caseSensitive","path","id","index","children"]);function aNe(t){return t.index===!0}function S0(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((i,a)=>{let s=[...r,String(a)],o=typeof i.id=="string"?i.id:s.join("-");if(mr(i.index!==!0||!i.children,"Cannot specify children on an index route"),mr(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),aNe(i)){let u=ln({},i,e(i),{id:o});return n[o]=u,u}else{let u=ln({},i,e(i),{id:o,children:void 0});return n[o]=u,i.children&&(u.children=S0(i.children,e,s,n)),u}})}function Eo(t,e,r){return r===void 0&&(r="/"),Hm(t,e,r,!1)}function Hm(t,e,r,n){let i=typeof e=="string"?so(e):e,a=vp(i.pathname||"/",r);if(a==null)return null;let s=SU(t);oNe(s);let o=null;for(let u=0;o==null&&u<s.length;++u){let c=vNe(a);o=gNe(s[u],c,n)}return o}function sNe(t,e){let{route:r,pathname:n,params:i}=t;return{id:r.id,pathname:n,params:i,data:e[r.id],handle:r.handle}}function SU(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(a,s,o)=>{let u={relativePath:o===void 0?a.path||"":o,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};u.relativePath.startsWith("/")&&(mr(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(n.length));let c=Mo([n,u.relativePath]),l=r.concat(u);a.children&&a.children.length>0&&(mr(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),SU(a.children,e,l,c)),!(a.path==null&&!a.index)&&e.push({path:c,score:pNe(c,a.index),routesMeta:l})};return t.forEach((a,s)=>{var o;if(a.path===""||!((o=a.path)!=null&&o.includes("?")))i(a,s);else for(let u of TU(a.path))i(a,s,u)}),e}function TU(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return i?[a,""]:[a];let s=TU(n.join("/")),o=[];return o.push(...s.map(u=>u===""?a:[a,u].join("/"))),i&&o.push(...s),o.map(u=>t.startsWith("/")&&u===""?"/":u)}function oNe(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:mNe(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const uNe=/^:[\w-]+$/,cNe=3,lNe=2,dNe=1,fNe=10,hNe=-2,nI=t=>t==="*";function pNe(t,e){let r=t.split("/"),n=r.length;return r.some(nI)&&(n+=hNe),e&&(n+=lNe),r.filter(i=>!nI(i)).reduce((i,a)=>i+(uNe.test(a)?cNe:a===""?dNe:fNe),n)}function mNe(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function gNe(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,i={},a="/",s=[];for(let o=0;o<n.length;++o){let u=n[o],c=o===n.length-1,l=a==="/"?e:e.slice(a.length)||"/",d=iI({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},l),f=u.route;if(!d&&c&&r&&!n[n.length-1].route.index&&(d=iI({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),s.push({params:i,pathname:Mo([a,d.pathname]),pathnameBase:_Ne(Mo([a,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(a=Mo([a,d.pathnameBase]))}return s}function iI(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=yNe(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let a=i[0],s=a.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:n.reduce((c,l,d)=>{let{paramName:f,isOptional:h}=l;if(f==="*"){let m=o[d]||"";s=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const p=o[d];return h&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:s,pattern:t}}function yNe(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),tc(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,u)=>(n.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function vNe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return tc(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function vp(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function bNe(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?so(t):t;return{pathname:r?r.startsWith("/")?r:wNe(r,e):e,search:xNe(n),hash:ENe(i)}}function wNe(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Nb(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function DU(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function AU(t,e){let r=DU(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function NU(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=so(t):(i=ln({},t),mr(!i.pathname||!i.pathname.includes("?"),Nb("?","pathname","search",i)),mr(!i.pathname||!i.pathname.includes("#"),Nb("#","pathname","hash",i)),mr(!i.search||!i.search.includes("#"),Nb("#","search","hash",i)));let a=t===""||i.pathname==="",s=a?"/":i.pathname,o;if(s==null)o=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let u=bNe(i,o),c=s&&s!=="/"&&s.endsWith("/"),l=(a||s===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||l)&&(u.pathname+="/"),u}const Mo=t=>t.join("/").replace(/\/\/+/g,"/"),_Ne=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),xNe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ENe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class I_{constructor(e,r,n,i){i===void 0&&(i=!1),this.status=e,this.statusText=r||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function zy(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const IU=["post","put","patch","delete"],SNe=new Set(IU),TNe=["get",...IU],DNe=new Set(TNe),ANe=new Set([301,302,303,307,308]),NNe=new Set([307,308]),Ib={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},INe={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Cd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},RE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,CNe=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),CU="remix-router-transitions";function ONe(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;mr(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let me=t.detectErrorBoundary;i=be=>({hasErrorBoundary:me(be)})}else i=CNe;let a={},s=S0(t.routes,i,void 0,a),o,u=t.basename||"/",c=t.dataStrategy||FNe,l=t.patchRoutesOnNavigation,d=ln({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,h=new Set,p=null,m=null,y=null,g=t.hydrationData!=null,v=Eo(s,t.history.location,u),w=null;if(v==null&&!l){let me=Ti(404,{pathname:t.history.location.pathname}),{matches:be,route:De}=mI(s);v=be,w={[De.id]:me}}v&&!t.hydrationData&&Or(v,s,t.history.location.pathname).active&&(v=null);let x;if(v)if(v.some(me=>me.route.lazy))x=!1;else if(!v.some(me=>me.route.loader))x=!0;else if(d.v7_partialHydration){let me=t.hydrationData?t.hydrationData.loaderData:null,be=t.hydrationData?t.hydrationData.errors:null;if(be){let De=v.findIndex(Ie=>be[Ie.route.id]!==void 0);x=v.slice(0,De+1).every(Ie=>!O_(Ie.route,me,be))}else x=v.every(De=>!O_(De.route,me,be))}else x=t.hydrationData!=null;else if(x=!1,v=[],d.v7_partialHydration){let me=Or(null,s,t.history.location.pathname);me.active&&me.matches&&(v=me.matches)}let _,A={historyAction:t.history.action,location:t.history.location,matches:v,initialized:x,navigation:Ib,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||w,fetchers:new Map,blockers:new Map},M=cn.Pop,F=!1,k,$=!1,T=new Map,N=null,b=!1,E=!1,D=[],C=new Set,I=new Map,O=0,S=-1,P=new Map,R=new Set,L=new Map,q=new Map,J=new Set,G=new Map,ie=new Map,z;function V(){if(f=t.history.listen(me=>{let{action:be,location:De,delta:Ie}=me;if(z){z(),z=void 0;return}tc(ie.size===0||Ie!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ze=Ee({currentLocation:A.location,nextLocation:De,historyAction:be});if(Ze&&Ie!=null){let tt=new Promise(Ye=>{z=Ye});t.history.go(Ie*-1),pe(Ze,{state:"blocked",location:De,proceed(){pe(Ze,{state:"proceeding",proceed:void 0,reset:void 0,location:De}),tt.then(()=>t.history.go(Ie))},reset(){let Ye=new Map(A.blockers);Ye.set(Ze,Cd),oe({blockers:Ye})}});return}return K(be,De)}),r){JNe(e,T);let me=()=>KNe(e,T);e.addEventListener("pagehide",me),N=()=>e.removeEventListener("pagehide",me)}return A.initialized||K(cn.Pop,A.location,{initialHydration:!0}),_}function Q(){f&&f(),N&&N(),h.clear(),k&&k.abort(),A.fetchers.forEach((me,be)=>Ne(be)),A.blockers.forEach((me,be)=>H(be))}function ae(me){return h.add(me),()=>h.delete(me)}function oe(me,be){be===void 0&&(be={}),A=ln({},A,me);let De=[],Ie=[];d.v7_fetcherPersist&&A.fetchers.forEach((Ze,tt)=>{Ze.state==="idle"&&(J.has(tt)?Ie.push(tt):De.push(tt))}),[...h].forEach(Ze=>Ze(A,{deletedFetchers:Ie,viewTransitionOpts:be.viewTransitionOpts,flushSync:be.flushSync===!0})),d.v7_fetcherPersist&&(De.forEach(Ze=>A.fetchers.delete(Ze)),Ie.forEach(Ze=>Ne(Ze)))}function le(me,be,De){var Ie,Ze;let{flushSync:tt}=De===void 0?{}:De,Ye=A.actionData!=null&&A.navigation.formMethod!=null&&_a(A.navigation.formMethod)&&A.navigation.state==="loading"&&((Ie=me.state)==null?void 0:Ie._isRedirect)!==!0,We;be.actionData?Object.keys(be.actionData).length>0?We=be.actionData:We=null:Ye?We=A.actionData:We=null;let Je=be.loaderData?hI(A.loaderData,be.loaderData,be.matches||[],be.errors):A.loaderData,Be=A.blockers;Be.size>0&&(Be=new Map(Be),Be.forEach((gt,Ur)=>Be.set(Ur,Cd)));let rt=F===!0||A.navigation.formMethod!=null&&_a(A.navigation.formMethod)&&((Ze=me.state)==null?void 0:Ze._isRedirect)!==!0;o&&(s=o,o=void 0),b||M===cn.Pop||(M===cn.Push?t.history.push(me,me.state):M===cn.Replace&&t.history.replace(me,me.state));let ht;if(M===cn.Pop){let gt=T.get(A.location.pathname);gt&&gt.has(me.pathname)?ht={currentLocation:A.location,nextLocation:me}:T.has(me.pathname)&&(ht={currentLocation:me,nextLocation:A.location})}else if($){let gt=T.get(A.location.pathname);gt?gt.add(me.pathname):(gt=new Set([me.pathname]),T.set(A.location.pathname,gt)),ht={currentLocation:A.location,nextLocation:me}}oe(ln({},be,{actionData:We,loaderData:Je,historyAction:M,location:me,initialized:!0,navigation:Ib,revalidation:"idle",restoreScrollPosition:Br(me,be.matches||A.matches),preventScrollReset:rt,blockers:Be}),{viewTransitionOpts:ht,flushSync:tt===!0}),M=cn.Pop,F=!1,$=!1,b=!1,E=!1,D=[]}async function he(me,be){if(typeof me=="number"){t.history.go(me);return}let De=C_(A.location,A.matches,u,d.v7_prependBasename,me,d.v7_relativeSplatPath,be==null?void 0:be.fromRouteId,be==null?void 0:be.relative),{path:Ie,submission:Ze,error:tt}=aI(d.v7_normalizeFormMethod,!1,De,be),Ye=A.location,We=Vl(A.location,Ie,be&&be.state);We=ln({},We,t.history.encodeLocation(We));let Je=be&&be.replace!=null?be.replace:void 0,Be=cn.Push;Je===!0?Be=cn.Replace:Je===!1||Ze!=null&&_a(Ze.formMethod)&&Ze.formAction===A.location.pathname+A.location.search&&(Be=cn.Replace);let rt=be&&"preventScrollReset"in be?be.preventScrollReset===!0:void 0,ht=(be&&be.flushSync)===!0,gt=Ee({currentLocation:Ye,nextLocation:We,historyAction:Be});if(gt){pe(gt,{state:"blocked",location:We,proceed(){pe(gt,{state:"proceeding",proceed:void 0,reset:void 0,location:We}),he(me,be)},reset(){let Ur=new Map(A.blockers);Ur.set(gt,Cd),oe({blockers:Ur})}});return}return await K(Be,We,{submission:Ze,pendingError:tt,preventScrollReset:rt,replace:be&&be.replace,enableViewTransition:be&&be.viewTransition,flushSync:ht})}function Z(){if(de(),oe({revalidation:"loading"}),A.navigation.state!=="submitting"){if(A.navigation.state==="idle"){K(A.historyAction,A.location,{startUninterruptedRevalidation:!0});return}K(M||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:$===!0})}}async function K(me,be,De){k&&k.abort(),k=null,M=me,b=(De&&De.startUninterruptedRevalidation)===!0,Ft(A.location,A.matches),F=(De&&De.preventScrollReset)===!0,$=(De&&De.enableViewTransition)===!0;let Ie=o||s,Ze=De&&De.overrideNavigation,tt=Eo(Ie,be,u),Ye=(De&&De.flushSync)===!0,We=Or(tt,Ie,be.pathname);if(We.active&&We.matches&&(tt=We.matches),!tt){let{error:fr,notFoundMatches:Jt,route:Sr}=Oe(be.pathname);le(be,{matches:Jt,loaderData:{},errors:{[Sr.id]:fr}},{flushSync:Ye});return}if(A.initialized&&!E&&UNe(A.location,be)&&!(De&&De.submission&&_a(De.submission.formMethod))){le(be,{matches:tt},{flushSync:Ye});return}k=new AbortController;let Je=Mc(t.history,be,k.signal,De&&De.submission),Be;if(De&&De.pendingError)Be=[bu(tt).route.id,{type:Kr.error,error:De.pendingError}];else if(De&&De.submission&&_a(De.submission.formMethod)){let fr=await B(Je,be,De.submission,tt,We.active,{replace:De.replace,flushSync:Ye});if(fr.shortCircuited)return;if(fr.pendingActionResult){let[Jt,Sr]=fr.pendingActionResult;if(Bi(Sr)&&zy(Sr.error)&&Sr.error.status===404){k=null,le(be,{matches:fr.matches,loaderData:{},errors:{[Jt]:Sr.error}});return}}tt=fr.matches||tt,Be=fr.pendingActionResult,Ze=Cb(be,De.submission),Ye=!1,We.active=!1,Je=Mc(t.history,Je.url,Je.signal)}let{shortCircuited:rt,matches:ht,loaderData:gt,errors:Ur}=await j(Je,be,tt,We.active,Ze,De&&De.submission,De&&De.fetcherSubmission,De&&De.replace,De&&De.initialHydration===!0,Ye,Be);rt||(k=null,le(be,ln({matches:ht||tt},pI(Be),{loaderData:gt,errors:Ur})))}async function B(me,be,De,Ie,Ze,tt){tt===void 0&&(tt={}),de();let Ye=WNe(be,De);if(oe({navigation:Ye},{flushSync:tt.flushSync===!0}),Ze){let Be=await Mt(Ie,be.pathname,me.signal);if(Be.type==="aborted")return{shortCircuited:!0};if(Be.type==="error"){let rt=bu(Be.partialMatches).route.id;return{matches:Be.partialMatches,pendingActionResult:[rt,{type:Kr.error,error:Be.error}]}}else if(Be.matches)Ie=Be.matches;else{let{notFoundMatches:rt,error:ht,route:gt}=Oe(be.pathname);return{matches:rt,pendingActionResult:[gt.id,{type:Kr.error,error:ht}]}}}let We,Je=Qd(Ie,be);if(!Je.route.action&&!Je.route.lazy)We={type:Kr.error,error:Ti(405,{method:me.method,pathname:be.pathname,routeId:Je.route.id})};else if(We=(await re("action",A,me,[Je],Ie,null))[Je.route.id],me.signal.aborted)return{shortCircuited:!0};if(Au(We)){let Be;return tt&&tt.replace!=null?Be=tt.replace:Be=lI(We.response.headers.get("Location"),new URL(me.url),u)===A.location.pathname+A.location.search,await Y(me,We,!0,{submission:De,replace:Be}),{shortCircuited:!0}}if(No(We))throw Ti(400,{type:"defer-action"});if(Bi(We)){let Be=bu(Ie,Je.route.id);return(tt&&tt.replace)!==!0&&(M=cn.Push),{matches:Ie,pendingActionResult:[Be.route.id,We]}}return{matches:Ie,pendingActionResult:[Je.route.id,We]}}async function j(me,be,De,Ie,Ze,tt,Ye,We,Je,Be,rt){let ht=Ze||Cb(be,tt),gt=tt||Ye||yI(ht),Ur=!b&&(!d.v7_partialHydration||!Je);if(Ie){if(Ur){let Mr=U(rt);oe(ln({navigation:ht},Mr!==void 0?{actionData:Mr}:{}),{flushSync:Be})}let Zt=await Mt(De,be.pathname,me.signal);if(Zt.type==="aborted")return{shortCircuited:!0};if(Zt.type==="error"){let Mr=bu(Zt.partialMatches).route.id;return{matches:Zt.partialMatches,loaderData:{},errors:{[Mr]:Zt.error}}}else if(Zt.matches)De=Zt.matches;else{let{error:Mr,notFoundMatches:ti,route:qn}=Oe(be.pathname);return{matches:ti,loaderData:{},errors:{[qn.id]:Mr}}}}let fr=o||s,[Jt,Sr]=oI(t.history,A,De,gt,be,d.v7_partialHydration&&Je===!0,d.v7_skipActionErrorRevalidation,E,D,C,J,L,R,fr,u,rt);if(je(Zt=>!(De&&De.some(Mr=>Mr.route.id===Zt))||Jt&&Jt.some(Mr=>Mr.route.id===Zt)),S=++O,Jt.length===0&&Sr.length===0){let Zt=ft();return le(be,ln({matches:De,loaderData:{},errors:rt&&Bi(rt[1])?{[rt[0]]:rt[1].error}:null},pI(rt),Zt?{fetchers:new Map(A.fetchers)}:{}),{flushSync:Be}),{shortCircuited:!0}}if(Ur){let Zt={};if(!Ie){Zt.navigation=ht;let Mr=U(rt);Mr!==void 0&&(Zt.actionData=Mr)}Sr.length>0&&(Zt.fetchers=W(Sr)),oe(Zt,{flushSync:Be})}Sr.forEach(Zt=>{Ce(Zt.key),Zt.controller&&I.set(Zt.key,Zt.controller)});let Fn=()=>Sr.forEach(Zt=>Ce(Zt.key));k&&k.signal.addEventListener("abort",Fn);let{loaderResults:zn,fetcherResults:bn}=await ce(A,De,Jt,Sr,me);if(me.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",Fn),Sr.forEach(Zt=>I.delete(Zt.key));let Qr=Sm(zn);if(Qr)return await Y(me,Qr.result,!0,{replace:We}),{shortCircuited:!0};if(Qr=Sm(bn),Qr)return R.add(Qr.key),await Y(me,Qr.result,!0,{replace:We}),{shortCircuited:!0};let{loaderData:kt,errors:rn}=fI(A,De,zn,rt,Sr,bn,G);G.forEach((Zt,Mr)=>{Zt.subscribe(ti=>{(ti||Zt.done)&&G.delete(Mr)})}),d.v7_partialHydration&&Je&&A.errors&&(rn=ln({},A.errors,rn));let un=ft(),Dn=$e(S),fn=un||Dn||Sr.length>0;return ln({matches:De,loaderData:kt,errors:rn},fn?{fetchers:new Map(A.fetchers)}:{})}function U(me){if(me&&!Bi(me[1]))return{[me[0]]:me[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function W(me){return me.forEach(be=>{let De=A.fetchers.get(be.key),Ie=Od(void 0,De?De.data:void 0);A.fetchers.set(be.key,Ie)}),new Map(A.fetchers)}function ee(me,be,De,Ie){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ce(me);let Ze=(Ie&&Ie.flushSync)===!0,tt=o||s,Ye=C_(A.location,A.matches,u,d.v7_prependBasename,De,d.v7_relativeSplatPath,be,Ie==null?void 0:Ie.relative),We=Eo(tt,Ye,u),Je=Or(We,tt,Ye);if(Je.active&&Je.matches&&(We=Je.matches),!We){we(me,be,Ti(404,{pathname:Ye}),{flushSync:Ze});return}let{path:Be,submission:rt,error:ht}=aI(d.v7_normalizeFormMethod,!0,Ye,Ie);if(ht){we(me,be,ht,{flushSync:Ze});return}let gt=Qd(We,Be),Ur=(Ie&&Ie.preventScrollReset)===!0;if(rt&&_a(rt.formMethod)){te(me,be,Be,gt,We,Je.active,Ze,Ur,rt);return}L.set(me,{routeId:be,path:Be}),ne(me,be,Be,gt,We,Je.active,Ze,Ur,rt)}async function te(me,be,De,Ie,Ze,tt,Ye,We,Je){de(),L.delete(me);function Be(nn){if(!nn.route.action&&!nn.route.lazy){let Ji=Ti(405,{method:Je.formMethod,pathname:De,routeId:be});return we(me,be,Ji,{flushSync:Ye}),!0}return!1}if(!tt&&Be(Ie))return;let rt=A.fetchers.get(me);ve(me,YNe(Je,rt),{flushSync:Ye});let ht=new AbortController,gt=Mc(t.history,De,ht.signal,Je);if(tt){let nn=await Mt(Ze,De,gt.signal);if(nn.type==="aborted")return;if(nn.type==="error"){we(me,be,nn.error,{flushSync:Ye});return}else if(nn.matches){if(Ze=nn.matches,Ie=Qd(Ze,De),Be(Ie))return}else{we(me,be,Ti(404,{pathname:De}),{flushSync:Ye});return}}I.set(me,ht);let Ur=O,Jt=(await re("action",A,gt,[Ie],Ze,me))[Ie.route.id];if(gt.signal.aborted){I.get(me)===ht&&I.delete(me);return}if(d.v7_fetcherPersist&&J.has(me)){if(Au(Jt)||Bi(Jt)){ve(me,ho(void 0));return}}else{if(Au(Jt))if(I.delete(me),S>Ur){ve(me,ho(void 0));return}else return R.add(me),ve(me,Od(Je)),Y(gt,Jt,!1,{fetcherSubmission:Je,preventScrollReset:We});if(Bi(Jt)){we(me,be,Jt.error);return}}if(No(Jt))throw Ti(400,{type:"defer-action"});let Sr=A.navigation.location||A.location,Fn=Mc(t.history,Sr,ht.signal),zn=o||s,bn=A.navigation.state!=="idle"?Eo(zn,A.navigation.location,u):A.matches;mr(bn,"Didn't find any matches after fetcher action");let Qr=++O;P.set(me,Qr);let kt=Od(Je,Jt.data);A.fetchers.set(me,kt);let[rn,un]=oI(t.history,A,bn,Je,Sr,!1,d.v7_skipActionErrorRevalidation,E,D,C,J,L,R,zn,u,[Ie.route.id,Jt]);un.filter(nn=>nn.key!==me).forEach(nn=>{let Ji=nn.key,ue=A.fetchers.get(Ji),ge=Od(void 0,ue?ue.data:void 0);A.fetchers.set(Ji,ge),Ce(Ji),nn.controller&&I.set(Ji,nn.controller)}),oe({fetchers:new Map(A.fetchers)});let Dn=()=>un.forEach(nn=>Ce(nn.key));ht.signal.addEventListener("abort",Dn);let{loaderResults:fn,fetcherResults:Zt}=await ce(A,bn,rn,un,Fn);if(ht.signal.aborted)return;ht.signal.removeEventListener("abort",Dn),P.delete(me),I.delete(me),un.forEach(nn=>I.delete(nn.key));let Mr=Sm(fn);if(Mr)return Y(Fn,Mr.result,!1,{preventScrollReset:We});if(Mr=Sm(Zt),Mr)return R.add(Mr.key),Y(Fn,Mr.result,!1,{preventScrollReset:We});let{loaderData:ti,errors:qn}=fI(A,bn,fn,void 0,un,Zt,G);if(A.fetchers.has(me)){let nn=ho(Jt.data);A.fetchers.set(me,nn)}$e(Qr),A.navigation.state==="loading"&&Qr>S?(mr(M,"Expected pending action"),k&&k.abort(),le(A.navigation.location,{matches:bn,loaderData:ti,errors:qn,fetchers:new Map(A.fetchers)})):(oe({errors:qn,loaderData:hI(A.loaderData,ti,bn,qn),fetchers:new Map(A.fetchers)}),E=!1)}async function ne(me,be,De,Ie,Ze,tt,Ye,We,Je){let Be=A.fetchers.get(me);ve(me,Od(Je,Be?Be.data:void 0),{flushSync:Ye});let rt=new AbortController,ht=Mc(t.history,De,rt.signal);if(tt){let Jt=await Mt(Ze,De,ht.signal);if(Jt.type==="aborted")return;if(Jt.type==="error"){we(me,be,Jt.error,{flushSync:Ye});return}else if(Jt.matches)Ze=Jt.matches,Ie=Qd(Ze,De);else{we(me,be,Ti(404,{pathname:De}),{flushSync:Ye});return}}I.set(me,rt);let gt=O,fr=(await re("loader",A,ht,[Ie],Ze,me))[Ie.route.id];if(No(fr)&&(fr=await FE(fr,ht.signal,!0)||fr),I.get(me)===rt&&I.delete(me),!ht.signal.aborted){if(J.has(me)){ve(me,ho(void 0));return}if(Au(fr))if(S>gt){ve(me,ho(void 0));return}else{R.add(me),await Y(ht,fr,!1,{preventScrollReset:We});return}if(Bi(fr)){we(me,be,fr.error);return}mr(!No(fr),"Unhandled fetcher deferred data"),ve(me,ho(fr.data))}}async function Y(me,be,De,Ie){let{submission:Ze,fetcherSubmission:tt,preventScrollReset:Ye,replace:We}=Ie===void 0?{}:Ie;be.response.headers.has("X-Remix-Revalidate")&&(E=!0);let Je=be.response.headers.get("Location");mr(Je,"Expected a Location header on the redirect Response"),Je=lI(Je,new URL(me.url),u);let Be=Vl(A.location,Je,{_isRedirect:!0});if(r){let Jt=!1;if(be.response.headers.has("X-Remix-Reload-Document"))Jt=!0;else if(RE.test(Je)){const Sr=t.history.createURL(Je);Jt=Sr.origin!==e.location.origin||vp(Sr.pathname,u)==null}if(Jt){We?e.location.replace(Je):e.location.assign(Je);return}}k=null;let rt=We===!0||be.response.headers.has("X-Remix-Replace")?cn.Replace:cn.Push,{formMethod:ht,formAction:gt,formEncType:Ur}=A.navigation;!Ze&&!tt&&ht&&gt&&Ur&&(Ze=yI(A.navigation));let fr=Ze||tt;if(NNe.has(be.response.status)&&fr&&_a(fr.formMethod))await K(rt,Be,{submission:ln({},fr,{formAction:Je}),preventScrollReset:Ye||F,enableViewTransition:De?$:void 0});else{let Jt=Cb(Be,Ze);await K(rt,Be,{overrideNavigation:Jt,fetcherSubmission:tt,preventScrollReset:Ye||F,enableViewTransition:De?$:void 0})}}async function re(me,be,De,Ie,Ze,tt){let Ye,We={};try{Ye=await PNe(c,me,be,De,Ie,Ze,tt,a,i)}catch(Je){return Ie.forEach(Be=>{We[Be.route.id]={type:Kr.error,error:Je}}),We}for(let[Je,Be]of Object.entries(Ye))if(zNe(Be)){let rt=Be.result;We[Je]={type:Kr.redirect,response:jNe(rt,De,Je,Ze,u,d.v7_relativeSplatPath)}}else We[Je]=await LNe(Be);return We}async function ce(me,be,De,Ie,Ze){let tt=me.matches,Ye=re("loader",me,Ze,De,be,null),We=Promise.all(Ie.map(async rt=>{if(rt.matches&&rt.match&&rt.controller){let gt=(await re("loader",me,Mc(t.history,rt.path,rt.controller.signal),[rt.match],rt.matches,rt.key))[rt.match.route.id];return{[rt.key]:gt}}else return Promise.resolve({[rt.key]:{type:Kr.error,error:Ti(404,{pathname:rt.path})}})})),Je=await Ye,Be=(await We).reduce((rt,ht)=>Object.assign(rt,ht),{});return await Promise.all([ZNe(be,Je,Ze.signal,tt,me.loaderData),HNe(be,Be,Ie)]),{loaderResults:Je,fetcherResults:Be}}function de(){E=!0,D.push(...je()),L.forEach((me,be)=>{I.has(be)&&C.add(be),Ce(be)})}function ve(me,be,De){De===void 0&&(De={}),A.fetchers.set(me,be),oe({fetchers:new Map(A.fetchers)},{flushSync:(De&&De.flushSync)===!0})}function we(me,be,De,Ie){Ie===void 0&&(Ie={});let Ze=bu(A.matches,be);Ne(me),oe({errors:{[Ze.route.id]:De},fetchers:new Map(A.fetchers)},{flushSync:(Ie&&Ie.flushSync)===!0})}function Ae(me){return d.v7_fetcherPersist&&(q.set(me,(q.get(me)||0)+1),J.has(me)&&J.delete(me)),A.fetchers.get(me)||INe}function Ne(me){let be=A.fetchers.get(me);I.has(me)&&!(be&&be.state==="loading"&&P.has(me))&&Ce(me),L.delete(me),P.delete(me),R.delete(me),J.delete(me),C.delete(me),A.fetchers.delete(me)}function Pe(me){if(d.v7_fetcherPersist){let be=(q.get(me)||0)-1;be<=0?(q.delete(me),J.add(me)):q.set(me,be)}else Ne(me);oe({fetchers:new Map(A.fetchers)})}function Ce(me){let be=I.get(me);be&&(be.abort(),I.delete(me))}function Qe(me){for(let be of me){let De=Ae(be),Ie=ho(De.data);A.fetchers.set(be,Ie)}}function ft(){let me=[],be=!1;for(let De of R){let Ie=A.fetchers.get(De);mr(Ie,"Expected fetcher: "+De),Ie.state==="loading"&&(R.delete(De),me.push(De),be=!0)}return Qe(me),be}function $e(me){let be=[];for(let[De,Ie]of P)if(Ie<me){let Ze=A.fetchers.get(De);mr(Ze,"Expected fetcher: "+De),Ze.state==="loading"&&(Ce(De),P.delete(De),be.push(De))}return Qe(be),be.length>0}function Et(me,be){let De=A.blockers.get(me)||Cd;return ie.get(me)!==be&&ie.set(me,be),De}function H(me){A.blockers.delete(me),ie.delete(me)}function pe(me,be){let De=A.blockers.get(me)||Cd;mr(De.state==="unblocked"&&be.state==="blocked"||De.state==="blocked"&&be.state==="blocked"||De.state==="blocked"&&be.state==="proceeding"||De.state==="blocked"&&be.state==="unblocked"||De.state==="proceeding"&&be.state==="unblocked","Invalid blocker state transition: "+De.state+" -> "+be.state);let Ie=new Map(A.blockers);Ie.set(me,be),oe({blockers:Ie})}function Ee(me){let{currentLocation:be,nextLocation:De,historyAction:Ie}=me;if(ie.size===0)return;ie.size>1&&tc(!1,"A router only supports one blocker at a time");let Ze=Array.from(ie.entries()),[tt,Ye]=Ze[Ze.length-1],We=A.blockers.get(tt);if(!(We&&We.state==="proceeding")&&Ye({currentLocation:be,nextLocation:De,historyAction:Ie}))return tt}function Oe(me){let be=Ti(404,{pathname:me}),De=o||s,{matches:Ie,route:Ze}=mI(De);return je(),{notFoundMatches:Ie,route:Ze,error:be}}function je(me){let be=[];return G.forEach((De,Ie)=>{(!me||me(Ie))&&(De.cancel(),be.push(Ie),G.delete(Ie))}),be}function it(me,be,De){if(p=me,y=be,m=De||null,!g&&A.navigation===Ib){g=!0;let Ie=Br(A.location,A.matches);Ie!=null&&oe({restoreScrollPosition:Ie})}return()=>{p=null,y=null,m=null}}function jt(me,be){return m&&m(me,be.map(Ie=>sNe(Ie,A.loaderData)))||me.key}function Ft(me,be){if(p&&y){let De=jt(me,be);p[De]=y()}}function Br(me,be){if(p){let De=jt(me,be),Ie=p[De];if(typeof Ie=="number")return Ie}return null}function Or(me,be,De){if(l)if(me){if(Object.keys(me[0].params).length>0)return{active:!0,matches:Hm(be,De,u,!0)}}else return{active:!0,matches:Hm(be,De,u,!0)||[]};return{active:!1,matches:null}}async function Mt(me,be,De){if(!l)return{type:"success",matches:me};let Ie=me;for(;;){let Ze=o==null,tt=o||s,Ye=a;try{await l({path:be,matches:Ie,patch:(Be,rt)=>{De.aborted||cI(Be,rt,tt,Ye,i)}})}catch(Be){return{type:"error",error:Be,partialMatches:Ie}}finally{Ze&&!De.aborted&&(s=[...s])}if(De.aborted)return{type:"aborted"};let We=Eo(tt,be,u);if(We)return{type:"success",matches:We};let Je=Hm(tt,be,u,!0);if(!Je||Ie.length===Je.length&&Ie.every((Be,rt)=>Be.route.id===Je[rt].route.id))return{type:"success",matches:null};Ie=Je}}function jr(me){a={},o=S0(me,i,void 0,a)}function $r(me,be){let De=o==null;cI(me,be,o||s,a,i),De&&(s=[...s],oe({}))}return _={get basename(){return u},get future(){return d},get state(){return A},get routes(){return s},get window(){return e},initialize:V,subscribe:ae,enableScrollRestoration:it,navigate:he,fetch:ee,revalidate:Z,createHref:me=>t.history.createHref(me),encodeLocation:me=>t.history.encodeLocation(me),getFetcher:Ae,deleteFetcher:Pe,dispose:Q,getBlocker:Et,deleteBlocker:H,patchRoutes:$r,_internalFetchControllers:I,_internalActiveDeferreds:G,_internalSetRoutes:jr},_}function MNe(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function C_(t,e,r,n,i,a,s,o){let u,c;if(s){u=[];for(let d of e)if(u.push(d),d.route.id===s){c=d;break}}else u=e,c=e[e.length-1];let l=NU(i||".",AU(u,a),vp(t.pathname,r)||t.pathname,o==="path");if(i==null&&(l.search=t.search,l.hash=t.hash),(i==null||i===""||i===".")&&c){let d=PE(l.search);if(c.route.index&&!d)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let f=new URLSearchParams(l.search),h=f.getAll("index");f.delete("index"),h.filter(m=>m).forEach(m=>f.append("index",m));let p=f.toString();l.search=p?"?"+p:""}}return n&&r!=="/"&&(l.pathname=l.pathname==="/"?r:Mo([r,l.pathname])),hd(l)}function aI(t,e,r,n){if(!n||!MNe(n))return{path:r};if(n.formMethod&&!VNe(n.formMethod))return{path:r,error:Ti(405,{method:n.formMethod})};let i=()=>({path:r,error:Ti(400,{type:"invalid-body"})}),a=n.formMethod||"get",s=t?a.toUpperCase():a.toLowerCase(),o=kU(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!_a(s))return i();let f=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,p)=>{let[m,y]=p;return""+h+m+"="+y+`
1198
1198
  `},""):String(n.body);return{path:r,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:f}}}else if(n.formEncType==="application/json"){if(!_a(s))return i();try{let f=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:f,text:void 0}}}catch{return i()}}}mr(typeof FormData=="function","FormData is not available in this environment");let u,c;if(n.formData)u=M_(n.formData),c=n.formData;else if(n.body instanceof FormData)u=M_(n.body),c=n.body;else if(n.body instanceof URLSearchParams)u=n.body,c=dI(u);else if(n.body==null)u=new URLSearchParams,c=new FormData;else try{u=new URLSearchParams(n.body),c=dI(u)}catch{return i()}let l={formMethod:s,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(_a(l.formMethod))return{path:r,submission:l};let d=so(r);return e&&d.search&&PE(d.search)&&u.append("index",""),d.search="?"+u,{path:hd(d),submission:l}}function sI(t,e,r){r===void 0&&(r=!1);let n=t.findIndex(i=>i.route.id===e);return n>=0?t.slice(0,r?n+1:n):t}function oI(t,e,r,n,i,a,s,o,u,c,l,d,f,h,p,m){let y=m?Bi(m[1])?m[1].error:m[1].data:void 0,g=t.createURL(e.location),v=t.createURL(i),w=r;a&&e.errors?w=sI(r,Object.keys(e.errors)[0],!0):m&&Bi(m[1])&&(w=sI(r,m[0]));let x=m?m[1].statusCode:void 0,_=s&&x&&x>=400,A=w.filter((F,k)=>{let{route:$}=F;if($.lazy)return!0;if($.loader==null)return!1;if(a)return O_($,e.loaderData,e.errors);if(kNe(e.loaderData,e.matches[k],F)||u.some(b=>b===F.route.id))return!0;let T=e.matches[k],N=F;return uI(F,ln({currentUrl:g,currentParams:T.params,nextUrl:v,nextParams:N.params},n,{actionResult:y,actionStatus:x,defaultShouldRevalidate:_?!1:o||g.pathname+g.search===v.pathname+v.search||g.search!==v.search||OU(T,N)}))}),M=[];return d.forEach((F,k)=>{if(a||!r.some(E=>E.route.id===F.routeId)||l.has(k))return;let $=Eo(h,F.path,p);if(!$){M.push({key:k,routeId:F.routeId,path:F.path,matches:null,match:null,controller:null});return}let T=e.fetchers.get(k),N=Qd($,F.path),b=!1;f.has(k)?b=!1:c.has(k)?(c.delete(k),b=!0):T&&T.state!=="idle"&&T.data===void 0?b=o:b=uI(N,ln({currentUrl:g,currentParams:e.matches[e.matches.length-1].params,nextUrl:v,nextParams:r[r.length-1].params},n,{actionResult:y,actionStatus:x,defaultShouldRevalidate:_?!1:o})),b&&M.push({key:k,routeId:F.routeId,path:F.path,matches:$,match:N,controller:new AbortController})}),[A,M]}function O_(t,e,r){if(t.lazy)return!0;if(!t.loader)return!1;let n=e!=null&&e[t.id]!==void 0,i=r!=null&&r[t.id]!==void 0;return!n&&i?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!n&&!i}function kNe(t,e,r){let n=!e||r.route.id!==e.route.id,i=t[r.route.id]===void 0;return n||i}function OU(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function uI(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function cI(t,e,r,n,i){var a;let s;if(t){let c=n[t];mr(c,"No route found to patch children into: routeId = "+t),c.children||(c.children=[]),s=c.children}else s=r;let o=e.filter(c=>!s.some(l=>MU(c,l))),u=S0(o,i,[t||"_","patch",String(((a=s)==null?void 0:a.length)||"0")],n);s.push(...u)}function MU(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((r,n)=>{var i;return(i=e.children)==null?void 0:i.some(a=>MU(r,a))}):!1}async function RNe(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let i=r[t.id];mr(i,"No route found in manifest");let a={};for(let s in n){let u=i[s]!==void 0&&s!=="hasErrorBoundary";tc(!u,'Route "'+i.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!u&&!iNe.has(s)&&(a[s]=n[s])}Object.assign(i,a),Object.assign(i,ln({},e(i),{lazy:void 0}))}async function FNe(t){let{matches:e}=t,r=e.filter(i=>i.shouldLoad);return(await Promise.all(r.map(i=>i.resolve()))).reduce((i,a,s)=>Object.assign(i,{[r[s].route.id]:a}),{})}async function PNe(t,e,r,n,i,a,s,o,u,c){let l=a.map(h=>h.route.lazy?RNe(h.route,u,o):void 0),d=a.map((h,p)=>{let m=l[p],y=i.some(v=>v.route.id===h.route.id);return ln({},h,{shouldLoad:y,resolve:async v=>(v&&n.method==="GET"&&(h.route.lazy||h.route.loader)&&(y=!0),y?BNe(e,n,h,m,v,c):Promise.resolve({type:Kr.data,result:void 0}))})}),f=await t({matches:d,request:n,params:a[0].params,fetcherKey:s,context:c});try{await Promise.all(l)}catch{}return f}async function BNe(t,e,r,n,i,a){let s,o,u=c=>{let l,d=new Promise((p,m)=>l=m);o=()=>l(),e.signal.addEventListener("abort",o);let f=p=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):c({request:e,params:r.params,context:a},...p!==void 0?[p]:[]),h=(async()=>{try{return{type:"data",result:await(i?i(m=>f(m)):f())}}catch(p){return{type:"error",result:p}}})();return Promise.race([h,d])};try{let c=r.route[t];if(n)if(c){let l,[d]=await Promise.all([u(c).catch(f=>{l=f}),n]);if(l!==void 0)throw l;s=d}else if(await n,c=r.route[t],c)s=await u(c);else if(t==="action"){let l=new URL(e.url),d=l.pathname+l.search;throw Ti(405,{method:e.method,pathname:d,routeId:r.route.id})}else return{type:Kr.data,result:void 0};else if(c)s=await u(c);else{let l=new URL(e.url),d=l.pathname+l.search;throw Ti(404,{pathname:d})}mr(s.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:Kr.error,result:c}}finally{o&&e.signal.removeEventListener("abort",o)}return s}async function LNe(t){let{result:e,type:r}=t;if(RU(e)){let c;try{let l=e.headers.get("Content-Type");l&&/\bapplication\/json\b/.test(l)?e.body==null?c=null:c=await e.json():c=await e.text()}catch(l){return{type:Kr.error,error:l}}return r===Kr.error?{type:Kr.error,error:new I_(e.status,e.statusText,c),statusCode:e.status,headers:e.headers}:{type:Kr.data,data:c,statusCode:e.status,headers:e.headers}}if(r===Kr.error){if(gI(e)){var n;if(e.data instanceof Error){var i;return{type:Kr.error,error:e.data,statusCode:(i=e.init)==null?void 0:i.status}}e=new I_(((n=e.init)==null?void 0:n.status)||500,void 0,e.data)}return{type:Kr.error,error:e,statusCode:zy(e)?e.status:void 0}}if(qNe(e)){var a,s;return{type:Kr.deferred,deferredData:e,statusCode:(a=e.init)==null?void 0:a.status,headers:((s=e.init)==null?void 0:s.headers)&&new Headers(e.init.headers)}}if(gI(e)){var o,u;return{type:Kr.data,data:e.data,statusCode:(o=e.init)==null?void 0:o.status,headers:(u=e.init)!=null&&u.headers?new Headers(e.init.headers):void 0}}return{type:Kr.data,data:e}}function jNe(t,e,r,n,i,a){let s=t.headers.get("Location");if(mr(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!RE.test(s)){let o=n.slice(0,n.findIndex(u=>u.route.id===r)+1);s=C_(new URL(e.url),o,i,!0,s,a),t.headers.set("Location",s)}return t}function lI(t,e,r){if(RE.test(t)){let n=t,i=n.startsWith("//")?new URL(e.protocol+n):new URL(n),a=vp(i.pathname,r)!=null;if(i.origin===e.origin&&a)return i.pathname+i.search+i.hash}return t}function Mc(t,e,r,n){let i=t.createURL(kU(e)).toString(),a={signal:r};if(n&&_a(n.formMethod)){let{formMethod:s,formEncType:o}=n;a.method=s.toUpperCase(),o==="application/json"?(a.headers=new Headers({"Content-Type":o}),a.body=JSON.stringify(n.json)):o==="text/plain"?a.body=n.text:o==="application/x-www-form-urlencoded"&&n.formData?a.body=M_(n.formData):a.body=n.formData}return new Request(i,a)}function M_(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function dI(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function $Ne(t,e,r,n,i){let a={},s=null,o,u=!1,c={},l=r&&Bi(r[1])?r[1].error:void 0;return t.forEach(d=>{if(!(d.route.id in e))return;let f=d.route.id,h=e[f];if(mr(!Au(h),"Cannot handle redirect results in processLoaderData"),Bi(h)){let p=h.error;l!==void 0&&(p=l,l=void 0),s=s||{};{let m=bu(t,f);s[m.route.id]==null&&(s[m.route.id]=p)}a[f]=void 0,u||(u=!0,o=zy(h.error)?h.error.status:500),h.headers&&(c[f]=h.headers)}else No(h)?(n.set(f,h.deferredData),a[f]=h.deferredData.data,h.statusCode!=null&&h.statusCode!==200&&!u&&(o=h.statusCode),h.headers&&(c[f]=h.headers)):(a[f]=h.data,h.statusCode&&h.statusCode!==200&&!u&&(o=h.statusCode),h.headers&&(c[f]=h.headers))}),l!==void 0&&r&&(s={[r[0]]:l},a[r[0]]=void 0),{loaderData:a,errors:s,statusCode:o||200,loaderHeaders:c}}function fI(t,e,r,n,i,a,s){let{loaderData:o,errors:u}=$Ne(e,r,n,s);return i.forEach(c=>{let{key:l,match:d,controller:f}=c,h=a[l];if(mr(h,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(Bi(h)){let p=bu(t.matches,d==null?void 0:d.route.id);u&&u[p.route.id]||(u=ln({},u,{[p.route.id]:h.error})),t.fetchers.delete(l)}else if(Au(h))mr(!1,"Unhandled fetcher revalidation redirect");else if(No(h))mr(!1,"Unhandled fetcher deferred data");else{let p=ho(h.data);t.fetchers.set(l,p)}}),{loaderData:o,errors:u}}function hI(t,e,r,n){let i=ln({},e);for(let a of r){let s=a.route.id;if(e.hasOwnProperty(s)?e[s]!==void 0&&(i[s]=e[s]):t[s]!==void 0&&a.route.loader&&(i[s]=t[s]),n&&n.hasOwnProperty(s))break}return i}function pI(t){return t?Bi(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function bu(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function mI(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Ti(t,e){let{pathname:r,routeId:n,method:i,type:a,message:s}=e===void 0?{}:e,o="Unknown Server Error",u="Unknown @remix-run/router error";return t===400?(o="Bad Request",i&&r&&n?u="You made a "+i+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":a==="defer-action"?u="defer() is not supported in actions":a==="invalid-body"&&(u="Unable to encode submission body")):t===403?(o="Forbidden",u='Route "'+n+'" does not match URL "'+r+'"'):t===404?(o="Not Found",u='No route matches URL "'+r+'"'):t===405&&(o="Method Not Allowed",i&&r&&n?u="You made a "+i.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":i&&(u='Invalid request method "'+i.toUpperCase()+'"')),new I_(t||500,o,new Error(u),!0)}function Sm(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,i]=e[r];if(Au(i))return{key:n,result:i}}}function kU(t){let e=typeof t=="string"?so(t):t;return hd(ln({},e,{hash:""}))}function UNe(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function zNe(t){return RU(t.result)&&ANe.has(t.result.status)}function No(t){return t.type===Kr.deferred}function Bi(t){return t.type===Kr.error}function Au(t){return(t&&t.type)===Kr.redirect}function gI(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function qNe(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function RU(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function VNe(t){return DNe.has(t.toLowerCase())}function _a(t){return SNe.has(t.toLowerCase())}async function ZNe(t,e,r,n,i){let a=Object.entries(e);for(let s=0;s<a.length;s++){let[o,u]=a[s],c=t.find(f=>(f==null?void 0:f.route.id)===o);if(!c)continue;let l=n.find(f=>f.route.id===c.route.id),d=l!=null&&!OU(l,c)&&(i&&i[c.route.id])!==void 0;No(u)&&d&&await FE(u,r,!1).then(f=>{f&&(e[o]=f)})}}async function HNe(t,e,r){for(let n=0;n<r.length;n++){let{key:i,routeId:a,controller:s}=r[n],o=e[i];t.find(c=>(c==null?void 0:c.route.id)===a)&&No(o)&&(mr(s,"Expected an AbortController for revalidating fetcher deferred result"),await FE(o,s.signal,!0).then(c=>{c&&(e[i]=c)}))}}async function FE(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:Kr.data,data:t.deferredData.unwrappedData}}catch(i){return{type:Kr.error,error:i}}return{type:Kr.data,data:t.deferredData.data}}}function PE(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Qd(t,e){let r=typeof e=="string"?so(e).search:e.search;if(t[t.length-1].route.index&&PE(r||""))return t[t.length-1];let n=DU(t);return n[n.length-1]}function yI(t){let{formMethod:e,formAction:r,formEncType:n,text:i,formData:a,json:s}=t;if(!(!e||!r||!n)){if(i!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:e,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0};if(s!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:s,text:void 0}}}function Cb(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function WNe(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Od(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function YNe(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function ho(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function JNe(t,e){try{let r=t.sessionStorage.getItem(CU);if(r){let n=JSON.parse(r);for(let[i,a]of Object.entries(n||{}))a&&Array.isArray(a)&&e.set(i,new Set(a||[]))}}catch{}}function KNe(t,e){if(e.size>0){let r={};for(let[n,i]of e)r[n]=[...i];try{t.sessionStorage.setItem(CU,JSON.stringify(r))}catch(n){tc(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
1199
1199
  * React Router v6.28.1
1200
1200
  *
@@ -1204,5 +1204,5 @@ enum ReactionType {
1204
1204
  * LICENSE.md file in the root directory of this source tree.
1205
1205
  *
1206
1206
  * @license MIT
1207
- */function Rh(){return Rh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Rh.apply(this,arguments)}const BE=mt.createContext(null),GNe=mt.createContext(null),qy=mt.createContext(null),Vy=mt.createContext(null),ou=mt.createContext({outlet:null,matches:[],isDataRoute:!1}),FU=mt.createContext(null);function Zy(){return mt.useContext(Vy)!=null}function LE(){return Zy()||mr(!1),mt.useContext(Vy).location}function XNe(){return mt.useContext(Vy).navigationType}function PU(t){mt.useContext(qy).static||mt.useLayoutEffect(t)}function Z9e(){let{isDataRoute:t}=mt.useContext(ou);return t?dIe():QNe()}function QNe(){Zy()||mr(!1);let t=mt.useContext(BE),{basename:e,future:r,navigator:n}=mt.useContext(qy),{matches:i}=mt.useContext(ou),{pathname:a}=LE(),s=JSON.stringify(AU(i,r.v7_relativeSplatPath)),o=mt.useRef(!1);return PU(()=>{o.current=!0}),mt.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=NU(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Mo([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const eIe=mt.createContext(null);function tIe(t){let e=mt.useContext(ou).outlet;return e&&mt.createElement(eIe.Provider,{value:t},e)}function H9e(){let{matches:t}=mt.useContext(ou),e=t[t.length-1];return e?e.params:{}}function W9e(t,e,r,n){Zy()||mr(!1);let{navigator:i}=mt.useContext(qy),{matches:a}=mt.useContext(ou),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=LE(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let h=Eo(t,{pathname:f});return sIe(h&&h.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:Mo([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Mo([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function rIe(){let t=lIe(),e=zy(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return mt.createElement(mt.Fragment,null,mt.createElement("h2",null,"Unexpected Application Error!"),mt.createElement("h3",{style:{fontStyle:"italic"}},e),r?mt.createElement("pre",{style:i},r):null,null)}const nIe=mt.createElement(rIe,null);class iIe extends mt.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?mt.createElement(ou.Provider,{value:this.props.routeContext},mt.createElement(FU.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function aIe(t){let{routeContext:e,match:r,children:n}=t,i=mt.useContext(BE);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),mt.createElement(ou.Provider,{value:e},n)}function sIe(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||mr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:h}=r,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let h,p=!1,m=null,y=null;r&&(h=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||nIe,u&&(c<0&&f===0?(p=!0,y=null):c===f&&(p=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),v=()=>{let w;return h?w=m:p?w=y:d.route.Component?w=mt.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=l,mt.createElement(aIe,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:w})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?mt.createElement(iIe,{location:r.location,revalidation:r.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var BU=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(BU||{}),T0=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(T0||{});function oIe(t){let e=mt.useContext(BE);return e||mr(!1),e}function uIe(t){let e=mt.useContext(GNe);return e||mr(!1),e}function cIe(t){let e=mt.useContext(ou);return e||mr(!1),e}function LU(t){let e=cIe(),r=e.matches[e.matches.length-1];return r.route.id||mr(!1),r.route.id}function lIe(){var t;let e=mt.useContext(FU),r=uIe(T0.UseRouteError),n=LU(T0.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function dIe(){let{router:t}=oIe(BU.UseNavigateStable),e=LU(T0.UseNavigateStable),r=mt.useRef(!1);return PU(()=>{r.current=!0}),mt.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Rh({fromRouteId:e},a)))},[t,e])}const vI={};function fIe(t,e){vI[e]||(vI[e]=!0,console.warn(e))}const kc=(t,e,r)=>fIe(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function Y9e(t,e){(t==null?void 0:t.v7_startTransition)===void 0&&kc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),(t==null?void 0:t.v7_relativeSplatPath)===void 0&&(!e||!e.v7_relativeSplatPath)&&kc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist===void 0&&kc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod===void 0&&kc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration===void 0&&kc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation===void 0&&kc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function J9e(t){return tIe(t.context)}function hIe(t){mr(!1)}function K9e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=cn.Pop,navigator:a,static:s=!1,future:o}=t;Zy()&&mr(!1);let u=e.replace(/^\/*/,"/"),c=mt.useMemo(()=>({basename:u,navigator:a,static:s,future:Rh({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=so(n));let{pathname:l="/",search:d="",hash:f="",state:h=null,key:p="default"}=n,m=mt.useMemo(()=>{let y=vp(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:h,key:p},navigationType:i}},[u,l,d,f,h,p,i]);return m==null?null:mt.createElement(qy.Provider,{value:c},mt.createElement(Vy.Provider,{children:r,value:m}))}new Promise(()=>{});function k_(t,e){e===void 0&&(e=[]);let r=[];return mt.Children.forEach(t,(n,i)=>{if(!mt.isValidElement(n))return;let a=[...e,i];if(n.type===mt.Fragment){r.push.apply(r,k_(n.props.children,a));return}n.type!==hIe&&mr(!1),!n.props.index||!n.props.children||mr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=k_(n.props.children,a)),r.push(s)}),r}function pIe(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:mt.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:mt.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:mt.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function G9e(t,e){return ONe({basename:e==null?void 0:e.basename,future:Rh({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:tNe({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:pIe,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function mIe(){const[t]=B_(),{analytics:e}=t;vi(()=>{const r=Er();if(!e){r&&r.close();return}if(r||!Rs.sentry.dsn||Rs.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[Ek(),wk({depth:5}),Mae(),vk({levels:["error"]})];Rs.sentry.tracing&&i.push(sse({useEffect:Us.useEffect,useLocation:LE,useNavigationType:XNe,createRoutesFromChildren:k_,matchRoutes:Eo})),Gae({release:n,dsn:Rs.sentry.dsn,environment:Rs.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const gIe=({children:t})=>(mIe(),t);function bI(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const yIe=()=>{const[{gaTrackingId:t}]=kE(),[{analytics:e}]=B_(),r=t&&e;return vi(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],bI("js",new Date),bI("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},vIe=Us.lazy(async()=>({default:await(await _f(()=>import("./router-D7_xmk-f.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),bIe=()=>{for(const t of Object.values($De))Lh(t);return null},wIe=()=>et(Us.StrictMode,{children:et(hz,{fallback:et(wI,{}),children:Yr(jz,{store:Mh,children:[et(bIe,{}),et(sz,{children:et(gIe,{children:et(eNe,{children:Yr(oz,{children:[et(uz,{position:"bottom-right"}),Yr(WAe,{children:[et(vIe,{}),et(JAe,{}),et(yIe,{})]})]})})})})]})})}),X9e=Object.freeze(Object.defineProperty({__proto__:null,default:wIe},Symbol.toStringTag,{value:"Module"}));export{GDe as $,IIe as A,$n as B,Lh as C,BE as D,I_ as E,RI as F,$Ae as G,Uy as H,oAe as I,CE as J,KDe as K,U9e as L,wU as M,LDe as N,J9e as O,gAe as P,Ko as Q,K9e as R,mAe as S,iq as T,Tu as U,Kw as V,AI as W,H9e as X,ODe as Y,z9e as Z,yAe as _,Z9e as a,DAe as a0,ij as a1,v8e as a2,kn as a3,qr as a4,a5e as a5,ai as a6,fme as a7,Ch as a8,X as a9,MDe as aa,Iy as ab,oue as ac,Iue as ad,q8e as ae,Yj as af,$y as ag,Oh as ah,D8e as ai,Jj as aj,Xj as ak,ql as al,Kj as am,Gj as an,X9e as ao,GNe as b,W9e as c,ONe as d,V9e as e,G9e as f,NIe as g,Bh as h,_Ae as i,Cn as j,nc as k,Y9e as l,pIe as m,ME as n,wAe as o,q9e as p,vU as q,kE as r,La as s,xU as t,LE as u,OE as v,jDe as w,Xe as x,Foe as y,iR as z};
1208
- //# sourceMappingURL=app-D49Tx2Bq.js.map
1207
+ */function Rh(){return Rh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Rh.apply(this,arguments)}const BE=mt.createContext(null),GNe=mt.createContext(null),qy=mt.createContext(null),Vy=mt.createContext(null),ou=mt.createContext({outlet:null,matches:[],isDataRoute:!1}),FU=mt.createContext(null);function Zy(){return mt.useContext(Vy)!=null}function LE(){return Zy()||mr(!1),mt.useContext(Vy).location}function XNe(){return mt.useContext(Vy).navigationType}function PU(t){mt.useContext(qy).static||mt.useLayoutEffect(t)}function V9e(){let{isDataRoute:t}=mt.useContext(ou);return t?dIe():QNe()}function QNe(){Zy()||mr(!1);let t=mt.useContext(BE),{basename:e,future:r,navigator:n}=mt.useContext(qy),{matches:i}=mt.useContext(ou),{pathname:a}=LE(),s=JSON.stringify(AU(i,r.v7_relativeSplatPath)),o=mt.useRef(!1);return PU(()=>{o.current=!0}),mt.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=NU(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Mo([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const eIe=mt.createContext(null);function tIe(t){let e=mt.useContext(ou).outlet;return e&&mt.createElement(eIe.Provider,{value:t},e)}function Z9e(){let{matches:t}=mt.useContext(ou),e=t[t.length-1];return e?e.params:{}}function H9e(t,e,r,n){Zy()||mr(!1);let{navigator:i}=mt.useContext(qy),{matches:a}=mt.useContext(ou),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=LE(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let h=Eo(t,{pathname:f});return sIe(h&&h.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:Mo([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Mo([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function rIe(){let t=lIe(),e=zy(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return mt.createElement(mt.Fragment,null,mt.createElement("h2",null,"Unexpected Application Error!"),mt.createElement("h3",{style:{fontStyle:"italic"}},e),r?mt.createElement("pre",{style:i},r):null,null)}const nIe=mt.createElement(rIe,null);class iIe extends mt.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?mt.createElement(ou.Provider,{value:this.props.routeContext},mt.createElement(FU.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function aIe(t){let{routeContext:e,match:r,children:n}=t,i=mt.useContext(BE);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),mt.createElement(ou.Provider,{value:e},n)}function sIe(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||mr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:h}=r,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let h,p=!1,m=null,y=null;r&&(h=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||nIe,u&&(c<0&&f===0?(p=!0,y=null):c===f&&(p=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),v=()=>{let w;return h?w=m:p?w=y:d.route.Component?w=mt.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=l,mt.createElement(aIe,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:w})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?mt.createElement(iIe,{location:r.location,revalidation:r.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var BU=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(BU||{}),T0=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(T0||{});function oIe(t){let e=mt.useContext(BE);return e||mr(!1),e}function uIe(t){let e=mt.useContext(GNe);return e||mr(!1),e}function cIe(t){let e=mt.useContext(ou);return e||mr(!1),e}function LU(t){let e=cIe(),r=e.matches[e.matches.length-1];return r.route.id||mr(!1),r.route.id}function lIe(){var t;let e=mt.useContext(FU),r=uIe(T0.UseRouteError),n=LU(T0.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function dIe(){let{router:t}=oIe(BU.UseNavigateStable),e=LU(T0.UseNavigateStable),r=mt.useRef(!1);return PU(()=>{r.current=!0}),mt.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Rh({fromRouteId:e},a)))},[t,e])}const vI={};function fIe(t,e){vI[e]||(vI[e]=!0,console.warn(e))}const kc=(t,e,r)=>fIe(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function W9e(t,e){(t==null?void 0:t.v7_startTransition)===void 0&&kc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),(t==null?void 0:t.v7_relativeSplatPath)===void 0&&(!e||!e.v7_relativeSplatPath)&&kc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist===void 0&&kc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod===void 0&&kc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration===void 0&&kc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation===void 0&&kc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function Y9e(t){return tIe(t.context)}function hIe(t){mr(!1)}function J9e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=cn.Pop,navigator:a,static:s=!1,future:o}=t;Zy()&&mr(!1);let u=e.replace(/^\/*/,"/"),c=mt.useMemo(()=>({basename:u,navigator:a,static:s,future:Rh({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=so(n));let{pathname:l="/",search:d="",hash:f="",state:h=null,key:p="default"}=n,m=mt.useMemo(()=>{let y=vp(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:h,key:p},navigationType:i}},[u,l,d,f,h,p,i]);return m==null?null:mt.createElement(qy.Provider,{value:c},mt.createElement(Vy.Provider,{children:r,value:m}))}new Promise(()=>{});function k_(t,e){e===void 0&&(e=[]);let r=[];return mt.Children.forEach(t,(n,i)=>{if(!mt.isValidElement(n))return;let a=[...e,i];if(n.type===mt.Fragment){r.push.apply(r,k_(n.props.children,a));return}n.type!==hIe&&mr(!1),!n.props.index||!n.props.children||mr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=k_(n.props.children,a)),r.push(s)}),r}function pIe(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:mt.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:mt.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:mt.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function K9e(t,e){return ONe({basename:e==null?void 0:e.basename,future:Rh({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:tNe({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:pIe,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function mIe(){const[t]=B_(),{analytics:e}=t;vi(()=>{const r=Er();if(!e){r&&r.close();return}if(r||!Rs.sentry.dsn||Rs.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[Ek(),wk({depth:5}),Mae(),vk({levels:["error"]})];Rs.sentry.tracing&&i.push(sse({useEffect:Us.useEffect,useLocation:LE,useNavigationType:XNe,createRoutesFromChildren:k_,matchRoutes:Eo})),Gae({release:n,dsn:Rs.sentry.dsn,environment:Rs.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const gIe=({children:t})=>(mIe(),t);function bI(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const yIe=()=>{const[{gaTrackingId:t}]=kE(),[{analytics:e}]=B_(),r=t&&e;return vi(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],bI("js",new Date),bI("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},vIe=Us.lazy(async()=>({default:await(await _f(()=>import("./router-CUrO08Jn.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),bIe=()=>{for(const t of Object.values($De))Lh(t);return null},wIe=()=>et(Us.StrictMode,{children:et(hz,{fallback:et(wI,{}),children:Yr(jz,{store:Mh,children:[et(bIe,{}),et(sz,{children:et(gIe,{children:et(eNe,{children:Yr(oz,{children:[et(uz,{position:"bottom-right"}),Yr(WAe,{children:[et(vIe,{}),et(JAe,{}),et(yIe,{})]})]})})})})]})})}),G9e=Object.freeze(Object.defineProperty({__proto__:null,default:wIe},Symbol.toStringTag,{value:"Module"}));export{DAe as $,Kn as A,RI as B,$Ae as C,BE as D,I_ as E,Lh as F,Uy as G,oAe as H,CE as I,KDe as J,$9e as K,wU as L,LDe as M,gAe as N,Y9e as O,Ko as P,mAe as Q,J9e as R,iq as S,AI as T,Tu as U,Kw as V,Z9e as W,ODe as X,U9e as Y,yAe as Z,GDe as _,V9e as a,ij as a0,v8e as a1,kn as a2,qr as a3,a5e as a4,ai as a5,fme as a6,Ch as a7,X as a8,MDe as a9,Iy as aa,oue as ab,Iue as ac,q8e as ad,Yj as ae,$y as af,Oh as ag,D8e as ah,Jj as ai,Xj as aj,ql as ak,Kj as al,Gj as am,G9e as an,GNe as b,H9e as c,ONe as d,q9e as e,K9e as f,NIe as g,Bh as h,_Ae as i,Cn as j,nc as k,W9e as l,pIe as m,ME as n,wAe as o,z9e as p,vU as q,kE as r,La as s,xU as t,LE as u,OE as v,jDe as w,Xe as x,Foe as y,iR as z};
1208
+ //# sourceMappingURL=app-CCIiKpPD.js.map