diff --git a/assets/index-223bc227.js b/assets/index-556e514e.js similarity index 77% rename from assets/index-223bc227.js rename to assets/index-556e514e.js index 5c801d6..09c50e6 100644 --- a/assets/index-223bc227.js +++ b/assets/index-556e514e.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function TO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function BO(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){if(this instanceof n){var o=[null];o.push.apply(o,arguments);var i=Function.bind.apply(t,o);return new i}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Wf={},PO={get exports(){return Wf},set exports(e){Wf=e}},r1={},dt={},RO={get exports(){return dt},set exports(e){dt=e}},Jt={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();var Ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function IO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wf={},TO={get exports(){return Wf},set exports(e){Wf=e}},r1={},dt={},BO={get exports(){return dt},set exports(e){dt=e}},Jt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ld=Symbol.for("react.element"),OO=Symbol.for("react.portal"),NO=Symbol.for("react.fragment"),LO=Symbol.for("react.strict_mode"),DO=Symbol.for("react.profiler"),UO=Symbol.for("react.provider"),jO=Symbol.for("react.context"),FO=Symbol.for("react.forward_ref"),zO=Symbol.for("react.suspense"),$O=Symbol.for("react.memo"),qO=Symbol.for("react.lazy"),I6=Symbol.iterator;function WO(e){return e===null||typeof e!="object"?null:(e=I6&&e[I6]||e["@@iterator"],typeof e=="function"?e:null)}var cE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},fE=Object.assign,dE={};function Xu(e,t,r){this.props=e,this.context=t,this.refs=dE,this.updater=r||cE}Xu.prototype.isReactComponent={};Xu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function hE(){}hE.prototype=Xu.prototype;function u3(e,t,r){this.props=e,this.context=t,this.refs=dE,this.updater=r||cE}var c3=u3.prototype=new hE;c3.constructor=u3;fE(c3,Xu.prototype);c3.isPureReactComponent=!0;var T6=Array.isArray,pE=Object.prototype.hasOwnProperty,f3={current:null},gE={key:!0,ref:!0,__self:!0,__source:!0};function mE(e,t,r){var n,o={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)pE.call(t,n)&&!gE.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1{this.listeners=this.listeners.filter(r=>r!==t),this.onUnsubscribe()}}hasListeners(){return this.listeners.length>0}onSubscribe(){}onUnsubscribe(){}}const h3=typeof window>"u"||"Deno"in window;function Li(){}function tN(e,t){return typeof e=="function"?e(t):e}function rN(e){return typeof e=="number"&&e>=0&&e!==1/0}function nN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wh(e,t,r){return i1(e)?typeof t=="function"?{...r,queryKey:e,queryFn:t}:{...t,queryKey:e}:e}function ba(e,t,r){return i1(e)?[{...t,queryKey:e},r]:[e||{},t]}function P6(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(i1(a)){if(n){if(t.queryHash!==p3(a,t.options))return!1}else if(!M0(t.queryKey,a))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function R6(e,t){const{exact:r,fetching:n,predicate:o,mutationKey:i}=e;if(i1(i)){if(!t.options.mutationKey)return!1;if(r){if(Os(t.options.mutationKey)!==Os(i))return!1}else if(!M0(t.options.mutationKey,i))return!1}return!(typeof n=="boolean"&&t.state.status==="loading"!==n||o&&!o(t))}function p3(e,t){return((t==null?void 0:t.queryKeyHashFn)||Os)(e)}function Os(e){return JSON.stringify(e,(t,r)=>Y2(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function M0(e,t){return yE(e,t)}function yE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!yE(e[r],t[r])):!1}function bE(e,t){if(e===t)return e;const r=O6(e)&&O6(t);if(r||Y2(e)&&Y2(t)){const n=r?e.length:Object.keys(e).length,o=r?t:Object.keys(t),i=o.length,a=r?[]:{};let s=0;for(let l=0;l"u")return!0;const r=t.prototype;return!(!N6(r)||!r.hasOwnProperty("isPrototypeOf"))}function N6(e){return Object.prototype.toString.call(e)==="[object Object]"}function i1(e){return Array.isArray(e)}function wE(e){return new Promise(t=>{setTimeout(t,e)})}function L6(e){wE(0).then(e)}function iN(){if(typeof AbortController=="function")return new AbortController}function oN(e,t,r){return r.isDataEqual!=null&&r.isDataEqual(e,t)?e:typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?bE(e,t):t}class aN extends n1{constructor(){super(),this.setup=t=>{if(!h3&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),window.addEventListener("focus",r,!1),()=>{window.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.cleanup)==null||t.call(this),this.cleanup=void 0}}setEventListener(t){var r;this.setup=t,(r=this.cleanup)==null||r.call(this),this.cleanup=t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(t){this.focused=t,t&&this.onFocus()}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const Q2=new aN;class sN extends n1{constructor(){super(),this.setup=t=>{if(!h3&&window.addEventListener){const r=()=>t();return window.addEventListener("online",r,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",r)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.cleanup)==null||t.call(this),this.cleanup=void 0}}setEventListener(t){var r;this.setup=t,(r=this.cleanup)==null||r.call(this),this.cleanup=t(n=>{typeof n=="boolean"?this.setOnline(n):this.onOnline()})}setOnline(t){this.online=t,t&&this.onOnline()}onOnline(){this.listeners.forEach(t=>{t()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const I0=new sN;function lN(e){return Math.min(1e3*2**e,3e4)}function g3(e){return(e??"online")==="online"?I0.isOnline():!0}class _E{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}}function cm(e){return e instanceof _E}function xE(e){let t=!1,r=0,n=!1,o,i,a;const s=new Promise((S,x)=>{i=S,a=x}),l=S=>{n||(p(new _E(S)),e.abort==null||e.abort())},u=()=>{t=!0},c=()=>{t=!1},h=()=>!Q2.isFocused()||e.networkMode!=="always"&&!I0.isOnline(),d=S=>{n||(n=!0,e.onSuccess==null||e.onSuccess(S),o==null||o(),i(S))},p=S=>{n||(n=!0,e.onError==null||e.onError(S),o==null||o(),a(S))},v=()=>new Promise(S=>{o=x=>{if(n||!h())return S(x)},e.onPause==null||e.onPause()}).then(()=>{o=void 0,n||e.onContinue==null||e.onContinue()}),b=()=>{if(n)return;let S;try{S=e.fn()}catch(x){S=Promise.reject(x)}Promise.resolve(S).then(d).catch(x=>{var k,M;if(n)return;const P=(k=e.retry)!=null?k:3,L=(M=e.retryDelay)!=null?M:lN,j=typeof L=="function"?L(r,x):L,V=P===!0||typeof P=="number"&&r{if(h())return v()}).then(()=>{t?p(x):b()})})};return g3(e.networkMode)?b():v().then(b),{promise:s,cancel:l,continue:()=>{o==null||o()},cancelRetry:u,continueRetry:c}}const m3=console;function uN(){let e=[],t=0,r=c=>{c()},n=c=>{c()};const o=c=>{let h;t++;try{h=c()}finally{t--,t||s()}return h},i=c=>{t?e.push(c):L6(()=>{r(c)})},a=c=>(...h)=>{i(()=>{c(...h)})},s=()=>{const c=e;e=[],c.length&&L6(()=>{n(()=>{c.forEach(h=>{r(h)})})})};return{batch:o,batchCalls:a,schedule:i,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c}}}const Ln=uN();class SE{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),rN(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(t){this.cacheTime=Math.max(this.cacheTime||0,t??(h3?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class cN extends SE{constructor(t){super(),this.abortSignalConsumed=!1,this.defaultOptions=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.cache=t.cache,this.logger=t.logger||m3,this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.initialState=t.state||fN(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(t){this.options={...this.defaultOptions,...t},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(t,r){const n=oN(this.state.data,t,this.options);return this.dispatch({data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){this.dispatch({type:"setState",state:t,setStateOptions:r})}cancel(t){var r;const n=this.promise;return(r=this.retryer)==null||r.cancel(t),n?n.then(Li).catch(Li):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!nN(this.state.dataUpdatedAt,t)}onFocus(){var t;const r=this.observers.find(n=>n.shouldFetchOnWindowFocus());r&&r.refetch({cancelRefetch:!1}),(t=this.retryer)==null||t.continue()}onOnline(){var t;const r=this.observers.find(n=>n.shouldFetchOnReconnect());r&&r.refetch({cancelRefetch:!1}),(t=this.retryer)==null||t.continue()}addObserver(t){this.observers.indexOf(t)===-1&&(this.observers.push(t),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.indexOf(t)!==-1&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(t,r){var n,o;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&r!=null&&r.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var i;return(i=this.retryer)==null||i.continueRetry(),this.promise}}if(t&&this.setOptions(t),!this.options.queryFn){const p=this.observers.find(v=>v.options.queryFn);p&&this.setOptions(p.options)}Array.isArray(this.options.queryKey);const a=iN(),s={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},l=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>{if(a)return this.abortSignalConsumed=!0,a.signal}})};l(s);const u=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(s)):Promise.reject("Missing queryFn"),c={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:u};if(l(c),(n=this.options.behavior)==null||n.onFetch(c),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((o=c.fetchOptions)==null?void 0:o.meta)){var h;this.dispatch({type:"fetch",meta:(h=c.fetchOptions)==null?void 0:h.meta})}const d=p=>{if(cm(p)&&p.silent||this.dispatch({type:"error",error:p}),!cm(p)){var v,b;(v=(b=this.cache.config).onError)==null||v.call(b,p,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=xE({fn:c.fetchFn,abort:a==null?void 0:a.abort.bind(a),onSuccess:p=>{var v,b;if(typeof p>"u"){d(new Error("undefined"));return}this.setData(p),(v=(b=this.cache.config).onSuccess)==null||v.call(b,p,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:d,onFail:(p,v)=>{this.dispatch({type:"failed",failureCount:p,error:v})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(t){const r=n=>{var o,i;switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(o=t.meta)!=null?o:null,fetchStatus:g3(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(i=t.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return cm(a)&&a.revert&&this.revertState?{...this.revertState}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Ln.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate(t)}),this.cache.notify({query:this,type:"updated",action:t})})}}function fN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=typeof t<"u",n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"loading",fetchStatus:"idle"}}class dN extends n1{constructor(t){super(),this.config=t||{},this.queries=[],this.queriesMap={}}build(t,r,n){var o;const i=r.queryKey,a=(o=r.queryHash)!=null?o:p3(i,r);let s=this.get(a);return s||(s=new cN({cache:this,logger:t.getLogger(),queryKey:i,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){this.queriesMap[t.queryHash]||(this.queriesMap[t.queryHash]=t,this.queries.push(t),this.notify({type:"added",query:t}))}remove(t){const r=this.queriesMap[t.queryHash];r&&(t.destroy(),this.queries=this.queries.filter(n=>n!==t),r===t&&delete this.queriesMap[t.queryHash],this.notify({type:"removed",query:t}))}clear(){Ln.batch(()=>{this.queries.forEach(t=>{this.remove(t)})})}get(t){return this.queriesMap[t]}getAll(){return this.queries}find(t,r){const[n]=ba(t,r);return typeof n.exact>"u"&&(n.exact=!0),this.queries.find(o=>P6(n,o))}findAll(t,r){const[n]=ba(t,r);return Object.keys(n).length>0?this.queries.filter(o=>P6(n,o)):this.queries}notify(t){Ln.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Ln.batch(()=>{this.queries.forEach(t=>{t.onFocus()})})}onOnline(){Ln.batch(()=>{this.queries.forEach(t=>{t.onOnline()})})}}class hN extends SE{constructor(t){super(),this.options={...t.defaultOptions,...t.options},this.mutationId=t.mutationId,this.mutationCache=t.mutationCache,this.logger=t.logger||m3,this.observers=[],this.state=t.state||pN(),this.updateCacheTime(this.options.cacheTime),this.scheduleGc()}get meta(){return this.options.meta}setState(t){this.dispatch({type:"setState",state:t})}addObserver(t){this.observers.indexOf(t)===-1&&(this.observers.push(t),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.observers=this.observers.filter(r=>r!==t),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){return this.retryer?(this.retryer.continue(),this.retryer.promise):this.execute()}async execute(){const t=()=>{var M;return this.retryer=xE({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(P,L)=>{this.dispatch({type:"failed",failureCount:P,error:L})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(M=this.options.retry)!=null?M:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},r=this.state.status==="loading";try{var n,o,i,a,s,l;if(!r){var u,c,h,d;this.dispatch({type:"loading",variables:this.options.variables}),await((u=(c=this.mutationCache.config).onMutate)==null?void 0:u.call(c,this.state.variables,this));const P=await((h=(d=this.options).onMutate)==null?void 0:h.call(d,this.state.variables));P!==this.state.context&&this.dispatch({type:"loading",context:P,variables:this.state.variables})}const M=await t();return await((n=(o=this.mutationCache.config).onSuccess)==null?void 0:n.call(o,M,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,M,this.state.variables,this.state.context)),await((s=(l=this.options).onSettled)==null?void 0:s.call(l,M,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:M}),M}catch(M){try{var p,v,b,S,x,k;throw await((p=(v=this.mutationCache.config).onError)==null?void 0:p.call(v,M,this.state.variables,this.state.context,this)),await((b=(S=this.options).onError)==null?void 0:b.call(S,M,this.state.variables,this.state.context)),await((x=(k=this.options).onSettled)==null?void 0:x.call(k,void 0,M,this.state.variables,this.state.context)),M}finally{this.dispatch({type:"error",error:M})}}}dispatch(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"loading":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!g3(this.options.networkMode),status:"loading",variables:t.variables};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"};case"setState":return{...n,...t.state}}};this.state=r(this.state),Ln.batch(()=>{this.observers.forEach(n=>{n.onMutationUpdate(t)}),this.mutationCache.notify({mutation:this,type:"updated",action:t})})}}function pN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class gN extends n1{constructor(t){super(),this.config=t||{},this.mutations=[],this.mutationId=0}build(t,r,n){const o=new hN({mutationCache:this,logger:t.getLogger(),mutationId:++this.mutationId,options:t.defaultMutationOptions(r),state:n,defaultOptions:r.mutationKey?t.getMutationDefaults(r.mutationKey):void 0});return this.add(o),o}add(t){this.mutations.push(t),this.notify({type:"added",mutation:t})}remove(t){this.mutations=this.mutations.filter(r=>r!==t),this.notify({type:"removed",mutation:t})}clear(){Ln.batch(()=>{this.mutations.forEach(t=>{this.remove(t)})})}getAll(){return this.mutations}find(t){return typeof t.exact>"u"&&(t.exact=!0),this.mutations.find(r=>R6(t,r))}findAll(t){return this.mutations.filter(r=>R6(t,r))}notify(t){Ln.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.mutations.filter(r=>r.state.isPaused);return Ln.batch(()=>t.reduce((r,n)=>r.then(()=>n.continue().catch(Li)),Promise.resolve()))}}function mN(){return{onFetch:e=>{e.fetchFn=()=>{var t,r,n,o,i,a;const s=(t=e.fetchOptions)==null||(r=t.meta)==null?void 0:r.refetchPage,l=(n=e.fetchOptions)==null||(o=n.meta)==null?void 0:o.fetchMore,u=l==null?void 0:l.pageParam,c=(l==null?void 0:l.direction)==="forward",h=(l==null?void 0:l.direction)==="backward",d=((i=e.state.data)==null?void 0:i.pages)||[],p=((a=e.state.data)==null?void 0:a.pageParams)||[];let v=p,b=!1;const S=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>{var V;if((V=e.signal)!=null&&V.aborted)b=!0;else{var K;(K=e.signal)==null||K.addEventListener("abort",()=>{b=!0})}return e.signal}})},x=e.options.queryFn||(()=>Promise.reject("Missing queryFn")),k=(j,V,K,Z)=>(v=Z?[V,...v]:[...v,V],Z?[K,...j]:[...j,K]),M=(j,V,K,Z)=>{if(b)return Promise.reject("Cancelled");if(typeof K>"u"&&!V&&j.length)return Promise.resolve(j);const ue={queryKey:e.queryKey,pageParam:K,meta:e.options.meta};S(ue);const U=x(ue);return Promise.resolve(U).then(y=>k(j,K,y,Z))};let P;if(!d.length)P=M([]);else if(c){const j=typeof u<"u",V=j?u:D6(e.options,d);P=M(d,j,V)}else if(h){const j=typeof u<"u",V=j?u:vN(e.options,d);P=M(d,j,V,!0)}else{v=[];const j=typeof e.options.getNextPageParam>"u";P=(s&&d[0]?s(d[0],0,d):!0)?M([],j,p[0]):Promise.resolve(k([],p[0],d[0]));for(let K=1;K{if(s&&d[K]?s(d[K],K,d):!0){const U=j?p[K]:D6(e.options,Z);return M(Z,j,U)}return Promise.resolve(k(Z,p[K],d[K]))})}return P.then(j=>({pages:j,pageParams:v}))}}}}function D6(e,t){return e.getNextPageParam==null?void 0:e.getNextPageParam(t[t.length-1],t)}function vN(e,t){return e.getPreviousPageParam==null?void 0:e.getPreviousPageParam(t[0],t)}class yN{constructor(t={}){this.queryCache=t.queryCache||new dN,this.mutationCache=t.mutationCache||new gN,this.logger=t.logger||m3,this.defaultOptions=t.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=Q2.subscribe(()=>{Q2.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=I0.subscribe(()=>{I0.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var t,r;this.mountCount--,this.mountCount===0&&((t=this.unsubscribeFocus)==null||t.call(this),this.unsubscribeFocus=void 0,(r=this.unsubscribeOnline)==null||r.call(this),this.unsubscribeOnline=void 0)}isFetching(t,r){const[n]=ba(t,r);return n.fetchStatus="fetching",this.queryCache.findAll(n).length}isMutating(t){return this.mutationCache.findAll({...t,fetching:!0}).length}getQueryData(t,r){var n;return(n=this.queryCache.find(t,r))==null?void 0:n.state.data}ensureQueryData(t,r,n){const o=wh(t,r,n),i=this.getQueryData(o.queryKey);return i?Promise.resolve(i):this.fetchQuery(o)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:r,state:n})=>{const o=n.data;return[r,o]})}setQueryData(t,r,n){const o=this.queryCache.find(t),i=o==null?void 0:o.state.data,a=tN(r,i);if(typeof a>"u")return;const s=wh(t),l=this.defaultQueryOptions(s);return this.queryCache.build(this,l).setData(a,{...n,manual:!0})}setQueriesData(t,r,n){return Ln.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:o})=>[o,this.setQueryData(o,r,n)]))}getQueryState(t,r){var n;return(n=this.queryCache.find(t,r))==null?void 0:n.state}removeQueries(t,r){const[n]=ba(t,r),o=this.queryCache;Ln.batch(()=>{o.findAll(n).forEach(i=>{o.remove(i)})})}resetQueries(t,r,n){const[o,i]=ba(t,r,n),a=this.queryCache,s={type:"active",...o};return Ln.batch(()=>(a.findAll(o).forEach(l=>{l.reset()}),this.refetchQueries(s,i)))}cancelQueries(t,r,n){const[o,i={}]=ba(t,r,n);typeof i.revert>"u"&&(i.revert=!0);const a=Ln.batch(()=>this.queryCache.findAll(o).map(s=>s.cancel(i)));return Promise.all(a).then(Li).catch(Li)}invalidateQueries(t,r,n){const[o,i]=ba(t,r,n);return Ln.batch(()=>{var a,s;if(this.queryCache.findAll(o).forEach(u=>{u.invalidate()}),o.refetchType==="none")return Promise.resolve();const l={...o,type:(a=(s=o.refetchType)!=null?s:o.type)!=null?a:"active"};return this.refetchQueries(l,i)})}refetchQueries(t,r,n){const[o,i]=ba(t,r,n),a=Ln.batch(()=>this.queryCache.findAll(o).filter(l=>!l.isDisabled()).map(l=>{var u;return l.fetch(void 0,{...i,cancelRefetch:(u=i==null?void 0:i.cancelRefetch)!=null?u:!0,meta:{refetchPage:o.refetchPage}})}));let s=Promise.all(a).then(Li);return i!=null&&i.throwOnError||(s=s.catch(Li)),s}fetchQuery(t,r,n){const o=wh(t,r,n),i=this.defaultQueryOptions(o);typeof i.retry>"u"&&(i.retry=!1);const a=this.queryCache.build(this,i);return a.isStaleByTime(i.staleTime)?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(t,r,n){return this.fetchQuery(t,r,n).then(Li).catch(Li)}fetchInfiniteQuery(t,r,n){const o=wh(t,r,n);return o.behavior=mN(),this.fetchQuery(o)}prefetchInfiniteQuery(t,r,n){return this.fetchInfiniteQuery(t,r,n).then(Li).catch(Li)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(t){this.defaultOptions=t}setQueryDefaults(t,r){const n=this.queryDefaults.find(o=>Os(t)===Os(o.queryKey));n?n.defaultOptions=r:this.queryDefaults.push({queryKey:t,defaultOptions:r})}getQueryDefaults(t){if(!t)return;const r=this.queryDefaults.find(n=>M0(t,n.queryKey));return r==null?void 0:r.defaultOptions}setMutationDefaults(t,r){const n=this.mutationDefaults.find(o=>Os(t)===Os(o.mutationKey));n?n.defaultOptions=r:this.mutationDefaults.push({mutationKey:t,defaultOptions:r})}getMutationDefaults(t){if(!t)return;const r=this.mutationDefaults.find(n=>M0(t,n.mutationKey));return r==null?void 0:r.defaultOptions}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const r={...this.defaultOptions.queries,...this.getQueryDefaults(t==null?void 0:t.queryKey),...t,_defaulted:!0};return!r.queryHash&&r.queryKey&&(r.queryHash=p3(r.queryKey,r)),typeof r.refetchOnReconnect>"u"&&(r.refetchOnReconnect=r.networkMode!=="always"),typeof r.useErrorBoundary>"u"&&(r.useErrorBoundary=!!r.suspense),r}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...this.defaultOptions.mutations,...this.getMutationDefaults(t==null?void 0:t.mutationKey),...t,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}var X2={},bN={get exports(){return X2},set exports(e){X2=e}},gi={},J2={},wN={get exports(){return J2},set exports(e){J2=e}},CE={};/** + */var KO=dt,ZO=Symbol.for("react.element"),GO=Symbol.for("react.fragment"),YO=Object.prototype.hasOwnProperty,QO=KO.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,XO={key:!0,ref:!0,__self:!0,__source:!0};function yE(e,t,r){var n,o={},i=null,a=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(n in t)YO.call(t,n)&&!XO.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:ZO,type:e,key:i,ref:a,props:o,_owner:QO.current}}r1.Fragment=GO;r1.jsx=yE;r1.jsxs=yE;(function(e){e.exports=r1})(TO);const A0=Wf.Fragment,Xe=Wf.jsx,Dr=Wf.jsxs;class n1{constructor(){this.listeners=[],this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.push(t),this.onSubscribe(),()=>{this.listeners=this.listeners.filter(r=>r!==t),this.onUnsubscribe()}}hasListeners(){return this.listeners.length>0}onSubscribe(){}onUnsubscribe(){}}const d3=typeof window>"u"||"Deno"in window;function Li(){}function JO(e,t){return typeof e=="function"?e(t):e}function eN(e){return typeof e=="number"&&e>=0&&e!==1/0}function tN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wh(e,t,r){return i1(e)?typeof t=="function"?{...r,queryKey:e,queryFn:t}:{...t,queryKey:e}:e}function ba(e,t,r){return i1(e)?[{...t,queryKey:e},r]:[e||{},t]}function P6(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(i1(a)){if(n){if(t.queryHash!==h3(a,t.options))return!1}else if(!M0(t.queryKey,a))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function R6(e,t){const{exact:r,fetching:n,predicate:o,mutationKey:i}=e;if(i1(i)){if(!t.options.mutationKey)return!1;if(r){if(Os(t.options.mutationKey)!==Os(i))return!1}else if(!M0(t.options.mutationKey,i))return!1}return!(typeof n=="boolean"&&t.state.status==="loading"!==n||o&&!o(t))}function h3(e,t){return((t==null?void 0:t.queryKeyHashFn)||Os)(e)}function Os(e){return JSON.stringify(e,(t,r)=>Y2(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function M0(e,t){return bE(e,t)}function bE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!bE(e[r],t[r])):!1}function wE(e,t){if(e===t)return e;const r=O6(e)&&O6(t);if(r||Y2(e)&&Y2(t)){const n=r?e.length:Object.keys(e).length,o=r?t:Object.keys(t),i=o.length,a=r?[]:{};let s=0;for(let l=0;l"u")return!0;const r=t.prototype;return!(!N6(r)||!r.hasOwnProperty("isPrototypeOf"))}function N6(e){return Object.prototype.toString.call(e)==="[object Object]"}function i1(e){return Array.isArray(e)}function _E(e){return new Promise(t=>{setTimeout(t,e)})}function L6(e){_E(0).then(e)}function rN(){if(typeof AbortController=="function")return new AbortController}function nN(e,t,r){return r.isDataEqual!=null&&r.isDataEqual(e,t)?e:typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?wE(e,t):t}class iN extends n1{constructor(){super(),this.setup=t=>{if(!d3&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),window.addEventListener("focus",r,!1),()=>{window.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.cleanup)==null||t.call(this),this.cleanup=void 0}}setEventListener(t){var r;this.setup=t,(r=this.cleanup)==null||r.call(this),this.cleanup=t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(t){this.focused=t,t&&this.onFocus()}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const Q2=new iN;class oN extends n1{constructor(){super(),this.setup=t=>{if(!d3&&window.addEventListener){const r=()=>t();return window.addEventListener("online",r,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",r)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.cleanup)==null||t.call(this),this.cleanup=void 0}}setEventListener(t){var r;this.setup=t,(r=this.cleanup)==null||r.call(this),this.cleanup=t(n=>{typeof n=="boolean"?this.setOnline(n):this.onOnline()})}setOnline(t){this.online=t,t&&this.onOnline()}onOnline(){this.listeners.forEach(t=>{t()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const I0=new oN;function aN(e){return Math.min(1e3*2**e,3e4)}function p3(e){return(e??"online")==="online"?I0.isOnline():!0}class xE{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}}function cm(e){return e instanceof xE}function SE(e){let t=!1,r=0,n=!1,o,i,a;const s=new Promise((S,x)=>{i=S,a=x}),l=S=>{n||(p(new xE(S)),e.abort==null||e.abort())},u=()=>{t=!0},c=()=>{t=!1},h=()=>!Q2.isFocused()||e.networkMode!=="always"&&!I0.isOnline(),d=S=>{n||(n=!0,e.onSuccess==null||e.onSuccess(S),o==null||o(),i(S))},p=S=>{n||(n=!0,e.onError==null||e.onError(S),o==null||o(),a(S))},v=()=>new Promise(S=>{o=x=>{if(n||!h())return S(x)},e.onPause==null||e.onPause()}).then(()=>{o=void 0,n||e.onContinue==null||e.onContinue()}),b=()=>{if(n)return;let S;try{S=e.fn()}catch(x){S=Promise.reject(x)}Promise.resolve(S).then(d).catch(x=>{var k,M;if(n)return;const P=(k=e.retry)!=null?k:3,L=(M=e.retryDelay)!=null?M:aN,j=typeof L=="function"?L(r,x):L,V=P===!0||typeof P=="number"&&r{if(h())return v()}).then(()=>{t?p(x):b()})})};return p3(e.networkMode)?b():v().then(b),{promise:s,cancel:l,continue:()=>{o==null||o()},cancelRetry:u,continueRetry:c}}const g3=console;function sN(){let e=[],t=0,r=c=>{c()},n=c=>{c()};const o=c=>{let h;t++;try{h=c()}finally{t--,t||s()}return h},i=c=>{t?e.push(c):L6(()=>{r(c)})},a=c=>(...h)=>{i(()=>{c(...h)})},s=()=>{const c=e;e=[],c.length&&L6(()=>{n(()=>{c.forEach(h=>{r(h)})})})};return{batch:o,batchCalls:a,schedule:i,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c}}}const Ln=sN();class CE{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),eN(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(t){this.cacheTime=Math.max(this.cacheTime||0,t??(d3?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class lN extends CE{constructor(t){super(),this.abortSignalConsumed=!1,this.defaultOptions=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.cache=t.cache,this.logger=t.logger||g3,this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.initialState=t.state||uN(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(t){this.options={...this.defaultOptions,...t},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(t,r){const n=nN(this.state.data,t,this.options);return this.dispatch({data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){this.dispatch({type:"setState",state:t,setStateOptions:r})}cancel(t){var r;const n=this.promise;return(r=this.retryer)==null||r.cancel(t),n?n.then(Li).catch(Li):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!tN(this.state.dataUpdatedAt,t)}onFocus(){var t;const r=this.observers.find(n=>n.shouldFetchOnWindowFocus());r&&r.refetch({cancelRefetch:!1}),(t=this.retryer)==null||t.continue()}onOnline(){var t;const r=this.observers.find(n=>n.shouldFetchOnReconnect());r&&r.refetch({cancelRefetch:!1}),(t=this.retryer)==null||t.continue()}addObserver(t){this.observers.indexOf(t)===-1&&(this.observers.push(t),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.indexOf(t)!==-1&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(t,r){var n,o;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&r!=null&&r.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var i;return(i=this.retryer)==null||i.continueRetry(),this.promise}}if(t&&this.setOptions(t),!this.options.queryFn){const p=this.observers.find(v=>v.options.queryFn);p&&this.setOptions(p.options)}Array.isArray(this.options.queryKey);const a=rN(),s={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},l=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>{if(a)return this.abortSignalConsumed=!0,a.signal}})};l(s);const u=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(s)):Promise.reject("Missing queryFn"),c={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:u};if(l(c),(n=this.options.behavior)==null||n.onFetch(c),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((o=c.fetchOptions)==null?void 0:o.meta)){var h;this.dispatch({type:"fetch",meta:(h=c.fetchOptions)==null?void 0:h.meta})}const d=p=>{if(cm(p)&&p.silent||this.dispatch({type:"error",error:p}),!cm(p)){var v,b;(v=(b=this.cache.config).onError)==null||v.call(b,p,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=SE({fn:c.fetchFn,abort:a==null?void 0:a.abort.bind(a),onSuccess:p=>{var v,b;if(typeof p>"u"){d(new Error("undefined"));return}this.setData(p),(v=(b=this.cache.config).onSuccess)==null||v.call(b,p,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:d,onFail:(p,v)=>{this.dispatch({type:"failed",failureCount:p,error:v})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(t){const r=n=>{var o,i;switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(o=t.meta)!=null?o:null,fetchStatus:p3(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(i=t.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return cm(a)&&a.revert&&this.revertState?{...this.revertState}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Ln.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate(t)}),this.cache.notify({query:this,type:"updated",action:t})})}}function uN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=typeof t<"u",n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"loading",fetchStatus:"idle"}}class cN extends n1{constructor(t){super(),this.config=t||{},this.queries=[],this.queriesMap={}}build(t,r,n){var o;const i=r.queryKey,a=(o=r.queryHash)!=null?o:h3(i,r);let s=this.get(a);return s||(s=new lN({cache:this,logger:t.getLogger(),queryKey:i,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){this.queriesMap[t.queryHash]||(this.queriesMap[t.queryHash]=t,this.queries.push(t),this.notify({type:"added",query:t}))}remove(t){const r=this.queriesMap[t.queryHash];r&&(t.destroy(),this.queries=this.queries.filter(n=>n!==t),r===t&&delete this.queriesMap[t.queryHash],this.notify({type:"removed",query:t}))}clear(){Ln.batch(()=>{this.queries.forEach(t=>{this.remove(t)})})}get(t){return this.queriesMap[t]}getAll(){return this.queries}find(t,r){const[n]=ba(t,r);return typeof n.exact>"u"&&(n.exact=!0),this.queries.find(o=>P6(n,o))}findAll(t,r){const[n]=ba(t,r);return Object.keys(n).length>0?this.queries.filter(o=>P6(n,o)):this.queries}notify(t){Ln.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Ln.batch(()=>{this.queries.forEach(t=>{t.onFocus()})})}onOnline(){Ln.batch(()=>{this.queries.forEach(t=>{t.onOnline()})})}}class fN extends CE{constructor(t){super(),this.options={...t.defaultOptions,...t.options},this.mutationId=t.mutationId,this.mutationCache=t.mutationCache,this.logger=t.logger||g3,this.observers=[],this.state=t.state||dN(),this.updateCacheTime(this.options.cacheTime),this.scheduleGc()}get meta(){return this.options.meta}setState(t){this.dispatch({type:"setState",state:t})}addObserver(t){this.observers.indexOf(t)===-1&&(this.observers.push(t),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.observers=this.observers.filter(r=>r!==t),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){return this.retryer?(this.retryer.continue(),this.retryer.promise):this.execute()}async execute(){const t=()=>{var M;return this.retryer=SE({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(P,L)=>{this.dispatch({type:"failed",failureCount:P,error:L})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(M=this.options.retry)!=null?M:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},r=this.state.status==="loading";try{var n,o,i,a,s,l;if(!r){var u,c,h,d;this.dispatch({type:"loading",variables:this.options.variables}),await((u=(c=this.mutationCache.config).onMutate)==null?void 0:u.call(c,this.state.variables,this));const P=await((h=(d=this.options).onMutate)==null?void 0:h.call(d,this.state.variables));P!==this.state.context&&this.dispatch({type:"loading",context:P,variables:this.state.variables})}const M=await t();return await((n=(o=this.mutationCache.config).onSuccess)==null?void 0:n.call(o,M,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,M,this.state.variables,this.state.context)),await((s=(l=this.options).onSettled)==null?void 0:s.call(l,M,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:M}),M}catch(M){try{var p,v,b,S,x,k;throw await((p=(v=this.mutationCache.config).onError)==null?void 0:p.call(v,M,this.state.variables,this.state.context,this)),await((b=(S=this.options).onError)==null?void 0:b.call(S,M,this.state.variables,this.state.context)),await((x=(k=this.options).onSettled)==null?void 0:x.call(k,void 0,M,this.state.variables,this.state.context)),M}finally{this.dispatch({type:"error",error:M})}}}dispatch(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"loading":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!p3(this.options.networkMode),status:"loading",variables:t.variables};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"};case"setState":return{...n,...t.state}}};this.state=r(this.state),Ln.batch(()=>{this.observers.forEach(n=>{n.onMutationUpdate(t)}),this.mutationCache.notify({mutation:this,type:"updated",action:t})})}}function dN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class hN extends n1{constructor(t){super(),this.config=t||{},this.mutations=[],this.mutationId=0}build(t,r,n){const o=new fN({mutationCache:this,logger:t.getLogger(),mutationId:++this.mutationId,options:t.defaultMutationOptions(r),state:n,defaultOptions:r.mutationKey?t.getMutationDefaults(r.mutationKey):void 0});return this.add(o),o}add(t){this.mutations.push(t),this.notify({type:"added",mutation:t})}remove(t){this.mutations=this.mutations.filter(r=>r!==t),this.notify({type:"removed",mutation:t})}clear(){Ln.batch(()=>{this.mutations.forEach(t=>{this.remove(t)})})}getAll(){return this.mutations}find(t){return typeof t.exact>"u"&&(t.exact=!0),this.mutations.find(r=>R6(t,r))}findAll(t){return this.mutations.filter(r=>R6(t,r))}notify(t){Ln.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.mutations.filter(r=>r.state.isPaused);return Ln.batch(()=>t.reduce((r,n)=>r.then(()=>n.continue().catch(Li)),Promise.resolve()))}}function pN(){return{onFetch:e=>{e.fetchFn=()=>{var t,r,n,o,i,a;const s=(t=e.fetchOptions)==null||(r=t.meta)==null?void 0:r.refetchPage,l=(n=e.fetchOptions)==null||(o=n.meta)==null?void 0:o.fetchMore,u=l==null?void 0:l.pageParam,c=(l==null?void 0:l.direction)==="forward",h=(l==null?void 0:l.direction)==="backward",d=((i=e.state.data)==null?void 0:i.pages)||[],p=((a=e.state.data)==null?void 0:a.pageParams)||[];let v=p,b=!1;const S=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>{var V;if((V=e.signal)!=null&&V.aborted)b=!0;else{var K;(K=e.signal)==null||K.addEventListener("abort",()=>{b=!0})}return e.signal}})},x=e.options.queryFn||(()=>Promise.reject("Missing queryFn")),k=(j,V,K,Z)=>(v=Z?[V,...v]:[...v,V],Z?[K,...j]:[...j,K]),M=(j,V,K,Z)=>{if(b)return Promise.reject("Cancelled");if(typeof K>"u"&&!V&&j.length)return Promise.resolve(j);const ue={queryKey:e.queryKey,pageParam:K,meta:e.options.meta};S(ue);const U=x(ue);return Promise.resolve(U).then(y=>k(j,K,y,Z))};let P;if(!d.length)P=M([]);else if(c){const j=typeof u<"u",V=j?u:D6(e.options,d);P=M(d,j,V)}else if(h){const j=typeof u<"u",V=j?u:gN(e.options,d);P=M(d,j,V,!0)}else{v=[];const j=typeof e.options.getNextPageParam>"u";P=(s&&d[0]?s(d[0],0,d):!0)?M([],j,p[0]):Promise.resolve(k([],p[0],d[0]));for(let K=1;K{if(s&&d[K]?s(d[K],K,d):!0){const U=j?p[K]:D6(e.options,Z);return M(Z,j,U)}return Promise.resolve(k(Z,p[K],d[K]))})}return P.then(j=>({pages:j,pageParams:v}))}}}}function D6(e,t){return e.getNextPageParam==null?void 0:e.getNextPageParam(t[t.length-1],t)}function gN(e,t){return e.getPreviousPageParam==null?void 0:e.getPreviousPageParam(t[0],t)}class mN{constructor(t={}){this.queryCache=t.queryCache||new cN,this.mutationCache=t.mutationCache||new hN,this.logger=t.logger||g3,this.defaultOptions=t.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=Q2.subscribe(()=>{Q2.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=I0.subscribe(()=>{I0.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var t,r;this.mountCount--,this.mountCount===0&&((t=this.unsubscribeFocus)==null||t.call(this),this.unsubscribeFocus=void 0,(r=this.unsubscribeOnline)==null||r.call(this),this.unsubscribeOnline=void 0)}isFetching(t,r){const[n]=ba(t,r);return n.fetchStatus="fetching",this.queryCache.findAll(n).length}isMutating(t){return this.mutationCache.findAll({...t,fetching:!0}).length}getQueryData(t,r){var n;return(n=this.queryCache.find(t,r))==null?void 0:n.state.data}ensureQueryData(t,r,n){const o=wh(t,r,n),i=this.getQueryData(o.queryKey);return i?Promise.resolve(i):this.fetchQuery(o)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:r,state:n})=>{const o=n.data;return[r,o]})}setQueryData(t,r,n){const o=this.queryCache.find(t),i=o==null?void 0:o.state.data,a=JO(r,i);if(typeof a>"u")return;const s=wh(t),l=this.defaultQueryOptions(s);return this.queryCache.build(this,l).setData(a,{...n,manual:!0})}setQueriesData(t,r,n){return Ln.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:o})=>[o,this.setQueryData(o,r,n)]))}getQueryState(t,r){var n;return(n=this.queryCache.find(t,r))==null?void 0:n.state}removeQueries(t,r){const[n]=ba(t,r),o=this.queryCache;Ln.batch(()=>{o.findAll(n).forEach(i=>{o.remove(i)})})}resetQueries(t,r,n){const[o,i]=ba(t,r,n),a=this.queryCache,s={type:"active",...o};return Ln.batch(()=>(a.findAll(o).forEach(l=>{l.reset()}),this.refetchQueries(s,i)))}cancelQueries(t,r,n){const[o,i={}]=ba(t,r,n);typeof i.revert>"u"&&(i.revert=!0);const a=Ln.batch(()=>this.queryCache.findAll(o).map(s=>s.cancel(i)));return Promise.all(a).then(Li).catch(Li)}invalidateQueries(t,r,n){const[o,i]=ba(t,r,n);return Ln.batch(()=>{var a,s;if(this.queryCache.findAll(o).forEach(u=>{u.invalidate()}),o.refetchType==="none")return Promise.resolve();const l={...o,type:(a=(s=o.refetchType)!=null?s:o.type)!=null?a:"active"};return this.refetchQueries(l,i)})}refetchQueries(t,r,n){const[o,i]=ba(t,r,n),a=Ln.batch(()=>this.queryCache.findAll(o).filter(l=>!l.isDisabled()).map(l=>{var u;return l.fetch(void 0,{...i,cancelRefetch:(u=i==null?void 0:i.cancelRefetch)!=null?u:!0,meta:{refetchPage:o.refetchPage}})}));let s=Promise.all(a).then(Li);return i!=null&&i.throwOnError||(s=s.catch(Li)),s}fetchQuery(t,r,n){const o=wh(t,r,n),i=this.defaultQueryOptions(o);typeof i.retry>"u"&&(i.retry=!1);const a=this.queryCache.build(this,i);return a.isStaleByTime(i.staleTime)?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(t,r,n){return this.fetchQuery(t,r,n).then(Li).catch(Li)}fetchInfiniteQuery(t,r,n){const o=wh(t,r,n);return o.behavior=pN(),this.fetchQuery(o)}prefetchInfiniteQuery(t,r,n){return this.fetchInfiniteQuery(t,r,n).then(Li).catch(Li)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(t){this.defaultOptions=t}setQueryDefaults(t,r){const n=this.queryDefaults.find(o=>Os(t)===Os(o.queryKey));n?n.defaultOptions=r:this.queryDefaults.push({queryKey:t,defaultOptions:r})}getQueryDefaults(t){if(!t)return;const r=this.queryDefaults.find(n=>M0(t,n.queryKey));return r==null?void 0:r.defaultOptions}setMutationDefaults(t,r){const n=this.mutationDefaults.find(o=>Os(t)===Os(o.mutationKey));n?n.defaultOptions=r:this.mutationDefaults.push({mutationKey:t,defaultOptions:r})}getMutationDefaults(t){if(!t)return;const r=this.mutationDefaults.find(n=>M0(t,n.mutationKey));return r==null?void 0:r.defaultOptions}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const r={...this.defaultOptions.queries,...this.getQueryDefaults(t==null?void 0:t.queryKey),...t,_defaulted:!0};return!r.queryHash&&r.queryKey&&(r.queryHash=h3(r.queryKey,r)),typeof r.refetchOnReconnect>"u"&&(r.refetchOnReconnect=r.networkMode!=="always"),typeof r.useErrorBoundary>"u"&&(r.useErrorBoundary=!!r.suspense),r}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...this.defaultOptions.mutations,...this.getMutationDefaults(t==null?void 0:t.mutationKey),...t,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}var X2={},vN={get exports(){return X2},set exports(e){X2=e}},gi={},J2={},yN={get exports(){return J2},set exports(e){J2=e}},EE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(T,E){var C=T.length;T.push(E);e:for(;0>>1,m=T[I];if(0>>1;Io(de,C))$o(he,de)?(T[I]=he,T[$]=C,I=$):(T[I]=de,T[ne]=C,I=ne);else if($o(he,C))T[I]=he,T[$]=C,I=$;else break e}}return E}function o(T,E){var C=T.sortIndex-E.sortIndex;return C!==0?C:T.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,h=null,d=3,p=!1,v=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(T){for(var E=r(u);E!==null;){if(E.callback===null)n(u);else if(E.startTime<=T)n(u),E.sortIndex=E.expirationTime,t(l,E);else break;E=r(u)}}function P(T){if(b=!1,M(T),!v)if(r(l)!==null)v=!0,w(L);else{var E=r(u);E!==null&&A(P,E.startTime-T)}}function L(T,E){v=!1,b&&(b=!1,x(K),K=-1),p=!0;var C=d;try{for(M(E),h=r(l);h!==null&&(!(h.expirationTime>E)||T&&!U());){var I=h.callback;if(typeof I=="function"){h.callback=null,d=h.priorityLevel;var m=I(h.expirationTime<=E);E=e.unstable_now(),typeof m=="function"?h.callback=m:h===r(l)&&n(l),M(E)}else n(l);h=r(l)}if(h!==null)var B=!0;else{var ne=r(u);ne!==null&&A(P,ne.startTime-E),B=!1}return B}finally{h=null,d=C,p=!1}}var j=!1,V=null,K=-1,Z=5,ue=-1;function U(){return!(e.unstable_now()-ueT||125I?(T.sortIndex=C,t(u,T),r(l)===null&&T===r(u)&&(b?(x(K),K=-1):b=!0,A(P,C-I))):(T.sortIndex=m,t(l,T),v||p||(v=!0,w(L))),T},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(T){var E=d;return function(){var C=d;d=E;try{return T.apply(this,arguments)}finally{d=C}}}})(CE);(function(e){e.exports=CE})(wN);/** + */(function(e){function t(T,E){var C=T.length;T.push(E);e:for(;0>>1,m=T[I];if(0>>1;Io(de,C))$o(he,de)?(T[I]=he,T[$]=C,I=$):(T[I]=de,T[ne]=C,I=ne);else if($o(he,C))T[I]=he,T[$]=C,I=$;else break e}}return E}function o(T,E){var C=T.sortIndex-E.sortIndex;return C!==0?C:T.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,h=null,d=3,p=!1,v=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(T){for(var E=r(u);E!==null;){if(E.callback===null)n(u);else if(E.startTime<=T)n(u),E.sortIndex=E.expirationTime,t(l,E);else break;E=r(u)}}function P(T){if(b=!1,M(T),!v)if(r(l)!==null)v=!0,w(L);else{var E=r(u);E!==null&&A(P,E.startTime-T)}}function L(T,E){v=!1,b&&(b=!1,x(K),K=-1),p=!0;var C=d;try{for(M(E),h=r(l);h!==null&&(!(h.expirationTime>E)||T&&!U());){var I=h.callback;if(typeof I=="function"){h.callback=null,d=h.priorityLevel;var m=I(h.expirationTime<=E);E=e.unstable_now(),typeof m=="function"?h.callback=m:h===r(l)&&n(l),M(E)}else n(l);h=r(l)}if(h!==null)var B=!0;else{var ne=r(u);ne!==null&&A(P,ne.startTime-E),B=!1}return B}finally{h=null,d=C,p=!1}}var j=!1,V=null,K=-1,Z=5,ue=-1;function U(){return!(e.unstable_now()-ueT||125I?(T.sortIndex=C,t(u,T),r(l)===null&&T===r(u)&&(b?(x(K),K=-1):b=!0,A(P,C-I))):(T.sortIndex=m,t(l,T),v||p||(v=!0,w(L))),T},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(T){var E=d;return function(){var C=d;d=E;try{return T.apply(this,arguments)}finally{d=C}}}})(EE);(function(e){e.exports=EE})(yN);/** * @license React * react-dom.production.min.js * @@ -30,20 +30,20 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var EE=dt,fi=J2;function Qe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eb=Object.prototype.hasOwnProperty,_N=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,U6={},j6={};function xN(e){return eb.call(j6,e)?!0:eb.call(U6,e)?!1:_N.test(e)?j6[e]=!0:(U6[e]=!0,!1)}function SN(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function CN(e,t,r,n){if(t===null||typeof t>"u"||SN(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Wn(e,t,r,n,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vn[e]=new Wn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vn[t]=new Wn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vn[e]=new Wn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vn[e]=new Wn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){vn[e]=new Wn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vn[e]=new Wn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vn[e]=new Wn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vn[e]=new Wn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vn[e]=new Wn(e,5,!1,e.toLowerCase(),null,!1,!1)});var v3=/[\-:]([a-z])/g;function y3(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(v3,y3);vn[t]=new Wn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(v3,y3);vn[t]=new Wn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(v3,y3);vn[t]=new Wn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!1,!1)});vn.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!0,!0)});function b3(e,t,r,n){var o=vn.hasOwnProperty(t)?vn[t]:null;(o!==null?o.type!==0:n||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eb=Object.prototype.hasOwnProperty,bN=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,U6={},j6={};function wN(e){return eb.call(j6,e)?!0:eb.call(U6,e)?!1:bN.test(e)?j6[e]=!0:(U6[e]=!0,!1)}function _N(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xN(e,t,r,n){if(t===null||typeof t>"u"||_N(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Wn(e,t,r,n,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vn[e]=new Wn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vn[t]=new Wn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vn[e]=new Wn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vn[e]=new Wn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){vn[e]=new Wn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vn[e]=new Wn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vn[e]=new Wn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vn[e]=new Wn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vn[e]=new Wn(e,5,!1,e.toLowerCase(),null,!1,!1)});var m3=/[\-:]([a-z])/g;function v3(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(m3,v3);vn[t]=new Wn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(m3,v3);vn[t]=new Wn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(m3,v3);vn[t]=new Wn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!1,!1)});vn.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!0,!0)});function y3(e,t,r,n){var o=vn.hasOwnProperty(t)?vn[t]:null;(o!==null?o.type!==0:n||!(2s||o[a]!==i[s]){var l=` -`+o[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{dm=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?nf(e):""}function EN(e){switch(e.tag){case 5:return nf(e.type);case 16:return nf("Lazy");case 13:return nf("Suspense");case 19:return nf("SuspenseList");case 0:case 2:case 15:return e=hm(e.type,!1),e;case 11:return e=hm(e.type.render,!1),e;case 1:return e=hm(e.type,!0),e;default:return""}}function ib(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Gl:return"Fragment";case Zl:return"Portal";case tb:return"Profiler";case w3:return"StrictMode";case rb:return"Suspense";case nb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ME:return(e.displayName||"Context")+".Consumer";case AE:return(e._context.displayName||"Context")+".Provider";case _3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case x3:return t=e.displayName||null,t!==null?t:ib(e.type)||"Memo";case wa:t=e._payload,e=e._init;try{return ib(e(t))}catch{}}return null}function kN(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ib(t);case 8:return t===w3?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function TE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function AN(e){var t=TE(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xh(e){e._valueTracker||(e._valueTracker=AN(e))}function BE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=TE(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function T0(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ob(e,t){var r=t.checked;return Pr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function z6(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Xa(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function PE(e,t){t=t.checked,t!=null&&b3(e,"checked",t,!1)}function ab(e,t){PE(e,t);var r=Xa(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sb(e,t.type,r):t.hasOwnProperty("defaultValue")&&sb(e,t.type,Xa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $6(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function sb(e,t,r){(t!=="number"||T0(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var of=Array.isArray;function mu(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Sh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hf(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var vf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},MN=["Webkit","ms","Moz","O"];Object.keys(vf).forEach(function(e){MN.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vf[t]=vf[e]})});function LE(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||vf.hasOwnProperty(e)&&vf[e]?(""+t).trim():t+"px"}function DE(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=LE(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var IN=Pr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cb(e,t){if(t){if(IN[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Qe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Qe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Qe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Qe(62))}}function fb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var db=null;function S3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hb=null,vu=null,yu=null;function V6(e){if(e=Fd(e)){if(typeof hb!="function")throw Error(Qe(280));var t=e.stateNode;t&&(t=u1(t),hb(e.stateNode,e.type,t))}}function UE(e){vu?yu?yu.push(e):yu=[e]:vu=e}function jE(){if(vu){var e=vu,t=yu;if(yu=vu=null,V6(e),t)for(e=0;e>>=0,e===0?32:31-(FN(e)/zN|0)|0}var Ch=64,Eh=4194304;function af(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function O0(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=af(s):(i&=a,i!==0&&(n=af(i)))}else a=r&~o,a!==0?n=af(a):i!==0&&(n=af(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&o)&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Ud(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zi(t),e[t]=r}function VN(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=bf),e_=String.fromCharCode(32),t_=!1;function ok(e,t){switch(e){case"keyup":return bL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ak(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yl=!1;function _L(e,t){switch(e){case"compositionend":return ak(t);case"keypress":return t.which!==32?null:(t_=!0,e_);case"textInput":return e=t.data,e===e_&&t_?null:e;default:return null}}function xL(e,t){if(Yl)return e==="compositionend"||!B3&&ok(e,t)?(e=nk(),l0=M3=Aa=null,Yl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=o_(r)}}function ck(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ck(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fk(){for(var e=window,t=T0();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=T0(e.document)}return t}function P3(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function BL(e){var t=fk(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&ck(r.ownerDocument.documentElement,r)){if(n!==null&&P3(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=a_(r,i);var a=a_(r,n);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ql=null,bb=null,_f=null,wb=!1;function s_(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wb||Ql==null||Ql!==T0(n)||(n=Ql,"selectionStart"in n&&P3(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),_f&&Xf(_f,n)||(_f=n,n=D0(bb,"onSelect"),0eu||(e.current=kb[eu],kb[eu]=null,eu--)}function wr(e,t){eu++,kb[eu]=e.current,e.current=t}var Ja={},In=cs(Ja),ei=cs(!1),Gs=Ja;function Tu(e,t){var r=e.type.contextTypes;if(!r)return Ja;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ti(e){return e=e.childContextTypes,e!=null}function j0(){Er(ei),Er(In)}function p_(e,t,r){if(In.current!==Ja)throw Error(Qe(168));wr(In,t),wr(ei,r)}function wk(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(Qe(108,kN(e)||"Unknown",o));return Pr({},r,n)}function F0(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ja,Gs=In.current,wr(In,e),wr(ei,ei.current),!0}function g_(e,t,r){var n=e.stateNode;if(!n)throw Error(Qe(169));r?(e=wk(e,t,Gs),n.__reactInternalMemoizedMergedChildContext=e,Er(ei),Er(In),wr(In,e)):Er(ei),wr(ei,r)}var Uo=null,c1=!1,Am=!1;function _k(e){Uo===null?Uo=[e]:Uo.push(e)}function qL(e){c1=!0,_k(e)}function fs(){if(!Am&&Uo!==null){Am=!0;var e=0,t=dr;try{var r=Uo;for(dr=1;e>=a,o-=a,zo=1<<32-Zi(t)+o|r<K?(Z=V,V=null):Z=V.sibling;var ue=d(x,V,M[K],P);if(ue===null){V===null&&(V=Z);break}e&&V&&ue.alternate===null&&t(x,V),k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue,V=Z}if(K===M.length)return r(x,V),kr&&ks(x,K),L;if(V===null){for(;KK?(Z=V,V=null):Z=V.sibling;var U=d(x,V,ue.value,P);if(U===null){V===null&&(V=Z);break}e&&V&&U.alternate===null&&t(x,V),k=i(U,k,K),j===null?L=U:j.sibling=U,j=U,V=Z}if(ue.done)return r(x,V),kr&&ks(x,K),L;if(V===null){for(;!ue.done;K++,ue=M.next())ue=h(x,ue.value,P),ue!==null&&(k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue);return kr&&ks(x,K),L}for(V=n(x,V);!ue.done;K++,ue=M.next())ue=p(V,x,K,ue.value,P),ue!==null&&(e&&ue.alternate!==null&&V.delete(ue.key===null?K:ue.key),k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue);return e&&V.forEach(function(_){return t(x,_)}),kr&&ks(x,K),L}function S(x,k,M,P){if(typeof M=="object"&&M!==null&&M.type===Gl&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case _h:e:{for(var L=M.key,j=k;j!==null;){if(j.key===L){if(L=M.type,L===Gl){if(j.tag===7){r(x,j.sibling),k=o(j,M.props.children),k.return=x,x=k;break e}}else if(j.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===wa&&x_(L)===j.type){r(x,j.sibling),k=o(j,M.props),k.ref=Ic(x,j,M),k.return=x,x=k;break e}r(x,j);break}else t(x,j);j=j.sibling}M.type===Gl?(k=qs(M.props.children,x.mode,P,M.key),k.return=x,x=k):(P=m0(M.type,M.key,M.props,null,x.mode,P),P.ref=Ic(x,k,M),P.return=x,x=P)}return a(x);case Zl:e:{for(j=M.key;k!==null;){if(k.key===j)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(x,k.sibling),k=o(k,M.children||[]),k.return=x,x=k;break e}else{r(x,k);break}else t(x,k);k=k.sibling}k=Nm(M,x.mode,P),k.return=x,x=k}return a(x);case wa:return j=M._init,S(x,k,j(M._payload),P)}if(of(M))return v(x,k,M,P);if(Cc(M))return b(x,k,M,P);Ph(x,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(x,k.sibling),k=o(k,M),k.return=x,x=k):(r(x,k),k=Om(M,x.mode,P),k.return=x,x=k),a(x)):r(x,k)}return S}var Pu=Ik(!0),Tk=Ik(!1),zd={},vo=cs(zd),rd=cs(zd),nd=cs(zd);function Ds(e){if(e===zd)throw Error(Qe(174));return e}function z3(e,t){switch(wr(nd,t),wr(rd,e),wr(vo,zd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ub(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ub(t,e)}Er(vo),wr(vo,t)}function Ru(){Er(vo),Er(rd),Er(nd)}function Bk(e){Ds(nd.current);var t=Ds(vo.current),r=ub(t,e.type);t!==r&&(wr(rd,e),wr(vo,r))}function $3(e){rd.current===e&&(Er(vo),Er(rd))}var Ir=cs(0);function H0(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mm=[];function q3(){for(var e=0;er?r:4,e(!0);var n=Im.transition;Im.transition={};try{e(!1),t()}finally{dr=r,Im.transition=n}}function Kk(){return Pi().memoizedState}function KL(e,t,r){var n=Da(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Zk(e))Gk(t,r);else if(r=Ek(e,t,r,n),r!==null){var o=Fn();Gi(r,e,n,o),Yk(r,t,n)}}function ZL(e,t,r){var n=Da(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Zk(e))Gk(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Ji(s,a)){var l=t.interleaved;l===null?(o.next=o,j3(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}r=Ek(e,t,o,n),r!==null&&(o=Fn(),Gi(r,e,n,o),Yk(r,t,n))}}function Zk(e){var t=e.alternate;return e===Br||t!==null&&t===Br}function Gk(e,t){xf=K0=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Yk(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,E3(e,r)}}var Z0={readContext:Bi,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},GL={readContext:Bi,useCallback:function(e,t){return ao().memoizedState=[e,t===void 0?null:t],e},useContext:Bi,useEffect:C_,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,d0(4194308,4,$k.bind(null,t,e),r)},useLayoutEffect:function(e,t){return d0(4194308,4,e,t)},useInsertionEffect:function(e,t){return d0(4,2,e,t)},useMemo:function(e,t){var r=ao();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ao();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=KL.bind(null,Br,e),[n.memoizedState,e]},useRef:function(e){var t=ao();return e={current:e},t.memoizedState=e},useState:S_,useDebugValue:Z3,useDeferredValue:function(e){return ao().memoizedState=e},useTransition:function(){var e=S_(!1),t=e[0];return e=HL.bind(null,e[1]),ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Br,o=ao();if(kr){if(r===void 0)throw Error(Qe(407));r=r()}else{if(r=t(),sn===null)throw Error(Qe(349));Qs&30||Ok(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,C_(Lk.bind(null,n,i,e),[e]),n.flags|=2048,ad(9,Nk.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=ao(),t=sn.identifierPrefix;if(kr){var r=$o,n=zo;r=(n&~(1<<32-Zi(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=id++,0")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{dm=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?nf(e):""}function SN(e){switch(e.tag){case 5:return nf(e.type);case 16:return nf("Lazy");case 13:return nf("Suspense");case 19:return nf("SuspenseList");case 0:case 2:case 15:return e=hm(e.type,!1),e;case 11:return e=hm(e.type.render,!1),e;case 1:return e=hm(e.type,!0),e;default:return""}}function ib(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Gl:return"Fragment";case Zl:return"Portal";case tb:return"Profiler";case b3:return"StrictMode";case rb:return"Suspense";case nb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case IE:return(e.displayName||"Context")+".Consumer";case ME:return(e._context.displayName||"Context")+".Provider";case w3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _3:return t=e.displayName||null,t!==null?t:ib(e.type)||"Memo";case wa:t=e._payload,e=e._init;try{return ib(e(t))}catch{}}return null}function CN(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ib(t);case 8:return t===b3?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function EN(e){var t=BE(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xh(e){e._valueTracker||(e._valueTracker=EN(e))}function PE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=BE(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function T0(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ob(e,t){var r=t.checked;return Pr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function z6(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Xa(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function RE(e,t){t=t.checked,t!=null&&y3(e,"checked",t,!1)}function ab(e,t){RE(e,t);var r=Xa(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sb(e,t.type,r):t.hasOwnProperty("defaultValue")&&sb(e,t.type,Xa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $6(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function sb(e,t,r){(t!=="number"||T0(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var of=Array.isArray;function mu(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Sh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hf(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var vf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kN=["Webkit","ms","Moz","O"];Object.keys(vf).forEach(function(e){kN.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vf[t]=vf[e]})});function DE(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||vf.hasOwnProperty(e)&&vf[e]?(""+t).trim():t+"px"}function UE(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=DE(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var AN=Pr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cb(e,t){if(t){if(AN[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Qe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Qe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Qe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Qe(62))}}function fb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var db=null;function x3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hb=null,vu=null,yu=null;function V6(e){if(e=Fd(e)){if(typeof hb!="function")throw Error(Qe(280));var t=e.stateNode;t&&(t=u1(t),hb(e.stateNode,e.type,t))}}function jE(e){vu?yu?yu.push(e):yu=[e]:vu=e}function FE(){if(vu){var e=vu,t=yu;if(yu=vu=null,V6(e),t)for(e=0;e>>=0,e===0?32:31-(UN(e)/jN|0)|0}var Ch=64,Eh=4194304;function af(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function O0(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=af(s):(i&=a,i!==0&&(n=af(i)))}else a=r&~o,a!==0?n=af(a):i!==0&&(n=af(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&o)&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Ud(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zi(t),e[t]=r}function qN(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=bf),e_=String.fromCharCode(32),t_=!1;function ak(e,t){switch(e){case"keyup":return vL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sk(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yl=!1;function bL(e,t){switch(e){case"compositionend":return sk(t);case"keypress":return t.which!==32?null:(t_=!0,e_);case"textInput":return e=t.data,e===e_&&t_?null:e;default:return null}}function wL(e,t){if(Yl)return e==="compositionend"||!T3&&ak(e,t)?(e=ik(),l0=A3=Aa=null,Yl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=o_(r)}}function fk(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?fk(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dk(){for(var e=window,t=T0();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=T0(e.document)}return t}function B3(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function IL(e){var t=dk(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&fk(r.ownerDocument.documentElement,r)){if(n!==null&&B3(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=a_(r,i);var a=a_(r,n);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ql=null,bb=null,_f=null,wb=!1;function s_(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wb||Ql==null||Ql!==T0(n)||(n=Ql,"selectionStart"in n&&B3(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),_f&&Xf(_f,n)||(_f=n,n=D0(bb,"onSelect"),0eu||(e.current=kb[eu],kb[eu]=null,eu--)}function wr(e,t){eu++,kb[eu]=e.current,e.current=t}var Ja={},In=cs(Ja),ei=cs(!1),Gs=Ja;function Tu(e,t){var r=e.type.contextTypes;if(!r)return Ja;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ti(e){return e=e.childContextTypes,e!=null}function j0(){Er(ei),Er(In)}function p_(e,t,r){if(In.current!==Ja)throw Error(Qe(168));wr(In,t),wr(ei,r)}function _k(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(Qe(108,CN(e)||"Unknown",o));return Pr({},r,n)}function F0(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ja,Gs=In.current,wr(In,e),wr(ei,ei.current),!0}function g_(e,t,r){var n=e.stateNode;if(!n)throw Error(Qe(169));r?(e=_k(e,t,Gs),n.__reactInternalMemoizedMergedChildContext=e,Er(ei),Er(In),wr(In,e)):Er(ei),wr(ei,r)}var Uo=null,c1=!1,Am=!1;function xk(e){Uo===null?Uo=[e]:Uo.push(e)}function zL(e){c1=!0,xk(e)}function fs(){if(!Am&&Uo!==null){Am=!0;var e=0,t=dr;try{var r=Uo;for(dr=1;e>=a,o-=a,zo=1<<32-Zi(t)+o|r<K?(Z=V,V=null):Z=V.sibling;var ue=d(x,V,M[K],P);if(ue===null){V===null&&(V=Z);break}e&&V&&ue.alternate===null&&t(x,V),k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue,V=Z}if(K===M.length)return r(x,V),kr&&ks(x,K),L;if(V===null){for(;KK?(Z=V,V=null):Z=V.sibling;var U=d(x,V,ue.value,P);if(U===null){V===null&&(V=Z);break}e&&V&&U.alternate===null&&t(x,V),k=i(U,k,K),j===null?L=U:j.sibling=U,j=U,V=Z}if(ue.done)return r(x,V),kr&&ks(x,K),L;if(V===null){for(;!ue.done;K++,ue=M.next())ue=h(x,ue.value,P),ue!==null&&(k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue);return kr&&ks(x,K),L}for(V=n(x,V);!ue.done;K++,ue=M.next())ue=p(V,x,K,ue.value,P),ue!==null&&(e&&ue.alternate!==null&&V.delete(ue.key===null?K:ue.key),k=i(ue,k,K),j===null?L=ue:j.sibling=ue,j=ue);return e&&V.forEach(function(_){return t(x,_)}),kr&&ks(x,K),L}function S(x,k,M,P){if(typeof M=="object"&&M!==null&&M.type===Gl&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case _h:e:{for(var L=M.key,j=k;j!==null;){if(j.key===L){if(L=M.type,L===Gl){if(j.tag===7){r(x,j.sibling),k=o(j,M.props.children),k.return=x,x=k;break e}}else if(j.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===wa&&x_(L)===j.type){r(x,j.sibling),k=o(j,M.props),k.ref=Ic(x,j,M),k.return=x,x=k;break e}r(x,j);break}else t(x,j);j=j.sibling}M.type===Gl?(k=qs(M.props.children,x.mode,P,M.key),k.return=x,x=k):(P=m0(M.type,M.key,M.props,null,x.mode,P),P.ref=Ic(x,k,M),P.return=x,x=P)}return a(x);case Zl:e:{for(j=M.key;k!==null;){if(k.key===j)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(x,k.sibling),k=o(k,M.children||[]),k.return=x,x=k;break e}else{r(x,k);break}else t(x,k);k=k.sibling}k=Nm(M,x.mode,P),k.return=x,x=k}return a(x);case wa:return j=M._init,S(x,k,j(M._payload),P)}if(of(M))return v(x,k,M,P);if(Cc(M))return b(x,k,M,P);Ph(x,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(x,k.sibling),k=o(k,M),k.return=x,x=k):(r(x,k),k=Om(M,x.mode,P),k.return=x,x=k),a(x)):r(x,k)}return S}var Pu=Tk(!0),Bk=Tk(!1),zd={},vo=cs(zd),rd=cs(zd),nd=cs(zd);function Ds(e){if(e===zd)throw Error(Qe(174));return e}function F3(e,t){switch(wr(nd,t),wr(rd,e),wr(vo,zd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ub(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ub(t,e)}Er(vo),wr(vo,t)}function Ru(){Er(vo),Er(rd),Er(nd)}function Pk(e){Ds(nd.current);var t=Ds(vo.current),r=ub(t,e.type);t!==r&&(wr(rd,e),wr(vo,r))}function z3(e){rd.current===e&&(Er(vo),Er(rd))}var Ir=cs(0);function H0(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mm=[];function $3(){for(var e=0;er?r:4,e(!0);var n=Im.transition;Im.transition={};try{e(!1),t()}finally{dr=r,Im.transition=n}}function Zk(){return Pi().memoizedState}function VL(e,t,r){var n=Da(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Gk(e))Yk(t,r);else if(r=kk(e,t,r,n),r!==null){var o=Fn();Gi(r,e,n,o),Qk(r,t,n)}}function HL(e,t,r){var n=Da(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Gk(e))Yk(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Ji(s,a)){var l=t.interleaved;l===null?(o.next=o,U3(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}r=kk(e,t,o,n),r!==null&&(o=Fn(),Gi(r,e,n,o),Qk(r,t,n))}}function Gk(e){var t=e.alternate;return e===Br||t!==null&&t===Br}function Yk(e,t){xf=K0=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Qk(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,C3(e,r)}}var Z0={readContext:Bi,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},KL={readContext:Bi,useCallback:function(e,t){return ao().memoizedState=[e,t===void 0?null:t],e},useContext:Bi,useEffect:C_,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,d0(4194308,4,qk.bind(null,t,e),r)},useLayoutEffect:function(e,t){return d0(4194308,4,e,t)},useInsertionEffect:function(e,t){return d0(4,2,e,t)},useMemo:function(e,t){var r=ao();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ao();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=VL.bind(null,Br,e),[n.memoizedState,e]},useRef:function(e){var t=ao();return e={current:e},t.memoizedState=e},useState:S_,useDebugValue:K3,useDeferredValue:function(e){return ao().memoizedState=e},useTransition:function(){var e=S_(!1),t=e[0];return e=WL.bind(null,e[1]),ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Br,o=ao();if(kr){if(r===void 0)throw Error(Qe(407));r=r()}else{if(r=t(),sn===null)throw Error(Qe(349));Qs&30||Nk(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,C_(Dk.bind(null,n,i,e),[e]),n.flags|=2048,ad(9,Lk.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=ao(),t=sn.identifierPrefix;if(kr){var r=$o,n=zo;r=(n&~(1<<32-Zi(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=id++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[uo]=t,e[td]=n,oA(e,t,!1,!1),t.stateNode=e;e:{switch(a=fb(r,n),r){case"dialog":_r("cancel",e),_r("close",e),o=n;break;case"iframe":case"object":case"embed":_r("load",e),o=n;break;case"video":case"audio":for(o=0;oNu&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304)}else{if(!n)if(e=H0(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Tc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!kr)return xn(t),null}else 2*zr()-i.renderingStartTime>Nu&&r!==1073741824&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=zr(),t.sibling=null,r=Ir.current,wr(Ir,n?r&1|2:r&1),t):(xn(t),null);case 22:case 23:return ew(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?si&1073741824&&(xn(t),t.subtreeFlags&6&&(t.flags|=8192)):xn(t),null;case 24:return null;case 25:return null}throw Error(Qe(156,t.tag))}function nD(e,t){switch(O3(t),t.tag){case 1:return ti(t.type)&&j0(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ru(),Er(ei),Er(In),q3(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $3(t),null;case 13:if(Er(Ir),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Qe(340));Bu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Er(Ir),null;case 4:return Ru(),null;case 10:return U3(t.type._context),null;case 22:case 23:return ew(),null;case 24:return null;default:return null}}var Oh=!1,Cn=!1,iD=typeof WeakSet=="function"?WeakSet:Set,mt=null;function iu(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Lr(e,t,n)}else r.current=null}function Ub(e,t,r){try{r()}catch(n){Lr(e,t,n)}}var R_=!1;function oD(e,t){if(_b=N0,e=fk(),P3(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,l=-1,u=0,c=0,h=e,d=null;t:for(;;){for(var p;h!==r||o!==0&&h.nodeType!==3||(s=a+o),h!==i||n!==0&&h.nodeType!==3||(l=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)d=h,h=p;for(;;){if(h===e)break t;if(d===r&&++u===o&&(s=a),d===i&&++c===n&&(l=a),(p=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(xb={focusedElem:e,selectionRange:r},N0=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){t=mt;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var b=v.memoizedProps,S=v.memoizedState,x=t.stateNode,k=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:Di(t.type,b),S);x.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Qe(163))}}catch(P){Lr(t,t.return,P)}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}return v=R_,R_=!1,v}function Sf(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Ub(t,r,i)}o=o.next}while(o!==n)}}function h1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function jb(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function lA(e){var t=e.alternate;t!==null&&(e.alternate=null,lA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[uo],delete t[td],delete t[Eb],delete t[zL],delete t[$L])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function uA(e){return e.tag===5||e.tag===3||e.tag===4}function O_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uA(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fb(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=U0));else if(n!==4&&(e=e.child,e!==null))for(Fb(e,t,r),e=e.sibling;e!==null;)Fb(e,t,r),e=e.sibling}function zb(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(zb(e,t,r),e=e.sibling;e!==null;)zb(e,t,r),e=e.sibling}var hn=null,Ui=!1;function ma(e,t,r){for(r=r.child;r!==null;)cA(e,t,r),r=r.sibling}function cA(e,t,r){if(mo&&typeof mo.onCommitFiberUnmount=="function")try{mo.onCommitFiberUnmount(o1,r)}catch{}switch(r.tag){case 5:Cn||iu(r,t);case 6:var n=hn,o=Ui;hn=null,ma(e,t,r),hn=n,Ui=o,hn!==null&&(Ui?(e=hn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):hn.removeChild(r.stateNode));break;case 18:hn!==null&&(Ui?(e=hn,r=r.stateNode,e.nodeType===8?km(e.parentNode,r):e.nodeType===1&&km(e,r),Yf(e)):km(hn,r.stateNode));break;case 4:n=hn,o=Ui,hn=r.stateNode.containerInfo,Ui=!0,ma(e,t,r),hn=n,Ui=o;break;case 0:case 11:case 14:case 15:if(!Cn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Ub(r,t,a),o=o.next}while(o!==n)}ma(e,t,r);break;case 1:if(!Cn&&(iu(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Lr(r,t,s)}ma(e,t,r);break;case 21:ma(e,t,r);break;case 22:r.mode&1?(Cn=(n=Cn)||r.memoizedState!==null,ma(e,t,r),Cn=n):ma(e,t,r);break;default:ma(e,t,r)}}function N_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new iD),t.forEach(function(n){var o=pD.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Ni(e,t){var r=t.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=zr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*sD(n/1960))-n,10e?16:e,Ma===null)var n=!1;else{if(e=Ma,Ma=null,Q0=0,or&6)throw Error(Qe(331));var o=or;for(or|=4,mt=e.current;mt!==null;){var i=mt,a=i.child;if(mt.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lzr()-X3?$s(e,0):Q3|=r),ri(e,t)}function yA(e,t){t===0&&(e.mode&1?(t=Eh,Eh<<=1,!(Eh&130023424)&&(Eh=4194304)):t=1);var r=Fn();e=na(e,t),e!==null&&(Ud(e,t,r),ri(e,r))}function hD(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),yA(e,r)}function pD(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Qe(314))}n!==null&&n.delete(t),yA(e,r)}var bA;bA=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ei.current)Xn=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Xn=!1,tD(e,t,r);Xn=!!(e.flags&131072)}else Xn=!1,kr&&t.flags&1048576&&xk(t,$0,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;h0(e,t),e=t.pendingProps;var o=Tu(t,In.current);wu(t,r),o=V3(null,t,n,e,o,r);var i=H3();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ti(n)?(i=!0,F0(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,F3(t),o.updater=f1,t.stateNode=o,o._reactInternals=t,Bb(t,n,e,r),t=Ob(null,t,n,!0,i,r)):(t.tag=0,kr&&i&&R3(t),On(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(h0(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=mD(n),e=Di(n,e),o){case 0:t=Rb(null,t,n,e,r);break e;case 1:t=T_(null,t,n,e,r);break e;case 11:t=M_(null,t,n,e,r);break e;case 14:t=I_(null,t,n,Di(n.type,e),r);break e}throw Error(Qe(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),Rb(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),T_(e,t,n,o,r);case 3:e:{if(rA(t),e===null)throw Error(Qe(387));n=t.pendingProps,i=t.memoizedState,o=i.element,kk(e,t),V0(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ou(Error(Qe(423)),t),t=B_(e,t,n,r,o);break e}else if(n!==o){o=Ou(Error(Qe(424)),t),t=B_(e,t,n,r,o);break e}else for(li=Oa(t.stateNode.containerInfo.firstChild),ci=t,kr=!0,Fi=null,r=Tk(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Bu(),n===o){t=ia(e,t,r);break e}On(e,t,n,r)}t=t.child}return t;case 5:return Bk(t),e===null&&Mb(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,Sb(n,o)?a=null:i!==null&&Sb(n,i)&&(t.flags|=32),tA(e,t),On(e,t,a,r),t.child;case 6:return e===null&&Mb(t),null;case 13:return nA(e,t,r);case 4:return z3(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Pu(t,null,n,r):On(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),M_(e,t,n,o,r);case 7:return On(e,t,t.pendingProps,r),t.child;case 8:return On(e,t,t.pendingProps.children,r),t.child;case 12:return On(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,wr(q0,n._currentValue),n._currentValue=a,i!==null)if(Ji(i.value,a)){if(i.children===o.children&&!ei.current){t=ia(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=Ko(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Ib(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Ib(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}On(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,wu(t,r),o=Bi(o),n=n(o),t.flags|=1,On(e,t,n,r),t.child;case 14:return n=t.type,o=Di(n,t.pendingProps),o=Di(n.type,o),I_(e,t,n,o,r);case 15:return Jk(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),h0(e,t),t.tag=1,ti(n)?(e=!0,F0(t)):e=!1,wu(t,r),Mk(t,n,o),Bb(t,n,o,r),Ob(null,t,n,!0,e,r);case 19:return iA(e,t,r);case 22:return eA(e,t,r)}throw Error(Qe(156,t.tag))};function wA(e,t){return HE(e,t)}function gD(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(e,t,r,n){return new gD(e,t,r,n)}function rw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mD(e){if(typeof e=="function")return rw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===_3)return 11;if(e===x3)return 14}return 2}function Ua(e,t){var r=e.alternate;return r===null?(r=Ai(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function m0(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")rw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Gl:return qs(r.children,o,i,t);case w3:a=8,o|=8;break;case tb:return e=Ai(12,r,t,o|2),e.elementType=tb,e.lanes=i,e;case rb:return e=Ai(13,r,t,o),e.elementType=rb,e.lanes=i,e;case nb:return e=Ai(19,r,t,o),e.elementType=nb,e.lanes=i,e;case IE:return g1(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case AE:a=10;break e;case ME:a=9;break e;case _3:a=11;break e;case x3:a=14;break e;case wa:a=16,n=null;break e}throw Error(Qe(130,e==null?e:typeof e,""))}return t=Ai(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function qs(e,t,r,n){return e=Ai(7,e,n,t),e.lanes=r,e}function g1(e,t,r,n){return e=Ai(22,e,n,t),e.elementType=IE,e.lanes=r,e.stateNode={isHidden:!1},e}function Om(e,t,r){return e=Ai(6,e,null,t),e.lanes=r,e}function Nm(e,t,r){return t=Ai(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vD(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gm(0),this.expirationTimes=gm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gm(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function nw(e,t,r,n,o,i,a,s,l){return e=new vD(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ai(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},F3(i),e}function yD(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}t(),e.exports=gi})(bN);const q_=dt.createContext(void 0),SD=dt.createContext(!1);function CD(e,t){return e||(t&&typeof window<"u"?(window.ReactQueryClientContext||(window.ReactQueryClientContext=q_),window.ReactQueryClientContext):q_)}const ED=({client:e,children:t,context:r,contextSharing:n=!1})=>{dt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]);const o=CD(r,n);return dt.createElement(SD.Provider,{value:!r&&n},dt.createElement(o.Provider,{value:e},t))};var Oe={},w1={};w1.byteLength=MD;w1.toByteArray=TD;w1.fromByteArray=RD;var co=[],Si=[],kD=typeof Uint8Array<"u"?Uint8Array:Array,Lm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ql=0,AD=Lm.length;ql0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function MD(e){var t=CA(e),r=t[0],n=t[1];return(r+n)*3/4-n}function ID(e,t,r){return(t+r)*3/4-r}function TD(e){var t,r=CA(e),n=r[0],o=r[1],i=new kD(ID(e,n,o)),a=0,s=o>0?n-4:n,l;for(l=0;l>16&255,i[a++]=t>>8&255,i[a++]=t&255;return o===2&&(t=Si[e.charCodeAt(l)]<<2|Si[e.charCodeAt(l+1)]>>4,i[a++]=t&255),o===1&&(t=Si[e.charCodeAt(l)]<<10|Si[e.charCodeAt(l+1)]<<4|Si[e.charCodeAt(l+2)]>>2,i[a++]=t>>8&255,i[a++]=t&255),i}function BD(e){return co[e>>18&63]+co[e>>12&63]+co[e>>6&63]+co[e&63]}function PD(e,t,r){for(var n,o=[],i=t;is?s:a+i));return n===1?(t=e[r-1],o.push(co[t>>2]+co[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(co[t>>10]+co[t>>4&63]+co[t<<2&63]+"=")),o.join("")}var sw={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */sw.read=function(e,t,r,n,o){var i,a,s=o*8-n-1,l=(1<>1,c=-7,h=r?o-1:0,d=r?-1:1,p=e[t+h];for(h+=d,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+e[t+h],h+=d,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+e[t+h],h+=d,c-=8);if(i===0)i=1-u;else{if(i===l)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-u}return(p?-1:1)*a*Math.pow(2,i-n)};sw.write=function(e,t,r,n,o,i){var a,s,l,u=i*8-o-1,c=(1<>1,d=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,v=n?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*l-1)*Math.pow(2,o),a=a+h):(s=t*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=s&255,p+=v,s/=256,o-=8);for(a=a<0;e[r+p]=a&255,p+=v,a/=256,u-=8);e[r+p-v]|=b*128};/*! +`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Pm(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Pb(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var YL=typeof WeakMap=="function"?WeakMap:Map;function Xk(e,t,r){r=Ko(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Y0||(Y0=!0,$b=n),Pb(e,t)},r}function Jk(e,t,r){r=Ko(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var o=t.value;r.payload=function(){return n(o)},r.callback=function(){Pb(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Pb(e,t),typeof n!="function"&&(La===null?La=new Set([this]):La.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function E_(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new YL;var o=new Set;n.set(t,o)}else o=n.get(t),o===void 0&&(o=new Set,n.set(t,o));o.has(r)||(o.add(r),e=cD.bind(null,e,t,r),t.then(e,e))}function k_(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function A_(e,t,r,n,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Ko(-1,1),t.tag=2,Na(r,t,1))),r.lanes|=1),e)}var QL=la.ReactCurrentOwner,Xn=!1;function On(e,t,r,n){t.child=e===null?Bk(t,null,r,n):Pu(t,e.child,r,n)}function M_(e,t,r,n,o){r=r.render;var i=t.ref;return wu(t,o),n=W3(e,t,r,n,i,o),r=V3(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,ia(e,t,o)):(kr&&r&&P3(t),t.flags|=1,On(e,t,n,o),t.child)}function I_(e,t,r,n,o){if(e===null){var i=r.type;return typeof i=="function"&&!tw(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,eA(e,t,i,n,o)):(e=m0(r.type,null,n,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:Xf,r(a,n)&&e.ref===t.ref)return ia(e,t,o)}return t.flags|=1,e=Ua(i,n),e.ref=t.ref,e.return=t,t.child=e}function eA(e,t,r,n,o){if(e!==null){var i=e.memoizedProps;if(Xf(i,n)&&e.ref===t.ref)if(Xn=!1,t.pendingProps=n=i,(e.lanes&o)!==0)e.flags&131072&&(Xn=!0);else return t.lanes=e.lanes,ia(e,t,o)}return Rb(e,t,r,n,o)}function tA(e,t,r){var n=t.pendingProps,o=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},wr(ou,si),si|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,wr(ou,si),si|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,wr(ou,si),si|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,wr(ou,si),si|=n;return On(e,t,o,r),t.child}function rA(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Rb(e,t,r,n,o){var i=ti(r)?Gs:In.current;return i=Tu(t,i),wu(t,o),r=W3(e,t,r,n,i,o),n=V3(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,ia(e,t,o)):(kr&&n&&P3(t),t.flags|=1,On(e,t,r,o),t.child)}function T_(e,t,r,n,o){if(ti(r)){var i=!0;F0(t)}else i=!1;if(wu(t,o),t.stateNode===null)h0(e,t),Ik(t,r,n),Bb(t,r,n,o),n=!0;else if(e===null){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,u=r.contextType;typeof u=="object"&&u!==null?u=Bi(u):(u=ti(r)?Gs:In.current,u=Tu(t,u));var c=r.getDerivedStateFromProps,h=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==n||l!==u)&&__(t,a,n,u),_a=!1;var d=t.memoizedState;a.state=d,V0(t,n,a,o),l=t.memoizedState,s!==n||d!==l||ei.current||_a?(typeof c=="function"&&(Tb(t,r,c,n),l=t.memoizedState),(s=_a||w_(t,r,s,n,d,l,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=l),a.props=n,a.state=l,a.context=u,n=s):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,Ak(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:Di(t.type,s),a.props=u,h=t.pendingProps,d=a.context,l=r.contextType,typeof l=="object"&&l!==null?l=Bi(l):(l=ti(r)?Gs:In.current,l=Tu(t,l));var p=r.getDerivedStateFromProps;(c=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==h||d!==l)&&__(t,a,n,l),_a=!1,d=t.memoizedState,a.state=d,V0(t,n,a,o);var v=t.memoizedState;s!==h||d!==v||ei.current||_a?(typeof p=="function"&&(Tb(t,r,p,n),v=t.memoizedState),(u=_a||w_(t,r,u,n,d,v,l)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,v,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,v,l)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=v),a.props=n,a.state=v,a.context=l,n=u):(typeof a.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return Ob(e,t,r,n,i,o)}function Ob(e,t,r,n,o,i){rA(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return o&&g_(t,r,!1),ia(e,t,i);n=t.stateNode,QL.current=t;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=Pu(t,e.child,null,i),t.child=Pu(t,null,s,i)):On(e,t,s,i),t.memoizedState=n.state,o&&g_(t,r,!0),t.child}function nA(e){var t=e.stateNode;t.pendingContext?p_(e,t.pendingContext,t.pendingContext!==t.context):t.context&&p_(e,t.context,!1),F3(e,t.containerInfo)}function B_(e,t,r,n,o){return Bu(),O3(o),t.flags|=256,On(e,t,r,n),t.child}var Nb={dehydrated:null,treeContext:null,retryLane:0};function Lb(e){return{baseLanes:e,cachePool:null,transitions:null}}function iA(e,t,r){var n=t.pendingProps,o=Ir.current,i=!1,a=(t.flags&128)!==0,s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:(o&2)!==0),s?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),wr(Ir,o&1),e===null)return Mb(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=n.children,e=n.fallback,i?(n=t.mode,i=t.child,a={mode:"hidden",children:a},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=g1(a,n,0,null),e=qs(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Lb(r),t.memoizedState=Nb,e):Z3(t,a));if(o=e.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return XL(e,t,a,n,s,o,r);if(i){i=n.fallback,a=t.mode,o=e.child,s=o.sibling;var l={mode:"hidden",children:n.children};return!(a&1)&&t.child!==o?(n=t.child,n.childLanes=0,n.pendingProps=l,t.deletions=null):(n=Ua(o,l),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=Ua(s,i):(i=qs(i,a,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,a=e.child.memoizedState,a=a===null?Lb(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=Nb,n}return i=e.child,e=i.sibling,n=Ua(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Z3(e,t){return t=g1({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Rh(e,t,r,n){return n!==null&&O3(n),Pu(t,e.child,null,r),e=Z3(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function XL(e,t,r,n,o,i,a){if(r)return t.flags&256?(t.flags&=-257,n=Pm(Error(Qe(422))),Rh(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,o=t.mode,n=g1({mode:"visible",children:n.children},o,0,null),i=qs(i,o,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Pu(t,e.child,null,a),t.child.memoizedState=Lb(a),t.memoizedState=Nb,i);if(!(t.mode&1))return Rh(e,t,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Qe(419)),n=Pm(i,n,void 0),Rh(e,t,a,n)}if(s=(a&e.childLanes)!==0,Xn||s){if(n=sn,n!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(n.suspendedLanes|a)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,na(e,o),Gi(n,e,o,-1))}return ew(),n=Pm(Error(Qe(421))),Rh(e,t,a,n)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=fD.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,li=Oa(o.nextSibling),ci=t,kr=!0,Fi=null,e!==null&&(Ci[Ei++]=zo,Ci[Ei++]=$o,Ci[Ei++]=Ys,zo=e.id,$o=e.overflow,Ys=t),t=Z3(t,n.children),t.flags|=4096,t)}function P_(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Ib(e.return,t,r)}function Rm(e,t,r,n,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function oA(e,t,r){var n=t.pendingProps,o=n.revealOrder,i=n.tail;if(On(e,t,n.children,r),n=Ir.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&P_(e,r,t);else if(e.tag===19)P_(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(wr(Ir,n),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(r=t.child,o=null;r!==null;)e=r.alternate,e!==null&&H0(e)===null&&(o=r),r=r.sibling;r=o,r===null?(o=t.child,t.child=null):(o=r.sibling,r.sibling=null),Rm(t,!1,o,r,i);break;case"backwards":for(r=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&H0(e)===null){t.child=o;break}e=o.sibling,o.sibling=r,r=o,o=e}Rm(t,!0,r,null,i);break;case"together":Rm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function h0(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ia(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Xs|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Qe(153));if(t.child!==null){for(e=t.child,r=Ua(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ua(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function JL(e,t,r){switch(t.tag){case 3:nA(t),Bu();break;case 5:Pk(t);break;case 1:ti(t.type)&&F0(t);break;case 4:F3(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,o=t.memoizedProps.value;wr(q0,n._currentValue),n._currentValue=o;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(wr(Ir,Ir.current&1),t.flags|=128,null):r&t.child.childLanes?iA(e,t,r):(wr(Ir,Ir.current&1),e=ia(e,t,r),e!==null?e.sibling:null);wr(Ir,Ir.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return oA(e,t,r);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),wr(Ir,Ir.current),n)break;return null;case 22:case 23:return t.lanes=0,tA(e,t,r)}return ia(e,t,r)}var aA,Db,sA,lA;aA=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Db=function(){};sA=function(e,t,r,n){var o=e.memoizedProps;if(o!==n){e=t.stateNode,Ds(vo.current);var i=null;switch(r){case"input":o=ob(e,o),n=ob(e,n),i=[];break;case"select":o=Pr({},o,{value:void 0}),n=Pr({},n,{value:void 0}),i=[];break;case"textarea":o=lb(e,o),n=lb(e,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=U0)}cb(r,n);var a;r=null;for(u in o)if(!n.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var s=o[u];for(a in s)s.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Vf.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var l=n[u];if(s=o!=null?o[u]:void 0,n.hasOwnProperty(u)&&l!==s&&(l!=null||s!=null))if(u==="style")if(s){for(a in s)!s.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in l)l.hasOwnProperty(a)&&s[a]!==l[a]&&(r||(r={}),r[a]=l[a])}else r||(i||(i=[]),i.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,s=s?s.__html:void 0,l!=null&&s!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Vf.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&_r("scroll",e),i||s===l||(i=[])):(i=i||[]).push(u,l))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};lA=function(e,t,r,n){r!==n&&(t.flags|=4)};function Tc(e,t){if(!kr)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function xn(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function eD(e,t,r){var n=t.pendingProps;switch(R3(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xn(t),null;case 1:return ti(t.type)&&j0(),xn(t),null;case 3:return n=t.stateNode,Ru(),Er(ei),Er(In),$3(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Bh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi!==null&&(Vb(Fi),Fi=null))),Db(e,t),xn(t),null;case 5:z3(t);var o=Ds(nd.current);if(r=t.type,e!==null&&t.stateNode!=null)sA(e,t,r,n,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Qe(166));return xn(t),null}if(e=Ds(vo.current),Bh(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[uo]=t,n[td]=i,e=(t.mode&1)!==0,r){case"dialog":_r("cancel",n),_r("close",n);break;case"iframe":case"object":case"embed":_r("load",n);break;case"video":case"audio":for(o=0;o<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[uo]=t,e[td]=n,aA(e,t,!1,!1),t.stateNode=e;e:{switch(a=fb(r,n),r){case"dialog":_r("cancel",e),_r("close",e),o=n;break;case"iframe":case"object":case"embed":_r("load",e),o=n;break;case"video":case"audio":for(o=0;oNu&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304)}else{if(!n)if(e=H0(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Tc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!kr)return xn(t),null}else 2*zr()-i.renderingStartTime>Nu&&r!==1073741824&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=zr(),t.sibling=null,r=Ir.current,wr(Ir,n?r&1|2:r&1),t):(xn(t),null);case 22:case 23:return J3(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?si&1073741824&&(xn(t),t.subtreeFlags&6&&(t.flags|=8192)):xn(t),null;case 24:return null;case 25:return null}throw Error(Qe(156,t.tag))}function tD(e,t){switch(R3(t),t.tag){case 1:return ti(t.type)&&j0(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ru(),Er(ei),Er(In),$3(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return z3(t),null;case 13:if(Er(Ir),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Qe(340));Bu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Er(Ir),null;case 4:return Ru(),null;case 10:return D3(t.type._context),null;case 22:case 23:return J3(),null;case 24:return null;default:return null}}var Oh=!1,Cn=!1,rD=typeof WeakSet=="function"?WeakSet:Set,mt=null;function iu(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Lr(e,t,n)}else r.current=null}function Ub(e,t,r){try{r()}catch(n){Lr(e,t,n)}}var R_=!1;function nD(e,t){if(_b=N0,e=dk(),B3(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,l=-1,u=0,c=0,h=e,d=null;t:for(;;){for(var p;h!==r||o!==0&&h.nodeType!==3||(s=a+o),h!==i||n!==0&&h.nodeType!==3||(l=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)d=h,h=p;for(;;){if(h===e)break t;if(d===r&&++u===o&&(s=a),d===i&&++c===n&&(l=a),(p=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(xb={focusedElem:e,selectionRange:r},N0=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){t=mt;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var b=v.memoizedProps,S=v.memoizedState,x=t.stateNode,k=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:Di(t.type,b),S);x.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Qe(163))}}catch(P){Lr(t,t.return,P)}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}return v=R_,R_=!1,v}function Sf(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Ub(t,r,i)}o=o.next}while(o!==n)}}function h1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function jb(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function uA(e){var t=e.alternate;t!==null&&(e.alternate=null,uA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[uo],delete t[td],delete t[Eb],delete t[jL],delete t[FL])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function cA(e){return e.tag===5||e.tag===3||e.tag===4}function O_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cA(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fb(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=U0));else if(n!==4&&(e=e.child,e!==null))for(Fb(e,t,r),e=e.sibling;e!==null;)Fb(e,t,r),e=e.sibling}function zb(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(zb(e,t,r),e=e.sibling;e!==null;)zb(e,t,r),e=e.sibling}var hn=null,Ui=!1;function ma(e,t,r){for(r=r.child;r!==null;)fA(e,t,r),r=r.sibling}function fA(e,t,r){if(mo&&typeof mo.onCommitFiberUnmount=="function")try{mo.onCommitFiberUnmount(o1,r)}catch{}switch(r.tag){case 5:Cn||iu(r,t);case 6:var n=hn,o=Ui;hn=null,ma(e,t,r),hn=n,Ui=o,hn!==null&&(Ui?(e=hn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):hn.removeChild(r.stateNode));break;case 18:hn!==null&&(Ui?(e=hn,r=r.stateNode,e.nodeType===8?km(e.parentNode,r):e.nodeType===1&&km(e,r),Yf(e)):km(hn,r.stateNode));break;case 4:n=hn,o=Ui,hn=r.stateNode.containerInfo,Ui=!0,ma(e,t,r),hn=n,Ui=o;break;case 0:case 11:case 14:case 15:if(!Cn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Ub(r,t,a),o=o.next}while(o!==n)}ma(e,t,r);break;case 1:if(!Cn&&(iu(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Lr(r,t,s)}ma(e,t,r);break;case 21:ma(e,t,r);break;case 22:r.mode&1?(Cn=(n=Cn)||r.memoizedState!==null,ma(e,t,r),Cn=n):ma(e,t,r);break;default:ma(e,t,r)}}function N_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new rD),t.forEach(function(n){var o=dD.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Ni(e,t){var r=t.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=zr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*oD(n/1960))-n,10e?16:e,Ma===null)var n=!1;else{if(e=Ma,Ma=null,Q0=0,or&6)throw Error(Qe(331));var o=or;for(or|=4,mt=e.current;mt!==null;){var i=mt,a=i.child;if(mt.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lzr()-Q3?$s(e,0):Y3|=r),ri(e,t)}function bA(e,t){t===0&&(e.mode&1?(t=Eh,Eh<<=1,!(Eh&130023424)&&(Eh=4194304)):t=1);var r=Fn();e=na(e,t),e!==null&&(Ud(e,t,r),ri(e,r))}function fD(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),bA(e,r)}function dD(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Qe(314))}n!==null&&n.delete(t),bA(e,r)}var wA;wA=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ei.current)Xn=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Xn=!1,JL(e,t,r);Xn=!!(e.flags&131072)}else Xn=!1,kr&&t.flags&1048576&&Sk(t,$0,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;h0(e,t),e=t.pendingProps;var o=Tu(t,In.current);wu(t,r),o=W3(null,t,n,e,o,r);var i=V3();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ti(n)?(i=!0,F0(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,j3(t),o.updater=f1,t.stateNode=o,o._reactInternals=t,Bb(t,n,e,r),t=Ob(null,t,n,!0,i,r)):(t.tag=0,kr&&i&&P3(t),On(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(h0(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=pD(n),e=Di(n,e),o){case 0:t=Rb(null,t,n,e,r);break e;case 1:t=T_(null,t,n,e,r);break e;case 11:t=M_(null,t,n,e,r);break e;case 14:t=I_(null,t,n,Di(n.type,e),r);break e}throw Error(Qe(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),Rb(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),T_(e,t,n,o,r);case 3:e:{if(nA(t),e===null)throw Error(Qe(387));n=t.pendingProps,i=t.memoizedState,o=i.element,Ak(e,t),V0(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ou(Error(Qe(423)),t),t=B_(e,t,n,r,o);break e}else if(n!==o){o=Ou(Error(Qe(424)),t),t=B_(e,t,n,r,o);break e}else for(li=Oa(t.stateNode.containerInfo.firstChild),ci=t,kr=!0,Fi=null,r=Bk(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Bu(),n===o){t=ia(e,t,r);break e}On(e,t,n,r)}t=t.child}return t;case 5:return Pk(t),e===null&&Mb(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,Sb(n,o)?a=null:i!==null&&Sb(n,i)&&(t.flags|=32),rA(e,t),On(e,t,a,r),t.child;case 6:return e===null&&Mb(t),null;case 13:return iA(e,t,r);case 4:return F3(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Pu(t,null,n,r):On(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),M_(e,t,n,o,r);case 7:return On(e,t,t.pendingProps,r),t.child;case 8:return On(e,t,t.pendingProps.children,r),t.child;case 12:return On(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,wr(q0,n._currentValue),n._currentValue=a,i!==null)if(Ji(i.value,a)){if(i.children===o.children&&!ei.current){t=ia(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=Ko(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Ib(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Ib(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}On(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,wu(t,r),o=Bi(o),n=n(o),t.flags|=1,On(e,t,n,r),t.child;case 14:return n=t.type,o=Di(n,t.pendingProps),o=Di(n.type,o),I_(e,t,n,o,r);case 15:return eA(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Di(n,o),h0(e,t),t.tag=1,ti(n)?(e=!0,F0(t)):e=!1,wu(t,r),Ik(t,n,o),Bb(t,n,o,r),Ob(null,t,n,!0,e,r);case 19:return oA(e,t,r);case 22:return tA(e,t,r)}throw Error(Qe(156,t.tag))};function _A(e,t){return KE(e,t)}function hD(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(e,t,r,n){return new hD(e,t,r,n)}function tw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pD(e){if(typeof e=="function")return tw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===w3)return 11;if(e===_3)return 14}return 2}function Ua(e,t){var r=e.alternate;return r===null?(r=Ai(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function m0(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")tw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Gl:return qs(r.children,o,i,t);case b3:a=8,o|=8;break;case tb:return e=Ai(12,r,t,o|2),e.elementType=tb,e.lanes=i,e;case rb:return e=Ai(13,r,t,o),e.elementType=rb,e.lanes=i,e;case nb:return e=Ai(19,r,t,o),e.elementType=nb,e.lanes=i,e;case TE:return g1(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ME:a=10;break e;case IE:a=9;break e;case w3:a=11;break e;case _3:a=14;break e;case wa:a=16,n=null;break e}throw Error(Qe(130,e==null?e:typeof e,""))}return t=Ai(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function qs(e,t,r,n){return e=Ai(7,e,n,t),e.lanes=r,e}function g1(e,t,r,n){return e=Ai(22,e,n,t),e.elementType=TE,e.lanes=r,e.stateNode={isHidden:!1},e}function Om(e,t,r){return e=Ai(6,e,null,t),e.lanes=r,e}function Nm(e,t,r){return t=Ai(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gD(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gm(0),this.expirationTimes=gm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gm(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function rw(e,t,r,n,o,i,a,s,l){return e=new gD(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ai(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},j3(i),e}function mD(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}t(),e.exports=gi})(vN);const q_=dt.createContext(void 0),_D=dt.createContext(!1);function xD(e,t){return e||(t&&typeof window<"u"?(window.ReactQueryClientContext||(window.ReactQueryClientContext=q_),window.ReactQueryClientContext):q_)}const SD=({client:e,children:t,context:r,contextSharing:n=!1})=>{dt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]);const o=xD(r,n);return dt.createElement(_D.Provider,{value:!r&&n},dt.createElement(o.Provider,{value:e},t))};var Oe={},w1={};w1.byteLength=kD;w1.toByteArray=MD;w1.fromByteArray=BD;var co=[],Si=[],CD=typeof Uint8Array<"u"?Uint8Array:Array,Lm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ql=0,ED=Lm.length;ql0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function kD(e){var t=EA(e),r=t[0],n=t[1];return(r+n)*3/4-n}function AD(e,t,r){return(t+r)*3/4-r}function MD(e){var t,r=EA(e),n=r[0],o=r[1],i=new CD(AD(e,n,o)),a=0,s=o>0?n-4:n,l;for(l=0;l>16&255,i[a++]=t>>8&255,i[a++]=t&255;return o===2&&(t=Si[e.charCodeAt(l)]<<2|Si[e.charCodeAt(l+1)]>>4,i[a++]=t&255),o===1&&(t=Si[e.charCodeAt(l)]<<10|Si[e.charCodeAt(l+1)]<<4|Si[e.charCodeAt(l+2)]>>2,i[a++]=t>>8&255,i[a++]=t&255),i}function ID(e){return co[e>>18&63]+co[e>>12&63]+co[e>>6&63]+co[e&63]}function TD(e,t,r){for(var n,o=[],i=t;is?s:a+i));return n===1?(t=e[r-1],o.push(co[t>>2]+co[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(co[t>>10]+co[t>>4&63]+co[t<<2&63]+"=")),o.join("")}var aw={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */aw.read=function(e,t,r,n,o){var i,a,s=o*8-n-1,l=(1<>1,c=-7,h=r?o-1:0,d=r?-1:1,p=e[t+h];for(h+=d,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+e[t+h],h+=d,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+e[t+h],h+=d,c-=8);if(i===0)i=1-u;else{if(i===l)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-u}return(p?-1:1)*a*Math.pow(2,i-n)};aw.write=function(e,t,r,n,o,i){var a,s,l,u=i*8-o-1,c=(1<>1,d=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,v=n?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*l-1)*Math.pow(2,o),a=a+h):(s=t*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=s&255,p+=v,s/=256,o-=8);for(a=a<0;e[r+p]=a&255,p+=v,a/=256,u-=8);e[r+p-v]|=b*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(e){var t=w1,r=sw,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=i(),!s.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 i(){try{var Q=new Uint8Array(1),N={foo:function(){return 42}};return Object.setPrototypeOf(N,Uint8Array.prototype),Object.setPrototypeOf(Q,N),Q.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function a(Q){if(Q>o)throw new RangeError('The value "'+Q+'" is invalid for option "size"');var N=new Uint8Array(Q);return Object.setPrototypeOf(N,s.prototype),N}function s(Q,N,D){if(typeof Q=="number"){if(typeof N=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(Q)}return l(Q,N,D)}s.poolSize=8192;function l(Q,N,D){if(typeof Q=="string")return d(Q,N);if(ArrayBuffer.isView(Q))return v(Q);if(Q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q);if(ye(Q,ArrayBuffer)||Q&&ye(Q.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(Q,SharedArrayBuffer)||Q&&ye(Q.buffer,SharedArrayBuffer)))return b(Q,N,D);if(typeof Q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var G=Q.valueOf&&Q.valueOf();if(G!=null&&G!==Q)return s.from(G,N,D);var me=S(Q);if(me)return me;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Q[Symbol.toPrimitive]=="function")return s.from(Q[Symbol.toPrimitive]("string"),N,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q)}s.from=function(Q,N,D){return l(Q,N,D)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(Q){if(typeof Q!="number")throw new TypeError('"size" argument must be of type number');if(Q<0)throw new RangeError('The value "'+Q+'" is invalid for option "size"')}function c(Q,N,D){return u(Q),Q<=0?a(Q):N!==void 0?typeof D=="string"?a(Q).fill(N,D):a(Q).fill(N):a(Q)}s.alloc=function(Q,N,D){return c(Q,N,D)};function h(Q){return u(Q),a(Q<0?0:x(Q)|0)}s.allocUnsafe=function(Q){return h(Q)},s.allocUnsafeSlow=function(Q){return h(Q)};function d(Q,N){if((typeof N!="string"||N==="")&&(N="utf8"),!s.isEncoding(N))throw new TypeError("Unknown encoding: "+N);var D=M(Q,N)|0,G=a(D),me=G.write(Q,N);return me!==D&&(G=G.slice(0,me)),G}function p(Q){for(var N=Q.length<0?0:x(Q.length)|0,D=a(N),G=0;G=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return Q|0}function k(Q){return+Q!=Q&&(Q=0),s.alloc(+Q)}s.isBuffer=function(N){return N!=null&&N._isBuffer===!0&&N!==s.prototype},s.compare=function(N,D){if(ye(N,Uint8Array)&&(N=s.from(N,N.offset,N.byteLength)),ye(D,Uint8Array)&&(D=s.from(D,D.offset,D.byteLength)),!s.isBuffer(N)||!s.isBuffer(D))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(N===D)return 0;for(var G=N.length,me=D.length,_e=0,Pe=Math.min(G,me);_eme.length?s.from(Pe).copy(me,_e):Uint8Array.prototype.set.call(me,Pe,_e);else if(s.isBuffer(Pe))Pe.copy(me,_e);else throw new TypeError('"list" argument must be an Array of Buffers');_e+=Pe.length}return me};function M(Q,N){if(s.isBuffer(Q))return Q.length;if(ArrayBuffer.isView(Q)||ye(Q,ArrayBuffer))return Q.byteLength;if(typeof Q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Q);var D=Q.length,G=arguments.length>2&&arguments[2]===!0;if(!G&&D===0)return 0;for(var me=!1;;)switch(N){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return X(Q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return W(Q).length;default:if(me)return G?-1:X(Q).length;N=(""+N).toLowerCase(),me=!0}}s.byteLength=M;function P(Q,N,D){var G=!1;if((N===void 0||N<0)&&(N=0),N>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,N>>>=0,D<=N))return"";for(Q||(Q="utf8");;)switch(Q){case"hex":return E(this,N,D);case"utf8":case"utf-8":return f(this,N,D);case"ascii":return A(this,N,D);case"latin1":case"binary":return T(this,N,D);case"base64":return y(this,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,N,D);default:if(G)throw new TypeError("Unknown encoding: "+Q);Q=(Q+"").toLowerCase(),G=!0}}s.prototype._isBuffer=!0;function L(Q,N,D){var G=Q[N];Q[N]=Q[D],Q[D]=G}s.prototype.swap16=function(){var N=this.length;if(N%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var D=0;DD&&(N+=" ... "),""},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(N,D,G,me,_e){if(ye(N,Uint8Array)&&(N=s.from(N,N.offset,N.byteLength)),!s.isBuffer(N))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof N);if(D===void 0&&(D=0),G===void 0&&(G=N?N.length:0),me===void 0&&(me=0),_e===void 0&&(_e=this.length),D<0||G>N.length||me<0||_e>this.length)throw new RangeError("out of range index");if(me>=_e&&D>=G)return 0;if(me>=_e)return-1;if(D>=G)return 1;if(D>>>=0,G>>>=0,me>>>=0,_e>>>=0,this===N)return 0;for(var Pe=_e-me,Fe=G-D,Re=Math.min(Pe,Fe),le=this.slice(me,_e),Y=N.slice(D,G),re=0;re2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,xe(D)&&(D=me?0:Q.length-1),D<0&&(D=Q.length+D),D>=Q.length){if(me)return-1;D=Q.length-1}else if(D<0)if(me)D=0;else return-1;if(typeof N=="string"&&(N=s.from(N,G)),s.isBuffer(N))return N.length===0?-1:V(Q,N,D,G,me);if(typeof N=="number")return N=N&255,typeof Uint8Array.prototype.indexOf=="function"?me?Uint8Array.prototype.indexOf.call(Q,N,D):Uint8Array.prototype.lastIndexOf.call(Q,N,D):V(Q,[N],D,G,me);throw new TypeError("val must be string, number or Buffer")}function V(Q,N,D,G,me){var _e=1,Pe=Q.length,Fe=N.length;if(G!==void 0&&(G=String(G).toLowerCase(),G==="ucs2"||G==="ucs-2"||G==="utf16le"||G==="utf-16le")){if(Q.length<2||N.length<2)return-1;_e=2,Pe/=2,Fe/=2,D/=2}function Re(be,ce){return _e===1?be[ce]:be.readUInt16BE(ce*_e)}var le;if(me){var Y=-1;for(le=D;lePe&&(D=Pe-Fe),le=D;le>=0;le--){for(var re=!0,ge=0;geme&&(G=me)):G=me;var _e=N.length;G>_e/2&&(G=_e/2);for(var Pe=0;Pe>>0,isFinite(G)?(G=G>>>0,me===void 0&&(me="utf8")):(me=G,G=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var _e=this.length-D;if((G===void 0||G>_e)&&(G=_e),N.length>0&&(G<0||D<0)||D>this.length)throw new RangeError("Attempt to write outside buffer bounds");me||(me="utf8");for(var Pe=!1;;)switch(me){case"hex":return K(this,N,D,G);case"utf8":case"utf-8":return Z(this,N,D,G);case"ascii":case"latin1":case"binary":return ue(this,N,D,G);case"base64":return U(this,N,D,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,N,D,G);default:if(Pe)throw new TypeError("Unknown encoding: "+me);me=(""+me).toLowerCase(),Pe=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y(Q,N,D){return N===0&&D===Q.length?t.fromByteArray(Q):t.fromByteArray(Q.slice(N,D))}function f(Q,N,D){D=Math.min(Q.length,D);for(var G=[],me=N;me239?4:_e>223?3:_e>191?2:1;if(me+Fe<=D){var Re,le,Y,re;switch(Fe){case 1:_e<128&&(Pe=_e);break;case 2:Re=Q[me+1],(Re&192)===128&&(re=(_e&31)<<6|Re&63,re>127&&(Pe=re));break;case 3:Re=Q[me+1],le=Q[me+2],(Re&192)===128&&(le&192)===128&&(re=(_e&15)<<12|(Re&63)<<6|le&63,re>2047&&(re<55296||re>57343)&&(Pe=re));break;case 4:Re=Q[me+1],le=Q[me+2],Y=Q[me+3],(Re&192)===128&&(le&192)===128&&(Y&192)===128&&(re=(_e&15)<<18|(Re&63)<<12|(le&63)<<6|Y&63,re>65535&&re<1114112&&(Pe=re))}}Pe===null?(Pe=65533,Fe=1):Pe>65535&&(Pe-=65536,G.push(Pe>>>10&1023|55296),Pe=56320|Pe&1023),G.push(Pe),me+=Fe}return w(G)}var g=4096;function w(Q){var N=Q.length;if(N<=g)return String.fromCharCode.apply(String,Q);for(var D="",G=0;GG)&&(D=G);for(var me="",_e=N;_eG&&(N=G),D<0?(D+=G,D<0&&(D=0)):D>G&&(D=G),DD)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N],_e=1,Pe=0;++Pe>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N+--D],_e=1;D>0&&(_e*=256);)me+=this[N+--D]*_e;return me},s.prototype.readUint8=s.prototype.readUInt8=function(N,D){return N=N>>>0,D||I(N,1,this.length),this[N]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(N,D){return N=N>>>0,D||I(N,2,this.length),this[N]|this[N+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(N,D){return N=N>>>0,D||I(N,2,this.length),this[N]<<8|this[N+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(N,D){return N=N>>>0,D||I(N,4,this.length),(this[N]|this[N+1]<<8|this[N+2]<<16)+this[N+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]*16777216+(this[N+1]<<16|this[N+2]<<8|this[N+3])},s.prototype.readIntLE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N],_e=1,Pe=0;++Pe=_e&&(me-=Math.pow(2,8*D)),me},s.prototype.readIntBE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=D,_e=1,Pe=this[N+--me];me>0&&(_e*=256);)Pe+=this[N+--me]*_e;return _e*=128,Pe>=_e&&(Pe-=Math.pow(2,8*D)),Pe},s.prototype.readInt8=function(N,D){return N=N>>>0,D||I(N,1,this.length),this[N]&128?(255-this[N]+1)*-1:this[N]},s.prototype.readInt16LE=function(N,D){N=N>>>0,D||I(N,2,this.length);var G=this[N]|this[N+1]<<8;return G&32768?G|4294901760:G},s.prototype.readInt16BE=function(N,D){N=N>>>0,D||I(N,2,this.length);var G=this[N+1]|this[N]<<8;return G&32768?G|4294901760:G},s.prototype.readInt32LE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]|this[N+1]<<8|this[N+2]<<16|this[N+3]<<24},s.prototype.readInt32BE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]<<24|this[N+1]<<16|this[N+2]<<8|this[N+3]},s.prototype.readFloatLE=function(N,D){return N=N>>>0,D||I(N,4,this.length),r.read(this,N,!0,23,4)},s.prototype.readFloatBE=function(N,D){return N=N>>>0,D||I(N,4,this.length),r.read(this,N,!1,23,4)},s.prototype.readDoubleLE=function(N,D){return N=N>>>0,D||I(N,8,this.length),r.read(this,N,!0,52,8)},s.prototype.readDoubleBE=function(N,D){return N=N>>>0,D||I(N,8,this.length),r.read(this,N,!1,52,8)};function m(Q,N,D,G,me,_e){if(!s.isBuffer(Q))throw new TypeError('"buffer" argument must be a Buffer instance');if(N>me||N<_e)throw new RangeError('"value" argument is out of bounds');if(D+G>Q.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(N,D,G,me){if(N=+N,D=D>>>0,G=G>>>0,!me){var _e=Math.pow(2,8*G)-1;m(this,N,D,G,_e,0)}var Pe=1,Fe=0;for(this[D]=N&255;++Fe>>0,G=G>>>0,!me){var _e=Math.pow(2,8*G)-1;m(this,N,D,G,_e,0)}var Pe=G-1,Fe=1;for(this[D+Pe]=N&255;--Pe>=0&&(Fe*=256);)this[D+Pe]=N/Fe&255;return D+G},s.prototype.writeUint8=s.prototype.writeUInt8=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,1,255,0),this[D]=N&255,D+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,65535,0),this[D]=N&255,this[D+1]=N>>>8,D+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,65535,0),this[D]=N>>>8,this[D+1]=N&255,D+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,4294967295,0),this[D+3]=N>>>24,this[D+2]=N>>>16,this[D+1]=N>>>8,this[D]=N&255,D+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,4294967295,0),this[D]=N>>>24,this[D+1]=N>>>16,this[D+2]=N>>>8,this[D+3]=N&255,D+4},s.prototype.writeIntLE=function(N,D,G,me){if(N=+N,D=D>>>0,!me){var _e=Math.pow(2,8*G-1);m(this,N,D,G,_e-1,-_e)}var Pe=0,Fe=1,Re=0;for(this[D]=N&255;++Pe>0)-Re&255;return D+G},s.prototype.writeIntBE=function(N,D,G,me){if(N=+N,D=D>>>0,!me){var _e=Math.pow(2,8*G-1);m(this,N,D,G,_e-1,-_e)}var Pe=G-1,Fe=1,Re=0;for(this[D+Pe]=N&255;--Pe>=0&&(Fe*=256);)N<0&&Re===0&&this[D+Pe+1]!==0&&(Re=1),this[D+Pe]=(N/Fe>>0)-Re&255;return D+G},s.prototype.writeInt8=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,1,127,-128),N<0&&(N=255+N+1),this[D]=N&255,D+1},s.prototype.writeInt16LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,32767,-32768),this[D]=N&255,this[D+1]=N>>>8,D+2},s.prototype.writeInt16BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,32767,-32768),this[D]=N>>>8,this[D+1]=N&255,D+2},s.prototype.writeInt32LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,2147483647,-2147483648),this[D]=N&255,this[D+1]=N>>>8,this[D+2]=N>>>16,this[D+3]=N>>>24,D+4},s.prototype.writeInt32BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,2147483647,-2147483648),N<0&&(N=4294967295+N+1),this[D]=N>>>24,this[D+1]=N>>>16,this[D+2]=N>>>8,this[D+3]=N&255,D+4};function B(Q,N,D,G,me,_e){if(D+G>Q.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function ne(Q,N,D,G,me){return N=+N,D=D>>>0,me||B(Q,N,D,4),r.write(Q,N,D,G,23,4),D+4}s.prototype.writeFloatLE=function(N,D,G){return ne(this,N,D,!0,G)},s.prototype.writeFloatBE=function(N,D,G){return ne(this,N,D,!1,G)};function de(Q,N,D,G,me){return N=+N,D=D>>>0,me||B(Q,N,D,8),r.write(Q,N,D,G,52,8),D+8}s.prototype.writeDoubleLE=function(N,D,G){return de(this,N,D,!0,G)},s.prototype.writeDoubleBE=function(N,D,G){return de(this,N,D,!1,G)},s.prototype.copy=function(N,D,G,me){if(!s.isBuffer(N))throw new TypeError("argument should be a Buffer");if(G||(G=0),!me&&me!==0&&(me=this.length),D>=N.length&&(D=N.length),D||(D=0),me>0&&me=this.length)throw new RangeError("Index out of range");if(me<0)throw new RangeError("sourceEnd out of bounds");me>this.length&&(me=this.length),N.length-D>>0,G=G===void 0?this.length:G>>>0,N||(N=0);var Pe;if(typeof N=="number")for(Pe=D;Pe55295&&D<57344){if(!me){if(D>56319){(N-=3)>-1&&_e.push(239,191,189);continue}else if(Pe+1===G){(N-=3)>-1&&_e.push(239,191,189);continue}me=D;continue}if(D<56320){(N-=3)>-1&&_e.push(239,191,189),me=D;continue}D=(me-55296<<10|D-56320)+65536}else me&&(N-=3)>-1&&_e.push(239,191,189);if(me=null,D<128){if((N-=1)<0)break;_e.push(D)}else if(D<2048){if((N-=2)<0)break;_e.push(D>>6|192,D&63|128)}else if(D<65536){if((N-=3)<0)break;_e.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((N-=4)<0)break;_e.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return _e}function se(Q){for(var N=[],D=0;D>8,me=D%256,_e.push(me),_e.push(G);return _e}function W(Q){return t.toByteArray(he(Q))}function q(Q,N,D,G){for(var me=0;me=N.length||me>=Q.length);++me)N[me+D]=Q[me];return me}function ye(Q,N){return Q instanceof N||Q!=null&&Q.constructor!=null&&Q.constructor.name!=null&&Q.constructor.name===N.name}function xe(Q){return Q!==Q}var Me=function(){for(var Q="0123456789abcdef",N=new Array(256),D=0;D<16;++D)for(var G=D*16,me=0;me<16;++me)N[G+me]=Q[D]+Q[me];return N}()})(Oe);var _t={},OD={get exports(){return _t},set exports(e){_t=e}},qr=OD.exports={},so,lo;function Hb(){throw new Error("setTimeout has not been defined")}function Kb(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?so=setTimeout:so=Hb}catch{so=Hb}try{typeof clearTimeout=="function"?lo=clearTimeout:lo=Kb}catch{lo=Kb}})();function EA(e){if(so===setTimeout)return setTimeout(e,0);if((so===Hb||!so)&&setTimeout)return so=setTimeout,setTimeout(e,0);try{return so(e,0)}catch{try{return so.call(null,e,0)}catch{return so.call(this,e,0)}}}function ND(e){if(lo===clearTimeout)return clearTimeout(e);if((lo===Kb||!lo)&&clearTimeout)return lo=clearTimeout,clearTimeout(e);try{return lo(e)}catch{try{return lo.call(null,e)}catch{return lo.call(this,e)}}}var qo=[],xu=!1,Us,v0=-1;function LD(){!xu||!Us||(xu=!1,Us.length?qo=Us.concat(qo):v0=-1,qo.length&&kA())}function kA(){if(!xu){var e=EA(LD);xu=!0;for(var t=qo.length;t;){for(Us=qo,qo=[];++v01)for(var r=1;r"u"?typeof Oe.Buffer.from<"u"?(t.encodeBase64=function(n){return Oe.Buffer.from(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Oe.Buffer.from(n,"base64"),0))}):(t.encodeBase64=function(n){return new Oe.Buffer(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Oe.Buffer(n,"base64"),0))}):(t.encodeBase64=function(n){var o,i=[],a=n.length;for(o=0;o */var V_;function Kt(){return V_||(V_=1,function(e,t){var r=Oe,n=r.Buffer;function o(a,s){for(var l in a)s[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=i);function i(a,s,l){return n(a,s,l)}i.prototype=Object.create(n.prototype),o(n,i),i.from=function(a,s,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,s,l)},i.alloc=function(a,s,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var u=n(a);return s!==void 0?typeof l=="string"?u.fill(s,l):u.fill(s):u.fill(0),u},i.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},i.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}}(zD,kf)),kf}var H_;function tc(){if(H_)return ep;H_=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser. -Use Chrome, Firefox or Internet Explorer 11`)}var n=Kt().Buffer,o=Ze.crypto||Ze.msCrypto;o&&o.getRandomValues?W_.exports=i:W_.exports=r;function i(a,s){if(a>t)throw new RangeError("requested too many random bytes");var l=n.allocUnsafe(a);if(a>0)if(a>e)for(var u=0;u0&&(ue=j[0]),ue instanceof Error)throw ue;var U=new Error("Unhandled error."+(ue?" ("+ue.message+")":""));throw U.context=ue,U}var _=Z[L];if(_===void 0)return!1;if(typeof _=="function")t(_,this,j);else for(var y=_.length,f=v(_,y),V=0;V0&&ue.length>K&&!ue.warned){ue.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+ue.length+" "+String(L)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=P,U.type=L,U.count=ue.length,n(U)}return P}i.prototype.addListener=function(L,j){return u(this,L,j,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(L,j){return u(this,L,j,!0)};function c(){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 h(P,L,j){var V={fired:!1,wrapFn:void 0,target:P,type:L,listener:j},K=c.bind(V);return K.listener=j,V.wrapFn=K,K}i.prototype.once=function(L,j){return s(j),this.on(L,h(this,L,j)),this},i.prototype.prependOnceListener=function(L,j){return s(j),this.prependListener(L,h(this,L,j)),this},i.prototype.removeListener=function(L,j){var V,K,Z,ue,U;if(s(j),K=this._events,K===void 0)return this;if(V=K[L],V===void 0)return this;if(V===j||V.listener===j)--this._eventsCount===0?this._events=Object.create(null):(delete K[L],K.removeListener&&this.emit("removeListener",L,V.listener||j));else if(typeof V!="function"){for(Z=-1,ue=V.length-1;ue>=0;ue--)if(V[ue]===j||V[ue].listener===j){U=V[ue].listener,Z=ue;break}if(Z<0)return this;Z===0?V.shift():b(V,Z),V.length===1&&(K[L]=V[0]),K.removeListener!==void 0&&this.emit("removeListener",L,U||j)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(L){var j,V,K;if(V=this._events,V===void 0)return this;if(V.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):V[L]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[L]),this;if(arguments.length===0){var Z=Object.keys(V),ue;for(K=0;K=0;K--)this.removeListener(L,j[K]);return this};function d(P,L,j){var V=P._events;if(V===void 0)return[];var K=V[L];return K===void 0?[]:typeof K=="function"?j?[K.listener||K]:[K]:j?S(K):v(K,K.length)}i.prototype.listeners=function(L){return d(this,L,!0)},i.prototype.rawListeners=function(L){return d(this,L,!1)},i.listenerCount=function(P,L){return typeof P.listenerCount=="function"?P.listenerCount(L):p.call(P,L)},i.prototype.listenerCount=p;function p(P){var L=this._events;if(L!==void 0){var j=L[P];if(typeof j=="function")return 1;if(j!==void 0)return j.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function v(P,L){for(var j=new Array(L),V=0;V"u"?e:u(Uint8Array),d={"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":l?u([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":c,"%AsyncGenerator%":c,"%AsyncGeneratorFunction%":c,"%AsyncIteratorPrototype%":c,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":r,"%GeneratorFunction%":c,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?u(u([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!l?e:u(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!l?e:u(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?u(""[Symbol.iterator]()):e,"%Symbol%":l?Symbol:e,"%SyntaxError%":t,"%ThrowTypeError%":s,"%TypedArray%":h,"%TypeError%":n,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet};try{null.error}catch(U){var p=u(u(U));d["%Error.prototype%"]=p}var v=function U(_){var y;if(_==="%AsyncFunction%")y=o("async function () {}");else if(_==="%GeneratorFunction%")y=o("function* () {}");else if(_==="%AsyncGeneratorFunction%")y=o("async function* () {}");else if(_==="%AsyncGenerator%"){var f=U("%AsyncGeneratorFunction%");f&&(y=f.prototype)}else if(_==="%AsyncIteratorPrototype%"){var g=U("%AsyncGenerator%");g&&(y=u(g.prototype))}return d[_]=y,y},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=uw(),x=HD(),k=S.call(Function.call,Array.prototype.concat),M=S.call(Function.apply,Array.prototype.splice),P=S.call(Function.call,String.prototype.replace),L=S.call(Function.call,String.prototype.slice),j=S.call(Function.call,RegExp.prototype.exec),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,Z=function(_){var y=L(_,0,1),f=L(_,-1);if(y==="%"&&f!=="%")throw new t("invalid intrinsic syntax, expected closing `%`");if(f==="%"&&y!=="%")throw new t("invalid intrinsic syntax, expected opening `%`");var g=[];return P(_,V,function(w,A,T,E){g[g.length]=T?P(E,K,"$1"):A||w}),g},ue=function(_,y){var f=_,g;if(x(b,f)&&(g=b[f],f="%"+g[0]+"%"),x(d,f)){var w=d[f];if(w===c&&(w=v(f)),typeof w>"u"&&!y)throw new n("intrinsic "+_+" exists, but is not available. Please file an issue!");return{alias:g,name:f,value:w}}throw new t("intrinsic "+_+" does not exist!")};return Hm=function(_,y){if(typeof _!="string"||_.length===0)throw new n("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof y!="boolean")throw new n('"allowMissing" argument must be a boolean');if(j(/^%?[^%]*%?$/,_)===null)throw new t("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=Z(_),g=f.length>0?f[0]:"",w=ue("%"+g+"%",y),A=w.name,T=w.value,E=!1,C=w.alias;C&&(g=C[0],M(f,k([0,1],C)));for(var I=1,m=!0;I=f.length){var $=i(T,B);m=!!$,m&&"get"in $&&!("originalValue"in $.get)?T=$.get:T=T[B]}else m=x(T,B),T=T[B];m&&!E&&(d[A]=T)}}return T},Hm}var rp={},KD={get exports(){return rp},set exports(e){rp=e}},i8;function ZD(){return i8||(i8=1,function(e){var t=uw(),r=cw(),n=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(o,n),a=r("%Object.getOwnPropertyDescriptor%",!0),s=r("%Object.defineProperty%",!0),l=r("%Math.max%");if(s)try{s({},"a",{value:1})}catch{s=null}e.exports=function(h){var d=i(t,o,arguments);if(a&&s){var p=a(d,"length");p.configurable&&s(d,"length",{value:1+l(0,h.length-(arguments.length-1))})}return d};var u=function(){return i(t,n,arguments)};s?s(e.exports,"apply",{value:u}):e.exports.apply=u}(KD)),rp}var Km,o8;function fw(){if(o8)return Km;o8=1;var e=cw(),t=ZD(),r=t(e("String.prototype.indexOf"));return Km=function(o,i){var a=e(o,!!i);return typeof a=="function"&&r(o,".prototype.")>-1?t(a):a},Km}var Zm,a8;function GD(){if(a8)return Zm;a8=1;var e=_1()(),t=fw(),r=t("Object.prototype.toString"),n=function(s){return e&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:r(s)==="[object Arguments]"},o=function(s){return n(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&r(s)!=="[object Array]"&&r(s.callee)==="[object Function]"},i=function(){return n(arguments)}();return n.isLegacyArguments=o,Zm=i?n:o,Zm}var Gm,s8;function YD(){if(s8)return Gm;s8=1;var e=Object.prototype.toString,t=Function.prototype.toString,r=/^\s*(?:function)?\*/,n=_1()(),o=Object.getPrototypeOf,i=function(){if(!n)return!1;try{return Function("return function*() {}")()}catch{}},a;return Gm=function(l){if(typeof l!="function")return!1;if(r.test(t.call(l)))return!0;if(!n){var u=e.call(l);return u==="[object GeneratorFunction]"}if(!o)return!1;if(typeof a>"u"){var c=i();a=c?o(c):!1}return o(l)===a},Gm}var Ym,l8;function QD(){if(l8)return Ym;l8=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},t(function(){throw 42},null,r)}catch(k){k!==n&&(t=null)}else t=null;var o=/^\s*class\b/,i=function(M){try{var P=e.call(M);return o.test(P)}catch{return!1}},a=function(M){try{return i(M)?!1:(e.call(M),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",u="[object Function]",c="[object GeneratorFunction]",h="[object HTMLAllCollection]",d="[object HTML document.all class]",p="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,b=!(0 in[,]),S=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(S=function(M){if((b||!M)&&(typeof M>"u"||typeof M=="object"))try{var P=s.call(M);return(P===h||P===d||P===p||P===l)&&M("")==null}catch{}return!1})}return Ym=t?function(M){if(S(M))return!0;if(!M||typeof M!="function"&&typeof M!="object")return!1;try{t(M,null,r)}catch(P){if(P!==n)return!1}return!i(M)&&a(M)}:function(M){if(S(M))return!0;if(!M||typeof M!="function"&&typeof M!="object")return!1;if(v)return a(M);if(i(M))return!1;var P=s.call(M);return P!==u&&P!==c&&!/^\[object HTML/.test(P)?!1:a(M)},Ym}var Qm,u8;function TA(){if(u8)return Qm;u8=1;var e=QD(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(l,u,c){for(var h=0,d=l.length;h=3&&(h=c),t.call(l)==="[object Array]"?n(l,u,h):typeof l=="string"?o(l,u,h):i(l,u,h)};return Qm=a,Qm}var Xm,c8;function BA(){if(c8)return Xm;c8=1;var e=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],t=typeof globalThis>"u"?Ze:globalThis;return Xm=function(){for(var n=[],o=0;o"u"?Ze:globalThis,s=t(),l=r("Array.prototype.indexOf",!0)||function(v,b){for(var S=0;S-1}return i?d(v):!1},ev}var tv,h8;function XD(){if(h8)return tv;h8=1;var e=TA(),t=BA(),r=fw(),n=PA(),o=r("Object.prototype.toString"),i=_1()(),a=typeof globalThis>"u"?Ze:globalThis,s=t(),l=r("String.prototype.slice"),u={},c=Object.getPrototypeOf;i&&n&&c&&e(s,function(p){if(typeof a[p]=="function"){var v=new a[p];if(Symbol.toStringTag in v){var b=c(v),S=n(b,Symbol.toStringTag);if(!S){var x=c(b);S=n(x,Symbol.toStringTag)}u[p]=S.get}}});var h=function(v){var b=!1;return e(u,function(S,x){if(!b)try{var k=S.call(v);k===x&&(b=k)}catch{}}),b},d=RA();return tv=function(v){return d(v)?!i||!(Symbol.toStringTag in v)?l(o(v),8,-1):h(v):!1},tv}var p8;function JD(){return p8||(p8=1,function(e){var t=GD(),r=YD(),n=XD(),o=RA();function i(G){return G.call.bind(G)}var a=typeof BigInt<"u",s=typeof Symbol<"u",l=i(Object.prototype.toString),u=i(Number.prototype.valueOf),c=i(String.prototype.valueOf),h=i(Boolean.prototype.valueOf);if(a)var d=i(BigInt.prototype.valueOf);if(s)var p=i(Symbol.prototype.valueOf);function v(G,me){if(typeof G!="object")return!1;try{return me(G),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=o;function b(G){return typeof Promise<"u"&&G instanceof Promise||G!==null&&typeof G=="object"&&typeof G.then=="function"&&typeof G.catch=="function"}e.isPromise=b;function S(G){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(G):o(G)||B(G)}e.isArrayBufferView=S;function x(G){return n(G)==="Uint8Array"}e.isUint8Array=x;function k(G){return n(G)==="Uint8ClampedArray"}e.isUint8ClampedArray=k;function M(G){return n(G)==="Uint16Array"}e.isUint16Array=M;function P(G){return n(G)==="Uint32Array"}e.isUint32Array=P;function L(G){return n(G)==="Int8Array"}e.isInt8Array=L;function j(G){return n(G)==="Int16Array"}e.isInt16Array=j;function V(G){return n(G)==="Int32Array"}e.isInt32Array=V;function K(G){return n(G)==="Float32Array"}e.isFloat32Array=K;function Z(G){return n(G)==="Float64Array"}e.isFloat64Array=Z;function ue(G){return n(G)==="BigInt64Array"}e.isBigInt64Array=ue;function U(G){return n(G)==="BigUint64Array"}e.isBigUint64Array=U;function _(G){return l(G)==="[object Map]"}_.working=typeof Map<"u"&&_(new Map);function y(G){return typeof Map>"u"?!1:_.working?_(G):G instanceof Map}e.isMap=y;function f(G){return l(G)==="[object Set]"}f.working=typeof Set<"u"&&f(new Set);function g(G){return typeof Set>"u"?!1:f.working?f(G):G instanceof Set}e.isSet=g;function w(G){return l(G)==="[object WeakMap]"}w.working=typeof WeakMap<"u"&&w(new WeakMap);function A(G){return typeof WeakMap>"u"?!1:w.working?w(G):G instanceof WeakMap}e.isWeakMap=A;function T(G){return l(G)==="[object WeakSet]"}T.working=typeof WeakSet<"u"&&T(new WeakSet);function E(G){return T(G)}e.isWeakSet=E;function C(G){return l(G)==="[object ArrayBuffer]"}C.working=typeof ArrayBuffer<"u"&&C(new ArrayBuffer);function I(G){return typeof ArrayBuffer>"u"?!1:C.working?C(G):G instanceof ArrayBuffer}e.isArrayBuffer=I;function m(G){return l(G)==="[object DataView]"}m.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&m(new DataView(new ArrayBuffer(1),0,1));function B(G){return typeof DataView>"u"?!1:m.working?m(G):G instanceof DataView}e.isDataView=B;var ne=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function de(G){return l(G)==="[object SharedArrayBuffer]"}function $(G){return typeof ne>"u"?!1:(typeof de.working>"u"&&(de.working=de(new ne)),de.working?de(G):G instanceof ne)}e.isSharedArrayBuffer=$;function he(G){return l(G)==="[object AsyncFunction]"}e.isAsyncFunction=he;function X(G){return l(G)==="[object Map Iterator]"}e.isMapIterator=X;function se(G){return l(G)==="[object Set Iterator]"}e.isSetIterator=se;function pe(G){return l(G)==="[object Generator]"}e.isGeneratorObject=pe;function W(G){return l(G)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=W;function q(G){return v(G,u)}e.isNumberObject=q;function ye(G){return v(G,c)}e.isStringObject=ye;function xe(G){return v(G,h)}e.isBooleanObject=xe;function Me(G){return a&&v(G,d)}e.isBigIntObject=Me;function Q(G){return s&&v(G,p)}e.isSymbolObject=Q;function N(G){return q(G)||ye(G)||xe(G)||Me(G)||Q(G)}e.isBoxedPrimitive=N;function D(G){return typeof Uint8Array<"u"&&(I(G)||$(G))}e.isAnyArrayBuffer=D,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(G){Object.defineProperty(e,G,{enumerable:!1,value:function(){throw new Error(G+" is not supported in userland")}})})}(jm)),jm}var rv,g8;function eU(){return g8||(g8=1,rv=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}),rv}var m8;function OA(){return m8||(m8=1,function(e){var t=Object.getOwnPropertyDescriptors||function(B){for(var ne=Object.keys(B),de={},$=0;$=$)return se;switch(se){case"%s":return String(de[ne++]);case"%d":return Number(de[ne++]);case"%j":try{return JSON.stringify(de[ne++])}catch{return"[Circular]"}default:return se}}),X=de[ne];ne<$;X=de[++ne])k(X)||!Z(X)?he+=" "+X:he+=" "+a(X);return he},e.deprecate=function(m,B){if(typeof _t<"u"&&_t.noDeprecation===!0)return m;if(typeof _t>"u")return function(){return e.deprecate(m,B).apply(this,arguments)};var ne=!1;function de(){if(!ne){if(_t.throwDeprecation)throw new Error(B);_t.traceDeprecation?console.trace(B):console.error(B),ne=!0}return m.apply(this,arguments)}return de};var n={},o=/^$/;if({}.NODE_DEBUG){var i={}.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+i+"$","i")}e.debuglog=function(m){if(m=m.toUpperCase(),!n[m])if(o.test(m)){var B=_t.pid;n[m]=function(){var ne=e.format.apply(e,arguments);console.error("%s %d: %s",m,B,ne)}}else n[m]=function(){};return n[m]};function a(m,B){var ne={seen:[],stylize:l};return arguments.length>=3&&(ne.depth=arguments[2]),arguments.length>=4&&(ne.colors=arguments[3]),x(B)?ne.showHidden=B:B&&e._extend(ne,B),V(ne.showHidden)&&(ne.showHidden=!1),V(ne.depth)&&(ne.depth=2),V(ne.colors)&&(ne.colors=!1),V(ne.customInspect)&&(ne.customInspect=!0),ne.colors&&(ne.stylize=s),c(ne,m,ne.depth)}e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function s(m,B){var ne=a.styles[B];return ne?"\x1B["+a.colors[ne][0]+"m"+m+"\x1B["+a.colors[ne][1]+"m":m}function l(m,B){return m}function u(m){var B={};return m.forEach(function(ne,de){B[ne]=!0}),B}function c(m,B,ne){if(m.customInspect&&B&&_(B.inspect)&&B.inspect!==e.inspect&&!(B.constructor&&B.constructor.prototype===B)){var de=B.inspect(ne,m);return L(de)||(de=c(m,de,ne)),de}var $=h(m,B);if($)return $;var he=Object.keys(B),X=u(he);if(m.showHidden&&(he=Object.getOwnPropertyNames(B)),U(B)&&(he.indexOf("message")>=0||he.indexOf("description")>=0))return d(B);if(he.length===0){if(_(B)){var se=B.name?": "+B.name:"";return m.stylize("[Function"+se+"]","special")}if(K(B))return m.stylize(RegExp.prototype.toString.call(B),"regexp");if(ue(B))return m.stylize(Date.prototype.toString.call(B),"date");if(U(B))return d(B)}var pe="",W=!1,q=["{","}"];if(S(B)&&(W=!0,q=["[","]"]),_(B)){var ye=B.name?": "+B.name:"";pe=" [Function"+ye+"]"}if(K(B)&&(pe=" "+RegExp.prototype.toString.call(B)),ue(B)&&(pe=" "+Date.prototype.toUTCString.call(B)),U(B)&&(pe=" "+d(B)),he.length===0&&(!W||B.length==0))return q[0]+pe+q[1];if(ne<0)return K(B)?m.stylize(RegExp.prototype.toString.call(B),"regexp"):m.stylize("[Object]","special");m.seen.push(B);var xe;return W?xe=p(m,B,ne,X,he):xe=he.map(function(Me){return v(m,B,ne,X,Me,W)}),m.seen.pop(),b(xe,pe,q)}function h(m,B){if(V(B))return m.stylize("undefined","undefined");if(L(B)){var ne="'"+JSON.stringify(B).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m.stylize(ne,"string")}if(P(B))return m.stylize(""+B,"number");if(x(B))return m.stylize(""+B,"boolean");if(k(B))return m.stylize("null","null")}function d(m){return"["+Error.prototype.toString.call(m)+"]"}function p(m,B,ne,de,$){for(var he=[],X=0,se=B.length;Xo)throw new RangeError('The value "'+Q+'" is invalid for option "size"');var N=new Uint8Array(Q);return Object.setPrototypeOf(N,s.prototype),N}function s(Q,N,D){if(typeof Q=="number"){if(typeof N=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(Q)}return l(Q,N,D)}s.poolSize=8192;function l(Q,N,D){if(typeof Q=="string")return d(Q,N);if(ArrayBuffer.isView(Q))return v(Q);if(Q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q);if(ye(Q,ArrayBuffer)||Q&&ye(Q.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(Q,SharedArrayBuffer)||Q&&ye(Q.buffer,SharedArrayBuffer)))return b(Q,N,D);if(typeof Q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var G=Q.valueOf&&Q.valueOf();if(G!=null&&G!==Q)return s.from(G,N,D);var me=S(Q);if(me)return me;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Q[Symbol.toPrimitive]=="function")return s.from(Q[Symbol.toPrimitive]("string"),N,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q)}s.from=function(Q,N,D){return l(Q,N,D)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(Q){if(typeof Q!="number")throw new TypeError('"size" argument must be of type number');if(Q<0)throw new RangeError('The value "'+Q+'" is invalid for option "size"')}function c(Q,N,D){return u(Q),Q<=0?a(Q):N!==void 0?typeof D=="string"?a(Q).fill(N,D):a(Q).fill(N):a(Q)}s.alloc=function(Q,N,D){return c(Q,N,D)};function h(Q){return u(Q),a(Q<0?0:x(Q)|0)}s.allocUnsafe=function(Q){return h(Q)},s.allocUnsafeSlow=function(Q){return h(Q)};function d(Q,N){if((typeof N!="string"||N==="")&&(N="utf8"),!s.isEncoding(N))throw new TypeError("Unknown encoding: "+N);var D=M(Q,N)|0,G=a(D),me=G.write(Q,N);return me!==D&&(G=G.slice(0,me)),G}function p(Q){for(var N=Q.length<0?0:x(Q.length)|0,D=a(N),G=0;G=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return Q|0}function k(Q){return+Q!=Q&&(Q=0),s.alloc(+Q)}s.isBuffer=function(N){return N!=null&&N._isBuffer===!0&&N!==s.prototype},s.compare=function(N,D){if(ye(N,Uint8Array)&&(N=s.from(N,N.offset,N.byteLength)),ye(D,Uint8Array)&&(D=s.from(D,D.offset,D.byteLength)),!s.isBuffer(N)||!s.isBuffer(D))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(N===D)return 0;for(var G=N.length,me=D.length,_e=0,Pe=Math.min(G,me);_eme.length?s.from(Pe).copy(me,_e):Uint8Array.prototype.set.call(me,Pe,_e);else if(s.isBuffer(Pe))Pe.copy(me,_e);else throw new TypeError('"list" argument must be an Array of Buffers');_e+=Pe.length}return me};function M(Q,N){if(s.isBuffer(Q))return Q.length;if(ArrayBuffer.isView(Q)||ye(Q,ArrayBuffer))return Q.byteLength;if(typeof Q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Q);var D=Q.length,G=arguments.length>2&&arguments[2]===!0;if(!G&&D===0)return 0;for(var me=!1;;)switch(N){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return X(Q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return W(Q).length;default:if(me)return G?-1:X(Q).length;N=(""+N).toLowerCase(),me=!0}}s.byteLength=M;function P(Q,N,D){var G=!1;if((N===void 0||N<0)&&(N=0),N>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,N>>>=0,D<=N))return"";for(Q||(Q="utf8");;)switch(Q){case"hex":return E(this,N,D);case"utf8":case"utf-8":return f(this,N,D);case"ascii":return A(this,N,D);case"latin1":case"binary":return T(this,N,D);case"base64":return y(this,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,N,D);default:if(G)throw new TypeError("Unknown encoding: "+Q);Q=(Q+"").toLowerCase(),G=!0}}s.prototype._isBuffer=!0;function L(Q,N,D){var G=Q[N];Q[N]=Q[D],Q[D]=G}s.prototype.swap16=function(){var N=this.length;if(N%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var D=0;DD&&(N+=" ... "),""},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(N,D,G,me,_e){if(ye(N,Uint8Array)&&(N=s.from(N,N.offset,N.byteLength)),!s.isBuffer(N))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof N);if(D===void 0&&(D=0),G===void 0&&(G=N?N.length:0),me===void 0&&(me=0),_e===void 0&&(_e=this.length),D<0||G>N.length||me<0||_e>this.length)throw new RangeError("out of range index");if(me>=_e&&D>=G)return 0;if(me>=_e)return-1;if(D>=G)return 1;if(D>>>=0,G>>>=0,me>>>=0,_e>>>=0,this===N)return 0;for(var Pe=_e-me,Fe=G-D,Re=Math.min(Pe,Fe),le=this.slice(me,_e),Y=N.slice(D,G),re=0;re2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,xe(D)&&(D=me?0:Q.length-1),D<0&&(D=Q.length+D),D>=Q.length){if(me)return-1;D=Q.length-1}else if(D<0)if(me)D=0;else return-1;if(typeof N=="string"&&(N=s.from(N,G)),s.isBuffer(N))return N.length===0?-1:V(Q,N,D,G,me);if(typeof N=="number")return N=N&255,typeof Uint8Array.prototype.indexOf=="function"?me?Uint8Array.prototype.indexOf.call(Q,N,D):Uint8Array.prototype.lastIndexOf.call(Q,N,D):V(Q,[N],D,G,me);throw new TypeError("val must be string, number or Buffer")}function V(Q,N,D,G,me){var _e=1,Pe=Q.length,Fe=N.length;if(G!==void 0&&(G=String(G).toLowerCase(),G==="ucs2"||G==="ucs-2"||G==="utf16le"||G==="utf-16le")){if(Q.length<2||N.length<2)return-1;_e=2,Pe/=2,Fe/=2,D/=2}function Re(be,ce){return _e===1?be[ce]:be.readUInt16BE(ce*_e)}var le;if(me){var Y=-1;for(le=D;lePe&&(D=Pe-Fe),le=D;le>=0;le--){for(var re=!0,ge=0;geme&&(G=me)):G=me;var _e=N.length;G>_e/2&&(G=_e/2);for(var Pe=0;Pe>>0,isFinite(G)?(G=G>>>0,me===void 0&&(me="utf8")):(me=G,G=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var _e=this.length-D;if((G===void 0||G>_e)&&(G=_e),N.length>0&&(G<0||D<0)||D>this.length)throw new RangeError("Attempt to write outside buffer bounds");me||(me="utf8");for(var Pe=!1;;)switch(me){case"hex":return K(this,N,D,G);case"utf8":case"utf-8":return Z(this,N,D,G);case"ascii":case"latin1":case"binary":return ue(this,N,D,G);case"base64":return U(this,N,D,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,N,D,G);default:if(Pe)throw new TypeError("Unknown encoding: "+me);me=(""+me).toLowerCase(),Pe=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y(Q,N,D){return N===0&&D===Q.length?t.fromByteArray(Q):t.fromByteArray(Q.slice(N,D))}function f(Q,N,D){D=Math.min(Q.length,D);for(var G=[],me=N;me239?4:_e>223?3:_e>191?2:1;if(me+Fe<=D){var Re,le,Y,re;switch(Fe){case 1:_e<128&&(Pe=_e);break;case 2:Re=Q[me+1],(Re&192)===128&&(re=(_e&31)<<6|Re&63,re>127&&(Pe=re));break;case 3:Re=Q[me+1],le=Q[me+2],(Re&192)===128&&(le&192)===128&&(re=(_e&15)<<12|(Re&63)<<6|le&63,re>2047&&(re<55296||re>57343)&&(Pe=re));break;case 4:Re=Q[me+1],le=Q[me+2],Y=Q[me+3],(Re&192)===128&&(le&192)===128&&(Y&192)===128&&(re=(_e&15)<<18|(Re&63)<<12|(le&63)<<6|Y&63,re>65535&&re<1114112&&(Pe=re))}}Pe===null?(Pe=65533,Fe=1):Pe>65535&&(Pe-=65536,G.push(Pe>>>10&1023|55296),Pe=56320|Pe&1023),G.push(Pe),me+=Fe}return w(G)}var g=4096;function w(Q){var N=Q.length;if(N<=g)return String.fromCharCode.apply(String,Q);for(var D="",G=0;GG)&&(D=G);for(var me="",_e=N;_eG&&(N=G),D<0?(D+=G,D<0&&(D=0)):D>G&&(D=G),DD)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N],_e=1,Pe=0;++Pe>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N+--D],_e=1;D>0&&(_e*=256);)me+=this[N+--D]*_e;return me},s.prototype.readUint8=s.prototype.readUInt8=function(N,D){return N=N>>>0,D||I(N,1,this.length),this[N]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(N,D){return N=N>>>0,D||I(N,2,this.length),this[N]|this[N+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(N,D){return N=N>>>0,D||I(N,2,this.length),this[N]<<8|this[N+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(N,D){return N=N>>>0,D||I(N,4,this.length),(this[N]|this[N+1]<<8|this[N+2]<<16)+this[N+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]*16777216+(this[N+1]<<16|this[N+2]<<8|this[N+3])},s.prototype.readIntLE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=this[N],_e=1,Pe=0;++Pe=_e&&(me-=Math.pow(2,8*D)),me},s.prototype.readIntBE=function(N,D,G){N=N>>>0,D=D>>>0,G||I(N,D,this.length);for(var me=D,_e=1,Pe=this[N+--me];me>0&&(_e*=256);)Pe+=this[N+--me]*_e;return _e*=128,Pe>=_e&&(Pe-=Math.pow(2,8*D)),Pe},s.prototype.readInt8=function(N,D){return N=N>>>0,D||I(N,1,this.length),this[N]&128?(255-this[N]+1)*-1:this[N]},s.prototype.readInt16LE=function(N,D){N=N>>>0,D||I(N,2,this.length);var G=this[N]|this[N+1]<<8;return G&32768?G|4294901760:G},s.prototype.readInt16BE=function(N,D){N=N>>>0,D||I(N,2,this.length);var G=this[N+1]|this[N]<<8;return G&32768?G|4294901760:G},s.prototype.readInt32LE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]|this[N+1]<<8|this[N+2]<<16|this[N+3]<<24},s.prototype.readInt32BE=function(N,D){return N=N>>>0,D||I(N,4,this.length),this[N]<<24|this[N+1]<<16|this[N+2]<<8|this[N+3]},s.prototype.readFloatLE=function(N,D){return N=N>>>0,D||I(N,4,this.length),r.read(this,N,!0,23,4)},s.prototype.readFloatBE=function(N,D){return N=N>>>0,D||I(N,4,this.length),r.read(this,N,!1,23,4)},s.prototype.readDoubleLE=function(N,D){return N=N>>>0,D||I(N,8,this.length),r.read(this,N,!0,52,8)},s.prototype.readDoubleBE=function(N,D){return N=N>>>0,D||I(N,8,this.length),r.read(this,N,!1,52,8)};function m(Q,N,D,G,me,_e){if(!s.isBuffer(Q))throw new TypeError('"buffer" argument must be a Buffer instance');if(N>me||N<_e)throw new RangeError('"value" argument is out of bounds');if(D+G>Q.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(N,D,G,me){if(N=+N,D=D>>>0,G=G>>>0,!me){var _e=Math.pow(2,8*G)-1;m(this,N,D,G,_e,0)}var Pe=1,Fe=0;for(this[D]=N&255;++Fe>>0,G=G>>>0,!me){var _e=Math.pow(2,8*G)-1;m(this,N,D,G,_e,0)}var Pe=G-1,Fe=1;for(this[D+Pe]=N&255;--Pe>=0&&(Fe*=256);)this[D+Pe]=N/Fe&255;return D+G},s.prototype.writeUint8=s.prototype.writeUInt8=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,1,255,0),this[D]=N&255,D+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,65535,0),this[D]=N&255,this[D+1]=N>>>8,D+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,65535,0),this[D]=N>>>8,this[D+1]=N&255,D+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,4294967295,0),this[D+3]=N>>>24,this[D+2]=N>>>16,this[D+1]=N>>>8,this[D]=N&255,D+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,4294967295,0),this[D]=N>>>24,this[D+1]=N>>>16,this[D+2]=N>>>8,this[D+3]=N&255,D+4},s.prototype.writeIntLE=function(N,D,G,me){if(N=+N,D=D>>>0,!me){var _e=Math.pow(2,8*G-1);m(this,N,D,G,_e-1,-_e)}var Pe=0,Fe=1,Re=0;for(this[D]=N&255;++Pe>0)-Re&255;return D+G},s.prototype.writeIntBE=function(N,D,G,me){if(N=+N,D=D>>>0,!me){var _e=Math.pow(2,8*G-1);m(this,N,D,G,_e-1,-_e)}var Pe=G-1,Fe=1,Re=0;for(this[D+Pe]=N&255;--Pe>=0&&(Fe*=256);)N<0&&Re===0&&this[D+Pe+1]!==0&&(Re=1),this[D+Pe]=(N/Fe>>0)-Re&255;return D+G},s.prototype.writeInt8=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,1,127,-128),N<0&&(N=255+N+1),this[D]=N&255,D+1},s.prototype.writeInt16LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,32767,-32768),this[D]=N&255,this[D+1]=N>>>8,D+2},s.prototype.writeInt16BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,2,32767,-32768),this[D]=N>>>8,this[D+1]=N&255,D+2},s.prototype.writeInt32LE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,2147483647,-2147483648),this[D]=N&255,this[D+1]=N>>>8,this[D+2]=N>>>16,this[D+3]=N>>>24,D+4},s.prototype.writeInt32BE=function(N,D,G){return N=+N,D=D>>>0,G||m(this,N,D,4,2147483647,-2147483648),N<0&&(N=4294967295+N+1),this[D]=N>>>24,this[D+1]=N>>>16,this[D+2]=N>>>8,this[D+3]=N&255,D+4};function B(Q,N,D,G,me,_e){if(D+G>Q.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function ne(Q,N,D,G,me){return N=+N,D=D>>>0,me||B(Q,N,D,4),r.write(Q,N,D,G,23,4),D+4}s.prototype.writeFloatLE=function(N,D,G){return ne(this,N,D,!0,G)},s.prototype.writeFloatBE=function(N,D,G){return ne(this,N,D,!1,G)};function de(Q,N,D,G,me){return N=+N,D=D>>>0,me||B(Q,N,D,8),r.write(Q,N,D,G,52,8),D+8}s.prototype.writeDoubleLE=function(N,D,G){return de(this,N,D,!0,G)},s.prototype.writeDoubleBE=function(N,D,G){return de(this,N,D,!1,G)},s.prototype.copy=function(N,D,G,me){if(!s.isBuffer(N))throw new TypeError("argument should be a Buffer");if(G||(G=0),!me&&me!==0&&(me=this.length),D>=N.length&&(D=N.length),D||(D=0),me>0&&me=this.length)throw new RangeError("Index out of range");if(me<0)throw new RangeError("sourceEnd out of bounds");me>this.length&&(me=this.length),N.length-D>>0,G=G===void 0?this.length:G>>>0,N||(N=0);var Pe;if(typeof N=="number")for(Pe=D;Pe55295&&D<57344){if(!me){if(D>56319){(N-=3)>-1&&_e.push(239,191,189);continue}else if(Pe+1===G){(N-=3)>-1&&_e.push(239,191,189);continue}me=D;continue}if(D<56320){(N-=3)>-1&&_e.push(239,191,189),me=D;continue}D=(me-55296<<10|D-56320)+65536}else me&&(N-=3)>-1&&_e.push(239,191,189);if(me=null,D<128){if((N-=1)<0)break;_e.push(D)}else if(D<2048){if((N-=2)<0)break;_e.push(D>>6|192,D&63|128)}else if(D<65536){if((N-=3)<0)break;_e.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((N-=4)<0)break;_e.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return _e}function se(Q){for(var N=[],D=0;D>8,me=D%256,_e.push(me),_e.push(G);return _e}function W(Q){return t.toByteArray(he(Q))}function q(Q,N,D,G){for(var me=0;me=N.length||me>=Q.length);++me)N[me+D]=Q[me];return me}function ye(Q,N){return Q instanceof N||Q!=null&&Q.constructor!=null&&Q.constructor.name!=null&&Q.constructor.name===N.name}function xe(Q){return Q!==Q}var Me=function(){for(var Q="0123456789abcdef",N=new Array(256),D=0;D<16;++D)for(var G=D*16,me=0;me<16;++me)N[G+me]=Q[D]+Q[me];return N}()})(Oe);var _t={},PD={get exports(){return _t},set exports(e){_t=e}},qr=PD.exports={},so,lo;function Hb(){throw new Error("setTimeout has not been defined")}function Kb(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?so=setTimeout:so=Hb}catch{so=Hb}try{typeof clearTimeout=="function"?lo=clearTimeout:lo=Kb}catch{lo=Kb}})();function kA(e){if(so===setTimeout)return setTimeout(e,0);if((so===Hb||!so)&&setTimeout)return so=setTimeout,setTimeout(e,0);try{return so(e,0)}catch{try{return so.call(null,e,0)}catch{return so.call(this,e,0)}}}function RD(e){if(lo===clearTimeout)return clearTimeout(e);if((lo===Kb||!lo)&&clearTimeout)return lo=clearTimeout,clearTimeout(e);try{return lo(e)}catch{try{return lo.call(null,e)}catch{return lo.call(this,e)}}}var qo=[],xu=!1,Us,v0=-1;function OD(){!xu||!Us||(xu=!1,Us.length?qo=Us.concat(qo):v0=-1,qo.length&&AA())}function AA(){if(!xu){var e=kA(OD);xu=!0;for(var t=qo.length;t;){for(Us=qo,qo=[];++v01)for(var r=1;r"u"?typeof Oe.Buffer.from<"u"?(t.encodeBase64=function(n){return Oe.Buffer.from(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Oe.Buffer.from(n,"base64"),0))}):(t.encodeBase64=function(n){return new Oe.Buffer(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Oe.Buffer(n,"base64"),0))}):(t.encodeBase64=function(n){var o,i=[],a=n.length;for(o=0;o */var H_;function Kt(){return H_||(H_=1,function(e,t){var r=Oe,n=r.Buffer;function o(a,s){for(var l in a)s[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=i);function i(a,s,l){return n(a,s,l)}i.prototype=Object.create(n.prototype),o(n,i),i.from=function(a,s,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,s,l)},i.alloc=function(a,s,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var u=n(a);return s!==void 0?typeof l=="string"?u.fill(s,l):u.fill(s):u.fill(0),u},i.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},i.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}}(jD,kf)),kf}var K_;function tc(){if(K_)return ep;K_=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser. +Use Chrome, Firefox or Internet Explorer 11`)}var n=Kt().Buffer,o=Ke.crypto||Ke.msCrypto;o&&o.getRandomValues?V_.exports=i:V_.exports=r;function i(a,s){if(a>t)throw new RangeError("requested too many random bytes");var l=n.allocUnsafe(a);if(a>0)if(a>e)for(var u=0;u0&&(ue=j[0]),ue instanceof Error)throw ue;var U=new Error("Unhandled error."+(ue?" ("+ue.message+")":""));throw U.context=ue,U}var _=Z[L];if(_===void 0)return!1;if(typeof _=="function")t(_,this,j);else for(var y=_.length,f=v(_,y),V=0;V0&&ue.length>K&&!ue.warned){ue.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+ue.length+" "+String(L)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=P,U.type=L,U.count=ue.length,n(U)}return P}i.prototype.addListener=function(L,j){return u(this,L,j,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(L,j){return u(this,L,j,!0)};function c(){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 h(P,L,j){var V={fired:!1,wrapFn:void 0,target:P,type:L,listener:j},K=c.bind(V);return K.listener=j,V.wrapFn=K,K}i.prototype.once=function(L,j){return s(j),this.on(L,h(this,L,j)),this},i.prototype.prependOnceListener=function(L,j){return s(j),this.prependListener(L,h(this,L,j)),this},i.prototype.removeListener=function(L,j){var V,K,Z,ue,U;if(s(j),K=this._events,K===void 0)return this;if(V=K[L],V===void 0)return this;if(V===j||V.listener===j)--this._eventsCount===0?this._events=Object.create(null):(delete K[L],K.removeListener&&this.emit("removeListener",L,V.listener||j));else if(typeof V!="function"){for(Z=-1,ue=V.length-1;ue>=0;ue--)if(V[ue]===j||V[ue].listener===j){U=V[ue].listener,Z=ue;break}if(Z<0)return this;Z===0?V.shift():b(V,Z),V.length===1&&(K[L]=V[0]),K.removeListener!==void 0&&this.emit("removeListener",L,U||j)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(L){var j,V,K;if(V=this._events,V===void 0)return this;if(V.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):V[L]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[L]),this;if(arguments.length===0){var Z=Object.keys(V),ue;for(K=0;K=0;K--)this.removeListener(L,j[K]);return this};function d(P,L,j){var V=P._events;if(V===void 0)return[];var K=V[L];return K===void 0?[]:typeof K=="function"?j?[K.listener||K]:[K]:j?S(K):v(K,K.length)}i.prototype.listeners=function(L){return d(this,L,!0)},i.prototype.rawListeners=function(L){return d(this,L,!1)},i.listenerCount=function(P,L){return typeof P.listenerCount=="function"?P.listenerCount(L):p.call(P,L)},i.prototype.listenerCount=p;function p(P){var L=this._events;if(L!==void 0){var j=L[P];if(typeof j=="function")return 1;if(j!==void 0)return j.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function v(P,L){for(var j=new Array(L),V=0;V"u"?e:u(Uint8Array),d={"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":l?u([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":c,"%AsyncGenerator%":c,"%AsyncGeneratorFunction%":c,"%AsyncIteratorPrototype%":c,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":r,"%GeneratorFunction%":c,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?u(u([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!l?e:u(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!l?e:u(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?u(""[Symbol.iterator]()):e,"%Symbol%":l?Symbol:e,"%SyntaxError%":t,"%ThrowTypeError%":s,"%TypedArray%":h,"%TypeError%":n,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet};try{null.error}catch(U){var p=u(u(U));d["%Error.prototype%"]=p}var v=function U(_){var y;if(_==="%AsyncFunction%")y=o("async function () {}");else if(_==="%GeneratorFunction%")y=o("function* () {}");else if(_==="%AsyncGeneratorFunction%")y=o("async function* () {}");else if(_==="%AsyncGenerator%"){var f=U("%AsyncGeneratorFunction%");f&&(y=f.prototype)}else if(_==="%AsyncIteratorPrototype%"){var g=U("%AsyncGenerator%");g&&(y=u(g.prototype))}return d[_]=y,y},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=lw(),x=WD(),k=S.call(Function.call,Array.prototype.concat),M=S.call(Function.apply,Array.prototype.splice),P=S.call(Function.call,String.prototype.replace),L=S.call(Function.call,String.prototype.slice),j=S.call(Function.call,RegExp.prototype.exec),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,Z=function(_){var y=L(_,0,1),f=L(_,-1);if(y==="%"&&f!=="%")throw new t("invalid intrinsic syntax, expected closing `%`");if(f==="%"&&y!=="%")throw new t("invalid intrinsic syntax, expected opening `%`");var g=[];return P(_,V,function(w,A,T,E){g[g.length]=T?P(E,K,"$1"):A||w}),g},ue=function(_,y){var f=_,g;if(x(b,f)&&(g=b[f],f="%"+g[0]+"%"),x(d,f)){var w=d[f];if(w===c&&(w=v(f)),typeof w>"u"&&!y)throw new n("intrinsic "+_+" exists, but is not available. Please file an issue!");return{alias:g,name:f,value:w}}throw new t("intrinsic "+_+" does not exist!")};return Hm=function(_,y){if(typeof _!="string"||_.length===0)throw new n("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof y!="boolean")throw new n('"allowMissing" argument must be a boolean');if(j(/^%?[^%]*%?$/,_)===null)throw new t("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=Z(_),g=f.length>0?f[0]:"",w=ue("%"+g+"%",y),A=w.name,T=w.value,E=!1,C=w.alias;C&&(g=C[0],M(f,k([0,1],C)));for(var I=1,m=!0;I=f.length){var $=i(T,B);m=!!$,m&&"get"in $&&!("originalValue"in $.get)?T=$.get:T=T[B]}else m=x(T,B),T=T[B];m&&!E&&(d[A]=T)}}return T},Hm}var rp={},VD={get exports(){return rp},set exports(e){rp=e}},o8;function HD(){return o8||(o8=1,function(e){var t=lw(),r=uw(),n=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(o,n),a=r("%Object.getOwnPropertyDescriptor%",!0),s=r("%Object.defineProperty%",!0),l=r("%Math.max%");if(s)try{s({},"a",{value:1})}catch{s=null}e.exports=function(h){var d=i(t,o,arguments);if(a&&s){var p=a(d,"length");p.configurable&&s(d,"length",{value:1+l(0,h.length-(arguments.length-1))})}return d};var u=function(){return i(t,n,arguments)};s?s(e.exports,"apply",{value:u}):e.exports.apply=u}(VD)),rp}var Km,a8;function cw(){if(a8)return Km;a8=1;var e=uw(),t=HD(),r=t(e("String.prototype.indexOf"));return Km=function(o,i){var a=e(o,!!i);return typeof a=="function"&&r(o,".prototype.")>-1?t(a):a},Km}var Zm,s8;function KD(){if(s8)return Zm;s8=1;var e=_1()(),t=cw(),r=t("Object.prototype.toString"),n=function(s){return e&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:r(s)==="[object Arguments]"},o=function(s){return n(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&r(s)!=="[object Array]"&&r(s.callee)==="[object Function]"},i=function(){return n(arguments)}();return n.isLegacyArguments=o,Zm=i?n:o,Zm}var Gm,l8;function ZD(){if(l8)return Gm;l8=1;var e=Object.prototype.toString,t=Function.prototype.toString,r=/^\s*(?:function)?\*/,n=_1()(),o=Object.getPrototypeOf,i=function(){if(!n)return!1;try{return Function("return function*() {}")()}catch{}},a;return Gm=function(l){if(typeof l!="function")return!1;if(r.test(t.call(l)))return!0;if(!n){var u=e.call(l);return u==="[object GeneratorFunction]"}if(!o)return!1;if(typeof a>"u"){var c=i();a=c?o(c):!1}return o(l)===a},Gm}var Ym,u8;function GD(){if(u8)return Ym;u8=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},t(function(){throw 42},null,r)}catch(k){k!==n&&(t=null)}else t=null;var o=/^\s*class\b/,i=function(M){try{var P=e.call(M);return o.test(P)}catch{return!1}},a=function(M){try{return i(M)?!1:(e.call(M),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",u="[object Function]",c="[object GeneratorFunction]",h="[object HTMLAllCollection]",d="[object HTML document.all class]",p="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,b=!(0 in[,]),S=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(S=function(M){if((b||!M)&&(typeof M>"u"||typeof M=="object"))try{var P=s.call(M);return(P===h||P===d||P===p||P===l)&&M("")==null}catch{}return!1})}return Ym=t?function(M){if(S(M))return!0;if(!M||typeof M!="function"&&typeof M!="object")return!1;try{t(M,null,r)}catch(P){if(P!==n)return!1}return!i(M)&&a(M)}:function(M){if(S(M))return!0;if(!M||typeof M!="function"&&typeof M!="object")return!1;if(v)return a(M);if(i(M))return!1;var P=s.call(M);return P!==u&&P!==c&&!/^\[object HTML/.test(P)?!1:a(M)},Ym}var Qm,c8;function BA(){if(c8)return Qm;c8=1;var e=GD(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(l,u,c){for(var h=0,d=l.length;h=3&&(h=c),t.call(l)==="[object Array]"?n(l,u,h):typeof l=="string"?o(l,u,h):i(l,u,h)};return Qm=a,Qm}var Xm,f8;function PA(){if(f8)return Xm;f8=1;var e=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],t=typeof globalThis>"u"?Ke:globalThis;return Xm=function(){for(var n=[],o=0;o"u"?Ke:globalThis,s=t(),l=r("Array.prototype.indexOf",!0)||function(v,b){for(var S=0;S-1}return i?d(v):!1},ev}var tv,p8;function YD(){if(p8)return tv;p8=1;var e=BA(),t=PA(),r=cw(),n=RA(),o=r("Object.prototype.toString"),i=_1()(),a=typeof globalThis>"u"?Ke:globalThis,s=t(),l=r("String.prototype.slice"),u={},c=Object.getPrototypeOf;i&&n&&c&&e(s,function(p){if(typeof a[p]=="function"){var v=new a[p];if(Symbol.toStringTag in v){var b=c(v),S=n(b,Symbol.toStringTag);if(!S){var x=c(b);S=n(x,Symbol.toStringTag)}u[p]=S.get}}});var h=function(v){var b=!1;return e(u,function(S,x){if(!b)try{var k=S.call(v);k===x&&(b=k)}catch{}}),b},d=OA();return tv=function(v){return d(v)?!i||!(Symbol.toStringTag in v)?l(o(v),8,-1):h(v):!1},tv}var g8;function QD(){return g8||(g8=1,function(e){var t=KD(),r=ZD(),n=YD(),o=OA();function i(G){return G.call.bind(G)}var a=typeof BigInt<"u",s=typeof Symbol<"u",l=i(Object.prototype.toString),u=i(Number.prototype.valueOf),c=i(String.prototype.valueOf),h=i(Boolean.prototype.valueOf);if(a)var d=i(BigInt.prototype.valueOf);if(s)var p=i(Symbol.prototype.valueOf);function v(G,me){if(typeof G!="object")return!1;try{return me(G),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=o;function b(G){return typeof Promise<"u"&&G instanceof Promise||G!==null&&typeof G=="object"&&typeof G.then=="function"&&typeof G.catch=="function"}e.isPromise=b;function S(G){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(G):o(G)||B(G)}e.isArrayBufferView=S;function x(G){return n(G)==="Uint8Array"}e.isUint8Array=x;function k(G){return n(G)==="Uint8ClampedArray"}e.isUint8ClampedArray=k;function M(G){return n(G)==="Uint16Array"}e.isUint16Array=M;function P(G){return n(G)==="Uint32Array"}e.isUint32Array=P;function L(G){return n(G)==="Int8Array"}e.isInt8Array=L;function j(G){return n(G)==="Int16Array"}e.isInt16Array=j;function V(G){return n(G)==="Int32Array"}e.isInt32Array=V;function K(G){return n(G)==="Float32Array"}e.isFloat32Array=K;function Z(G){return n(G)==="Float64Array"}e.isFloat64Array=Z;function ue(G){return n(G)==="BigInt64Array"}e.isBigInt64Array=ue;function U(G){return n(G)==="BigUint64Array"}e.isBigUint64Array=U;function _(G){return l(G)==="[object Map]"}_.working=typeof Map<"u"&&_(new Map);function y(G){return typeof Map>"u"?!1:_.working?_(G):G instanceof Map}e.isMap=y;function f(G){return l(G)==="[object Set]"}f.working=typeof Set<"u"&&f(new Set);function g(G){return typeof Set>"u"?!1:f.working?f(G):G instanceof Set}e.isSet=g;function w(G){return l(G)==="[object WeakMap]"}w.working=typeof WeakMap<"u"&&w(new WeakMap);function A(G){return typeof WeakMap>"u"?!1:w.working?w(G):G instanceof WeakMap}e.isWeakMap=A;function T(G){return l(G)==="[object WeakSet]"}T.working=typeof WeakSet<"u"&&T(new WeakSet);function E(G){return T(G)}e.isWeakSet=E;function C(G){return l(G)==="[object ArrayBuffer]"}C.working=typeof ArrayBuffer<"u"&&C(new ArrayBuffer);function I(G){return typeof ArrayBuffer>"u"?!1:C.working?C(G):G instanceof ArrayBuffer}e.isArrayBuffer=I;function m(G){return l(G)==="[object DataView]"}m.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&m(new DataView(new ArrayBuffer(1),0,1));function B(G){return typeof DataView>"u"?!1:m.working?m(G):G instanceof DataView}e.isDataView=B;var ne=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function de(G){return l(G)==="[object SharedArrayBuffer]"}function $(G){return typeof ne>"u"?!1:(typeof de.working>"u"&&(de.working=de(new ne)),de.working?de(G):G instanceof ne)}e.isSharedArrayBuffer=$;function he(G){return l(G)==="[object AsyncFunction]"}e.isAsyncFunction=he;function X(G){return l(G)==="[object Map Iterator]"}e.isMapIterator=X;function se(G){return l(G)==="[object Set Iterator]"}e.isSetIterator=se;function pe(G){return l(G)==="[object Generator]"}e.isGeneratorObject=pe;function W(G){return l(G)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=W;function q(G){return v(G,u)}e.isNumberObject=q;function ye(G){return v(G,c)}e.isStringObject=ye;function xe(G){return v(G,h)}e.isBooleanObject=xe;function Me(G){return a&&v(G,d)}e.isBigIntObject=Me;function Q(G){return s&&v(G,p)}e.isSymbolObject=Q;function N(G){return q(G)||ye(G)||xe(G)||Me(G)||Q(G)}e.isBoxedPrimitive=N;function D(G){return typeof Uint8Array<"u"&&(I(G)||$(G))}e.isAnyArrayBuffer=D,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(G){Object.defineProperty(e,G,{enumerable:!1,value:function(){throw new Error(G+" is not supported in userland")}})})}(jm)),jm}var rv,m8;function XD(){return m8||(m8=1,rv=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}),rv}var v8;function NA(){return v8||(v8=1,function(e){var t=Object.getOwnPropertyDescriptors||function(B){for(var ne=Object.keys(B),de={},$=0;$=$)return se;switch(se){case"%s":return String(de[ne++]);case"%d":return Number(de[ne++]);case"%j":try{return JSON.stringify(de[ne++])}catch{return"[Circular]"}default:return se}}),X=de[ne];ne<$;X=de[++ne])k(X)||!Z(X)?he+=" "+X:he+=" "+a(X);return he},e.deprecate=function(m,B){if(typeof _t<"u"&&_t.noDeprecation===!0)return m;if(typeof _t>"u")return function(){return e.deprecate(m,B).apply(this,arguments)};var ne=!1;function de(){if(!ne){if(_t.throwDeprecation)throw new Error(B);_t.traceDeprecation?console.trace(B):console.error(B),ne=!0}return m.apply(this,arguments)}return de};var n={},o=/^$/;if({}.NODE_DEBUG){var i={}.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+i+"$","i")}e.debuglog=function(m){if(m=m.toUpperCase(),!n[m])if(o.test(m)){var B=_t.pid;n[m]=function(){var ne=e.format.apply(e,arguments);console.error("%s %d: %s",m,B,ne)}}else n[m]=function(){};return n[m]};function a(m,B){var ne={seen:[],stylize:l};return arguments.length>=3&&(ne.depth=arguments[2]),arguments.length>=4&&(ne.colors=arguments[3]),x(B)?ne.showHidden=B:B&&e._extend(ne,B),V(ne.showHidden)&&(ne.showHidden=!1),V(ne.depth)&&(ne.depth=2),V(ne.colors)&&(ne.colors=!1),V(ne.customInspect)&&(ne.customInspect=!0),ne.colors&&(ne.stylize=s),c(ne,m,ne.depth)}e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function s(m,B){var ne=a.styles[B];return ne?"\x1B["+a.colors[ne][0]+"m"+m+"\x1B["+a.colors[ne][1]+"m":m}function l(m,B){return m}function u(m){var B={};return m.forEach(function(ne,de){B[ne]=!0}),B}function c(m,B,ne){if(m.customInspect&&B&&_(B.inspect)&&B.inspect!==e.inspect&&!(B.constructor&&B.constructor.prototype===B)){var de=B.inspect(ne,m);return L(de)||(de=c(m,de,ne)),de}var $=h(m,B);if($)return $;var he=Object.keys(B),X=u(he);if(m.showHidden&&(he=Object.getOwnPropertyNames(B)),U(B)&&(he.indexOf("message")>=0||he.indexOf("description")>=0))return d(B);if(he.length===0){if(_(B)){var se=B.name?": "+B.name:"";return m.stylize("[Function"+se+"]","special")}if(K(B))return m.stylize(RegExp.prototype.toString.call(B),"regexp");if(ue(B))return m.stylize(Date.prototype.toString.call(B),"date");if(U(B))return d(B)}var pe="",W=!1,q=["{","}"];if(S(B)&&(W=!0,q=["[","]"]),_(B)){var ye=B.name?": "+B.name:"";pe=" [Function"+ye+"]"}if(K(B)&&(pe=" "+RegExp.prototype.toString.call(B)),ue(B)&&(pe=" "+Date.prototype.toUTCString.call(B)),U(B)&&(pe=" "+d(B)),he.length===0&&(!W||B.length==0))return q[0]+pe+q[1];if(ne<0)return K(B)?m.stylize(RegExp.prototype.toString.call(B),"regexp"):m.stylize("[Object]","special");m.seen.push(B);var xe;return W?xe=p(m,B,ne,X,he):xe=he.map(function(Me){return v(m,B,ne,X,Me,W)}),m.seen.pop(),b(xe,pe,q)}function h(m,B){if(V(B))return m.stylize("undefined","undefined");if(L(B)){var ne="'"+JSON.stringify(B).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m.stylize(ne,"string")}if(P(B))return m.stylize(""+B,"number");if(x(B))return m.stylize(""+B,"boolean");if(k(B))return m.stylize("null","null")}function d(m){return"["+Error.prototype.toString.call(m)+"]"}function p(m,B,ne,de,$){for(var he=[],X=0,se=B.length;X-1&&(he?se=se.split(` `).map(function(W){return" "+W}).join(` `).slice(2):se=` @@ -52,10 +52,10 @@ Use Chrome, Firefox or Internet Explorer 11`)}var n=Kt().Buffer,o=Ze.crypto||Ze. `))):se=m.stylize("[Circular]","special")),V(X)){if(he&&$.match(/^\d+$/))return se;X=JSON.stringify(""+$),X.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(X=X.slice(1,-1),X=m.stylize(X,"name")):(X=X.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),X=m.stylize(X,"string"))}return X+": "+se}function b(m,B,ne){var de=m.reduce(function($,he){return he.indexOf(` `)>=0,$+he.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?ne[0]+(B===""?"":B+` `)+" "+m.join(`, - `)+" "+ne[1]:ne[0]+B+" "+m.join(", ")+" "+ne[1]}e.types=JD();function S(m){return Array.isArray(m)}e.isArray=S;function x(m){return typeof m=="boolean"}e.isBoolean=x;function k(m){return m===null}e.isNull=k;function M(m){return m==null}e.isNullOrUndefined=M;function P(m){return typeof m=="number"}e.isNumber=P;function L(m){return typeof m=="string"}e.isString=L;function j(m){return typeof m=="symbol"}e.isSymbol=j;function V(m){return m===void 0}e.isUndefined=V;function K(m){return Z(m)&&f(m)==="[object RegExp]"}e.isRegExp=K,e.types.isRegExp=K;function Z(m){return typeof m=="object"&&m!==null}e.isObject=Z;function ue(m){return Z(m)&&f(m)==="[object Date]"}e.isDate=ue,e.types.isDate=ue;function U(m){return Z(m)&&(f(m)==="[object Error]"||m instanceof Error)}e.isError=U,e.types.isNativeError=U;function _(m){return typeof m=="function"}e.isFunction=_;function y(m){return m===null||typeof m=="boolean"||typeof m=="number"||typeof m=="string"||typeof m=="symbol"||typeof m>"u"}e.isPrimitive=y,e.isBuffer=eU();function f(m){return Object.prototype.toString.call(m)}function g(m){return m<10?"0"+m.toString(10):m.toString(10)}var w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var m=new Date,B=[g(m.getHours()),g(m.getMinutes()),g(m.getSeconds())].join(":");return[m.getDate(),w[m.getMonth()],B].join(" ")}e.log=function(){console.log("%s - %s",A(),e.format.apply(e,arguments))},e.inherits=Ht(),e._extend=function(m,B){if(!B||!Z(B))return m;for(var ne=Object.keys(B),de=ne.length;de--;)m[ne[de]]=B[ne[de]];return m};function T(m,B){return Object.prototype.hasOwnProperty.call(m,B)}var E=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(B){if(typeof B!="function")throw new TypeError('The "original" argument must be of type Function');if(E&&B[E]){var ne=B[E];if(typeof ne!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(ne,E,{value:ne,enumerable:!1,writable:!1,configurable:!0}),ne}function ne(){for(var de,$,he=new Promise(function(pe,W){de=pe,$=W}),X=[],se=0;se0?this.tail.next=b:this.head=b,this.tail=b,++this.length}},{key:"unshift",value:function(v){var b={data:v,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var b=this.head,S=""+b.data;b=b.next;)S+=v+b.data;return S}},{key:"concat",value:function(v){if(this.length===0)return s.alloc(0);for(var b=s.allocUnsafe(v>>>0),S=this.head,x=0;S;)h(S.data,b,x),x+=S.data.length,S=S.next;return b}},{key:"consume",value:function(v,b){var S;return vk.length?k.length:v;if(M===k.length?x+=k:x+=k.slice(0,v),v-=M,v===0){M===k.length?(++S,b.next?this.head=b.next:this.head=this.tail=null):(this.head=b,b.data=k.slice(M));break}++S}return this.length-=S,x}},{key:"_getBuffer",value:function(v){var b=s.allocUnsafe(v),S=this.head,x=1;for(S.data.copy(b),v-=S.data.length;S=S.next;){var k=S.data,M=v>k.length?k.length:v;if(k.copy(b,b.length-v,0,M),v-=M,v===0){M===k.length?(++x,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=k.slice(M));break}++x}return this.length-=x,b}},{key:c,value:function(v,b){return u(this,t({},b,{depth:0,customInspect:!1}))}}]),d}(),nv}var iv,y8;function NA(){if(y8)return iv;y8=1;function e(a,s){var l=this,u=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return u||c?(s?s(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,_t.nextTick(o,this,a)):_t.nextTick(o,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(h){!s&&h?l._writableState?l._writableState.errorEmitted?_t.nextTick(r,l):(l._writableState.errorEmitted=!0,_t.nextTick(t,l,h)):_t.nextTick(t,l,h):s?(_t.nextTick(r,l),s(h)):_t.nextTick(r,l)}),this)}function t(a,s){o(a,s),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function n(){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 o(a,s){a.emit("error",s)}function i(a,s){var l=a._readableState,u=a._writableState;l&&l.autoDestroy||u&&u.autoDestroy?a.destroy(s):a.emit("error",s)}return iv={destroy:e,undestroy:n,errorOrDestroy:i},iv}var ov={},b8;function rc(){if(b8)return ov;b8=1;function e(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,s.__proto__=l}var t={};function r(s,l,u){u||(u=Error);function c(d,p,v){return typeof l=="string"?l:l(d,p,v)}var h=function(d){e(p,d);function p(v,b,S){return d.call(this,c(v,b,S))||this}return p}(u);h.prototype.name=u.name,h.prototype.code=s,t[s]=h}function n(s,l){if(Array.isArray(s)){var u=s.length;return s=s.map(function(c){return String(c)}),u>2?"one of ".concat(l," ").concat(s.slice(0,u-1).join(", "),", or ")+s[u-1]:u===2?"one of ".concat(l," ").concat(s[0]," or ").concat(s[1]):"of ".concat(l," ").concat(s[0])}else return"of ".concat(l," ").concat(String(s))}function o(s,l,u){return s.substr(!u||u<0?0:+u,l.length)===l}function i(s,l,u){return(u===void 0||u>s.length)&&(u=s.length),s.substring(u-l.length,u)===l}function a(s,l,u){return typeof u!="number"&&(u=0),u+l.length>s.length?!1:s.indexOf(l,u)!==-1}return r("ERR_INVALID_OPT_VALUE",function(s,l){return'The value "'+l+'" is invalid for option "'+s+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(s,l,u){var c;typeof l=="string"&&o(l,"not ")?(c="must not be",l=l.replace(/^not /,"")):c="must be";var h;if(i(s," argument"))h="The ".concat(s," ").concat(c," ").concat(n(l,"type"));else{var d=a(s,".")?"property":"argument";h='The "'.concat(s,'" ').concat(d," ").concat(c," ").concat(n(l,"type"))}return h+=". Received type ".concat(typeof u),h},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ov.codes=t,ov}var av,w8;function LA(){if(w8)return av;w8=1;var e=rc().codes.ERR_INVALID_OPT_VALUE;function t(n,o,i){return n.highWaterMark!=null?n.highWaterMark:o?n[i]:null}function r(n,o,i,a){var s=t(o,a,i);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=a?i:"highWaterMark";throw new e(l,s)}return Math.floor(s)}return n.objectMode?16:16*1024}return av={getHighWaterMark:r},av}var sv,_8;function rU(){if(_8)return sv;_8=1,sv=e;function e(r,n){if(t("noDeprecation"))return r;var o=!1;function i(){if(!o){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),o=!0}return r.apply(this,arguments)}return i}function t(r){try{if(!Ze.localStorage)return!1}catch{return!1}var n=Ze.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return sv}var lv,x8;function dw(){if(x8)return lv;x8=1,lv=K;function e($){var he=this;this.next=null,this.entry=null,this.finish=function(){de(he,$)}}var t;K.WritableState=j;var r={deprecate:rU()},n=MA(),o=Oe.Buffer,i=Ze.Uint8Array||function(){};function a($){return o.from($)}function s($){return o.isBuffer($)||$ instanceof i}var l=NA(),u=LA(),c=u.getHighWaterMark,h=rc().codes,d=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_MULTIPLE_CALLBACK,b=h.ERR_STREAM_CANNOT_PIPE,S=h.ERR_STREAM_DESTROYED,x=h.ERR_STREAM_NULL_VALUES,k=h.ERR_STREAM_WRITE_AFTER_END,M=h.ERR_UNKNOWN_ENCODING,P=l.errorOrDestroy;Ht()(K,n);function L(){}function j($,he,X){t=t||el(),$=$||{},typeof X!="boolean"&&(X=he instanceof t),this.objectMode=!!$.objectMode,X&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=c(this,$,"writableHighWaterMark",X),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var se=$.decodeStrings===!1;this.decodeStrings=!se,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(pe){w(he,pe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=$.emitClose!==!1,this.autoDestroy=!!$.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}j.prototype.getBuffer=function(){for(var he=this.bufferedRequest,X=[];he;)X.push(he),he=he.next;return X},function(){try{Object.defineProperty(j.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var V;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(V=Function.prototype[Symbol.hasInstance],Object.defineProperty(K,Symbol.hasInstance,{value:function(he){return V.call(this,he)?!0:this!==K?!1:he&&he._writableState instanceof j}})):V=function(he){return he instanceof this};function K($){t=t||el();var he=this instanceof t;if(!he&&!V.call(K,this))return new K($);this._writableState=new j($,this,he),this.writable=!0,$&&(typeof $.write=="function"&&(this._write=$.write),typeof $.writev=="function"&&(this._writev=$.writev),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.final=="function"&&(this._final=$.final)),n.call(this)}K.prototype.pipe=function(){P(this,new b)};function Z($,he){var X=new k;P($,X),_t.nextTick(he,X)}function ue($,he,X,se){var pe;return X===null?pe=new x:typeof X!="string"&&!he.objectMode&&(pe=new d("chunk",["string","Buffer"],X)),pe?(P($,pe),_t.nextTick(se,pe),!1):!0}K.prototype.write=function($,he,X){var se=this._writableState,pe=!1,W=!se.objectMode&&s($);return W&&!o.isBuffer($)&&($=a($)),typeof he=="function"&&(X=he,he=null),W?he="buffer":he||(he=se.defaultEncoding),typeof X!="function"&&(X=L),se.ending?Z(this,X):(W||ue(this,se,$,X))&&(se.pendingcb++,pe=_(this,se,W,$,he,X)),pe},K.prototype.cork=function(){this._writableState.corked++},K.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&E(this,$))},K.prototype.setDefaultEncoding=function(he){if(typeof he=="string"&&(he=he.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((he+"").toLowerCase())>-1))throw new M(he);return this._writableState.defaultEncoding=he,this},Object.defineProperty(K.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function U($,he,X){return!$.objectMode&&$.decodeStrings!==!1&&typeof he=="string"&&(he=o.from(he,X)),he}Object.defineProperty(K.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function _($,he,X,se,pe,W){if(!X){var q=U(he,se,pe);se!==q&&(X=!0,pe="buffer",se=q)}var ye=he.objectMode?1:se.length;he.length+=ye;var xe=he.length>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,k,M){var P=k.length-1;if(P=0?(L>0&&(x.lastNeed=L-1),L):--P=0?(L>0&&(x.lastNeed=L-2),L):--P=0?(L>0&&(L===2?L=0:x.lastNeed=L-3),L):0))}function s(x,k,M){if((k[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return x.lastNeed=2,"�"}}function l(x){var k=this.lastTotal-this.lastNeed,M=s(this,x);if(M!==void 0)return M;if(this.lastNeed<=x.length)return x.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,k,0,x.length),this.lastNeed-=x.length}function u(x,k){var M=a(this,x,k);if(!this.lastNeed)return x.toString("utf8",k);this.lastTotal=M;var P=x.length-(M-this.lastNeed);return x.copy(this.lastChar,0,P),x.toString("utf8",k,P)}function c(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+"�":k}function h(x,k){if((x.length-k)%2===0){var M=x.toString("utf16le",k);if(M){var P=M.charCodeAt(M.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],M.slice(0,-1)}return M}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",k,x.length-1)}function d(x){var k=x&&x.length?this.write(x):"";if(this.lastNeed){var M=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,M)}return k}function p(x,k){var M=(x.length-k)%3;return M===0?x.toString("base64",k):(this.lastNeed=3-M,this.lastTotal=3,M===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",k,x.length-M))}function v(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function b(x){return x.toString(this.encoding)}function S(x){return x&&x.length?this.write(x):""}return cv}var fv,E8;function x1(){if(E8)return fv;E8=1;var e=rc().codes.ERR_STREAM_PREMATURE_CLOSE;function t(i){var a=!1;return function(){if(!a){a=!0;for(var s=arguments.length,l=new Array(s),u=0;u0)if(typeof q!="string"&&!Q.objectMode&&Object.getPrototypeOf(q)!==n.prototype&&(q=i(q)),xe)Q.endEmitted?L(W,new x):U(W,Q,q,!0);else if(Q.ended)L(W,new b);else{if(Q.destroyed)return!1;Q.reading=!1,Q.decoder&&!ye?(q=Q.decoder.write(q),Q.objectMode||q.length!==0?U(W,Q,q,!1):E(W,Q)):U(W,Q,q,!1)}else xe||(Q.reading=!1,E(W,Q))}return!Q.ended&&(Q.length=y?W=y:(W--,W|=W>>>1,W|=W>>>2,W|=W>>>4,W|=W>>>8,W|=W>>>16,W++),W}function g(W,q){return W<=0||q.length===0&&q.ended?0:q.objectMode?1:W!==W?q.flowing&&q.length?q.buffer.head.data.length:q.length:(W>q.highWaterMark&&(q.highWaterMark=f(W)),W<=q.length?W:q.ended?q.length:(q.needReadable=!0,0))}Z.prototype.read=function(W){l("read",W),W=parseInt(W,10);var q=this._readableState,ye=W;if(W!==0&&(q.emittedReadable=!1),W===0&&q.needReadable&&((q.highWaterMark!==0?q.length>=q.highWaterMark:q.length>0)||q.ended))return l("read: emitReadable",q.length,q.ended),q.length===0&&q.ended?X(this):A(this),null;if(W=g(W,q),W===0&&q.ended)return q.length===0&&X(this),null;var xe=q.needReadable;l("need readable",xe),(q.length===0||q.length-W0?Me=he(W,q):Me=null,Me===null?(q.needReadable=q.length<=q.highWaterMark,W=0):(q.length-=W,q.awaitDrain=0),q.length===0&&(q.ended||(q.needReadable=!0),ye!==W&&q.ended&&X(this)),Me!==null&&this.emit("data",Me),Me};function w(W,q){if(l("onEofChunk"),!q.ended){if(q.decoder){var ye=q.decoder.end();ye&&ye.length&&(q.buffer.push(ye),q.length+=q.objectMode?1:ye.length)}q.ended=!0,q.sync?A(W):(q.needReadable=!1,q.emittedReadable||(q.emittedReadable=!0,T(W)))}}function A(W){var q=W._readableState;l("emitReadable",q.needReadable,q.emittedReadable),q.needReadable=!1,q.emittedReadable||(l("emitReadable",q.flowing),q.emittedReadable=!0,_t.nextTick(T,W))}function T(W){var q=W._readableState;l("emitReadable_",q.destroyed,q.length,q.ended),!q.destroyed&&(q.length||q.ended)&&(W.emit("readable"),q.emittedReadable=!1),q.needReadable=!q.flowing&&!q.ended&&q.length<=q.highWaterMark,$(W)}function E(W,q){q.readingMore||(q.readingMore=!0,_t.nextTick(C,W,q))}function C(W,q){for(;!q.reading&&!q.ended&&(q.length1&&pe(xe.pipes,W)!==-1)&&!me&&(l("false write response, pause",xe.awaitDrain),xe.awaitDrain++),ye.pause())}function Fe(re){l("onerror",re),Y(),W.removeListener("error",Fe),t(W,"error")===0&&L(W,re)}V(W,"error",Fe);function Re(){W.removeListener("finish",le),Y()}W.once("close",Re);function le(){l("onfinish"),W.removeListener("close",Re),Y()}W.once("finish",le);function Y(){l("unpipe"),ye.unpipe(W)}return W.emit("pipe",ye),xe.flowing||(l("pipe resume"),ye.resume()),W};function I(W){return function(){var ye=W._readableState;l("pipeOnDrain",ye.awaitDrain),ye.awaitDrain&&ye.awaitDrain--,ye.awaitDrain===0&&t(W,"data")&&(ye.flowing=!0,$(W))}}Z.prototype.unpipe=function(W){var q=this._readableState,ye={hasUnpiped:!1};if(q.pipesCount===0)return this;if(q.pipesCount===1)return W&&W!==q.pipes?this:(W||(W=q.pipes),q.pipes=null,q.pipesCount=0,q.flowing=!1,W&&W.emit("unpipe",this,ye),this);if(!W){var xe=q.pipes,Me=q.pipesCount;q.pipes=null,q.pipesCount=0,q.flowing=!1;for(var Q=0;Q0,xe.flowing!==!1&&this.resume()):W==="readable"&&!xe.endEmitted&&!xe.readableListening&&(xe.readableListening=xe.needReadable=!0,xe.flowing=!1,xe.emittedReadable=!1,l("on readable",xe.length,xe.reading),xe.length?A(this):xe.reading||_t.nextTick(B,this)),ye},Z.prototype.addListener=Z.prototype.on,Z.prototype.removeListener=function(W,q){var ye=r.prototype.removeListener.call(this,W,q);return W==="readable"&&_t.nextTick(m,this),ye},Z.prototype.removeAllListeners=function(W){var q=r.prototype.removeAllListeners.apply(this,arguments);return(W==="readable"||W===void 0)&&_t.nextTick(m,this),q};function m(W){var q=W._readableState;q.readableListening=W.listenerCount("readable")>0,q.resumeScheduled&&!q.paused?q.flowing=!0:W.listenerCount("data")>0&&W.resume()}function B(W){l("readable nexttick read 0"),W.read(0)}Z.prototype.resume=function(){var W=this._readableState;return W.flowing||(l("resume"),W.flowing=!W.readableListening,ne(this,W)),W.paused=!1,this};function ne(W,q){q.resumeScheduled||(q.resumeScheduled=!0,_t.nextTick(de,W,q))}function de(W,q){l("resume",q.reading),q.reading||W.read(0),q.resumeScheduled=!1,W.emit("resume"),$(W),q.flowing&&!q.reading&&W.read(0)}Z.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function $(W){var q=W._readableState;for(l("flow",q.flowing);q.flowing&&W.read()!==null;);}Z.prototype.wrap=function(W){var q=this,ye=this._readableState,xe=!1;W.on("end",function(){if(l("wrapped end"),ye.decoder&&!ye.ended){var N=ye.decoder.end();N&&N.length&&q.push(N)}q.push(null)}),W.on("data",function(N){if(l("wrapped data"),ye.decoder&&(N=ye.decoder.write(N)),!(ye.objectMode&&N==null)&&!(!ye.objectMode&&(!N||!N.length))){var D=q.push(N);D||(xe=!0,W.pause())}});for(var Me in W)this[Me]===void 0&&typeof W[Me]=="function"&&(this[Me]=function(D){return function(){return W[D].apply(W,arguments)}}(Me));for(var Q=0;Q=q.length?(q.decoder?ye=q.buffer.join(""):q.buffer.length===1?ye=q.buffer.first():ye=q.buffer.concat(q.length),q.buffer.clear()):ye=q.buffer.consume(W,q.decoder),ye}function X(W){var q=W._readableState;l("endReadable",q.endEmitted),q.endEmitted||(q.ended=!0,_t.nextTick(se,q,W))}function se(W,q){if(l("endReadableNT",W.endEmitted,W.length),!W.endEmitted&&W.length===0&&(W.endEmitted=!0,q.readable=!1,q.emit("end"),W.autoDestroy)){var ye=q._writableState;(!ye||ye.autoDestroy&&ye.finished)&&q.destroy()}}typeof Symbol=="function"&&(Z.from=function(W,q){return P===void 0&&(P=iU()),P(Z,W,q)});function pe(W,q){for(var ye=0,xe=W.length;ye0;return s(k,P,L,function(j){S||(S=j),j&&x.forEach(l),!P&&(x.forEach(l),b(S))})});return p.reduce(u)}return vv=h,vv}var P8;function jA(){return P8||(P8=1,function(e,t){t=e.exports=hw(),t.Stream=t,t.Readable=t,t.Writable=dw(),t.Duplex=el(),t.Transform=pw(),t.PassThrough=DA(),t.finished=x1(),t.pipeline=UA()}($D,Af)),Af}var yv,R8;function FA(){if(R8)return yv;R8=1;var e=Kt().Buffer,t=jA().Transform,r=Ht();function n(i,a){if(!e.isBuffer(i)&&typeof i!="string")throw new TypeError(a+" must be a string or a buffer")}function o(i){t.call(this),this._block=e.allocUnsafe(i),this._blockSize=i,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return r(o,t),o.prototype._transform=function(i,a,s){var l=null;try{this.update(i,a)}catch(u){l=u}s(l)},o.prototype._flush=function(i){var a=null;try{this.push(this.digest())}catch(s){a=s}i(a)},o.prototype.update=function(i,a){if(n(i,"Data"),this._finalized)throw new Error("Digest already called");e.isBuffer(i)||(i=e.from(i,a));for(var s=this._block,l=0;this._blockOffset+i.length-l>=this._blockSize;){for(var u=this._blockOffset;u0;++c)this._length[c]+=h,h=this._length[c]/4294967296|0,h>0&&(this._length[c]-=4294967296*h);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(i){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();i!==void 0&&(a=a.toString(i)),this._block.fill(0),this._blockOffset=0;for(var s=0;s<4;++s)this._length[s]=0;return a},o.prototype._digest=function(){throw new Error("_digest is not implemented")},yv=o,yv}var bv,O8;function gw(){if(O8)return bv;O8=1;var e=Ht(),t=FA(),r=Kt().Buffer,n=new Array(16);function o(){t.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}e(o,t),o.prototype._update=function(){for(var c=n,h=0;h<16;++h)c[h]=this._block.readInt32LE(h*4);var d=this._a,p=this._b,v=this._c,b=this._d;d=a(d,p,v,b,c[0],3614090360,7),b=a(b,d,p,v,c[1],3905402710,12),v=a(v,b,d,p,c[2],606105819,17),p=a(p,v,b,d,c[3],3250441966,22),d=a(d,p,v,b,c[4],4118548399,7),b=a(b,d,p,v,c[5],1200080426,12),v=a(v,b,d,p,c[6],2821735955,17),p=a(p,v,b,d,c[7],4249261313,22),d=a(d,p,v,b,c[8],1770035416,7),b=a(b,d,p,v,c[9],2336552879,12),v=a(v,b,d,p,c[10],4294925233,17),p=a(p,v,b,d,c[11],2304563134,22),d=a(d,p,v,b,c[12],1804603682,7),b=a(b,d,p,v,c[13],4254626195,12),v=a(v,b,d,p,c[14],2792965006,17),p=a(p,v,b,d,c[15],1236535329,22),d=s(d,p,v,b,c[1],4129170786,5),b=s(b,d,p,v,c[6],3225465664,9),v=s(v,b,d,p,c[11],643717713,14),p=s(p,v,b,d,c[0],3921069994,20),d=s(d,p,v,b,c[5],3593408605,5),b=s(b,d,p,v,c[10],38016083,9),v=s(v,b,d,p,c[15],3634488961,14),p=s(p,v,b,d,c[4],3889429448,20),d=s(d,p,v,b,c[9],568446438,5),b=s(b,d,p,v,c[14],3275163606,9),v=s(v,b,d,p,c[3],4107603335,14),p=s(p,v,b,d,c[8],1163531501,20),d=s(d,p,v,b,c[13],2850285829,5),b=s(b,d,p,v,c[2],4243563512,9),v=s(v,b,d,p,c[7],1735328473,14),p=s(p,v,b,d,c[12],2368359562,20),d=l(d,p,v,b,c[5],4294588738,4),b=l(b,d,p,v,c[8],2272392833,11),v=l(v,b,d,p,c[11],1839030562,16),p=l(p,v,b,d,c[14],4259657740,23),d=l(d,p,v,b,c[1],2763975236,4),b=l(b,d,p,v,c[4],1272893353,11),v=l(v,b,d,p,c[7],4139469664,16),p=l(p,v,b,d,c[10],3200236656,23),d=l(d,p,v,b,c[13],681279174,4),b=l(b,d,p,v,c[0],3936430074,11),v=l(v,b,d,p,c[3],3572445317,16),p=l(p,v,b,d,c[6],76029189,23),d=l(d,p,v,b,c[9],3654602809,4),b=l(b,d,p,v,c[12],3873151461,11),v=l(v,b,d,p,c[15],530742520,16),p=l(p,v,b,d,c[2],3299628645,23),d=u(d,p,v,b,c[0],4096336452,6),b=u(b,d,p,v,c[7],1126891415,10),v=u(v,b,d,p,c[14],2878612391,15),p=u(p,v,b,d,c[5],4237533241,21),d=u(d,p,v,b,c[12],1700485571,6),b=u(b,d,p,v,c[3],2399980690,10),v=u(v,b,d,p,c[10],4293915773,15),p=u(p,v,b,d,c[1],2240044497,21),d=u(d,p,v,b,c[8],1873313359,6),b=u(b,d,p,v,c[15],4264355552,10),v=u(v,b,d,p,c[6],2734768916,15),p=u(p,v,b,d,c[13],1309151649,21),d=u(d,p,v,b,c[4],4149444226,6),b=u(b,d,p,v,c[11],3174756917,10),v=u(v,b,d,p,c[2],718787259,15),p=u(p,v,b,d,c[9],3951481745,21),this._a=this._a+d|0,this._b=this._b+p|0,this._c=this._c+v|0,this._d=this._d+b|0},o.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 c=r.allocUnsafe(16);return c.writeInt32LE(this._a,0),c.writeInt32LE(this._b,4),c.writeInt32LE(this._c,8),c.writeInt32LE(this._d,12),c};function i(c,h){return c<>>32-h}function a(c,h,d,p,v,b,S){return i(c+(h&d|~h&p)+v+b|0,S)+h|0}function s(c,h,d,p,v,b,S){return i(c+(h&p|d&~p)+v+b|0,S)+h|0}function l(c,h,d,p,v,b,S){return i(c+(h^d^p)+v+b|0,S)+h|0}function u(c,h,d,p,v,b,S){return i(c+(d^(h|~p))+v+b|0,S)+h|0}return bv=o,bv}var wv,N8;function mw(){if(N8)return wv;N8=1;var e=Oe.Buffer,t=Ht(),r=FA(),n=new Array(16),o=[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],i=[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],a=[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],s=[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],l=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function c(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}t(c,r),c.prototype._update=function(){for(var x=n,k=0;k<16;++k)x[k]=this._block.readInt32LE(k*4);for(var M=this._a|0,P=this._b|0,L=this._c|0,j=this._d|0,V=this._e|0,K=this._a|0,Z=this._b|0,ue=this._c|0,U=this._d|0,_=this._e|0,y=0;y<80;y+=1){var f,g;y<16?(f=d(M,P,L,j,V,x[o[y]],l[0],a[y]),g=S(K,Z,ue,U,_,x[i[y]],u[0],s[y])):y<32?(f=p(M,P,L,j,V,x[o[y]],l[1],a[y]),g=b(K,Z,ue,U,_,x[i[y]],u[1],s[y])):y<48?(f=v(M,P,L,j,V,x[o[y]],l[2],a[y]),g=v(K,Z,ue,U,_,x[i[y]],u[2],s[y])):y<64?(f=b(M,P,L,j,V,x[o[y]],l[3],a[y]),g=p(K,Z,ue,U,_,x[i[y]],u[3],s[y])):(f=S(M,P,L,j,V,x[o[y]],l[4],a[y]),g=d(K,Z,ue,U,_,x[i[y]],u[4],s[y])),M=V,V=j,j=h(L,10),L=P,P=f,K=_,_=U,U=h(ue,10),ue=Z,Z=g}var w=this._b+L+U|0;this._b=this._c+j+_|0,this._c=this._d+V+K|0,this._d=this._e+M+Z|0,this._e=this._a+P+ue|0,this._a=w},c.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 x=e.alloc?e.alloc(20):new e(20);return x.writeInt32LE(this._a,0),x.writeInt32LE(this._b,4),x.writeInt32LE(this._c,8),x.writeInt32LE(this._d,12),x.writeInt32LE(this._e,16),x};function h(x,k){return x<>>32-k}function d(x,k,M,P,L,j,V,K){return h(x+(k^M^P)+j+V|0,K)+L|0}function p(x,k,M,P,L,j,V,K){return h(x+(k&M|~k&P)+j+V|0,K)+L|0}function v(x,k,M,P,L,j,V,K){return h(x+((k|~M)^P)+j+V|0,K)+L|0}function b(x,k,M,P,L,j,V,K){return h(x+(k&P|M&~P)+j+V|0,K)+L|0}function S(x,k,M,P,L,j,V,K){return h(x+(k^(M|~P))+j+V|0,K)+L|0}return wv=c,wv}var np={},oU={get exports(){return np},set exports(e){np=e}},_v,L8;function nc(){if(L8)return _v;L8=1;var e=Kt().Buffer;function t(r,n){this._block=e.alloc(r),this._finalSize=n,this._blockSize=r,this._len=0}return t.prototype.update=function(r,n){typeof r=="string"&&(n=n||"utf8",r=e.from(r,n));for(var o=this._block,i=this._blockSize,a=r.length,s=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var o=this._len*8;if(o<=4294967295)this._block.writeUInt32BE(o,this._blockSize-4);else{var i=(o&4294967295)>>>0,a=(o-i)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return r?s.toString(r):s},t.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_v=t,_v}var xv,D8;function aU(){if(D8)return xv;D8=1;var e=Ht(),t=nc(),r=Kt().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],o=new Array(80);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function a(u){return u<<5|u>>>27}function s(u){return u<<30|u>>>2}function l(u,c,h,d){return u===0?c&h|~c&d:u===2?c&h|c&d|h&d:c^h^d}return i.prototype._update=function(u){for(var c=this._w,h=this._a|0,d=this._b|0,p=this._c|0,v=this._d|0,b=this._e|0,S=0;S<16;++S)c[S]=u.readInt32BE(S*4);for(;S<80;++S)c[S]=c[S-3]^c[S-8]^c[S-14]^c[S-16];for(var x=0;x<80;++x){var k=~~(x/20),M=a(h)+l(k,d,p,v)+b+c[x]+n[k]|0;b=v,v=p,p=s(d),d=h,h=M}this._a=h+this._a|0,this._b=d+this._b|0,this._c=p+this._c|0,this._d=v+this._d|0,this._e=b+this._e|0},i.prototype._hash=function(){var u=r.allocUnsafe(20);return u.writeInt32BE(this._a|0,0),u.writeInt32BE(this._b|0,4),u.writeInt32BE(this._c|0,8),u.writeInt32BE(this._d|0,12),u.writeInt32BE(this._e|0,16),u},xv=i,xv}var Sv,U8;function sU(){if(U8)return Sv;U8=1;var e=Ht(),t=nc(),r=Kt().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],o=new Array(80);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function a(c){return c<<1|c>>>31}function s(c){return c<<5|c>>>27}function l(c){return c<<30|c>>>2}function u(c,h,d,p){return c===0?h&d|~h&p:c===2?h&d|h&p|d&p:h^d^p}return i.prototype._update=function(c){for(var h=this._w,d=this._a|0,p=this._b|0,v=this._c|0,b=this._d|0,S=this._e|0,x=0;x<16;++x)h[x]=c.readInt32BE(x*4);for(;x<80;++x)h[x]=a(h[x-3]^h[x-8]^h[x-14]^h[x-16]);for(var k=0;k<80;++k){var M=~~(k/20),P=s(d)+u(M,p,v,b)+S+h[k]+n[M]|0;S=b,b=v,v=l(p),p=d,d=P}this._a=d+this._a|0,this._b=p+this._b|0,this._c=v+this._c|0,this._d=b+this._d|0,this._e=S+this._e|0},i.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},Sv=i,Sv}var Cv,j8;function zA(){if(j8)return Cv;j8=1;var e=Ht(),t=nc(),r=Kt().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],o=new Array(64);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.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 a(d,p,v){return v^d&(p^v)}function s(d,p,v){return d&p|v&(d|p)}function l(d){return(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10)}function u(d){return(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7)}function c(d){return(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3}function h(d){return(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10}return i.prototype._update=function(d){for(var p=this._w,v=this._a|0,b=this._b|0,S=this._c|0,x=this._d|0,k=this._e|0,M=this._f|0,P=this._g|0,L=this._h|0,j=0;j<16;++j)p[j]=d.readInt32BE(j*4);for(;j<64;++j)p[j]=h(p[j-2])+p[j-7]+c(p[j-15])+p[j-16]|0;for(var V=0;V<64;++V){var K=L+u(k)+a(k,M,P)+n[V]+p[V]|0,Z=l(v)+s(v,b,S)|0;L=P,P=M,M=k,k=x+K|0,x=S,S=b,b=v,v=K+Z|0}this._a=v+this._a|0,this._b=b+this._b|0,this._c=S+this._c|0,this._d=x+this._d|0,this._e=k+this._e|0,this._f=M+this._f|0,this._g=P+this._g|0,this._h=L+this._h|0},i.prototype._hash=function(){var d=r.allocUnsafe(32);return d.writeInt32BE(this._a,0),d.writeInt32BE(this._b,4),d.writeInt32BE(this._c,8),d.writeInt32BE(this._d,12),d.writeInt32BE(this._e,16),d.writeInt32BE(this._f,20),d.writeInt32BE(this._g,24),d.writeInt32BE(this._h,28),d},Cv=i,Cv}var Ev,F8;function lU(){if(F8)return Ev;F8=1;var e=Ht(),t=zA(),r=nc(),n=Kt().Buffer,o=new Array(64);function i(){this.init(),this._w=o,r.call(this,64,56)}return e(i,t),i.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},i.prototype._hash=function(){var a=n.allocUnsafe(28);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a},Ev=i,Ev}var kv,z8;function $A(){if(z8)return kv;z8=1;var e=Ht(),t=nc(),r=Kt().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],o=new Array(160);function i(){this.init(),this._w=o,t.call(this,128,112)}e(i,t),i.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 a(b,S,x){return x^b&(S^x)}function s(b,S,x){return b&S|x&(b|S)}function l(b,S){return(b>>>28|S<<4)^(S>>>2|b<<30)^(S>>>7|b<<25)}function u(b,S){return(b>>>14|S<<18)^(b>>>18|S<<14)^(S>>>9|b<<23)}function c(b,S){return(b>>>1|S<<31)^(b>>>8|S<<24)^b>>>7}function h(b,S){return(b>>>1|S<<31)^(b>>>8|S<<24)^(b>>>7|S<<25)}function d(b,S){return(b>>>19|S<<13)^(S>>>29|b<<3)^b>>>6}function p(b,S){return(b>>>19|S<<13)^(S>>>29|b<<3)^(b>>>6|S<<26)}function v(b,S){return b>>>0>>0?1:0}return i.prototype._update=function(b){for(var S=this._w,x=this._ah|0,k=this._bh|0,M=this._ch|0,P=this._dh|0,L=this._eh|0,j=this._fh|0,V=this._gh|0,K=this._hh|0,Z=this._al|0,ue=this._bl|0,U=this._cl|0,_=this._dl|0,y=this._el|0,f=this._fl|0,g=this._gl|0,w=this._hl|0,A=0;A<32;A+=2)S[A]=b.readInt32BE(A*4),S[A+1]=b.readInt32BE(A*4+4);for(;A<160;A+=2){var T=S[A-30],E=S[A-15*2+1],C=c(T,E),I=h(E,T);T=S[A-2*2],E=S[A-2*2+1];var m=d(T,E),B=p(E,T),ne=S[A-7*2],de=S[A-7*2+1],$=S[A-16*2],he=S[A-16*2+1],X=I+de|0,se=C+ne+v(X,I)|0;X=X+B|0,se=se+m+v(X,B)|0,X=X+he|0,se=se+$+v(X,he)|0,S[A]=se,S[A+1]=X}for(var pe=0;pe<160;pe+=2){se=S[pe],X=S[pe+1];var W=s(x,k,M),q=s(Z,ue,U),ye=l(x,Z),xe=l(Z,x),Me=u(L,y),Q=u(y,L),N=n[pe],D=n[pe+1],G=a(L,j,V),me=a(y,f,g),_e=w+Q|0,Pe=K+Me+v(_e,w)|0;_e=_e+me|0,Pe=Pe+G+v(_e,me)|0,_e=_e+D|0,Pe=Pe+N+v(_e,D)|0,_e=_e+X|0,Pe=Pe+se+v(_e,X)|0;var Fe=xe+q|0,Re=ye+W+v(Fe,xe)|0;K=V,w=g,V=j,g=f,j=L,f=y,y=_+_e|0,L=P+Pe+v(y,_)|0,P=M,_=U,M=k,U=ue,k=x,ue=Z,Z=_e+Fe|0,x=Pe+Re+v(Z,_e)|0}this._al=this._al+Z|0,this._bl=this._bl+ue|0,this._cl=this._cl+U|0,this._dl=this._dl+_|0,this._el=this._el+y|0,this._fl=this._fl+f|0,this._gl=this._gl+g|0,this._hl=this._hl+w|0,this._ah=this._ah+x+v(this._al,Z)|0,this._bh=this._bh+k+v(this._bl,ue)|0,this._ch=this._ch+M+v(this._cl,U)|0,this._dh=this._dh+P+v(this._dl,_)|0,this._eh=this._eh+L+v(this._el,y)|0,this._fh=this._fh+j+v(this._fl,f)|0,this._gh=this._gh+V+v(this._gl,g)|0,this._hh=this._hh+K+v(this._hl,w)|0},i.prototype._hash=function(){var b=r.allocUnsafe(64);function S(x,k,M){b.writeInt32BE(x,M),b.writeInt32BE(k,M+4)}return S(this._ah,this._al,0),S(this._bh,this._bl,8),S(this._ch,this._cl,16),S(this._dh,this._dl,24),S(this._eh,this._el,32),S(this._fh,this._fl,40),S(this._gh,this._gl,48),S(this._hh,this._hl,56),b},kv=i,kv}var Av,$8;function uU(){if($8)return Av;$8=1;var e=Ht(),t=$A(),r=nc(),n=Kt().Buffer,o=new Array(160);function i(){this.init(),this._w=o,r.call(this,128,112)}return e(i,t),i.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},i.prototype._hash=function(){var a=n.allocUnsafe(48);function s(l,u,c){a.writeInt32BE(l,c),a.writeInt32BE(u,c+4)}return s(this._ah,this._al,0),s(this._bh,this._bl,8),s(this._ch,this._cl,16),s(this._dh,this._dl,24),s(this._eh,this._el,32),s(this._fh,this._fl,40),a},Av=i,Av}var q8;function vw(){if(q8)return np;q8=1;var e=oU.exports=function(r){r=r.toLowerCase();var n=e[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n};return e.sha=aU(),e.sha1=sU(),e.sha224=lU(),e.sha256=zA(),e.sha384=uU(),e.sha512=$A(),np}var Mv,W8;function cU(){if(W8)return Mv;W8=1,Mv=r;var e=lw().EventEmitter,t=Ht();t(r,e),r.Readable=hw(),r.Writable=dw(),r.Duplex=el(),r.Transform=pw(),r.PassThrough=DA(),r.finished=x1(),r.pipeline=UA(),r.Stream=r;function r(){e.call(this)}return r.prototype.pipe=function(n,o){var i=this;function a(p){n.writable&&n.write(p)===!1&&i.pause&&i.pause()}i.on("data",a);function s(){i.readable&&i.resume&&i.resume()}n.on("drain",s),!n._isStdio&&(!o||o.end!==!1)&&(i.on("end",u),i.on("close",c));var l=!1;function u(){l||(l=!0,n.end())}function c(){l||(l=!0,typeof n.destroy=="function"&&n.destroy())}function h(p){if(d(),e.listenerCount(this,"error")===0)throw p}i.on("error",h),n.on("error",h);function d(){i.removeListener("data",a),n.removeListener("drain",s),i.removeListener("end",u),i.removeListener("close",c),i.removeListener("error",h),n.removeListener("error",h),i.removeListener("end",d),i.removeListener("close",d),n.removeListener("close",d)}return i.on("end",d),i.on("close",d),n.on("close",d),n.emit("pipe",i),n},Mv}var Iv,V8;function ds(){if(V8)return Iv;V8=1;var e=Kt().Buffer,t=cU().Transform,r=Yb().StringDecoder,n=Ht();function o(i){t.call(this),this.hashMode=typeof i=="string",this.hashMode?this[i]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return n(o,t),o.prototype.update=function(i,a,s){typeof i=="string"&&(i=e.from(i,a));var l=this._update(i);return this.hashMode?this:(s&&(l=this._toString(l,s)),l)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(i,a,s){var l;try{this.hashMode?this._update(i):this.push(this._update(i))}catch(u){l=u}finally{s(l)}},o.prototype._flush=function(i){var a;try{this.push(this.__final())}catch(s){a=s}i(a)},o.prototype._finalOrDigest=function(i){var a=this.__final()||e.alloc(0);return i&&(a=this._toString(a,i,!0)),a},o.prototype._toString=function(i,a,s){if(this._decoder||(this._decoder=new r(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var l=this._decoder.write(i);return s&&(l+=this._decoder.end()),l},Iv=o,Iv}var Tv,H8;function $d(){if(H8)return Tv;H8=1;var e=Ht(),t=gw(),r=mw(),n=vw(),o=ds();function i(a){o.call(this,"digest"),this._hash=a}return e(i,o),i.prototype._update=function(a){this._hash.update(a)},i.prototype._final=function(){return this._hash.digest()},Tv=function(s){return s=s.toLowerCase(),s==="md5"?new t:s==="rmd160"||s==="ripemd160"?new r:new i(n(s))},Tv}var Bv,K8;function fU(){if(K8)return Bv;K8=1;var e=Ht(),t=Kt().Buffer,r=ds(),n=t.alloc(128),o=64;function i(a,s){r.call(this,"digest"),typeof s=="string"&&(s=t.from(s)),this._alg=a,this._key=s,s.length>o?s=a(s):s.lengthh){var d=u==="rmd160"?new i:a(u);c=d.update(c).digest()}else c.lengthe||r!==r)throw new TypeError("Bad key length")},Ov}var Nv,X8;function KA(){if(X8)return Nv;X8=1;var e;if(Ze.process&&Ze.process.browser)e="utf-8";else if(Ze.process&&Ze.process.version){var t=parseInt(_t.version.split(".")[0].slice(1),10);e=t>=6?"utf-8":"binary"}else e="utf-8";return Nv=e,Nv}var Lv,J8;function ZA(){if(J8)return Lv;J8=1;var e=Kt().Buffer;return Lv=function(t,r,n){if(e.isBuffer(t))return t;if(typeof t=="string")return e.from(t,r);if(ArrayBuffer.isView(t))return e.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},Lv}var Dv,e9;function GA(){if(e9)return Dv;e9=1;var e=qA(),t=mw(),r=vw(),n=Kt().Buffer,o=HA(),i=KA(),a=ZA(),s=n.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function u(d,p,v){var b=c(d),S=d==="sha512"||d==="sha384"?128:64;p.length>S?p=b(p):p.length>>0},oi.writeUInt32BE=function(o,i,a){o[0+a]=i>>>24,o[1+a]=i>>>16&255,o[2+a]=i>>>8&255,o[3+a]=i&255},oi.ip=function(o,i,a,s){for(var l=0,u=0,c=6;c>=0;c-=2){for(var h=0;h<=24;h+=8)l<<=1,l|=i>>>h+c&1;for(var h=0;h<=24;h+=8)l<<=1,l|=o>>>h+c&1}for(var c=6;c>=0;c-=2){for(var h=1;h<=25;h+=8)u<<=1,u|=i>>>h+c&1;for(var h=1;h<=25;h+=8)u<<=1,u|=o>>>h+c&1}a[s+0]=l>>>0,a[s+1]=u>>>0},oi.rip=function(o,i,a,s){for(var l=0,u=0,c=0;c<4;c++)for(var h=24;h>=0;h-=8)l<<=1,l|=i>>>h+c&1,l<<=1,l|=o>>>h+c&1;for(var c=4;c<8;c++)for(var h=24;h>=0;h-=8)u<<=1,u|=i>>>h+c&1,u<<=1,u|=o>>>h+c&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.pc1=function(o,i,a,s){for(var l=0,u=0,c=7;c>=5;c--){for(var h=0;h<=24;h+=8)l<<=1,l|=i>>h+c&1;for(var h=0;h<=24;h+=8)l<<=1,l|=o>>h+c&1}for(var h=0;h<=24;h+=8)l<<=1,l|=i>>h+c&1;for(var c=1;c<=3;c++){for(var h=0;h<=24;h+=8)u<<=1,u|=i>>h+c&1;for(var h=0;h<=24;h+=8)u<<=1,u|=o>>h+c&1}for(var h=0;h<=24;h+=8)u<<=1,u|=o>>h+c&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.r28shl=function(o,i){return o<>>28-i};var e=[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];oi.pc2=function(o,i,a,s){for(var l=0,u=0,c=e.length>>>1,h=0;h>>e[h]&1;for(var h=c;h>>e[h]&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.expand=function(o,i,a){var s=0,l=0;s=(o&1)<<5|o>>>27;for(var u=23;u>=15;u-=4)s<<=6,s|=o>>>u&63;for(var u=11;u>=3;u-=4)l|=o>>>u&63,l<<=6;l|=(o&31)<<1|o>>>31,i[a+0]=s>>>0,i[a+1]=l>>>0};var t=[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];oi.substitute=function(o,i){for(var a=0,s=0;s<4;s++){var l=o>>>18-s*6&63,u=t[s*64+l];a<<=4,a|=u}for(var s=0;s<4;s++){var l=i>>>18-s*6&63,u=t[4*64+s*64+l];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 oi.permute=function(o){for(var i=0,a=0;a>>r[a]&1;return i>>>0},oi.padSplit=function(o,i,a){for(var s=o.toString(2);s.length0;a--)o+=this._buffer(n,o),i+=this._flushBuffer(s,i);return o+=this._buffer(n,o),s},t.prototype.final=function(n){var o;n&&(o=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),o?o.concat(i):i},t.prototype._pad=function(n,o){if(o===0)return!1;for(;o>>1];c=r.r28shl(c,p),h=r.r28shl(h,p),r.pc2(c,h,l.keys,d)}},i.prototype._update=function(l,u,c,h){var d=this._desState,p=r.readUInt32BE(l,u),v=r.readUInt32BE(l,u+4);r.ip(p,v,d.tmp,0),p=d.tmp[0],v=d.tmp[1],this.type==="encrypt"?this._encrypt(d,p,v,d.tmp,0):this._decrypt(d,p,v,d.tmp,0),p=d.tmp[0],v=d.tmp[1],r.writeUInt32BE(c,p,h),r.writeUInt32BE(c,v,h+4)},i.prototype._pad=function(l,u){for(var c=l.length-u,h=u;h>>0,p=P}r.rip(v,p,h,d)},i.prototype._decrypt=function(l,u,c,h,d){for(var p=c,v=u,b=l.keys.length-2;b>=0;b-=2){var S=l.keys[b],x=l.keys[b+1];r.expand(p,l.tmp,0),S^=l.tmp[0],x^=l.tmp[1];var k=r.substitute(S,x),M=r.permute(k),P=p;p=(v^M)>>>0,v=P}r.rip(p,v,h,d)},zv}var $v={},s9;function kU(){if(s9)return $v;s9=1;var e=Ri(),t=Ht(),r={};function n(i){e.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var a=0;a>s%8,n._prev=r(n._prev,i?c:h);return u}function r(n,o){var i=n.length,a=-1,s=e.allocUnsafe(n.length);for(n=e.concat([n,e.from([o])]);++a>7;return s}return Zv.encrypt=function(n,o,i){for(var a=o.length,s=e.allocUnsafe(a),l=-1;++l>>24]^p[x>>>16&255]^v[k>>>8&255]^b[M&255]^l[K++],L=d[x>>>24]^p[k>>>16&255]^v[M>>>8&255]^b[S&255]^l[K++],j=d[k>>>24]^p[M>>>16&255]^v[S>>>8&255]^b[x&255]^l[K++],V=d[M>>>24]^p[S>>>16&255]^v[x>>>8&255]^b[k&255]^l[K++],S=P,x=L,k=j,M=V;return P=(c[S>>>24]<<24|c[x>>>16&255]<<16|c[k>>>8&255]<<8|c[M&255])^l[K++],L=(c[x>>>24]<<24|c[k>>>16&255]<<16|c[M>>>8&255]<<8|c[S&255])^l[K++],j=(c[k>>>24]<<24|c[M>>>16&255]<<16|c[S>>>8&255]<<8|c[x&255])^l[K++],V=(c[M>>>24]<<24|c[S>>>16&255]<<16|c[x>>>8&255]<<8|c[k&255])^l[K++],P=P>>>0,L=L>>>0,j=j>>>0,V=V>>>0,[P,L,j,V]}var o=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var s=new Array(256),l=0;l<256;l++)l<128?s[l]=l<<1:s[l]=l<<1^283;for(var u=[],c=[],h=[[],[],[],[]],d=[[],[],[],[]],p=0,v=0,b=0;b<256;++b){var S=v^v<<1^v<<2^v<<3^v<<4;S=S>>>8^S&255^99,u[p]=S,c[S]=p;var x=s[p],k=s[x],M=s[k],P=s[S]*257^S*16843008;h[0][p]=P<<24|P>>>8,h[1][p]=P<<16|P>>>16,h[2][p]=P<<8|P>>>24,h[3][p]=P,P=M*16843009^k*65537^x*257^p*16843008,d[0][S]=P<<24|P>>>8,d[1][S]=P<<16|P>>>16,d[2][S]=P<<8|P>>>24,d[3][S]=P,p===0?p=v=1:(p=x^s[s[s[M^x]]],v^=s[s[v]])}return{SBOX:u,INV_SBOX:c,SUB_MIX:h,INV_SUB_MIX:d}}();function a(s){this._key=t(s),this._reset()}return a.blockSize=4*4,a.keySize=256/8,a.prototype.blockSize=a.blockSize,a.prototype.keySize=a.keySize,a.prototype._reset=function(){for(var s=this._key,l=s.length,u=l+6,c=(u+1)*4,h=[],d=0;d>>24,p=i.SBOX[p>>>24]<<24|i.SBOX[p>>>16&255]<<16|i.SBOX[p>>>8&255]<<8|i.SBOX[p&255],p^=o[d/l|0]<<24):l>6&&d%l===4&&(p=i.SBOX[p>>>24]<<24|i.SBOX[p>>>16&255]<<16|i.SBOX[p>>>8&255]<<8|i.SBOX[p&255]),h[d]=h[d-l]^p}for(var v=[],b=0;b>>24]]^i.INV_SUB_MIX[1][i.SBOX[x>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[x>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[x&255]]}this._nRounds=u,this._keySchedule=h,this._invKeySchedule=v},a.prototype.encryptBlockRaw=function(s){return s=t(s),n(s,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},a.prototype.encryptBlock=function(s){var l=this.encryptBlockRaw(s),u=e.allocUnsafe(16);return u.writeUInt32BE(l[0],0),u.writeUInt32BE(l[1],4),u.writeUInt32BE(l[2],8),u.writeUInt32BE(l[3],12),u},a.prototype.decryptBlock=function(s){s=t(s);var l=s[1];s[1]=s[3],s[3]=l;var u=n(s,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),c=e.allocUnsafe(16);return c.writeUInt32BE(u[0],0),c.writeUInt32BE(u[3],4),c.writeUInt32BE(u[2],8),c.writeUInt32BE(u[1],12),c},a.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},Jv.AES=a,Jv}var ey,S9;function jU(){if(S9)return ey;S9=1;var e=Kt().Buffer,t=e.alloc(16,0);function r(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var a=e.allocUnsafe(16);return a.writeUInt32BE(i[0]>>>0,0),a.writeUInt32BE(i[1]>>>0,4),a.writeUInt32BE(i[2]>>>0,8),a.writeUInt32BE(i[3]>>>0,12),a}function o(i){this.h=i,this.state=e.alloc(16,0),this.cache=e.allocUnsafe(0)}return o.prototype.ghash=function(i){for(var a=-1;++a0;s--)i[s]=i[s]>>>1|(i[s-1]&1)<<31;i[0]=i[0]>>>1,u&&(i[0]=i[0]^225<<24)}this.state=n(a)},o.prototype.update=function(i){this.cache=e.concat([this.cache,i]);for(var a;this.cache.length>=16;)a=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(a)},o.prototype.final=function(i,a){return this.cache.length&&this.ghash(e.concat([this.cache,t],16)),this.ghash(n([0,i,0,a])),this.state},ey=o,ey}var ty,C9;function tM(){if(C9)return ty;C9=1;var e=S1(),t=Kt().Buffer,r=ds(),n=Ht(),o=jU(),i=qd(),a=JA();function s(c,h){var d=0;c.length!==h.length&&d++;for(var p=Math.min(c.length,h.length),v=0;v0||a>0;){var h=new t;h.update(c),h.update(n),o&&h.update(o),c=h.digest();var d=0;if(s>0){var p=l.length-s;d=Math.min(s,c.length),c.copy(l,p,0,d),s-=d}if(d0){var v=u.length-a,b=Math.min(a,c.length-d);c.copy(u,v,d,d+b),a-=b}}return c.fill(0),{key:l,iv:u}}return ny=r,ny}var A9;function FU(){if(A9)return Uh;A9=1;var e=bw(),t=tM(),r=Kt().Buffer,n=rM(),o=ds(),i=S1(),a=C1(),s=Ht();function l(p,v,b){o.call(this),this._cache=new c,this._cipher=new i.AES(v),this._prev=r.from(b),this._mode=p,this._autopadding=!0}s(l,o),l.prototype._update=function(p){this._cache.add(p);for(var v,b,S=[];v=this._cache.get();)b=this._mode.encrypt(this,v),S.push(b);return r.concat(S)};var u=r.alloc(16,16);l.prototype._final=function(){var p=this._cache.flush();if(this._autopadding)return p=this._mode.encrypt(this,p),this._cipher.scrub(),p;if(!p.equals(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(p){return this._autopadding=!!p,this};function c(){this.cache=r.allocUnsafe(0)}c.prototype.add=function(p){this.cache=r.concat([this.cache,p])},c.prototype.get=function(){if(this.cache.length>15){var p=this.cache.slice(0,16);return this.cache=this.cache.slice(16),p}return null},c.prototype.flush=function(){for(var p=16-this.cache.length,v=r.allocUnsafe(p),b=-1;++b16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v}else if(this.cache.length>=16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache};function c(p){var v=p[15];if(v<1||v>16)throw new Error("unable to decrypt data");for(var b=-1;++b0?_:y},i.min=function(_,y){return _.cmp(y)<0?_:y},i.prototype._init=function(_,y,f){if(typeof _=="number")return this._initNumber(_,y,f);if(typeof _=="object")return this._initArray(_,y,f);y==="hex"&&(y=16),n(y===(y|0)&&y>=2&&y<=36),_=_.toString().replace(/\s+/g,"");var g=0;_[0]==="-"&&(g++,this.negative=1),g<_.length&&(y===16?this._parseHex(_,g,f):(this._parseBase(_,y,g),f==="le"&&this._initArray(this.toArray(),y,f)))},i.prototype._initNumber=function(_,y,f){_<0&&(this.negative=1,_=-_),_<67108864?(this.words=[_&67108863],this.length=1):_<4503599627370496?(this.words=[_&67108863,_/67108864&67108863],this.length=2):(n(_<9007199254740992),this.words=[_&67108863,_/67108864&67108863,1],this.length=3),f==="le"&&this._initArray(this.toArray(),y,f)},i.prototype._initArray=function(_,y,f){if(n(typeof _.length=="number"),_.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(_.length/3),this.words=new Array(this.length);for(var g=0;g=0;g-=3)A=_[g]|_[g-1]<<8|_[g-2]<<16,this.words[w]|=A<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);else if(f==="le")for(g=0,w=0;g<_.length;g+=3)A=_[g]|_[g+1]<<8|_[g+2]<<16,this.words[w]|=A<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);return this.strip()};function s(U,_){var y=U.charCodeAt(_);return y>=65&&y<=70?y-55:y>=97&&y<=102?y-87:y-48&15}function l(U,_,y){var f=s(U,y);return y-1>=_&&(f|=s(U,y-1)<<4),f}i.prototype._parseHex=function(_,y,f){this.length=Math.ceil((_.length-y)/6),this.words=new Array(this.length);for(var g=0;g=y;g-=2)T=l(_,y,g)<=18?(w-=18,A+=1,this.words[A]|=T>>>26):w+=8;else{var E=_.length-y;for(g=E%2===0?y+1:y;g<_.length;g+=2)T=l(_,y,g)<=18?(w-=18,A+=1,this.words[A]|=T>>>26):w+=8}this.strip()};function u(U,_,y,f){for(var g=0,w=Math.min(U.length,y),A=_;A=49?g+=T-49+10:T>=17?g+=T-17+10:g+=T}return g}i.prototype._parseBase=function(_,y,f){this.words=[0],this.length=1;for(var g=0,w=1;w<=67108863;w*=y)g++;g--,w=w/y|0;for(var A=_.length-f,T=A%g,E=Math.min(A,A-T)+f,C=0,I=f;I1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var c=["","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],d=[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];i.prototype.toString=function(_,y){_=_||10,y=y|0||1;var f;if(_===16||_==="hex"){f="";for(var g=0,w=0,A=0;A>>24-g&16777215,w!==0||A!==this.length-1?f=c[6-E.length]+E+f:f=E+f,g+=2,g>=26&&(g-=26,A--)}for(w!==0&&(f=w.toString(16)+f);f.length%y!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(_===(_|0)&&_>=2&&_<=36){var C=h[_],I=d[_];f="";var m=this.clone();for(m.negative=0;!m.isZero();){var B=m.modn(I).toString(_);m=m.idivn(I),m.isZero()?f=B+f:f=c[C-B.length]+B+f}for(this.isZero()&&(f="0"+f);f.length%y!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var _=this.words[0];return this.length===2?_+=this.words[1]*67108864:this.length===3&&this.words[2]===1?_+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-_:_},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(_,y){return n(typeof a<"u"),this.toArrayLike(a,_,y)},i.prototype.toArray=function(_,y){return this.toArrayLike(Array,_,y)},i.prototype.toArrayLike=function(_,y,f){var g=this.byteLength(),w=f||Math.max(1,g);n(g<=w,"byte array longer than desired length"),n(w>0,"Requested array length <= 0"),this.strip();var A=y==="le",T=new _(w),E,C,I=this.clone();if(A){for(C=0;!I.isZero();C++)E=I.andln(255),I.iushrn(8),T[C]=E;for(;C=4096&&(f+=13,y>>>=13),y>=64&&(f+=7,y>>>=7),y>=8&&(f+=4,y>>>=4),y>=2&&(f+=2,y>>>=2),f+y},i.prototype._zeroBits=function(_){if(_===0)return 26;var y=_,f=0;return y&8191||(f+=13,y>>>=13),y&127||(f+=7,y>>>=7),y&15||(f+=4,y>>>=4),y&3||(f+=2,y>>>=2),y&1||f++,f},i.prototype.bitLength=function(){var _=this.words[this.length-1],y=this._countBits(_);return(this.length-1)*26+y};function p(U){for(var _=new Array(U.bitLength()),y=0;y<_.length;y++){var f=y/26|0,g=y%26;_[y]=(U.words[f]&1<>>g}return _}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var _=0,y=0;y_.length?this.clone().ior(_):_.clone().ior(this)},i.prototype.uor=function(_){return this.length>_.length?this.clone().iuor(_):_.clone().iuor(this)},i.prototype.iuand=function(_){var y;this.length>_.length?y=_:y=this;for(var f=0;f_.length?this.clone().iand(_):_.clone().iand(this)},i.prototype.uand=function(_){return this.length>_.length?this.clone().iuand(_):_.clone().iuand(this)},i.prototype.iuxor=function(_){var y,f;this.length>_.length?(y=this,f=_):(y=_,f=this);for(var g=0;g_.length?this.clone().ixor(_):_.clone().ixor(this)},i.prototype.uxor=function(_){return this.length>_.length?this.clone().iuxor(_):_.clone().iuxor(this)},i.prototype.inotn=function(_){n(typeof _=="number"&&_>=0);var y=Math.ceil(_/26)|0,f=_%26;this._expand(y),f>0&&y--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},i.prototype.notn=function(_){return this.clone().inotn(_)},i.prototype.setn=function(_,y){n(typeof _=="number"&&_>=0);var f=_/26|0,g=_%26;return this._expand(f+1),y?this.words[f]=this.words[f]|1<_.length?(f=this,g=_):(f=_,g=this);for(var w=0,A=0;A>>26;for(;w!==0&&A>>26;if(this.length=f.length,w!==0)this.words[this.length]=w,this.length++;else if(f!==this)for(;A_.length?this.clone().iadd(_):_.clone().iadd(this)},i.prototype.isub=function(_){if(_.negative!==0){_.negative=0;var y=this.iadd(_);return _.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(_),this.negative=1,this._normSign();var f=this.cmp(_);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,w;f>0?(g=this,w=_):(g=_,w=this);for(var A=0,T=0;T>26,this.words[T]=y&67108863;for(;A!==0&&T>26,this.words[T]=y&67108863;if(A===0&&T>>26,m=E&67108863,B=Math.min(C,_.length-1),ne=Math.max(0,C-U.length+1);ne<=B;ne++){var de=C-ne|0;g=U.words[de]|0,w=_.words[ne]|0,A=g*w+m,I+=A/67108864|0,m=A&67108863}y.words[C]=m|0,E=I|0}return E!==0?y.words[C]=E|0:y.length--,y.strip()}var b=function(_,y,f){var g=_.words,w=y.words,A=f.words,T=0,E,C,I,m=g[0]|0,B=m&8191,ne=m>>>13,de=g[1]|0,$=de&8191,he=de>>>13,X=g[2]|0,se=X&8191,pe=X>>>13,W=g[3]|0,q=W&8191,ye=W>>>13,xe=g[4]|0,Me=xe&8191,Q=xe>>>13,N=g[5]|0,D=N&8191,G=N>>>13,me=g[6]|0,_e=me&8191,Pe=me>>>13,Fe=g[7]|0,Re=Fe&8191,le=Fe>>>13,Y=g[8]|0,re=Y&8191,ge=Y>>>13,be=g[9]|0,ce=be&8191,Ie=be>>>13,ke=w[0]|0,Te=ke&8191,ze=ke>>>13,We=w[1]|0,Ne=We&8191,Ke=We>>>13,De=w[2]|0,Le=De&8191,gt=De>>>13,rt=w[3]|0,Ye=rt&8191,kt=rt>>>13,ht=w[4]|0,tt=ht&8191,Nt=ht>>>13,It=w[5]|0,ut=It&8191,Yt=It>>>13,Tt=w[6]|0,at=Tt&8191,lr=Tt>>>13,z=w[7]|0,J=z&8191,ee=z>>>13,O=w[8]|0,te=O&8191,Ae=O>>>13,Ee=w[9]|0,Be=Ee&8191,qe=Ee>>>13;f.negative=_.negative^y.negative,f.length=19,E=Math.imul(B,Te),C=Math.imul(B,ze),C=C+Math.imul(ne,Te)|0,I=Math.imul(ne,ze);var He=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(He>>>26)|0,He&=67108863,E=Math.imul($,Te),C=Math.imul($,ze),C=C+Math.imul(he,Te)|0,I=Math.imul(he,ze),E=E+Math.imul(B,Ne)|0,C=C+Math.imul(B,Ke)|0,C=C+Math.imul(ne,Ne)|0,I=I+Math.imul(ne,Ke)|0;var $e=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+($e>>>26)|0,$e&=67108863,E=Math.imul(se,Te),C=Math.imul(se,ze),C=C+Math.imul(pe,Te)|0,I=Math.imul(pe,ze),E=E+Math.imul($,Ne)|0,C=C+Math.imul($,Ke)|0,C=C+Math.imul(he,Ne)|0,I=I+Math.imul(he,Ke)|0,E=E+Math.imul(B,Le)|0,C=C+Math.imul(B,gt)|0,C=C+Math.imul(ne,Le)|0,I=I+Math.imul(ne,gt)|0;var Lt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,E=Math.imul(q,Te),C=Math.imul(q,ze),C=C+Math.imul(ye,Te)|0,I=Math.imul(ye,ze),E=E+Math.imul(se,Ne)|0,C=C+Math.imul(se,Ke)|0,C=C+Math.imul(pe,Ne)|0,I=I+Math.imul(pe,Ke)|0,E=E+Math.imul($,Le)|0,C=C+Math.imul($,gt)|0,C=C+Math.imul(he,Le)|0,I=I+Math.imul(he,gt)|0,E=E+Math.imul(B,Ye)|0,C=C+Math.imul(B,kt)|0,C=C+Math.imul(ne,Ye)|0,I=I+Math.imul(ne,kt)|0;var ot=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(ot>>>26)|0,ot&=67108863,E=Math.imul(Me,Te),C=Math.imul(Me,ze),C=C+Math.imul(Q,Te)|0,I=Math.imul(Q,ze),E=E+Math.imul(q,Ne)|0,C=C+Math.imul(q,Ke)|0,C=C+Math.imul(ye,Ne)|0,I=I+Math.imul(ye,Ke)|0,E=E+Math.imul(se,Le)|0,C=C+Math.imul(se,gt)|0,C=C+Math.imul(pe,Le)|0,I=I+Math.imul(pe,gt)|0,E=E+Math.imul($,Ye)|0,C=C+Math.imul($,kt)|0,C=C+Math.imul(he,Ye)|0,I=I+Math.imul(he,kt)|0,E=E+Math.imul(B,tt)|0,C=C+Math.imul(B,Nt)|0,C=C+Math.imul(ne,tt)|0,I=I+Math.imul(ne,Nt)|0;var vt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(vt>>>26)|0,vt&=67108863,E=Math.imul(D,Te),C=Math.imul(D,ze),C=C+Math.imul(G,Te)|0,I=Math.imul(G,ze),E=E+Math.imul(Me,Ne)|0,C=C+Math.imul(Me,Ke)|0,C=C+Math.imul(Q,Ne)|0,I=I+Math.imul(Q,Ke)|0,E=E+Math.imul(q,Le)|0,C=C+Math.imul(q,gt)|0,C=C+Math.imul(ye,Le)|0,I=I+Math.imul(ye,gt)|0,E=E+Math.imul(se,Ye)|0,C=C+Math.imul(se,kt)|0,C=C+Math.imul(pe,Ye)|0,I=I+Math.imul(pe,kt)|0,E=E+Math.imul($,tt)|0,C=C+Math.imul($,Nt)|0,C=C+Math.imul(he,tt)|0,I=I+Math.imul(he,Nt)|0,E=E+Math.imul(B,ut)|0,C=C+Math.imul(B,Yt)|0,C=C+Math.imul(ne,ut)|0,I=I+Math.imul(ne,Yt)|0;var yt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(yt>>>26)|0,yt&=67108863,E=Math.imul(_e,Te),C=Math.imul(_e,ze),C=C+Math.imul(Pe,Te)|0,I=Math.imul(Pe,ze),E=E+Math.imul(D,Ne)|0,C=C+Math.imul(D,Ke)|0,C=C+Math.imul(G,Ne)|0,I=I+Math.imul(G,Ke)|0,E=E+Math.imul(Me,Le)|0,C=C+Math.imul(Me,gt)|0,C=C+Math.imul(Q,Le)|0,I=I+Math.imul(Q,gt)|0,E=E+Math.imul(q,Ye)|0,C=C+Math.imul(q,kt)|0,C=C+Math.imul(ye,Ye)|0,I=I+Math.imul(ye,kt)|0,E=E+Math.imul(se,tt)|0,C=C+Math.imul(se,Nt)|0,C=C+Math.imul(pe,tt)|0,I=I+Math.imul(pe,Nt)|0,E=E+Math.imul($,ut)|0,C=C+Math.imul($,Yt)|0,C=C+Math.imul(he,ut)|0,I=I+Math.imul(he,Yt)|0,E=E+Math.imul(B,at)|0,C=C+Math.imul(B,lr)|0,C=C+Math.imul(ne,at)|0,I=I+Math.imul(ne,lr)|0;var Ct=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,E=Math.imul(Re,Te),C=Math.imul(Re,ze),C=C+Math.imul(le,Te)|0,I=Math.imul(le,ze),E=E+Math.imul(_e,Ne)|0,C=C+Math.imul(_e,Ke)|0,C=C+Math.imul(Pe,Ne)|0,I=I+Math.imul(Pe,Ke)|0,E=E+Math.imul(D,Le)|0,C=C+Math.imul(D,gt)|0,C=C+Math.imul(G,Le)|0,I=I+Math.imul(G,gt)|0,E=E+Math.imul(Me,Ye)|0,C=C+Math.imul(Me,kt)|0,C=C+Math.imul(Q,Ye)|0,I=I+Math.imul(Q,kt)|0,E=E+Math.imul(q,tt)|0,C=C+Math.imul(q,Nt)|0,C=C+Math.imul(ye,tt)|0,I=I+Math.imul(ye,Nt)|0,E=E+Math.imul(se,ut)|0,C=C+Math.imul(se,Yt)|0,C=C+Math.imul(pe,ut)|0,I=I+Math.imul(pe,Yt)|0,E=E+Math.imul($,at)|0,C=C+Math.imul($,lr)|0,C=C+Math.imul(he,at)|0,I=I+Math.imul(he,lr)|0,E=E+Math.imul(B,J)|0,C=C+Math.imul(B,ee)|0,C=C+Math.imul(ne,J)|0,I=I+Math.imul(ne,ee)|0;var St=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(St>>>26)|0,St&=67108863,E=Math.imul(re,Te),C=Math.imul(re,ze),C=C+Math.imul(ge,Te)|0,I=Math.imul(ge,ze),E=E+Math.imul(Re,Ne)|0,C=C+Math.imul(Re,Ke)|0,C=C+Math.imul(le,Ne)|0,I=I+Math.imul(le,Ke)|0,E=E+Math.imul(_e,Le)|0,C=C+Math.imul(_e,gt)|0,C=C+Math.imul(Pe,Le)|0,I=I+Math.imul(Pe,gt)|0,E=E+Math.imul(D,Ye)|0,C=C+Math.imul(D,kt)|0,C=C+Math.imul(G,Ye)|0,I=I+Math.imul(G,kt)|0,E=E+Math.imul(Me,tt)|0,C=C+Math.imul(Me,Nt)|0,C=C+Math.imul(Q,tt)|0,I=I+Math.imul(Q,Nt)|0,E=E+Math.imul(q,ut)|0,C=C+Math.imul(q,Yt)|0,C=C+Math.imul(ye,ut)|0,I=I+Math.imul(ye,Yt)|0,E=E+Math.imul(se,at)|0,C=C+Math.imul(se,lr)|0,C=C+Math.imul(pe,at)|0,I=I+Math.imul(pe,lr)|0,E=E+Math.imul($,J)|0,C=C+Math.imul($,ee)|0,C=C+Math.imul(he,J)|0,I=I+Math.imul(he,ee)|0,E=E+Math.imul(B,te)|0,C=C+Math.imul(B,Ae)|0,C=C+Math.imul(ne,te)|0,I=I+Math.imul(ne,Ae)|0;var bt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(bt>>>26)|0,bt&=67108863,E=Math.imul(ce,Te),C=Math.imul(ce,ze),C=C+Math.imul(Ie,Te)|0,I=Math.imul(Ie,ze),E=E+Math.imul(re,Ne)|0,C=C+Math.imul(re,Ke)|0,C=C+Math.imul(ge,Ne)|0,I=I+Math.imul(ge,Ke)|0,E=E+Math.imul(Re,Le)|0,C=C+Math.imul(Re,gt)|0,C=C+Math.imul(le,Le)|0,I=I+Math.imul(le,gt)|0,E=E+Math.imul(_e,Ye)|0,C=C+Math.imul(_e,kt)|0,C=C+Math.imul(Pe,Ye)|0,I=I+Math.imul(Pe,kt)|0,E=E+Math.imul(D,tt)|0,C=C+Math.imul(D,Nt)|0,C=C+Math.imul(G,tt)|0,I=I+Math.imul(G,Nt)|0,E=E+Math.imul(Me,ut)|0,C=C+Math.imul(Me,Yt)|0,C=C+Math.imul(Q,ut)|0,I=I+Math.imul(Q,Yt)|0,E=E+Math.imul(q,at)|0,C=C+Math.imul(q,lr)|0,C=C+Math.imul(ye,at)|0,I=I+Math.imul(ye,lr)|0,E=E+Math.imul(se,J)|0,C=C+Math.imul(se,ee)|0,C=C+Math.imul(pe,J)|0,I=I+Math.imul(pe,ee)|0,E=E+Math.imul($,te)|0,C=C+Math.imul($,Ae)|0,C=C+Math.imul(he,te)|0,I=I+Math.imul(he,Ae)|0,E=E+Math.imul(B,Be)|0,C=C+Math.imul(B,qe)|0,C=C+Math.imul(ne,Be)|0,I=I+Math.imul(ne,qe)|0;var xt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(xt>>>26)|0,xt&=67108863,E=Math.imul(ce,Ne),C=Math.imul(ce,Ke),C=C+Math.imul(Ie,Ne)|0,I=Math.imul(Ie,Ke),E=E+Math.imul(re,Le)|0,C=C+Math.imul(re,gt)|0,C=C+Math.imul(ge,Le)|0,I=I+Math.imul(ge,gt)|0,E=E+Math.imul(Re,Ye)|0,C=C+Math.imul(Re,kt)|0,C=C+Math.imul(le,Ye)|0,I=I+Math.imul(le,kt)|0,E=E+Math.imul(_e,tt)|0,C=C+Math.imul(_e,Nt)|0,C=C+Math.imul(Pe,tt)|0,I=I+Math.imul(Pe,Nt)|0,E=E+Math.imul(D,ut)|0,C=C+Math.imul(D,Yt)|0,C=C+Math.imul(G,ut)|0,I=I+Math.imul(G,Yt)|0,E=E+Math.imul(Me,at)|0,C=C+Math.imul(Me,lr)|0,C=C+Math.imul(Q,at)|0,I=I+Math.imul(Q,lr)|0,E=E+Math.imul(q,J)|0,C=C+Math.imul(q,ee)|0,C=C+Math.imul(ye,J)|0,I=I+Math.imul(ye,ee)|0,E=E+Math.imul(se,te)|0,C=C+Math.imul(se,Ae)|0,C=C+Math.imul(pe,te)|0,I=I+Math.imul(pe,Ae)|0,E=E+Math.imul($,Be)|0,C=C+Math.imul($,qe)|0,C=C+Math.imul(he,Be)|0,I=I+Math.imul(he,qe)|0;var wt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(wt>>>26)|0,wt&=67108863,E=Math.imul(ce,Le),C=Math.imul(ce,gt),C=C+Math.imul(Ie,Le)|0,I=Math.imul(Ie,gt),E=E+Math.imul(re,Ye)|0,C=C+Math.imul(re,kt)|0,C=C+Math.imul(ge,Ye)|0,I=I+Math.imul(ge,kt)|0,E=E+Math.imul(Re,tt)|0,C=C+Math.imul(Re,Nt)|0,C=C+Math.imul(le,tt)|0,I=I+Math.imul(le,Nt)|0,E=E+Math.imul(_e,ut)|0,C=C+Math.imul(_e,Yt)|0,C=C+Math.imul(Pe,ut)|0,I=I+Math.imul(Pe,Yt)|0,E=E+Math.imul(D,at)|0,C=C+Math.imul(D,lr)|0,C=C+Math.imul(G,at)|0,I=I+Math.imul(G,lr)|0,E=E+Math.imul(Me,J)|0,C=C+Math.imul(Me,ee)|0,C=C+Math.imul(Q,J)|0,I=I+Math.imul(Q,ee)|0,E=E+Math.imul(q,te)|0,C=C+Math.imul(q,Ae)|0,C=C+Math.imul(ye,te)|0,I=I+Math.imul(ye,Ae)|0,E=E+Math.imul(se,Be)|0,C=C+Math.imul(se,qe)|0,C=C+Math.imul(pe,Be)|0,I=I+Math.imul(pe,qe)|0;var st=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(st>>>26)|0,st&=67108863,E=Math.imul(ce,Ye),C=Math.imul(ce,kt),C=C+Math.imul(Ie,Ye)|0,I=Math.imul(Ie,kt),E=E+Math.imul(re,tt)|0,C=C+Math.imul(re,Nt)|0,C=C+Math.imul(ge,tt)|0,I=I+Math.imul(ge,Nt)|0,E=E+Math.imul(Re,ut)|0,C=C+Math.imul(Re,Yt)|0,C=C+Math.imul(le,ut)|0,I=I+Math.imul(le,Yt)|0,E=E+Math.imul(_e,at)|0,C=C+Math.imul(_e,lr)|0,C=C+Math.imul(Pe,at)|0,I=I+Math.imul(Pe,lr)|0,E=E+Math.imul(D,J)|0,C=C+Math.imul(D,ee)|0,C=C+Math.imul(G,J)|0,I=I+Math.imul(G,ee)|0,E=E+Math.imul(Me,te)|0,C=C+Math.imul(Me,Ae)|0,C=C+Math.imul(Q,te)|0,I=I+Math.imul(Q,Ae)|0,E=E+Math.imul(q,Be)|0,C=C+Math.imul(q,qe)|0,C=C+Math.imul(ye,Be)|0,I=I+Math.imul(ye,qe)|0;var ct=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(ct>>>26)|0,ct&=67108863,E=Math.imul(ce,tt),C=Math.imul(ce,Nt),C=C+Math.imul(Ie,tt)|0,I=Math.imul(Ie,Nt),E=E+Math.imul(re,ut)|0,C=C+Math.imul(re,Yt)|0,C=C+Math.imul(ge,ut)|0,I=I+Math.imul(ge,Yt)|0,E=E+Math.imul(Re,at)|0,C=C+Math.imul(Re,lr)|0,C=C+Math.imul(le,at)|0,I=I+Math.imul(le,lr)|0,E=E+Math.imul(_e,J)|0,C=C+Math.imul(_e,ee)|0,C=C+Math.imul(Pe,J)|0,I=I+Math.imul(Pe,ee)|0,E=E+Math.imul(D,te)|0,C=C+Math.imul(D,Ae)|0,C=C+Math.imul(G,te)|0,I=I+Math.imul(G,Ae)|0,E=E+Math.imul(Me,Be)|0,C=C+Math.imul(Me,qe)|0,C=C+Math.imul(Q,Be)|0,I=I+Math.imul(Q,qe)|0;var nt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(nt>>>26)|0,nt&=67108863,E=Math.imul(ce,ut),C=Math.imul(ce,Yt),C=C+Math.imul(Ie,ut)|0,I=Math.imul(Ie,Yt),E=E+Math.imul(re,at)|0,C=C+Math.imul(re,lr)|0,C=C+Math.imul(ge,at)|0,I=I+Math.imul(ge,lr)|0,E=E+Math.imul(Re,J)|0,C=C+Math.imul(Re,ee)|0,C=C+Math.imul(le,J)|0,I=I+Math.imul(le,ee)|0,E=E+Math.imul(_e,te)|0,C=C+Math.imul(_e,Ae)|0,C=C+Math.imul(Pe,te)|0,I=I+Math.imul(Pe,Ae)|0,E=E+Math.imul(D,Be)|0,C=C+Math.imul(D,qe)|0,C=C+Math.imul(G,Be)|0,I=I+Math.imul(G,qe)|0;var lt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(lt>>>26)|0,lt&=67108863,E=Math.imul(ce,at),C=Math.imul(ce,lr),C=C+Math.imul(Ie,at)|0,I=Math.imul(Ie,lr),E=E+Math.imul(re,J)|0,C=C+Math.imul(re,ee)|0,C=C+Math.imul(ge,J)|0,I=I+Math.imul(ge,ee)|0,E=E+Math.imul(Re,te)|0,C=C+Math.imul(Re,Ae)|0,C=C+Math.imul(le,te)|0,I=I+Math.imul(le,Ae)|0,E=E+Math.imul(_e,Be)|0,C=C+Math.imul(_e,qe)|0,C=C+Math.imul(Pe,Be)|0,I=I+Math.imul(Pe,qe)|0;var fe=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(fe>>>26)|0,fe&=67108863,E=Math.imul(ce,J),C=Math.imul(ce,ee),C=C+Math.imul(Ie,J)|0,I=Math.imul(Ie,ee),E=E+Math.imul(re,te)|0,C=C+Math.imul(re,Ae)|0,C=C+Math.imul(ge,te)|0,I=I+Math.imul(ge,Ae)|0,E=E+Math.imul(Re,Be)|0,C=C+Math.imul(Re,qe)|0,C=C+Math.imul(le,Be)|0,I=I+Math.imul(le,qe)|0;var R=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(R>>>26)|0,R&=67108863,E=Math.imul(ce,te),C=Math.imul(ce,Ae),C=C+Math.imul(Ie,te)|0,I=Math.imul(Ie,Ae),E=E+Math.imul(re,Be)|0,C=C+Math.imul(re,qe)|0,C=C+Math.imul(ge,Be)|0,I=I+Math.imul(ge,qe)|0;var F=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(F>>>26)|0,F&=67108863,E=Math.imul(ce,Be),C=Math.imul(ce,qe),C=C+Math.imul(Ie,Be)|0,I=Math.imul(Ie,qe);var H=(T+E|0)+((C&8191)<<13)|0;return T=(I+(C>>>13)|0)+(H>>>26)|0,H&=67108863,A[0]=He,A[1]=$e,A[2]=Lt,A[3]=ot,A[4]=vt,A[5]=yt,A[6]=Ct,A[7]=St,A[8]=bt,A[9]=xt,A[10]=wt,A[11]=st,A[12]=ct,A[13]=nt,A[14]=lt,A[15]=fe,A[16]=R,A[17]=F,A[18]=H,T!==0&&(A[19]=T,f.length++),f};Math.imul||(b=v);function S(U,_,y){y.negative=_.negative^U.negative,y.length=U.length+_.length;for(var f=0,g=0,w=0;w>>26)|0,g+=A>>>26,A&=67108863}y.words[w]=T,f=A,A=g}return f!==0?y.words[w]=f:y.length--,y.strip()}function x(U,_,y){var f=new k;return f.mulp(U,_,y)}i.prototype.mulTo=function(_,y){var f,g=this.length+_.length;return this.length===10&&_.length===10?f=b(this,_,y):g<63?f=v(this,_,y):g<1024?f=S(this,_,y):f=x(this,_,y),f};function k(U,_){this.x=U,this.y=_}k.prototype.makeRBT=function(_){for(var y=new Array(_),f=i.prototype._countBits(_)-1,g=0;g<_;g++)y[g]=this.revBin(g,f,_);return y},k.prototype.revBin=function(_,y,f){if(_===0||_===f-1)return _;for(var g=0,w=0;w>=1;return g},k.prototype.permute=function(_,y,f,g,w,A){for(var T=0;T>>1)w++;return 1<>>13,f[2*A+1]=w&8191,w=w>>>13;for(A=2*y;A>=26,y+=g/67108864|0,y+=w>>>26,this.words[f]=w&67108863}return y!==0&&(this.words[f]=y,this.length++),this},i.prototype.muln=function(_){return this.clone().imuln(_)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(_){var y=p(_);if(y.length===0)return new i(1);for(var f=this,g=0;g=0);var y=_%26,f=(_-y)/26,g=67108863>>>26-y<<26-y,w;if(y!==0){var A=0;for(w=0;w>>26-y}A&&(this.words[w]=A,this.length++)}if(f!==0){for(w=this.length-1;w>=0;w--)this.words[w+f]=this.words[w];for(w=0;w=0);var g;y?g=(y-y%26)/26:g=0;var w=_%26,A=Math.min((_-w)/26,this.length),T=67108863^67108863>>>w<A)for(this.length-=A,C=0;C=0&&(I!==0||C>=g);C--){var m=this.words[C]|0;this.words[C]=I<<26-w|m>>>w,I=m&T}return E&&I!==0&&(E.words[E.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(_,y,f){return n(this.negative===0),this.iushrn(_,y,f)},i.prototype.shln=function(_){return this.clone().ishln(_)},i.prototype.ushln=function(_){return this.clone().iushln(_)},i.prototype.shrn=function(_){return this.clone().ishrn(_)},i.prototype.ushrn=function(_){return this.clone().iushrn(_)},i.prototype.testn=function(_){n(typeof _=="number"&&_>=0);var y=_%26,f=(_-y)/26,g=1<=0);var y=_%26,f=(_-y)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(y!==0&&f++,this.length=Math.min(f,this.length),y!==0){var g=67108863^67108863>>>y<=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},i.prototype.isubn=function(_){if(n(typeof _=="number"),n(_<67108864),_<0)return this.iaddn(-_);if(this.negative!==0)return this.negative=0,this.iaddn(_),this.negative=1,this;if(this.words[0]-=_,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y>26)-(E/67108864|0),this.words[w+f]=A&67108863}for(;w>26,this.words[w+f]=A&67108863;if(T===0)return this.strip();for(n(T===-1),T=0,w=0;w>26,this.words[w]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(_,y){var f=this.length-_.length,g=this.clone(),w=_,A=w.words[w.length-1]|0,T=this._countBits(A);f=26-T,f!==0&&(w=w.ushln(f),g.iushln(f),A=w.words[w.length-1]|0);var E=g.length-w.length,C;if(y!=="mod"){C=new i(null),C.length=E+1,C.words=new Array(C.length);for(var I=0;I=0;B--){var ne=(g.words[w.length+B]|0)*67108864+(g.words[w.length+B-1]|0);for(ne=Math.min(ne/A|0,67108863),g._ishlnsubmul(w,ne,B);g.negative!==0;)ne--,g.negative=0,g._ishlnsubmul(w,1,B),g.isZero()||(g.negative^=1);C&&(C.words[B]=ne)}return C&&C.strip(),g.strip(),y!=="div"&&f!==0&&g.iushrn(f),{div:C||null,mod:g}},i.prototype.divmod=function(_,y,f){if(n(!_.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var g,w,A;return this.negative!==0&&_.negative===0?(A=this.neg().divmod(_,y),y!=="mod"&&(g=A.div.neg()),y!=="div"&&(w=A.mod.neg(),f&&w.negative!==0&&w.iadd(_)),{div:g,mod:w}):this.negative===0&&_.negative!==0?(A=this.divmod(_.neg(),y),y!=="mod"&&(g=A.div.neg()),{div:g,mod:A.mod}):this.negative&_.negative?(A=this.neg().divmod(_.neg(),y),y!=="div"&&(w=A.mod.neg(),f&&w.negative!==0&&w.isub(_)),{div:A.div,mod:w}):_.length>this.length||this.cmp(_)<0?{div:new i(0),mod:this}:_.length===1?y==="div"?{div:this.divn(_.words[0]),mod:null}:y==="mod"?{div:null,mod:new i(this.modn(_.words[0]))}:{div:this.divn(_.words[0]),mod:new i(this.modn(_.words[0]))}:this._wordDiv(_,y)},i.prototype.div=function(_){return this.divmod(_,"div",!1).div},i.prototype.mod=function(_){return this.divmod(_,"mod",!1).mod},i.prototype.umod=function(_){return this.divmod(_,"mod",!0).mod},i.prototype.divRound=function(_){var y=this.divmod(_);if(y.mod.isZero())return y.div;var f=y.div.negative!==0?y.mod.isub(_):y.mod,g=_.ushrn(1),w=_.andln(1),A=f.cmp(g);return A<0||w===1&&A===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},i.prototype.modn=function(_){n(_<=67108863);for(var y=(1<<26)%_,f=0,g=this.length-1;g>=0;g--)f=(y*f+(this.words[g]|0))%_;return f},i.prototype.idivn=function(_){n(_<=67108863);for(var y=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+y*67108864;this.words[f]=g/_|0,y=g%_}return this.strip()},i.prototype.divn=function(_){return this.clone().idivn(_)},i.prototype.egcd=function(_){n(_.negative===0),n(!_.isZero());var y=this,f=_.clone();y.negative!==0?y=y.umod(_):y=y.clone();for(var g=new i(1),w=new i(0),A=new i(0),T=new i(1),E=0;y.isEven()&&f.isEven();)y.iushrn(1),f.iushrn(1),++E;for(var C=f.clone(),I=y.clone();!y.isZero();){for(var m=0,B=1;!(y.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(y.iushrn(m);m-- >0;)(g.isOdd()||w.isOdd())&&(g.iadd(C),w.isub(I)),g.iushrn(1),w.iushrn(1);for(var ne=0,de=1;!(f.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(f.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(C),T.isub(I)),A.iushrn(1),T.iushrn(1);y.cmp(f)>=0?(y.isub(f),g.isub(A),w.isub(T)):(f.isub(y),A.isub(g),T.isub(w))}return{a:A,b:T,gcd:f.iushln(E)}},i.prototype._invmp=function(_){n(_.negative===0),n(!_.isZero());var y=this,f=_.clone();y.negative!==0?y=y.umod(_):y=y.clone();for(var g=new i(1),w=new i(0),A=f.clone();y.cmpn(1)>0&&f.cmpn(1)>0;){for(var T=0,E=1;!(y.words[0]&E)&&T<26;++T,E<<=1);if(T>0)for(y.iushrn(T);T-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);for(var C=0,I=1;!(f.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(f.iushrn(C);C-- >0;)w.isOdd()&&w.iadd(A),w.iushrn(1);y.cmp(f)>=0?(y.isub(f),g.isub(w)):(f.isub(y),w.isub(g))}var m;return y.cmpn(1)===0?m=g:m=w,m.cmpn(0)<0&&m.iadd(_),m},i.prototype.gcd=function(_){if(this.isZero())return _.abs();if(_.isZero())return this.abs();var y=this.clone(),f=_.clone();y.negative=0,f.negative=0;for(var g=0;y.isEven()&&f.isEven();g++)y.iushrn(1),f.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;f.isEven();)f.iushrn(1);var w=y.cmp(f);if(w<0){var A=y;y=f,f=A}else if(w===0||f.cmpn(1)===0)break;y.isub(f)}while(!0);return f.iushln(g)},i.prototype.invm=function(_){return this.egcd(_).a.umod(_)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(_){return this.words[0]&_},i.prototype.bincn=function(_){n(typeof _=="number");var y=_%26,f=(_-y)/26,g=1<>>26,T&=67108863,this.words[A]=T}return w!==0&&(this.words[A]=w,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(_){var y=_<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this.strip();var f;if(this.length>1)f=1;else{y&&(_=-_),n(_<=67108863,"Number is too big");var g=this.words[0]|0;f=g===_?0:g<_?-1:1}return this.negative!==0?-f|0:f},i.prototype.cmp=function(_){if(this.negative!==0&&_.negative===0)return-1;if(this.negative===0&&_.negative!==0)return 1;var y=this.ucmp(_);return this.negative!==0?-y|0:y},i.prototype.ucmp=function(_){if(this.length>_.length)return 1;if(this.length<_.length)return-1;for(var y=0,f=this.length-1;f>=0;f--){var g=this.words[f]|0,w=_.words[f]|0;if(g!==w){gw&&(y=1);break}}return y},i.prototype.gtn=function(_){return this.cmpn(_)===1},i.prototype.gt=function(_){return this.cmp(_)===1},i.prototype.gten=function(_){return this.cmpn(_)>=0},i.prototype.gte=function(_){return this.cmp(_)>=0},i.prototype.ltn=function(_){return this.cmpn(_)===-1},i.prototype.lt=function(_){return this.cmp(_)===-1},i.prototype.lten=function(_){return this.cmpn(_)<=0},i.prototype.lte=function(_){return this.cmp(_)<=0},i.prototype.eqn=function(_){return this.cmpn(_)===0},i.prototype.eq=function(_){return this.cmp(_)===0},i.red=function(_){return new Z(_)},i.prototype.toRed=function(_){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),_.convertTo(this)._forceRed(_)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(_){return this.red=_,this},i.prototype.forceRed=function(_){return n(!this.red,"Already a number in reduction context"),this._forceRed(_)},i.prototype.redAdd=function(_){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,_)},i.prototype.redIAdd=function(_){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,_)},i.prototype.redSub=function(_){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,_)},i.prototype.redISub=function(_){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,_)},i.prototype.redShl=function(_){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,_)},i.prototype.redMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.mul(this,_)},i.prototype.redIMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.imul(this,_)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(_){return n(this.red&&!_.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,_)};var M={k256:null,p224:null,p192:null,p25519:null};function P(U,_){this.name=U,this.p=new i(_,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var _=new i(null);return _.words=new Array(Math.ceil(this.n/13)),_},P.prototype.ireduce=function(_){var y=_,f;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),f=y.bitLength();while(f>this.n);var g=f0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},P.prototype.split=function(_,y){_.iushrn(this.n,0,y)},P.prototype.imulK=function(_){return _.imul(this.k)};function L(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,P),L.prototype.split=function(_,y){for(var f=4194303,g=Math.min(_.length,9),w=0;w>>22,A=T}A>>>=22,_.words[w-10]=A,A===0&&_.length>10?_.length-=10:_.length-=9},L.prototype.imulK=function(_){_.words[_.length]=0,_.words[_.length+1]=0,_.length+=2;for(var y=0,f=0;f<_.length;f++){var g=_.words[f]|0;y+=g*977,_.words[f]=y&67108863,y=g*64+(y/67108864|0)}return _.words[_.length-1]===0&&(_.length--,_.words[_.length-1]===0&&_.length--),_};function j(){P.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(j,P);function V(){P.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(V,P);function K(){P.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(K,P),K.prototype.imulK=function(_){for(var y=0,f=0;f<_.length;f++){var g=(_.words[f]|0)*19+y,w=g&67108863;g>>>=26,_.words[f]=w,y=g}return y!==0&&(_.words[_.length++]=y),_},i._prime=function(_){if(M[_])return M[_];var y;if(_==="k256")y=new L;else if(_==="p224")y=new j;else if(_==="p192")y=new V;else if(_==="p25519")y=new K;else throw new Error("Unknown prime "+_);return M[_]=y,y};function Z(U){if(typeof U=="string"){var _=i._prime(U);this.m=_.p,this.prime=_}else n(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}Z.prototype._verify1=function(_){n(_.negative===0,"red works only with positives"),n(_.red,"red works only with red numbers")},Z.prototype._verify2=function(_,y){n((_.negative|y.negative)===0,"red works only with positives"),n(_.red&&_.red===y.red,"red works only with red numbers")},Z.prototype.imod=function(_){return this.prime?this.prime.ireduce(_)._forceRed(this):_.umod(this.m)._forceRed(this)},Z.prototype.neg=function(_){return _.isZero()?_.clone():this.m.sub(_)._forceRed(this)},Z.prototype.add=function(_,y){this._verify2(_,y);var f=_.add(y);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(_,y){this._verify2(_,y);var f=_.iadd(y);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(_,y){this._verify2(_,y);var f=_.sub(y);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(_,y){this._verify2(_,y);var f=_.isub(y);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(_,y){return this._verify1(_),this.imod(_.ushln(y))},Z.prototype.imul=function(_,y){return this._verify2(_,y),this.imod(_.imul(y))},Z.prototype.mul=function(_,y){return this._verify2(_,y),this.imod(_.mul(y))},Z.prototype.isqr=function(_){return this.imul(_,_.clone())},Z.prototype.sqr=function(_){return this.mul(_,_)},Z.prototype.sqrt=function(_){if(_.isZero())return _.clone();var y=this.m.andln(3);if(n(y%2===1),y===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(_,f)}for(var g=this.m.subn(1),w=0;!g.isZero()&&g.andln(1)===0;)w++,g.iushrn(1);n(!g.isZero());var A=new i(1).toRed(this),T=A.redNeg(),E=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new i(2*C*C).toRed(this);this.pow(C,E).cmp(T)!==0;)C.redIAdd(T);for(var I=this.pow(C,g),m=this.pow(_,g.addn(1).iushrn(1)),B=this.pow(_,g),ne=w;B.cmp(A)!==0;){for(var de=B,$=0;de.cmp(A)!==0;$++)de=de.redSqr();n($=0;w--){for(var I=y.words[w],m=C-1;m>=0;m--){var B=I>>m&1;if(A!==g[0]&&(A=this.sqr(A)),B===0&&T===0){E=0;continue}T<<=1,T|=B,E++,!(E!==f&&(w!==0||m!==0))&&(A=this.mul(A,g[T]),E=0,T=0)}C=26}return A},Z.prototype.convertTo=function(_){var y=_.umod(this.m);return y===_?y.clone():y},Z.prototype.convertFrom=function(_){var y=_.clone();return y.red=null,y},i.mont=function(_){return new ue(_)};function ue(U){Z.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(ue,Z),ue.prototype.convertTo=function(_){return this.imod(_.ushln(this.shift))},ue.prototype.convertFrom=function(_){var y=this.imod(_.mul(this.rinv));return y.red=null,y},ue.prototype.imul=function(_,y){if(_.isZero()||y.isZero())return _.words[0]=0,_.length=1,_;var f=_.imul(y),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=f.isub(g).iushrn(this.shift),A=w;return w.cmp(this.m)>=0?A=w.isub(this.m):w.cmpn(0)<0&&(A=w.iadd(this.m)),A._forceRed(this)},ue.prototype.mul=function(_,y){if(_.isZero()||y.isZero())return new i(0)._forceRed(this);var f=_.mul(y),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=f.isub(g).iushrn(this.shift),A=w;return w.cmp(this.m)>=0?A=w.isub(this.m):w.cmpn(0)<0&&(A=w.iadd(this.m)),A._forceRed(this)},ue.prototype.invm=function(_){var y=this.imod(_._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(e,Ze)}(WU)),op}var If={},VU={get exports(){return If},set exports(e){If=e}},R9;function _w(){if(R9)return If;R9=1;var e;VU.exports=function(o){return e||(e=new t(null)),e.generate(o)};function t(n){this.rand=n}if(If.Rand=t,t.prototype.generate=function(o){return this._rand(o)},t.prototype._rand=function(o){if(this.rand.getBytes)return this.rand.getBytes(o);for(var i=new Uint8Array(o),a=0;a=0);return s},r.prototype._randrange=function(o,i){var a=i.sub(o);return o.add(this._randbelow(a))},r.prototype.test=function(o,i,a){var s=o.bitLength(),l=e.mont(o),u=new e(1).toRed(l);i||(i=Math.max(1,s/48|0));for(var c=o.subn(1),h=0;!c.testn(h);h++);for(var d=o.shrn(h),p=c.toRed(l),v=!0;i>0;i--){var b=this._randrange(new e(2),c);a&&a(b);var S=b.toRed(l).redPow(d);if(!(S.cmp(u)===0||S.cmp(p)===0)){for(var x=1;x0;i--){var p=this._randrange(new e(2),u),v=o.gcd(p);if(v.cmpn(1)!==0)return v;var b=p.toRed(s).redPow(h);if(!(b.cmp(l)===0||b.cmp(d)===0)){for(var S=1;Sx;)M.ishrn(1);if(M.isEven()&&M.iadd(i),M.testn(1)||M.iadd(a),k.cmp(a)){if(!k.cmp(s))for(;M.mod(l).cmp(u);)M.iadd(h)}else for(;M.mod(r).cmp(c);)M.iadd(h);if(P=M.shrn(1),v(P)&&v(M)&&b(P)&&b(M)&&o.test(P)&&o.test(M))return M}}return ay}const HU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},KU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},ZU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},GU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},YU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},QU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},XU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},JU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},ej={modp1:HU,modp2:KU,modp5:ZU,modp14:GU,modp15:YU,modp16:QU,modp17:XU,modp18:JU};var sy,L9;function tj(){if(L9)return sy;L9=1;var e=cn(),t=nM(),r=new t,n=new e(24),o=new e(11),i=new e(10),a=new e(3),s=new e(7),l=iM(),u=tc();sy=v;function c(S,x){return x=x||"utf8",Oe.Buffer.isBuffer(S)||(S=new Oe.Buffer(S,x)),this._pub=new e(S),this}function h(S,x){return x=x||"utf8",Oe.Buffer.isBuffer(S)||(S=new Oe.Buffer(S,x)),this._priv=new e(S),this}var d={};function p(S,x){var k=x.toString("hex"),M=[k,S.toString(16)].join("_");if(M in d)return d[M];var P=0;if(S.isEven()||!l.simpleSieve||!l.fermatTest(S)||!r.test(S))return P+=1,k==="02"||k==="05"?P+=8:P+=4,d[M]=P,P;r.test(S.shrn(1))||(P+=2);var L;switch(k){case"02":S.mod(n).cmp(o)&&(P+=8);break;case"05":L=S.mod(i),L.cmp(a)&&L.cmp(s)&&(P+=8);break;default:P+=4}return d[M]=P,P}function v(S,x,k){this.setGenerator(x),this.__prime=new e(S),this._prime=e.mont(this.__prime),this._primeLen=S.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,k?(this.setPublicKey=c,this.setPrivateKey=h):this._primeCode=8}Object.defineProperty(v.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=p(this.__prime,this.__gen)),this._primeCode}}),v.prototype.generateKeys=function(){return this._priv||(this._priv=new e(u(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},v.prototype.computeSecret=function(S){S=new e(S),S=S.toRed(this._prime);var x=S.redPow(this._priv).fromRed(),k=new Oe.Buffer(x.toArray()),M=this.getPrime();if(k.length0?f:g},i.min=function(f,g){return f.cmp(g)<0?f:g},i.prototype._init=function(f,g,w){if(typeof f=="number")return this._initNumber(f,g,w);if(typeof f=="object")return this._initArray(f,g,w);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var A=0;f[0]==="-"&&(A++,this.negative=1),A=0;A-=3)E=f[A]|f[A-1]<<8|f[A-2]<<16,this.words[T]|=E<>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);else if(w==="le")for(A=0,T=0;A>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);return this._strip()};function s(y,f){var g=y.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+y)}function l(y,f,g){var w=s(y,g);return g-1>=f&&(w|=s(y,g-1)<<4),w}i.prototype._parseHex=function(f,g,w){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var A=0;A=g;A-=2)C=l(f,g,A)<=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8;else{var I=f.length-g;for(A=I%2===0?g+1:g;A=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8}this._strip()};function u(y,f,g,w){for(var A=0,T=0,E=Math.min(y.length,g),C=f;C=49?T=I-49+10:I>=17?T=I-17+10:T=I,n(I>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","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"],p=[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],v=[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];i.prototype.toString=function(f,g){f=f||10,g=g|0||1;var w;if(f===16||f==="hex"){w="";for(var A=0,T=0,E=0;E>>24-A&16777215,A+=2,A>=26&&(A-=26,E--),T!==0||E!==this.length-1?w=d[6-I.length]+I+w:w=I+w}for(T!==0&&(w=T.toString(16)+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(f===(f|0)&&f>=2&&f<=36){var m=p[f],B=v[f];w="";var ne=this.clone();for(ne.negative=0;!ne.isZero();){var de=ne.modrn(B).toString(f);ne=ne.idivn(B),ne.isZero()?w=de+w:w=d[m-de.length]+de+w}for(this.isZero()&&(w="0"+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(f,g){return this.toArrayLike(a,f,g)}),i.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};i.prototype.toArrayLike=function(f,g,w){this._strip();var A=this.byteLength(),T=w||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var E=b(f,T),C=g==="le"?"LE":"BE";return this["_toArrayLike"+C](E,A),E},i.prototype._toArrayLikeLE=function(f,g){for(var w=0,A=0,T=0,E=0;T>8&255),w>16&255),E===6?(w>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w=0&&(f[w--]=C>>8&255),w>=0&&(f[w--]=C>>16&255),E===6?(w>=0&&(f[w--]=C>>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w>=0)for(f[w--]=A;w>=0;)f[w--]=0},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var g=f,w=0;return g>=4096&&(w+=13,g>>>=13),g>=64&&(w+=7,g>>>=7),g>=8&&(w+=4,g>>>=4),g>=2&&(w+=2,g>>>=2),w+g},i.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,w=0;return g&8191||(w+=13,g>>>=13),g&127||(w+=7,g>>>=7),g&15||(w+=4,g>>>=4),g&3||(w+=2,g>>>=2),g&1||w++,w},i.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function S(y){for(var f=new Array(y.bitLength()),g=0;g>>A&1}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var w=0;wf.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var g,w;this.length>f.length?(g=this,w=f):(g=f,w=this);for(var A=0;Af.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,w=f%26;this._expand(g),w>0&&g--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-w),this._strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var w=f/26|0,A=f%26;return this._expand(w+1),g?this.words[w]=this.words[w]|1<f.length?(w=this,A=f):(w=f,A=this);for(var T=0,E=0;E>>26;for(;T!==0&&E>>26;if(this.length=w.length,T!==0)this.words[this.length]=T,this.length++;else if(w!==this)for(;Ef.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var w=this.cmp(f);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;w>0?(A=this,T=f):(A=f,T=this);for(var E=0,C=0;C>26,this.words[C]=g&67108863;for(;E!==0&&C>26,this.words[C]=g&67108863;if(E===0&&C>>26,ne=I&67108863,de=Math.min(m,f.length-1),$=Math.max(0,m-y.length+1);$<=de;$++){var he=m-$|0;A=y.words[he]|0,T=f.words[$]|0,E=A*T+ne,B+=E/67108864|0,ne=E&67108863}g.words[m]=ne|0,I=B|0}return I!==0?g.words[m]=I|0:g.length--,g._strip()}var k=function(f,g,w){var A=f.words,T=g.words,E=w.words,C=0,I,m,B,ne=A[0]|0,de=ne&8191,$=ne>>>13,he=A[1]|0,X=he&8191,se=he>>>13,pe=A[2]|0,W=pe&8191,q=pe>>>13,ye=A[3]|0,xe=ye&8191,Me=ye>>>13,Q=A[4]|0,N=Q&8191,D=Q>>>13,G=A[5]|0,me=G&8191,_e=G>>>13,Pe=A[6]|0,Fe=Pe&8191,Re=Pe>>>13,le=A[7]|0,Y=le&8191,re=le>>>13,ge=A[8]|0,be=ge&8191,ce=ge>>>13,Ie=A[9]|0,ke=Ie&8191,Te=Ie>>>13,ze=T[0]|0,We=ze&8191,Ne=ze>>>13,Ke=T[1]|0,De=Ke&8191,Le=Ke>>>13,gt=T[2]|0,rt=gt&8191,Ye=gt>>>13,kt=T[3]|0,ht=kt&8191,tt=kt>>>13,Nt=T[4]|0,It=Nt&8191,ut=Nt>>>13,Yt=T[5]|0,Tt=Yt&8191,at=Yt>>>13,lr=T[6]|0,z=lr&8191,J=lr>>>13,ee=T[7]|0,O=ee&8191,te=ee>>>13,Ae=T[8]|0,Ee=Ae&8191,Be=Ae>>>13,qe=T[9]|0,He=qe&8191,$e=qe>>>13;w.negative=f.negative^g.negative,w.length=19,I=Math.imul(de,We),m=Math.imul(de,Ne),m=m+Math.imul($,We)|0,B=Math.imul($,Ne);var Lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,I=Math.imul(X,We),m=Math.imul(X,Ne),m=m+Math.imul(se,We)|0,B=Math.imul(se,Ne),I=I+Math.imul(de,De)|0,m=m+Math.imul(de,Le)|0,m=m+Math.imul($,De)|0,B=B+Math.imul($,Le)|0;var ot=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ot>>>26)|0,ot&=67108863,I=Math.imul(W,We),m=Math.imul(W,Ne),m=m+Math.imul(q,We)|0,B=Math.imul(q,Ne),I=I+Math.imul(X,De)|0,m=m+Math.imul(X,Le)|0,m=m+Math.imul(se,De)|0,B=B+Math.imul(se,Le)|0,I=I+Math.imul(de,rt)|0,m=m+Math.imul(de,Ye)|0,m=m+Math.imul($,rt)|0,B=B+Math.imul($,Ye)|0;var vt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(vt>>>26)|0,vt&=67108863,I=Math.imul(xe,We),m=Math.imul(xe,Ne),m=m+Math.imul(Me,We)|0,B=Math.imul(Me,Ne),I=I+Math.imul(W,De)|0,m=m+Math.imul(W,Le)|0,m=m+Math.imul(q,De)|0,B=B+Math.imul(q,Le)|0,I=I+Math.imul(X,rt)|0,m=m+Math.imul(X,Ye)|0,m=m+Math.imul(se,rt)|0,B=B+Math.imul(se,Ye)|0,I=I+Math.imul(de,ht)|0,m=m+Math.imul(de,tt)|0,m=m+Math.imul($,ht)|0,B=B+Math.imul($,tt)|0;var yt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(yt>>>26)|0,yt&=67108863,I=Math.imul(N,We),m=Math.imul(N,Ne),m=m+Math.imul(D,We)|0,B=Math.imul(D,Ne),I=I+Math.imul(xe,De)|0,m=m+Math.imul(xe,Le)|0,m=m+Math.imul(Me,De)|0,B=B+Math.imul(Me,Le)|0,I=I+Math.imul(W,rt)|0,m=m+Math.imul(W,Ye)|0,m=m+Math.imul(q,rt)|0,B=B+Math.imul(q,Ye)|0,I=I+Math.imul(X,ht)|0,m=m+Math.imul(X,tt)|0,m=m+Math.imul(se,ht)|0,B=B+Math.imul(se,tt)|0,I=I+Math.imul(de,It)|0,m=m+Math.imul(de,ut)|0,m=m+Math.imul($,It)|0,B=B+Math.imul($,ut)|0;var Ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,I=Math.imul(me,We),m=Math.imul(me,Ne),m=m+Math.imul(_e,We)|0,B=Math.imul(_e,Ne),I=I+Math.imul(N,De)|0,m=m+Math.imul(N,Le)|0,m=m+Math.imul(D,De)|0,B=B+Math.imul(D,Le)|0,I=I+Math.imul(xe,rt)|0,m=m+Math.imul(xe,Ye)|0,m=m+Math.imul(Me,rt)|0,B=B+Math.imul(Me,Ye)|0,I=I+Math.imul(W,ht)|0,m=m+Math.imul(W,tt)|0,m=m+Math.imul(q,ht)|0,B=B+Math.imul(q,tt)|0,I=I+Math.imul(X,It)|0,m=m+Math.imul(X,ut)|0,m=m+Math.imul(se,It)|0,B=B+Math.imul(se,ut)|0,I=I+Math.imul(de,Tt)|0,m=m+Math.imul(de,at)|0,m=m+Math.imul($,Tt)|0,B=B+Math.imul($,at)|0;var St=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(St>>>26)|0,St&=67108863,I=Math.imul(Fe,We),m=Math.imul(Fe,Ne),m=m+Math.imul(Re,We)|0,B=Math.imul(Re,Ne),I=I+Math.imul(me,De)|0,m=m+Math.imul(me,Le)|0,m=m+Math.imul(_e,De)|0,B=B+Math.imul(_e,Le)|0,I=I+Math.imul(N,rt)|0,m=m+Math.imul(N,Ye)|0,m=m+Math.imul(D,rt)|0,B=B+Math.imul(D,Ye)|0,I=I+Math.imul(xe,ht)|0,m=m+Math.imul(xe,tt)|0,m=m+Math.imul(Me,ht)|0,B=B+Math.imul(Me,tt)|0,I=I+Math.imul(W,It)|0,m=m+Math.imul(W,ut)|0,m=m+Math.imul(q,It)|0,B=B+Math.imul(q,ut)|0,I=I+Math.imul(X,Tt)|0,m=m+Math.imul(X,at)|0,m=m+Math.imul(se,Tt)|0,B=B+Math.imul(se,at)|0,I=I+Math.imul(de,z)|0,m=m+Math.imul(de,J)|0,m=m+Math.imul($,z)|0,B=B+Math.imul($,J)|0;var bt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(bt>>>26)|0,bt&=67108863,I=Math.imul(Y,We),m=Math.imul(Y,Ne),m=m+Math.imul(re,We)|0,B=Math.imul(re,Ne),I=I+Math.imul(Fe,De)|0,m=m+Math.imul(Fe,Le)|0,m=m+Math.imul(Re,De)|0,B=B+Math.imul(Re,Le)|0,I=I+Math.imul(me,rt)|0,m=m+Math.imul(me,Ye)|0,m=m+Math.imul(_e,rt)|0,B=B+Math.imul(_e,Ye)|0,I=I+Math.imul(N,ht)|0,m=m+Math.imul(N,tt)|0,m=m+Math.imul(D,ht)|0,B=B+Math.imul(D,tt)|0,I=I+Math.imul(xe,It)|0,m=m+Math.imul(xe,ut)|0,m=m+Math.imul(Me,It)|0,B=B+Math.imul(Me,ut)|0,I=I+Math.imul(W,Tt)|0,m=m+Math.imul(W,at)|0,m=m+Math.imul(q,Tt)|0,B=B+Math.imul(q,at)|0,I=I+Math.imul(X,z)|0,m=m+Math.imul(X,J)|0,m=m+Math.imul(se,z)|0,B=B+Math.imul(se,J)|0,I=I+Math.imul(de,O)|0,m=m+Math.imul(de,te)|0,m=m+Math.imul($,O)|0,B=B+Math.imul($,te)|0;var xt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(xt>>>26)|0,xt&=67108863,I=Math.imul(be,We),m=Math.imul(be,Ne),m=m+Math.imul(ce,We)|0,B=Math.imul(ce,Ne),I=I+Math.imul(Y,De)|0,m=m+Math.imul(Y,Le)|0,m=m+Math.imul(re,De)|0,B=B+Math.imul(re,Le)|0,I=I+Math.imul(Fe,rt)|0,m=m+Math.imul(Fe,Ye)|0,m=m+Math.imul(Re,rt)|0,B=B+Math.imul(Re,Ye)|0,I=I+Math.imul(me,ht)|0,m=m+Math.imul(me,tt)|0,m=m+Math.imul(_e,ht)|0,B=B+Math.imul(_e,tt)|0,I=I+Math.imul(N,It)|0,m=m+Math.imul(N,ut)|0,m=m+Math.imul(D,It)|0,B=B+Math.imul(D,ut)|0,I=I+Math.imul(xe,Tt)|0,m=m+Math.imul(xe,at)|0,m=m+Math.imul(Me,Tt)|0,B=B+Math.imul(Me,at)|0,I=I+Math.imul(W,z)|0,m=m+Math.imul(W,J)|0,m=m+Math.imul(q,z)|0,B=B+Math.imul(q,J)|0,I=I+Math.imul(X,O)|0,m=m+Math.imul(X,te)|0,m=m+Math.imul(se,O)|0,B=B+Math.imul(se,te)|0,I=I+Math.imul(de,Ee)|0,m=m+Math.imul(de,Be)|0,m=m+Math.imul($,Ee)|0,B=B+Math.imul($,Be)|0;var wt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(wt>>>26)|0,wt&=67108863,I=Math.imul(ke,We),m=Math.imul(ke,Ne),m=m+Math.imul(Te,We)|0,B=Math.imul(Te,Ne),I=I+Math.imul(be,De)|0,m=m+Math.imul(be,Le)|0,m=m+Math.imul(ce,De)|0,B=B+Math.imul(ce,Le)|0,I=I+Math.imul(Y,rt)|0,m=m+Math.imul(Y,Ye)|0,m=m+Math.imul(re,rt)|0,B=B+Math.imul(re,Ye)|0,I=I+Math.imul(Fe,ht)|0,m=m+Math.imul(Fe,tt)|0,m=m+Math.imul(Re,ht)|0,B=B+Math.imul(Re,tt)|0,I=I+Math.imul(me,It)|0,m=m+Math.imul(me,ut)|0,m=m+Math.imul(_e,It)|0,B=B+Math.imul(_e,ut)|0,I=I+Math.imul(N,Tt)|0,m=m+Math.imul(N,at)|0,m=m+Math.imul(D,Tt)|0,B=B+Math.imul(D,at)|0,I=I+Math.imul(xe,z)|0,m=m+Math.imul(xe,J)|0,m=m+Math.imul(Me,z)|0,B=B+Math.imul(Me,J)|0,I=I+Math.imul(W,O)|0,m=m+Math.imul(W,te)|0,m=m+Math.imul(q,O)|0,B=B+Math.imul(q,te)|0,I=I+Math.imul(X,Ee)|0,m=m+Math.imul(X,Be)|0,m=m+Math.imul(se,Ee)|0,B=B+Math.imul(se,Be)|0,I=I+Math.imul(de,He)|0,m=m+Math.imul(de,$e)|0,m=m+Math.imul($,He)|0,B=B+Math.imul($,$e)|0;var st=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(ke,De),m=Math.imul(ke,Le),m=m+Math.imul(Te,De)|0,B=Math.imul(Te,Le),I=I+Math.imul(be,rt)|0,m=m+Math.imul(be,Ye)|0,m=m+Math.imul(ce,rt)|0,B=B+Math.imul(ce,Ye)|0,I=I+Math.imul(Y,ht)|0,m=m+Math.imul(Y,tt)|0,m=m+Math.imul(re,ht)|0,B=B+Math.imul(re,tt)|0,I=I+Math.imul(Fe,It)|0,m=m+Math.imul(Fe,ut)|0,m=m+Math.imul(Re,It)|0,B=B+Math.imul(Re,ut)|0,I=I+Math.imul(me,Tt)|0,m=m+Math.imul(me,at)|0,m=m+Math.imul(_e,Tt)|0,B=B+Math.imul(_e,at)|0,I=I+Math.imul(N,z)|0,m=m+Math.imul(N,J)|0,m=m+Math.imul(D,z)|0,B=B+Math.imul(D,J)|0,I=I+Math.imul(xe,O)|0,m=m+Math.imul(xe,te)|0,m=m+Math.imul(Me,O)|0,B=B+Math.imul(Me,te)|0,I=I+Math.imul(W,Ee)|0,m=m+Math.imul(W,Be)|0,m=m+Math.imul(q,Ee)|0,B=B+Math.imul(q,Be)|0,I=I+Math.imul(X,He)|0,m=m+Math.imul(X,$e)|0,m=m+Math.imul(se,He)|0,B=B+Math.imul(se,$e)|0;var ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ct>>>26)|0,ct&=67108863,I=Math.imul(ke,rt),m=Math.imul(ke,Ye),m=m+Math.imul(Te,rt)|0,B=Math.imul(Te,Ye),I=I+Math.imul(be,ht)|0,m=m+Math.imul(be,tt)|0,m=m+Math.imul(ce,ht)|0,B=B+Math.imul(ce,tt)|0,I=I+Math.imul(Y,It)|0,m=m+Math.imul(Y,ut)|0,m=m+Math.imul(re,It)|0,B=B+Math.imul(re,ut)|0,I=I+Math.imul(Fe,Tt)|0,m=m+Math.imul(Fe,at)|0,m=m+Math.imul(Re,Tt)|0,B=B+Math.imul(Re,at)|0,I=I+Math.imul(me,z)|0,m=m+Math.imul(me,J)|0,m=m+Math.imul(_e,z)|0,B=B+Math.imul(_e,J)|0,I=I+Math.imul(N,O)|0,m=m+Math.imul(N,te)|0,m=m+Math.imul(D,O)|0,B=B+Math.imul(D,te)|0,I=I+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Be)|0,m=m+Math.imul(Me,Ee)|0,B=B+Math.imul(Me,Be)|0,I=I+Math.imul(W,He)|0,m=m+Math.imul(W,$e)|0,m=m+Math.imul(q,He)|0,B=B+Math.imul(q,$e)|0;var nt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(nt>>>26)|0,nt&=67108863,I=Math.imul(ke,ht),m=Math.imul(ke,tt),m=m+Math.imul(Te,ht)|0,B=Math.imul(Te,tt),I=I+Math.imul(be,It)|0,m=m+Math.imul(be,ut)|0,m=m+Math.imul(ce,It)|0,B=B+Math.imul(ce,ut)|0,I=I+Math.imul(Y,Tt)|0,m=m+Math.imul(Y,at)|0,m=m+Math.imul(re,Tt)|0,B=B+Math.imul(re,at)|0,I=I+Math.imul(Fe,z)|0,m=m+Math.imul(Fe,J)|0,m=m+Math.imul(Re,z)|0,B=B+Math.imul(Re,J)|0,I=I+Math.imul(me,O)|0,m=m+Math.imul(me,te)|0,m=m+Math.imul(_e,O)|0,B=B+Math.imul(_e,te)|0,I=I+Math.imul(N,Ee)|0,m=m+Math.imul(N,Be)|0,m=m+Math.imul(D,Ee)|0,B=B+Math.imul(D,Be)|0,I=I+Math.imul(xe,He)|0,m=m+Math.imul(xe,$e)|0,m=m+Math.imul(Me,He)|0,B=B+Math.imul(Me,$e)|0;var lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(lt>>>26)|0,lt&=67108863,I=Math.imul(ke,It),m=Math.imul(ke,ut),m=m+Math.imul(Te,It)|0,B=Math.imul(Te,ut),I=I+Math.imul(be,Tt)|0,m=m+Math.imul(be,at)|0,m=m+Math.imul(ce,Tt)|0,B=B+Math.imul(ce,at)|0,I=I+Math.imul(Y,z)|0,m=m+Math.imul(Y,J)|0,m=m+Math.imul(re,z)|0,B=B+Math.imul(re,J)|0,I=I+Math.imul(Fe,O)|0,m=m+Math.imul(Fe,te)|0,m=m+Math.imul(Re,O)|0,B=B+Math.imul(Re,te)|0,I=I+Math.imul(me,Ee)|0,m=m+Math.imul(me,Be)|0,m=m+Math.imul(_e,Ee)|0,B=B+Math.imul(_e,Be)|0,I=I+Math.imul(N,He)|0,m=m+Math.imul(N,$e)|0,m=m+Math.imul(D,He)|0,B=B+Math.imul(D,$e)|0;var fe=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(fe>>>26)|0,fe&=67108863,I=Math.imul(ke,Tt),m=Math.imul(ke,at),m=m+Math.imul(Te,Tt)|0,B=Math.imul(Te,at),I=I+Math.imul(be,z)|0,m=m+Math.imul(be,J)|0,m=m+Math.imul(ce,z)|0,B=B+Math.imul(ce,J)|0,I=I+Math.imul(Y,O)|0,m=m+Math.imul(Y,te)|0,m=m+Math.imul(re,O)|0,B=B+Math.imul(re,te)|0,I=I+Math.imul(Fe,Ee)|0,m=m+Math.imul(Fe,Be)|0,m=m+Math.imul(Re,Ee)|0,B=B+Math.imul(Re,Be)|0,I=I+Math.imul(me,He)|0,m=m+Math.imul(me,$e)|0,m=m+Math.imul(_e,He)|0,B=B+Math.imul(_e,$e)|0;var R=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(R>>>26)|0,R&=67108863,I=Math.imul(ke,z),m=Math.imul(ke,J),m=m+Math.imul(Te,z)|0,B=Math.imul(Te,J),I=I+Math.imul(be,O)|0,m=m+Math.imul(be,te)|0,m=m+Math.imul(ce,O)|0,B=B+Math.imul(ce,te)|0,I=I+Math.imul(Y,Ee)|0,m=m+Math.imul(Y,Be)|0,m=m+Math.imul(re,Ee)|0,B=B+Math.imul(re,Be)|0,I=I+Math.imul(Fe,He)|0,m=m+Math.imul(Fe,$e)|0,m=m+Math.imul(Re,He)|0,B=B+Math.imul(Re,$e)|0;var F=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(F>>>26)|0,F&=67108863,I=Math.imul(ke,O),m=Math.imul(ke,te),m=m+Math.imul(Te,O)|0,B=Math.imul(Te,te),I=I+Math.imul(be,Ee)|0,m=m+Math.imul(be,Be)|0,m=m+Math.imul(ce,Ee)|0,B=B+Math.imul(ce,Be)|0,I=I+Math.imul(Y,He)|0,m=m+Math.imul(Y,$e)|0,m=m+Math.imul(re,He)|0,B=B+Math.imul(re,$e)|0;var H=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(H>>>26)|0,H&=67108863,I=Math.imul(ke,Ee),m=Math.imul(ke,Be),m=m+Math.imul(Te,Ee)|0,B=Math.imul(Te,Be),I=I+Math.imul(be,He)|0,m=m+Math.imul(be,$e)|0,m=m+Math.imul(ce,He)|0,B=B+Math.imul(ce,$e)|0;var ae=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ae>>>26)|0,ae&=67108863,I=Math.imul(ke,He),m=Math.imul(ke,$e),m=m+Math.imul(Te,He)|0,B=Math.imul(Te,$e);var oe=(C+I|0)+((m&8191)<<13)|0;return C=(B+(m>>>13)|0)+(oe>>>26)|0,oe&=67108863,E[0]=Lt,E[1]=ot,E[2]=vt,E[3]=yt,E[4]=Ct,E[5]=St,E[6]=bt,E[7]=xt,E[8]=wt,E[9]=st,E[10]=ct,E[11]=nt,E[12]=lt,E[13]=fe,E[14]=R,E[15]=F,E[16]=H,E[17]=ae,E[18]=oe,C!==0&&(E[19]=C,w.length++),w};Math.imul||(k=x);function M(y,f,g){g.negative=f.negative^y.negative,g.length=y.length+f.length;for(var w=0,A=0,T=0;T>>26)|0,A+=E>>>26,E&=67108863}g.words[T]=C,w=E,E=A}return w!==0?g.words[T]=w:g.length--,g._strip()}function P(y,f,g){return M(y,f,g)}i.prototype.mulTo=function(f,g){var w,A=this.length+f.length;return this.length===10&&f.length===10?w=k(this,f,g):A<63?w=x(this,f,g):A<1024?w=M(this,f,g):w=P(this,f,g),w},i.prototype.mul=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},i.prototype.mulf=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),P(this,f,g)},i.prototype.imul=function(f){return this.clone().mulTo(f,this)},i.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var w=0,A=0;A>=26,w+=T/67108864|0,w+=E>>>26,this.words[A]=E&67108863}return w!==0&&(this.words[A]=w,this.length++),g?this.ineg():this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var g=S(f);if(g.length===0)return new i(1);for(var w=this,A=0;A=0);var g=f%26,w=(f-g)/26,A=67108863>>>26-g<<26-g,T;if(g!==0){var E=0;for(T=0;T>>26-g}E&&(this.words[T]=E,this.length++)}if(w!==0){for(T=this.length-1;T>=0;T--)this.words[T+w]=this.words[T];for(T=0;T=0);var A;g?A=(g-g%26)/26:A=0;var T=f%26,E=Math.min((f-T)/26,this.length),C=67108863^67108863>>>T<E)for(this.length-=E,m=0;m=0&&(B!==0||m>=A);m--){var ne=this.words[m]|0;this.words[m]=B<<26-T|ne>>>T,B=ne&C}return I&&B!==0&&(I.words[I.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(f,g,w){return n(this.negative===0),this.iushrn(f,g,w)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,w=(f-g)/26,A=1<=0);var g=f%26,w=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(g!==0&&w++,this.length=Math.min(w,this.length),g!==0){var A=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(I/67108864|0),this.words[T+w]=E&67108863}for(;T>26,this.words[T+w]=E&67108863;if(C===0)return this._strip();for(n(C===-1),C=0,T=0;T>26,this.words[T]=E&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(f,g){var w=this.length-f.length,A=this.clone(),T=f,E=T.words[T.length-1]|0,C=this._countBits(E);w=26-C,w!==0&&(T=T.ushln(w),A.iushln(w),E=T.words[T.length-1]|0);var I=A.length-T.length,m;if(g!=="mod"){m=new i(null),m.length=I+1,m.words=new Array(m.length);for(var B=0;B=0;de--){var $=(A.words[T.length+de]|0)*67108864+(A.words[T.length+de-1]|0);for($=Math.min($/E|0,67108863),A._ishlnsubmul(T,$,de);A.negative!==0;)$--,A.negative=0,A._ishlnsubmul(T,1,de),A.isZero()||(A.negative^=1);m&&(m.words[de]=$)}return m&&m._strip(),A._strip(),g!=="div"&&w!==0&&A.iushrn(w),{div:m||null,mod:A}},i.prototype.divmod=function(f,g,w){if(n(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var A,T,E;return this.negative!==0&&f.negative===0?(E=this.neg().divmod(f,g),g!=="mod"&&(A=E.div.neg()),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.iadd(f)),{div:A,mod:T}):this.negative===0&&f.negative!==0?(E=this.divmod(f.neg(),g),g!=="mod"&&(A=E.div.neg()),{div:A,mod:E.mod}):this.negative&f.negative?(E=this.neg().divmod(f.neg(),g),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.isub(f)),{div:E.div,mod:T}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modrn(f.words[0]))}:this._wordDiv(f,g)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var w=g.div.negative!==0?g.mod.isub(f):g.mod,A=f.ushrn(1),T=f.andln(1),E=w.cmp(A);return E<0||T===1&&E===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=(1<<26)%f,A=0,T=this.length-1;T>=0;T--)A=(w*A+(this.words[T]|0))%f;return g?-A:A},i.prototype.modn=function(f){return this.modrn(f)},i.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+w*67108864;this.words[A]=T/f|0,w=T%f}return this._strip(),g?this.ineg():this},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=new i(0),C=new i(1),I=0;g.isEven()&&w.isEven();)g.iushrn(1),w.iushrn(1),++I;for(var m=w.clone(),B=g.clone();!g.isZero();){for(var ne=0,de=1;!(g.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(g.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(m),T.isub(B)),A.iushrn(1),T.iushrn(1);for(var $=0,he=1;!(w.words[0]&he)&&$<26;++$,he<<=1);if($>0)for(w.iushrn($);$-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(B)),E.iushrn(1),C.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(E),T.isub(C)):(w.isub(g),E.isub(A),C.isub(T))}return{a:E,b:C,gcd:w.iushln(I)}},i.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=w.clone();g.cmpn(1)>0&&w.cmpn(1)>0;){for(var C=0,I=1;!(g.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(g.iushrn(C);C-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);for(var m=0,B=1;!(w.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(w.iushrn(m);m-- >0;)T.isOdd()&&T.iadd(E),T.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(T)):(w.isub(g),T.isub(A))}var ne;return g.cmpn(1)===0?ne=A:ne=T,ne.cmpn(0)<0&&ne.iadd(f),ne},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),w=f.clone();g.negative=0,w.negative=0;for(var A=0;g.isEven()&&w.isEven();A++)g.iushrn(1),w.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;w.isEven();)w.iushrn(1);var T=g.cmp(w);if(T<0){var E=g;g=w,w=E}else if(T===0||w.cmpn(1)===0)break;g.isub(w)}while(!0);return w.iushln(A)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,w=(f-g)/26,A=1<>>26,C&=67108863,this.words[E]=C}return T!==0&&(this.words[E]=T,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var w;if(this.length>1)w=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var A=this.words[0]|0;w=A===f?0:Af.length)return 1;if(this.length=0;w--){var A=this.words[w]|0,T=f.words[w]|0;if(A!==T){AT&&(g=1);break}}return g},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new U(f)},i.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function j(y,f){this.name=y,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,w;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),w=g.bitLength();while(w>this.n);var A=w0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function V(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(V,j),V.prototype.split=function(f,g){for(var w=4194303,A=Math.min(f.length,9),T=0;T>>22,E=C}E>>>=22,f.words[T-10]=E,E===0&&f.length>10?f.length-=10:f.length-=9},V.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,w=0;w>>=26,f.words[w]=T,g=A}return g!==0&&(f.words[f.length++]=g),f},i._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new V;else if(f==="p224")g=new K;else if(f==="p192")g=new Z;else if(f==="p25519")g=new ue;else throw new Error("Unknown prime "+f);return L[f]=g,g};function U(y){if(typeof y=="string"){var f=i._prime(y);this.m=f.p,this.prime=f}else n(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}U.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},U.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},U.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},U.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},U.prototype.add=function(f,g){this._verify2(f,g);var w=f.add(g);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},U.prototype.iadd=function(f,g){this._verify2(f,g);var w=f.iadd(g);return w.cmp(this.m)>=0&&w.isub(this.m),w},U.prototype.sub=function(f,g){this._verify2(f,g);var w=f.sub(g);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},U.prototype.isub=function(f,g){this._verify2(f,g);var w=f.isub(g);return w.cmpn(0)<0&&w.iadd(this.m),w},U.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},U.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},U.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},U.prototype.isqr=function(f){return this.imul(f,f.clone())},U.prototype.sqr=function(f){return this.mul(f,f)},U.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var w=this.m.add(new i(1)).iushrn(2);return this.pow(f,w)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var E=new i(1).toRed(this),C=E.redNeg(),I=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new i(2*m*m).toRed(this);this.pow(m,I).cmp(C)!==0;)m.redIAdd(C);for(var B=this.pow(m,A),ne=this.pow(f,A.addn(1).iushrn(1)),de=this.pow(f,A),$=T;de.cmp(E)!==0;){for(var he=de,X=0;he.cmp(E)!==0;X++)he=he.redSqr();n(X<$);var se=this.pow(B,new i(1).iushln($-X-1));ne=ne.redMul(se),B=se.redSqr(),de=de.redMul(B),$=X}return ne},U.prototype.invm=function(f){var g=f._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},U.prototype.pow=function(f,g){if(g.isZero())return new i(1).toRed(this);if(g.cmpn(1)===0)return f.clone();var w=4,A=new Array(1<=0;T--){for(var B=g.words[T],ne=m-1;ne>=0;ne--){var de=B>>ne&1;if(E!==A[0]&&(E=this.sqr(E)),de===0&&C===0){I=0;continue}C<<=1,C|=de,I++,!(I!==w&&(T!==0||ne!==0))&&(E=this.mul(E,A[C]),I=0,C=0)}m=26}return E},U.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},U.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},i.mont=function(f){return new _(f)};function _(y){U.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(_,U),_.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},_.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},_.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var w=f.imul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new i(0)._forceRed(this);var w=f.mul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(e,Ze)}(ij)),ap}var ly,j9;function xw(){if(j9)return ly;j9=1;var e=oj(),t=tc();function r(i){var a=n(i),s=a.toRed(e.mont(i.modulus)).redPow(new e(i.publicExponent)).fromRed();return{blinder:s,unblinder:a.invm(i.modulus)}}function n(i){var a=i.modulus.byteLength(),s;do s=new e(t(a));while(s.cmp(i.modulus)>=0||!s.umod(i.prime1)||!s.umod(i.prime2));return s}function o(i,a){var s=r(a),l=a.modulus.byteLength(),u=new e(i).mul(s.blinder).umod(a.modulus),c=u.toRed(e.mont(a.prime1)),h=u.toRed(e.mont(a.prime2)),d=a.coefficient,p=a.prime1,v=a.prime2,b=c.redPow(a.exponent1).fromRed(),S=h.redPow(a.exponent2).fromRed(),x=b.isub(S).imul(d).umod(p).imul(v);return S.iadd(x).imul(s.unblinder).umod(a.modulus).toArrayLike(Oe.Buffer,"be",l)}return o.getr=n,ly=o,ly}var uy={};const aj="elliptic",sj="6.5.4",lj="EC cryptography",uj="lib/elliptic.js",cj=["lib"],fj={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/"},dj={type:"git",url:"git@github.com:indutny/elliptic"},hj=["EC","Elliptic","curve","Cryptography"],pj="Fedor Indutny ",gj="MIT",mj={url:"https://github.com/indutny/elliptic/issues"},vj="https://github.com/indutny/elliptic",yj={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"},bj={"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"},wj={name:aj,version:sj,description:lj,main:uj,files:cj,scripts:fj,repository:dj,keywords:hj,author:pj,license:gj,bugs:mj,homepage:vj,devDependencies:yj,dependencies:bj};var cy={},fy={},F9;function oM(){return F9||(F9=1,function(e){var t=e;function r(i,a){if(Array.isArray(i))return i.slice();if(!i)return[];var s=[];if(typeof i!="string"){for(var l=0;l>8,h=u&255;c?s.push(c,h):s.push(h)}return s}t.toArray=r;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function o(i){for(var a="",s=0;s(v>>1)-1?x=(v>>1)-k:x=k,b.isubn(x)):x=0,p[S]=x,b.iushrn(1)}return p}t.getNAF=i;function a(c,h){var d=[[],[]];c=c.clone(),h=h.clone();for(var p=0,v=0,b;c.cmpn(-p)>0||h.cmpn(-v)>0;){var S=c.andln(3)+p&3,x=h.andln(3)+v&3;S===3&&(S=-1),x===3&&(x=-1);var k;S&1?(b=c.andln(7)+p&7,(b===3||b===5)&&x===2?k=-S:k=S):k=0,d[0].push(k);var M;x&1?(b=h.andln(7)+v&7,(b===3||b===5)&&S===2?M=-x:M=x):M=0,d[1].push(M),2*p===k+1&&(p=1-p),2*v===M+1&&(v=1-v),c.iushrn(1),h.iushrn(1)}return d}t.getJSF=a;function s(c,h,d){var p="_"+h;c.prototype[h]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}t.cachedProperty=s;function l(c){return typeof c=="string"?t.toArray(c,"hex"):c}t.parseBytes=l;function u(c){return new r(c,"hex","le")}t.intFromLE=u}(cy)),cy}var dy={},hy,$9;function E1(){if($9)return hy;$9=1;var e=cn(),t=Oi(),r=t.getNAF,n=t.getJSF,o=t.assert;function i(s,l){this.type=s,this.p=new e(l.p,16),this.red=l.prime?e.red(l.prime):e.mont(this.p),this.zero=new e(0).toRed(this.red),this.one=new e(1).toRed(this.red),this.two=new e(2).toRed(this.red),this.n=l.n&&new e(l.n,16),this.g=l.g&&this.pointFromJSON(l.g,l.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 u=this.n&&this.p.div(this.n);!u||u.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}hy=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(l,u){o(l.precomputed);var c=l._getDoubles(),h=r(u,1,this._bitLength),d=(1<=v;S--)b=(b<<1)+h[S];p.push(b)}for(var x=this.jpoint(null,null,null),k=this.jpoint(null,null,null),M=d;M>0;M--){for(v=0;v=0;b--){for(var S=0;b>=0&&p[b]===0;b--)S++;if(b>=0&&S++,v=v.dblp(S),b<0)break;var x=p[b];o(x!==0),l.type==="affine"?x>0?v=v.mixedAdd(d[x-1>>1]):v=v.mixedAdd(d[-x-1>>1].neg()):x>0?v=v.add(d[x-1>>1]):v=v.add(d[-x-1>>1].neg())}return l.type==="affine"?v.toP():v},i.prototype._wnafMulAdd=function(l,u,c,h,d){var p=this._wnafT1,v=this._wnafT2,b=this._wnafT3,S=0,x,k,M;for(x=0;x=1;x-=2){var L=x-1,j=x;if(p[L]!==1||p[j]!==1){b[L]=r(c[L],p[L],this._bitLength),b[j]=r(c[j],p[j],this._bitLength),S=Math.max(b[L].length,S),S=Math.max(b[j].length,S);continue}var V=[u[L],null,null,u[j]];u[L].y.cmp(u[j].y)===0?(V[1]=u[L].add(u[j]),V[2]=u[L].toJ().mixedAdd(u[j].neg())):u[L].y.cmp(u[j].y.redNeg())===0?(V[1]=u[L].toJ().mixedAdd(u[j]),V[2]=u[L].add(u[j].neg())):(V[1]=u[L].toJ().mixedAdd(u[j]),V[2]=u[L].toJ().mixedAdd(u[j].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],Z=n(c[L],c[j]);for(S=Math.max(Z[0].length,S),b[L]=new Array(S),b[j]=new Array(S),k=0;k=0;x--){for(var f=0;x>=0;){var g=!0;for(k=0;k=0&&f++,_=_.dblp(f),x<0)break;for(k=0;k0?M=v[k][w-1>>1]:w<0&&(M=v[k][-w-1>>1].neg()),M.type==="affine"?_=_.mixedAdd(M):_=_.add(M))}}for(x=0;x=Math.ceil((l.bitLength()+1)/u.step):!1},a.prototype._getDoubles=function(l,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],h=this,d=0;d=0&&(L=x,j=k),M.negative&&(M=M.neg(),P=P.neg()),L.negative&&(L=L.neg(),j=j.neg()),[{a:M,b:P},{a:L,b:j}]},i.prototype._endoSplit=function(u){var c=this.endo.basis,h=c[0],d=c[1],p=d.b.mul(u).divRound(this.n),v=h.b.neg().mul(u).divRound(this.n),b=p.mul(h.a),S=v.mul(d.a),x=p.mul(h.b),k=v.mul(d.b),M=u.sub(b).sub(S),P=x.add(k).neg();return{k1:M,k2:P}},i.prototype.pointFromX=function(u,c){u=new t(u,16),u.red||(u=u.toRed(this.red));var h=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),d=h.redSqrt();if(d.redSqr().redSub(h).cmp(this.zero)!==0)throw new Error("invalid point");var p=d.fromRed().isOdd();return(c&&!p||!c&&p)&&(d=d.redNeg()),this.point(u,d)},i.prototype.validate=function(u){if(u.inf)return!0;var c=u.x,h=u.y,d=this.a.redMul(c),p=c.redSqr().redMul(c).redIAdd(d).redIAdd(this.b);return h.redSqr().redISub(p).cmpn(0)===0},i.prototype._endoWnafMulAdd=function(u,c,h){for(var d=this._endoWnafT1,p=this._endoWnafT2,v=0;v":""},a.prototype.isInfinity=function(){return this.inf},a.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 h=c.redSqr().redISub(this.x).redISub(u.x),d=c.redMul(this.x.redSub(h)).redISub(this.y);return this.curve.point(h,d)},a.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,h=this.x.redSqr(),d=u.redInvm(),p=h.redAdd(h).redIAdd(h).redIAdd(c).redMul(d),v=p.redSqr().redISub(this.x.redAdd(this.x)),b=p.redMul(this.x.redSub(v)).redISub(this.y);return this.curve.point(v,b)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(u){return u=new t(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)},a.prototype.mulAdd=function(u,c,h){var d=[this,c],p=[u,h];return this.curve.endo?this.curve._endoWnafMulAdd(d,p):this.curve._wnafMulAdd(1,d,p,2)},a.prototype.jmulAdd=function(u,c,h){var d=[this,c],p=[u,h];return this.curve.endo?this.curve._endoWnafMulAdd(d,p,!0):this.curve._wnafMulAdd(1,d,p,2,!0)},a.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)},a.prototype.neg=function(u){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var h=this.precomputed,d=function(p){return p.neg()};c.precomputed={naf:h.naf&&{wnd:h.naf.wnd,points:h.naf.points.map(d)},doubles:h.doubles&&{step:h.doubles.step,points:h.doubles.points.map(d)}}}return c},a.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 s(l,u,c,h){n.BasePoint.call(this,l,"jacobian"),u===null&&c===null&&h===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new t(0)):(this.x=new t(u,16),this.y=new t(c,16),this.z=new t(h,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(s,n.BasePoint),i.prototype.jpoint=function(u,c,h){return new s(this,u,c,h)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),c=u.redSqr(),h=this.x.redMul(c),d=this.y.redMul(c).redMul(u);return this.curve.point(h,d)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var c=u.z.redSqr(),h=this.z.redSqr(),d=this.x.redMul(c),p=u.x.redMul(h),v=this.y.redMul(c.redMul(u.z)),b=u.y.redMul(h.redMul(this.z)),S=d.redSub(p),x=v.redSub(b);if(S.cmpn(0)===0)return x.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var k=S.redSqr(),M=k.redMul(S),P=d.redMul(k),L=x.redSqr().redIAdd(M).redISub(P).redISub(P),j=x.redMul(P.redISub(L)).redISub(v.redMul(M)),V=this.z.redMul(u.z).redMul(S);return this.curve.jpoint(L,j,V)},s.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var c=this.z.redSqr(),h=this.x,d=u.x.redMul(c),p=this.y,v=u.y.redMul(c).redMul(this.z),b=h.redSub(d),S=p.redSub(v);if(b.cmpn(0)===0)return S.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var x=b.redSqr(),k=x.redMul(b),M=h.redMul(x),P=S.redSqr().redIAdd(k).redISub(M).redISub(M),L=S.redMul(M.redISub(P)).redISub(p.redMul(k)),j=this.z.redMul(b);return this.curve.jpoint(P,L,j)},s.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 h=this;for(c=0;c=0)return!1;if(h.redIAdd(p),this.x.cmp(h)===0)return!0}},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},py}var gy,W9;function xj(){if(W9)return gy;W9=1;var e=cn(),t=Ht(),r=E1(),n=Oi();function o(a){r.call(this,"mont",a),this.a=new e(a.a,16).toRed(this.red),this.b=new e(a.b,16).toRed(this.red),this.i4=new e(4).toRed(this.red).redInvm(),this.two=new e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}t(o,r),gy=o,o.prototype.validate=function(s){var l=s.normalize().x,u=l.redSqr(),c=u.redMul(l).redAdd(u.redMul(this.a)).redAdd(l),h=c.redSqrt();return h.redSqr().cmp(c)===0};function i(a,s,l){r.BasePoint.call(this,a,"projective"),s===null&&l===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new e(s,16),this.z=new e(l,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return t(i,r.BasePoint),o.prototype.decodePoint=function(s,l){return this.point(n.toArray(s,l),1)},o.prototype.point=function(s,l){return new i(this,s,l)},o.prototype.pointFromJSON=function(s){return i.fromJSON(this,s)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(s,l){return new i(s,l[0],l[1]||s.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.z.cmpn(0)===0},i.prototype.dbl=function(){var s=this.x.redAdd(this.z),l=s.redSqr(),u=this.x.redSub(this.z),c=u.redSqr(),h=l.redSub(c),d=l.redMul(c),p=h.redMul(c.redAdd(this.curve.a24.redMul(h)));return this.curve.point(d,p)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(s,l){var u=this.x.redAdd(this.z),c=this.x.redSub(this.z),h=s.x.redAdd(s.z),d=s.x.redSub(s.z),p=d.redMul(u),v=h.redMul(c),b=l.z.redMul(p.redAdd(v).redSqr()),S=l.x.redMul(p.redISub(v).redSqr());return this.curve.point(b,S)},i.prototype.mul=function(s){for(var l=s.clone(),u=this,c=this.curve.point(null,null),h=this,d=[];l.cmpn(0)!==0;l.iushrn(1))d.push(l.andln(1));for(var p=d.length-1;p>=0;p--)d[p]===0?(u=u.diffAdd(c,h),c=c.dbl()):(c=u.diffAdd(c,h),u=u.dbl());return c},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(s){return this.getX().cmp(s.getX())===0},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},gy}var my,V9;function Sj(){if(V9)return my;V9=1;var e=Oi(),t=cn(),r=Ht(),n=E1(),o=e.assert;function i(s){this.twisted=(s.a|0)!==1,this.mOneA=this.twisted&&(s.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",s),this.a=new t(s.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new t(s.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new t(s.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),o(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(s.c|0)===1}r(i,n),my=i,i.prototype._mulA=function(l){return this.mOneA?l.redNeg():this.a.redMul(l)},i.prototype._mulC=function(l){return this.oneC?l:this.c.redMul(l)},i.prototype.jpoint=function(l,u,c,h){return this.point(l,u,c,h)},i.prototype.pointFromX=function(l,u){l=new t(l,16),l.red||(l=l.toRed(this.red));var c=l.redSqr(),h=this.c2.redSub(this.a.redMul(c)),d=this.one.redSub(this.c2.redMul(this.d).redMul(c)),p=h.redMul(d.redInvm()),v=p.redSqrt();if(v.redSqr().redSub(p).cmp(this.zero)!==0)throw new Error("invalid point");var b=v.fromRed().isOdd();return(u&&!b||!u&&b)&&(v=v.redNeg()),this.point(l,v)},i.prototype.pointFromY=function(l,u){l=new t(l,16),l.red||(l=l.toRed(this.red));var c=l.redSqr(),h=c.redSub(this.c2),d=c.redMul(this.d).redMul(this.c2).redSub(this.a),p=h.redMul(d.redInvm());if(p.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,l)}var v=p.redSqrt();if(v.redSqr().redSub(p).cmp(this.zero)!==0)throw new Error("invalid point");return v.fromRed().isOdd()!==u&&(v=v.redNeg()),this.point(v,l)},i.prototype.validate=function(l){if(l.isInfinity())return!0;l.normalize();var u=l.x.redSqr(),c=l.y.redSqr(),h=u.redMul(this.a).redAdd(c),d=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(c)));return h.cmp(d)===0};function a(s,l,u,c,h){n.BasePoint.call(this,s,"projective"),l===null&&u===null&&c===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 t(l,16),this.y=new t(u,16),this.z=c?new t(c,16):this.curve.one,this.t=h&&new t(h,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(a,n.BasePoint),i.prototype.pointFromJSON=function(l){return a.fromJSON(this,l)},i.prototype.point=function(l,u,c,h){return new a(this,l,u,c,h)},a.fromJSON=function(l,u){return new a(l,u[0],u[1],u[2])},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},a.prototype._extDbl=function(){var l=this.x.redSqr(),u=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var h=this.curve._mulA(l),d=this.x.redAdd(this.y).redSqr().redISub(l).redISub(u),p=h.redAdd(u),v=p.redSub(c),b=h.redSub(u),S=d.redMul(v),x=p.redMul(b),k=d.redMul(b),M=v.redMul(p);return this.curve.point(S,x,M,k)},a.prototype._projDbl=function(){var l=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),c=this.y.redSqr(),h,d,p,v,b,S;if(this.curve.twisted){v=this.curve._mulA(u);var x=v.redAdd(c);this.zOne?(h=l.redSub(u).redSub(c).redMul(x.redSub(this.curve.two)),d=x.redMul(v.redSub(c)),p=x.redSqr().redSub(x).redSub(x)):(b=this.z.redSqr(),S=x.redSub(b).redISub(b),h=l.redSub(u).redISub(c).redMul(S),d=x.redMul(v.redSub(c)),p=x.redMul(S))}else v=u.redAdd(c),b=this.curve._mulC(this.z).redSqr(),S=v.redSub(b).redSub(b),h=this.curve._mulC(l.redISub(v)).redMul(S),d=this.curve._mulC(v).redMul(u.redISub(c)),p=v.redMul(S);return this.curve.point(h,d,p)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(l){var u=this.y.redSub(this.x).redMul(l.y.redSub(l.x)),c=this.y.redAdd(this.x).redMul(l.y.redAdd(l.x)),h=this.t.redMul(this.curve.dd).redMul(l.t),d=this.z.redMul(l.z.redAdd(l.z)),p=c.redSub(u),v=d.redSub(h),b=d.redAdd(h),S=c.redAdd(u),x=p.redMul(v),k=b.redMul(S),M=p.redMul(S),P=v.redMul(b);return this.curve.point(x,k,P,M)},a.prototype._projAdd=function(l){var u=this.z.redMul(l.z),c=u.redSqr(),h=this.x.redMul(l.x),d=this.y.redMul(l.y),p=this.curve.d.redMul(h).redMul(d),v=c.redSub(p),b=c.redAdd(p),S=this.x.redAdd(this.y).redMul(l.x.redAdd(l.y)).redISub(h).redISub(d),x=u.redMul(v).redMul(S),k,M;return this.curve.twisted?(k=u.redMul(b).redMul(d.redSub(this.curve._mulA(h))),M=v.redMul(b)):(k=u.redMul(b).redMul(d.redSub(h)),M=this.curve._mulC(v).redMul(b)),this.curve.point(x,k,M)},a.prototype.add=function(l){return this.isInfinity()?l:l.isInfinity()?this:this.curve.extended?this._extAdd(l):this._projAdd(l)},a.prototype.mul=function(l){return this._hasDoubles(l)?this.curve._fixedNafMul(this,l):this.curve._wnafMul(this,l)},a.prototype.mulAdd=function(l,u,c){return this.curve._wnafMulAdd(1,[this,u],[l,c],2,!1)},a.prototype.jmulAdd=function(l,u,c){return this.curve._wnafMulAdd(1,[this,u],[l,c],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var l=this.z.redInvm();return this.x=this.x.redMul(l),this.y=this.y.redMul(l),this.t&&(this.t=this.t.redMul(l)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(l){return this===l||this.getX().cmp(l.getX())===0&&this.getY().cmp(l.getY())===0},a.prototype.eqXToP=function(l){var u=l.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var c=l.clone(),h=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(h),this.x.cmp(u)===0)return!0}},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add,my}var H9;function aM(){return H9||(H9=1,function(e){var t=e;t.base=E1(),t.short=_j(),t.mont=xj(),t.edwards=Sj()}(dy)),dy}var vy={},yy={},pr={},K9;function To(){if(K9)return pr;K9=1;var e=Ri(),t=Ht();pr.inherits=t;function r(_,y){return(_.charCodeAt(y)&64512)!==55296||y<0||y+1>=_.length?!1:(_.charCodeAt(y+1)&64512)===56320}function n(_,y){if(Array.isArray(_))return _.slice();if(!_)return[];var f=[];if(typeof _=="string")if(y){if(y==="hex")for(_=_.replace(/[^a-z0-9]+/ig,""),_.length%2!==0&&(_="0"+_),w=0;w<_.length;w+=2)f.push(parseInt(_[w]+_[w+1],16))}else for(var g=0,w=0;w<_.length;w++){var A=_.charCodeAt(w);A<128?f[g++]=A:A<2048?(f[g++]=A>>6|192,f[g++]=A&63|128):r(_,w)?(A=65536+((A&1023)<<10)+(_.charCodeAt(++w)&1023),f[g++]=A>>18|240,f[g++]=A>>12&63|128,f[g++]=A>>6&63|128,f[g++]=A&63|128):(f[g++]=A>>12|224,f[g++]=A>>6&63|128,f[g++]=A&63|128)}else for(w=0;w<_.length;w++)f[w]=_[w]|0;return f}pr.toArray=n;function o(_){for(var y="",f=0;f<_.length;f++)y+=s(_[f].toString(16));return y}pr.toHex=o;function i(_){var y=_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24;return y>>>0}pr.htonl=i;function a(_,y){for(var f="",g=0;g<_.length;g++){var w=_[g];y==="little"&&(w=i(w)),f+=l(w.toString(16))}return f}pr.toHex32=a;function s(_){return _.length===1?"0"+_:_}pr.zero2=s;function l(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}pr.zero8=l;function u(_,y,f,g){var w=f-y;e(w%4===0);for(var A=new Array(w/4),T=0,E=y;T>>0}return A}pr.join32=u;function c(_,y){for(var f=new Array(_.length*4),g=0,w=0;g<_.length;g++,w+=4){var A=_[g];y==="big"?(f[w]=A>>>24,f[w+1]=A>>>16&255,f[w+2]=A>>>8&255,f[w+3]=A&255):(f[w+3]=A>>>24,f[w+2]=A>>>16&255,f[w+1]=A>>>8&255,f[w]=A&255)}return f}pr.split32=c;function h(_,y){return _>>>y|_<<32-y}pr.rotr32=h;function d(_,y){return _<>>32-y}pr.rotl32=d;function p(_,y){return _+y>>>0}pr.sum32=p;function v(_,y,f){return _+y+f>>>0}pr.sum32_3=v;function b(_,y,f,g){return _+y+f+g>>>0}pr.sum32_4=b;function S(_,y,f,g,w){return _+y+f+g+w>>>0}pr.sum32_5=S;function x(_,y,f,g){var w=_[y],A=_[y+1],T=g+A>>>0,E=(T>>0,_[y+1]=T}pr.sum64=x;function k(_,y,f,g){var w=y+g>>>0,A=(w>>0}pr.sum64_hi=k;function M(_,y,f,g){var w=y+g;return w>>>0}pr.sum64_lo=M;function P(_,y,f,g,w,A,T,E){var C=0,I=y;I=I+g>>>0,C+=I>>0,C+=I>>0,C+=I>>0}pr.sum64_4_hi=P;function L(_,y,f,g,w,A,T,E){var C=y+g+A+E;return C>>>0}pr.sum64_4_lo=L;function j(_,y,f,g,w,A,T,E,C,I){var m=0,B=y;B=B+g>>>0,m+=B>>0,m+=B>>0,m+=B>>0,m+=B>>0}pr.sum64_5_hi=j;function V(_,y,f,g,w,A,T,E,C,I){var m=y+g+A+E+I;return m>>>0}pr.sum64_5_lo=V;function K(_,y,f){var g=y<<32-f|_>>>f;return g>>>0}pr.rotr64_hi=K;function Z(_,y,f){var g=_<<32-f|y>>>f;return g>>>0}pr.rotr64_lo=Z;function ue(_,y,f){return _>>>f}pr.shr64_hi=ue;function U(_,y,f){var g=_<<32-f|y>>>f;return g>>>0}return pr.shr64_lo=U,pr}var by={},Z9;function Wd(){if(Z9)return by;Z9=1;var e=To(),t=Ri();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 by.BlockHash=r,r.prototype.update=function(o,i){if(o=e.toArray(o,i),this.pending?this.pending=this.pending.concat(o):this.pending=o,this.pendingTotal+=o.length,this.pending.length>=this._delta8){o=this.pending;var a=o.length%this._delta8;this.pending=o.slice(o.length-a,o.length),this.pending.length===0&&(this.pending=null),o=e.join32(o,0,o.length-a,this.endian);for(var s=0;s>>24&255,s[l++]=o>>>16&255,s[l++]=o>>>8&255,s[l++]=o&255}else for(s[l++]=o&255,s[l++]=o>>>8&255,s[l++]=o>>>16&255,s[l++]=o>>>24&255,s[l++]=0,s[l++]=0,s[l++]=0,s[l++]=0,u=8;u>>3}io.g0_256=l;function u(c){return t(c,17)^t(c,19)^c>>>10}return io.g1_256=u,io}var wy,Y9;function Cj(){if(Y9)return wy;Y9=1;var e=To(),t=Wd(),r=sM(),n=e.rotl32,o=e.sum32,i=e.sum32_5,a=r.ft_1,s=t.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return e.inherits(u,s),wy=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(h,d){for(var p=this.W,v=0;v<16;v++)p[v]=h[d+v];for(;vthis.blockSize&&(o=new this.Hash().update(o).digest()),t(o.length<=this.blockSize);for(var i=o.length;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,a,s)}return My=n,n.prototype._init=function(i,a,s){var l=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.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,l){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(l=s,s=a,a=null),s&&(s=t.toArray(s,l||"hex"),this._update(s));for(var u=[];u.length"},Iy}var Ty,ux;function Rj(){if(ux)return Ty;ux=1;var e=cn(),t=Oi(),r=t.assert;function n(l,u){if(l instanceof n)return l;this._importDER(l,u)||(r(l.r&&l.s,"Signature without r or s"),this.r=new e(l.r,16),this.s=new e(l.s,16),l.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=l.recoveryParam)}Ty=n;function o(){this.place=0}function i(l,u){var c=l[u.place++];if(!(c&128))return c;var h=c&15;if(h===0||h>4)return!1;for(var d=0,p=0,v=u.place;p>>=0;return d<=127?!1:(u.place=v,d)}function a(l){for(var u=0,c=l.length-1;!l[u]&&!(l[u+1]&128)&&u>>3);for(l.push(c|128);--c;)l.push(u>>>(c<<3)&255);l.push(u)}return n.prototype.toDER=function(u){var c=this.r.toArray(),h=this.s.toArray();for(c[0]&128&&(c=[0].concat(c)),h[0]&128&&(h=[0].concat(h)),c=a(c),h=a(h);!h[0]&&!(h[1]&128);)h=h.slice(1);var d=[2];s(d,c.length),d=d.concat(c),d.push(2),s(d,h.length);var p=d.concat(h),v=[48];return s(v,p.length),v=v.concat(p),t.encode(v,u)},Ty}var By,cx;function Oj(){if(cx)return By;cx=1;var e=cn(),t=Bj(),r=Oi(),n=Cw(),o=_w(),i=r.assert,a=Pj(),s=Rj();function l(u){if(!(this instanceof l))return new l(u);typeof u=="string"&&(i(Object.prototype.hasOwnProperty.call(n,u),"Unknown curve "+u),u=n[u]),u instanceof n.PresetCurve&&(u={curve:u}),this.curve=u.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=u.curve.g,this.g.precompute(u.curve.n.bitLength()+1),this.hash=u.hash||u.curve.hash}return By=l,l.prototype.keyPair=function(c){return new a(this,c)},l.prototype.keyFromPrivate=function(c,h){return a.fromPrivate(this,c,h)},l.prototype.keyFromPublic=function(c,h){return a.fromPublic(this,c,h)},l.prototype.genKeyPair=function(c){c||(c={});for(var h=new t({hash:this.hash,pers:c.pers,persEnc:c.persEnc||"utf8",entropy:c.entropy||o(this.hash.hmacStrength),entropyEnc:c.entropy&&c.entropyEnc||"utf8",nonce:this.n.toArray()}),d=this.n.byteLength(),p=this.n.sub(new e(2));;){var v=new e(h.generate(d));if(!(v.cmp(p)>0))return v.iaddn(1),this.keyFromPrivate(v)}},l.prototype._truncateToN=function(c,h){var d=c.byteLength()*8-this.n.bitLength();return d>0&&(c=c.ushrn(d)),!h&&c.cmp(this.n)>=0?c.sub(this.n):c},l.prototype.sign=function(c,h,d,p){typeof d=="object"&&(p=d,d=null),p||(p={}),h=this.keyFromPrivate(h,d),c=this._truncateToN(new e(c,16));for(var v=this.n.byteLength(),b=h.getPrivate().toArray("be",v),S=c.toArray("be",v),x=new t({hash:this.hash,entropy:b,nonce:S,pers:p.pers,persEnc:p.persEnc||"utf8"}),k=this.n.sub(new e(1)),M=0;;M++){var P=p.k?p.k(M):new e(x.generate(this.n.byteLength()));if(P=this._truncateToN(P,!0),!(P.cmpn(1)<=0||P.cmp(k)>=0)){var L=this.g.mul(P);if(!L.isInfinity()){var j=L.getX(),V=j.umod(this.n);if(V.cmpn(0)!==0){var K=P.invm(this.n).mul(V.mul(h.getPrivate()).iadd(c));if(K=K.umod(this.n),K.cmpn(0)!==0){var Z=(L.getY().isOdd()?1:0)|(j.cmp(V)!==0?2:0);return p.canonical&&K.cmp(this.nh)>0&&(K=this.n.sub(K),Z^=1),new s({r:V,s:K,recoveryParam:Z})}}}}}},l.prototype.verify=function(c,h,d,p){c=this._truncateToN(new e(c,16)),d=this.keyFromPublic(d,p),h=new s(h,"hex");var v=h.r,b=h.s;if(v.cmpn(1)<0||v.cmp(this.n)>=0||b.cmpn(1)<0||b.cmp(this.n)>=0)return!1;var S=b.invm(this.n),x=S.mul(c).umod(this.n),k=S.mul(v).umod(this.n),M;return this.curve._maxwellTrick?(M=this.g.jmulAdd(x,d.getPublic(),k),M.isInfinity()?!1:M.eqXToP(v)):(M=this.g.mulAdd(x,d.getPublic(),k),M.isInfinity()?!1:M.getX().umod(this.n).cmp(v)===0)},l.prototype.recoverPubKey=function(u,c,h,d){i((3&h)===h,"The recovery param is more than two bits"),c=new s(c,d);var p=this.n,v=new e(u),b=c.r,S=c.s,x=h&1,k=h>>1;if(b.cmp(this.curve.p.umod(this.curve.n))>=0&&k)throw new Error("Unable to find sencond key candinate");k?b=this.curve.pointFromX(b.add(this.curve.n),x):b=this.curve.pointFromX(b,x);var M=c.r.invm(p),P=p.sub(v).mul(M).umod(p),L=S.mul(M).umod(p);return this.g.mulAdd(P,b,L)},l.prototype.getKeyRecoveryParam=function(u,c,h,d){if(c=new s(c,d),c.recoveryParam!==null)return c.recoveryParam;for(var p=0;p<4;p++){var v;try{v=this.recoverPubKey(u,c,p)}catch{continue}if(v.eq(h))return p}throw new Error("Unable to find valid recovery factor")},By}var Py,fx;function Nj(){if(fx)return Py;fx=1;var e=Oi(),t=e.assert,r=e.parseBytes,n=e.cachedProperty;function o(i,a){this.eddsa=i,this._secret=r(a.secret),i.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=r(a.pub)}return o.fromPublic=function(a,s){return s instanceof o?s:new o(a,{pub:s})},o.fromSecret=function(a,s){return s instanceof o?s:new o(a,{secret:s})},o.prototype.secret=function(){return this._secret},n(o,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(o,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(o,"privBytes",function(){var a=this.eddsa,s=this.hash(),l=a.encodingLength-1,u=s.slice(0,a.encodingLength);return u[0]&=248,u[l]&=127,u[l]|=64,u}),n(o,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(o,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(o,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),o.prototype.sign=function(a){return t(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)},o.prototype.verify=function(a,s){return this.eddsa.verify(a,s,this)},o.prototype.getSecret=function(a){return t(this._secret,"KeyPair is public only"),e.encode(this.secret(),a)},o.prototype.getPublic=function(a){return e.encode(this.pubBytes(),a)},Py=o,Py}var Ry,dx;function Lj(){if(dx)return Ry;dx=1;var e=cn(),t=Oi(),r=t.assert,n=t.cachedProperty,o=t.parseBytes;function i(a,s){this.eddsa=a,typeof s!="object"&&(s=o(s)),Array.isArray(s)&&(s={R:s.slice(0,a.encodingLength),S:s.slice(a.encodingLength)}),r(s.R&&s.S,"Signature without R or S"),a.isPoint(s.R)&&(this._R=s.R),s.S instanceof e&&(this._S=s.S),this._Rencoded=Array.isArray(s.R)?s.R:s.Rencoded,this._Sencoded=Array.isArray(s.S)?s.S:s.Sencoded}return n(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},Ry=i,Ry}var Oy,hx;function Dj(){if(hx)return Oy;hx=1;var e=Sw(),t=Cw(),r=Oi(),n=r.assert,o=r.parseBytes,i=Nj(),a=Lj();function s(l){if(n(l==="ed25519","only tested with ed25519 so far"),!(this instanceof s))return new s(l);l=t[l].curve,this.curve=l,this.g=l.g,this.g.precompute(l.n.bitLength()+1),this.pointClass=l.point().constructor,this.encodingLength=Math.ceil(l.n.bitLength()/8),this.hash=e.sha512}return Oy=s,s.prototype.sign=function(u,c){u=o(u);var h=this.keyFromSecret(c),d=this.hashInt(h.messagePrefix(),u),p=this.g.mul(d),v=this.encodePoint(p),b=this.hashInt(v,h.pubBytes(),u).mul(h.priv()),S=d.add(b).umod(this.curve.n);return this.makeSignature({R:p,S,Rencoded:v})},s.prototype.verify=function(u,c,h){u=o(u),c=this.makeSignature(c);var d=this.keyFromPublic(h),p=this.hashInt(c.Rencoded(),d.pubBytes(),u),v=this.g.mul(c.S()),b=c.R().add(d.pub().mul(p));return b.eq(v)},s.prototype.hashInt=function(){for(var u=this.hash(),c=0;c0?f:g},i.min=function(f,g){return f.cmp(g)<0?f:g},i.prototype._init=function(f,g,w){if(typeof f=="number")return this._initNumber(f,g,w);if(typeof f=="object")return this._initArray(f,g,w);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var A=0;f[0]==="-"&&(A++,this.negative=1),A=0;A-=3)E=f[A]|f[A-1]<<8|f[A-2]<<16,this.words[T]|=E<>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);else if(w==="le")for(A=0,T=0;A>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);return this._strip()};function s(y,f){var g=y.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+y)}function l(y,f,g){var w=s(y,g);return g-1>=f&&(w|=s(y,g-1)<<4),w}i.prototype._parseHex=function(f,g,w){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var A=0;A=g;A-=2)C=l(f,g,A)<=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8;else{var I=f.length-g;for(A=I%2===0?g+1:g;A=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8}this._strip()};function u(y,f,g,w){for(var A=0,T=0,E=Math.min(y.length,g),C=f;C=49?T=I-49+10:I>=17?T=I-17+10:T=I,n(I>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","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"],p=[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],v=[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];i.prototype.toString=function(f,g){f=f||10,g=g|0||1;var w;if(f===16||f==="hex"){w="";for(var A=0,T=0,E=0;E>>24-A&16777215,A+=2,A>=26&&(A-=26,E--),T!==0||E!==this.length-1?w=d[6-I.length]+I+w:w=I+w}for(T!==0&&(w=T.toString(16)+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(f===(f|0)&&f>=2&&f<=36){var m=p[f],B=v[f];w="";var ne=this.clone();for(ne.negative=0;!ne.isZero();){var de=ne.modrn(B).toString(f);ne=ne.idivn(B),ne.isZero()?w=de+w:w=d[m-de.length]+de+w}for(this.isZero()&&(w="0"+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(f,g){return this.toArrayLike(a,f,g)}),i.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};i.prototype.toArrayLike=function(f,g,w){this._strip();var A=this.byteLength(),T=w||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var E=b(f,T),C=g==="le"?"LE":"BE";return this["_toArrayLike"+C](E,A),E},i.prototype._toArrayLikeLE=function(f,g){for(var w=0,A=0,T=0,E=0;T>8&255),w>16&255),E===6?(w>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w=0&&(f[w--]=C>>8&255),w>=0&&(f[w--]=C>>16&255),E===6?(w>=0&&(f[w--]=C>>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w>=0)for(f[w--]=A;w>=0;)f[w--]=0},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var g=f,w=0;return g>=4096&&(w+=13,g>>>=13),g>=64&&(w+=7,g>>>=7),g>=8&&(w+=4,g>>>=4),g>=2&&(w+=2,g>>>=2),w+g},i.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,w=0;return g&8191||(w+=13,g>>>=13),g&127||(w+=7,g>>>=7),g&15||(w+=4,g>>>=4),g&3||(w+=2,g>>>=2),g&1||w++,w},i.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function S(y){for(var f=new Array(y.bitLength()),g=0;g>>A&1}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var w=0;wf.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var g,w;this.length>f.length?(g=this,w=f):(g=f,w=this);for(var A=0;Af.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,w=f%26;this._expand(g),w>0&&g--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-w),this._strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var w=f/26|0,A=f%26;return this._expand(w+1),g?this.words[w]=this.words[w]|1<f.length?(w=this,A=f):(w=f,A=this);for(var T=0,E=0;E>>26;for(;T!==0&&E>>26;if(this.length=w.length,T!==0)this.words[this.length]=T,this.length++;else if(w!==this)for(;Ef.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var w=this.cmp(f);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;w>0?(A=this,T=f):(A=f,T=this);for(var E=0,C=0;C>26,this.words[C]=g&67108863;for(;E!==0&&C>26,this.words[C]=g&67108863;if(E===0&&C>>26,ne=I&67108863,de=Math.min(m,f.length-1),$=Math.max(0,m-y.length+1);$<=de;$++){var he=m-$|0;A=y.words[he]|0,T=f.words[$]|0,E=A*T+ne,B+=E/67108864|0,ne=E&67108863}g.words[m]=ne|0,I=B|0}return I!==0?g.words[m]=I|0:g.length--,g._strip()}var k=function(f,g,w){var A=f.words,T=g.words,E=w.words,C=0,I,m,B,ne=A[0]|0,de=ne&8191,$=ne>>>13,he=A[1]|0,X=he&8191,se=he>>>13,pe=A[2]|0,W=pe&8191,q=pe>>>13,ye=A[3]|0,xe=ye&8191,Me=ye>>>13,Q=A[4]|0,N=Q&8191,D=Q>>>13,G=A[5]|0,me=G&8191,_e=G>>>13,Pe=A[6]|0,Fe=Pe&8191,Re=Pe>>>13,le=A[7]|0,Y=le&8191,re=le>>>13,ge=A[8]|0,be=ge&8191,ce=ge>>>13,Ie=A[9]|0,ke=Ie&8191,Te=Ie>>>13,ze=T[0]|0,We=ze&8191,Ne=ze>>>13,Ke=T[1]|0,De=Ke&8191,Le=Ke>>>13,gt=T[2]|0,rt=gt&8191,Ye=gt>>>13,kt=T[3]|0,ht=kt&8191,tt=kt>>>13,Nt=T[4]|0,It=Nt&8191,ut=Nt>>>13,Yt=T[5]|0,Tt=Yt&8191,at=Yt>>>13,lr=T[6]|0,z=lr&8191,J=lr>>>13,ee=T[7]|0,O=ee&8191,te=ee>>>13,Ae=T[8]|0,Ee=Ae&8191,Be=Ae>>>13,qe=T[9]|0,He=qe&8191,$e=qe>>>13;w.negative=f.negative^g.negative,w.length=19,I=Math.imul(de,We),m=Math.imul(de,Ne),m=m+Math.imul($,We)|0,B=Math.imul($,Ne);var Lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,I=Math.imul(X,We),m=Math.imul(X,Ne),m=m+Math.imul(se,We)|0,B=Math.imul(se,Ne),I=I+Math.imul(de,De)|0,m=m+Math.imul(de,Le)|0,m=m+Math.imul($,De)|0,B=B+Math.imul($,Le)|0;var ot=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ot>>>26)|0,ot&=67108863,I=Math.imul(W,We),m=Math.imul(W,Ne),m=m+Math.imul(q,We)|0,B=Math.imul(q,Ne),I=I+Math.imul(X,De)|0,m=m+Math.imul(X,Le)|0,m=m+Math.imul(se,De)|0,B=B+Math.imul(se,Le)|0,I=I+Math.imul(de,rt)|0,m=m+Math.imul(de,Ye)|0,m=m+Math.imul($,rt)|0,B=B+Math.imul($,Ye)|0;var vt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(vt>>>26)|0,vt&=67108863,I=Math.imul(xe,We),m=Math.imul(xe,Ne),m=m+Math.imul(Me,We)|0,B=Math.imul(Me,Ne),I=I+Math.imul(W,De)|0,m=m+Math.imul(W,Le)|0,m=m+Math.imul(q,De)|0,B=B+Math.imul(q,Le)|0,I=I+Math.imul(X,rt)|0,m=m+Math.imul(X,Ye)|0,m=m+Math.imul(se,rt)|0,B=B+Math.imul(se,Ye)|0,I=I+Math.imul(de,ht)|0,m=m+Math.imul(de,tt)|0,m=m+Math.imul($,ht)|0,B=B+Math.imul($,tt)|0;var yt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(yt>>>26)|0,yt&=67108863,I=Math.imul(N,We),m=Math.imul(N,Ne),m=m+Math.imul(D,We)|0,B=Math.imul(D,Ne),I=I+Math.imul(xe,De)|0,m=m+Math.imul(xe,Le)|0,m=m+Math.imul(Me,De)|0,B=B+Math.imul(Me,Le)|0,I=I+Math.imul(W,rt)|0,m=m+Math.imul(W,Ye)|0,m=m+Math.imul(q,rt)|0,B=B+Math.imul(q,Ye)|0,I=I+Math.imul(X,ht)|0,m=m+Math.imul(X,tt)|0,m=m+Math.imul(se,ht)|0,B=B+Math.imul(se,tt)|0,I=I+Math.imul(de,It)|0,m=m+Math.imul(de,ut)|0,m=m+Math.imul($,It)|0,B=B+Math.imul($,ut)|0;var Ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,I=Math.imul(me,We),m=Math.imul(me,Ne),m=m+Math.imul(_e,We)|0,B=Math.imul(_e,Ne),I=I+Math.imul(N,De)|0,m=m+Math.imul(N,Le)|0,m=m+Math.imul(D,De)|0,B=B+Math.imul(D,Le)|0,I=I+Math.imul(xe,rt)|0,m=m+Math.imul(xe,Ye)|0,m=m+Math.imul(Me,rt)|0,B=B+Math.imul(Me,Ye)|0,I=I+Math.imul(W,ht)|0,m=m+Math.imul(W,tt)|0,m=m+Math.imul(q,ht)|0,B=B+Math.imul(q,tt)|0,I=I+Math.imul(X,It)|0,m=m+Math.imul(X,ut)|0,m=m+Math.imul(se,It)|0,B=B+Math.imul(se,ut)|0,I=I+Math.imul(de,Tt)|0,m=m+Math.imul(de,at)|0,m=m+Math.imul($,Tt)|0,B=B+Math.imul($,at)|0;var St=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(St>>>26)|0,St&=67108863,I=Math.imul(Fe,We),m=Math.imul(Fe,Ne),m=m+Math.imul(Re,We)|0,B=Math.imul(Re,Ne),I=I+Math.imul(me,De)|0,m=m+Math.imul(me,Le)|0,m=m+Math.imul(_e,De)|0,B=B+Math.imul(_e,Le)|0,I=I+Math.imul(N,rt)|0,m=m+Math.imul(N,Ye)|0,m=m+Math.imul(D,rt)|0,B=B+Math.imul(D,Ye)|0,I=I+Math.imul(xe,ht)|0,m=m+Math.imul(xe,tt)|0,m=m+Math.imul(Me,ht)|0,B=B+Math.imul(Me,tt)|0,I=I+Math.imul(W,It)|0,m=m+Math.imul(W,ut)|0,m=m+Math.imul(q,It)|0,B=B+Math.imul(q,ut)|0,I=I+Math.imul(X,Tt)|0,m=m+Math.imul(X,at)|0,m=m+Math.imul(se,Tt)|0,B=B+Math.imul(se,at)|0,I=I+Math.imul(de,z)|0,m=m+Math.imul(de,J)|0,m=m+Math.imul($,z)|0,B=B+Math.imul($,J)|0;var bt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(bt>>>26)|0,bt&=67108863,I=Math.imul(Y,We),m=Math.imul(Y,Ne),m=m+Math.imul(re,We)|0,B=Math.imul(re,Ne),I=I+Math.imul(Fe,De)|0,m=m+Math.imul(Fe,Le)|0,m=m+Math.imul(Re,De)|0,B=B+Math.imul(Re,Le)|0,I=I+Math.imul(me,rt)|0,m=m+Math.imul(me,Ye)|0,m=m+Math.imul(_e,rt)|0,B=B+Math.imul(_e,Ye)|0,I=I+Math.imul(N,ht)|0,m=m+Math.imul(N,tt)|0,m=m+Math.imul(D,ht)|0,B=B+Math.imul(D,tt)|0,I=I+Math.imul(xe,It)|0,m=m+Math.imul(xe,ut)|0,m=m+Math.imul(Me,It)|0,B=B+Math.imul(Me,ut)|0,I=I+Math.imul(W,Tt)|0,m=m+Math.imul(W,at)|0,m=m+Math.imul(q,Tt)|0,B=B+Math.imul(q,at)|0,I=I+Math.imul(X,z)|0,m=m+Math.imul(X,J)|0,m=m+Math.imul(se,z)|0,B=B+Math.imul(se,J)|0,I=I+Math.imul(de,O)|0,m=m+Math.imul(de,te)|0,m=m+Math.imul($,O)|0,B=B+Math.imul($,te)|0;var xt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(xt>>>26)|0,xt&=67108863,I=Math.imul(be,We),m=Math.imul(be,Ne),m=m+Math.imul(ce,We)|0,B=Math.imul(ce,Ne),I=I+Math.imul(Y,De)|0,m=m+Math.imul(Y,Le)|0,m=m+Math.imul(re,De)|0,B=B+Math.imul(re,Le)|0,I=I+Math.imul(Fe,rt)|0,m=m+Math.imul(Fe,Ye)|0,m=m+Math.imul(Re,rt)|0,B=B+Math.imul(Re,Ye)|0,I=I+Math.imul(me,ht)|0,m=m+Math.imul(me,tt)|0,m=m+Math.imul(_e,ht)|0,B=B+Math.imul(_e,tt)|0,I=I+Math.imul(N,It)|0,m=m+Math.imul(N,ut)|0,m=m+Math.imul(D,It)|0,B=B+Math.imul(D,ut)|0,I=I+Math.imul(xe,Tt)|0,m=m+Math.imul(xe,at)|0,m=m+Math.imul(Me,Tt)|0,B=B+Math.imul(Me,at)|0,I=I+Math.imul(W,z)|0,m=m+Math.imul(W,J)|0,m=m+Math.imul(q,z)|0,B=B+Math.imul(q,J)|0,I=I+Math.imul(X,O)|0,m=m+Math.imul(X,te)|0,m=m+Math.imul(se,O)|0,B=B+Math.imul(se,te)|0,I=I+Math.imul(de,Ee)|0,m=m+Math.imul(de,Be)|0,m=m+Math.imul($,Ee)|0,B=B+Math.imul($,Be)|0;var wt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(wt>>>26)|0,wt&=67108863,I=Math.imul(ke,We),m=Math.imul(ke,Ne),m=m+Math.imul(Te,We)|0,B=Math.imul(Te,Ne),I=I+Math.imul(be,De)|0,m=m+Math.imul(be,Le)|0,m=m+Math.imul(ce,De)|0,B=B+Math.imul(ce,Le)|0,I=I+Math.imul(Y,rt)|0,m=m+Math.imul(Y,Ye)|0,m=m+Math.imul(re,rt)|0,B=B+Math.imul(re,Ye)|0,I=I+Math.imul(Fe,ht)|0,m=m+Math.imul(Fe,tt)|0,m=m+Math.imul(Re,ht)|0,B=B+Math.imul(Re,tt)|0,I=I+Math.imul(me,It)|0,m=m+Math.imul(me,ut)|0,m=m+Math.imul(_e,It)|0,B=B+Math.imul(_e,ut)|0,I=I+Math.imul(N,Tt)|0,m=m+Math.imul(N,at)|0,m=m+Math.imul(D,Tt)|0,B=B+Math.imul(D,at)|0,I=I+Math.imul(xe,z)|0,m=m+Math.imul(xe,J)|0,m=m+Math.imul(Me,z)|0,B=B+Math.imul(Me,J)|0,I=I+Math.imul(W,O)|0,m=m+Math.imul(W,te)|0,m=m+Math.imul(q,O)|0,B=B+Math.imul(q,te)|0,I=I+Math.imul(X,Ee)|0,m=m+Math.imul(X,Be)|0,m=m+Math.imul(se,Ee)|0,B=B+Math.imul(se,Be)|0,I=I+Math.imul(de,He)|0,m=m+Math.imul(de,$e)|0,m=m+Math.imul($,He)|0,B=B+Math.imul($,$e)|0;var st=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(ke,De),m=Math.imul(ke,Le),m=m+Math.imul(Te,De)|0,B=Math.imul(Te,Le),I=I+Math.imul(be,rt)|0,m=m+Math.imul(be,Ye)|0,m=m+Math.imul(ce,rt)|0,B=B+Math.imul(ce,Ye)|0,I=I+Math.imul(Y,ht)|0,m=m+Math.imul(Y,tt)|0,m=m+Math.imul(re,ht)|0,B=B+Math.imul(re,tt)|0,I=I+Math.imul(Fe,It)|0,m=m+Math.imul(Fe,ut)|0,m=m+Math.imul(Re,It)|0,B=B+Math.imul(Re,ut)|0,I=I+Math.imul(me,Tt)|0,m=m+Math.imul(me,at)|0,m=m+Math.imul(_e,Tt)|0,B=B+Math.imul(_e,at)|0,I=I+Math.imul(N,z)|0,m=m+Math.imul(N,J)|0,m=m+Math.imul(D,z)|0,B=B+Math.imul(D,J)|0,I=I+Math.imul(xe,O)|0,m=m+Math.imul(xe,te)|0,m=m+Math.imul(Me,O)|0,B=B+Math.imul(Me,te)|0,I=I+Math.imul(W,Ee)|0,m=m+Math.imul(W,Be)|0,m=m+Math.imul(q,Ee)|0,B=B+Math.imul(q,Be)|0,I=I+Math.imul(X,He)|0,m=m+Math.imul(X,$e)|0,m=m+Math.imul(se,He)|0,B=B+Math.imul(se,$e)|0;var ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ct>>>26)|0,ct&=67108863,I=Math.imul(ke,rt),m=Math.imul(ke,Ye),m=m+Math.imul(Te,rt)|0,B=Math.imul(Te,Ye),I=I+Math.imul(be,ht)|0,m=m+Math.imul(be,tt)|0,m=m+Math.imul(ce,ht)|0,B=B+Math.imul(ce,tt)|0,I=I+Math.imul(Y,It)|0,m=m+Math.imul(Y,ut)|0,m=m+Math.imul(re,It)|0,B=B+Math.imul(re,ut)|0,I=I+Math.imul(Fe,Tt)|0,m=m+Math.imul(Fe,at)|0,m=m+Math.imul(Re,Tt)|0,B=B+Math.imul(Re,at)|0,I=I+Math.imul(me,z)|0,m=m+Math.imul(me,J)|0,m=m+Math.imul(_e,z)|0,B=B+Math.imul(_e,J)|0,I=I+Math.imul(N,O)|0,m=m+Math.imul(N,te)|0,m=m+Math.imul(D,O)|0,B=B+Math.imul(D,te)|0,I=I+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Be)|0,m=m+Math.imul(Me,Ee)|0,B=B+Math.imul(Me,Be)|0,I=I+Math.imul(W,He)|0,m=m+Math.imul(W,$e)|0,m=m+Math.imul(q,He)|0,B=B+Math.imul(q,$e)|0;var nt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(nt>>>26)|0,nt&=67108863,I=Math.imul(ke,ht),m=Math.imul(ke,tt),m=m+Math.imul(Te,ht)|0,B=Math.imul(Te,tt),I=I+Math.imul(be,It)|0,m=m+Math.imul(be,ut)|0,m=m+Math.imul(ce,It)|0,B=B+Math.imul(ce,ut)|0,I=I+Math.imul(Y,Tt)|0,m=m+Math.imul(Y,at)|0,m=m+Math.imul(re,Tt)|0,B=B+Math.imul(re,at)|0,I=I+Math.imul(Fe,z)|0,m=m+Math.imul(Fe,J)|0,m=m+Math.imul(Re,z)|0,B=B+Math.imul(Re,J)|0,I=I+Math.imul(me,O)|0,m=m+Math.imul(me,te)|0,m=m+Math.imul(_e,O)|0,B=B+Math.imul(_e,te)|0,I=I+Math.imul(N,Ee)|0,m=m+Math.imul(N,Be)|0,m=m+Math.imul(D,Ee)|0,B=B+Math.imul(D,Be)|0,I=I+Math.imul(xe,He)|0,m=m+Math.imul(xe,$e)|0,m=m+Math.imul(Me,He)|0,B=B+Math.imul(Me,$e)|0;var lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(lt>>>26)|0,lt&=67108863,I=Math.imul(ke,It),m=Math.imul(ke,ut),m=m+Math.imul(Te,It)|0,B=Math.imul(Te,ut),I=I+Math.imul(be,Tt)|0,m=m+Math.imul(be,at)|0,m=m+Math.imul(ce,Tt)|0,B=B+Math.imul(ce,at)|0,I=I+Math.imul(Y,z)|0,m=m+Math.imul(Y,J)|0,m=m+Math.imul(re,z)|0,B=B+Math.imul(re,J)|0,I=I+Math.imul(Fe,O)|0,m=m+Math.imul(Fe,te)|0,m=m+Math.imul(Re,O)|0,B=B+Math.imul(Re,te)|0,I=I+Math.imul(me,Ee)|0,m=m+Math.imul(me,Be)|0,m=m+Math.imul(_e,Ee)|0,B=B+Math.imul(_e,Be)|0,I=I+Math.imul(N,He)|0,m=m+Math.imul(N,$e)|0,m=m+Math.imul(D,He)|0,B=B+Math.imul(D,$e)|0;var fe=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(fe>>>26)|0,fe&=67108863,I=Math.imul(ke,Tt),m=Math.imul(ke,at),m=m+Math.imul(Te,Tt)|0,B=Math.imul(Te,at),I=I+Math.imul(be,z)|0,m=m+Math.imul(be,J)|0,m=m+Math.imul(ce,z)|0,B=B+Math.imul(ce,J)|0,I=I+Math.imul(Y,O)|0,m=m+Math.imul(Y,te)|0,m=m+Math.imul(re,O)|0,B=B+Math.imul(re,te)|0,I=I+Math.imul(Fe,Ee)|0,m=m+Math.imul(Fe,Be)|0,m=m+Math.imul(Re,Ee)|0,B=B+Math.imul(Re,Be)|0,I=I+Math.imul(me,He)|0,m=m+Math.imul(me,$e)|0,m=m+Math.imul(_e,He)|0,B=B+Math.imul(_e,$e)|0;var R=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(R>>>26)|0,R&=67108863,I=Math.imul(ke,z),m=Math.imul(ke,J),m=m+Math.imul(Te,z)|0,B=Math.imul(Te,J),I=I+Math.imul(be,O)|0,m=m+Math.imul(be,te)|0,m=m+Math.imul(ce,O)|0,B=B+Math.imul(ce,te)|0,I=I+Math.imul(Y,Ee)|0,m=m+Math.imul(Y,Be)|0,m=m+Math.imul(re,Ee)|0,B=B+Math.imul(re,Be)|0,I=I+Math.imul(Fe,He)|0,m=m+Math.imul(Fe,$e)|0,m=m+Math.imul(Re,He)|0,B=B+Math.imul(Re,$e)|0;var F=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(F>>>26)|0,F&=67108863,I=Math.imul(ke,O),m=Math.imul(ke,te),m=m+Math.imul(Te,O)|0,B=Math.imul(Te,te),I=I+Math.imul(be,Ee)|0,m=m+Math.imul(be,Be)|0,m=m+Math.imul(ce,Ee)|0,B=B+Math.imul(ce,Be)|0,I=I+Math.imul(Y,He)|0,m=m+Math.imul(Y,$e)|0,m=m+Math.imul(re,He)|0,B=B+Math.imul(re,$e)|0;var H=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(H>>>26)|0,H&=67108863,I=Math.imul(ke,Ee),m=Math.imul(ke,Be),m=m+Math.imul(Te,Ee)|0,B=Math.imul(Te,Be),I=I+Math.imul(be,He)|0,m=m+Math.imul(be,$e)|0,m=m+Math.imul(ce,He)|0,B=B+Math.imul(ce,$e)|0;var ae=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ae>>>26)|0,ae&=67108863,I=Math.imul(ke,He),m=Math.imul(ke,$e),m=m+Math.imul(Te,He)|0,B=Math.imul(Te,$e);var oe=(C+I|0)+((m&8191)<<13)|0;return C=(B+(m>>>13)|0)+(oe>>>26)|0,oe&=67108863,E[0]=Lt,E[1]=ot,E[2]=vt,E[3]=yt,E[4]=Ct,E[5]=St,E[6]=bt,E[7]=xt,E[8]=wt,E[9]=st,E[10]=ct,E[11]=nt,E[12]=lt,E[13]=fe,E[14]=R,E[15]=F,E[16]=H,E[17]=ae,E[18]=oe,C!==0&&(E[19]=C,w.length++),w};Math.imul||(k=x);function M(y,f,g){g.negative=f.negative^y.negative,g.length=y.length+f.length;for(var w=0,A=0,T=0;T>>26)|0,A+=E>>>26,E&=67108863}g.words[T]=C,w=E,E=A}return w!==0?g.words[T]=w:g.length--,g._strip()}function P(y,f,g){return M(y,f,g)}i.prototype.mulTo=function(f,g){var w,A=this.length+f.length;return this.length===10&&f.length===10?w=k(this,f,g):A<63?w=x(this,f,g):A<1024?w=M(this,f,g):w=P(this,f,g),w},i.prototype.mul=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},i.prototype.mulf=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),P(this,f,g)},i.prototype.imul=function(f){return this.clone().mulTo(f,this)},i.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var w=0,A=0;A>=26,w+=T/67108864|0,w+=E>>>26,this.words[A]=E&67108863}return w!==0&&(this.words[A]=w,this.length++),g?this.ineg():this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var g=S(f);if(g.length===0)return new i(1);for(var w=this,A=0;A=0);var g=f%26,w=(f-g)/26,A=67108863>>>26-g<<26-g,T;if(g!==0){var E=0;for(T=0;T>>26-g}E&&(this.words[T]=E,this.length++)}if(w!==0){for(T=this.length-1;T>=0;T--)this.words[T+w]=this.words[T];for(T=0;T=0);var A;g?A=(g-g%26)/26:A=0;var T=f%26,E=Math.min((f-T)/26,this.length),C=67108863^67108863>>>T<E)for(this.length-=E,m=0;m=0&&(B!==0||m>=A);m--){var ne=this.words[m]|0;this.words[m]=B<<26-T|ne>>>T,B=ne&C}return I&&B!==0&&(I.words[I.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(f,g,w){return n(this.negative===0),this.iushrn(f,g,w)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,w=(f-g)/26,A=1<=0);var g=f%26,w=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(g!==0&&w++,this.length=Math.min(w,this.length),g!==0){var A=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(I/67108864|0),this.words[T+w]=E&67108863}for(;T>26,this.words[T+w]=E&67108863;if(C===0)return this._strip();for(n(C===-1),C=0,T=0;T>26,this.words[T]=E&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(f,g){var w=this.length-f.length,A=this.clone(),T=f,E=T.words[T.length-1]|0,C=this._countBits(E);w=26-C,w!==0&&(T=T.ushln(w),A.iushln(w),E=T.words[T.length-1]|0);var I=A.length-T.length,m;if(g!=="mod"){m=new i(null),m.length=I+1,m.words=new Array(m.length);for(var B=0;B=0;de--){var $=(A.words[T.length+de]|0)*67108864+(A.words[T.length+de-1]|0);for($=Math.min($/E|0,67108863),A._ishlnsubmul(T,$,de);A.negative!==0;)$--,A.negative=0,A._ishlnsubmul(T,1,de),A.isZero()||(A.negative^=1);m&&(m.words[de]=$)}return m&&m._strip(),A._strip(),g!=="div"&&w!==0&&A.iushrn(w),{div:m||null,mod:A}},i.prototype.divmod=function(f,g,w){if(n(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var A,T,E;return this.negative!==0&&f.negative===0?(E=this.neg().divmod(f,g),g!=="mod"&&(A=E.div.neg()),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.iadd(f)),{div:A,mod:T}):this.negative===0&&f.negative!==0?(E=this.divmod(f.neg(),g),g!=="mod"&&(A=E.div.neg()),{div:A,mod:E.mod}):this.negative&f.negative?(E=this.neg().divmod(f.neg(),g),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.isub(f)),{div:E.div,mod:T}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modrn(f.words[0]))}:this._wordDiv(f,g)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var w=g.div.negative!==0?g.mod.isub(f):g.mod,A=f.ushrn(1),T=f.andln(1),E=w.cmp(A);return E<0||T===1&&E===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=(1<<26)%f,A=0,T=this.length-1;T>=0;T--)A=(w*A+(this.words[T]|0))%f;return g?-A:A},i.prototype.modn=function(f){return this.modrn(f)},i.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+w*67108864;this.words[A]=T/f|0,w=T%f}return this._strip(),g?this.ineg():this},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=new i(0),C=new i(1),I=0;g.isEven()&&w.isEven();)g.iushrn(1),w.iushrn(1),++I;for(var m=w.clone(),B=g.clone();!g.isZero();){for(var ne=0,de=1;!(g.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(g.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(m),T.isub(B)),A.iushrn(1),T.iushrn(1);for(var $=0,he=1;!(w.words[0]&he)&&$<26;++$,he<<=1);if($>0)for(w.iushrn($);$-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(B)),E.iushrn(1),C.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(E),T.isub(C)):(w.isub(g),E.isub(A),C.isub(T))}return{a:E,b:C,gcd:w.iushln(I)}},i.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=w.clone();g.cmpn(1)>0&&w.cmpn(1)>0;){for(var C=0,I=1;!(g.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(g.iushrn(C);C-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);for(var m=0,B=1;!(w.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(w.iushrn(m);m-- >0;)T.isOdd()&&T.iadd(E),T.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(T)):(w.isub(g),T.isub(A))}var ne;return g.cmpn(1)===0?ne=A:ne=T,ne.cmpn(0)<0&&ne.iadd(f),ne},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),w=f.clone();g.negative=0,w.negative=0;for(var A=0;g.isEven()&&w.isEven();A++)g.iushrn(1),w.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;w.isEven();)w.iushrn(1);var T=g.cmp(w);if(T<0){var E=g;g=w,w=E}else if(T===0||w.cmpn(1)===0)break;g.isub(w)}while(!0);return w.iushln(A)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,w=(f-g)/26,A=1<>>26,C&=67108863,this.words[E]=C}return T!==0&&(this.words[E]=T,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var w;if(this.length>1)w=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var A=this.words[0]|0;w=A===f?0:Af.length)return 1;if(this.length=0;w--){var A=this.words[w]|0,T=f.words[w]|0;if(A!==T){AT&&(g=1);break}}return g},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new U(f)},i.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function j(y,f){this.name=y,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,w;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),w=g.bitLength();while(w>this.n);var A=w0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function V(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(V,j),V.prototype.split=function(f,g){for(var w=4194303,A=Math.min(f.length,9),T=0;T>>22,E=C}E>>>=22,f.words[T-10]=E,E===0&&f.length>10?f.length-=10:f.length-=9},V.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,w=0;w>>=26,f.words[w]=T,g=A}return g!==0&&(f.words[f.length++]=g),f},i._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new V;else if(f==="p224")g=new K;else if(f==="p192")g=new Z;else if(f==="p25519")g=new ue;else throw new Error("Unknown prime "+f);return L[f]=g,g};function U(y){if(typeof y=="string"){var f=i._prime(y);this.m=f.p,this.prime=f}else n(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}U.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},U.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},U.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},U.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},U.prototype.add=function(f,g){this._verify2(f,g);var w=f.add(g);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},U.prototype.iadd=function(f,g){this._verify2(f,g);var w=f.iadd(g);return w.cmp(this.m)>=0&&w.isub(this.m),w},U.prototype.sub=function(f,g){this._verify2(f,g);var w=f.sub(g);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},U.prototype.isub=function(f,g){this._verify2(f,g);var w=f.isub(g);return w.cmpn(0)<0&&w.iadd(this.m),w},U.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},U.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},U.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},U.prototype.isqr=function(f){return this.imul(f,f.clone())},U.prototype.sqr=function(f){return this.mul(f,f)},U.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var w=this.m.add(new i(1)).iushrn(2);return this.pow(f,w)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var E=new i(1).toRed(this),C=E.redNeg(),I=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new i(2*m*m).toRed(this);this.pow(m,I).cmp(C)!==0;)m.redIAdd(C);for(var B=this.pow(m,A),ne=this.pow(f,A.addn(1).iushrn(1)),de=this.pow(f,A),$=T;de.cmp(E)!==0;){for(var he=de,X=0;he.cmp(E)!==0;X++)he=he.redSqr();n(X<$);var se=this.pow(B,new i(1).iushln($-X-1));ne=ne.redMul(se),B=se.redSqr(),de=de.redMul(B),$=X}return ne},U.prototype.invm=function(f){var g=f._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},U.prototype.pow=function(f,g){if(g.isZero())return new i(1).toRed(this);if(g.cmpn(1)===0)return f.clone();var w=4,A=new Array(1<=0;T--){for(var B=g.words[T],ne=m-1;ne>=0;ne--){var de=B>>ne&1;if(E!==A[0]&&(E=this.sqr(E)),de===0&&C===0){I=0;continue}C<<=1,C|=de,I++,!(I!==w&&(T!==0||ne!==0))&&(E=this.mul(E,A[C]),I=0,C=0)}m=26}return E},U.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},U.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},i.mont=function(f){return new _(f)};function _(y){U.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(_,U),_.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},_.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},_.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var w=f.imul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new i(0)._forceRed(this);var w=f.mul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(e,Ze)}(Uj)),sp}var _i={},Ny={},Ly={},Dy={},Uy,mx;function kw(){if(mx)return Uy;mx=1;var e=Oe,t=e.Buffer,r={},n;for(n in e)e.hasOwnProperty(n)&&(n==="SlowBuffer"||n==="Buffer"||(r[n]=e[n]));var o=r.Buffer={};for(n in t)t.hasOwnProperty(n)&&(n==="allocUnsafe"||n==="allocUnsafeSlow"||(o[n]=t[n]));if(r.Buffer.prototype=t.prototype,(!o.from||o.from===Uint8Array.from)&&(o.from=function(i,a,s){if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&typeof i.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return t(i,a,s)}),o.alloc||(o.alloc=function(i,a,s){if(typeof i!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var l=t(i);return!a||a.length===0?l.fill(0):typeof s=="string"?l.fill(a,s):l.fill(a),l}),!r.kStringMaxLength)try{r.kStringMaxLength=_t.binding("buffer").kStringMaxLength}catch{}return r.constants||(r.constants={MAX_LENGTH:r.kMaxLength},r.kStringMaxLength&&(r.constants.MAX_STRING_LENGTH=r.kStringMaxLength)),Uy=r,Uy}var jy={},vx;function Aw(){if(vx)return jy;vx=1;const e=Ht();function t(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}jy.Reporter=t,t.prototype.isError=function(o){return o instanceof r},t.prototype.save=function(){const o=this._reporterState;return{obj:o.obj,pathLen:o.path.length}},t.prototype.restore=function(o){const i=this._reporterState;i.obj=o.obj,i.path=i.path.slice(0,o.pathLen)},t.prototype.enterKey=function(o){return this._reporterState.path.push(o)},t.prototype.exitKey=function(o){const i=this._reporterState;i.path=i.path.slice(0,o-1)},t.prototype.leaveKey=function(o,i,a){const s=this._reporterState;this.exitKey(o),s.obj!==null&&(s.obj[i]=a)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){const o=this._reporterState,i=o.obj;return o.obj={},i},t.prototype.leaveObject=function(o){const i=this._reporterState,a=i.obj;return i.obj=o,a},t.prototype.error=function(o){let i;const a=this._reporterState,s=o instanceof r;if(s?i=o:i=new r(a.path.map(function(l){return"["+JSON.stringify(l)+"]"}).join(""),o.message||o,o.stack),!a.options.partial)throw i;return s||a.errors.push(i),i},t.prototype.wrapResult=function(o){const i=this._reporterState;return i.options.partial?{result:this.isError(o)?null:o,errors:i.errors}:o};function r(n,o){this.path=n,this.rethrow(o)}return e(r,Error),r.prototype.rethrow=function(o){if(this.message=o+" 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},jy}var $h={},yx;function ud(){if(yx)return $h;yx=1;const e=Ht(),t=Aw().Reporter,r=kw().Buffer;function n(i,a){if(t.call(this,a),!r.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}e(n,t),$h.DecoderBuffer=n,n.isDecoderBuffer=function(a){return a instanceof n?!0:typeof a=="object"&&r.isBuffer(a.base)&&a.constructor.name==="DecoderBuffer"&&typeof a.offset=="number"&&typeof a.length=="number"&&typeof a.save=="function"&&typeof a.restore=="function"&&typeof a.isEmpty=="function"&&typeof a.readUInt8=="function"&&typeof a.skip=="function"&&typeof a.raw=="function"},n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(a){const s=new n(this.base);return s.offset=a.offset,s.length=this.offset,this.offset=a.offset,t.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");const l=new n(this.base);return l._reporterState=this._reporterState,l.offset=this.offset,l.length=this.offset+a,this.offset+=a,l},n.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)};function o(i,a){if(Array.isArray(i))this.length=0,this.value=i.map(function(s){return o.isEncoderBuffer(s)||(s=new o(s,a)),this.length+=s.length,s},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return a.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=r.byteLength(i);else if(r.isBuffer(i))this.value=i,this.length=i.length;else return a.error("Unsupported type: "+typeof i)}return $h.EncoderBuffer=o,o.isEncoderBuffer=function(a){return a instanceof o?!0:typeof a=="object"&&a.constructor.name==="EncoderBuffer"&&typeof a.length=="number"&&typeof a.join=="function"},o.prototype.join=function(a,s){return a||(a=r.alloc(this.length)),s||(s=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(l){l.join(a,s),s+=l.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},$h}var Fy,bx;function Mw(){if(bx)return Fy;bx=1;const e=Aw().Reporter,t=ud().EncoderBuffer,r=ud().DecoderBuffer,n=Ri(),o=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o),a=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function s(u,c,h){const d={};this._baseState=d,d.name=h,d.enc=u,d.parent=c||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())}Fy=s;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return s.prototype.clone=function(){const c=this._baseState,h={};l.forEach(function(p){h[p]=c[p]});const d=new this.constructor(h.parent);return d._baseState=h,d},s.prototype._wrap=function(){const c=this._baseState;i.forEach(function(h){this[h]=function(){const p=new this.constructor(this);return c.children.push(p),p[h].apply(p,arguments)}},this)},s.prototype._init=function(c){const h=this._baseState;n(h.parent===null),c.call(this),h.children=h.children.filter(function(d){return d._baseState.parent===this},this),n.equal(h.children.length,1,"Root node can have only one child")},s.prototype._useArgs=function(c){const h=this._baseState,d=c.filter(function(p){return p instanceof this.constructor},this);c=c.filter(function(p){return!(p instanceof this.constructor)},this),d.length!==0&&(n(h.children===null),h.children=d,d.forEach(function(p){p._baseState.parent=this},this)),c.length!==0&&(n(h.args===null),h.args=c,h.reverseArgs=c.map(function(p){if(typeof p!="object"||p.constructor!==Object)return p;const v={};return Object.keys(p).forEach(function(b){b==(b|0)&&(b|=0);const S=p[b];v[S]=b}),v}))},a.forEach(function(u){s.prototype[u]=function(){const h=this._baseState;throw new Error(u+" not implemented for encoding: "+h.enc)}}),o.forEach(function(u){s.prototype[u]=function(){const h=this._baseState,d=Array.prototype.slice.call(arguments);return n(h.tag===null),h.tag=u,this._useArgs(d),this}}),s.prototype.use=function(c){n(c);const h=this._baseState;return n(h.use===null),h.use=c,this},s.prototype.optional=function(){const c=this._baseState;return c.optional=!0,this},s.prototype.def=function(c){const h=this._baseState;return n(h.default===null),h.default=c,h.optional=!0,this},s.prototype.explicit=function(c){const h=this._baseState;return n(h.explicit===null&&h.implicit===null),h.explicit=c,this},s.prototype.implicit=function(c){const h=this._baseState;return n(h.explicit===null&&h.implicit===null),h.implicit=c,this},s.prototype.obj=function(){const c=this._baseState,h=Array.prototype.slice.call(arguments);return c.obj=!0,h.length!==0&&this._useArgs(h),this},s.prototype.key=function(c){const h=this._baseState;return n(h.key===null),h.key=c,this},s.prototype.any=function(){const c=this._baseState;return c.any=!0,this},s.prototype.choice=function(c){const h=this._baseState;return n(h.choice===null),h.choice=c,this._useArgs(Object.keys(c).map(function(d){return c[d]})),this},s.prototype.contains=function(c){const h=this._baseState;return n(h.use===null),h.contains=c,this},s.prototype._decode=function(c,h){const d=this._baseState;if(d.parent===null)return c.wrapResult(d.children[0]._decode(c,h));let p=d.default,v=!0,b=null;if(d.key!==null&&(b=c.enterKey(d.key)),d.optional){let x=null;if(d.explicit!==null?x=d.explicit:d.implicit!==null?x=d.implicit:d.tag!==null&&(x=d.tag),x===null&&!d.any){const k=c.save();try{d.choice===null?this._decodeGeneric(d.tag,c,h):this._decodeChoice(c,h),v=!0}catch{v=!1}c.restore(k)}else if(v=this._peekTag(c,x,d.any),c.isError(v))return v}let S;if(d.obj&&v&&(S=c.enterObject()),v){if(d.explicit!==null){const k=this._decodeTag(c,d.explicit);if(c.isError(k))return k;c=k}const x=c.offset;if(d.use===null&&d.choice===null){let k;d.any&&(k=c.save());const M=this._decodeTag(c,d.implicit!==null?d.implicit:d.tag,d.any);if(c.isError(M))return M;d.any?p=c.raw(k):c=M}if(h&&h.track&&d.tag!==null&&h.track(c.path(),x,c.length,"tagged"),h&&h.track&&d.tag!==null&&h.track(c.path(),c.offset,c.length,"content"),d.any||(d.choice===null?p=this._decodeGeneric(d.tag,c,h):p=this._decodeChoice(c,h)),c.isError(p))return p;if(!d.any&&d.choice===null&&d.children!==null&&d.children.forEach(function(M){M._decode(c,h)}),d.contains&&(d.tag==="octstr"||d.tag==="bitstr")){const k=new r(p);p=this._getUse(d.contains,c._reporterState.obj)._decode(k,h)}}return d.obj&&v&&(p=c.leaveObject(S)),d.key!==null&&(p!==null||v===!0)?c.leaveKey(b,d.key,p):b!==null&&c.exitKey(b),p},s.prototype._decodeGeneric=function(c,h,d){const p=this._baseState;return c==="seq"||c==="set"?null:c==="seqof"||c==="setof"?this._decodeList(h,c,p.args[0],d):/str$/.test(c)?this._decodeStr(h,c,d):c==="objid"&&p.args?this._decodeObjid(h,p.args[0],p.args[1],d):c==="objid"?this._decodeObjid(h,null,null,d):c==="gentime"||c==="utctime"?this._decodeTime(h,c,d):c==="null_"?this._decodeNull(h,d):c==="bool"?this._decodeBool(h,d):c==="objDesc"?this._decodeStr(h,c,d):c==="int"||c==="enum"?this._decodeInt(h,p.args&&p.args[0],d):p.use!==null?this._getUse(p.use,h._reporterState.obj)._decode(h,d):h.error("unknown tag: "+c)},s.prototype._getUse=function(c,h){const d=this._baseState;return d.useDecoder=this._use(c,h),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},s.prototype._decodeChoice=function(c,h){const d=this._baseState;let p=null,v=!1;return Object.keys(d.choice).some(function(b){const S=c.save(),x=d.choice[b];try{const k=x._decode(c,h);if(c.isError(k))return!1;p={type:b,value:k},v=!0}catch{return c.restore(S),!1}return!0},this),v?p:c.error("Choice not matched")},s.prototype._createEncoderBuffer=function(c){return new t(c,this.reporter)},s.prototype._encode=function(c,h,d){const p=this._baseState;if(p.default!==null&&p.default===c)return;const v=this._encodeValue(c,h,d);if(v!==void 0&&!this._skipDefault(v,h,d))return v},s.prototype._encodeValue=function(c,h,d){const p=this._baseState;if(p.parent===null)return p.children[0]._encode(c,h||new e);let v=null;if(this.reporter=h,p.optional&&c===void 0)if(p.default!==null)c=p.default;else return;let b=null,S=!1;if(p.any)v=this._createEncoderBuffer(c);else if(p.choice)v=this._encodeChoice(c,h);else if(p.contains)b=this._getUse(p.contains,d)._encode(c,h),S=!0;else if(p.children)b=p.children.map(function(x){if(x._baseState.tag==="null_")return x._encode(null,h,c);if(x._baseState.key===null)return h.error("Child should have a key");const k=h.enterKey(x._baseState.key);if(typeof c!="object")return h.error("Child expected, but input is not object");const M=x._encode(c[x._baseState.key],h,c);return h.leaveKey(k),M},this).filter(function(x){return x}),b=this._createEncoderBuffer(b);else if(p.tag==="seqof"||p.tag==="setof"){if(!(p.args&&p.args.length===1))return h.error("Too many args for : "+p.tag);if(!Array.isArray(c))return h.error("seqof/setof, but data is not Array");const x=this.clone();x._baseState.implicit=null,b=this._createEncoderBuffer(c.map(function(k){const M=this._baseState;return this._getUse(M.args[0],c)._encode(k,h)},x))}else p.use!==null?v=this._getUse(p.use,d)._encode(c,h):(b=this._encodePrimitive(p.tag,c),S=!0);if(!p.any&&p.choice===null){const x=p.implicit!==null?p.implicit:p.tag,k=p.implicit===null?"universal":"context";x===null?p.use===null&&h.error("Tag could be omitted only for .use()"):p.use===null&&(v=this._encodeComposite(x,S,k,b))}return p.explicit!==null&&(v=this._encodeComposite(p.explicit,!1,"context",v)),v},s.prototype._encodeChoice=function(c,h){const d=this._baseState,p=d.choice[c.type];return p||n(!1,c.type+" not found in "+JSON.stringify(Object.keys(d.choice))),p._encode(c.value,h)},s.prototype._encodePrimitive=function(c,h){const d=this._baseState;if(/str$/.test(c))return this._encodeStr(h,c);if(c==="objid"&&d.args)return this._encodeObjid(h,d.reverseArgs[0],d.args[1]);if(c==="objid")return this._encodeObjid(h,null,null);if(c==="gentime"||c==="utctime")return this._encodeTime(h,c);if(c==="null_")return this._encodeNull();if(c==="int"||c==="enum")return this._encodeInt(h,d.args&&d.reverseArgs[0]);if(c==="bool")return this._encodeBool(h);if(c==="objDesc")return this._encodeStr(h,c);throw new Error("Unsupported tag: "+c)},s.prototype._isNumstr=function(c){return/^[0-9 ]*$/.test(c)},s.prototype._isPrintstr=function(c){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(c)},Fy}var zy={},wx;function Iw(){return wx||(wx=1,function(e){function t(r){const n={};return Object.keys(r).forEach(function(o){(o|0)==o&&(o=o|0);const i=r[o];n[i]=o}),n}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.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"},e.tagByName=t(e.tag)}(zy)),zy}var $y,_x;function fM(){if(_x)return $y;_x=1;const e=Ht(),t=kw().Buffer,r=Mw(),n=Iw();function o(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new i,this.tree._init(l.body)}$y=o,o.prototype.encode=function(u,c){return this.tree._encode(u,c).join()};function i(l){r.call(this,"der",l)}e(i,r),i.prototype._encodeComposite=function(u,c,h,d){const p=s(u,c,h,this.reporter);if(d.length<128){const S=t.alloc(2);return S[0]=p,S[1]=d.length,this._createEncoderBuffer([S,d])}let v=1;for(let S=d.length;S>=256;S>>=8)v++;const b=t.alloc(1+1+v);b[0]=p,b[1]=128|v;for(let S=1+v,x=d.length;x>0;S--,x>>=8)b[S]=x&255;return this._createEncoderBuffer([b,d])},i.prototype._encodeStr=function(u,c){if(c==="bitstr")return this._createEncoderBuffer([u.unused|0,u.data]);if(c==="bmpstr"){const h=t.alloc(u.length*2);for(let d=0;d=40)return this.reporter.error("Second objid identifier OOB");u.splice(0,2,u[0]*40+u[1])}let d=0;for(let b=0;b=128;S>>=7)d++}const p=t.alloc(d);let v=p.length-1;for(let b=u.length-1;b>=0;b--){let S=u[b];for(p[v--]=S&127;(S>>=7)>0;)p[v--]=128|S&127}return this._createEncoderBuffer(p)};function a(l){return l<10?"0"+l:l}i.prototype._encodeTime=function(u,c){let h;const d=new Date(u);return c==="gentime"?h=[a(d.getUTCFullYear()),a(d.getUTCMonth()+1),a(d.getUTCDate()),a(d.getUTCHours()),a(d.getUTCMinutes()),a(d.getUTCSeconds()),"Z"].join(""):c==="utctime"?h=[a(d.getUTCFullYear()%100),a(d.getUTCMonth()+1),a(d.getUTCDate()),a(d.getUTCHours()),a(d.getUTCMinutes()),a(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+c+" time is not supported yet"),this._encodeStr(h,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(u,c){if(typeof u=="string"){if(!c)return this.reporter.error("String int or enum given, but no values map");if(!c.hasOwnProperty(u))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(u));u=c[u]}if(typeof u!="number"&&!t.isBuffer(u)){const p=u.toArray();!u.sign&&p[0]&128&&p.unshift(0),u=t.from(p)}if(t.isBuffer(u)){let p=u.length;u.length===0&&p++;const v=t.alloc(p);return u.copy(v),u.length===0&&(v[0]=0),this._createEncoderBuffer(v)}if(u<128)return this._createEncoderBuffer(u);if(u<256)return this._createEncoderBuffer([0,u]);let h=1;for(let p=u;p>=256;p>>=8)h++;const d=new Array(h);for(let p=d.length-1;p>=0;p--)d[p]=u&255,u>>=8;return d[0]&128&&d.unshift(0),this._createEncoderBuffer(t.from(d))},i.prototype._encodeBool=function(u){return this._createEncoderBuffer(u?255:0)},i.prototype._use=function(u,c){return typeof u=="function"&&(u=u(c)),u._getEncoder("der").tree},i.prototype._skipDefault=function(u,c,h){const d=this._baseState;let p;if(d.default===null)return!1;const v=u.join();if(d.defaultBuffer===void 0&&(d.defaultBuffer=this._encodeValue(d.default,c,h).join()),v.length!==d.defaultBuffer.length)return!1;for(p=0;p=31?h.error("Multi-octet tag encoding unsupported"):(u||(d|=32),d|=n.tagClassByName[c||"universal"]<<6,d)}return $y}var qy,xx;function jj(){if(xx)return qy;xx=1;const e=Ht(),t=fM();function r(n){t.call(this,n),this.enc="pem"}return e(r,t),qy=r,r.prototype.encode=function(o,i){const s=t.prototype.encode.call(this,o).toString("base64"),l=["-----BEGIN "+i.label+"-----"];for(let u=0;u>6],p=(h&32)===0;if((h&31)===31){let b=h;for(h=0;(b&128)===128;){if(b=u.readUInt8(c),u.isError(b))return b;h<<=7,h|=b&127}}else h&=31;const v=o.tag[h];return{cls:d,primitive:p,tag:h,tagStr:v}}function l(u,c,h){let d=u.readUInt8(h);if(u.isError(d))return d;if(!c&&d===128)return null;if(!(d&128))return d;const p=d&127;if(p>4)return u.error("length octect is too long");d=0;for(let v=0;v0&&k.ishrn(M),k}function p(S,x){S=d(S,x),S=S.mod(x);var k=e.from(S.toArray());if(k.length=c)throw new Error("invalid sig")}return Xy=i,Xy}var Jy,Dx;function Yj(){if(Dx)return Jy;Dx=1;var e=Kt().Buffer,t=$d(),r=jA(),n=Ht(),o=Zj(),i=Gj(),a=VA;Object.keys(a).forEach(function(h){a[h].id=e.from(a[h].id,"hex"),a[h.toLowerCase()]=a[h]});function s(h){r.Writable.call(this);var d=a[h];if(!d)throw new Error("Unknown message digest");this._hashType=d.hash,this._hash=t(d.hash),this._tag=d.id,this._signType=d.sign}n(s,r.Writable),s.prototype._write=function(d,p,v){this._hash.update(d),v()},s.prototype.update=function(d,p){return typeof d=="string"&&(d=e.from(d,p)),this._hash.update(d),this},s.prototype.sign=function(d,p){this.end();var v=this._hash.digest(),b=o(v,d,this._hashType,this._signType,this._tag);return p?b.toString(p):b};function l(h){r.Writable.call(this);var d=a[h];if(!d)throw new Error("Unknown message digest");this._hash=t(d.hash),this._tag=d.id,this._signType=d.sign}n(l,r.Writable),l.prototype._write=function(d,p,v){this._hash.update(d),v()},l.prototype.update=function(d,p){return typeof d=="string"&&(d=e.from(d,p)),this._hash.update(d),this},l.prototype.verify=function(d,p,v){typeof p=="string"&&(p=e.from(p,v)),this.end();var b=this._hash.digest();return i(p,b,d,this._signType,this._tag)};function u(h){return new s(h)}function c(h){return new l(h)}return Jy={Sign:u,Verify:c,createSign:u,createVerify:c},Jy}var e2,Ux;function Qj(){if(Ux)return e2;Ux=1;var e=Ew(),t=cn();e2=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(i){this.curveType=r[i],this.curveType||(this.curveType={name:i}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,a){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,a)},n.prototype.computeSecret=function(i,a,s){a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a));var l=this.curve.keyFromPublic(i).getPublic(),u=l.mul(this.keys.getPrivate()).getX();return o(u,s,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,a){var s=this.keys.getPublic(a==="compressed",!0);return a==="hybrid"&&(s[s.length-1]%2?s[0]=7:s[0]=6),o(s,i)},n.prototype.getPrivateKey=function(i){return o(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,a){return a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,a){a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a));var s=new t(i);return s=s.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(s),this};function o(i,a,s){Array.isArray(i)||(i=i.toArray());var l=new Oe.Buffer(i);if(s&&l.length=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return b?s(k,x):a(k,x)};function u(d,p){var v=d.modulus.byteLength(),b=p.length,S=r("sha1").update(l.alloc(0)).digest(),x=S.length,k=2*x;if(b>v-k-2)throw new Error("message too long");var M=l.alloc(v-b-k-2),P=v-x-1,L=t(x),j=o(l.concat([S,M,l.alloc(1,1),p],P),n(L,P)),V=o(L,n(j,x));return new i(l.concat([l.alloc(1),V,j],v))}function c(d,p,v){var b=p.length,S=d.modulus.byteLength();if(b>S-11)throw new Error("message too long");var x;return v?x=l.alloc(S-b-3,255):x=h(S-b-3),new i(l.concat([l.from([0,v?1:2]),x,l.alloc(1),p],S))}function h(d){for(var p=l.allocUnsafe(d),v=0,b=t(d*2),S=0,x;vx||new n(p).cmp(S.modulus)>=0)throw new Error("decryption error");var k;v?k=a(new n(p),S):k=o(p,S);var M=s.alloc(x-k.length);if(k=s.concat([M,k],x),b===4)return l(S,k);if(b===1)return u(S,k,v);if(b===3)return k;throw new Error("unknown padding")};function l(h,d){var p=h.modulus.byteLength(),v=i("sha1").update(s.alloc(0)).digest(),b=v.length;if(d[0]!==0)throw new Error("decryption error");var S=d.slice(1,b+1),x=d.slice(b+1),k=r(S,t(x,b)),M=r(x,t(k,p-b-1));if(c(v,M.slice(0,b)))throw new Error("decryption error");for(var P=b;M[P]===0;)P++;if(M[P++]!==1)throw new Error("decryption error");return M.slice(P)}function u(h,d,p){for(var v=d.slice(0,2),b=2,S=0;d[b++]!==0;)if(b>=d.length){S++;break}var x=d.slice(2,b-1);if((v.toString("hex")!=="0002"&&!p||v.toString("hex")!=="0001"&&p)&&S++,x.length<8&&S++,S)throw new Error("decryption error");return d.slice(b)}function c(h,d){h=s.from(h),d=s.from(d);var p=0,v=h.length;h.length!==d.length&&(p++,v=Math.min(h.length,d.length));for(var b=-1;++ba||d<0)throw new TypeError("offset must be a uint32");if(d>o||d>p)throw new RangeError("offset out of range")}function l(d,p,v){if(typeof d!="number"||d!==d)throw new TypeError("size must be a number");if(d>a||d<0)throw new TypeError("size must be a uint32");if(d+p>v||d>o)throw new RangeError("buffer too small")}i&&i.getRandomValues||!_t.browser?(Wl.randomFill=u,Wl.randomFillSync=h):(Wl.randomFill=e,Wl.randomFillSync=e);function u(d,p,v,b){if(!n.isBuffer(d)&&!(d instanceof Ze.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof p=="function")b=p,p=0,v=d.length;else if(typeof v=="function")b=v,v=d.length-p;else if(typeof b!="function")throw new TypeError('"cb" argument must be a function');return s(p,d.length),l(v,p,d.length),c(d,p,v,b)}function c(d,p,v,b){if(_t.browser){var S=d.buffer,x=new Uint8Array(S,p,v);if(i.getRandomValues(x),b){_t.nextTick(function(){b(null,d)});return}return d}if(b){r(v,function(M,P){if(M)return b(M);P.copy(d,p),b(null,d)});return}var k=r(v);return k.copy(d,p),d}function h(d,p,v){if(typeof p>"u"&&(p=0),!n.isBuffer(d)&&!(d instanceof Ze.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return s(p,d.length),v===void 0&&(v=d.length-p),l(v,p,d.length),c(d,p,v)}return Wl}var Hx;function wM(){if(Hx)return zt;Hx=1,zt.randomBytes=zt.rng=zt.pseudoRandomBytes=zt.prng=tc(),zt.createHash=zt.Hash=$d(),zt.createHmac=zt.Hmac=WA();var e=CU(),t=Object.keys(e),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);zt.getHashes=function(){return r};var n=YA();zt.pbkdf2=n.pbkdf2,zt.pbkdf2Sync=n.pbkdf2Sync;var o=qU();zt.Cipher=o.Cipher,zt.createCipher=o.createCipher,zt.Cipheriv=o.Cipheriv,zt.createCipheriv=o.createCipheriv,zt.Decipher=o.Decipher,zt.createDecipher=o.createDecipher,zt.Decipheriv=o.Decipheriv,zt.createDecipheriv=o.createDecipheriv,zt.getCiphers=o.getCiphers,zt.listCiphers=o.listCiphers;var i=rj();zt.DiffieHellmanGroup=i.DiffieHellmanGroup,zt.createDiffieHellmanGroup=i.createDiffieHellmanGroup,zt.getDiffieHellman=i.getDiffieHellman,zt.createDiffieHellman=i.createDiffieHellman,zt.DiffieHellman=i.DiffieHellman;var a=Yj();zt.createSign=a.createSign,zt.Sign=a.Sign,zt.createVerify=a.createVerify,zt.Verify=a.Verify,zt.createECDH=Qj();var s=eF();zt.publicEncrypt=s.publicEncrypt,zt.privateEncrypt=s.privateEncrypt,zt.publicDecrypt=s.publicDecrypt,zt.privateDecrypt=s.privateDecrypt;var l=tF();return zt.randomFill=l.randomFill,zt.randomFillSync=l.randomFillSync,zt.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` -`))},zt.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},zt}(function(e){(function(t){var r=function(z){var J,ee=new Float64Array(16);if(z)for(J=0;J>24&255,z[J+1]=ee>>16&255,z[J+2]=ee>>8&255,z[J+3]=ee&255,z[J+4]=O>>24&255,z[J+5]=O>>16&255,z[J+6]=O>>8&255,z[J+7]=O&255}function b(z,J,ee,O,te){var Ae,Ee=0;for(Ae=0;Ae>>8)-1}function S(z,J,ee,O){return b(z,J,ee,O,16)}function x(z,J,ee,O){return b(z,J,ee,O,32)}function k(z,J,ee,O){for(var te=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,Ae=ee[0]&255|(ee[1]&255)<<8|(ee[2]&255)<<16|(ee[3]&255)<<24,Ee=ee[4]&255|(ee[5]&255)<<8|(ee[6]&255)<<16|(ee[7]&255)<<24,Be=ee[8]&255|(ee[9]&255)<<8|(ee[10]&255)<<16|(ee[11]&255)<<24,qe=ee[12]&255|(ee[13]&255)<<8|(ee[14]&255)<<16|(ee[15]&255)<<24,He=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,$e=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Lt=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,ot=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,yt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,Ct=ee[16]&255|(ee[17]&255)<<8|(ee[18]&255)<<16|(ee[19]&255)<<24,St=ee[20]&255|(ee[21]&255)<<8|(ee[22]&255)<<16|(ee[23]&255)<<24,bt=ee[24]&255|(ee[25]&255)<<8|(ee[26]&255)<<16|(ee[27]&255)<<24,xt=ee[28]&255|(ee[29]&255)<<8|(ee[30]&255)<<16|(ee[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,st=te,ct=Ae,nt=Ee,lt=Be,fe=qe,R=He,F=$e,H=Lt,ae=ot,oe=vt,Ce=yt,Se=Ct,Ve=St,Ge=bt,Je=xt,At=wt,we,jt=0;jt<20;jt+=2)we=st+Ve|0,fe^=we<<7|we>>>32-7,we=fe+st|0,ae^=we<<9|we>>>32-9,we=ae+fe|0,Ve^=we<<13|we>>>32-13,we=Ve+ae|0,st^=we<<18|we>>>32-18,we=R+ct|0,oe^=we<<7|we>>>32-7,we=oe+R|0,Ge^=we<<9|we>>>32-9,we=Ge+oe|0,ct^=we<<13|we>>>32-13,we=ct+Ge|0,R^=we<<18|we>>>32-18,we=Ce+F|0,Je^=we<<7|we>>>32-7,we=Je+Ce|0,nt^=we<<9|we>>>32-9,we=nt+Je|0,F^=we<<13|we>>>32-13,we=F+nt|0,Ce^=we<<18|we>>>32-18,we=At+Se|0,lt^=we<<7|we>>>32-7,we=lt+At|0,H^=we<<9|we>>>32-9,we=H+lt|0,Se^=we<<13|we>>>32-13,we=Se+H|0,At^=we<<18|we>>>32-18,we=st+lt|0,ct^=we<<7|we>>>32-7,we=ct+st|0,nt^=we<<9|we>>>32-9,we=nt+ct|0,lt^=we<<13|we>>>32-13,we=lt+nt|0,st^=we<<18|we>>>32-18,we=R+fe|0,F^=we<<7|we>>>32-7,we=F+R|0,H^=we<<9|we>>>32-9,we=H+F|0,fe^=we<<13|we>>>32-13,we=fe+H|0,R^=we<<18|we>>>32-18,we=Ce+oe|0,Se^=we<<7|we>>>32-7,we=Se+Ce|0,ae^=we<<9|we>>>32-9,we=ae+Se|0,oe^=we<<13|we>>>32-13,we=oe+ae|0,Ce^=we<<18|we>>>32-18,we=At+Je|0,Ve^=we<<7|we>>>32-7,we=Ve+At|0,Ge^=we<<9|we>>>32-9,we=Ge+Ve|0,Je^=we<<13|we>>>32-13,we=Je+Ge|0,At^=we<<18|we>>>32-18;st=st+te|0,ct=ct+Ae|0,nt=nt+Ee|0,lt=lt+Be|0,fe=fe+qe|0,R=R+He|0,F=F+$e|0,H=H+Lt|0,ae=ae+ot|0,oe=oe+vt|0,Ce=Ce+yt|0,Se=Se+Ct|0,Ve=Ve+St|0,Ge=Ge+bt|0,Je=Je+xt|0,At=At+wt|0,z[0]=st>>>0&255,z[1]=st>>>8&255,z[2]=st>>>16&255,z[3]=st>>>24&255,z[4]=ct>>>0&255,z[5]=ct>>>8&255,z[6]=ct>>>16&255,z[7]=ct>>>24&255,z[8]=nt>>>0&255,z[9]=nt>>>8&255,z[10]=nt>>>16&255,z[11]=nt>>>24&255,z[12]=lt>>>0&255,z[13]=lt>>>8&255,z[14]=lt>>>16&255,z[15]=lt>>>24&255,z[16]=fe>>>0&255,z[17]=fe>>>8&255,z[18]=fe>>>16&255,z[19]=fe>>>24&255,z[20]=R>>>0&255,z[21]=R>>>8&255,z[22]=R>>>16&255,z[23]=R>>>24&255,z[24]=F>>>0&255,z[25]=F>>>8&255,z[26]=F>>>16&255,z[27]=F>>>24&255,z[28]=H>>>0&255,z[29]=H>>>8&255,z[30]=H>>>16&255,z[31]=H>>>24&255,z[32]=ae>>>0&255,z[33]=ae>>>8&255,z[34]=ae>>>16&255,z[35]=ae>>>24&255,z[36]=oe>>>0&255,z[37]=oe>>>8&255,z[38]=oe>>>16&255,z[39]=oe>>>24&255,z[40]=Ce>>>0&255,z[41]=Ce>>>8&255,z[42]=Ce>>>16&255,z[43]=Ce>>>24&255,z[44]=Se>>>0&255,z[45]=Se>>>8&255,z[46]=Se>>>16&255,z[47]=Se>>>24&255,z[48]=Ve>>>0&255,z[49]=Ve>>>8&255,z[50]=Ve>>>16&255,z[51]=Ve>>>24&255,z[52]=Ge>>>0&255,z[53]=Ge>>>8&255,z[54]=Ge>>>16&255,z[55]=Ge>>>24&255,z[56]=Je>>>0&255,z[57]=Je>>>8&255,z[58]=Je>>>16&255,z[59]=Je>>>24&255,z[60]=At>>>0&255,z[61]=At>>>8&255,z[62]=At>>>16&255,z[63]=At>>>24&255}function M(z,J,ee,O){for(var te=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,Ae=ee[0]&255|(ee[1]&255)<<8|(ee[2]&255)<<16|(ee[3]&255)<<24,Ee=ee[4]&255|(ee[5]&255)<<8|(ee[6]&255)<<16|(ee[7]&255)<<24,Be=ee[8]&255|(ee[9]&255)<<8|(ee[10]&255)<<16|(ee[11]&255)<<24,qe=ee[12]&255|(ee[13]&255)<<8|(ee[14]&255)<<16|(ee[15]&255)<<24,He=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,$e=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Lt=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,ot=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,yt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,Ct=ee[16]&255|(ee[17]&255)<<8|(ee[18]&255)<<16|(ee[19]&255)<<24,St=ee[20]&255|(ee[21]&255)<<8|(ee[22]&255)<<16|(ee[23]&255)<<24,bt=ee[24]&255|(ee[25]&255)<<8|(ee[26]&255)<<16|(ee[27]&255)<<24,xt=ee[28]&255|(ee[29]&255)<<8|(ee[30]&255)<<16|(ee[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,st=te,ct=Ae,nt=Ee,lt=Be,fe=qe,R=He,F=$e,H=Lt,ae=ot,oe=vt,Ce=yt,Se=Ct,Ve=St,Ge=bt,Je=xt,At=wt,we,jt=0;jt<20;jt+=2)we=st+Ve|0,fe^=we<<7|we>>>32-7,we=fe+st|0,ae^=we<<9|we>>>32-9,we=ae+fe|0,Ve^=we<<13|we>>>32-13,we=Ve+ae|0,st^=we<<18|we>>>32-18,we=R+ct|0,oe^=we<<7|we>>>32-7,we=oe+R|0,Ge^=we<<9|we>>>32-9,we=Ge+oe|0,ct^=we<<13|we>>>32-13,we=ct+Ge|0,R^=we<<18|we>>>32-18,we=Ce+F|0,Je^=we<<7|we>>>32-7,we=Je+Ce|0,nt^=we<<9|we>>>32-9,we=nt+Je|0,F^=we<<13|we>>>32-13,we=F+nt|0,Ce^=we<<18|we>>>32-18,we=At+Se|0,lt^=we<<7|we>>>32-7,we=lt+At|0,H^=we<<9|we>>>32-9,we=H+lt|0,Se^=we<<13|we>>>32-13,we=Se+H|0,At^=we<<18|we>>>32-18,we=st+lt|0,ct^=we<<7|we>>>32-7,we=ct+st|0,nt^=we<<9|we>>>32-9,we=nt+ct|0,lt^=we<<13|we>>>32-13,we=lt+nt|0,st^=we<<18|we>>>32-18,we=R+fe|0,F^=we<<7|we>>>32-7,we=F+R|0,H^=we<<9|we>>>32-9,we=H+F|0,fe^=we<<13|we>>>32-13,we=fe+H|0,R^=we<<18|we>>>32-18,we=Ce+oe|0,Se^=we<<7|we>>>32-7,we=Se+Ce|0,ae^=we<<9|we>>>32-9,we=ae+Se|0,oe^=we<<13|we>>>32-13,we=oe+ae|0,Ce^=we<<18|we>>>32-18,we=At+Je|0,Ve^=we<<7|we>>>32-7,we=Ve+At|0,Ge^=we<<9|we>>>32-9,we=Ge+Ve|0,Je^=we<<13|we>>>32-13,we=Je+Ge|0,At^=we<<18|we>>>32-18;z[0]=st>>>0&255,z[1]=st>>>8&255,z[2]=st>>>16&255,z[3]=st>>>24&255,z[4]=R>>>0&255,z[5]=R>>>8&255,z[6]=R>>>16&255,z[7]=R>>>24&255,z[8]=Ce>>>0&255,z[9]=Ce>>>8&255,z[10]=Ce>>>16&255,z[11]=Ce>>>24&255,z[12]=At>>>0&255,z[13]=At>>>8&255,z[14]=At>>>16&255,z[15]=At>>>24&255,z[16]=F>>>0&255,z[17]=F>>>8&255,z[18]=F>>>16&255,z[19]=F>>>24&255,z[20]=H>>>0&255,z[21]=H>>>8&255,z[22]=H>>>16&255,z[23]=H>>>24&255,z[24]=ae>>>0&255,z[25]=ae>>>8&255,z[26]=ae>>>16&255,z[27]=ae>>>24&255,z[28]=oe>>>0&255,z[29]=oe>>>8&255,z[30]=oe>>>16&255,z[31]=oe>>>24&255}function P(z,J,ee,O){k(z,J,ee,O)}function L(z,J,ee,O){M(z,J,ee,O)}var j=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function V(z,J,ee,O,te,Ae,Ee){var Be=new Uint8Array(16),qe=new Uint8Array(64),He,$e;for($e=0;$e<16;$e++)Be[$e]=0;for($e=0;$e<8;$e++)Be[$e]=Ae[$e];for(;te>=64;){for(P(qe,Be,Ee,j),$e=0;$e<64;$e++)z[J+$e]=ee[O+$e]^qe[$e];for(He=1,$e=8;$e<16;$e++)He=He+(Be[$e]&255)|0,Be[$e]=He&255,He>>>=8;te-=64,J+=64,O+=64}if(te>0)for(P(qe,Be,Ee,j),$e=0;$e=64;){for(P(Ee,Ae,te,j),qe=0;qe<64;qe++)z[J+qe]=Ee[qe];for(Be=1,qe=8;qe<16;qe++)Be=Be+(Ae[qe]&255)|0,Ae[qe]=Be&255,Be>>>=8;ee-=64,J+=64}if(ee>0)for(P(Ee,Ae,te,j),qe=0;qe>>13|ee<<3)&8191,O=z[4]&255|(z[5]&255)<<8,this.r[2]=(ee>>>10|O<<6)&7939,te=z[6]&255|(z[7]&255)<<8,this.r[3]=(O>>>7|te<<9)&8191,Ae=z[8]&255|(z[9]&255)<<8,this.r[4]=(te>>>4|Ae<<12)&255,this.r[5]=Ae>>>1&8190,Ee=z[10]&255|(z[11]&255)<<8,this.r[6]=(Ae>>>14|Ee<<2)&8191,Be=z[12]&255|(z[13]&255)<<8,this.r[7]=(Ee>>>11|Be<<5)&8065,qe=z[14]&255|(z[15]&255)<<8,this.r[8]=(Be>>>8|qe<<8)&8191,this.r[9]=qe>>>5&127,this.pad[0]=z[16]&255|(z[17]&255)<<8,this.pad[1]=z[18]&255|(z[19]&255)<<8,this.pad[2]=z[20]&255|(z[21]&255)<<8,this.pad[3]=z[22]&255|(z[23]&255)<<8,this.pad[4]=z[24]&255|(z[25]&255)<<8,this.pad[5]=z[26]&255|(z[27]&255)<<8,this.pad[6]=z[28]&255|(z[29]&255)<<8,this.pad[7]=z[30]&255|(z[31]&255)<<8};U.prototype.blocks=function(z,J,ee){for(var O=this.fin?0:2048,te,Ae,Ee,Be,qe,He,$e,Lt,ot,vt,yt,Ct,St,bt,xt,wt,st,ct,nt,lt=this.h[0],fe=this.h[1],R=this.h[2],F=this.h[3],H=this.h[4],ae=this.h[5],oe=this.h[6],Ce=this.h[7],Se=this.h[8],Ve=this.h[9],Ge=this.r[0],Je=this.r[1],At=this.r[2],we=this.r[3],jt=this.r[4],nr=this.r[5],ir=this.r[6],Wt=this.r[7],er=this.r[8],tr=this.r[9];ee>=16;)te=z[J+0]&255|(z[J+1]&255)<<8,lt+=te&8191,Ae=z[J+2]&255|(z[J+3]&255)<<8,fe+=(te>>>13|Ae<<3)&8191,Ee=z[J+4]&255|(z[J+5]&255)<<8,R+=(Ae>>>10|Ee<<6)&8191,Be=z[J+6]&255|(z[J+7]&255)<<8,F+=(Ee>>>7|Be<<9)&8191,qe=z[J+8]&255|(z[J+9]&255)<<8,H+=(Be>>>4|qe<<12)&8191,ae+=qe>>>1&8191,He=z[J+10]&255|(z[J+11]&255)<<8,oe+=(qe>>>14|He<<2)&8191,$e=z[J+12]&255|(z[J+13]&255)<<8,Ce+=(He>>>11|$e<<5)&8191,Lt=z[J+14]&255|(z[J+15]&255)<<8,Se+=($e>>>8|Lt<<8)&8191,Ve+=Lt>>>5|O,ot=0,vt=ot,vt+=lt*Ge,vt+=fe*(5*tr),vt+=R*(5*er),vt+=F*(5*Wt),vt+=H*(5*ir),ot=vt>>>13,vt&=8191,vt+=ae*(5*nr),vt+=oe*(5*jt),vt+=Ce*(5*we),vt+=Se*(5*At),vt+=Ve*(5*Je),ot+=vt>>>13,vt&=8191,yt=ot,yt+=lt*Je,yt+=fe*Ge,yt+=R*(5*tr),yt+=F*(5*er),yt+=H*(5*Wt),ot=yt>>>13,yt&=8191,yt+=ae*(5*ir),yt+=oe*(5*nr),yt+=Ce*(5*jt),yt+=Se*(5*we),yt+=Ve*(5*At),ot+=yt>>>13,yt&=8191,Ct=ot,Ct+=lt*At,Ct+=fe*Je,Ct+=R*Ge,Ct+=F*(5*tr),Ct+=H*(5*er),ot=Ct>>>13,Ct&=8191,Ct+=ae*(5*Wt),Ct+=oe*(5*ir),Ct+=Ce*(5*nr),Ct+=Se*(5*jt),Ct+=Ve*(5*we),ot+=Ct>>>13,Ct&=8191,St=ot,St+=lt*we,St+=fe*At,St+=R*Je,St+=F*Ge,St+=H*(5*tr),ot=St>>>13,St&=8191,St+=ae*(5*er),St+=oe*(5*Wt),St+=Ce*(5*ir),St+=Se*(5*nr),St+=Ve*(5*jt),ot+=St>>>13,St&=8191,bt=ot,bt+=lt*jt,bt+=fe*we,bt+=R*At,bt+=F*Je,bt+=H*Ge,ot=bt>>>13,bt&=8191,bt+=ae*(5*tr),bt+=oe*(5*er),bt+=Ce*(5*Wt),bt+=Se*(5*ir),bt+=Ve*(5*nr),ot+=bt>>>13,bt&=8191,xt=ot,xt+=lt*nr,xt+=fe*jt,xt+=R*we,xt+=F*At,xt+=H*Je,ot=xt>>>13,xt&=8191,xt+=ae*Ge,xt+=oe*(5*tr),xt+=Ce*(5*er),xt+=Se*(5*Wt),xt+=Ve*(5*ir),ot+=xt>>>13,xt&=8191,wt=ot,wt+=lt*ir,wt+=fe*nr,wt+=R*jt,wt+=F*we,wt+=H*At,ot=wt>>>13,wt&=8191,wt+=ae*Je,wt+=oe*Ge,wt+=Ce*(5*tr),wt+=Se*(5*er),wt+=Ve*(5*Wt),ot+=wt>>>13,wt&=8191,st=ot,st+=lt*Wt,st+=fe*ir,st+=R*nr,st+=F*jt,st+=H*we,ot=st>>>13,st&=8191,st+=ae*At,st+=oe*Je,st+=Ce*Ge,st+=Se*(5*tr),st+=Ve*(5*er),ot+=st>>>13,st&=8191,ct=ot,ct+=lt*er,ct+=fe*Wt,ct+=R*ir,ct+=F*nr,ct+=H*jt,ot=ct>>>13,ct&=8191,ct+=ae*we,ct+=oe*At,ct+=Ce*Je,ct+=Se*Ge,ct+=Ve*(5*tr),ot+=ct>>>13,ct&=8191,nt=ot,nt+=lt*tr,nt+=fe*er,nt+=R*Wt,nt+=F*ir,nt+=H*nr,ot=nt>>>13,nt&=8191,nt+=ae*jt,nt+=oe*we,nt+=Ce*At,nt+=Se*Je,nt+=Ve*Ge,ot+=nt>>>13,nt&=8191,ot=(ot<<2)+ot|0,ot=ot+vt|0,vt=ot&8191,ot=ot>>>13,yt+=ot,lt=vt,fe=yt,R=Ct,F=St,H=bt,ae=xt,oe=wt,Ce=st,Se=ct,Ve=nt,J+=16,ee-=16;this.h[0]=lt,this.h[1]=fe,this.h[2]=R,this.h[3]=F,this.h[4]=H,this.h[5]=ae,this.h[6]=oe,this.h[7]=Ce,this.h[8]=Se,this.h[9]=Ve},U.prototype.finish=function(z,J){var ee=new Uint16Array(10),O,te,Ae,Ee;if(this.leftover){for(Ee=this.leftover,this.buffer[Ee++]=1;Ee<16;Ee++)this.buffer[Ee]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(O=this.h[1]>>>13,this.h[1]&=8191,Ee=2;Ee<10;Ee++)this.h[Ee]+=O,O=this.h[Ee]>>>13,this.h[Ee]&=8191;for(this.h[0]+=O*5,O=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=O,O=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=O,ee[0]=this.h[0]+5,O=ee[0]>>>13,ee[0]&=8191,Ee=1;Ee<10;Ee++)ee[Ee]=this.h[Ee]+O,O=ee[Ee]>>>13,ee[Ee]&=8191;for(ee[9]-=1<<13,te=(O^1)-1,Ee=0;Ee<10;Ee++)ee[Ee]&=te;for(te=~te,Ee=0;Ee<10;Ee++)this.h[Ee]=this.h[Ee]&te|ee[Ee];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Ae=this.h[0]+this.pad[0],this.h[0]=Ae&65535,Ee=1;Ee<8;Ee++)Ae=(this.h[Ee]+this.pad[Ee]|0)+(Ae>>>16)|0,this.h[Ee]=Ae&65535;z[J+0]=this.h[0]>>>0&255,z[J+1]=this.h[0]>>>8&255,z[J+2]=this.h[1]>>>0&255,z[J+3]=this.h[1]>>>8&255,z[J+4]=this.h[2]>>>0&255,z[J+5]=this.h[2]>>>8&255,z[J+6]=this.h[3]>>>0&255,z[J+7]=this.h[3]>>>8&255,z[J+8]=this.h[4]>>>0&255,z[J+9]=this.h[4]>>>8&255,z[J+10]=this.h[5]>>>0&255,z[J+11]=this.h[5]>>>8&255,z[J+12]=this.h[6]>>>0&255,z[J+13]=this.h[6]>>>8&255,z[J+14]=this.h[7]>>>0&255,z[J+15]=this.h[7]>>>8&255},U.prototype.update=function(z,J,ee){var O,te;if(this.leftover){for(te=16-this.leftover,te>ee&&(te=ee),O=0;O=16&&(te=ee-ee%16,this.blocks(z,J,te),J+=te,ee-=te),ee){for(O=0;O>16&1),Ae[ee-1]&=65535;Ae[15]=Ee[15]-32767-(Ae[14]>>16&1),te=Ae[15]>>16&1,Ae[14]&=65535,T(Ee,Ae,1-te)}for(ee=0;ee<16;ee++)z[2*ee]=Ee[ee]&255,z[2*ee+1]=Ee[ee]>>8}function C(z,J){var ee=new Uint8Array(32),O=new Uint8Array(32);return E(ee,z),E(O,J),x(ee,0,O,0)}function I(z){var J=new Uint8Array(32);return E(J,z),J[0]&1}function m(z,J){var ee;for(ee=0;ee<16;ee++)z[ee]=J[2*ee]+(J[2*ee+1]<<8);z[15]&=32767}function B(z,J,ee){for(var O=0;O<16;O++)z[O]=J[O]+ee[O]}function ne(z,J,ee){for(var O=0;O<16;O++)z[O]=J[O]-ee[O]}function de(z,J,ee){var O,te,Ae=0,Ee=0,Be=0,qe=0,He=0,$e=0,Lt=0,ot=0,vt=0,yt=0,Ct=0,St=0,bt=0,xt=0,wt=0,st=0,ct=0,nt=0,lt=0,fe=0,R=0,F=0,H=0,ae=0,oe=0,Ce=0,Se=0,Ve=0,Ge=0,Je=0,At=0,we=ee[0],jt=ee[1],nr=ee[2],ir=ee[3],Wt=ee[4],er=ee[5],tr=ee[6],jr=ee[7],fr=ee[8],Rr=ee[9],Or=ee[10],Nr=ee[11],Hr=ee[12],yn=ee[13],bn=ee[14],wn=ee[15];O=J[0],Ae+=O*we,Ee+=O*jt,Be+=O*nr,qe+=O*ir,He+=O*Wt,$e+=O*er,Lt+=O*tr,ot+=O*jr,vt+=O*fr,yt+=O*Rr,Ct+=O*Or,St+=O*Nr,bt+=O*Hr,xt+=O*yn,wt+=O*bn,st+=O*wn,O=J[1],Ee+=O*we,Be+=O*jt,qe+=O*nr,He+=O*ir,$e+=O*Wt,Lt+=O*er,ot+=O*tr,vt+=O*jr,yt+=O*fr,Ct+=O*Rr,St+=O*Or,bt+=O*Nr,xt+=O*Hr,wt+=O*yn,st+=O*bn,ct+=O*wn,O=J[2],Be+=O*we,qe+=O*jt,He+=O*nr,$e+=O*ir,Lt+=O*Wt,ot+=O*er,vt+=O*tr,yt+=O*jr,Ct+=O*fr,St+=O*Rr,bt+=O*Or,xt+=O*Nr,wt+=O*Hr,st+=O*yn,ct+=O*bn,nt+=O*wn,O=J[3],qe+=O*we,He+=O*jt,$e+=O*nr,Lt+=O*ir,ot+=O*Wt,vt+=O*er,yt+=O*tr,Ct+=O*jr,St+=O*fr,bt+=O*Rr,xt+=O*Or,wt+=O*Nr,st+=O*Hr,ct+=O*yn,nt+=O*bn,lt+=O*wn,O=J[4],He+=O*we,$e+=O*jt,Lt+=O*nr,ot+=O*ir,vt+=O*Wt,yt+=O*er,Ct+=O*tr,St+=O*jr,bt+=O*fr,xt+=O*Rr,wt+=O*Or,st+=O*Nr,ct+=O*Hr,nt+=O*yn,lt+=O*bn,fe+=O*wn,O=J[5],$e+=O*we,Lt+=O*jt,ot+=O*nr,vt+=O*ir,yt+=O*Wt,Ct+=O*er,St+=O*tr,bt+=O*jr,xt+=O*fr,wt+=O*Rr,st+=O*Or,ct+=O*Nr,nt+=O*Hr,lt+=O*yn,fe+=O*bn,R+=O*wn,O=J[6],Lt+=O*we,ot+=O*jt,vt+=O*nr,yt+=O*ir,Ct+=O*Wt,St+=O*er,bt+=O*tr,xt+=O*jr,wt+=O*fr,st+=O*Rr,ct+=O*Or,nt+=O*Nr,lt+=O*Hr,fe+=O*yn,R+=O*bn,F+=O*wn,O=J[7],ot+=O*we,vt+=O*jt,yt+=O*nr,Ct+=O*ir,St+=O*Wt,bt+=O*er,xt+=O*tr,wt+=O*jr,st+=O*fr,ct+=O*Rr,nt+=O*Or,lt+=O*Nr,fe+=O*Hr,R+=O*yn,F+=O*bn,H+=O*wn,O=J[8],vt+=O*we,yt+=O*jt,Ct+=O*nr,St+=O*ir,bt+=O*Wt,xt+=O*er,wt+=O*tr,st+=O*jr,ct+=O*fr,nt+=O*Rr,lt+=O*Or,fe+=O*Nr,R+=O*Hr,F+=O*yn,H+=O*bn,ae+=O*wn,O=J[9],yt+=O*we,Ct+=O*jt,St+=O*nr,bt+=O*ir,xt+=O*Wt,wt+=O*er,st+=O*tr,ct+=O*jr,nt+=O*fr,lt+=O*Rr,fe+=O*Or,R+=O*Nr,F+=O*Hr,H+=O*yn,ae+=O*bn,oe+=O*wn,O=J[10],Ct+=O*we,St+=O*jt,bt+=O*nr,xt+=O*ir,wt+=O*Wt,st+=O*er,ct+=O*tr,nt+=O*jr,lt+=O*fr,fe+=O*Rr,R+=O*Or,F+=O*Nr,H+=O*Hr,ae+=O*yn,oe+=O*bn,Ce+=O*wn,O=J[11],St+=O*we,bt+=O*jt,xt+=O*nr,wt+=O*ir,st+=O*Wt,ct+=O*er,nt+=O*tr,lt+=O*jr,fe+=O*fr,R+=O*Rr,F+=O*Or,H+=O*Nr,ae+=O*Hr,oe+=O*yn,Ce+=O*bn,Se+=O*wn,O=J[12],bt+=O*we,xt+=O*jt,wt+=O*nr,st+=O*ir,ct+=O*Wt,nt+=O*er,lt+=O*tr,fe+=O*jr,R+=O*fr,F+=O*Rr,H+=O*Or,ae+=O*Nr,oe+=O*Hr,Ce+=O*yn,Se+=O*bn,Ve+=O*wn,O=J[13],xt+=O*we,wt+=O*jt,st+=O*nr,ct+=O*ir,nt+=O*Wt,lt+=O*er,fe+=O*tr,R+=O*jr,F+=O*fr,H+=O*Rr,ae+=O*Or,oe+=O*Nr,Ce+=O*Hr,Se+=O*yn,Ve+=O*bn,Ge+=O*wn,O=J[14],wt+=O*we,st+=O*jt,ct+=O*nr,nt+=O*ir,lt+=O*Wt,fe+=O*er,R+=O*tr,F+=O*jr,H+=O*fr,ae+=O*Rr,oe+=O*Or,Ce+=O*Nr,Se+=O*Hr,Ve+=O*yn,Ge+=O*bn,Je+=O*wn,O=J[15],st+=O*we,ct+=O*jt,nt+=O*nr,lt+=O*ir,fe+=O*Wt,R+=O*er,F+=O*tr,H+=O*jr,ae+=O*fr,oe+=O*Rr,Ce+=O*Or,Se+=O*Nr,Ve+=O*Hr,Ge+=O*yn,Je+=O*bn,At+=O*wn,Ae+=38*ct,Ee+=38*nt,Be+=38*lt,qe+=38*fe,He+=38*R,$e+=38*F,Lt+=38*H,ot+=38*ae,vt+=38*oe,yt+=38*Ce,Ct+=38*Se,St+=38*Ve,bt+=38*Ge,xt+=38*Je,wt+=38*At,te=1,O=Ae+te+65535,te=Math.floor(O/65536),Ae=O-te*65536,O=Ee+te+65535,te=Math.floor(O/65536),Ee=O-te*65536,O=Be+te+65535,te=Math.floor(O/65536),Be=O-te*65536,O=qe+te+65535,te=Math.floor(O/65536),qe=O-te*65536,O=He+te+65535,te=Math.floor(O/65536),He=O-te*65536,O=$e+te+65535,te=Math.floor(O/65536),$e=O-te*65536,O=Lt+te+65535,te=Math.floor(O/65536),Lt=O-te*65536,O=ot+te+65535,te=Math.floor(O/65536),ot=O-te*65536,O=vt+te+65535,te=Math.floor(O/65536),vt=O-te*65536,O=yt+te+65535,te=Math.floor(O/65536),yt=O-te*65536,O=Ct+te+65535,te=Math.floor(O/65536),Ct=O-te*65536,O=St+te+65535,te=Math.floor(O/65536),St=O-te*65536,O=bt+te+65535,te=Math.floor(O/65536),bt=O-te*65536,O=xt+te+65535,te=Math.floor(O/65536),xt=O-te*65536,O=wt+te+65535,te=Math.floor(O/65536),wt=O-te*65536,O=st+te+65535,te=Math.floor(O/65536),st=O-te*65536,Ae+=te-1+37*(te-1),te=1,O=Ae+te+65535,te=Math.floor(O/65536),Ae=O-te*65536,O=Ee+te+65535,te=Math.floor(O/65536),Ee=O-te*65536,O=Be+te+65535,te=Math.floor(O/65536),Be=O-te*65536,O=qe+te+65535,te=Math.floor(O/65536),qe=O-te*65536,O=He+te+65535,te=Math.floor(O/65536),He=O-te*65536,O=$e+te+65535,te=Math.floor(O/65536),$e=O-te*65536,O=Lt+te+65535,te=Math.floor(O/65536),Lt=O-te*65536,O=ot+te+65535,te=Math.floor(O/65536),ot=O-te*65536,O=vt+te+65535,te=Math.floor(O/65536),vt=O-te*65536,O=yt+te+65535,te=Math.floor(O/65536),yt=O-te*65536,O=Ct+te+65535,te=Math.floor(O/65536),Ct=O-te*65536,O=St+te+65535,te=Math.floor(O/65536),St=O-te*65536,O=bt+te+65535,te=Math.floor(O/65536),bt=O-te*65536,O=xt+te+65535,te=Math.floor(O/65536),xt=O-te*65536,O=wt+te+65535,te=Math.floor(O/65536),wt=O-te*65536,O=st+te+65535,te=Math.floor(O/65536),st=O-te*65536,Ae+=te-1+37*(te-1),z[0]=Ae,z[1]=Ee,z[2]=Be,z[3]=qe,z[4]=He,z[5]=$e,z[6]=Lt,z[7]=ot,z[8]=vt,z[9]=yt,z[10]=Ct,z[11]=St,z[12]=bt,z[13]=xt,z[14]=wt,z[15]=st}function $(z,J){de(z,J,J)}function he(z,J){var ee=r(),O;for(O=0;O<16;O++)ee[O]=J[O];for(O=253;O>=0;O--)$(ee,ee),O!==2&&O!==4&&de(ee,ee,J);for(O=0;O<16;O++)z[O]=ee[O]}function X(z,J){var ee=r(),O;for(O=0;O<16;O++)ee[O]=J[O];for(O=250;O>=0;O--)$(ee,ee),O!==1&&de(ee,ee,J);for(O=0;O<16;O++)z[O]=ee[O]}function se(z,J,ee){var O=new Uint8Array(32),te=new Float64Array(80),Ae,Ee,Be=r(),qe=r(),He=r(),$e=r(),Lt=r(),ot=r();for(Ee=0;Ee<31;Ee++)O[Ee]=J[Ee];for(O[31]=J[31]&127|64,O[0]&=248,m(te,ee),Ee=0;Ee<16;Ee++)qe[Ee]=te[Ee],$e[Ee]=Be[Ee]=He[Ee]=0;for(Be[0]=$e[0]=1,Ee=254;Ee>=0;--Ee)Ae=O[Ee>>>3]>>>(Ee&7)&1,T(Be,qe,Ae),T(He,$e,Ae),B(Lt,Be,He),ne(Be,Be,He),B(He,qe,$e),ne(qe,qe,$e),$($e,Lt),$(ot,Be),de(Be,He,Be),de(He,qe,Lt),B(Lt,Be,He),ne(Be,Be,He),$(qe,Be),ne(He,$e,ot),de(Be,He,l),B(Be,Be,$e),de(He,He,Be),de(Be,$e,ot),de($e,qe,te),$(qe,Lt),T(Be,qe,Ae),T(He,$e,Ae);for(Ee=0;Ee<16;Ee++)te[Ee+16]=Be[Ee],te[Ee+32]=He[Ee],te[Ee+48]=qe[Ee],te[Ee+64]=$e[Ee];var vt=te.subarray(32),yt=te.subarray(16);return he(vt,vt),de(yt,yt,vt),E(z,yt),0}function pe(z,J){return se(z,J,i)}function W(z,J){return n(J,32),pe(z,J)}function q(z,J,ee){var O=new Uint8Array(32);return se(O,ee,J),L(z,o,O,j)}var ye=f,xe=g;function Me(z,J,ee,O,te,Ae){var Ee=new Uint8Array(32);return q(Ee,te,Ae),ye(z,J,ee,O,Ee)}function Q(z,J,ee,O,te,Ae){var Ee=new Uint8Array(32);return q(Ee,te,Ae),xe(z,J,ee,O,Ee)}var 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];function D(z,J,ee,O){for(var te=new Int32Array(16),Ae=new Int32Array(16),Ee,Be,qe,He,$e,Lt,ot,vt,yt,Ct,St,bt,xt,wt,st,ct,nt,lt,fe,R,F,H,ae,oe,Ce,Se,Ve=z[0],Ge=z[1],Je=z[2],At=z[3],we=z[4],jt=z[5],nr=z[6],ir=z[7],Wt=J[0],er=J[1],tr=J[2],jr=J[3],fr=J[4],Rr=J[5],Or=J[6],Nr=J[7],Hr=0;O>=128;){for(fe=0;fe<16;fe++)R=8*fe+Hr,te[fe]=ee[R+0]<<24|ee[R+1]<<16|ee[R+2]<<8|ee[R+3],Ae[fe]=ee[R+4]<<24|ee[R+5]<<16|ee[R+6]<<8|ee[R+7];for(fe=0;fe<80;fe++)if(Ee=Ve,Be=Ge,qe=Je,He=At,$e=we,Lt=jt,ot=nr,vt=ir,yt=Wt,Ct=er,St=tr,bt=jr,xt=fr,wt=Rr,st=Or,ct=Nr,F=ir,H=Nr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=(we>>>14|fr<<32-14)^(we>>>18|fr<<32-18)^(fr>>>41-32|we<<32-(41-32)),H=(fr>>>14|we<<32-14)^(fr>>>18|we<<32-18)^(we>>>41-32|fr<<32-(41-32)),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=we&jt^~we&nr,H=fr&Rr^~fr&Or,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=N[fe*2],H=N[fe*2+1],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=te[fe%16],H=Ae[fe%16],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,nt=Ce&65535|Se<<16,lt=ae&65535|oe<<16,F=nt,H=lt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=(Ve>>>28|Wt<<32-28)^(Wt>>>34-32|Ve<<32-(34-32))^(Wt>>>39-32|Ve<<32-(39-32)),H=(Wt>>>28|Ve<<32-28)^(Ve>>>34-32|Wt<<32-(34-32))^(Ve>>>39-32|Wt<<32-(39-32)),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=Ve&Ge^Ve&Je^Ge&Je,H=Wt&er^Wt&tr^er&tr,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,vt=Ce&65535|Se<<16,ct=ae&65535|oe<<16,F=He,H=bt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=nt,H=lt,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,He=Ce&65535|Se<<16,bt=ae&65535|oe<<16,Ge=Ee,Je=Be,At=qe,we=He,jt=$e,nr=Lt,ir=ot,Ve=vt,er=yt,tr=Ct,jr=St,fr=bt,Rr=xt,Or=wt,Nr=st,Wt=ct,fe%16===15)for(R=0;R<16;R++)F=te[R],H=Ae[R],ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=te[(R+9)%16],H=Ae[(R+9)%16],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,nt=te[(R+1)%16],lt=Ae[(R+1)%16],F=(nt>>>1|lt<<32-1)^(nt>>>8|lt<<32-8)^nt>>>7,H=(lt>>>1|nt<<32-1)^(lt>>>8|nt<<32-8)^(lt>>>7|nt<<32-7),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,nt=te[(R+14)%16],lt=Ae[(R+14)%16],F=(nt>>>19|lt<<32-19)^(lt>>>61-32|nt<<32-(61-32))^nt>>>6,H=(lt>>>19|nt<<32-19)^(nt>>>61-32|lt<<32-(61-32))^(lt>>>6|nt<<32-6),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,te[R]=Ce&65535|Se<<16,Ae[R]=ae&65535|oe<<16;F=Ve,H=Wt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[0],H=J[0],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[0]=Ve=Ce&65535|Se<<16,J[0]=Wt=ae&65535|oe<<16,F=Ge,H=er,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[1],H=J[1],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[1]=Ge=Ce&65535|Se<<16,J[1]=er=ae&65535|oe<<16,F=Je,H=tr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[2],H=J[2],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[2]=Je=Ce&65535|Se<<16,J[2]=tr=ae&65535|oe<<16,F=At,H=jr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[3],H=J[3],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[3]=At=Ce&65535|Se<<16,J[3]=jr=ae&65535|oe<<16,F=we,H=fr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[4],H=J[4],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[4]=we=Ce&65535|Se<<16,J[4]=fr=ae&65535|oe<<16,F=jt,H=Rr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[5],H=J[5],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[5]=jt=Ce&65535|Se<<16,J[5]=Rr=ae&65535|oe<<16,F=nr,H=Or,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[6],H=J[6],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[6]=nr=Ce&65535|Se<<16,J[6]=Or=ae&65535|oe<<16,F=ir,H=Nr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[7],H=J[7],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[7]=ir=Ce&65535|Se<<16,J[7]=Nr=ae&65535|oe<<16,Hr+=128,O-=128}return O}function G(z,J,ee){var O=new Int32Array(8),te=new Int32Array(8),Ae=new Uint8Array(256),Ee,Be=ee;for(O[0]=1779033703,O[1]=3144134277,O[2]=1013904242,O[3]=2773480762,O[4]=1359893119,O[5]=2600822924,O[6]=528734635,O[7]=1541459225,te[0]=4089235720,te[1]=2227873595,te[2]=4271175723,te[3]=1595750129,te[4]=2917565137,te[5]=725511199,te[6]=4215389547,te[7]=327033209,D(O,te,J,ee),ee%=128,Ee=0;Ee=0;--te)O=ee[te/8|0]>>(te&7)&1,_e(z,J,O),me(J,z),me(z,z),_e(z,J,O)}function Re(z,J){var ee=[r(),r(),r(),r()];w(ee[0],h),w(ee[1],d),w(ee[2],s),de(ee[3],h,d),Fe(z,ee,J)}function le(z,J,ee){var O=new Uint8Array(64),te=[r(),r(),r(),r()],Ae;for(ee||n(J,32),G(O,J,32),O[0]&=248,O[31]&=127,O[31]|=64,Re(te,O),Pe(z,te),Ae=0;Ae<32;Ae++)J[Ae+32]=z[Ae];return 0}var Y=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function re(z,J){var ee,O,te,Ae;for(O=63;O>=32;--O){for(ee=0,te=O-32,Ae=O-12;te>4)*Y[te],ee=J[te]>>8,J[te]&=255;for(te=0;te<32;te++)J[te]-=ee*Y[te];for(O=0;O<32;O++)J[O+1]+=J[O]>>8,z[O]=J[O]&255}function ge(z){var J=new Float64Array(64),ee;for(ee=0;ee<64;ee++)J[ee]=z[ee];for(ee=0;ee<64;ee++)z[ee]=0;re(z,J)}function be(z,J,ee,O){var te=new Uint8Array(64),Ae=new Uint8Array(64),Ee=new Uint8Array(64),Be,qe,He=new Float64Array(64),$e=[r(),r(),r(),r()];G(te,O,32),te[0]&=248,te[31]&=127,te[31]|=64;var Lt=ee+64;for(Be=0;Be>7&&ne(z[0],a,z[0]),de(z[3],z[0],z[1]),0)}function Ie(z,J,ee,O){var te,Ae=new Uint8Array(32),Ee=new Uint8Array(64),Be=[r(),r(),r(),r()],qe=[r(),r(),r(),r()];if(ee<64||ce(qe,O))return-1;for(te=0;te=0},t.sign.keyPair=function(){var z=new Uint8Array(tt),J=new Uint8Array(Nt);return le(z,J),{publicKey:z,secretKey:J}},t.sign.keyPair.fromSecretKey=function(z){if(at(z),z.length!==Nt)throw new Error("bad secret key size");for(var J=new Uint8Array(tt),ee=0;ee=e.length)throw new Error("Index is out of buffer");const r=e.slice(0,t),n=e.slice(t);return[r,n]}function s2(e){let t="";return e.forEach(r=>{t+=("0"+(r&255).toString(16)).slice(-2)}),t}function lp(e){if(e.length%2!==0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let r=0;r"u"}e.isPrimitive=y,e.isBuffer=XD();function f(m){return Object.prototype.toString.call(m)}function g(m){return m<10?"0"+m.toString(10):m.toString(10)}var w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var m=new Date,B=[g(m.getHours()),g(m.getMinutes()),g(m.getSeconds())].join(":");return[m.getDate(),w[m.getMonth()],B].join(" ")}e.log=function(){console.log("%s - %s",A(),e.format.apply(e,arguments))},e.inherits=Ht(),e._extend=function(m,B){if(!B||!Z(B))return m;for(var ne=Object.keys(B),de=ne.length;de--;)m[ne[de]]=B[ne[de]];return m};function T(m,B){return Object.prototype.hasOwnProperty.call(m,B)}var E=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(B){if(typeof B!="function")throw new TypeError('The "original" argument must be of type Function');if(E&&B[E]){var ne=B[E];if(typeof ne!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(ne,E,{value:ne,enumerable:!1,writable:!1,configurable:!0}),ne}function ne(){for(var de,$,he=new Promise(function(pe,W){de=pe,$=W}),X=[],se=0;se0?this.tail.next=b:this.head=b,this.tail=b,++this.length}},{key:"unshift",value:function(v){var b={data:v,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var b=this.head,S=""+b.data;b=b.next;)S+=v+b.data;return S}},{key:"concat",value:function(v){if(this.length===0)return s.alloc(0);for(var b=s.allocUnsafe(v>>>0),S=this.head,x=0;S;)h(S.data,b,x),x+=S.data.length,S=S.next;return b}},{key:"consume",value:function(v,b){var S;return vk.length?k.length:v;if(M===k.length?x+=k:x+=k.slice(0,v),v-=M,v===0){M===k.length?(++S,b.next?this.head=b.next:this.head=this.tail=null):(this.head=b,b.data=k.slice(M));break}++S}return this.length-=S,x}},{key:"_getBuffer",value:function(v){var b=s.allocUnsafe(v),S=this.head,x=1;for(S.data.copy(b),v-=S.data.length;S=S.next;){var k=S.data,M=v>k.length?k.length:v;if(k.copy(b,b.length-v,0,M),v-=M,v===0){M===k.length?(++x,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=k.slice(M));break}++x}return this.length-=x,b}},{key:c,value:function(v,b){return u(this,t({},b,{depth:0,customInspect:!1}))}}]),d}(),nv}var iv,b8;function LA(){if(b8)return iv;b8=1;function e(a,s){var l=this,u=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return u||c?(s?s(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,_t.nextTick(o,this,a)):_t.nextTick(o,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(h){!s&&h?l._writableState?l._writableState.errorEmitted?_t.nextTick(r,l):(l._writableState.errorEmitted=!0,_t.nextTick(t,l,h)):_t.nextTick(t,l,h):s?(_t.nextTick(r,l),s(h)):_t.nextTick(r,l)}),this)}function t(a,s){o(a,s),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function n(){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 o(a,s){a.emit("error",s)}function i(a,s){var l=a._readableState,u=a._writableState;l&&l.autoDestroy||u&&u.autoDestroy?a.destroy(s):a.emit("error",s)}return iv={destroy:e,undestroy:n,errorOrDestroy:i},iv}var ov={},w8;function rc(){if(w8)return ov;w8=1;function e(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,s.__proto__=l}var t={};function r(s,l,u){u||(u=Error);function c(d,p,v){return typeof l=="string"?l:l(d,p,v)}var h=function(d){e(p,d);function p(v,b,S){return d.call(this,c(v,b,S))||this}return p}(u);h.prototype.name=u.name,h.prototype.code=s,t[s]=h}function n(s,l){if(Array.isArray(s)){var u=s.length;return s=s.map(function(c){return String(c)}),u>2?"one of ".concat(l," ").concat(s.slice(0,u-1).join(", "),", or ")+s[u-1]:u===2?"one of ".concat(l," ").concat(s[0]," or ").concat(s[1]):"of ".concat(l," ").concat(s[0])}else return"of ".concat(l," ").concat(String(s))}function o(s,l,u){return s.substr(!u||u<0?0:+u,l.length)===l}function i(s,l,u){return(u===void 0||u>s.length)&&(u=s.length),s.substring(u-l.length,u)===l}function a(s,l,u){return typeof u!="number"&&(u=0),u+l.length>s.length?!1:s.indexOf(l,u)!==-1}return r("ERR_INVALID_OPT_VALUE",function(s,l){return'The value "'+l+'" is invalid for option "'+s+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(s,l,u){var c;typeof l=="string"&&o(l,"not ")?(c="must not be",l=l.replace(/^not /,"")):c="must be";var h;if(i(s," argument"))h="The ".concat(s," ").concat(c," ").concat(n(l,"type"));else{var d=a(s,".")?"property":"argument";h='The "'.concat(s,'" ').concat(d," ").concat(c," ").concat(n(l,"type"))}return h+=". Received type ".concat(typeof u),h},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ov.codes=t,ov}var av,_8;function DA(){if(_8)return av;_8=1;var e=rc().codes.ERR_INVALID_OPT_VALUE;function t(n,o,i){return n.highWaterMark!=null?n.highWaterMark:o?n[i]:null}function r(n,o,i,a){var s=t(o,a,i);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=a?i:"highWaterMark";throw new e(l,s)}return Math.floor(s)}return n.objectMode?16:16*1024}return av={getHighWaterMark:r},av}var sv,x8;function eU(){if(x8)return sv;x8=1,sv=e;function e(r,n){if(t("noDeprecation"))return r;var o=!1;function i(){if(!o){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),o=!0}return r.apply(this,arguments)}return i}function t(r){try{if(!Ke.localStorage)return!1}catch{return!1}var n=Ke.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return sv}var lv,S8;function fw(){if(S8)return lv;S8=1,lv=K;function e($){var he=this;this.next=null,this.entry=null,this.finish=function(){de(he,$)}}var t;K.WritableState=j;var r={deprecate:eU()},n=IA(),o=Oe.Buffer,i=Ke.Uint8Array||function(){};function a($){return o.from($)}function s($){return o.isBuffer($)||$ instanceof i}var l=LA(),u=DA(),c=u.getHighWaterMark,h=rc().codes,d=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_MULTIPLE_CALLBACK,b=h.ERR_STREAM_CANNOT_PIPE,S=h.ERR_STREAM_DESTROYED,x=h.ERR_STREAM_NULL_VALUES,k=h.ERR_STREAM_WRITE_AFTER_END,M=h.ERR_UNKNOWN_ENCODING,P=l.errorOrDestroy;Ht()(K,n);function L(){}function j($,he,X){t=t||el(),$=$||{},typeof X!="boolean"&&(X=he instanceof t),this.objectMode=!!$.objectMode,X&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=c(this,$,"writableHighWaterMark",X),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var se=$.decodeStrings===!1;this.decodeStrings=!se,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(pe){w(he,pe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=$.emitClose!==!1,this.autoDestroy=!!$.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}j.prototype.getBuffer=function(){for(var he=this.bufferedRequest,X=[];he;)X.push(he),he=he.next;return X},function(){try{Object.defineProperty(j.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var V;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(V=Function.prototype[Symbol.hasInstance],Object.defineProperty(K,Symbol.hasInstance,{value:function(he){return V.call(this,he)?!0:this!==K?!1:he&&he._writableState instanceof j}})):V=function(he){return he instanceof this};function K($){t=t||el();var he=this instanceof t;if(!he&&!V.call(K,this))return new K($);this._writableState=new j($,this,he),this.writable=!0,$&&(typeof $.write=="function"&&(this._write=$.write),typeof $.writev=="function"&&(this._writev=$.writev),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.final=="function"&&(this._final=$.final)),n.call(this)}K.prototype.pipe=function(){P(this,new b)};function Z($,he){var X=new k;P($,X),_t.nextTick(he,X)}function ue($,he,X,se){var pe;return X===null?pe=new x:typeof X!="string"&&!he.objectMode&&(pe=new d("chunk",["string","Buffer"],X)),pe?(P($,pe),_t.nextTick(se,pe),!1):!0}K.prototype.write=function($,he,X){var se=this._writableState,pe=!1,W=!se.objectMode&&s($);return W&&!o.isBuffer($)&&($=a($)),typeof he=="function"&&(X=he,he=null),W?he="buffer":he||(he=se.defaultEncoding),typeof X!="function"&&(X=L),se.ending?Z(this,X):(W||ue(this,se,$,X))&&(se.pendingcb++,pe=_(this,se,W,$,he,X)),pe},K.prototype.cork=function(){this._writableState.corked++},K.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&E(this,$))},K.prototype.setDefaultEncoding=function(he){if(typeof he=="string"&&(he=he.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((he+"").toLowerCase())>-1))throw new M(he);return this._writableState.defaultEncoding=he,this},Object.defineProperty(K.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function U($,he,X){return!$.objectMode&&$.decodeStrings!==!1&&typeof he=="string"&&(he=o.from(he,X)),he}Object.defineProperty(K.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function _($,he,X,se,pe,W){if(!X){var q=U(he,se,pe);se!==q&&(X=!0,pe="buffer",se=q)}var ye=he.objectMode?1:se.length;he.length+=ye;var xe=he.length>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,k,M){var P=k.length-1;if(P=0?(L>0&&(x.lastNeed=L-1),L):--P=0?(L>0&&(x.lastNeed=L-2),L):--P=0?(L>0&&(L===2?L=0:x.lastNeed=L-3),L):0))}function s(x,k,M){if((k[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return x.lastNeed=2,"�"}}function l(x){var k=this.lastTotal-this.lastNeed,M=s(this,x);if(M!==void 0)return M;if(this.lastNeed<=x.length)return x.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,k,0,x.length),this.lastNeed-=x.length}function u(x,k){var M=a(this,x,k);if(!this.lastNeed)return x.toString("utf8",k);this.lastTotal=M;var P=x.length-(M-this.lastNeed);return x.copy(this.lastChar,0,P),x.toString("utf8",k,P)}function c(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+"�":k}function h(x,k){if((x.length-k)%2===0){var M=x.toString("utf16le",k);if(M){var P=M.charCodeAt(M.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],M.slice(0,-1)}return M}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",k,x.length-1)}function d(x){var k=x&&x.length?this.write(x):"";if(this.lastNeed){var M=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,M)}return k}function p(x,k){var M=(x.length-k)%3;return M===0?x.toString("base64",k):(this.lastNeed=3-M,this.lastTotal=3,M===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",k,x.length-M))}function v(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function b(x){return x.toString(this.encoding)}function S(x){return x&&x.length?this.write(x):""}return cv}var fv,k8;function x1(){if(k8)return fv;k8=1;var e=rc().codes.ERR_STREAM_PREMATURE_CLOSE;function t(i){var a=!1;return function(){if(!a){a=!0;for(var s=arguments.length,l=new Array(s),u=0;u0)if(typeof q!="string"&&!Q.objectMode&&Object.getPrototypeOf(q)!==n.prototype&&(q=i(q)),xe)Q.endEmitted?L(W,new x):U(W,Q,q,!0);else if(Q.ended)L(W,new b);else{if(Q.destroyed)return!1;Q.reading=!1,Q.decoder&&!ye?(q=Q.decoder.write(q),Q.objectMode||q.length!==0?U(W,Q,q,!1):E(W,Q)):U(W,Q,q,!1)}else xe||(Q.reading=!1,E(W,Q))}return!Q.ended&&(Q.length=y?W=y:(W--,W|=W>>>1,W|=W>>>2,W|=W>>>4,W|=W>>>8,W|=W>>>16,W++),W}function g(W,q){return W<=0||q.length===0&&q.ended?0:q.objectMode?1:W!==W?q.flowing&&q.length?q.buffer.head.data.length:q.length:(W>q.highWaterMark&&(q.highWaterMark=f(W)),W<=q.length?W:q.ended?q.length:(q.needReadable=!0,0))}Z.prototype.read=function(W){l("read",W),W=parseInt(W,10);var q=this._readableState,ye=W;if(W!==0&&(q.emittedReadable=!1),W===0&&q.needReadable&&((q.highWaterMark!==0?q.length>=q.highWaterMark:q.length>0)||q.ended))return l("read: emitReadable",q.length,q.ended),q.length===0&&q.ended?X(this):A(this),null;if(W=g(W,q),W===0&&q.ended)return q.length===0&&X(this),null;var xe=q.needReadable;l("need readable",xe),(q.length===0||q.length-W0?Me=he(W,q):Me=null,Me===null?(q.needReadable=q.length<=q.highWaterMark,W=0):(q.length-=W,q.awaitDrain=0),q.length===0&&(q.ended||(q.needReadable=!0),ye!==W&&q.ended&&X(this)),Me!==null&&this.emit("data",Me),Me};function w(W,q){if(l("onEofChunk"),!q.ended){if(q.decoder){var ye=q.decoder.end();ye&&ye.length&&(q.buffer.push(ye),q.length+=q.objectMode?1:ye.length)}q.ended=!0,q.sync?A(W):(q.needReadable=!1,q.emittedReadable||(q.emittedReadable=!0,T(W)))}}function A(W){var q=W._readableState;l("emitReadable",q.needReadable,q.emittedReadable),q.needReadable=!1,q.emittedReadable||(l("emitReadable",q.flowing),q.emittedReadable=!0,_t.nextTick(T,W))}function T(W){var q=W._readableState;l("emitReadable_",q.destroyed,q.length,q.ended),!q.destroyed&&(q.length||q.ended)&&(W.emit("readable"),q.emittedReadable=!1),q.needReadable=!q.flowing&&!q.ended&&q.length<=q.highWaterMark,$(W)}function E(W,q){q.readingMore||(q.readingMore=!0,_t.nextTick(C,W,q))}function C(W,q){for(;!q.reading&&!q.ended&&(q.length1&&pe(xe.pipes,W)!==-1)&&!me&&(l("false write response, pause",xe.awaitDrain),xe.awaitDrain++),ye.pause())}function Fe(re){l("onerror",re),Y(),W.removeListener("error",Fe),t(W,"error")===0&&L(W,re)}V(W,"error",Fe);function Re(){W.removeListener("finish",le),Y()}W.once("close",Re);function le(){l("onfinish"),W.removeListener("close",Re),Y()}W.once("finish",le);function Y(){l("unpipe"),ye.unpipe(W)}return W.emit("pipe",ye),xe.flowing||(l("pipe resume"),ye.resume()),W};function I(W){return function(){var ye=W._readableState;l("pipeOnDrain",ye.awaitDrain),ye.awaitDrain&&ye.awaitDrain--,ye.awaitDrain===0&&t(W,"data")&&(ye.flowing=!0,$(W))}}Z.prototype.unpipe=function(W){var q=this._readableState,ye={hasUnpiped:!1};if(q.pipesCount===0)return this;if(q.pipesCount===1)return W&&W!==q.pipes?this:(W||(W=q.pipes),q.pipes=null,q.pipesCount=0,q.flowing=!1,W&&W.emit("unpipe",this,ye),this);if(!W){var xe=q.pipes,Me=q.pipesCount;q.pipes=null,q.pipesCount=0,q.flowing=!1;for(var Q=0;Q0,xe.flowing!==!1&&this.resume()):W==="readable"&&!xe.endEmitted&&!xe.readableListening&&(xe.readableListening=xe.needReadable=!0,xe.flowing=!1,xe.emittedReadable=!1,l("on readable",xe.length,xe.reading),xe.length?A(this):xe.reading||_t.nextTick(B,this)),ye},Z.prototype.addListener=Z.prototype.on,Z.prototype.removeListener=function(W,q){var ye=r.prototype.removeListener.call(this,W,q);return W==="readable"&&_t.nextTick(m,this),ye},Z.prototype.removeAllListeners=function(W){var q=r.prototype.removeAllListeners.apply(this,arguments);return(W==="readable"||W===void 0)&&_t.nextTick(m,this),q};function m(W){var q=W._readableState;q.readableListening=W.listenerCount("readable")>0,q.resumeScheduled&&!q.paused?q.flowing=!0:W.listenerCount("data")>0&&W.resume()}function B(W){l("readable nexttick read 0"),W.read(0)}Z.prototype.resume=function(){var W=this._readableState;return W.flowing||(l("resume"),W.flowing=!W.readableListening,ne(this,W)),W.paused=!1,this};function ne(W,q){q.resumeScheduled||(q.resumeScheduled=!0,_t.nextTick(de,W,q))}function de(W,q){l("resume",q.reading),q.reading||W.read(0),q.resumeScheduled=!1,W.emit("resume"),$(W),q.flowing&&!q.reading&&W.read(0)}Z.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function $(W){var q=W._readableState;for(l("flow",q.flowing);q.flowing&&W.read()!==null;);}Z.prototype.wrap=function(W){var q=this,ye=this._readableState,xe=!1;W.on("end",function(){if(l("wrapped end"),ye.decoder&&!ye.ended){var N=ye.decoder.end();N&&N.length&&q.push(N)}q.push(null)}),W.on("data",function(N){if(l("wrapped data"),ye.decoder&&(N=ye.decoder.write(N)),!(ye.objectMode&&N==null)&&!(!ye.objectMode&&(!N||!N.length))){var D=q.push(N);D||(xe=!0,W.pause())}});for(var Me in W)this[Me]===void 0&&typeof W[Me]=="function"&&(this[Me]=function(D){return function(){return W[D].apply(W,arguments)}}(Me));for(var Q=0;Q=q.length?(q.decoder?ye=q.buffer.join(""):q.buffer.length===1?ye=q.buffer.first():ye=q.buffer.concat(q.length),q.buffer.clear()):ye=q.buffer.consume(W,q.decoder),ye}function X(W){var q=W._readableState;l("endReadable",q.endEmitted),q.endEmitted||(q.ended=!0,_t.nextTick(se,q,W))}function se(W,q){if(l("endReadableNT",W.endEmitted,W.length),!W.endEmitted&&W.length===0&&(W.endEmitted=!0,q.readable=!1,q.emit("end"),W.autoDestroy)){var ye=q._writableState;(!ye||ye.autoDestroy&&ye.finished)&&q.destroy()}}typeof Symbol=="function"&&(Z.from=function(W,q){return P===void 0&&(P=rU()),P(Z,W,q)});function pe(W,q){for(var ye=0,xe=W.length;ye0;return s(k,P,L,function(j){S||(S=j),j&&x.forEach(l),!P&&(x.forEach(l),b(S))})});return p.reduce(u)}return vv=h,vv}var R8;function FA(){return R8||(R8=1,function(e,t){t=e.exports=dw(),t.Stream=t,t.Readable=t,t.Writable=fw(),t.Duplex=el(),t.Transform=hw(),t.PassThrough=UA(),t.finished=x1(),t.pipeline=jA()}(FD,Af)),Af}var yv,O8;function zA(){if(O8)return yv;O8=1;var e=Kt().Buffer,t=FA().Transform,r=Ht();function n(i,a){if(!e.isBuffer(i)&&typeof i!="string")throw new TypeError(a+" must be a string or a buffer")}function o(i){t.call(this),this._block=e.allocUnsafe(i),this._blockSize=i,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return r(o,t),o.prototype._transform=function(i,a,s){var l=null;try{this.update(i,a)}catch(u){l=u}s(l)},o.prototype._flush=function(i){var a=null;try{this.push(this.digest())}catch(s){a=s}i(a)},o.prototype.update=function(i,a){if(n(i,"Data"),this._finalized)throw new Error("Digest already called");e.isBuffer(i)||(i=e.from(i,a));for(var s=this._block,l=0;this._blockOffset+i.length-l>=this._blockSize;){for(var u=this._blockOffset;u0;++c)this._length[c]+=h,h=this._length[c]/4294967296|0,h>0&&(this._length[c]-=4294967296*h);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(i){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();i!==void 0&&(a=a.toString(i)),this._block.fill(0),this._blockOffset=0;for(var s=0;s<4;++s)this._length[s]=0;return a},o.prototype._digest=function(){throw new Error("_digest is not implemented")},yv=o,yv}var bv,N8;function pw(){if(N8)return bv;N8=1;var e=Ht(),t=zA(),r=Kt().Buffer,n=new Array(16);function o(){t.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}e(o,t),o.prototype._update=function(){for(var c=n,h=0;h<16;++h)c[h]=this._block.readInt32LE(h*4);var d=this._a,p=this._b,v=this._c,b=this._d;d=a(d,p,v,b,c[0],3614090360,7),b=a(b,d,p,v,c[1],3905402710,12),v=a(v,b,d,p,c[2],606105819,17),p=a(p,v,b,d,c[3],3250441966,22),d=a(d,p,v,b,c[4],4118548399,7),b=a(b,d,p,v,c[5],1200080426,12),v=a(v,b,d,p,c[6],2821735955,17),p=a(p,v,b,d,c[7],4249261313,22),d=a(d,p,v,b,c[8],1770035416,7),b=a(b,d,p,v,c[9],2336552879,12),v=a(v,b,d,p,c[10],4294925233,17),p=a(p,v,b,d,c[11],2304563134,22),d=a(d,p,v,b,c[12],1804603682,7),b=a(b,d,p,v,c[13],4254626195,12),v=a(v,b,d,p,c[14],2792965006,17),p=a(p,v,b,d,c[15],1236535329,22),d=s(d,p,v,b,c[1],4129170786,5),b=s(b,d,p,v,c[6],3225465664,9),v=s(v,b,d,p,c[11],643717713,14),p=s(p,v,b,d,c[0],3921069994,20),d=s(d,p,v,b,c[5],3593408605,5),b=s(b,d,p,v,c[10],38016083,9),v=s(v,b,d,p,c[15],3634488961,14),p=s(p,v,b,d,c[4],3889429448,20),d=s(d,p,v,b,c[9],568446438,5),b=s(b,d,p,v,c[14],3275163606,9),v=s(v,b,d,p,c[3],4107603335,14),p=s(p,v,b,d,c[8],1163531501,20),d=s(d,p,v,b,c[13],2850285829,5),b=s(b,d,p,v,c[2],4243563512,9),v=s(v,b,d,p,c[7],1735328473,14),p=s(p,v,b,d,c[12],2368359562,20),d=l(d,p,v,b,c[5],4294588738,4),b=l(b,d,p,v,c[8],2272392833,11),v=l(v,b,d,p,c[11],1839030562,16),p=l(p,v,b,d,c[14],4259657740,23),d=l(d,p,v,b,c[1],2763975236,4),b=l(b,d,p,v,c[4],1272893353,11),v=l(v,b,d,p,c[7],4139469664,16),p=l(p,v,b,d,c[10],3200236656,23),d=l(d,p,v,b,c[13],681279174,4),b=l(b,d,p,v,c[0],3936430074,11),v=l(v,b,d,p,c[3],3572445317,16),p=l(p,v,b,d,c[6],76029189,23),d=l(d,p,v,b,c[9],3654602809,4),b=l(b,d,p,v,c[12],3873151461,11),v=l(v,b,d,p,c[15],530742520,16),p=l(p,v,b,d,c[2],3299628645,23),d=u(d,p,v,b,c[0],4096336452,6),b=u(b,d,p,v,c[7],1126891415,10),v=u(v,b,d,p,c[14],2878612391,15),p=u(p,v,b,d,c[5],4237533241,21),d=u(d,p,v,b,c[12],1700485571,6),b=u(b,d,p,v,c[3],2399980690,10),v=u(v,b,d,p,c[10],4293915773,15),p=u(p,v,b,d,c[1],2240044497,21),d=u(d,p,v,b,c[8],1873313359,6),b=u(b,d,p,v,c[15],4264355552,10),v=u(v,b,d,p,c[6],2734768916,15),p=u(p,v,b,d,c[13],1309151649,21),d=u(d,p,v,b,c[4],4149444226,6),b=u(b,d,p,v,c[11],3174756917,10),v=u(v,b,d,p,c[2],718787259,15),p=u(p,v,b,d,c[9],3951481745,21),this._a=this._a+d|0,this._b=this._b+p|0,this._c=this._c+v|0,this._d=this._d+b|0},o.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 c=r.allocUnsafe(16);return c.writeInt32LE(this._a,0),c.writeInt32LE(this._b,4),c.writeInt32LE(this._c,8),c.writeInt32LE(this._d,12),c};function i(c,h){return c<>>32-h}function a(c,h,d,p,v,b,S){return i(c+(h&d|~h&p)+v+b|0,S)+h|0}function s(c,h,d,p,v,b,S){return i(c+(h&p|d&~p)+v+b|0,S)+h|0}function l(c,h,d,p,v,b,S){return i(c+(h^d^p)+v+b|0,S)+h|0}function u(c,h,d,p,v,b,S){return i(c+(d^(h|~p))+v+b|0,S)+h|0}return bv=o,bv}var wv,L8;function gw(){if(L8)return wv;L8=1;var e=Oe.Buffer,t=Ht(),r=zA(),n=new Array(16),o=[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],i=[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],a=[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],s=[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],l=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function c(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}t(c,r),c.prototype._update=function(){for(var x=n,k=0;k<16;++k)x[k]=this._block.readInt32LE(k*4);for(var M=this._a|0,P=this._b|0,L=this._c|0,j=this._d|0,V=this._e|0,K=this._a|0,Z=this._b|0,ue=this._c|0,U=this._d|0,_=this._e|0,y=0;y<80;y+=1){var f,g;y<16?(f=d(M,P,L,j,V,x[o[y]],l[0],a[y]),g=S(K,Z,ue,U,_,x[i[y]],u[0],s[y])):y<32?(f=p(M,P,L,j,V,x[o[y]],l[1],a[y]),g=b(K,Z,ue,U,_,x[i[y]],u[1],s[y])):y<48?(f=v(M,P,L,j,V,x[o[y]],l[2],a[y]),g=v(K,Z,ue,U,_,x[i[y]],u[2],s[y])):y<64?(f=b(M,P,L,j,V,x[o[y]],l[3],a[y]),g=p(K,Z,ue,U,_,x[i[y]],u[3],s[y])):(f=S(M,P,L,j,V,x[o[y]],l[4],a[y]),g=d(K,Z,ue,U,_,x[i[y]],u[4],s[y])),M=V,V=j,j=h(L,10),L=P,P=f,K=_,_=U,U=h(ue,10),ue=Z,Z=g}var w=this._b+L+U|0;this._b=this._c+j+_|0,this._c=this._d+V+K|0,this._d=this._e+M+Z|0,this._e=this._a+P+ue|0,this._a=w},c.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 x=e.alloc?e.alloc(20):new e(20);return x.writeInt32LE(this._a,0),x.writeInt32LE(this._b,4),x.writeInt32LE(this._c,8),x.writeInt32LE(this._d,12),x.writeInt32LE(this._e,16),x};function h(x,k){return x<>>32-k}function d(x,k,M,P,L,j,V,K){return h(x+(k^M^P)+j+V|0,K)+L|0}function p(x,k,M,P,L,j,V,K){return h(x+(k&M|~k&P)+j+V|0,K)+L|0}function v(x,k,M,P,L,j,V,K){return h(x+((k|~M)^P)+j+V|0,K)+L|0}function b(x,k,M,P,L,j,V,K){return h(x+(k&P|M&~P)+j+V|0,K)+L|0}function S(x,k,M,P,L,j,V,K){return h(x+(k^(M|~P))+j+V|0,K)+L|0}return wv=c,wv}var np={},nU={get exports(){return np},set exports(e){np=e}},_v,D8;function nc(){if(D8)return _v;D8=1;var e=Kt().Buffer;function t(r,n){this._block=e.alloc(r),this._finalSize=n,this._blockSize=r,this._len=0}return t.prototype.update=function(r,n){typeof r=="string"&&(n=n||"utf8",r=e.from(r,n));for(var o=this._block,i=this._blockSize,a=r.length,s=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var o=this._len*8;if(o<=4294967295)this._block.writeUInt32BE(o,this._blockSize-4);else{var i=(o&4294967295)>>>0,a=(o-i)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return r?s.toString(r):s},t.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_v=t,_v}var xv,U8;function iU(){if(U8)return xv;U8=1;var e=Ht(),t=nc(),r=Kt().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],o=new Array(80);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function a(u){return u<<5|u>>>27}function s(u){return u<<30|u>>>2}function l(u,c,h,d){return u===0?c&h|~c&d:u===2?c&h|c&d|h&d:c^h^d}return i.prototype._update=function(u){for(var c=this._w,h=this._a|0,d=this._b|0,p=this._c|0,v=this._d|0,b=this._e|0,S=0;S<16;++S)c[S]=u.readInt32BE(S*4);for(;S<80;++S)c[S]=c[S-3]^c[S-8]^c[S-14]^c[S-16];for(var x=0;x<80;++x){var k=~~(x/20),M=a(h)+l(k,d,p,v)+b+c[x]+n[k]|0;b=v,v=p,p=s(d),d=h,h=M}this._a=h+this._a|0,this._b=d+this._b|0,this._c=p+this._c|0,this._d=v+this._d|0,this._e=b+this._e|0},i.prototype._hash=function(){var u=r.allocUnsafe(20);return u.writeInt32BE(this._a|0,0),u.writeInt32BE(this._b|0,4),u.writeInt32BE(this._c|0,8),u.writeInt32BE(this._d|0,12),u.writeInt32BE(this._e|0,16),u},xv=i,xv}var Sv,j8;function oU(){if(j8)return Sv;j8=1;var e=Ht(),t=nc(),r=Kt().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],o=new Array(80);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function a(c){return c<<1|c>>>31}function s(c){return c<<5|c>>>27}function l(c){return c<<30|c>>>2}function u(c,h,d,p){return c===0?h&d|~h&p:c===2?h&d|h&p|d&p:h^d^p}return i.prototype._update=function(c){for(var h=this._w,d=this._a|0,p=this._b|0,v=this._c|0,b=this._d|0,S=this._e|0,x=0;x<16;++x)h[x]=c.readInt32BE(x*4);for(;x<80;++x)h[x]=a(h[x-3]^h[x-8]^h[x-14]^h[x-16]);for(var k=0;k<80;++k){var M=~~(k/20),P=s(d)+u(M,p,v,b)+S+h[k]+n[M]|0;S=b,b=v,v=l(p),p=d,d=P}this._a=d+this._a|0,this._b=p+this._b|0,this._c=v+this._c|0,this._d=b+this._d|0,this._e=S+this._e|0},i.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},Sv=i,Sv}var Cv,F8;function $A(){if(F8)return Cv;F8=1;var e=Ht(),t=nc(),r=Kt().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],o=new Array(64);function i(){this.init(),this._w=o,t.call(this,64,56)}e(i,t),i.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 a(d,p,v){return v^d&(p^v)}function s(d,p,v){return d&p|v&(d|p)}function l(d){return(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10)}function u(d){return(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7)}function c(d){return(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3}function h(d){return(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10}return i.prototype._update=function(d){for(var p=this._w,v=this._a|0,b=this._b|0,S=this._c|0,x=this._d|0,k=this._e|0,M=this._f|0,P=this._g|0,L=this._h|0,j=0;j<16;++j)p[j]=d.readInt32BE(j*4);for(;j<64;++j)p[j]=h(p[j-2])+p[j-7]+c(p[j-15])+p[j-16]|0;for(var V=0;V<64;++V){var K=L+u(k)+a(k,M,P)+n[V]+p[V]|0,Z=l(v)+s(v,b,S)|0;L=P,P=M,M=k,k=x+K|0,x=S,S=b,b=v,v=K+Z|0}this._a=v+this._a|0,this._b=b+this._b|0,this._c=S+this._c|0,this._d=x+this._d|0,this._e=k+this._e|0,this._f=M+this._f|0,this._g=P+this._g|0,this._h=L+this._h|0},i.prototype._hash=function(){var d=r.allocUnsafe(32);return d.writeInt32BE(this._a,0),d.writeInt32BE(this._b,4),d.writeInt32BE(this._c,8),d.writeInt32BE(this._d,12),d.writeInt32BE(this._e,16),d.writeInt32BE(this._f,20),d.writeInt32BE(this._g,24),d.writeInt32BE(this._h,28),d},Cv=i,Cv}var Ev,z8;function aU(){if(z8)return Ev;z8=1;var e=Ht(),t=$A(),r=nc(),n=Kt().Buffer,o=new Array(64);function i(){this.init(),this._w=o,r.call(this,64,56)}return e(i,t),i.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},i.prototype._hash=function(){var a=n.allocUnsafe(28);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a},Ev=i,Ev}var kv,$8;function qA(){if($8)return kv;$8=1;var e=Ht(),t=nc(),r=Kt().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],o=new Array(160);function i(){this.init(),this._w=o,t.call(this,128,112)}e(i,t),i.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 a(b,S,x){return x^b&(S^x)}function s(b,S,x){return b&S|x&(b|S)}function l(b,S){return(b>>>28|S<<4)^(S>>>2|b<<30)^(S>>>7|b<<25)}function u(b,S){return(b>>>14|S<<18)^(b>>>18|S<<14)^(S>>>9|b<<23)}function c(b,S){return(b>>>1|S<<31)^(b>>>8|S<<24)^b>>>7}function h(b,S){return(b>>>1|S<<31)^(b>>>8|S<<24)^(b>>>7|S<<25)}function d(b,S){return(b>>>19|S<<13)^(S>>>29|b<<3)^b>>>6}function p(b,S){return(b>>>19|S<<13)^(S>>>29|b<<3)^(b>>>6|S<<26)}function v(b,S){return b>>>0>>0?1:0}return i.prototype._update=function(b){for(var S=this._w,x=this._ah|0,k=this._bh|0,M=this._ch|0,P=this._dh|0,L=this._eh|0,j=this._fh|0,V=this._gh|0,K=this._hh|0,Z=this._al|0,ue=this._bl|0,U=this._cl|0,_=this._dl|0,y=this._el|0,f=this._fl|0,g=this._gl|0,w=this._hl|0,A=0;A<32;A+=2)S[A]=b.readInt32BE(A*4),S[A+1]=b.readInt32BE(A*4+4);for(;A<160;A+=2){var T=S[A-30],E=S[A-15*2+1],C=c(T,E),I=h(E,T);T=S[A-2*2],E=S[A-2*2+1];var m=d(T,E),B=p(E,T),ne=S[A-7*2],de=S[A-7*2+1],$=S[A-16*2],he=S[A-16*2+1],X=I+de|0,se=C+ne+v(X,I)|0;X=X+B|0,se=se+m+v(X,B)|0,X=X+he|0,se=se+$+v(X,he)|0,S[A]=se,S[A+1]=X}for(var pe=0;pe<160;pe+=2){se=S[pe],X=S[pe+1];var W=s(x,k,M),q=s(Z,ue,U),ye=l(x,Z),xe=l(Z,x),Me=u(L,y),Q=u(y,L),N=n[pe],D=n[pe+1],G=a(L,j,V),me=a(y,f,g),_e=w+Q|0,Pe=K+Me+v(_e,w)|0;_e=_e+me|0,Pe=Pe+G+v(_e,me)|0,_e=_e+D|0,Pe=Pe+N+v(_e,D)|0,_e=_e+X|0,Pe=Pe+se+v(_e,X)|0;var Fe=xe+q|0,Re=ye+W+v(Fe,xe)|0;K=V,w=g,V=j,g=f,j=L,f=y,y=_+_e|0,L=P+Pe+v(y,_)|0,P=M,_=U,M=k,U=ue,k=x,ue=Z,Z=_e+Fe|0,x=Pe+Re+v(Z,_e)|0}this._al=this._al+Z|0,this._bl=this._bl+ue|0,this._cl=this._cl+U|0,this._dl=this._dl+_|0,this._el=this._el+y|0,this._fl=this._fl+f|0,this._gl=this._gl+g|0,this._hl=this._hl+w|0,this._ah=this._ah+x+v(this._al,Z)|0,this._bh=this._bh+k+v(this._bl,ue)|0,this._ch=this._ch+M+v(this._cl,U)|0,this._dh=this._dh+P+v(this._dl,_)|0,this._eh=this._eh+L+v(this._el,y)|0,this._fh=this._fh+j+v(this._fl,f)|0,this._gh=this._gh+V+v(this._gl,g)|0,this._hh=this._hh+K+v(this._hl,w)|0},i.prototype._hash=function(){var b=r.allocUnsafe(64);function S(x,k,M){b.writeInt32BE(x,M),b.writeInt32BE(k,M+4)}return S(this._ah,this._al,0),S(this._bh,this._bl,8),S(this._ch,this._cl,16),S(this._dh,this._dl,24),S(this._eh,this._el,32),S(this._fh,this._fl,40),S(this._gh,this._gl,48),S(this._hh,this._hl,56),b},kv=i,kv}var Av,q8;function sU(){if(q8)return Av;q8=1;var e=Ht(),t=qA(),r=nc(),n=Kt().Buffer,o=new Array(160);function i(){this.init(),this._w=o,r.call(this,128,112)}return e(i,t),i.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},i.prototype._hash=function(){var a=n.allocUnsafe(48);function s(l,u,c){a.writeInt32BE(l,c),a.writeInt32BE(u,c+4)}return s(this._ah,this._al,0),s(this._bh,this._bl,8),s(this._ch,this._cl,16),s(this._dh,this._dl,24),s(this._eh,this._el,32),s(this._fh,this._fl,40),a},Av=i,Av}var W8;function mw(){if(W8)return np;W8=1;var e=nU.exports=function(r){r=r.toLowerCase();var n=e[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n};return e.sha=iU(),e.sha1=oU(),e.sha224=aU(),e.sha256=$A(),e.sha384=sU(),e.sha512=qA(),np}var Mv,V8;function lU(){if(V8)return Mv;V8=1,Mv=r;var e=sw().EventEmitter,t=Ht();t(r,e),r.Readable=dw(),r.Writable=fw(),r.Duplex=el(),r.Transform=hw(),r.PassThrough=UA(),r.finished=x1(),r.pipeline=jA(),r.Stream=r;function r(){e.call(this)}return r.prototype.pipe=function(n,o){var i=this;function a(p){n.writable&&n.write(p)===!1&&i.pause&&i.pause()}i.on("data",a);function s(){i.readable&&i.resume&&i.resume()}n.on("drain",s),!n._isStdio&&(!o||o.end!==!1)&&(i.on("end",u),i.on("close",c));var l=!1;function u(){l||(l=!0,n.end())}function c(){l||(l=!0,typeof n.destroy=="function"&&n.destroy())}function h(p){if(d(),e.listenerCount(this,"error")===0)throw p}i.on("error",h),n.on("error",h);function d(){i.removeListener("data",a),n.removeListener("drain",s),i.removeListener("end",u),i.removeListener("close",c),i.removeListener("error",h),n.removeListener("error",h),i.removeListener("end",d),i.removeListener("close",d),n.removeListener("close",d)}return i.on("end",d),i.on("close",d),n.on("close",d),n.emit("pipe",i),n},Mv}var Iv,H8;function ds(){if(H8)return Iv;H8=1;var e=Kt().Buffer,t=lU().Transform,r=Gb().StringDecoder,n=Ht();function o(i){t.call(this),this.hashMode=typeof i=="string",this.hashMode?this[i]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return n(o,t),o.prototype.update=function(i,a,s){typeof i=="string"&&(i=e.from(i,a));var l=this._update(i);return this.hashMode?this:(s&&(l=this._toString(l,s)),l)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(i,a,s){var l;try{this.hashMode?this._update(i):this.push(this._update(i))}catch(u){l=u}finally{s(l)}},o.prototype._flush=function(i){var a;try{this.push(this.__final())}catch(s){a=s}i(a)},o.prototype._finalOrDigest=function(i){var a=this.__final()||e.alloc(0);return i&&(a=this._toString(a,i,!0)),a},o.prototype._toString=function(i,a,s){if(this._decoder||(this._decoder=new r(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var l=this._decoder.write(i);return s&&(l+=this._decoder.end()),l},Iv=o,Iv}var Tv,K8;function $d(){if(K8)return Tv;K8=1;var e=Ht(),t=pw(),r=gw(),n=mw(),o=ds();function i(a){o.call(this,"digest"),this._hash=a}return e(i,o),i.prototype._update=function(a){this._hash.update(a)},i.prototype._final=function(){return this._hash.digest()},Tv=function(s){return s=s.toLowerCase(),s==="md5"?new t:s==="rmd160"||s==="ripemd160"?new r:new i(n(s))},Tv}var Bv,Z8;function uU(){if(Z8)return Bv;Z8=1;var e=Ht(),t=Kt().Buffer,r=ds(),n=t.alloc(128),o=64;function i(a,s){r.call(this,"digest"),typeof s=="string"&&(s=t.from(s)),this._alg=a,this._key=s,s.length>o?s=a(s):s.lengthh){var d=u==="rmd160"?new i:a(u);c=d.update(c).digest()}else c.lengthe||r!==r)throw new TypeError("Bad key length")},Ov}var Nv,J8;function ZA(){if(J8)return Nv;J8=1;var e;if(Ke.process&&Ke.process.browser)e="utf-8";else if(Ke.process&&Ke.process.version){var t=parseInt(_t.version.split(".")[0].slice(1),10);e=t>=6?"utf-8":"binary"}else e="utf-8";return Nv=e,Nv}var Lv,e9;function GA(){if(e9)return Lv;e9=1;var e=Kt().Buffer;return Lv=function(t,r,n){if(e.isBuffer(t))return t;if(typeof t=="string")return e.from(t,r);if(ArrayBuffer.isView(t))return e.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},Lv}var Dv,t9;function YA(){if(t9)return Dv;t9=1;var e=WA(),t=gw(),r=mw(),n=Kt().Buffer,o=KA(),i=ZA(),a=GA(),s=n.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function u(d,p,v){var b=c(d),S=d==="sha512"||d==="sha384"?128:64;p.length>S?p=b(p):p.length>>0},oi.writeUInt32BE=function(o,i,a){o[0+a]=i>>>24,o[1+a]=i>>>16&255,o[2+a]=i>>>8&255,o[3+a]=i&255},oi.ip=function(o,i,a,s){for(var l=0,u=0,c=6;c>=0;c-=2){for(var h=0;h<=24;h+=8)l<<=1,l|=i>>>h+c&1;for(var h=0;h<=24;h+=8)l<<=1,l|=o>>>h+c&1}for(var c=6;c>=0;c-=2){for(var h=1;h<=25;h+=8)u<<=1,u|=i>>>h+c&1;for(var h=1;h<=25;h+=8)u<<=1,u|=o>>>h+c&1}a[s+0]=l>>>0,a[s+1]=u>>>0},oi.rip=function(o,i,a,s){for(var l=0,u=0,c=0;c<4;c++)for(var h=24;h>=0;h-=8)l<<=1,l|=i>>>h+c&1,l<<=1,l|=o>>>h+c&1;for(var c=4;c<8;c++)for(var h=24;h>=0;h-=8)u<<=1,u|=i>>>h+c&1,u<<=1,u|=o>>>h+c&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.pc1=function(o,i,a,s){for(var l=0,u=0,c=7;c>=5;c--){for(var h=0;h<=24;h+=8)l<<=1,l|=i>>h+c&1;for(var h=0;h<=24;h+=8)l<<=1,l|=o>>h+c&1}for(var h=0;h<=24;h+=8)l<<=1,l|=i>>h+c&1;for(var c=1;c<=3;c++){for(var h=0;h<=24;h+=8)u<<=1,u|=i>>h+c&1;for(var h=0;h<=24;h+=8)u<<=1,u|=o>>h+c&1}for(var h=0;h<=24;h+=8)u<<=1,u|=o>>h+c&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.r28shl=function(o,i){return o<>>28-i};var e=[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];oi.pc2=function(o,i,a,s){for(var l=0,u=0,c=e.length>>>1,h=0;h>>e[h]&1;for(var h=c;h>>e[h]&1;a[s+0]=l>>>0,a[s+1]=u>>>0},oi.expand=function(o,i,a){var s=0,l=0;s=(o&1)<<5|o>>>27;for(var u=23;u>=15;u-=4)s<<=6,s|=o>>>u&63;for(var u=11;u>=3;u-=4)l|=o>>>u&63,l<<=6;l|=(o&31)<<1|o>>>31,i[a+0]=s>>>0,i[a+1]=l>>>0};var t=[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];oi.substitute=function(o,i){for(var a=0,s=0;s<4;s++){var l=o>>>18-s*6&63,u=t[s*64+l];a<<=4,a|=u}for(var s=0;s<4;s++){var l=i>>>18-s*6&63,u=t[4*64+s*64+l];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 oi.permute=function(o){for(var i=0,a=0;a>>r[a]&1;return i>>>0},oi.padSplit=function(o,i,a){for(var s=o.toString(2);s.length0;a--)o+=this._buffer(n,o),i+=this._flushBuffer(s,i);return o+=this._buffer(n,o),s},t.prototype.final=function(n){var o;n&&(o=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),o?o.concat(i):i},t.prototype._pad=function(n,o){if(o===0)return!1;for(;o>>1];c=r.r28shl(c,p),h=r.r28shl(h,p),r.pc2(c,h,l.keys,d)}},i.prototype._update=function(l,u,c,h){var d=this._desState,p=r.readUInt32BE(l,u),v=r.readUInt32BE(l,u+4);r.ip(p,v,d.tmp,0),p=d.tmp[0],v=d.tmp[1],this.type==="encrypt"?this._encrypt(d,p,v,d.tmp,0):this._decrypt(d,p,v,d.tmp,0),p=d.tmp[0],v=d.tmp[1],r.writeUInt32BE(c,p,h),r.writeUInt32BE(c,v,h+4)},i.prototype._pad=function(l,u){for(var c=l.length-u,h=u;h>>0,p=P}r.rip(v,p,h,d)},i.prototype._decrypt=function(l,u,c,h,d){for(var p=c,v=u,b=l.keys.length-2;b>=0;b-=2){var S=l.keys[b],x=l.keys[b+1];r.expand(p,l.tmp,0),S^=l.tmp[0],x^=l.tmp[1];var k=r.substitute(S,x),M=r.permute(k),P=p;p=(v^M)>>>0,v=P}r.rip(p,v,h,d)},zv}var $v={},l9;function CU(){if(l9)return $v;l9=1;var e=Ri(),t=Ht(),r={};function n(i){e.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var a=0;a>s%8,n._prev=r(n._prev,i?c:h);return u}function r(n,o){var i=n.length,a=-1,s=e.allocUnsafe(n.length);for(n=e.concat([n,e.from([o])]);++a>7;return s}return Zv.encrypt=function(n,o,i){for(var a=o.length,s=e.allocUnsafe(a),l=-1;++l>>24]^p[x>>>16&255]^v[k>>>8&255]^b[M&255]^l[K++],L=d[x>>>24]^p[k>>>16&255]^v[M>>>8&255]^b[S&255]^l[K++],j=d[k>>>24]^p[M>>>16&255]^v[S>>>8&255]^b[x&255]^l[K++],V=d[M>>>24]^p[S>>>16&255]^v[x>>>8&255]^b[k&255]^l[K++],S=P,x=L,k=j,M=V;return P=(c[S>>>24]<<24|c[x>>>16&255]<<16|c[k>>>8&255]<<8|c[M&255])^l[K++],L=(c[x>>>24]<<24|c[k>>>16&255]<<16|c[M>>>8&255]<<8|c[S&255])^l[K++],j=(c[k>>>24]<<24|c[M>>>16&255]<<16|c[S>>>8&255]<<8|c[x&255])^l[K++],V=(c[M>>>24]<<24|c[S>>>16&255]<<16|c[x>>>8&255]<<8|c[k&255])^l[K++],P=P>>>0,L=L>>>0,j=j>>>0,V=V>>>0,[P,L,j,V]}var o=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var s=new Array(256),l=0;l<256;l++)l<128?s[l]=l<<1:s[l]=l<<1^283;for(var u=[],c=[],h=[[],[],[],[]],d=[[],[],[],[]],p=0,v=0,b=0;b<256;++b){var S=v^v<<1^v<<2^v<<3^v<<4;S=S>>>8^S&255^99,u[p]=S,c[S]=p;var x=s[p],k=s[x],M=s[k],P=s[S]*257^S*16843008;h[0][p]=P<<24|P>>>8,h[1][p]=P<<16|P>>>16,h[2][p]=P<<8|P>>>24,h[3][p]=P,P=M*16843009^k*65537^x*257^p*16843008,d[0][S]=P<<24|P>>>8,d[1][S]=P<<16|P>>>16,d[2][S]=P<<8|P>>>24,d[3][S]=P,p===0?p=v=1:(p=x^s[s[s[M^x]]],v^=s[s[v]])}return{SBOX:u,INV_SBOX:c,SUB_MIX:h,INV_SUB_MIX:d}}();function a(s){this._key=t(s),this._reset()}return a.blockSize=4*4,a.keySize=256/8,a.prototype.blockSize=a.blockSize,a.prototype.keySize=a.keySize,a.prototype._reset=function(){for(var s=this._key,l=s.length,u=l+6,c=(u+1)*4,h=[],d=0;d>>24,p=i.SBOX[p>>>24]<<24|i.SBOX[p>>>16&255]<<16|i.SBOX[p>>>8&255]<<8|i.SBOX[p&255],p^=o[d/l|0]<<24):l>6&&d%l===4&&(p=i.SBOX[p>>>24]<<24|i.SBOX[p>>>16&255]<<16|i.SBOX[p>>>8&255]<<8|i.SBOX[p&255]),h[d]=h[d-l]^p}for(var v=[],b=0;b>>24]]^i.INV_SUB_MIX[1][i.SBOX[x>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[x>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[x&255]]}this._nRounds=u,this._keySchedule=h,this._invKeySchedule=v},a.prototype.encryptBlockRaw=function(s){return s=t(s),n(s,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},a.prototype.encryptBlock=function(s){var l=this.encryptBlockRaw(s),u=e.allocUnsafe(16);return u.writeUInt32BE(l[0],0),u.writeUInt32BE(l[1],4),u.writeUInt32BE(l[2],8),u.writeUInt32BE(l[3],12),u},a.prototype.decryptBlock=function(s){s=t(s);var l=s[1];s[1]=s[3],s[3]=l;var u=n(s,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),c=e.allocUnsafe(16);return c.writeUInt32BE(u[0],0),c.writeUInt32BE(u[3],4),c.writeUInt32BE(u[2],8),c.writeUInt32BE(u[1],12),c},a.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},Jv.AES=a,Jv}var ey,C9;function DU(){if(C9)return ey;C9=1;var e=Kt().Buffer,t=e.alloc(16,0);function r(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var a=e.allocUnsafe(16);return a.writeUInt32BE(i[0]>>>0,0),a.writeUInt32BE(i[1]>>>0,4),a.writeUInt32BE(i[2]>>>0,8),a.writeUInt32BE(i[3]>>>0,12),a}function o(i){this.h=i,this.state=e.alloc(16,0),this.cache=e.allocUnsafe(0)}return o.prototype.ghash=function(i){for(var a=-1;++a0;s--)i[s]=i[s]>>>1|(i[s-1]&1)<<31;i[0]=i[0]>>>1,u&&(i[0]=i[0]^225<<24)}this.state=n(a)},o.prototype.update=function(i){this.cache=e.concat([this.cache,i]);for(var a;this.cache.length>=16;)a=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(a)},o.prototype.final=function(i,a){return this.cache.length&&this.ghash(e.concat([this.cache,t],16)),this.ghash(n([0,i,0,a])),this.state},ey=o,ey}var ty,E9;function rM(){if(E9)return ty;E9=1;var e=S1(),t=Kt().Buffer,r=ds(),n=Ht(),o=DU(),i=qd(),a=eM();function s(c,h){var d=0;c.length!==h.length&&d++;for(var p=Math.min(c.length,h.length),v=0;v0||a>0;){var h=new t;h.update(c),h.update(n),o&&h.update(o),c=h.digest();var d=0;if(s>0){var p=l.length-s;d=Math.min(s,c.length),c.copy(l,p,0,d),s-=d}if(d0){var v=u.length-a,b=Math.min(a,c.length-d);c.copy(u,v,d,d+b),a-=b}}return c.fill(0),{key:l,iv:u}}return ny=r,ny}var M9;function UU(){if(M9)return Uh;M9=1;var e=yw(),t=rM(),r=Kt().Buffer,n=nM(),o=ds(),i=S1(),a=C1(),s=Ht();function l(p,v,b){o.call(this),this._cache=new c,this._cipher=new i.AES(v),this._prev=r.from(b),this._mode=p,this._autopadding=!0}s(l,o),l.prototype._update=function(p){this._cache.add(p);for(var v,b,S=[];v=this._cache.get();)b=this._mode.encrypt(this,v),S.push(b);return r.concat(S)};var u=r.alloc(16,16);l.prototype._final=function(){var p=this._cache.flush();if(this._autopadding)return p=this._mode.encrypt(this,p),this._cipher.scrub(),p;if(!p.equals(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(p){return this._autopadding=!!p,this};function c(){this.cache=r.allocUnsafe(0)}c.prototype.add=function(p){this.cache=r.concat([this.cache,p])},c.prototype.get=function(){if(this.cache.length>15){var p=this.cache.slice(0,16);return this.cache=this.cache.slice(16),p}return null},c.prototype.flush=function(){for(var p=16-this.cache.length,v=r.allocUnsafe(p),b=-1;++b16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v}else if(this.cache.length>=16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache};function c(p){var v=p[15];if(v<1||v>16)throw new Error("unable to decrypt data");for(var b=-1;++b0?_:y},i.min=function(_,y){return _.cmp(y)<0?_:y},i.prototype._init=function(_,y,f){if(typeof _=="number")return this._initNumber(_,y,f);if(typeof _=="object")return this._initArray(_,y,f);y==="hex"&&(y=16),n(y===(y|0)&&y>=2&&y<=36),_=_.toString().replace(/\s+/g,"");var g=0;_[0]==="-"&&(g++,this.negative=1),g<_.length&&(y===16?this._parseHex(_,g,f):(this._parseBase(_,y,g),f==="le"&&this._initArray(this.toArray(),y,f)))},i.prototype._initNumber=function(_,y,f){_<0&&(this.negative=1,_=-_),_<67108864?(this.words=[_&67108863],this.length=1):_<4503599627370496?(this.words=[_&67108863,_/67108864&67108863],this.length=2):(n(_<9007199254740992),this.words=[_&67108863,_/67108864&67108863,1],this.length=3),f==="le"&&this._initArray(this.toArray(),y,f)},i.prototype._initArray=function(_,y,f){if(n(typeof _.length=="number"),_.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(_.length/3),this.words=new Array(this.length);for(var g=0;g=0;g-=3)A=_[g]|_[g-1]<<8|_[g-2]<<16,this.words[w]|=A<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);else if(f==="le")for(g=0,w=0;g<_.length;g+=3)A=_[g]|_[g+1]<<8|_[g+2]<<16,this.words[w]|=A<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);return this.strip()};function s(U,_){var y=U.charCodeAt(_);return y>=65&&y<=70?y-55:y>=97&&y<=102?y-87:y-48&15}function l(U,_,y){var f=s(U,y);return y-1>=_&&(f|=s(U,y-1)<<4),f}i.prototype._parseHex=function(_,y,f){this.length=Math.ceil((_.length-y)/6),this.words=new Array(this.length);for(var g=0;g=y;g-=2)T=l(_,y,g)<=18?(w-=18,A+=1,this.words[A]|=T>>>26):w+=8;else{var E=_.length-y;for(g=E%2===0?y+1:y;g<_.length;g+=2)T=l(_,y,g)<=18?(w-=18,A+=1,this.words[A]|=T>>>26):w+=8}this.strip()};function u(U,_,y,f){for(var g=0,w=Math.min(U.length,y),A=_;A=49?g+=T-49+10:T>=17?g+=T-17+10:g+=T}return g}i.prototype._parseBase=function(_,y,f){this.words=[0],this.length=1;for(var g=0,w=1;w<=67108863;w*=y)g++;g--,w=w/y|0;for(var A=_.length-f,T=A%g,E=Math.min(A,A-T)+f,C=0,I=f;I1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var c=["","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],d=[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];i.prototype.toString=function(_,y){_=_||10,y=y|0||1;var f;if(_===16||_==="hex"){f="";for(var g=0,w=0,A=0;A>>24-g&16777215,w!==0||A!==this.length-1?f=c[6-E.length]+E+f:f=E+f,g+=2,g>=26&&(g-=26,A--)}for(w!==0&&(f=w.toString(16)+f);f.length%y!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(_===(_|0)&&_>=2&&_<=36){var C=h[_],I=d[_];f="";var m=this.clone();for(m.negative=0;!m.isZero();){var B=m.modn(I).toString(_);m=m.idivn(I),m.isZero()?f=B+f:f=c[C-B.length]+B+f}for(this.isZero()&&(f="0"+f);f.length%y!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var _=this.words[0];return this.length===2?_+=this.words[1]*67108864:this.length===3&&this.words[2]===1?_+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-_:_},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(_,y){return n(typeof a<"u"),this.toArrayLike(a,_,y)},i.prototype.toArray=function(_,y){return this.toArrayLike(Array,_,y)},i.prototype.toArrayLike=function(_,y,f){var g=this.byteLength(),w=f||Math.max(1,g);n(g<=w,"byte array longer than desired length"),n(w>0,"Requested array length <= 0"),this.strip();var A=y==="le",T=new _(w),E,C,I=this.clone();if(A){for(C=0;!I.isZero();C++)E=I.andln(255),I.iushrn(8),T[C]=E;for(;C=4096&&(f+=13,y>>>=13),y>=64&&(f+=7,y>>>=7),y>=8&&(f+=4,y>>>=4),y>=2&&(f+=2,y>>>=2),f+y},i.prototype._zeroBits=function(_){if(_===0)return 26;var y=_,f=0;return y&8191||(f+=13,y>>>=13),y&127||(f+=7,y>>>=7),y&15||(f+=4,y>>>=4),y&3||(f+=2,y>>>=2),y&1||f++,f},i.prototype.bitLength=function(){var _=this.words[this.length-1],y=this._countBits(_);return(this.length-1)*26+y};function p(U){for(var _=new Array(U.bitLength()),y=0;y<_.length;y++){var f=y/26|0,g=y%26;_[y]=(U.words[f]&1<>>g}return _}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var _=0,y=0;y_.length?this.clone().ior(_):_.clone().ior(this)},i.prototype.uor=function(_){return this.length>_.length?this.clone().iuor(_):_.clone().iuor(this)},i.prototype.iuand=function(_){var y;this.length>_.length?y=_:y=this;for(var f=0;f_.length?this.clone().iand(_):_.clone().iand(this)},i.prototype.uand=function(_){return this.length>_.length?this.clone().iuand(_):_.clone().iuand(this)},i.prototype.iuxor=function(_){var y,f;this.length>_.length?(y=this,f=_):(y=_,f=this);for(var g=0;g_.length?this.clone().ixor(_):_.clone().ixor(this)},i.prototype.uxor=function(_){return this.length>_.length?this.clone().iuxor(_):_.clone().iuxor(this)},i.prototype.inotn=function(_){n(typeof _=="number"&&_>=0);var y=Math.ceil(_/26)|0,f=_%26;this._expand(y),f>0&&y--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},i.prototype.notn=function(_){return this.clone().inotn(_)},i.prototype.setn=function(_,y){n(typeof _=="number"&&_>=0);var f=_/26|0,g=_%26;return this._expand(f+1),y?this.words[f]=this.words[f]|1<_.length?(f=this,g=_):(f=_,g=this);for(var w=0,A=0;A>>26;for(;w!==0&&A>>26;if(this.length=f.length,w!==0)this.words[this.length]=w,this.length++;else if(f!==this)for(;A_.length?this.clone().iadd(_):_.clone().iadd(this)},i.prototype.isub=function(_){if(_.negative!==0){_.negative=0;var y=this.iadd(_);return _.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(_),this.negative=1,this._normSign();var f=this.cmp(_);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,w;f>0?(g=this,w=_):(g=_,w=this);for(var A=0,T=0;T>26,this.words[T]=y&67108863;for(;A!==0&&T>26,this.words[T]=y&67108863;if(A===0&&T>>26,m=E&67108863,B=Math.min(C,_.length-1),ne=Math.max(0,C-U.length+1);ne<=B;ne++){var de=C-ne|0;g=U.words[de]|0,w=_.words[ne]|0,A=g*w+m,I+=A/67108864|0,m=A&67108863}y.words[C]=m|0,E=I|0}return E!==0?y.words[C]=E|0:y.length--,y.strip()}var b=function(_,y,f){var g=_.words,w=y.words,A=f.words,T=0,E,C,I,m=g[0]|0,B=m&8191,ne=m>>>13,de=g[1]|0,$=de&8191,he=de>>>13,X=g[2]|0,se=X&8191,pe=X>>>13,W=g[3]|0,q=W&8191,ye=W>>>13,xe=g[4]|0,Me=xe&8191,Q=xe>>>13,N=g[5]|0,D=N&8191,G=N>>>13,me=g[6]|0,_e=me&8191,Pe=me>>>13,Fe=g[7]|0,Re=Fe&8191,le=Fe>>>13,Y=g[8]|0,re=Y&8191,ge=Y>>>13,be=g[9]|0,ce=be&8191,Ie=be>>>13,ke=w[0]|0,Te=ke&8191,ze=ke>>>13,We=w[1]|0,Ne=We&8191,Ze=We>>>13,De=w[2]|0,Le=De&8191,gt=De>>>13,rt=w[3]|0,Ye=rt&8191,kt=rt>>>13,ht=w[4]|0,tt=ht&8191,Nt=ht>>>13,It=w[5]|0,ut=It&8191,Yt=It>>>13,Tt=w[6]|0,at=Tt&8191,lr=Tt>>>13,z=w[7]|0,J=z&8191,ee=z>>>13,O=w[8]|0,te=O&8191,Ae=O>>>13,Ee=w[9]|0,Be=Ee&8191,qe=Ee>>>13;f.negative=_.negative^y.negative,f.length=19,E=Math.imul(B,Te),C=Math.imul(B,ze),C=C+Math.imul(ne,Te)|0,I=Math.imul(ne,ze);var He=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(He>>>26)|0,He&=67108863,E=Math.imul($,Te),C=Math.imul($,ze),C=C+Math.imul(he,Te)|0,I=Math.imul(he,ze),E=E+Math.imul(B,Ne)|0,C=C+Math.imul(B,Ze)|0,C=C+Math.imul(ne,Ne)|0,I=I+Math.imul(ne,Ze)|0;var $e=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+($e>>>26)|0,$e&=67108863,E=Math.imul(se,Te),C=Math.imul(se,ze),C=C+Math.imul(pe,Te)|0,I=Math.imul(pe,ze),E=E+Math.imul($,Ne)|0,C=C+Math.imul($,Ze)|0,C=C+Math.imul(he,Ne)|0,I=I+Math.imul(he,Ze)|0,E=E+Math.imul(B,Le)|0,C=C+Math.imul(B,gt)|0,C=C+Math.imul(ne,Le)|0,I=I+Math.imul(ne,gt)|0;var Lt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,E=Math.imul(q,Te),C=Math.imul(q,ze),C=C+Math.imul(ye,Te)|0,I=Math.imul(ye,ze),E=E+Math.imul(se,Ne)|0,C=C+Math.imul(se,Ze)|0,C=C+Math.imul(pe,Ne)|0,I=I+Math.imul(pe,Ze)|0,E=E+Math.imul($,Le)|0,C=C+Math.imul($,gt)|0,C=C+Math.imul(he,Le)|0,I=I+Math.imul(he,gt)|0,E=E+Math.imul(B,Ye)|0,C=C+Math.imul(B,kt)|0,C=C+Math.imul(ne,Ye)|0,I=I+Math.imul(ne,kt)|0;var ot=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(ot>>>26)|0,ot&=67108863,E=Math.imul(Me,Te),C=Math.imul(Me,ze),C=C+Math.imul(Q,Te)|0,I=Math.imul(Q,ze),E=E+Math.imul(q,Ne)|0,C=C+Math.imul(q,Ze)|0,C=C+Math.imul(ye,Ne)|0,I=I+Math.imul(ye,Ze)|0,E=E+Math.imul(se,Le)|0,C=C+Math.imul(se,gt)|0,C=C+Math.imul(pe,Le)|0,I=I+Math.imul(pe,gt)|0,E=E+Math.imul($,Ye)|0,C=C+Math.imul($,kt)|0,C=C+Math.imul(he,Ye)|0,I=I+Math.imul(he,kt)|0,E=E+Math.imul(B,tt)|0,C=C+Math.imul(B,Nt)|0,C=C+Math.imul(ne,tt)|0,I=I+Math.imul(ne,Nt)|0;var vt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(vt>>>26)|0,vt&=67108863,E=Math.imul(D,Te),C=Math.imul(D,ze),C=C+Math.imul(G,Te)|0,I=Math.imul(G,ze),E=E+Math.imul(Me,Ne)|0,C=C+Math.imul(Me,Ze)|0,C=C+Math.imul(Q,Ne)|0,I=I+Math.imul(Q,Ze)|0,E=E+Math.imul(q,Le)|0,C=C+Math.imul(q,gt)|0,C=C+Math.imul(ye,Le)|0,I=I+Math.imul(ye,gt)|0,E=E+Math.imul(se,Ye)|0,C=C+Math.imul(se,kt)|0,C=C+Math.imul(pe,Ye)|0,I=I+Math.imul(pe,kt)|0,E=E+Math.imul($,tt)|0,C=C+Math.imul($,Nt)|0,C=C+Math.imul(he,tt)|0,I=I+Math.imul(he,Nt)|0,E=E+Math.imul(B,ut)|0,C=C+Math.imul(B,Yt)|0,C=C+Math.imul(ne,ut)|0,I=I+Math.imul(ne,Yt)|0;var yt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(yt>>>26)|0,yt&=67108863,E=Math.imul(_e,Te),C=Math.imul(_e,ze),C=C+Math.imul(Pe,Te)|0,I=Math.imul(Pe,ze),E=E+Math.imul(D,Ne)|0,C=C+Math.imul(D,Ze)|0,C=C+Math.imul(G,Ne)|0,I=I+Math.imul(G,Ze)|0,E=E+Math.imul(Me,Le)|0,C=C+Math.imul(Me,gt)|0,C=C+Math.imul(Q,Le)|0,I=I+Math.imul(Q,gt)|0,E=E+Math.imul(q,Ye)|0,C=C+Math.imul(q,kt)|0,C=C+Math.imul(ye,Ye)|0,I=I+Math.imul(ye,kt)|0,E=E+Math.imul(se,tt)|0,C=C+Math.imul(se,Nt)|0,C=C+Math.imul(pe,tt)|0,I=I+Math.imul(pe,Nt)|0,E=E+Math.imul($,ut)|0,C=C+Math.imul($,Yt)|0,C=C+Math.imul(he,ut)|0,I=I+Math.imul(he,Yt)|0,E=E+Math.imul(B,at)|0,C=C+Math.imul(B,lr)|0,C=C+Math.imul(ne,at)|0,I=I+Math.imul(ne,lr)|0;var Ct=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,E=Math.imul(Re,Te),C=Math.imul(Re,ze),C=C+Math.imul(le,Te)|0,I=Math.imul(le,ze),E=E+Math.imul(_e,Ne)|0,C=C+Math.imul(_e,Ze)|0,C=C+Math.imul(Pe,Ne)|0,I=I+Math.imul(Pe,Ze)|0,E=E+Math.imul(D,Le)|0,C=C+Math.imul(D,gt)|0,C=C+Math.imul(G,Le)|0,I=I+Math.imul(G,gt)|0,E=E+Math.imul(Me,Ye)|0,C=C+Math.imul(Me,kt)|0,C=C+Math.imul(Q,Ye)|0,I=I+Math.imul(Q,kt)|0,E=E+Math.imul(q,tt)|0,C=C+Math.imul(q,Nt)|0,C=C+Math.imul(ye,tt)|0,I=I+Math.imul(ye,Nt)|0,E=E+Math.imul(se,ut)|0,C=C+Math.imul(se,Yt)|0,C=C+Math.imul(pe,ut)|0,I=I+Math.imul(pe,Yt)|0,E=E+Math.imul($,at)|0,C=C+Math.imul($,lr)|0,C=C+Math.imul(he,at)|0,I=I+Math.imul(he,lr)|0,E=E+Math.imul(B,J)|0,C=C+Math.imul(B,ee)|0,C=C+Math.imul(ne,J)|0,I=I+Math.imul(ne,ee)|0;var St=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(St>>>26)|0,St&=67108863,E=Math.imul(re,Te),C=Math.imul(re,ze),C=C+Math.imul(ge,Te)|0,I=Math.imul(ge,ze),E=E+Math.imul(Re,Ne)|0,C=C+Math.imul(Re,Ze)|0,C=C+Math.imul(le,Ne)|0,I=I+Math.imul(le,Ze)|0,E=E+Math.imul(_e,Le)|0,C=C+Math.imul(_e,gt)|0,C=C+Math.imul(Pe,Le)|0,I=I+Math.imul(Pe,gt)|0,E=E+Math.imul(D,Ye)|0,C=C+Math.imul(D,kt)|0,C=C+Math.imul(G,Ye)|0,I=I+Math.imul(G,kt)|0,E=E+Math.imul(Me,tt)|0,C=C+Math.imul(Me,Nt)|0,C=C+Math.imul(Q,tt)|0,I=I+Math.imul(Q,Nt)|0,E=E+Math.imul(q,ut)|0,C=C+Math.imul(q,Yt)|0,C=C+Math.imul(ye,ut)|0,I=I+Math.imul(ye,Yt)|0,E=E+Math.imul(se,at)|0,C=C+Math.imul(se,lr)|0,C=C+Math.imul(pe,at)|0,I=I+Math.imul(pe,lr)|0,E=E+Math.imul($,J)|0,C=C+Math.imul($,ee)|0,C=C+Math.imul(he,J)|0,I=I+Math.imul(he,ee)|0,E=E+Math.imul(B,te)|0,C=C+Math.imul(B,Ae)|0,C=C+Math.imul(ne,te)|0,I=I+Math.imul(ne,Ae)|0;var bt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(bt>>>26)|0,bt&=67108863,E=Math.imul(ce,Te),C=Math.imul(ce,ze),C=C+Math.imul(Ie,Te)|0,I=Math.imul(Ie,ze),E=E+Math.imul(re,Ne)|0,C=C+Math.imul(re,Ze)|0,C=C+Math.imul(ge,Ne)|0,I=I+Math.imul(ge,Ze)|0,E=E+Math.imul(Re,Le)|0,C=C+Math.imul(Re,gt)|0,C=C+Math.imul(le,Le)|0,I=I+Math.imul(le,gt)|0,E=E+Math.imul(_e,Ye)|0,C=C+Math.imul(_e,kt)|0,C=C+Math.imul(Pe,Ye)|0,I=I+Math.imul(Pe,kt)|0,E=E+Math.imul(D,tt)|0,C=C+Math.imul(D,Nt)|0,C=C+Math.imul(G,tt)|0,I=I+Math.imul(G,Nt)|0,E=E+Math.imul(Me,ut)|0,C=C+Math.imul(Me,Yt)|0,C=C+Math.imul(Q,ut)|0,I=I+Math.imul(Q,Yt)|0,E=E+Math.imul(q,at)|0,C=C+Math.imul(q,lr)|0,C=C+Math.imul(ye,at)|0,I=I+Math.imul(ye,lr)|0,E=E+Math.imul(se,J)|0,C=C+Math.imul(se,ee)|0,C=C+Math.imul(pe,J)|0,I=I+Math.imul(pe,ee)|0,E=E+Math.imul($,te)|0,C=C+Math.imul($,Ae)|0,C=C+Math.imul(he,te)|0,I=I+Math.imul(he,Ae)|0,E=E+Math.imul(B,Be)|0,C=C+Math.imul(B,qe)|0,C=C+Math.imul(ne,Be)|0,I=I+Math.imul(ne,qe)|0;var xt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(xt>>>26)|0,xt&=67108863,E=Math.imul(ce,Ne),C=Math.imul(ce,Ze),C=C+Math.imul(Ie,Ne)|0,I=Math.imul(Ie,Ze),E=E+Math.imul(re,Le)|0,C=C+Math.imul(re,gt)|0,C=C+Math.imul(ge,Le)|0,I=I+Math.imul(ge,gt)|0,E=E+Math.imul(Re,Ye)|0,C=C+Math.imul(Re,kt)|0,C=C+Math.imul(le,Ye)|0,I=I+Math.imul(le,kt)|0,E=E+Math.imul(_e,tt)|0,C=C+Math.imul(_e,Nt)|0,C=C+Math.imul(Pe,tt)|0,I=I+Math.imul(Pe,Nt)|0,E=E+Math.imul(D,ut)|0,C=C+Math.imul(D,Yt)|0,C=C+Math.imul(G,ut)|0,I=I+Math.imul(G,Yt)|0,E=E+Math.imul(Me,at)|0,C=C+Math.imul(Me,lr)|0,C=C+Math.imul(Q,at)|0,I=I+Math.imul(Q,lr)|0,E=E+Math.imul(q,J)|0,C=C+Math.imul(q,ee)|0,C=C+Math.imul(ye,J)|0,I=I+Math.imul(ye,ee)|0,E=E+Math.imul(se,te)|0,C=C+Math.imul(se,Ae)|0,C=C+Math.imul(pe,te)|0,I=I+Math.imul(pe,Ae)|0,E=E+Math.imul($,Be)|0,C=C+Math.imul($,qe)|0,C=C+Math.imul(he,Be)|0,I=I+Math.imul(he,qe)|0;var wt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(wt>>>26)|0,wt&=67108863,E=Math.imul(ce,Le),C=Math.imul(ce,gt),C=C+Math.imul(Ie,Le)|0,I=Math.imul(Ie,gt),E=E+Math.imul(re,Ye)|0,C=C+Math.imul(re,kt)|0,C=C+Math.imul(ge,Ye)|0,I=I+Math.imul(ge,kt)|0,E=E+Math.imul(Re,tt)|0,C=C+Math.imul(Re,Nt)|0,C=C+Math.imul(le,tt)|0,I=I+Math.imul(le,Nt)|0,E=E+Math.imul(_e,ut)|0,C=C+Math.imul(_e,Yt)|0,C=C+Math.imul(Pe,ut)|0,I=I+Math.imul(Pe,Yt)|0,E=E+Math.imul(D,at)|0,C=C+Math.imul(D,lr)|0,C=C+Math.imul(G,at)|0,I=I+Math.imul(G,lr)|0,E=E+Math.imul(Me,J)|0,C=C+Math.imul(Me,ee)|0,C=C+Math.imul(Q,J)|0,I=I+Math.imul(Q,ee)|0,E=E+Math.imul(q,te)|0,C=C+Math.imul(q,Ae)|0,C=C+Math.imul(ye,te)|0,I=I+Math.imul(ye,Ae)|0,E=E+Math.imul(se,Be)|0,C=C+Math.imul(se,qe)|0,C=C+Math.imul(pe,Be)|0,I=I+Math.imul(pe,qe)|0;var st=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(st>>>26)|0,st&=67108863,E=Math.imul(ce,Ye),C=Math.imul(ce,kt),C=C+Math.imul(Ie,Ye)|0,I=Math.imul(Ie,kt),E=E+Math.imul(re,tt)|0,C=C+Math.imul(re,Nt)|0,C=C+Math.imul(ge,tt)|0,I=I+Math.imul(ge,Nt)|0,E=E+Math.imul(Re,ut)|0,C=C+Math.imul(Re,Yt)|0,C=C+Math.imul(le,ut)|0,I=I+Math.imul(le,Yt)|0,E=E+Math.imul(_e,at)|0,C=C+Math.imul(_e,lr)|0,C=C+Math.imul(Pe,at)|0,I=I+Math.imul(Pe,lr)|0,E=E+Math.imul(D,J)|0,C=C+Math.imul(D,ee)|0,C=C+Math.imul(G,J)|0,I=I+Math.imul(G,ee)|0,E=E+Math.imul(Me,te)|0,C=C+Math.imul(Me,Ae)|0,C=C+Math.imul(Q,te)|0,I=I+Math.imul(Q,Ae)|0,E=E+Math.imul(q,Be)|0,C=C+Math.imul(q,qe)|0,C=C+Math.imul(ye,Be)|0,I=I+Math.imul(ye,qe)|0;var ct=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(ct>>>26)|0,ct&=67108863,E=Math.imul(ce,tt),C=Math.imul(ce,Nt),C=C+Math.imul(Ie,tt)|0,I=Math.imul(Ie,Nt),E=E+Math.imul(re,ut)|0,C=C+Math.imul(re,Yt)|0,C=C+Math.imul(ge,ut)|0,I=I+Math.imul(ge,Yt)|0,E=E+Math.imul(Re,at)|0,C=C+Math.imul(Re,lr)|0,C=C+Math.imul(le,at)|0,I=I+Math.imul(le,lr)|0,E=E+Math.imul(_e,J)|0,C=C+Math.imul(_e,ee)|0,C=C+Math.imul(Pe,J)|0,I=I+Math.imul(Pe,ee)|0,E=E+Math.imul(D,te)|0,C=C+Math.imul(D,Ae)|0,C=C+Math.imul(G,te)|0,I=I+Math.imul(G,Ae)|0,E=E+Math.imul(Me,Be)|0,C=C+Math.imul(Me,qe)|0,C=C+Math.imul(Q,Be)|0,I=I+Math.imul(Q,qe)|0;var nt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(nt>>>26)|0,nt&=67108863,E=Math.imul(ce,ut),C=Math.imul(ce,Yt),C=C+Math.imul(Ie,ut)|0,I=Math.imul(Ie,Yt),E=E+Math.imul(re,at)|0,C=C+Math.imul(re,lr)|0,C=C+Math.imul(ge,at)|0,I=I+Math.imul(ge,lr)|0,E=E+Math.imul(Re,J)|0,C=C+Math.imul(Re,ee)|0,C=C+Math.imul(le,J)|0,I=I+Math.imul(le,ee)|0,E=E+Math.imul(_e,te)|0,C=C+Math.imul(_e,Ae)|0,C=C+Math.imul(Pe,te)|0,I=I+Math.imul(Pe,Ae)|0,E=E+Math.imul(D,Be)|0,C=C+Math.imul(D,qe)|0,C=C+Math.imul(G,Be)|0,I=I+Math.imul(G,qe)|0;var lt=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(lt>>>26)|0,lt&=67108863,E=Math.imul(ce,at),C=Math.imul(ce,lr),C=C+Math.imul(Ie,at)|0,I=Math.imul(Ie,lr),E=E+Math.imul(re,J)|0,C=C+Math.imul(re,ee)|0,C=C+Math.imul(ge,J)|0,I=I+Math.imul(ge,ee)|0,E=E+Math.imul(Re,te)|0,C=C+Math.imul(Re,Ae)|0,C=C+Math.imul(le,te)|0,I=I+Math.imul(le,Ae)|0,E=E+Math.imul(_e,Be)|0,C=C+Math.imul(_e,qe)|0,C=C+Math.imul(Pe,Be)|0,I=I+Math.imul(Pe,qe)|0;var fe=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(fe>>>26)|0,fe&=67108863,E=Math.imul(ce,J),C=Math.imul(ce,ee),C=C+Math.imul(Ie,J)|0,I=Math.imul(Ie,ee),E=E+Math.imul(re,te)|0,C=C+Math.imul(re,Ae)|0,C=C+Math.imul(ge,te)|0,I=I+Math.imul(ge,Ae)|0,E=E+Math.imul(Re,Be)|0,C=C+Math.imul(Re,qe)|0,C=C+Math.imul(le,Be)|0,I=I+Math.imul(le,qe)|0;var R=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(R>>>26)|0,R&=67108863,E=Math.imul(ce,te),C=Math.imul(ce,Ae),C=C+Math.imul(Ie,te)|0,I=Math.imul(Ie,Ae),E=E+Math.imul(re,Be)|0,C=C+Math.imul(re,qe)|0,C=C+Math.imul(ge,Be)|0,I=I+Math.imul(ge,qe)|0;var F=(T+E|0)+((C&8191)<<13)|0;T=(I+(C>>>13)|0)+(F>>>26)|0,F&=67108863,E=Math.imul(ce,Be),C=Math.imul(ce,qe),C=C+Math.imul(Ie,Be)|0,I=Math.imul(Ie,qe);var H=(T+E|0)+((C&8191)<<13)|0;return T=(I+(C>>>13)|0)+(H>>>26)|0,H&=67108863,A[0]=He,A[1]=$e,A[2]=Lt,A[3]=ot,A[4]=vt,A[5]=yt,A[6]=Ct,A[7]=St,A[8]=bt,A[9]=xt,A[10]=wt,A[11]=st,A[12]=ct,A[13]=nt,A[14]=lt,A[15]=fe,A[16]=R,A[17]=F,A[18]=H,T!==0&&(A[19]=T,f.length++),f};Math.imul||(b=v);function S(U,_,y){y.negative=_.negative^U.negative,y.length=U.length+_.length;for(var f=0,g=0,w=0;w>>26)|0,g+=A>>>26,A&=67108863}y.words[w]=T,f=A,A=g}return f!==0?y.words[w]=f:y.length--,y.strip()}function x(U,_,y){var f=new k;return f.mulp(U,_,y)}i.prototype.mulTo=function(_,y){var f,g=this.length+_.length;return this.length===10&&_.length===10?f=b(this,_,y):g<63?f=v(this,_,y):g<1024?f=S(this,_,y):f=x(this,_,y),f};function k(U,_){this.x=U,this.y=_}k.prototype.makeRBT=function(_){for(var y=new Array(_),f=i.prototype._countBits(_)-1,g=0;g<_;g++)y[g]=this.revBin(g,f,_);return y},k.prototype.revBin=function(_,y,f){if(_===0||_===f-1)return _;for(var g=0,w=0;w>=1;return g},k.prototype.permute=function(_,y,f,g,w,A){for(var T=0;T>>1)w++;return 1<>>13,f[2*A+1]=w&8191,w=w>>>13;for(A=2*y;A>=26,y+=g/67108864|0,y+=w>>>26,this.words[f]=w&67108863}return y!==0&&(this.words[f]=y,this.length++),this},i.prototype.muln=function(_){return this.clone().imuln(_)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(_){var y=p(_);if(y.length===0)return new i(1);for(var f=this,g=0;g=0);var y=_%26,f=(_-y)/26,g=67108863>>>26-y<<26-y,w;if(y!==0){var A=0;for(w=0;w>>26-y}A&&(this.words[w]=A,this.length++)}if(f!==0){for(w=this.length-1;w>=0;w--)this.words[w+f]=this.words[w];for(w=0;w=0);var g;y?g=(y-y%26)/26:g=0;var w=_%26,A=Math.min((_-w)/26,this.length),T=67108863^67108863>>>w<A)for(this.length-=A,C=0;C=0&&(I!==0||C>=g);C--){var m=this.words[C]|0;this.words[C]=I<<26-w|m>>>w,I=m&T}return E&&I!==0&&(E.words[E.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(_,y,f){return n(this.negative===0),this.iushrn(_,y,f)},i.prototype.shln=function(_){return this.clone().ishln(_)},i.prototype.ushln=function(_){return this.clone().iushln(_)},i.prototype.shrn=function(_){return this.clone().ishrn(_)},i.prototype.ushrn=function(_){return this.clone().iushrn(_)},i.prototype.testn=function(_){n(typeof _=="number"&&_>=0);var y=_%26,f=(_-y)/26,g=1<=0);var y=_%26,f=(_-y)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(y!==0&&f++,this.length=Math.min(f,this.length),y!==0){var g=67108863^67108863>>>y<=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},i.prototype.isubn=function(_){if(n(typeof _=="number"),n(_<67108864),_<0)return this.iaddn(-_);if(this.negative!==0)return this.negative=0,this.iaddn(_),this.negative=1,this;if(this.words[0]-=_,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y>26)-(E/67108864|0),this.words[w+f]=A&67108863}for(;w>26,this.words[w+f]=A&67108863;if(T===0)return this.strip();for(n(T===-1),T=0,w=0;w>26,this.words[w]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(_,y){var f=this.length-_.length,g=this.clone(),w=_,A=w.words[w.length-1]|0,T=this._countBits(A);f=26-T,f!==0&&(w=w.ushln(f),g.iushln(f),A=w.words[w.length-1]|0);var E=g.length-w.length,C;if(y!=="mod"){C=new i(null),C.length=E+1,C.words=new Array(C.length);for(var I=0;I=0;B--){var ne=(g.words[w.length+B]|0)*67108864+(g.words[w.length+B-1]|0);for(ne=Math.min(ne/A|0,67108863),g._ishlnsubmul(w,ne,B);g.negative!==0;)ne--,g.negative=0,g._ishlnsubmul(w,1,B),g.isZero()||(g.negative^=1);C&&(C.words[B]=ne)}return C&&C.strip(),g.strip(),y!=="div"&&f!==0&&g.iushrn(f),{div:C||null,mod:g}},i.prototype.divmod=function(_,y,f){if(n(!_.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var g,w,A;return this.negative!==0&&_.negative===0?(A=this.neg().divmod(_,y),y!=="mod"&&(g=A.div.neg()),y!=="div"&&(w=A.mod.neg(),f&&w.negative!==0&&w.iadd(_)),{div:g,mod:w}):this.negative===0&&_.negative!==0?(A=this.divmod(_.neg(),y),y!=="mod"&&(g=A.div.neg()),{div:g,mod:A.mod}):this.negative&_.negative?(A=this.neg().divmod(_.neg(),y),y!=="div"&&(w=A.mod.neg(),f&&w.negative!==0&&w.isub(_)),{div:A.div,mod:w}):_.length>this.length||this.cmp(_)<0?{div:new i(0),mod:this}:_.length===1?y==="div"?{div:this.divn(_.words[0]),mod:null}:y==="mod"?{div:null,mod:new i(this.modn(_.words[0]))}:{div:this.divn(_.words[0]),mod:new i(this.modn(_.words[0]))}:this._wordDiv(_,y)},i.prototype.div=function(_){return this.divmod(_,"div",!1).div},i.prototype.mod=function(_){return this.divmod(_,"mod",!1).mod},i.prototype.umod=function(_){return this.divmod(_,"mod",!0).mod},i.prototype.divRound=function(_){var y=this.divmod(_);if(y.mod.isZero())return y.div;var f=y.div.negative!==0?y.mod.isub(_):y.mod,g=_.ushrn(1),w=_.andln(1),A=f.cmp(g);return A<0||w===1&&A===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},i.prototype.modn=function(_){n(_<=67108863);for(var y=(1<<26)%_,f=0,g=this.length-1;g>=0;g--)f=(y*f+(this.words[g]|0))%_;return f},i.prototype.idivn=function(_){n(_<=67108863);for(var y=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+y*67108864;this.words[f]=g/_|0,y=g%_}return this.strip()},i.prototype.divn=function(_){return this.clone().idivn(_)},i.prototype.egcd=function(_){n(_.negative===0),n(!_.isZero());var y=this,f=_.clone();y.negative!==0?y=y.umod(_):y=y.clone();for(var g=new i(1),w=new i(0),A=new i(0),T=new i(1),E=0;y.isEven()&&f.isEven();)y.iushrn(1),f.iushrn(1),++E;for(var C=f.clone(),I=y.clone();!y.isZero();){for(var m=0,B=1;!(y.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(y.iushrn(m);m-- >0;)(g.isOdd()||w.isOdd())&&(g.iadd(C),w.isub(I)),g.iushrn(1),w.iushrn(1);for(var ne=0,de=1;!(f.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(f.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(C),T.isub(I)),A.iushrn(1),T.iushrn(1);y.cmp(f)>=0?(y.isub(f),g.isub(A),w.isub(T)):(f.isub(y),A.isub(g),T.isub(w))}return{a:A,b:T,gcd:f.iushln(E)}},i.prototype._invmp=function(_){n(_.negative===0),n(!_.isZero());var y=this,f=_.clone();y.negative!==0?y=y.umod(_):y=y.clone();for(var g=new i(1),w=new i(0),A=f.clone();y.cmpn(1)>0&&f.cmpn(1)>0;){for(var T=0,E=1;!(y.words[0]&E)&&T<26;++T,E<<=1);if(T>0)for(y.iushrn(T);T-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);for(var C=0,I=1;!(f.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(f.iushrn(C);C-- >0;)w.isOdd()&&w.iadd(A),w.iushrn(1);y.cmp(f)>=0?(y.isub(f),g.isub(w)):(f.isub(y),w.isub(g))}var m;return y.cmpn(1)===0?m=g:m=w,m.cmpn(0)<0&&m.iadd(_),m},i.prototype.gcd=function(_){if(this.isZero())return _.abs();if(_.isZero())return this.abs();var y=this.clone(),f=_.clone();y.negative=0,f.negative=0;for(var g=0;y.isEven()&&f.isEven();g++)y.iushrn(1),f.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;f.isEven();)f.iushrn(1);var w=y.cmp(f);if(w<0){var A=y;y=f,f=A}else if(w===0||f.cmpn(1)===0)break;y.isub(f)}while(!0);return f.iushln(g)},i.prototype.invm=function(_){return this.egcd(_).a.umod(_)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(_){return this.words[0]&_},i.prototype.bincn=function(_){n(typeof _=="number");var y=_%26,f=(_-y)/26,g=1<>>26,T&=67108863,this.words[A]=T}return w!==0&&(this.words[A]=w,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(_){var y=_<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this.strip();var f;if(this.length>1)f=1;else{y&&(_=-_),n(_<=67108863,"Number is too big");var g=this.words[0]|0;f=g===_?0:g<_?-1:1}return this.negative!==0?-f|0:f},i.prototype.cmp=function(_){if(this.negative!==0&&_.negative===0)return-1;if(this.negative===0&&_.negative!==0)return 1;var y=this.ucmp(_);return this.negative!==0?-y|0:y},i.prototype.ucmp=function(_){if(this.length>_.length)return 1;if(this.length<_.length)return-1;for(var y=0,f=this.length-1;f>=0;f--){var g=this.words[f]|0,w=_.words[f]|0;if(g!==w){gw&&(y=1);break}}return y},i.prototype.gtn=function(_){return this.cmpn(_)===1},i.prototype.gt=function(_){return this.cmp(_)===1},i.prototype.gten=function(_){return this.cmpn(_)>=0},i.prototype.gte=function(_){return this.cmp(_)>=0},i.prototype.ltn=function(_){return this.cmpn(_)===-1},i.prototype.lt=function(_){return this.cmp(_)===-1},i.prototype.lten=function(_){return this.cmpn(_)<=0},i.prototype.lte=function(_){return this.cmp(_)<=0},i.prototype.eqn=function(_){return this.cmpn(_)===0},i.prototype.eq=function(_){return this.cmp(_)===0},i.red=function(_){return new Z(_)},i.prototype.toRed=function(_){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),_.convertTo(this)._forceRed(_)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(_){return this.red=_,this},i.prototype.forceRed=function(_){return n(!this.red,"Already a number in reduction context"),this._forceRed(_)},i.prototype.redAdd=function(_){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,_)},i.prototype.redIAdd=function(_){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,_)},i.prototype.redSub=function(_){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,_)},i.prototype.redISub=function(_){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,_)},i.prototype.redShl=function(_){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,_)},i.prototype.redMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.mul(this,_)},i.prototype.redIMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.imul(this,_)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(_){return n(this.red&&!_.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,_)};var M={k256:null,p224:null,p192:null,p25519:null};function P(U,_){this.name=U,this.p=new i(_,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var _=new i(null);return _.words=new Array(Math.ceil(this.n/13)),_},P.prototype.ireduce=function(_){var y=_,f;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),f=y.bitLength();while(f>this.n);var g=f0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},P.prototype.split=function(_,y){_.iushrn(this.n,0,y)},P.prototype.imulK=function(_){return _.imul(this.k)};function L(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,P),L.prototype.split=function(_,y){for(var f=4194303,g=Math.min(_.length,9),w=0;w>>22,A=T}A>>>=22,_.words[w-10]=A,A===0&&_.length>10?_.length-=10:_.length-=9},L.prototype.imulK=function(_){_.words[_.length]=0,_.words[_.length+1]=0,_.length+=2;for(var y=0,f=0;f<_.length;f++){var g=_.words[f]|0;y+=g*977,_.words[f]=y&67108863,y=g*64+(y/67108864|0)}return _.words[_.length-1]===0&&(_.length--,_.words[_.length-1]===0&&_.length--),_};function j(){P.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(j,P);function V(){P.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(V,P);function K(){P.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(K,P),K.prototype.imulK=function(_){for(var y=0,f=0;f<_.length;f++){var g=(_.words[f]|0)*19+y,w=g&67108863;g>>>=26,_.words[f]=w,y=g}return y!==0&&(_.words[_.length++]=y),_},i._prime=function(_){if(M[_])return M[_];var y;if(_==="k256")y=new L;else if(_==="p224")y=new j;else if(_==="p192")y=new V;else if(_==="p25519")y=new K;else throw new Error("Unknown prime "+_);return M[_]=y,y};function Z(U){if(typeof U=="string"){var _=i._prime(U);this.m=_.p,this.prime=_}else n(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}Z.prototype._verify1=function(_){n(_.negative===0,"red works only with positives"),n(_.red,"red works only with red numbers")},Z.prototype._verify2=function(_,y){n((_.negative|y.negative)===0,"red works only with positives"),n(_.red&&_.red===y.red,"red works only with red numbers")},Z.prototype.imod=function(_){return this.prime?this.prime.ireduce(_)._forceRed(this):_.umod(this.m)._forceRed(this)},Z.prototype.neg=function(_){return _.isZero()?_.clone():this.m.sub(_)._forceRed(this)},Z.prototype.add=function(_,y){this._verify2(_,y);var f=_.add(y);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(_,y){this._verify2(_,y);var f=_.iadd(y);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(_,y){this._verify2(_,y);var f=_.sub(y);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(_,y){this._verify2(_,y);var f=_.isub(y);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(_,y){return this._verify1(_),this.imod(_.ushln(y))},Z.prototype.imul=function(_,y){return this._verify2(_,y),this.imod(_.imul(y))},Z.prototype.mul=function(_,y){return this._verify2(_,y),this.imod(_.mul(y))},Z.prototype.isqr=function(_){return this.imul(_,_.clone())},Z.prototype.sqr=function(_){return this.mul(_,_)},Z.prototype.sqrt=function(_){if(_.isZero())return _.clone();var y=this.m.andln(3);if(n(y%2===1),y===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(_,f)}for(var g=this.m.subn(1),w=0;!g.isZero()&&g.andln(1)===0;)w++,g.iushrn(1);n(!g.isZero());var A=new i(1).toRed(this),T=A.redNeg(),E=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new i(2*C*C).toRed(this);this.pow(C,E).cmp(T)!==0;)C.redIAdd(T);for(var I=this.pow(C,g),m=this.pow(_,g.addn(1).iushrn(1)),B=this.pow(_,g),ne=w;B.cmp(A)!==0;){for(var de=B,$=0;de.cmp(A)!==0;$++)de=de.redSqr();n($=0;w--){for(var I=y.words[w],m=C-1;m>=0;m--){var B=I>>m&1;if(A!==g[0]&&(A=this.sqr(A)),B===0&&T===0){E=0;continue}T<<=1,T|=B,E++,!(E!==f&&(w!==0||m!==0))&&(A=this.mul(A,g[T]),E=0,T=0)}C=26}return A},Z.prototype.convertTo=function(_){var y=_.umod(this.m);return y===_?y.clone():y},Z.prototype.convertFrom=function(_){var y=_.clone();return y.red=null,y},i.mont=function(_){return new ue(_)};function ue(U){Z.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(ue,Z),ue.prototype.convertTo=function(_){return this.imod(_.ushln(this.shift))},ue.prototype.convertFrom=function(_){var y=this.imod(_.mul(this.rinv));return y.red=null,y},ue.prototype.imul=function(_,y){if(_.isZero()||y.isZero())return _.words[0]=0,_.length=1,_;var f=_.imul(y),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=f.isub(g).iushrn(this.shift),A=w;return w.cmp(this.m)>=0?A=w.isub(this.m):w.cmpn(0)<0&&(A=w.iadd(this.m)),A._forceRed(this)},ue.prototype.mul=function(_,y){if(_.isZero()||y.isZero())return new i(0)._forceRed(this);var f=_.mul(y),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=f.isub(g).iushrn(this.shift),A=w;return w.cmp(this.m)>=0?A=w.isub(this.m):w.cmpn(0)<0&&(A=w.iadd(this.m)),A._forceRed(this)},ue.prototype.invm=function(_){var y=this.imod(_._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(e,Ke)}($U)),op}var If={},qU={get exports(){return If},set exports(e){If=e}},O9;function ww(){if(O9)return If;O9=1;var e;qU.exports=function(o){return e||(e=new t(null)),e.generate(o)};function t(n){this.rand=n}if(If.Rand=t,t.prototype.generate=function(o){return this._rand(o)},t.prototype._rand=function(o){if(this.rand.getBytes)return this.rand.getBytes(o);for(var i=new Uint8Array(o),a=0;a=0);return s},r.prototype._randrange=function(o,i){var a=i.sub(o);return o.add(this._randbelow(a))},r.prototype.test=function(o,i,a){var s=o.bitLength(),l=e.mont(o),u=new e(1).toRed(l);i||(i=Math.max(1,s/48|0));for(var c=o.subn(1),h=0;!c.testn(h);h++);for(var d=o.shrn(h),p=c.toRed(l),v=!0;i>0;i--){var b=this._randrange(new e(2),c);a&&a(b);var S=b.toRed(l).redPow(d);if(!(S.cmp(u)===0||S.cmp(p)===0)){for(var x=1;x0;i--){var p=this._randrange(new e(2),u),v=o.gcd(p);if(v.cmpn(1)!==0)return v;var b=p.toRed(s).redPow(h);if(!(b.cmp(l)===0||b.cmp(d)===0)){for(var S=1;Sx;)M.ishrn(1);if(M.isEven()&&M.iadd(i),M.testn(1)||M.iadd(a),k.cmp(a)){if(!k.cmp(s))for(;M.mod(l).cmp(u);)M.iadd(h)}else for(;M.mod(r).cmp(c);)M.iadd(h);if(P=M.shrn(1),v(P)&&v(M)&&b(P)&&b(M)&&o.test(P)&&o.test(M))return M}}return ay}const WU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},VU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},HU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},KU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},ZU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},GU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},YU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},QU={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},XU={modp1:WU,modp2:VU,modp5:HU,modp14:KU,modp15:ZU,modp16:GU,modp17:YU,modp18:QU};var sy,D9;function JU(){if(D9)return sy;D9=1;var e=cn(),t=iM(),r=new t,n=new e(24),o=new e(11),i=new e(10),a=new e(3),s=new e(7),l=oM(),u=tc();sy=v;function c(S,x){return x=x||"utf8",Oe.Buffer.isBuffer(S)||(S=new Oe.Buffer(S,x)),this._pub=new e(S),this}function h(S,x){return x=x||"utf8",Oe.Buffer.isBuffer(S)||(S=new Oe.Buffer(S,x)),this._priv=new e(S),this}var d={};function p(S,x){var k=x.toString("hex"),M=[k,S.toString(16)].join("_");if(M in d)return d[M];var P=0;if(S.isEven()||!l.simpleSieve||!l.fermatTest(S)||!r.test(S))return P+=1,k==="02"||k==="05"?P+=8:P+=4,d[M]=P,P;r.test(S.shrn(1))||(P+=2);var L;switch(k){case"02":S.mod(n).cmp(o)&&(P+=8);break;case"05":L=S.mod(i),L.cmp(a)&&L.cmp(s)&&(P+=8);break;default:P+=4}return d[M]=P,P}function v(S,x,k){this.setGenerator(x),this.__prime=new e(S),this._prime=e.mont(this.__prime),this._primeLen=S.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,k?(this.setPublicKey=c,this.setPrivateKey=h):this._primeCode=8}Object.defineProperty(v.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=p(this.__prime,this.__gen)),this._primeCode}}),v.prototype.generateKeys=function(){return this._priv||(this._priv=new e(u(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},v.prototype.computeSecret=function(S){S=new e(S),S=S.toRed(this._prime);var x=S.redPow(this._priv).fromRed(),k=new Oe.Buffer(x.toArray()),M=this.getPrime();if(k.length0?f:g},i.min=function(f,g){return f.cmp(g)<0?f:g},i.prototype._init=function(f,g,w){if(typeof f=="number")return this._initNumber(f,g,w);if(typeof f=="object")return this._initArray(f,g,w);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var A=0;f[0]==="-"&&(A++,this.negative=1),A=0;A-=3)E=f[A]|f[A-1]<<8|f[A-2]<<16,this.words[T]|=E<>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);else if(w==="le")for(A=0,T=0;A>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);return this._strip()};function s(y,f){var g=y.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+y)}function l(y,f,g){var w=s(y,g);return g-1>=f&&(w|=s(y,g-1)<<4),w}i.prototype._parseHex=function(f,g,w){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var A=0;A=g;A-=2)C=l(f,g,A)<=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8;else{var I=f.length-g;for(A=I%2===0?g+1:g;A=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8}this._strip()};function u(y,f,g,w){for(var A=0,T=0,E=Math.min(y.length,g),C=f;C=49?T=I-49+10:I>=17?T=I-17+10:T=I,n(I>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","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"],p=[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],v=[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];i.prototype.toString=function(f,g){f=f||10,g=g|0||1;var w;if(f===16||f==="hex"){w="";for(var A=0,T=0,E=0;E>>24-A&16777215,A+=2,A>=26&&(A-=26,E--),T!==0||E!==this.length-1?w=d[6-I.length]+I+w:w=I+w}for(T!==0&&(w=T.toString(16)+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(f===(f|0)&&f>=2&&f<=36){var m=p[f],B=v[f];w="";var ne=this.clone();for(ne.negative=0;!ne.isZero();){var de=ne.modrn(B).toString(f);ne=ne.idivn(B),ne.isZero()?w=de+w:w=d[m-de.length]+de+w}for(this.isZero()&&(w="0"+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(f,g){return this.toArrayLike(a,f,g)}),i.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};i.prototype.toArrayLike=function(f,g,w){this._strip();var A=this.byteLength(),T=w||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var E=b(f,T),C=g==="le"?"LE":"BE";return this["_toArrayLike"+C](E,A),E},i.prototype._toArrayLikeLE=function(f,g){for(var w=0,A=0,T=0,E=0;T>8&255),w>16&255),E===6?(w>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w=0&&(f[w--]=C>>8&255),w>=0&&(f[w--]=C>>16&255),E===6?(w>=0&&(f[w--]=C>>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w>=0)for(f[w--]=A;w>=0;)f[w--]=0},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var g=f,w=0;return g>=4096&&(w+=13,g>>>=13),g>=64&&(w+=7,g>>>=7),g>=8&&(w+=4,g>>>=4),g>=2&&(w+=2,g>>>=2),w+g},i.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,w=0;return g&8191||(w+=13,g>>>=13),g&127||(w+=7,g>>>=7),g&15||(w+=4,g>>>=4),g&3||(w+=2,g>>>=2),g&1||w++,w},i.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function S(y){for(var f=new Array(y.bitLength()),g=0;g>>A&1}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var w=0;wf.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var g,w;this.length>f.length?(g=this,w=f):(g=f,w=this);for(var A=0;Af.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,w=f%26;this._expand(g),w>0&&g--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-w),this._strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var w=f/26|0,A=f%26;return this._expand(w+1),g?this.words[w]=this.words[w]|1<f.length?(w=this,A=f):(w=f,A=this);for(var T=0,E=0;E>>26;for(;T!==0&&E>>26;if(this.length=w.length,T!==0)this.words[this.length]=T,this.length++;else if(w!==this)for(;Ef.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var w=this.cmp(f);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;w>0?(A=this,T=f):(A=f,T=this);for(var E=0,C=0;C>26,this.words[C]=g&67108863;for(;E!==0&&C>26,this.words[C]=g&67108863;if(E===0&&C>>26,ne=I&67108863,de=Math.min(m,f.length-1),$=Math.max(0,m-y.length+1);$<=de;$++){var he=m-$|0;A=y.words[he]|0,T=f.words[$]|0,E=A*T+ne,B+=E/67108864|0,ne=E&67108863}g.words[m]=ne|0,I=B|0}return I!==0?g.words[m]=I|0:g.length--,g._strip()}var k=function(f,g,w){var A=f.words,T=g.words,E=w.words,C=0,I,m,B,ne=A[0]|0,de=ne&8191,$=ne>>>13,he=A[1]|0,X=he&8191,se=he>>>13,pe=A[2]|0,W=pe&8191,q=pe>>>13,ye=A[3]|0,xe=ye&8191,Me=ye>>>13,Q=A[4]|0,N=Q&8191,D=Q>>>13,G=A[5]|0,me=G&8191,_e=G>>>13,Pe=A[6]|0,Fe=Pe&8191,Re=Pe>>>13,le=A[7]|0,Y=le&8191,re=le>>>13,ge=A[8]|0,be=ge&8191,ce=ge>>>13,Ie=A[9]|0,ke=Ie&8191,Te=Ie>>>13,ze=T[0]|0,We=ze&8191,Ne=ze>>>13,Ze=T[1]|0,De=Ze&8191,Le=Ze>>>13,gt=T[2]|0,rt=gt&8191,Ye=gt>>>13,kt=T[3]|0,ht=kt&8191,tt=kt>>>13,Nt=T[4]|0,It=Nt&8191,ut=Nt>>>13,Yt=T[5]|0,Tt=Yt&8191,at=Yt>>>13,lr=T[6]|0,z=lr&8191,J=lr>>>13,ee=T[7]|0,O=ee&8191,te=ee>>>13,Ae=T[8]|0,Ee=Ae&8191,Be=Ae>>>13,qe=T[9]|0,He=qe&8191,$e=qe>>>13;w.negative=f.negative^g.negative,w.length=19,I=Math.imul(de,We),m=Math.imul(de,Ne),m=m+Math.imul($,We)|0,B=Math.imul($,Ne);var Lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,I=Math.imul(X,We),m=Math.imul(X,Ne),m=m+Math.imul(se,We)|0,B=Math.imul(se,Ne),I=I+Math.imul(de,De)|0,m=m+Math.imul(de,Le)|0,m=m+Math.imul($,De)|0,B=B+Math.imul($,Le)|0;var ot=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ot>>>26)|0,ot&=67108863,I=Math.imul(W,We),m=Math.imul(W,Ne),m=m+Math.imul(q,We)|0,B=Math.imul(q,Ne),I=I+Math.imul(X,De)|0,m=m+Math.imul(X,Le)|0,m=m+Math.imul(se,De)|0,B=B+Math.imul(se,Le)|0,I=I+Math.imul(de,rt)|0,m=m+Math.imul(de,Ye)|0,m=m+Math.imul($,rt)|0,B=B+Math.imul($,Ye)|0;var vt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(vt>>>26)|0,vt&=67108863,I=Math.imul(xe,We),m=Math.imul(xe,Ne),m=m+Math.imul(Me,We)|0,B=Math.imul(Me,Ne),I=I+Math.imul(W,De)|0,m=m+Math.imul(W,Le)|0,m=m+Math.imul(q,De)|0,B=B+Math.imul(q,Le)|0,I=I+Math.imul(X,rt)|0,m=m+Math.imul(X,Ye)|0,m=m+Math.imul(se,rt)|0,B=B+Math.imul(se,Ye)|0,I=I+Math.imul(de,ht)|0,m=m+Math.imul(de,tt)|0,m=m+Math.imul($,ht)|0,B=B+Math.imul($,tt)|0;var yt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(yt>>>26)|0,yt&=67108863,I=Math.imul(N,We),m=Math.imul(N,Ne),m=m+Math.imul(D,We)|0,B=Math.imul(D,Ne),I=I+Math.imul(xe,De)|0,m=m+Math.imul(xe,Le)|0,m=m+Math.imul(Me,De)|0,B=B+Math.imul(Me,Le)|0,I=I+Math.imul(W,rt)|0,m=m+Math.imul(W,Ye)|0,m=m+Math.imul(q,rt)|0,B=B+Math.imul(q,Ye)|0,I=I+Math.imul(X,ht)|0,m=m+Math.imul(X,tt)|0,m=m+Math.imul(se,ht)|0,B=B+Math.imul(se,tt)|0,I=I+Math.imul(de,It)|0,m=m+Math.imul(de,ut)|0,m=m+Math.imul($,It)|0,B=B+Math.imul($,ut)|0;var Ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,I=Math.imul(me,We),m=Math.imul(me,Ne),m=m+Math.imul(_e,We)|0,B=Math.imul(_e,Ne),I=I+Math.imul(N,De)|0,m=m+Math.imul(N,Le)|0,m=m+Math.imul(D,De)|0,B=B+Math.imul(D,Le)|0,I=I+Math.imul(xe,rt)|0,m=m+Math.imul(xe,Ye)|0,m=m+Math.imul(Me,rt)|0,B=B+Math.imul(Me,Ye)|0,I=I+Math.imul(W,ht)|0,m=m+Math.imul(W,tt)|0,m=m+Math.imul(q,ht)|0,B=B+Math.imul(q,tt)|0,I=I+Math.imul(X,It)|0,m=m+Math.imul(X,ut)|0,m=m+Math.imul(se,It)|0,B=B+Math.imul(se,ut)|0,I=I+Math.imul(de,Tt)|0,m=m+Math.imul(de,at)|0,m=m+Math.imul($,Tt)|0,B=B+Math.imul($,at)|0;var St=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(St>>>26)|0,St&=67108863,I=Math.imul(Fe,We),m=Math.imul(Fe,Ne),m=m+Math.imul(Re,We)|0,B=Math.imul(Re,Ne),I=I+Math.imul(me,De)|0,m=m+Math.imul(me,Le)|0,m=m+Math.imul(_e,De)|0,B=B+Math.imul(_e,Le)|0,I=I+Math.imul(N,rt)|0,m=m+Math.imul(N,Ye)|0,m=m+Math.imul(D,rt)|0,B=B+Math.imul(D,Ye)|0,I=I+Math.imul(xe,ht)|0,m=m+Math.imul(xe,tt)|0,m=m+Math.imul(Me,ht)|0,B=B+Math.imul(Me,tt)|0,I=I+Math.imul(W,It)|0,m=m+Math.imul(W,ut)|0,m=m+Math.imul(q,It)|0,B=B+Math.imul(q,ut)|0,I=I+Math.imul(X,Tt)|0,m=m+Math.imul(X,at)|0,m=m+Math.imul(se,Tt)|0,B=B+Math.imul(se,at)|0,I=I+Math.imul(de,z)|0,m=m+Math.imul(de,J)|0,m=m+Math.imul($,z)|0,B=B+Math.imul($,J)|0;var bt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(bt>>>26)|0,bt&=67108863,I=Math.imul(Y,We),m=Math.imul(Y,Ne),m=m+Math.imul(re,We)|0,B=Math.imul(re,Ne),I=I+Math.imul(Fe,De)|0,m=m+Math.imul(Fe,Le)|0,m=m+Math.imul(Re,De)|0,B=B+Math.imul(Re,Le)|0,I=I+Math.imul(me,rt)|0,m=m+Math.imul(me,Ye)|0,m=m+Math.imul(_e,rt)|0,B=B+Math.imul(_e,Ye)|0,I=I+Math.imul(N,ht)|0,m=m+Math.imul(N,tt)|0,m=m+Math.imul(D,ht)|0,B=B+Math.imul(D,tt)|0,I=I+Math.imul(xe,It)|0,m=m+Math.imul(xe,ut)|0,m=m+Math.imul(Me,It)|0,B=B+Math.imul(Me,ut)|0,I=I+Math.imul(W,Tt)|0,m=m+Math.imul(W,at)|0,m=m+Math.imul(q,Tt)|0,B=B+Math.imul(q,at)|0,I=I+Math.imul(X,z)|0,m=m+Math.imul(X,J)|0,m=m+Math.imul(se,z)|0,B=B+Math.imul(se,J)|0,I=I+Math.imul(de,O)|0,m=m+Math.imul(de,te)|0,m=m+Math.imul($,O)|0,B=B+Math.imul($,te)|0;var xt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(xt>>>26)|0,xt&=67108863,I=Math.imul(be,We),m=Math.imul(be,Ne),m=m+Math.imul(ce,We)|0,B=Math.imul(ce,Ne),I=I+Math.imul(Y,De)|0,m=m+Math.imul(Y,Le)|0,m=m+Math.imul(re,De)|0,B=B+Math.imul(re,Le)|0,I=I+Math.imul(Fe,rt)|0,m=m+Math.imul(Fe,Ye)|0,m=m+Math.imul(Re,rt)|0,B=B+Math.imul(Re,Ye)|0,I=I+Math.imul(me,ht)|0,m=m+Math.imul(me,tt)|0,m=m+Math.imul(_e,ht)|0,B=B+Math.imul(_e,tt)|0,I=I+Math.imul(N,It)|0,m=m+Math.imul(N,ut)|0,m=m+Math.imul(D,It)|0,B=B+Math.imul(D,ut)|0,I=I+Math.imul(xe,Tt)|0,m=m+Math.imul(xe,at)|0,m=m+Math.imul(Me,Tt)|0,B=B+Math.imul(Me,at)|0,I=I+Math.imul(W,z)|0,m=m+Math.imul(W,J)|0,m=m+Math.imul(q,z)|0,B=B+Math.imul(q,J)|0,I=I+Math.imul(X,O)|0,m=m+Math.imul(X,te)|0,m=m+Math.imul(se,O)|0,B=B+Math.imul(se,te)|0,I=I+Math.imul(de,Ee)|0,m=m+Math.imul(de,Be)|0,m=m+Math.imul($,Ee)|0,B=B+Math.imul($,Be)|0;var wt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(wt>>>26)|0,wt&=67108863,I=Math.imul(ke,We),m=Math.imul(ke,Ne),m=m+Math.imul(Te,We)|0,B=Math.imul(Te,Ne),I=I+Math.imul(be,De)|0,m=m+Math.imul(be,Le)|0,m=m+Math.imul(ce,De)|0,B=B+Math.imul(ce,Le)|0,I=I+Math.imul(Y,rt)|0,m=m+Math.imul(Y,Ye)|0,m=m+Math.imul(re,rt)|0,B=B+Math.imul(re,Ye)|0,I=I+Math.imul(Fe,ht)|0,m=m+Math.imul(Fe,tt)|0,m=m+Math.imul(Re,ht)|0,B=B+Math.imul(Re,tt)|0,I=I+Math.imul(me,It)|0,m=m+Math.imul(me,ut)|0,m=m+Math.imul(_e,It)|0,B=B+Math.imul(_e,ut)|0,I=I+Math.imul(N,Tt)|0,m=m+Math.imul(N,at)|0,m=m+Math.imul(D,Tt)|0,B=B+Math.imul(D,at)|0,I=I+Math.imul(xe,z)|0,m=m+Math.imul(xe,J)|0,m=m+Math.imul(Me,z)|0,B=B+Math.imul(Me,J)|0,I=I+Math.imul(W,O)|0,m=m+Math.imul(W,te)|0,m=m+Math.imul(q,O)|0,B=B+Math.imul(q,te)|0,I=I+Math.imul(X,Ee)|0,m=m+Math.imul(X,Be)|0,m=m+Math.imul(se,Ee)|0,B=B+Math.imul(se,Be)|0,I=I+Math.imul(de,He)|0,m=m+Math.imul(de,$e)|0,m=m+Math.imul($,He)|0,B=B+Math.imul($,$e)|0;var st=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(ke,De),m=Math.imul(ke,Le),m=m+Math.imul(Te,De)|0,B=Math.imul(Te,Le),I=I+Math.imul(be,rt)|0,m=m+Math.imul(be,Ye)|0,m=m+Math.imul(ce,rt)|0,B=B+Math.imul(ce,Ye)|0,I=I+Math.imul(Y,ht)|0,m=m+Math.imul(Y,tt)|0,m=m+Math.imul(re,ht)|0,B=B+Math.imul(re,tt)|0,I=I+Math.imul(Fe,It)|0,m=m+Math.imul(Fe,ut)|0,m=m+Math.imul(Re,It)|0,B=B+Math.imul(Re,ut)|0,I=I+Math.imul(me,Tt)|0,m=m+Math.imul(me,at)|0,m=m+Math.imul(_e,Tt)|0,B=B+Math.imul(_e,at)|0,I=I+Math.imul(N,z)|0,m=m+Math.imul(N,J)|0,m=m+Math.imul(D,z)|0,B=B+Math.imul(D,J)|0,I=I+Math.imul(xe,O)|0,m=m+Math.imul(xe,te)|0,m=m+Math.imul(Me,O)|0,B=B+Math.imul(Me,te)|0,I=I+Math.imul(W,Ee)|0,m=m+Math.imul(W,Be)|0,m=m+Math.imul(q,Ee)|0,B=B+Math.imul(q,Be)|0,I=I+Math.imul(X,He)|0,m=m+Math.imul(X,$e)|0,m=m+Math.imul(se,He)|0,B=B+Math.imul(se,$e)|0;var ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ct>>>26)|0,ct&=67108863,I=Math.imul(ke,rt),m=Math.imul(ke,Ye),m=m+Math.imul(Te,rt)|0,B=Math.imul(Te,Ye),I=I+Math.imul(be,ht)|0,m=m+Math.imul(be,tt)|0,m=m+Math.imul(ce,ht)|0,B=B+Math.imul(ce,tt)|0,I=I+Math.imul(Y,It)|0,m=m+Math.imul(Y,ut)|0,m=m+Math.imul(re,It)|0,B=B+Math.imul(re,ut)|0,I=I+Math.imul(Fe,Tt)|0,m=m+Math.imul(Fe,at)|0,m=m+Math.imul(Re,Tt)|0,B=B+Math.imul(Re,at)|0,I=I+Math.imul(me,z)|0,m=m+Math.imul(me,J)|0,m=m+Math.imul(_e,z)|0,B=B+Math.imul(_e,J)|0,I=I+Math.imul(N,O)|0,m=m+Math.imul(N,te)|0,m=m+Math.imul(D,O)|0,B=B+Math.imul(D,te)|0,I=I+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Be)|0,m=m+Math.imul(Me,Ee)|0,B=B+Math.imul(Me,Be)|0,I=I+Math.imul(W,He)|0,m=m+Math.imul(W,$e)|0,m=m+Math.imul(q,He)|0,B=B+Math.imul(q,$e)|0;var nt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(nt>>>26)|0,nt&=67108863,I=Math.imul(ke,ht),m=Math.imul(ke,tt),m=m+Math.imul(Te,ht)|0,B=Math.imul(Te,tt),I=I+Math.imul(be,It)|0,m=m+Math.imul(be,ut)|0,m=m+Math.imul(ce,It)|0,B=B+Math.imul(ce,ut)|0,I=I+Math.imul(Y,Tt)|0,m=m+Math.imul(Y,at)|0,m=m+Math.imul(re,Tt)|0,B=B+Math.imul(re,at)|0,I=I+Math.imul(Fe,z)|0,m=m+Math.imul(Fe,J)|0,m=m+Math.imul(Re,z)|0,B=B+Math.imul(Re,J)|0,I=I+Math.imul(me,O)|0,m=m+Math.imul(me,te)|0,m=m+Math.imul(_e,O)|0,B=B+Math.imul(_e,te)|0,I=I+Math.imul(N,Ee)|0,m=m+Math.imul(N,Be)|0,m=m+Math.imul(D,Ee)|0,B=B+Math.imul(D,Be)|0,I=I+Math.imul(xe,He)|0,m=m+Math.imul(xe,$e)|0,m=m+Math.imul(Me,He)|0,B=B+Math.imul(Me,$e)|0;var lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(lt>>>26)|0,lt&=67108863,I=Math.imul(ke,It),m=Math.imul(ke,ut),m=m+Math.imul(Te,It)|0,B=Math.imul(Te,ut),I=I+Math.imul(be,Tt)|0,m=m+Math.imul(be,at)|0,m=m+Math.imul(ce,Tt)|0,B=B+Math.imul(ce,at)|0,I=I+Math.imul(Y,z)|0,m=m+Math.imul(Y,J)|0,m=m+Math.imul(re,z)|0,B=B+Math.imul(re,J)|0,I=I+Math.imul(Fe,O)|0,m=m+Math.imul(Fe,te)|0,m=m+Math.imul(Re,O)|0,B=B+Math.imul(Re,te)|0,I=I+Math.imul(me,Ee)|0,m=m+Math.imul(me,Be)|0,m=m+Math.imul(_e,Ee)|0,B=B+Math.imul(_e,Be)|0,I=I+Math.imul(N,He)|0,m=m+Math.imul(N,$e)|0,m=m+Math.imul(D,He)|0,B=B+Math.imul(D,$e)|0;var fe=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(fe>>>26)|0,fe&=67108863,I=Math.imul(ke,Tt),m=Math.imul(ke,at),m=m+Math.imul(Te,Tt)|0,B=Math.imul(Te,at),I=I+Math.imul(be,z)|0,m=m+Math.imul(be,J)|0,m=m+Math.imul(ce,z)|0,B=B+Math.imul(ce,J)|0,I=I+Math.imul(Y,O)|0,m=m+Math.imul(Y,te)|0,m=m+Math.imul(re,O)|0,B=B+Math.imul(re,te)|0,I=I+Math.imul(Fe,Ee)|0,m=m+Math.imul(Fe,Be)|0,m=m+Math.imul(Re,Ee)|0,B=B+Math.imul(Re,Be)|0,I=I+Math.imul(me,He)|0,m=m+Math.imul(me,$e)|0,m=m+Math.imul(_e,He)|0,B=B+Math.imul(_e,$e)|0;var R=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(R>>>26)|0,R&=67108863,I=Math.imul(ke,z),m=Math.imul(ke,J),m=m+Math.imul(Te,z)|0,B=Math.imul(Te,J),I=I+Math.imul(be,O)|0,m=m+Math.imul(be,te)|0,m=m+Math.imul(ce,O)|0,B=B+Math.imul(ce,te)|0,I=I+Math.imul(Y,Ee)|0,m=m+Math.imul(Y,Be)|0,m=m+Math.imul(re,Ee)|0,B=B+Math.imul(re,Be)|0,I=I+Math.imul(Fe,He)|0,m=m+Math.imul(Fe,$e)|0,m=m+Math.imul(Re,He)|0,B=B+Math.imul(Re,$e)|0;var F=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(F>>>26)|0,F&=67108863,I=Math.imul(ke,O),m=Math.imul(ke,te),m=m+Math.imul(Te,O)|0,B=Math.imul(Te,te),I=I+Math.imul(be,Ee)|0,m=m+Math.imul(be,Be)|0,m=m+Math.imul(ce,Ee)|0,B=B+Math.imul(ce,Be)|0,I=I+Math.imul(Y,He)|0,m=m+Math.imul(Y,$e)|0,m=m+Math.imul(re,He)|0,B=B+Math.imul(re,$e)|0;var H=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(H>>>26)|0,H&=67108863,I=Math.imul(ke,Ee),m=Math.imul(ke,Be),m=m+Math.imul(Te,Ee)|0,B=Math.imul(Te,Be),I=I+Math.imul(be,He)|0,m=m+Math.imul(be,$e)|0,m=m+Math.imul(ce,He)|0,B=B+Math.imul(ce,$e)|0;var ae=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ae>>>26)|0,ae&=67108863,I=Math.imul(ke,He),m=Math.imul(ke,$e),m=m+Math.imul(Te,He)|0,B=Math.imul(Te,$e);var oe=(C+I|0)+((m&8191)<<13)|0;return C=(B+(m>>>13)|0)+(oe>>>26)|0,oe&=67108863,E[0]=Lt,E[1]=ot,E[2]=vt,E[3]=yt,E[4]=Ct,E[5]=St,E[6]=bt,E[7]=xt,E[8]=wt,E[9]=st,E[10]=ct,E[11]=nt,E[12]=lt,E[13]=fe,E[14]=R,E[15]=F,E[16]=H,E[17]=ae,E[18]=oe,C!==0&&(E[19]=C,w.length++),w};Math.imul||(k=x);function M(y,f,g){g.negative=f.negative^y.negative,g.length=y.length+f.length;for(var w=0,A=0,T=0;T>>26)|0,A+=E>>>26,E&=67108863}g.words[T]=C,w=E,E=A}return w!==0?g.words[T]=w:g.length--,g._strip()}function P(y,f,g){return M(y,f,g)}i.prototype.mulTo=function(f,g){var w,A=this.length+f.length;return this.length===10&&f.length===10?w=k(this,f,g):A<63?w=x(this,f,g):A<1024?w=M(this,f,g):w=P(this,f,g),w},i.prototype.mul=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},i.prototype.mulf=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),P(this,f,g)},i.prototype.imul=function(f){return this.clone().mulTo(f,this)},i.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var w=0,A=0;A>=26,w+=T/67108864|0,w+=E>>>26,this.words[A]=E&67108863}return w!==0&&(this.words[A]=w,this.length++),g?this.ineg():this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var g=S(f);if(g.length===0)return new i(1);for(var w=this,A=0;A=0);var g=f%26,w=(f-g)/26,A=67108863>>>26-g<<26-g,T;if(g!==0){var E=0;for(T=0;T>>26-g}E&&(this.words[T]=E,this.length++)}if(w!==0){for(T=this.length-1;T>=0;T--)this.words[T+w]=this.words[T];for(T=0;T=0);var A;g?A=(g-g%26)/26:A=0;var T=f%26,E=Math.min((f-T)/26,this.length),C=67108863^67108863>>>T<E)for(this.length-=E,m=0;m=0&&(B!==0||m>=A);m--){var ne=this.words[m]|0;this.words[m]=B<<26-T|ne>>>T,B=ne&C}return I&&B!==0&&(I.words[I.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(f,g,w){return n(this.negative===0),this.iushrn(f,g,w)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,w=(f-g)/26,A=1<=0);var g=f%26,w=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(g!==0&&w++,this.length=Math.min(w,this.length),g!==0){var A=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(I/67108864|0),this.words[T+w]=E&67108863}for(;T>26,this.words[T+w]=E&67108863;if(C===0)return this._strip();for(n(C===-1),C=0,T=0;T>26,this.words[T]=E&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(f,g){var w=this.length-f.length,A=this.clone(),T=f,E=T.words[T.length-1]|0,C=this._countBits(E);w=26-C,w!==0&&(T=T.ushln(w),A.iushln(w),E=T.words[T.length-1]|0);var I=A.length-T.length,m;if(g!=="mod"){m=new i(null),m.length=I+1,m.words=new Array(m.length);for(var B=0;B=0;de--){var $=(A.words[T.length+de]|0)*67108864+(A.words[T.length+de-1]|0);for($=Math.min($/E|0,67108863),A._ishlnsubmul(T,$,de);A.negative!==0;)$--,A.negative=0,A._ishlnsubmul(T,1,de),A.isZero()||(A.negative^=1);m&&(m.words[de]=$)}return m&&m._strip(),A._strip(),g!=="div"&&w!==0&&A.iushrn(w),{div:m||null,mod:A}},i.prototype.divmod=function(f,g,w){if(n(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var A,T,E;return this.negative!==0&&f.negative===0?(E=this.neg().divmod(f,g),g!=="mod"&&(A=E.div.neg()),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.iadd(f)),{div:A,mod:T}):this.negative===0&&f.negative!==0?(E=this.divmod(f.neg(),g),g!=="mod"&&(A=E.div.neg()),{div:A,mod:E.mod}):this.negative&f.negative?(E=this.neg().divmod(f.neg(),g),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.isub(f)),{div:E.div,mod:T}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modrn(f.words[0]))}:this._wordDiv(f,g)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var w=g.div.negative!==0?g.mod.isub(f):g.mod,A=f.ushrn(1),T=f.andln(1),E=w.cmp(A);return E<0||T===1&&E===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=(1<<26)%f,A=0,T=this.length-1;T>=0;T--)A=(w*A+(this.words[T]|0))%f;return g?-A:A},i.prototype.modn=function(f){return this.modrn(f)},i.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+w*67108864;this.words[A]=T/f|0,w=T%f}return this._strip(),g?this.ineg():this},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=new i(0),C=new i(1),I=0;g.isEven()&&w.isEven();)g.iushrn(1),w.iushrn(1),++I;for(var m=w.clone(),B=g.clone();!g.isZero();){for(var ne=0,de=1;!(g.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(g.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(m),T.isub(B)),A.iushrn(1),T.iushrn(1);for(var $=0,he=1;!(w.words[0]&he)&&$<26;++$,he<<=1);if($>0)for(w.iushrn($);$-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(B)),E.iushrn(1),C.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(E),T.isub(C)):(w.isub(g),E.isub(A),C.isub(T))}return{a:E,b:C,gcd:w.iushln(I)}},i.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=w.clone();g.cmpn(1)>0&&w.cmpn(1)>0;){for(var C=0,I=1;!(g.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(g.iushrn(C);C-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);for(var m=0,B=1;!(w.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(w.iushrn(m);m-- >0;)T.isOdd()&&T.iadd(E),T.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(T)):(w.isub(g),T.isub(A))}var ne;return g.cmpn(1)===0?ne=A:ne=T,ne.cmpn(0)<0&&ne.iadd(f),ne},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),w=f.clone();g.negative=0,w.negative=0;for(var A=0;g.isEven()&&w.isEven();A++)g.iushrn(1),w.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;w.isEven();)w.iushrn(1);var T=g.cmp(w);if(T<0){var E=g;g=w,w=E}else if(T===0||w.cmpn(1)===0)break;g.isub(w)}while(!0);return w.iushln(A)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,w=(f-g)/26,A=1<>>26,C&=67108863,this.words[E]=C}return T!==0&&(this.words[E]=T,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var w;if(this.length>1)w=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var A=this.words[0]|0;w=A===f?0:Af.length)return 1;if(this.length=0;w--){var A=this.words[w]|0,T=f.words[w]|0;if(A!==T){AT&&(g=1);break}}return g},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new U(f)},i.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function j(y,f){this.name=y,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,w;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),w=g.bitLength();while(w>this.n);var A=w0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function V(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(V,j),V.prototype.split=function(f,g){for(var w=4194303,A=Math.min(f.length,9),T=0;T>>22,E=C}E>>>=22,f.words[T-10]=E,E===0&&f.length>10?f.length-=10:f.length-=9},V.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,w=0;w>>=26,f.words[w]=T,g=A}return g!==0&&(f.words[f.length++]=g),f},i._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new V;else if(f==="p224")g=new K;else if(f==="p192")g=new Z;else if(f==="p25519")g=new ue;else throw new Error("Unknown prime "+f);return L[f]=g,g};function U(y){if(typeof y=="string"){var f=i._prime(y);this.m=f.p,this.prime=f}else n(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}U.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},U.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},U.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},U.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},U.prototype.add=function(f,g){this._verify2(f,g);var w=f.add(g);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},U.prototype.iadd=function(f,g){this._verify2(f,g);var w=f.iadd(g);return w.cmp(this.m)>=0&&w.isub(this.m),w},U.prototype.sub=function(f,g){this._verify2(f,g);var w=f.sub(g);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},U.prototype.isub=function(f,g){this._verify2(f,g);var w=f.isub(g);return w.cmpn(0)<0&&w.iadd(this.m),w},U.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},U.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},U.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},U.prototype.isqr=function(f){return this.imul(f,f.clone())},U.prototype.sqr=function(f){return this.mul(f,f)},U.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var w=this.m.add(new i(1)).iushrn(2);return this.pow(f,w)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var E=new i(1).toRed(this),C=E.redNeg(),I=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new i(2*m*m).toRed(this);this.pow(m,I).cmp(C)!==0;)m.redIAdd(C);for(var B=this.pow(m,A),ne=this.pow(f,A.addn(1).iushrn(1)),de=this.pow(f,A),$=T;de.cmp(E)!==0;){for(var he=de,X=0;he.cmp(E)!==0;X++)he=he.redSqr();n(X<$);var se=this.pow(B,new i(1).iushln($-X-1));ne=ne.redMul(se),B=se.redSqr(),de=de.redMul(B),$=X}return ne},U.prototype.invm=function(f){var g=f._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},U.prototype.pow=function(f,g){if(g.isZero())return new i(1).toRed(this);if(g.cmpn(1)===0)return f.clone();var w=4,A=new Array(1<=0;T--){for(var B=g.words[T],ne=m-1;ne>=0;ne--){var de=B>>ne&1;if(E!==A[0]&&(E=this.sqr(E)),de===0&&C===0){I=0;continue}C<<=1,C|=de,I++,!(I!==w&&(T!==0||ne!==0))&&(E=this.mul(E,A[C]),I=0,C=0)}m=26}return E},U.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},U.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},i.mont=function(f){return new _(f)};function _(y){U.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(_,U),_.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},_.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},_.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var w=f.imul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new i(0)._forceRed(this);var w=f.mul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(e,Ke)}(rj)),ap}var ly,F9;function _w(){if(F9)return ly;F9=1;var e=nj(),t=tc();function r(i){var a=n(i),s=a.toRed(e.mont(i.modulus)).redPow(new e(i.publicExponent)).fromRed();return{blinder:s,unblinder:a.invm(i.modulus)}}function n(i){var a=i.modulus.byteLength(),s;do s=new e(t(a));while(s.cmp(i.modulus)>=0||!s.umod(i.prime1)||!s.umod(i.prime2));return s}function o(i,a){var s=r(a),l=a.modulus.byteLength(),u=new e(i).mul(s.blinder).umod(a.modulus),c=u.toRed(e.mont(a.prime1)),h=u.toRed(e.mont(a.prime2)),d=a.coefficient,p=a.prime1,v=a.prime2,b=c.redPow(a.exponent1).fromRed(),S=h.redPow(a.exponent2).fromRed(),x=b.isub(S).imul(d).umod(p).imul(v);return S.iadd(x).imul(s.unblinder).umod(a.modulus).toArrayLike(Oe.Buffer,"be",l)}return o.getr=n,ly=o,ly}var uy={};const ij="elliptic",oj="6.5.4",aj="EC cryptography",sj="lib/elliptic.js",lj=["lib"],uj={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/"},cj={type:"git",url:"git@github.com:indutny/elliptic"},fj=["EC","Elliptic","curve","Cryptography"],dj="Fedor Indutny ",hj="MIT",pj={url:"https://github.com/indutny/elliptic/issues"},gj="https://github.com/indutny/elliptic",mj={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"},vj={"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"},yj={name:ij,version:oj,description:aj,main:sj,files:lj,scripts:uj,repository:cj,keywords:fj,author:dj,license:hj,bugs:pj,homepage:gj,devDependencies:mj,dependencies:vj};var cy={},fy={},z9;function aM(){return z9||(z9=1,function(e){var t=e;function r(i,a){if(Array.isArray(i))return i.slice();if(!i)return[];var s=[];if(typeof i!="string"){for(var l=0;l>8,h=u&255;c?s.push(c,h):s.push(h)}return s}t.toArray=r;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function o(i){for(var a="",s=0;s(v>>1)-1?x=(v>>1)-k:x=k,b.isubn(x)):x=0,p[S]=x,b.iushrn(1)}return p}t.getNAF=i;function a(c,h){var d=[[],[]];c=c.clone(),h=h.clone();for(var p=0,v=0,b;c.cmpn(-p)>0||h.cmpn(-v)>0;){var S=c.andln(3)+p&3,x=h.andln(3)+v&3;S===3&&(S=-1),x===3&&(x=-1);var k;S&1?(b=c.andln(7)+p&7,(b===3||b===5)&&x===2?k=-S:k=S):k=0,d[0].push(k);var M;x&1?(b=h.andln(7)+v&7,(b===3||b===5)&&S===2?M=-x:M=x):M=0,d[1].push(M),2*p===k+1&&(p=1-p),2*v===M+1&&(v=1-v),c.iushrn(1),h.iushrn(1)}return d}t.getJSF=a;function s(c,h,d){var p="_"+h;c.prototype[h]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}t.cachedProperty=s;function l(c){return typeof c=="string"?t.toArray(c,"hex"):c}t.parseBytes=l;function u(c){return new r(c,"hex","le")}t.intFromLE=u}(cy)),cy}var dy={},hy,q9;function E1(){if(q9)return hy;q9=1;var e=cn(),t=Oi(),r=t.getNAF,n=t.getJSF,o=t.assert;function i(s,l){this.type=s,this.p=new e(l.p,16),this.red=l.prime?e.red(l.prime):e.mont(this.p),this.zero=new e(0).toRed(this.red),this.one=new e(1).toRed(this.red),this.two=new e(2).toRed(this.red),this.n=l.n&&new e(l.n,16),this.g=l.g&&this.pointFromJSON(l.g,l.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 u=this.n&&this.p.div(this.n);!u||u.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}hy=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(l,u){o(l.precomputed);var c=l._getDoubles(),h=r(u,1,this._bitLength),d=(1<=v;S--)b=(b<<1)+h[S];p.push(b)}for(var x=this.jpoint(null,null,null),k=this.jpoint(null,null,null),M=d;M>0;M--){for(v=0;v=0;b--){for(var S=0;b>=0&&p[b]===0;b--)S++;if(b>=0&&S++,v=v.dblp(S),b<0)break;var x=p[b];o(x!==0),l.type==="affine"?x>0?v=v.mixedAdd(d[x-1>>1]):v=v.mixedAdd(d[-x-1>>1].neg()):x>0?v=v.add(d[x-1>>1]):v=v.add(d[-x-1>>1].neg())}return l.type==="affine"?v.toP():v},i.prototype._wnafMulAdd=function(l,u,c,h,d){var p=this._wnafT1,v=this._wnafT2,b=this._wnafT3,S=0,x,k,M;for(x=0;x=1;x-=2){var L=x-1,j=x;if(p[L]!==1||p[j]!==1){b[L]=r(c[L],p[L],this._bitLength),b[j]=r(c[j],p[j],this._bitLength),S=Math.max(b[L].length,S),S=Math.max(b[j].length,S);continue}var V=[u[L],null,null,u[j]];u[L].y.cmp(u[j].y)===0?(V[1]=u[L].add(u[j]),V[2]=u[L].toJ().mixedAdd(u[j].neg())):u[L].y.cmp(u[j].y.redNeg())===0?(V[1]=u[L].toJ().mixedAdd(u[j]),V[2]=u[L].add(u[j].neg())):(V[1]=u[L].toJ().mixedAdd(u[j]),V[2]=u[L].toJ().mixedAdd(u[j].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],Z=n(c[L],c[j]);for(S=Math.max(Z[0].length,S),b[L]=new Array(S),b[j]=new Array(S),k=0;k=0;x--){for(var f=0;x>=0;){var g=!0;for(k=0;k=0&&f++,_=_.dblp(f),x<0)break;for(k=0;k0?M=v[k][w-1>>1]:w<0&&(M=v[k][-w-1>>1].neg()),M.type==="affine"?_=_.mixedAdd(M):_=_.add(M))}}for(x=0;x=Math.ceil((l.bitLength()+1)/u.step):!1},a.prototype._getDoubles=function(l,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],h=this,d=0;d=0&&(L=x,j=k),M.negative&&(M=M.neg(),P=P.neg()),L.negative&&(L=L.neg(),j=j.neg()),[{a:M,b:P},{a:L,b:j}]},i.prototype._endoSplit=function(u){var c=this.endo.basis,h=c[0],d=c[1],p=d.b.mul(u).divRound(this.n),v=h.b.neg().mul(u).divRound(this.n),b=p.mul(h.a),S=v.mul(d.a),x=p.mul(h.b),k=v.mul(d.b),M=u.sub(b).sub(S),P=x.add(k).neg();return{k1:M,k2:P}},i.prototype.pointFromX=function(u,c){u=new t(u,16),u.red||(u=u.toRed(this.red));var h=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),d=h.redSqrt();if(d.redSqr().redSub(h).cmp(this.zero)!==0)throw new Error("invalid point");var p=d.fromRed().isOdd();return(c&&!p||!c&&p)&&(d=d.redNeg()),this.point(u,d)},i.prototype.validate=function(u){if(u.inf)return!0;var c=u.x,h=u.y,d=this.a.redMul(c),p=c.redSqr().redMul(c).redIAdd(d).redIAdd(this.b);return h.redSqr().redISub(p).cmpn(0)===0},i.prototype._endoWnafMulAdd=function(u,c,h){for(var d=this._endoWnafT1,p=this._endoWnafT2,v=0;v":""},a.prototype.isInfinity=function(){return this.inf},a.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 h=c.redSqr().redISub(this.x).redISub(u.x),d=c.redMul(this.x.redSub(h)).redISub(this.y);return this.curve.point(h,d)},a.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,h=this.x.redSqr(),d=u.redInvm(),p=h.redAdd(h).redIAdd(h).redIAdd(c).redMul(d),v=p.redSqr().redISub(this.x.redAdd(this.x)),b=p.redMul(this.x.redSub(v)).redISub(this.y);return this.curve.point(v,b)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(u){return u=new t(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)},a.prototype.mulAdd=function(u,c,h){var d=[this,c],p=[u,h];return this.curve.endo?this.curve._endoWnafMulAdd(d,p):this.curve._wnafMulAdd(1,d,p,2)},a.prototype.jmulAdd=function(u,c,h){var d=[this,c],p=[u,h];return this.curve.endo?this.curve._endoWnafMulAdd(d,p,!0):this.curve._wnafMulAdd(1,d,p,2,!0)},a.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)},a.prototype.neg=function(u){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var h=this.precomputed,d=function(p){return p.neg()};c.precomputed={naf:h.naf&&{wnd:h.naf.wnd,points:h.naf.points.map(d)},doubles:h.doubles&&{step:h.doubles.step,points:h.doubles.points.map(d)}}}return c},a.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 s(l,u,c,h){n.BasePoint.call(this,l,"jacobian"),u===null&&c===null&&h===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new t(0)):(this.x=new t(u,16),this.y=new t(c,16),this.z=new t(h,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(s,n.BasePoint),i.prototype.jpoint=function(u,c,h){return new s(this,u,c,h)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),c=u.redSqr(),h=this.x.redMul(c),d=this.y.redMul(c).redMul(u);return this.curve.point(h,d)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var c=u.z.redSqr(),h=this.z.redSqr(),d=this.x.redMul(c),p=u.x.redMul(h),v=this.y.redMul(c.redMul(u.z)),b=u.y.redMul(h.redMul(this.z)),S=d.redSub(p),x=v.redSub(b);if(S.cmpn(0)===0)return x.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var k=S.redSqr(),M=k.redMul(S),P=d.redMul(k),L=x.redSqr().redIAdd(M).redISub(P).redISub(P),j=x.redMul(P.redISub(L)).redISub(v.redMul(M)),V=this.z.redMul(u.z).redMul(S);return this.curve.jpoint(L,j,V)},s.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var c=this.z.redSqr(),h=this.x,d=u.x.redMul(c),p=this.y,v=u.y.redMul(c).redMul(this.z),b=h.redSub(d),S=p.redSub(v);if(b.cmpn(0)===0)return S.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var x=b.redSqr(),k=x.redMul(b),M=h.redMul(x),P=S.redSqr().redIAdd(k).redISub(M).redISub(M),L=S.redMul(M.redISub(P)).redISub(p.redMul(k)),j=this.z.redMul(b);return this.curve.jpoint(P,L,j)},s.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 h=this;for(c=0;c=0)return!1;if(h.redIAdd(p),this.x.cmp(h)===0)return!0}},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},py}var gy,V9;function wj(){if(V9)return gy;V9=1;var e=cn(),t=Ht(),r=E1(),n=Oi();function o(a){r.call(this,"mont",a),this.a=new e(a.a,16).toRed(this.red),this.b=new e(a.b,16).toRed(this.red),this.i4=new e(4).toRed(this.red).redInvm(),this.two=new e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}t(o,r),gy=o,o.prototype.validate=function(s){var l=s.normalize().x,u=l.redSqr(),c=u.redMul(l).redAdd(u.redMul(this.a)).redAdd(l),h=c.redSqrt();return h.redSqr().cmp(c)===0};function i(a,s,l){r.BasePoint.call(this,a,"projective"),s===null&&l===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new e(s,16),this.z=new e(l,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return t(i,r.BasePoint),o.prototype.decodePoint=function(s,l){return this.point(n.toArray(s,l),1)},o.prototype.point=function(s,l){return new i(this,s,l)},o.prototype.pointFromJSON=function(s){return i.fromJSON(this,s)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(s,l){return new i(s,l[0],l[1]||s.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.z.cmpn(0)===0},i.prototype.dbl=function(){var s=this.x.redAdd(this.z),l=s.redSqr(),u=this.x.redSub(this.z),c=u.redSqr(),h=l.redSub(c),d=l.redMul(c),p=h.redMul(c.redAdd(this.curve.a24.redMul(h)));return this.curve.point(d,p)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(s,l){var u=this.x.redAdd(this.z),c=this.x.redSub(this.z),h=s.x.redAdd(s.z),d=s.x.redSub(s.z),p=d.redMul(u),v=h.redMul(c),b=l.z.redMul(p.redAdd(v).redSqr()),S=l.x.redMul(p.redISub(v).redSqr());return this.curve.point(b,S)},i.prototype.mul=function(s){for(var l=s.clone(),u=this,c=this.curve.point(null,null),h=this,d=[];l.cmpn(0)!==0;l.iushrn(1))d.push(l.andln(1));for(var p=d.length-1;p>=0;p--)d[p]===0?(u=u.diffAdd(c,h),c=c.dbl()):(c=u.diffAdd(c,h),u=u.dbl());return c},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(s){return this.getX().cmp(s.getX())===0},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},gy}var my,H9;function _j(){if(H9)return my;H9=1;var e=Oi(),t=cn(),r=Ht(),n=E1(),o=e.assert;function i(s){this.twisted=(s.a|0)!==1,this.mOneA=this.twisted&&(s.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",s),this.a=new t(s.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new t(s.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new t(s.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),o(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(s.c|0)===1}r(i,n),my=i,i.prototype._mulA=function(l){return this.mOneA?l.redNeg():this.a.redMul(l)},i.prototype._mulC=function(l){return this.oneC?l:this.c.redMul(l)},i.prototype.jpoint=function(l,u,c,h){return this.point(l,u,c,h)},i.prototype.pointFromX=function(l,u){l=new t(l,16),l.red||(l=l.toRed(this.red));var c=l.redSqr(),h=this.c2.redSub(this.a.redMul(c)),d=this.one.redSub(this.c2.redMul(this.d).redMul(c)),p=h.redMul(d.redInvm()),v=p.redSqrt();if(v.redSqr().redSub(p).cmp(this.zero)!==0)throw new Error("invalid point");var b=v.fromRed().isOdd();return(u&&!b||!u&&b)&&(v=v.redNeg()),this.point(l,v)},i.prototype.pointFromY=function(l,u){l=new t(l,16),l.red||(l=l.toRed(this.red));var c=l.redSqr(),h=c.redSub(this.c2),d=c.redMul(this.d).redMul(this.c2).redSub(this.a),p=h.redMul(d.redInvm());if(p.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,l)}var v=p.redSqrt();if(v.redSqr().redSub(p).cmp(this.zero)!==0)throw new Error("invalid point");return v.fromRed().isOdd()!==u&&(v=v.redNeg()),this.point(v,l)},i.prototype.validate=function(l){if(l.isInfinity())return!0;l.normalize();var u=l.x.redSqr(),c=l.y.redSqr(),h=u.redMul(this.a).redAdd(c),d=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(c)));return h.cmp(d)===0};function a(s,l,u,c,h){n.BasePoint.call(this,s,"projective"),l===null&&u===null&&c===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 t(l,16),this.y=new t(u,16),this.z=c?new t(c,16):this.curve.one,this.t=h&&new t(h,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(a,n.BasePoint),i.prototype.pointFromJSON=function(l){return a.fromJSON(this,l)},i.prototype.point=function(l,u,c,h){return new a(this,l,u,c,h)},a.fromJSON=function(l,u){return new a(l,u[0],u[1],u[2])},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},a.prototype._extDbl=function(){var l=this.x.redSqr(),u=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var h=this.curve._mulA(l),d=this.x.redAdd(this.y).redSqr().redISub(l).redISub(u),p=h.redAdd(u),v=p.redSub(c),b=h.redSub(u),S=d.redMul(v),x=p.redMul(b),k=d.redMul(b),M=v.redMul(p);return this.curve.point(S,x,M,k)},a.prototype._projDbl=function(){var l=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),c=this.y.redSqr(),h,d,p,v,b,S;if(this.curve.twisted){v=this.curve._mulA(u);var x=v.redAdd(c);this.zOne?(h=l.redSub(u).redSub(c).redMul(x.redSub(this.curve.two)),d=x.redMul(v.redSub(c)),p=x.redSqr().redSub(x).redSub(x)):(b=this.z.redSqr(),S=x.redSub(b).redISub(b),h=l.redSub(u).redISub(c).redMul(S),d=x.redMul(v.redSub(c)),p=x.redMul(S))}else v=u.redAdd(c),b=this.curve._mulC(this.z).redSqr(),S=v.redSub(b).redSub(b),h=this.curve._mulC(l.redISub(v)).redMul(S),d=this.curve._mulC(v).redMul(u.redISub(c)),p=v.redMul(S);return this.curve.point(h,d,p)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(l){var u=this.y.redSub(this.x).redMul(l.y.redSub(l.x)),c=this.y.redAdd(this.x).redMul(l.y.redAdd(l.x)),h=this.t.redMul(this.curve.dd).redMul(l.t),d=this.z.redMul(l.z.redAdd(l.z)),p=c.redSub(u),v=d.redSub(h),b=d.redAdd(h),S=c.redAdd(u),x=p.redMul(v),k=b.redMul(S),M=p.redMul(S),P=v.redMul(b);return this.curve.point(x,k,P,M)},a.prototype._projAdd=function(l){var u=this.z.redMul(l.z),c=u.redSqr(),h=this.x.redMul(l.x),d=this.y.redMul(l.y),p=this.curve.d.redMul(h).redMul(d),v=c.redSub(p),b=c.redAdd(p),S=this.x.redAdd(this.y).redMul(l.x.redAdd(l.y)).redISub(h).redISub(d),x=u.redMul(v).redMul(S),k,M;return this.curve.twisted?(k=u.redMul(b).redMul(d.redSub(this.curve._mulA(h))),M=v.redMul(b)):(k=u.redMul(b).redMul(d.redSub(h)),M=this.curve._mulC(v).redMul(b)),this.curve.point(x,k,M)},a.prototype.add=function(l){return this.isInfinity()?l:l.isInfinity()?this:this.curve.extended?this._extAdd(l):this._projAdd(l)},a.prototype.mul=function(l){return this._hasDoubles(l)?this.curve._fixedNafMul(this,l):this.curve._wnafMul(this,l)},a.prototype.mulAdd=function(l,u,c){return this.curve._wnafMulAdd(1,[this,u],[l,c],2,!1)},a.prototype.jmulAdd=function(l,u,c){return this.curve._wnafMulAdd(1,[this,u],[l,c],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var l=this.z.redInvm();return this.x=this.x.redMul(l),this.y=this.y.redMul(l),this.t&&(this.t=this.t.redMul(l)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(l){return this===l||this.getX().cmp(l.getX())===0&&this.getY().cmp(l.getY())===0},a.prototype.eqXToP=function(l){var u=l.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var c=l.clone(),h=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(h),this.x.cmp(u)===0)return!0}},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add,my}var K9;function sM(){return K9||(K9=1,function(e){var t=e;t.base=E1(),t.short=bj(),t.mont=wj(),t.edwards=_j()}(dy)),dy}var vy={},yy={},pr={},Z9;function To(){if(Z9)return pr;Z9=1;var e=Ri(),t=Ht();pr.inherits=t;function r(_,y){return(_.charCodeAt(y)&64512)!==55296||y<0||y+1>=_.length?!1:(_.charCodeAt(y+1)&64512)===56320}function n(_,y){if(Array.isArray(_))return _.slice();if(!_)return[];var f=[];if(typeof _=="string")if(y){if(y==="hex")for(_=_.replace(/[^a-z0-9]+/ig,""),_.length%2!==0&&(_="0"+_),w=0;w<_.length;w+=2)f.push(parseInt(_[w]+_[w+1],16))}else for(var g=0,w=0;w<_.length;w++){var A=_.charCodeAt(w);A<128?f[g++]=A:A<2048?(f[g++]=A>>6|192,f[g++]=A&63|128):r(_,w)?(A=65536+((A&1023)<<10)+(_.charCodeAt(++w)&1023),f[g++]=A>>18|240,f[g++]=A>>12&63|128,f[g++]=A>>6&63|128,f[g++]=A&63|128):(f[g++]=A>>12|224,f[g++]=A>>6&63|128,f[g++]=A&63|128)}else for(w=0;w<_.length;w++)f[w]=_[w]|0;return f}pr.toArray=n;function o(_){for(var y="",f=0;f<_.length;f++)y+=s(_[f].toString(16));return y}pr.toHex=o;function i(_){var y=_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24;return y>>>0}pr.htonl=i;function a(_,y){for(var f="",g=0;g<_.length;g++){var w=_[g];y==="little"&&(w=i(w)),f+=l(w.toString(16))}return f}pr.toHex32=a;function s(_){return _.length===1?"0"+_:_}pr.zero2=s;function l(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}pr.zero8=l;function u(_,y,f,g){var w=f-y;e(w%4===0);for(var A=new Array(w/4),T=0,E=y;T>>0}return A}pr.join32=u;function c(_,y){for(var f=new Array(_.length*4),g=0,w=0;g<_.length;g++,w+=4){var A=_[g];y==="big"?(f[w]=A>>>24,f[w+1]=A>>>16&255,f[w+2]=A>>>8&255,f[w+3]=A&255):(f[w+3]=A>>>24,f[w+2]=A>>>16&255,f[w+1]=A>>>8&255,f[w]=A&255)}return f}pr.split32=c;function h(_,y){return _>>>y|_<<32-y}pr.rotr32=h;function d(_,y){return _<>>32-y}pr.rotl32=d;function p(_,y){return _+y>>>0}pr.sum32=p;function v(_,y,f){return _+y+f>>>0}pr.sum32_3=v;function b(_,y,f,g){return _+y+f+g>>>0}pr.sum32_4=b;function S(_,y,f,g,w){return _+y+f+g+w>>>0}pr.sum32_5=S;function x(_,y,f,g){var w=_[y],A=_[y+1],T=g+A>>>0,E=(T>>0,_[y+1]=T}pr.sum64=x;function k(_,y,f,g){var w=y+g>>>0,A=(w>>0}pr.sum64_hi=k;function M(_,y,f,g){var w=y+g;return w>>>0}pr.sum64_lo=M;function P(_,y,f,g,w,A,T,E){var C=0,I=y;I=I+g>>>0,C+=I>>0,C+=I>>0,C+=I>>0}pr.sum64_4_hi=P;function L(_,y,f,g,w,A,T,E){var C=y+g+A+E;return C>>>0}pr.sum64_4_lo=L;function j(_,y,f,g,w,A,T,E,C,I){var m=0,B=y;B=B+g>>>0,m+=B>>0,m+=B>>0,m+=B>>0,m+=B>>0}pr.sum64_5_hi=j;function V(_,y,f,g,w,A,T,E,C,I){var m=y+g+A+E+I;return m>>>0}pr.sum64_5_lo=V;function K(_,y,f){var g=y<<32-f|_>>>f;return g>>>0}pr.rotr64_hi=K;function Z(_,y,f){var g=_<<32-f|y>>>f;return g>>>0}pr.rotr64_lo=Z;function ue(_,y,f){return _>>>f}pr.shr64_hi=ue;function U(_,y,f){var g=_<<32-f|y>>>f;return g>>>0}return pr.shr64_lo=U,pr}var by={},G9;function Wd(){if(G9)return by;G9=1;var e=To(),t=Ri();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 by.BlockHash=r,r.prototype.update=function(o,i){if(o=e.toArray(o,i),this.pending?this.pending=this.pending.concat(o):this.pending=o,this.pendingTotal+=o.length,this.pending.length>=this._delta8){o=this.pending;var a=o.length%this._delta8;this.pending=o.slice(o.length-a,o.length),this.pending.length===0&&(this.pending=null),o=e.join32(o,0,o.length-a,this.endian);for(var s=0;s>>24&255,s[l++]=o>>>16&255,s[l++]=o>>>8&255,s[l++]=o&255}else for(s[l++]=o&255,s[l++]=o>>>8&255,s[l++]=o>>>16&255,s[l++]=o>>>24&255,s[l++]=0,s[l++]=0,s[l++]=0,s[l++]=0,u=8;u>>3}io.g0_256=l;function u(c){return t(c,17)^t(c,19)^c>>>10}return io.g1_256=u,io}var wy,Q9;function xj(){if(Q9)return wy;Q9=1;var e=To(),t=Wd(),r=lM(),n=e.rotl32,o=e.sum32,i=e.sum32_5,a=r.ft_1,s=t.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return e.inherits(u,s),wy=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(h,d){for(var p=this.W,v=0;v<16;v++)p[v]=h[d+v];for(;vthis.blockSize&&(o=new this.Hash().update(o).digest()),t(o.length<=this.blockSize);for(var i=o.length;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,a,s)}return My=n,n.prototype._init=function(i,a,s){var l=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.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,l){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(l=s,s=a,a=null),s&&(s=t.toArray(s,l||"hex"),this._update(s));for(var u=[];u.length"},Iy}var Ty,cx;function Bj(){if(cx)return Ty;cx=1;var e=cn(),t=Oi(),r=t.assert;function n(l,u){if(l instanceof n)return l;this._importDER(l,u)||(r(l.r&&l.s,"Signature without r or s"),this.r=new e(l.r,16),this.s=new e(l.s,16),l.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=l.recoveryParam)}Ty=n;function o(){this.place=0}function i(l,u){var c=l[u.place++];if(!(c&128))return c;var h=c&15;if(h===0||h>4)return!1;for(var d=0,p=0,v=u.place;p>>=0;return d<=127?!1:(u.place=v,d)}function a(l){for(var u=0,c=l.length-1;!l[u]&&!(l[u+1]&128)&&u>>3);for(l.push(c|128);--c;)l.push(u>>>(c<<3)&255);l.push(u)}return n.prototype.toDER=function(u){var c=this.r.toArray(),h=this.s.toArray();for(c[0]&128&&(c=[0].concat(c)),h[0]&128&&(h=[0].concat(h)),c=a(c),h=a(h);!h[0]&&!(h[1]&128);)h=h.slice(1);var d=[2];s(d,c.length),d=d.concat(c),d.push(2),s(d,h.length);var p=d.concat(h),v=[48];return s(v,p.length),v=v.concat(p),t.encode(v,u)},Ty}var By,fx;function Pj(){if(fx)return By;fx=1;var e=cn(),t=Ij(),r=Oi(),n=Sw(),o=ww(),i=r.assert,a=Tj(),s=Bj();function l(u){if(!(this instanceof l))return new l(u);typeof u=="string"&&(i(Object.prototype.hasOwnProperty.call(n,u),"Unknown curve "+u),u=n[u]),u instanceof n.PresetCurve&&(u={curve:u}),this.curve=u.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=u.curve.g,this.g.precompute(u.curve.n.bitLength()+1),this.hash=u.hash||u.curve.hash}return By=l,l.prototype.keyPair=function(c){return new a(this,c)},l.prototype.keyFromPrivate=function(c,h){return a.fromPrivate(this,c,h)},l.prototype.keyFromPublic=function(c,h){return a.fromPublic(this,c,h)},l.prototype.genKeyPair=function(c){c||(c={});for(var h=new t({hash:this.hash,pers:c.pers,persEnc:c.persEnc||"utf8",entropy:c.entropy||o(this.hash.hmacStrength),entropyEnc:c.entropy&&c.entropyEnc||"utf8",nonce:this.n.toArray()}),d=this.n.byteLength(),p=this.n.sub(new e(2));;){var v=new e(h.generate(d));if(!(v.cmp(p)>0))return v.iaddn(1),this.keyFromPrivate(v)}},l.prototype._truncateToN=function(c,h){var d=c.byteLength()*8-this.n.bitLength();return d>0&&(c=c.ushrn(d)),!h&&c.cmp(this.n)>=0?c.sub(this.n):c},l.prototype.sign=function(c,h,d,p){typeof d=="object"&&(p=d,d=null),p||(p={}),h=this.keyFromPrivate(h,d),c=this._truncateToN(new e(c,16));for(var v=this.n.byteLength(),b=h.getPrivate().toArray("be",v),S=c.toArray("be",v),x=new t({hash:this.hash,entropy:b,nonce:S,pers:p.pers,persEnc:p.persEnc||"utf8"}),k=this.n.sub(new e(1)),M=0;;M++){var P=p.k?p.k(M):new e(x.generate(this.n.byteLength()));if(P=this._truncateToN(P,!0),!(P.cmpn(1)<=0||P.cmp(k)>=0)){var L=this.g.mul(P);if(!L.isInfinity()){var j=L.getX(),V=j.umod(this.n);if(V.cmpn(0)!==0){var K=P.invm(this.n).mul(V.mul(h.getPrivate()).iadd(c));if(K=K.umod(this.n),K.cmpn(0)!==0){var Z=(L.getY().isOdd()?1:0)|(j.cmp(V)!==0?2:0);return p.canonical&&K.cmp(this.nh)>0&&(K=this.n.sub(K),Z^=1),new s({r:V,s:K,recoveryParam:Z})}}}}}},l.prototype.verify=function(c,h,d,p){c=this._truncateToN(new e(c,16)),d=this.keyFromPublic(d,p),h=new s(h,"hex");var v=h.r,b=h.s;if(v.cmpn(1)<0||v.cmp(this.n)>=0||b.cmpn(1)<0||b.cmp(this.n)>=0)return!1;var S=b.invm(this.n),x=S.mul(c).umod(this.n),k=S.mul(v).umod(this.n),M;return this.curve._maxwellTrick?(M=this.g.jmulAdd(x,d.getPublic(),k),M.isInfinity()?!1:M.eqXToP(v)):(M=this.g.mulAdd(x,d.getPublic(),k),M.isInfinity()?!1:M.getX().umod(this.n).cmp(v)===0)},l.prototype.recoverPubKey=function(u,c,h,d){i((3&h)===h,"The recovery param is more than two bits"),c=new s(c,d);var p=this.n,v=new e(u),b=c.r,S=c.s,x=h&1,k=h>>1;if(b.cmp(this.curve.p.umod(this.curve.n))>=0&&k)throw new Error("Unable to find sencond key candinate");k?b=this.curve.pointFromX(b.add(this.curve.n),x):b=this.curve.pointFromX(b,x);var M=c.r.invm(p),P=p.sub(v).mul(M).umod(p),L=S.mul(M).umod(p);return this.g.mulAdd(P,b,L)},l.prototype.getKeyRecoveryParam=function(u,c,h,d){if(c=new s(c,d),c.recoveryParam!==null)return c.recoveryParam;for(var p=0;p<4;p++){var v;try{v=this.recoverPubKey(u,c,p)}catch{continue}if(v.eq(h))return p}throw new Error("Unable to find valid recovery factor")},By}var Py,dx;function Rj(){if(dx)return Py;dx=1;var e=Oi(),t=e.assert,r=e.parseBytes,n=e.cachedProperty;function o(i,a){this.eddsa=i,this._secret=r(a.secret),i.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=r(a.pub)}return o.fromPublic=function(a,s){return s instanceof o?s:new o(a,{pub:s})},o.fromSecret=function(a,s){return s instanceof o?s:new o(a,{secret:s})},o.prototype.secret=function(){return this._secret},n(o,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(o,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(o,"privBytes",function(){var a=this.eddsa,s=this.hash(),l=a.encodingLength-1,u=s.slice(0,a.encodingLength);return u[0]&=248,u[l]&=127,u[l]|=64,u}),n(o,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(o,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(o,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),o.prototype.sign=function(a){return t(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)},o.prototype.verify=function(a,s){return this.eddsa.verify(a,s,this)},o.prototype.getSecret=function(a){return t(this._secret,"KeyPair is public only"),e.encode(this.secret(),a)},o.prototype.getPublic=function(a){return e.encode(this.pubBytes(),a)},Py=o,Py}var Ry,hx;function Oj(){if(hx)return Ry;hx=1;var e=cn(),t=Oi(),r=t.assert,n=t.cachedProperty,o=t.parseBytes;function i(a,s){this.eddsa=a,typeof s!="object"&&(s=o(s)),Array.isArray(s)&&(s={R:s.slice(0,a.encodingLength),S:s.slice(a.encodingLength)}),r(s.R&&s.S,"Signature without R or S"),a.isPoint(s.R)&&(this._R=s.R),s.S instanceof e&&(this._S=s.S),this._Rencoded=Array.isArray(s.R)?s.R:s.Rencoded,this._Sencoded=Array.isArray(s.S)?s.S:s.Sencoded}return n(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},Ry=i,Ry}var Oy,px;function Nj(){if(px)return Oy;px=1;var e=xw(),t=Sw(),r=Oi(),n=r.assert,o=r.parseBytes,i=Rj(),a=Oj();function s(l){if(n(l==="ed25519","only tested with ed25519 so far"),!(this instanceof s))return new s(l);l=t[l].curve,this.curve=l,this.g=l.g,this.g.precompute(l.n.bitLength()+1),this.pointClass=l.point().constructor,this.encodingLength=Math.ceil(l.n.bitLength()/8),this.hash=e.sha512}return Oy=s,s.prototype.sign=function(u,c){u=o(u);var h=this.keyFromSecret(c),d=this.hashInt(h.messagePrefix(),u),p=this.g.mul(d),v=this.encodePoint(p),b=this.hashInt(v,h.pubBytes(),u).mul(h.priv()),S=d.add(b).umod(this.curve.n);return this.makeSignature({R:p,S,Rencoded:v})},s.prototype.verify=function(u,c,h){u=o(u),c=this.makeSignature(c);var d=this.keyFromPublic(h),p=this.hashInt(c.Rencoded(),d.pubBytes(),u),v=this.g.mul(c.S()),b=c.R().add(d.pub().mul(p));return b.eq(v)},s.prototype.hashInt=function(){for(var u=this.hash(),c=0;c0?f:g},i.min=function(f,g){return f.cmp(g)<0?f:g},i.prototype._init=function(f,g,w){if(typeof f=="number")return this._initNumber(f,g,w);if(typeof f=="object")return this._initArray(f,g,w);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var A=0;f[0]==="-"&&(A++,this.negative=1),A=0;A-=3)E=f[A]|f[A-1]<<8|f[A-2]<<16,this.words[T]|=E<>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);else if(w==="le")for(A=0,T=0;A>>26-C&67108863,C+=24,C>=26&&(C-=26,T++);return this._strip()};function s(y,f){var g=y.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+y)}function l(y,f,g){var w=s(y,g);return g-1>=f&&(w|=s(y,g-1)<<4),w}i.prototype._parseHex=function(f,g,w){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var A=0;A=g;A-=2)C=l(f,g,A)<=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8;else{var I=f.length-g;for(A=I%2===0?g+1:g;A=18?(T-=18,E+=1,this.words[E]|=C>>>26):T+=8}this._strip()};function u(y,f,g,w){for(var A=0,T=0,E=Math.min(y.length,g),C=f;C=49?T=I-49+10:I>=17?T=I-17+10:T=I,n(I>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","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"],p=[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],v=[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];i.prototype.toString=function(f,g){f=f||10,g=g|0||1;var w;if(f===16||f==="hex"){w="";for(var A=0,T=0,E=0;E>>24-A&16777215,A+=2,A>=26&&(A-=26,E--),T!==0||E!==this.length-1?w=d[6-I.length]+I+w:w=I+w}for(T!==0&&(w=T.toString(16)+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(f===(f|0)&&f>=2&&f<=36){var m=p[f],B=v[f];w="";var ne=this.clone();for(ne.negative=0;!ne.isZero();){var de=ne.modrn(B).toString(f);ne=ne.idivn(B),ne.isZero()?w=de+w:w=d[m-de.length]+de+w}for(this.isZero()&&(w="0"+w);w.length%g!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(f,g){return this.toArrayLike(a,f,g)}),i.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};i.prototype.toArrayLike=function(f,g,w){this._strip();var A=this.byteLength(),T=w||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var E=b(f,T),C=g==="le"?"LE":"BE";return this["_toArrayLike"+C](E,A),E},i.prototype._toArrayLikeLE=function(f,g){for(var w=0,A=0,T=0,E=0;T>8&255),w>16&255),E===6?(w>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w=0&&(f[w--]=C>>8&255),w>=0&&(f[w--]=C>>16&255),E===6?(w>=0&&(f[w--]=C>>24&255),A=0,E=0):(A=C>>>24,E+=2)}if(w>=0)for(f[w--]=A;w>=0;)f[w--]=0},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var g=f,w=0;return g>=4096&&(w+=13,g>>>=13),g>=64&&(w+=7,g>>>=7),g>=8&&(w+=4,g>>>=4),g>=2&&(w+=2,g>>>=2),w+g},i.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,w=0;return g&8191||(w+=13,g>>>=13),g&127||(w+=7,g>>>=7),g&15||(w+=4,g>>>=4),g&3||(w+=2,g>>>=2),g&1||w++,w},i.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function S(y){for(var f=new Array(y.bitLength()),g=0;g>>A&1}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var w=0;wf.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var g,w;this.length>f.length?(g=this,w=f):(g=f,w=this);for(var A=0;Af.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,w=f%26;this._expand(g),w>0&&g--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-w),this._strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var w=f/26|0,A=f%26;return this._expand(w+1),g?this.words[w]=this.words[w]|1<f.length?(w=this,A=f):(w=f,A=this);for(var T=0,E=0;E>>26;for(;T!==0&&E>>26;if(this.length=w.length,T!==0)this.words[this.length]=T,this.length++;else if(w!==this)for(;Ef.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var w=this.cmp(f);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;w>0?(A=this,T=f):(A=f,T=this);for(var E=0,C=0;C>26,this.words[C]=g&67108863;for(;E!==0&&C>26,this.words[C]=g&67108863;if(E===0&&C>>26,ne=I&67108863,de=Math.min(m,f.length-1),$=Math.max(0,m-y.length+1);$<=de;$++){var he=m-$|0;A=y.words[he]|0,T=f.words[$]|0,E=A*T+ne,B+=E/67108864|0,ne=E&67108863}g.words[m]=ne|0,I=B|0}return I!==0?g.words[m]=I|0:g.length--,g._strip()}var k=function(f,g,w){var A=f.words,T=g.words,E=w.words,C=0,I,m,B,ne=A[0]|0,de=ne&8191,$=ne>>>13,he=A[1]|0,X=he&8191,se=he>>>13,pe=A[2]|0,W=pe&8191,q=pe>>>13,ye=A[3]|0,xe=ye&8191,Me=ye>>>13,Q=A[4]|0,N=Q&8191,D=Q>>>13,G=A[5]|0,me=G&8191,_e=G>>>13,Pe=A[6]|0,Fe=Pe&8191,Re=Pe>>>13,le=A[7]|0,Y=le&8191,re=le>>>13,ge=A[8]|0,be=ge&8191,ce=ge>>>13,Ie=A[9]|0,ke=Ie&8191,Te=Ie>>>13,ze=T[0]|0,We=ze&8191,Ne=ze>>>13,Ze=T[1]|0,De=Ze&8191,Le=Ze>>>13,gt=T[2]|0,rt=gt&8191,Ye=gt>>>13,kt=T[3]|0,ht=kt&8191,tt=kt>>>13,Nt=T[4]|0,It=Nt&8191,ut=Nt>>>13,Yt=T[5]|0,Tt=Yt&8191,at=Yt>>>13,lr=T[6]|0,z=lr&8191,J=lr>>>13,ee=T[7]|0,O=ee&8191,te=ee>>>13,Ae=T[8]|0,Ee=Ae&8191,Be=Ae>>>13,qe=T[9]|0,He=qe&8191,$e=qe>>>13;w.negative=f.negative^g.negative,w.length=19,I=Math.imul(de,We),m=Math.imul(de,Ne),m=m+Math.imul($,We)|0,B=Math.imul($,Ne);var Lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,I=Math.imul(X,We),m=Math.imul(X,Ne),m=m+Math.imul(se,We)|0,B=Math.imul(se,Ne),I=I+Math.imul(de,De)|0,m=m+Math.imul(de,Le)|0,m=m+Math.imul($,De)|0,B=B+Math.imul($,Le)|0;var ot=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ot>>>26)|0,ot&=67108863,I=Math.imul(W,We),m=Math.imul(W,Ne),m=m+Math.imul(q,We)|0,B=Math.imul(q,Ne),I=I+Math.imul(X,De)|0,m=m+Math.imul(X,Le)|0,m=m+Math.imul(se,De)|0,B=B+Math.imul(se,Le)|0,I=I+Math.imul(de,rt)|0,m=m+Math.imul(de,Ye)|0,m=m+Math.imul($,rt)|0,B=B+Math.imul($,Ye)|0;var vt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(vt>>>26)|0,vt&=67108863,I=Math.imul(xe,We),m=Math.imul(xe,Ne),m=m+Math.imul(Me,We)|0,B=Math.imul(Me,Ne),I=I+Math.imul(W,De)|0,m=m+Math.imul(W,Le)|0,m=m+Math.imul(q,De)|0,B=B+Math.imul(q,Le)|0,I=I+Math.imul(X,rt)|0,m=m+Math.imul(X,Ye)|0,m=m+Math.imul(se,rt)|0,B=B+Math.imul(se,Ye)|0,I=I+Math.imul(de,ht)|0,m=m+Math.imul(de,tt)|0,m=m+Math.imul($,ht)|0,B=B+Math.imul($,tt)|0;var yt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(yt>>>26)|0,yt&=67108863,I=Math.imul(N,We),m=Math.imul(N,Ne),m=m+Math.imul(D,We)|0,B=Math.imul(D,Ne),I=I+Math.imul(xe,De)|0,m=m+Math.imul(xe,Le)|0,m=m+Math.imul(Me,De)|0,B=B+Math.imul(Me,Le)|0,I=I+Math.imul(W,rt)|0,m=m+Math.imul(W,Ye)|0,m=m+Math.imul(q,rt)|0,B=B+Math.imul(q,Ye)|0,I=I+Math.imul(X,ht)|0,m=m+Math.imul(X,tt)|0,m=m+Math.imul(se,ht)|0,B=B+Math.imul(se,tt)|0,I=I+Math.imul(de,It)|0,m=m+Math.imul(de,ut)|0,m=m+Math.imul($,It)|0,B=B+Math.imul($,ut)|0;var Ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,I=Math.imul(me,We),m=Math.imul(me,Ne),m=m+Math.imul(_e,We)|0,B=Math.imul(_e,Ne),I=I+Math.imul(N,De)|0,m=m+Math.imul(N,Le)|0,m=m+Math.imul(D,De)|0,B=B+Math.imul(D,Le)|0,I=I+Math.imul(xe,rt)|0,m=m+Math.imul(xe,Ye)|0,m=m+Math.imul(Me,rt)|0,B=B+Math.imul(Me,Ye)|0,I=I+Math.imul(W,ht)|0,m=m+Math.imul(W,tt)|0,m=m+Math.imul(q,ht)|0,B=B+Math.imul(q,tt)|0,I=I+Math.imul(X,It)|0,m=m+Math.imul(X,ut)|0,m=m+Math.imul(se,It)|0,B=B+Math.imul(se,ut)|0,I=I+Math.imul(de,Tt)|0,m=m+Math.imul(de,at)|0,m=m+Math.imul($,Tt)|0,B=B+Math.imul($,at)|0;var St=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(St>>>26)|0,St&=67108863,I=Math.imul(Fe,We),m=Math.imul(Fe,Ne),m=m+Math.imul(Re,We)|0,B=Math.imul(Re,Ne),I=I+Math.imul(me,De)|0,m=m+Math.imul(me,Le)|0,m=m+Math.imul(_e,De)|0,B=B+Math.imul(_e,Le)|0,I=I+Math.imul(N,rt)|0,m=m+Math.imul(N,Ye)|0,m=m+Math.imul(D,rt)|0,B=B+Math.imul(D,Ye)|0,I=I+Math.imul(xe,ht)|0,m=m+Math.imul(xe,tt)|0,m=m+Math.imul(Me,ht)|0,B=B+Math.imul(Me,tt)|0,I=I+Math.imul(W,It)|0,m=m+Math.imul(W,ut)|0,m=m+Math.imul(q,It)|0,B=B+Math.imul(q,ut)|0,I=I+Math.imul(X,Tt)|0,m=m+Math.imul(X,at)|0,m=m+Math.imul(se,Tt)|0,B=B+Math.imul(se,at)|0,I=I+Math.imul(de,z)|0,m=m+Math.imul(de,J)|0,m=m+Math.imul($,z)|0,B=B+Math.imul($,J)|0;var bt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(bt>>>26)|0,bt&=67108863,I=Math.imul(Y,We),m=Math.imul(Y,Ne),m=m+Math.imul(re,We)|0,B=Math.imul(re,Ne),I=I+Math.imul(Fe,De)|0,m=m+Math.imul(Fe,Le)|0,m=m+Math.imul(Re,De)|0,B=B+Math.imul(Re,Le)|0,I=I+Math.imul(me,rt)|0,m=m+Math.imul(me,Ye)|0,m=m+Math.imul(_e,rt)|0,B=B+Math.imul(_e,Ye)|0,I=I+Math.imul(N,ht)|0,m=m+Math.imul(N,tt)|0,m=m+Math.imul(D,ht)|0,B=B+Math.imul(D,tt)|0,I=I+Math.imul(xe,It)|0,m=m+Math.imul(xe,ut)|0,m=m+Math.imul(Me,It)|0,B=B+Math.imul(Me,ut)|0,I=I+Math.imul(W,Tt)|0,m=m+Math.imul(W,at)|0,m=m+Math.imul(q,Tt)|0,B=B+Math.imul(q,at)|0,I=I+Math.imul(X,z)|0,m=m+Math.imul(X,J)|0,m=m+Math.imul(se,z)|0,B=B+Math.imul(se,J)|0,I=I+Math.imul(de,O)|0,m=m+Math.imul(de,te)|0,m=m+Math.imul($,O)|0,B=B+Math.imul($,te)|0;var xt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(xt>>>26)|0,xt&=67108863,I=Math.imul(be,We),m=Math.imul(be,Ne),m=m+Math.imul(ce,We)|0,B=Math.imul(ce,Ne),I=I+Math.imul(Y,De)|0,m=m+Math.imul(Y,Le)|0,m=m+Math.imul(re,De)|0,B=B+Math.imul(re,Le)|0,I=I+Math.imul(Fe,rt)|0,m=m+Math.imul(Fe,Ye)|0,m=m+Math.imul(Re,rt)|0,B=B+Math.imul(Re,Ye)|0,I=I+Math.imul(me,ht)|0,m=m+Math.imul(me,tt)|0,m=m+Math.imul(_e,ht)|0,B=B+Math.imul(_e,tt)|0,I=I+Math.imul(N,It)|0,m=m+Math.imul(N,ut)|0,m=m+Math.imul(D,It)|0,B=B+Math.imul(D,ut)|0,I=I+Math.imul(xe,Tt)|0,m=m+Math.imul(xe,at)|0,m=m+Math.imul(Me,Tt)|0,B=B+Math.imul(Me,at)|0,I=I+Math.imul(W,z)|0,m=m+Math.imul(W,J)|0,m=m+Math.imul(q,z)|0,B=B+Math.imul(q,J)|0,I=I+Math.imul(X,O)|0,m=m+Math.imul(X,te)|0,m=m+Math.imul(se,O)|0,B=B+Math.imul(se,te)|0,I=I+Math.imul(de,Ee)|0,m=m+Math.imul(de,Be)|0,m=m+Math.imul($,Ee)|0,B=B+Math.imul($,Be)|0;var wt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(wt>>>26)|0,wt&=67108863,I=Math.imul(ke,We),m=Math.imul(ke,Ne),m=m+Math.imul(Te,We)|0,B=Math.imul(Te,Ne),I=I+Math.imul(be,De)|0,m=m+Math.imul(be,Le)|0,m=m+Math.imul(ce,De)|0,B=B+Math.imul(ce,Le)|0,I=I+Math.imul(Y,rt)|0,m=m+Math.imul(Y,Ye)|0,m=m+Math.imul(re,rt)|0,B=B+Math.imul(re,Ye)|0,I=I+Math.imul(Fe,ht)|0,m=m+Math.imul(Fe,tt)|0,m=m+Math.imul(Re,ht)|0,B=B+Math.imul(Re,tt)|0,I=I+Math.imul(me,It)|0,m=m+Math.imul(me,ut)|0,m=m+Math.imul(_e,It)|0,B=B+Math.imul(_e,ut)|0,I=I+Math.imul(N,Tt)|0,m=m+Math.imul(N,at)|0,m=m+Math.imul(D,Tt)|0,B=B+Math.imul(D,at)|0,I=I+Math.imul(xe,z)|0,m=m+Math.imul(xe,J)|0,m=m+Math.imul(Me,z)|0,B=B+Math.imul(Me,J)|0,I=I+Math.imul(W,O)|0,m=m+Math.imul(W,te)|0,m=m+Math.imul(q,O)|0,B=B+Math.imul(q,te)|0,I=I+Math.imul(X,Ee)|0,m=m+Math.imul(X,Be)|0,m=m+Math.imul(se,Ee)|0,B=B+Math.imul(se,Be)|0,I=I+Math.imul(de,He)|0,m=m+Math.imul(de,$e)|0,m=m+Math.imul($,He)|0,B=B+Math.imul($,$e)|0;var st=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(ke,De),m=Math.imul(ke,Le),m=m+Math.imul(Te,De)|0,B=Math.imul(Te,Le),I=I+Math.imul(be,rt)|0,m=m+Math.imul(be,Ye)|0,m=m+Math.imul(ce,rt)|0,B=B+Math.imul(ce,Ye)|0,I=I+Math.imul(Y,ht)|0,m=m+Math.imul(Y,tt)|0,m=m+Math.imul(re,ht)|0,B=B+Math.imul(re,tt)|0,I=I+Math.imul(Fe,It)|0,m=m+Math.imul(Fe,ut)|0,m=m+Math.imul(Re,It)|0,B=B+Math.imul(Re,ut)|0,I=I+Math.imul(me,Tt)|0,m=m+Math.imul(me,at)|0,m=m+Math.imul(_e,Tt)|0,B=B+Math.imul(_e,at)|0,I=I+Math.imul(N,z)|0,m=m+Math.imul(N,J)|0,m=m+Math.imul(D,z)|0,B=B+Math.imul(D,J)|0,I=I+Math.imul(xe,O)|0,m=m+Math.imul(xe,te)|0,m=m+Math.imul(Me,O)|0,B=B+Math.imul(Me,te)|0,I=I+Math.imul(W,Ee)|0,m=m+Math.imul(W,Be)|0,m=m+Math.imul(q,Ee)|0,B=B+Math.imul(q,Be)|0,I=I+Math.imul(X,He)|0,m=m+Math.imul(X,$e)|0,m=m+Math.imul(se,He)|0,B=B+Math.imul(se,$e)|0;var ct=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ct>>>26)|0,ct&=67108863,I=Math.imul(ke,rt),m=Math.imul(ke,Ye),m=m+Math.imul(Te,rt)|0,B=Math.imul(Te,Ye),I=I+Math.imul(be,ht)|0,m=m+Math.imul(be,tt)|0,m=m+Math.imul(ce,ht)|0,B=B+Math.imul(ce,tt)|0,I=I+Math.imul(Y,It)|0,m=m+Math.imul(Y,ut)|0,m=m+Math.imul(re,It)|0,B=B+Math.imul(re,ut)|0,I=I+Math.imul(Fe,Tt)|0,m=m+Math.imul(Fe,at)|0,m=m+Math.imul(Re,Tt)|0,B=B+Math.imul(Re,at)|0,I=I+Math.imul(me,z)|0,m=m+Math.imul(me,J)|0,m=m+Math.imul(_e,z)|0,B=B+Math.imul(_e,J)|0,I=I+Math.imul(N,O)|0,m=m+Math.imul(N,te)|0,m=m+Math.imul(D,O)|0,B=B+Math.imul(D,te)|0,I=I+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Be)|0,m=m+Math.imul(Me,Ee)|0,B=B+Math.imul(Me,Be)|0,I=I+Math.imul(W,He)|0,m=m+Math.imul(W,$e)|0,m=m+Math.imul(q,He)|0,B=B+Math.imul(q,$e)|0;var nt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(nt>>>26)|0,nt&=67108863,I=Math.imul(ke,ht),m=Math.imul(ke,tt),m=m+Math.imul(Te,ht)|0,B=Math.imul(Te,tt),I=I+Math.imul(be,It)|0,m=m+Math.imul(be,ut)|0,m=m+Math.imul(ce,It)|0,B=B+Math.imul(ce,ut)|0,I=I+Math.imul(Y,Tt)|0,m=m+Math.imul(Y,at)|0,m=m+Math.imul(re,Tt)|0,B=B+Math.imul(re,at)|0,I=I+Math.imul(Fe,z)|0,m=m+Math.imul(Fe,J)|0,m=m+Math.imul(Re,z)|0,B=B+Math.imul(Re,J)|0,I=I+Math.imul(me,O)|0,m=m+Math.imul(me,te)|0,m=m+Math.imul(_e,O)|0,B=B+Math.imul(_e,te)|0,I=I+Math.imul(N,Ee)|0,m=m+Math.imul(N,Be)|0,m=m+Math.imul(D,Ee)|0,B=B+Math.imul(D,Be)|0,I=I+Math.imul(xe,He)|0,m=m+Math.imul(xe,$e)|0,m=m+Math.imul(Me,He)|0,B=B+Math.imul(Me,$e)|0;var lt=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(lt>>>26)|0,lt&=67108863,I=Math.imul(ke,It),m=Math.imul(ke,ut),m=m+Math.imul(Te,It)|0,B=Math.imul(Te,ut),I=I+Math.imul(be,Tt)|0,m=m+Math.imul(be,at)|0,m=m+Math.imul(ce,Tt)|0,B=B+Math.imul(ce,at)|0,I=I+Math.imul(Y,z)|0,m=m+Math.imul(Y,J)|0,m=m+Math.imul(re,z)|0,B=B+Math.imul(re,J)|0,I=I+Math.imul(Fe,O)|0,m=m+Math.imul(Fe,te)|0,m=m+Math.imul(Re,O)|0,B=B+Math.imul(Re,te)|0,I=I+Math.imul(me,Ee)|0,m=m+Math.imul(me,Be)|0,m=m+Math.imul(_e,Ee)|0,B=B+Math.imul(_e,Be)|0,I=I+Math.imul(N,He)|0,m=m+Math.imul(N,$e)|0,m=m+Math.imul(D,He)|0,B=B+Math.imul(D,$e)|0;var fe=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(fe>>>26)|0,fe&=67108863,I=Math.imul(ke,Tt),m=Math.imul(ke,at),m=m+Math.imul(Te,Tt)|0,B=Math.imul(Te,at),I=I+Math.imul(be,z)|0,m=m+Math.imul(be,J)|0,m=m+Math.imul(ce,z)|0,B=B+Math.imul(ce,J)|0,I=I+Math.imul(Y,O)|0,m=m+Math.imul(Y,te)|0,m=m+Math.imul(re,O)|0,B=B+Math.imul(re,te)|0,I=I+Math.imul(Fe,Ee)|0,m=m+Math.imul(Fe,Be)|0,m=m+Math.imul(Re,Ee)|0,B=B+Math.imul(Re,Be)|0,I=I+Math.imul(me,He)|0,m=m+Math.imul(me,$e)|0,m=m+Math.imul(_e,He)|0,B=B+Math.imul(_e,$e)|0;var R=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(R>>>26)|0,R&=67108863,I=Math.imul(ke,z),m=Math.imul(ke,J),m=m+Math.imul(Te,z)|0,B=Math.imul(Te,J),I=I+Math.imul(be,O)|0,m=m+Math.imul(be,te)|0,m=m+Math.imul(ce,O)|0,B=B+Math.imul(ce,te)|0,I=I+Math.imul(Y,Ee)|0,m=m+Math.imul(Y,Be)|0,m=m+Math.imul(re,Ee)|0,B=B+Math.imul(re,Be)|0,I=I+Math.imul(Fe,He)|0,m=m+Math.imul(Fe,$e)|0,m=m+Math.imul(Re,He)|0,B=B+Math.imul(Re,$e)|0;var F=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(F>>>26)|0,F&=67108863,I=Math.imul(ke,O),m=Math.imul(ke,te),m=m+Math.imul(Te,O)|0,B=Math.imul(Te,te),I=I+Math.imul(be,Ee)|0,m=m+Math.imul(be,Be)|0,m=m+Math.imul(ce,Ee)|0,B=B+Math.imul(ce,Be)|0,I=I+Math.imul(Y,He)|0,m=m+Math.imul(Y,$e)|0,m=m+Math.imul(re,He)|0,B=B+Math.imul(re,$e)|0;var H=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(H>>>26)|0,H&=67108863,I=Math.imul(ke,Ee),m=Math.imul(ke,Be),m=m+Math.imul(Te,Ee)|0,B=Math.imul(Te,Be),I=I+Math.imul(be,He)|0,m=m+Math.imul(be,$e)|0,m=m+Math.imul(ce,He)|0,B=B+Math.imul(ce,$e)|0;var ae=(C+I|0)+((m&8191)<<13)|0;C=(B+(m>>>13)|0)+(ae>>>26)|0,ae&=67108863,I=Math.imul(ke,He),m=Math.imul(ke,$e),m=m+Math.imul(Te,He)|0,B=Math.imul(Te,$e);var oe=(C+I|0)+((m&8191)<<13)|0;return C=(B+(m>>>13)|0)+(oe>>>26)|0,oe&=67108863,E[0]=Lt,E[1]=ot,E[2]=vt,E[3]=yt,E[4]=Ct,E[5]=St,E[6]=bt,E[7]=xt,E[8]=wt,E[9]=st,E[10]=ct,E[11]=nt,E[12]=lt,E[13]=fe,E[14]=R,E[15]=F,E[16]=H,E[17]=ae,E[18]=oe,C!==0&&(E[19]=C,w.length++),w};Math.imul||(k=x);function M(y,f,g){g.negative=f.negative^y.negative,g.length=y.length+f.length;for(var w=0,A=0,T=0;T>>26)|0,A+=E>>>26,E&=67108863}g.words[T]=C,w=E,E=A}return w!==0?g.words[T]=w:g.length--,g._strip()}function P(y,f,g){return M(y,f,g)}i.prototype.mulTo=function(f,g){var w,A=this.length+f.length;return this.length===10&&f.length===10?w=k(this,f,g):A<63?w=x(this,f,g):A<1024?w=M(this,f,g):w=P(this,f,g),w},i.prototype.mul=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},i.prototype.mulf=function(f){var g=new i(null);return g.words=new Array(this.length+f.length),P(this,f,g)},i.prototype.imul=function(f){return this.clone().mulTo(f,this)},i.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var w=0,A=0;A>=26,w+=T/67108864|0,w+=E>>>26,this.words[A]=E&67108863}return w!==0&&(this.words[A]=w,this.length++),g?this.ineg():this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var g=S(f);if(g.length===0)return new i(1);for(var w=this,A=0;A=0);var g=f%26,w=(f-g)/26,A=67108863>>>26-g<<26-g,T;if(g!==0){var E=0;for(T=0;T>>26-g}E&&(this.words[T]=E,this.length++)}if(w!==0){for(T=this.length-1;T>=0;T--)this.words[T+w]=this.words[T];for(T=0;T=0);var A;g?A=(g-g%26)/26:A=0;var T=f%26,E=Math.min((f-T)/26,this.length),C=67108863^67108863>>>T<E)for(this.length-=E,m=0;m=0&&(B!==0||m>=A);m--){var ne=this.words[m]|0;this.words[m]=B<<26-T|ne>>>T,B=ne&C}return I&&B!==0&&(I.words[I.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(f,g,w){return n(this.negative===0),this.iushrn(f,g,w)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,w=(f-g)/26,A=1<=0);var g=f%26,w=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(g!==0&&w++,this.length=Math.min(w,this.length),g!==0){var A=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(I/67108864|0),this.words[T+w]=E&67108863}for(;T>26,this.words[T+w]=E&67108863;if(C===0)return this._strip();for(n(C===-1),C=0,T=0;T>26,this.words[T]=E&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(f,g){var w=this.length-f.length,A=this.clone(),T=f,E=T.words[T.length-1]|0,C=this._countBits(E);w=26-C,w!==0&&(T=T.ushln(w),A.iushln(w),E=T.words[T.length-1]|0);var I=A.length-T.length,m;if(g!=="mod"){m=new i(null),m.length=I+1,m.words=new Array(m.length);for(var B=0;B=0;de--){var $=(A.words[T.length+de]|0)*67108864+(A.words[T.length+de-1]|0);for($=Math.min($/E|0,67108863),A._ishlnsubmul(T,$,de);A.negative!==0;)$--,A.negative=0,A._ishlnsubmul(T,1,de),A.isZero()||(A.negative^=1);m&&(m.words[de]=$)}return m&&m._strip(),A._strip(),g!=="div"&&w!==0&&A.iushrn(w),{div:m||null,mod:A}},i.prototype.divmod=function(f,g,w){if(n(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var A,T,E;return this.negative!==0&&f.negative===0?(E=this.neg().divmod(f,g),g!=="mod"&&(A=E.div.neg()),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.iadd(f)),{div:A,mod:T}):this.negative===0&&f.negative!==0?(E=this.divmod(f.neg(),g),g!=="mod"&&(A=E.div.neg()),{div:A,mod:E.mod}):this.negative&f.negative?(E=this.neg().divmod(f.neg(),g),g!=="div"&&(T=E.mod.neg(),w&&T.negative!==0&&T.isub(f)),{div:E.div,mod:T}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modrn(f.words[0]))}:this._wordDiv(f,g)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var w=g.div.negative!==0?g.mod.isub(f):g.mod,A=f.ushrn(1),T=f.andln(1),E=w.cmp(A);return E<0||T===1&&E===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=(1<<26)%f,A=0,T=this.length-1;T>=0;T--)A=(w*A+(this.words[T]|0))%f;return g?-A:A},i.prototype.modn=function(f){return this.modrn(f)},i.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var w=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+w*67108864;this.words[A]=T/f|0,w=T%f}return this._strip(),g?this.ineg():this},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=new i(0),C=new i(1),I=0;g.isEven()&&w.isEven();)g.iushrn(1),w.iushrn(1),++I;for(var m=w.clone(),B=g.clone();!g.isZero();){for(var ne=0,de=1;!(g.words[0]&de)&&ne<26;++ne,de<<=1);if(ne>0)for(g.iushrn(ne);ne-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(m),T.isub(B)),A.iushrn(1),T.iushrn(1);for(var $=0,he=1;!(w.words[0]&he)&&$<26;++$,he<<=1);if($>0)for(w.iushrn($);$-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(B)),E.iushrn(1),C.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(E),T.isub(C)):(w.isub(g),E.isub(A),C.isub(T))}return{a:E,b:C,gcd:w.iushln(I)}},i.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,w=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var A=new i(1),T=new i(0),E=w.clone();g.cmpn(1)>0&&w.cmpn(1)>0;){for(var C=0,I=1;!(g.words[0]&I)&&C<26;++C,I<<=1);if(C>0)for(g.iushrn(C);C-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);for(var m=0,B=1;!(w.words[0]&B)&&m<26;++m,B<<=1);if(m>0)for(w.iushrn(m);m-- >0;)T.isOdd()&&T.iadd(E),T.iushrn(1);g.cmp(w)>=0?(g.isub(w),A.isub(T)):(w.isub(g),T.isub(A))}var ne;return g.cmpn(1)===0?ne=A:ne=T,ne.cmpn(0)<0&&ne.iadd(f),ne},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),w=f.clone();g.negative=0,w.negative=0;for(var A=0;g.isEven()&&w.isEven();A++)g.iushrn(1),w.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;w.isEven();)w.iushrn(1);var T=g.cmp(w);if(T<0){var E=g;g=w,w=E}else if(T===0||w.cmpn(1)===0)break;g.isub(w)}while(!0);return w.iushln(A)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,w=(f-g)/26,A=1<>>26,C&=67108863,this.words[E]=C}return T!==0&&(this.words[E]=T,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var w;if(this.length>1)w=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var A=this.words[0]|0;w=A===f?0:Af.length)return 1;if(this.length=0;w--){var A=this.words[w]|0,T=f.words[w]|0;if(A!==T){AT&&(g=1);break}}return g},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new U(f)},i.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function j(y,f){this.name=y,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,w;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),w=g.bitLength();while(w>this.n);var A=w0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function V(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(V,j),V.prototype.split=function(f,g){for(var w=4194303,A=Math.min(f.length,9),T=0;T>>22,E=C}E>>>=22,f.words[T-10]=E,E===0&&f.length>10?f.length-=10:f.length-=9},V.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,w=0;w>>=26,f.words[w]=T,g=A}return g!==0&&(f.words[f.length++]=g),f},i._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new V;else if(f==="p224")g=new K;else if(f==="p192")g=new Z;else if(f==="p25519")g=new ue;else throw new Error("Unknown prime "+f);return L[f]=g,g};function U(y){if(typeof y=="string"){var f=i._prime(y);this.m=f.p,this.prime=f}else n(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}U.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},U.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},U.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},U.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},U.prototype.add=function(f,g){this._verify2(f,g);var w=f.add(g);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},U.prototype.iadd=function(f,g){this._verify2(f,g);var w=f.iadd(g);return w.cmp(this.m)>=0&&w.isub(this.m),w},U.prototype.sub=function(f,g){this._verify2(f,g);var w=f.sub(g);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},U.prototype.isub=function(f,g){this._verify2(f,g);var w=f.isub(g);return w.cmpn(0)<0&&w.iadd(this.m),w},U.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},U.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},U.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},U.prototype.isqr=function(f){return this.imul(f,f.clone())},U.prototype.sqr=function(f){return this.mul(f,f)},U.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var w=this.m.add(new i(1)).iushrn(2);return this.pow(f,w)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var E=new i(1).toRed(this),C=E.redNeg(),I=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new i(2*m*m).toRed(this);this.pow(m,I).cmp(C)!==0;)m.redIAdd(C);for(var B=this.pow(m,A),ne=this.pow(f,A.addn(1).iushrn(1)),de=this.pow(f,A),$=T;de.cmp(E)!==0;){for(var he=de,X=0;he.cmp(E)!==0;X++)he=he.redSqr();n(X<$);var se=this.pow(B,new i(1).iushln($-X-1));ne=ne.redMul(se),B=se.redSqr(),de=de.redMul(B),$=X}return ne},U.prototype.invm=function(f){var g=f._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},U.prototype.pow=function(f,g){if(g.isZero())return new i(1).toRed(this);if(g.cmpn(1)===0)return f.clone();var w=4,A=new Array(1<=0;T--){for(var B=g.words[T],ne=m-1;ne>=0;ne--){var de=B>>ne&1;if(E!==A[0]&&(E=this.sqr(E)),de===0&&C===0){I=0;continue}C<<=1,C|=de,I++,!(I!==w&&(T!==0||ne!==0))&&(E=this.mul(E,A[C]),I=0,C=0)}m=26}return E},U.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},U.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},i.mont=function(f){return new _(f)};function _(y){U.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}o(_,U),_.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},_.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},_.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var w=f.imul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new i(0)._forceRed(this);var w=f.mul(g),A=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=w.isub(A).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},_.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(e,Ke)}(Lj)),sp}var _i={},Ny={},Ly={},Dy={},Uy,vx;function Ew(){if(vx)return Uy;vx=1;var e=Oe,t=e.Buffer,r={},n;for(n in e)e.hasOwnProperty(n)&&(n==="SlowBuffer"||n==="Buffer"||(r[n]=e[n]));var o=r.Buffer={};for(n in t)t.hasOwnProperty(n)&&(n==="allocUnsafe"||n==="allocUnsafeSlow"||(o[n]=t[n]));if(r.Buffer.prototype=t.prototype,(!o.from||o.from===Uint8Array.from)&&(o.from=function(i,a,s){if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&typeof i.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return t(i,a,s)}),o.alloc||(o.alloc=function(i,a,s){if(typeof i!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var l=t(i);return!a||a.length===0?l.fill(0):typeof s=="string"?l.fill(a,s):l.fill(a),l}),!r.kStringMaxLength)try{r.kStringMaxLength=_t.binding("buffer").kStringMaxLength}catch{}return r.constants||(r.constants={MAX_LENGTH:r.kMaxLength},r.kStringMaxLength&&(r.constants.MAX_STRING_LENGTH=r.kStringMaxLength)),Uy=r,Uy}var jy={},yx;function kw(){if(yx)return jy;yx=1;const e=Ht();function t(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}jy.Reporter=t,t.prototype.isError=function(o){return o instanceof r},t.prototype.save=function(){const o=this._reporterState;return{obj:o.obj,pathLen:o.path.length}},t.prototype.restore=function(o){const i=this._reporterState;i.obj=o.obj,i.path=i.path.slice(0,o.pathLen)},t.prototype.enterKey=function(o){return this._reporterState.path.push(o)},t.prototype.exitKey=function(o){const i=this._reporterState;i.path=i.path.slice(0,o-1)},t.prototype.leaveKey=function(o,i,a){const s=this._reporterState;this.exitKey(o),s.obj!==null&&(s.obj[i]=a)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){const o=this._reporterState,i=o.obj;return o.obj={},i},t.prototype.leaveObject=function(o){const i=this._reporterState,a=i.obj;return i.obj=o,a},t.prototype.error=function(o){let i;const a=this._reporterState,s=o instanceof r;if(s?i=o:i=new r(a.path.map(function(l){return"["+JSON.stringify(l)+"]"}).join(""),o.message||o,o.stack),!a.options.partial)throw i;return s||a.errors.push(i),i},t.prototype.wrapResult=function(o){const i=this._reporterState;return i.options.partial?{result:this.isError(o)?null:o,errors:i.errors}:o};function r(n,o){this.path=n,this.rethrow(o)}return e(r,Error),r.prototype.rethrow=function(o){if(this.message=o+" 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},jy}var $h={},bx;function ud(){if(bx)return $h;bx=1;const e=Ht(),t=kw().Reporter,r=Ew().Buffer;function n(i,a){if(t.call(this,a),!r.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}e(n,t),$h.DecoderBuffer=n,n.isDecoderBuffer=function(a){return a instanceof n?!0:typeof a=="object"&&r.isBuffer(a.base)&&a.constructor.name==="DecoderBuffer"&&typeof a.offset=="number"&&typeof a.length=="number"&&typeof a.save=="function"&&typeof a.restore=="function"&&typeof a.isEmpty=="function"&&typeof a.readUInt8=="function"&&typeof a.skip=="function"&&typeof a.raw=="function"},n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(a){const s=new n(this.base);return s.offset=a.offset,s.length=this.offset,this.offset=a.offset,t.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");const l=new n(this.base);return l._reporterState=this._reporterState,l.offset=this.offset,l.length=this.offset+a,this.offset+=a,l},n.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)};function o(i,a){if(Array.isArray(i))this.length=0,this.value=i.map(function(s){return o.isEncoderBuffer(s)||(s=new o(s,a)),this.length+=s.length,s},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return a.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=r.byteLength(i);else if(r.isBuffer(i))this.value=i,this.length=i.length;else return a.error("Unsupported type: "+typeof i)}return $h.EncoderBuffer=o,o.isEncoderBuffer=function(a){return a instanceof o?!0:typeof a=="object"&&a.constructor.name==="EncoderBuffer"&&typeof a.length=="number"&&typeof a.join=="function"},o.prototype.join=function(a,s){return a||(a=r.alloc(this.length)),s||(s=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(l){l.join(a,s),s+=l.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},$h}var Fy,wx;function Aw(){if(wx)return Fy;wx=1;const e=kw().Reporter,t=ud().EncoderBuffer,r=ud().DecoderBuffer,n=Ri(),o=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o),a=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function s(u,c,h){const d={};this._baseState=d,d.name=h,d.enc=u,d.parent=c||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())}Fy=s;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return s.prototype.clone=function(){const c=this._baseState,h={};l.forEach(function(p){h[p]=c[p]});const d=new this.constructor(h.parent);return d._baseState=h,d},s.prototype._wrap=function(){const c=this._baseState;i.forEach(function(h){this[h]=function(){const p=new this.constructor(this);return c.children.push(p),p[h].apply(p,arguments)}},this)},s.prototype._init=function(c){const h=this._baseState;n(h.parent===null),c.call(this),h.children=h.children.filter(function(d){return d._baseState.parent===this},this),n.equal(h.children.length,1,"Root node can have only one child")},s.prototype._useArgs=function(c){const h=this._baseState,d=c.filter(function(p){return p instanceof this.constructor},this);c=c.filter(function(p){return!(p instanceof this.constructor)},this),d.length!==0&&(n(h.children===null),h.children=d,d.forEach(function(p){p._baseState.parent=this},this)),c.length!==0&&(n(h.args===null),h.args=c,h.reverseArgs=c.map(function(p){if(typeof p!="object"||p.constructor!==Object)return p;const v={};return Object.keys(p).forEach(function(b){b==(b|0)&&(b|=0);const S=p[b];v[S]=b}),v}))},a.forEach(function(u){s.prototype[u]=function(){const h=this._baseState;throw new Error(u+" not implemented for encoding: "+h.enc)}}),o.forEach(function(u){s.prototype[u]=function(){const h=this._baseState,d=Array.prototype.slice.call(arguments);return n(h.tag===null),h.tag=u,this._useArgs(d),this}}),s.prototype.use=function(c){n(c);const h=this._baseState;return n(h.use===null),h.use=c,this},s.prototype.optional=function(){const c=this._baseState;return c.optional=!0,this},s.prototype.def=function(c){const h=this._baseState;return n(h.default===null),h.default=c,h.optional=!0,this},s.prototype.explicit=function(c){const h=this._baseState;return n(h.explicit===null&&h.implicit===null),h.explicit=c,this},s.prototype.implicit=function(c){const h=this._baseState;return n(h.explicit===null&&h.implicit===null),h.implicit=c,this},s.prototype.obj=function(){const c=this._baseState,h=Array.prototype.slice.call(arguments);return c.obj=!0,h.length!==0&&this._useArgs(h),this},s.prototype.key=function(c){const h=this._baseState;return n(h.key===null),h.key=c,this},s.prototype.any=function(){const c=this._baseState;return c.any=!0,this},s.prototype.choice=function(c){const h=this._baseState;return n(h.choice===null),h.choice=c,this._useArgs(Object.keys(c).map(function(d){return c[d]})),this},s.prototype.contains=function(c){const h=this._baseState;return n(h.use===null),h.contains=c,this},s.prototype._decode=function(c,h){const d=this._baseState;if(d.parent===null)return c.wrapResult(d.children[0]._decode(c,h));let p=d.default,v=!0,b=null;if(d.key!==null&&(b=c.enterKey(d.key)),d.optional){let x=null;if(d.explicit!==null?x=d.explicit:d.implicit!==null?x=d.implicit:d.tag!==null&&(x=d.tag),x===null&&!d.any){const k=c.save();try{d.choice===null?this._decodeGeneric(d.tag,c,h):this._decodeChoice(c,h),v=!0}catch{v=!1}c.restore(k)}else if(v=this._peekTag(c,x,d.any),c.isError(v))return v}let S;if(d.obj&&v&&(S=c.enterObject()),v){if(d.explicit!==null){const k=this._decodeTag(c,d.explicit);if(c.isError(k))return k;c=k}const x=c.offset;if(d.use===null&&d.choice===null){let k;d.any&&(k=c.save());const M=this._decodeTag(c,d.implicit!==null?d.implicit:d.tag,d.any);if(c.isError(M))return M;d.any?p=c.raw(k):c=M}if(h&&h.track&&d.tag!==null&&h.track(c.path(),x,c.length,"tagged"),h&&h.track&&d.tag!==null&&h.track(c.path(),c.offset,c.length,"content"),d.any||(d.choice===null?p=this._decodeGeneric(d.tag,c,h):p=this._decodeChoice(c,h)),c.isError(p))return p;if(!d.any&&d.choice===null&&d.children!==null&&d.children.forEach(function(M){M._decode(c,h)}),d.contains&&(d.tag==="octstr"||d.tag==="bitstr")){const k=new r(p);p=this._getUse(d.contains,c._reporterState.obj)._decode(k,h)}}return d.obj&&v&&(p=c.leaveObject(S)),d.key!==null&&(p!==null||v===!0)?c.leaveKey(b,d.key,p):b!==null&&c.exitKey(b),p},s.prototype._decodeGeneric=function(c,h,d){const p=this._baseState;return c==="seq"||c==="set"?null:c==="seqof"||c==="setof"?this._decodeList(h,c,p.args[0],d):/str$/.test(c)?this._decodeStr(h,c,d):c==="objid"&&p.args?this._decodeObjid(h,p.args[0],p.args[1],d):c==="objid"?this._decodeObjid(h,null,null,d):c==="gentime"||c==="utctime"?this._decodeTime(h,c,d):c==="null_"?this._decodeNull(h,d):c==="bool"?this._decodeBool(h,d):c==="objDesc"?this._decodeStr(h,c,d):c==="int"||c==="enum"?this._decodeInt(h,p.args&&p.args[0],d):p.use!==null?this._getUse(p.use,h._reporterState.obj)._decode(h,d):h.error("unknown tag: "+c)},s.prototype._getUse=function(c,h){const d=this._baseState;return d.useDecoder=this._use(c,h),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},s.prototype._decodeChoice=function(c,h){const d=this._baseState;let p=null,v=!1;return Object.keys(d.choice).some(function(b){const S=c.save(),x=d.choice[b];try{const k=x._decode(c,h);if(c.isError(k))return!1;p={type:b,value:k},v=!0}catch{return c.restore(S),!1}return!0},this),v?p:c.error("Choice not matched")},s.prototype._createEncoderBuffer=function(c){return new t(c,this.reporter)},s.prototype._encode=function(c,h,d){const p=this._baseState;if(p.default!==null&&p.default===c)return;const v=this._encodeValue(c,h,d);if(v!==void 0&&!this._skipDefault(v,h,d))return v},s.prototype._encodeValue=function(c,h,d){const p=this._baseState;if(p.parent===null)return p.children[0]._encode(c,h||new e);let v=null;if(this.reporter=h,p.optional&&c===void 0)if(p.default!==null)c=p.default;else return;let b=null,S=!1;if(p.any)v=this._createEncoderBuffer(c);else if(p.choice)v=this._encodeChoice(c,h);else if(p.contains)b=this._getUse(p.contains,d)._encode(c,h),S=!0;else if(p.children)b=p.children.map(function(x){if(x._baseState.tag==="null_")return x._encode(null,h,c);if(x._baseState.key===null)return h.error("Child should have a key");const k=h.enterKey(x._baseState.key);if(typeof c!="object")return h.error("Child expected, but input is not object");const M=x._encode(c[x._baseState.key],h,c);return h.leaveKey(k),M},this).filter(function(x){return x}),b=this._createEncoderBuffer(b);else if(p.tag==="seqof"||p.tag==="setof"){if(!(p.args&&p.args.length===1))return h.error("Too many args for : "+p.tag);if(!Array.isArray(c))return h.error("seqof/setof, but data is not Array");const x=this.clone();x._baseState.implicit=null,b=this._createEncoderBuffer(c.map(function(k){const M=this._baseState;return this._getUse(M.args[0],c)._encode(k,h)},x))}else p.use!==null?v=this._getUse(p.use,d)._encode(c,h):(b=this._encodePrimitive(p.tag,c),S=!0);if(!p.any&&p.choice===null){const x=p.implicit!==null?p.implicit:p.tag,k=p.implicit===null?"universal":"context";x===null?p.use===null&&h.error("Tag could be omitted only for .use()"):p.use===null&&(v=this._encodeComposite(x,S,k,b))}return p.explicit!==null&&(v=this._encodeComposite(p.explicit,!1,"context",v)),v},s.prototype._encodeChoice=function(c,h){const d=this._baseState,p=d.choice[c.type];return p||n(!1,c.type+" not found in "+JSON.stringify(Object.keys(d.choice))),p._encode(c.value,h)},s.prototype._encodePrimitive=function(c,h){const d=this._baseState;if(/str$/.test(c))return this._encodeStr(h,c);if(c==="objid"&&d.args)return this._encodeObjid(h,d.reverseArgs[0],d.args[1]);if(c==="objid")return this._encodeObjid(h,null,null);if(c==="gentime"||c==="utctime")return this._encodeTime(h,c);if(c==="null_")return this._encodeNull();if(c==="int"||c==="enum")return this._encodeInt(h,d.args&&d.reverseArgs[0]);if(c==="bool")return this._encodeBool(h);if(c==="objDesc")return this._encodeStr(h,c);throw new Error("Unsupported tag: "+c)},s.prototype._isNumstr=function(c){return/^[0-9 ]*$/.test(c)},s.prototype._isPrintstr=function(c){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(c)},Fy}var zy={},_x;function Mw(){return _x||(_x=1,function(e){function t(r){const n={};return Object.keys(r).forEach(function(o){(o|0)==o&&(o=o|0);const i=r[o];n[i]=o}),n}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.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"},e.tagByName=t(e.tag)}(zy)),zy}var $y,xx;function dM(){if(xx)return $y;xx=1;const e=Ht(),t=Ew().Buffer,r=Aw(),n=Mw();function o(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new i,this.tree._init(l.body)}$y=o,o.prototype.encode=function(u,c){return this.tree._encode(u,c).join()};function i(l){r.call(this,"der",l)}e(i,r),i.prototype._encodeComposite=function(u,c,h,d){const p=s(u,c,h,this.reporter);if(d.length<128){const S=t.alloc(2);return S[0]=p,S[1]=d.length,this._createEncoderBuffer([S,d])}let v=1;for(let S=d.length;S>=256;S>>=8)v++;const b=t.alloc(1+1+v);b[0]=p,b[1]=128|v;for(let S=1+v,x=d.length;x>0;S--,x>>=8)b[S]=x&255;return this._createEncoderBuffer([b,d])},i.prototype._encodeStr=function(u,c){if(c==="bitstr")return this._createEncoderBuffer([u.unused|0,u.data]);if(c==="bmpstr"){const h=t.alloc(u.length*2);for(let d=0;d=40)return this.reporter.error("Second objid identifier OOB");u.splice(0,2,u[0]*40+u[1])}let d=0;for(let b=0;b=128;S>>=7)d++}const p=t.alloc(d);let v=p.length-1;for(let b=u.length-1;b>=0;b--){let S=u[b];for(p[v--]=S&127;(S>>=7)>0;)p[v--]=128|S&127}return this._createEncoderBuffer(p)};function a(l){return l<10?"0"+l:l}i.prototype._encodeTime=function(u,c){let h;const d=new Date(u);return c==="gentime"?h=[a(d.getUTCFullYear()),a(d.getUTCMonth()+1),a(d.getUTCDate()),a(d.getUTCHours()),a(d.getUTCMinutes()),a(d.getUTCSeconds()),"Z"].join(""):c==="utctime"?h=[a(d.getUTCFullYear()%100),a(d.getUTCMonth()+1),a(d.getUTCDate()),a(d.getUTCHours()),a(d.getUTCMinutes()),a(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+c+" time is not supported yet"),this._encodeStr(h,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(u,c){if(typeof u=="string"){if(!c)return this.reporter.error("String int or enum given, but no values map");if(!c.hasOwnProperty(u))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(u));u=c[u]}if(typeof u!="number"&&!t.isBuffer(u)){const p=u.toArray();!u.sign&&p[0]&128&&p.unshift(0),u=t.from(p)}if(t.isBuffer(u)){let p=u.length;u.length===0&&p++;const v=t.alloc(p);return u.copy(v),u.length===0&&(v[0]=0),this._createEncoderBuffer(v)}if(u<128)return this._createEncoderBuffer(u);if(u<256)return this._createEncoderBuffer([0,u]);let h=1;for(let p=u;p>=256;p>>=8)h++;const d=new Array(h);for(let p=d.length-1;p>=0;p--)d[p]=u&255,u>>=8;return d[0]&128&&d.unshift(0),this._createEncoderBuffer(t.from(d))},i.prototype._encodeBool=function(u){return this._createEncoderBuffer(u?255:0)},i.prototype._use=function(u,c){return typeof u=="function"&&(u=u(c)),u._getEncoder("der").tree},i.prototype._skipDefault=function(u,c,h){const d=this._baseState;let p;if(d.default===null)return!1;const v=u.join();if(d.defaultBuffer===void 0&&(d.defaultBuffer=this._encodeValue(d.default,c,h).join()),v.length!==d.defaultBuffer.length)return!1;for(p=0;p=31?h.error("Multi-octet tag encoding unsupported"):(u||(d|=32),d|=n.tagClassByName[c||"universal"]<<6,d)}return $y}var qy,Sx;function Dj(){if(Sx)return qy;Sx=1;const e=Ht(),t=dM();function r(n){t.call(this,n),this.enc="pem"}return e(r,t),qy=r,r.prototype.encode=function(o,i){const s=t.prototype.encode.call(this,o).toString("base64"),l=["-----BEGIN "+i.label+"-----"];for(let u=0;u>6],p=(h&32)===0;if((h&31)===31){let b=h;for(h=0;(b&128)===128;){if(b=u.readUInt8(c),u.isError(b))return b;h<<=7,h|=b&127}}else h&=31;const v=o.tag[h];return{cls:d,primitive:p,tag:h,tagStr:v}}function l(u,c,h){let d=u.readUInt8(h);if(u.isError(d))return d;if(!c&&d===128)return null;if(!(d&128))return d;const p=d&127;if(p>4)return u.error("length octect is too long");d=0;for(let v=0;v0&&k.ishrn(M),k}function p(S,x){S=d(S,x),S=S.mod(x);var k=e.from(S.toArray());if(k.length=c)throw new Error("invalid sig")}return Xy=i,Xy}var Jy,Ux;function Zj(){if(Ux)return Jy;Ux=1;var e=Kt().Buffer,t=$d(),r=FA(),n=Ht(),o=Hj(),i=Kj(),a=HA;Object.keys(a).forEach(function(h){a[h].id=e.from(a[h].id,"hex"),a[h.toLowerCase()]=a[h]});function s(h){r.Writable.call(this);var d=a[h];if(!d)throw new Error("Unknown message digest");this._hashType=d.hash,this._hash=t(d.hash),this._tag=d.id,this._signType=d.sign}n(s,r.Writable),s.prototype._write=function(d,p,v){this._hash.update(d),v()},s.prototype.update=function(d,p){return typeof d=="string"&&(d=e.from(d,p)),this._hash.update(d),this},s.prototype.sign=function(d,p){this.end();var v=this._hash.digest(),b=o(v,d,this._hashType,this._signType,this._tag);return p?b.toString(p):b};function l(h){r.Writable.call(this);var d=a[h];if(!d)throw new Error("Unknown message digest");this._hash=t(d.hash),this._tag=d.id,this._signType=d.sign}n(l,r.Writable),l.prototype._write=function(d,p,v){this._hash.update(d),v()},l.prototype.update=function(d,p){return typeof d=="string"&&(d=e.from(d,p)),this._hash.update(d),this},l.prototype.verify=function(d,p,v){typeof p=="string"&&(p=e.from(p,v)),this.end();var b=this._hash.digest();return i(p,b,d,this._signType,this._tag)};function u(h){return new s(h)}function c(h){return new l(h)}return Jy={Sign:u,Verify:c,createSign:u,createVerify:c},Jy}var e2,jx;function Gj(){if(jx)return e2;jx=1;var e=Cw(),t=cn();e2=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(i){this.curveType=r[i],this.curveType||(this.curveType={name:i}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,a){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,a)},n.prototype.computeSecret=function(i,a,s){a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a));var l=this.curve.keyFromPublic(i).getPublic(),u=l.mul(this.keys.getPrivate()).getX();return o(u,s,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,a){var s=this.keys.getPublic(a==="compressed",!0);return a==="hybrid"&&(s[s.length-1]%2?s[0]=7:s[0]=6),o(s,i)},n.prototype.getPrivateKey=function(i){return o(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,a){return a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,a){a=a||"utf8",Oe.Buffer.isBuffer(i)||(i=new Oe.Buffer(i,a));var s=new t(i);return s=s.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(s),this};function o(i,a,s){Array.isArray(i)||(i=i.toArray());var l=new Oe.Buffer(i);if(s&&l.length=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return b?s(k,x):a(k,x)};function u(d,p){var v=d.modulus.byteLength(),b=p.length,S=r("sha1").update(l.alloc(0)).digest(),x=S.length,k=2*x;if(b>v-k-2)throw new Error("message too long");var M=l.alloc(v-b-k-2),P=v-x-1,L=t(x),j=o(l.concat([S,M,l.alloc(1,1),p],P),n(L,P)),V=o(L,n(j,x));return new i(l.concat([l.alloc(1),V,j],v))}function c(d,p,v){var b=p.length,S=d.modulus.byteLength();if(b>S-11)throw new Error("message too long");var x;return v?x=l.alloc(S-b-3,255):x=h(S-b-3),new i(l.concat([l.from([0,v?1:2]),x,l.alloc(1),p],S))}function h(d){for(var p=l.allocUnsafe(d),v=0,b=t(d*2),S=0,x;vx||new n(p).cmp(S.modulus)>=0)throw new Error("decryption error");var k;v?k=a(new n(p),S):k=o(p,S);var M=s.alloc(x-k.length);if(k=s.concat([M,k],x),b===4)return l(S,k);if(b===1)return u(S,k,v);if(b===3)return k;throw new Error("unknown padding")};function l(h,d){var p=h.modulus.byteLength(),v=i("sha1").update(s.alloc(0)).digest(),b=v.length;if(d[0]!==0)throw new Error("decryption error");var S=d.slice(1,b+1),x=d.slice(b+1),k=r(S,t(x,b)),M=r(x,t(k,p-b-1));if(c(v,M.slice(0,b)))throw new Error("decryption error");for(var P=b;M[P]===0;)P++;if(M[P++]!==1)throw new Error("decryption error");return M.slice(P)}function u(h,d,p){for(var v=d.slice(0,2),b=2,S=0;d[b++]!==0;)if(b>=d.length){S++;break}var x=d.slice(2,b-1);if((v.toString("hex")!=="0002"&&!p||v.toString("hex")!=="0001"&&p)&&S++,x.length<8&&S++,S)throw new Error("decryption error");return d.slice(b)}function c(h,d){h=s.from(h),d=s.from(d);var p=0,v=h.length;h.length!==d.length&&(p++,v=Math.min(h.length,d.length));for(var b=-1;++ba||d<0)throw new TypeError("offset must be a uint32");if(d>o||d>p)throw new RangeError("offset out of range")}function l(d,p,v){if(typeof d!="number"||d!==d)throw new TypeError("size must be a number");if(d>a||d<0)throw new TypeError("size must be a uint32");if(d+p>v||d>o)throw new RangeError("buffer too small")}i&&i.getRandomValues||!_t.browser?(Wl.randomFill=u,Wl.randomFillSync=h):(Wl.randomFill=e,Wl.randomFillSync=e);function u(d,p,v,b){if(!n.isBuffer(d)&&!(d instanceof Ke.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof p=="function")b=p,p=0,v=d.length;else if(typeof v=="function")b=v,v=d.length-p;else if(typeof b!="function")throw new TypeError('"cb" argument must be a function');return s(p,d.length),l(v,p,d.length),c(d,p,v,b)}function c(d,p,v,b){if(_t.browser){var S=d.buffer,x=new Uint8Array(S,p,v);if(i.getRandomValues(x),b){_t.nextTick(function(){b(null,d)});return}return d}if(b){r(v,function(M,P){if(M)return b(M);P.copy(d,p),b(null,d)});return}var k=r(v);return k.copy(d,p),d}function h(d,p,v){if(typeof p>"u"&&(p=0),!n.isBuffer(d)&&!(d instanceof Ke.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return s(p,d.length),v===void 0&&(v=d.length-p),l(v,p,d.length),c(d,p,v)}return Wl}var Kx;function _M(){if(Kx)return zt;Kx=1,zt.randomBytes=zt.rng=zt.pseudoRandomBytes=zt.prng=tc(),zt.createHash=zt.Hash=$d(),zt.createHmac=zt.Hmac=VA();var e=xU(),t=Object.keys(e),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);zt.getHashes=function(){return r};var n=QA();zt.pbkdf2=n.pbkdf2,zt.pbkdf2Sync=n.pbkdf2Sync;var o=zU();zt.Cipher=o.Cipher,zt.createCipher=o.createCipher,zt.Cipheriv=o.Cipheriv,zt.createCipheriv=o.createCipheriv,zt.Decipher=o.Decipher,zt.createDecipher=o.createDecipher,zt.Decipheriv=o.Decipheriv,zt.createDecipheriv=o.createDecipheriv,zt.getCiphers=o.getCiphers,zt.listCiphers=o.listCiphers;var i=ej();zt.DiffieHellmanGroup=i.DiffieHellmanGroup,zt.createDiffieHellmanGroup=i.createDiffieHellmanGroup,zt.getDiffieHellman=i.getDiffieHellman,zt.createDiffieHellman=i.createDiffieHellman,zt.DiffieHellman=i.DiffieHellman;var a=Zj();zt.createSign=a.createSign,zt.Sign=a.Sign,zt.createVerify=a.createVerify,zt.Verify=a.Verify,zt.createECDH=Gj();var s=Xj();zt.publicEncrypt=s.publicEncrypt,zt.privateEncrypt=s.privateEncrypt,zt.publicDecrypt=s.publicDecrypt,zt.privateDecrypt=s.privateDecrypt;var l=Jj();return zt.randomFill=l.randomFill,zt.randomFillSync=l.randomFillSync,zt.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` +`))},zt.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},zt}(function(e){(function(t){var r=function(z){var J,ee=new Float64Array(16);if(z)for(J=0;J>24&255,z[J+1]=ee>>16&255,z[J+2]=ee>>8&255,z[J+3]=ee&255,z[J+4]=O>>24&255,z[J+5]=O>>16&255,z[J+6]=O>>8&255,z[J+7]=O&255}function b(z,J,ee,O,te){var Ae,Ee=0;for(Ae=0;Ae>>8)-1}function S(z,J,ee,O){return b(z,J,ee,O,16)}function x(z,J,ee,O){return b(z,J,ee,O,32)}function k(z,J,ee,O){for(var te=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,Ae=ee[0]&255|(ee[1]&255)<<8|(ee[2]&255)<<16|(ee[3]&255)<<24,Ee=ee[4]&255|(ee[5]&255)<<8|(ee[6]&255)<<16|(ee[7]&255)<<24,Be=ee[8]&255|(ee[9]&255)<<8|(ee[10]&255)<<16|(ee[11]&255)<<24,qe=ee[12]&255|(ee[13]&255)<<8|(ee[14]&255)<<16|(ee[15]&255)<<24,He=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,$e=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Lt=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,ot=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,yt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,Ct=ee[16]&255|(ee[17]&255)<<8|(ee[18]&255)<<16|(ee[19]&255)<<24,St=ee[20]&255|(ee[21]&255)<<8|(ee[22]&255)<<16|(ee[23]&255)<<24,bt=ee[24]&255|(ee[25]&255)<<8|(ee[26]&255)<<16|(ee[27]&255)<<24,xt=ee[28]&255|(ee[29]&255)<<8|(ee[30]&255)<<16|(ee[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,st=te,ct=Ae,nt=Ee,lt=Be,fe=qe,R=He,F=$e,H=Lt,ae=ot,oe=vt,Ce=yt,Se=Ct,Ve=St,Ge=bt,Je=xt,At=wt,we,jt=0;jt<20;jt+=2)we=st+Ve|0,fe^=we<<7|we>>>32-7,we=fe+st|0,ae^=we<<9|we>>>32-9,we=ae+fe|0,Ve^=we<<13|we>>>32-13,we=Ve+ae|0,st^=we<<18|we>>>32-18,we=R+ct|0,oe^=we<<7|we>>>32-7,we=oe+R|0,Ge^=we<<9|we>>>32-9,we=Ge+oe|0,ct^=we<<13|we>>>32-13,we=ct+Ge|0,R^=we<<18|we>>>32-18,we=Ce+F|0,Je^=we<<7|we>>>32-7,we=Je+Ce|0,nt^=we<<9|we>>>32-9,we=nt+Je|0,F^=we<<13|we>>>32-13,we=F+nt|0,Ce^=we<<18|we>>>32-18,we=At+Se|0,lt^=we<<7|we>>>32-7,we=lt+At|0,H^=we<<9|we>>>32-9,we=H+lt|0,Se^=we<<13|we>>>32-13,we=Se+H|0,At^=we<<18|we>>>32-18,we=st+lt|0,ct^=we<<7|we>>>32-7,we=ct+st|0,nt^=we<<9|we>>>32-9,we=nt+ct|0,lt^=we<<13|we>>>32-13,we=lt+nt|0,st^=we<<18|we>>>32-18,we=R+fe|0,F^=we<<7|we>>>32-7,we=F+R|0,H^=we<<9|we>>>32-9,we=H+F|0,fe^=we<<13|we>>>32-13,we=fe+H|0,R^=we<<18|we>>>32-18,we=Ce+oe|0,Se^=we<<7|we>>>32-7,we=Se+Ce|0,ae^=we<<9|we>>>32-9,we=ae+Se|0,oe^=we<<13|we>>>32-13,we=oe+ae|0,Ce^=we<<18|we>>>32-18,we=At+Je|0,Ve^=we<<7|we>>>32-7,we=Ve+At|0,Ge^=we<<9|we>>>32-9,we=Ge+Ve|0,Je^=we<<13|we>>>32-13,we=Je+Ge|0,At^=we<<18|we>>>32-18;st=st+te|0,ct=ct+Ae|0,nt=nt+Ee|0,lt=lt+Be|0,fe=fe+qe|0,R=R+He|0,F=F+$e|0,H=H+Lt|0,ae=ae+ot|0,oe=oe+vt|0,Ce=Ce+yt|0,Se=Se+Ct|0,Ve=Ve+St|0,Ge=Ge+bt|0,Je=Je+xt|0,At=At+wt|0,z[0]=st>>>0&255,z[1]=st>>>8&255,z[2]=st>>>16&255,z[3]=st>>>24&255,z[4]=ct>>>0&255,z[5]=ct>>>8&255,z[6]=ct>>>16&255,z[7]=ct>>>24&255,z[8]=nt>>>0&255,z[9]=nt>>>8&255,z[10]=nt>>>16&255,z[11]=nt>>>24&255,z[12]=lt>>>0&255,z[13]=lt>>>8&255,z[14]=lt>>>16&255,z[15]=lt>>>24&255,z[16]=fe>>>0&255,z[17]=fe>>>8&255,z[18]=fe>>>16&255,z[19]=fe>>>24&255,z[20]=R>>>0&255,z[21]=R>>>8&255,z[22]=R>>>16&255,z[23]=R>>>24&255,z[24]=F>>>0&255,z[25]=F>>>8&255,z[26]=F>>>16&255,z[27]=F>>>24&255,z[28]=H>>>0&255,z[29]=H>>>8&255,z[30]=H>>>16&255,z[31]=H>>>24&255,z[32]=ae>>>0&255,z[33]=ae>>>8&255,z[34]=ae>>>16&255,z[35]=ae>>>24&255,z[36]=oe>>>0&255,z[37]=oe>>>8&255,z[38]=oe>>>16&255,z[39]=oe>>>24&255,z[40]=Ce>>>0&255,z[41]=Ce>>>8&255,z[42]=Ce>>>16&255,z[43]=Ce>>>24&255,z[44]=Se>>>0&255,z[45]=Se>>>8&255,z[46]=Se>>>16&255,z[47]=Se>>>24&255,z[48]=Ve>>>0&255,z[49]=Ve>>>8&255,z[50]=Ve>>>16&255,z[51]=Ve>>>24&255,z[52]=Ge>>>0&255,z[53]=Ge>>>8&255,z[54]=Ge>>>16&255,z[55]=Ge>>>24&255,z[56]=Je>>>0&255,z[57]=Je>>>8&255,z[58]=Je>>>16&255,z[59]=Je>>>24&255,z[60]=At>>>0&255,z[61]=At>>>8&255,z[62]=At>>>16&255,z[63]=At>>>24&255}function M(z,J,ee,O){for(var te=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,Ae=ee[0]&255|(ee[1]&255)<<8|(ee[2]&255)<<16|(ee[3]&255)<<24,Ee=ee[4]&255|(ee[5]&255)<<8|(ee[6]&255)<<16|(ee[7]&255)<<24,Be=ee[8]&255|(ee[9]&255)<<8|(ee[10]&255)<<16|(ee[11]&255)<<24,qe=ee[12]&255|(ee[13]&255)<<8|(ee[14]&255)<<16|(ee[15]&255)<<24,He=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,$e=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Lt=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,ot=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,yt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,Ct=ee[16]&255|(ee[17]&255)<<8|(ee[18]&255)<<16|(ee[19]&255)<<24,St=ee[20]&255|(ee[21]&255)<<8|(ee[22]&255)<<16|(ee[23]&255)<<24,bt=ee[24]&255|(ee[25]&255)<<8|(ee[26]&255)<<16|(ee[27]&255)<<24,xt=ee[28]&255|(ee[29]&255)<<8|(ee[30]&255)<<16|(ee[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,st=te,ct=Ae,nt=Ee,lt=Be,fe=qe,R=He,F=$e,H=Lt,ae=ot,oe=vt,Ce=yt,Se=Ct,Ve=St,Ge=bt,Je=xt,At=wt,we,jt=0;jt<20;jt+=2)we=st+Ve|0,fe^=we<<7|we>>>32-7,we=fe+st|0,ae^=we<<9|we>>>32-9,we=ae+fe|0,Ve^=we<<13|we>>>32-13,we=Ve+ae|0,st^=we<<18|we>>>32-18,we=R+ct|0,oe^=we<<7|we>>>32-7,we=oe+R|0,Ge^=we<<9|we>>>32-9,we=Ge+oe|0,ct^=we<<13|we>>>32-13,we=ct+Ge|0,R^=we<<18|we>>>32-18,we=Ce+F|0,Je^=we<<7|we>>>32-7,we=Je+Ce|0,nt^=we<<9|we>>>32-9,we=nt+Je|0,F^=we<<13|we>>>32-13,we=F+nt|0,Ce^=we<<18|we>>>32-18,we=At+Se|0,lt^=we<<7|we>>>32-7,we=lt+At|0,H^=we<<9|we>>>32-9,we=H+lt|0,Se^=we<<13|we>>>32-13,we=Se+H|0,At^=we<<18|we>>>32-18,we=st+lt|0,ct^=we<<7|we>>>32-7,we=ct+st|0,nt^=we<<9|we>>>32-9,we=nt+ct|0,lt^=we<<13|we>>>32-13,we=lt+nt|0,st^=we<<18|we>>>32-18,we=R+fe|0,F^=we<<7|we>>>32-7,we=F+R|0,H^=we<<9|we>>>32-9,we=H+F|0,fe^=we<<13|we>>>32-13,we=fe+H|0,R^=we<<18|we>>>32-18,we=Ce+oe|0,Se^=we<<7|we>>>32-7,we=Se+Ce|0,ae^=we<<9|we>>>32-9,we=ae+Se|0,oe^=we<<13|we>>>32-13,we=oe+ae|0,Ce^=we<<18|we>>>32-18,we=At+Je|0,Ve^=we<<7|we>>>32-7,we=Ve+At|0,Ge^=we<<9|we>>>32-9,we=Ge+Ve|0,Je^=we<<13|we>>>32-13,we=Je+Ge|0,At^=we<<18|we>>>32-18;z[0]=st>>>0&255,z[1]=st>>>8&255,z[2]=st>>>16&255,z[3]=st>>>24&255,z[4]=R>>>0&255,z[5]=R>>>8&255,z[6]=R>>>16&255,z[7]=R>>>24&255,z[8]=Ce>>>0&255,z[9]=Ce>>>8&255,z[10]=Ce>>>16&255,z[11]=Ce>>>24&255,z[12]=At>>>0&255,z[13]=At>>>8&255,z[14]=At>>>16&255,z[15]=At>>>24&255,z[16]=F>>>0&255,z[17]=F>>>8&255,z[18]=F>>>16&255,z[19]=F>>>24&255,z[20]=H>>>0&255,z[21]=H>>>8&255,z[22]=H>>>16&255,z[23]=H>>>24&255,z[24]=ae>>>0&255,z[25]=ae>>>8&255,z[26]=ae>>>16&255,z[27]=ae>>>24&255,z[28]=oe>>>0&255,z[29]=oe>>>8&255,z[30]=oe>>>16&255,z[31]=oe>>>24&255}function P(z,J,ee,O){k(z,J,ee,O)}function L(z,J,ee,O){M(z,J,ee,O)}var j=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function V(z,J,ee,O,te,Ae,Ee){var Be=new Uint8Array(16),qe=new Uint8Array(64),He,$e;for($e=0;$e<16;$e++)Be[$e]=0;for($e=0;$e<8;$e++)Be[$e]=Ae[$e];for(;te>=64;){for(P(qe,Be,Ee,j),$e=0;$e<64;$e++)z[J+$e]=ee[O+$e]^qe[$e];for(He=1,$e=8;$e<16;$e++)He=He+(Be[$e]&255)|0,Be[$e]=He&255,He>>>=8;te-=64,J+=64,O+=64}if(te>0)for(P(qe,Be,Ee,j),$e=0;$e=64;){for(P(Ee,Ae,te,j),qe=0;qe<64;qe++)z[J+qe]=Ee[qe];for(Be=1,qe=8;qe<16;qe++)Be=Be+(Ae[qe]&255)|0,Ae[qe]=Be&255,Be>>>=8;ee-=64,J+=64}if(ee>0)for(P(Ee,Ae,te,j),qe=0;qe>>13|ee<<3)&8191,O=z[4]&255|(z[5]&255)<<8,this.r[2]=(ee>>>10|O<<6)&7939,te=z[6]&255|(z[7]&255)<<8,this.r[3]=(O>>>7|te<<9)&8191,Ae=z[8]&255|(z[9]&255)<<8,this.r[4]=(te>>>4|Ae<<12)&255,this.r[5]=Ae>>>1&8190,Ee=z[10]&255|(z[11]&255)<<8,this.r[6]=(Ae>>>14|Ee<<2)&8191,Be=z[12]&255|(z[13]&255)<<8,this.r[7]=(Ee>>>11|Be<<5)&8065,qe=z[14]&255|(z[15]&255)<<8,this.r[8]=(Be>>>8|qe<<8)&8191,this.r[9]=qe>>>5&127,this.pad[0]=z[16]&255|(z[17]&255)<<8,this.pad[1]=z[18]&255|(z[19]&255)<<8,this.pad[2]=z[20]&255|(z[21]&255)<<8,this.pad[3]=z[22]&255|(z[23]&255)<<8,this.pad[4]=z[24]&255|(z[25]&255)<<8,this.pad[5]=z[26]&255|(z[27]&255)<<8,this.pad[6]=z[28]&255|(z[29]&255)<<8,this.pad[7]=z[30]&255|(z[31]&255)<<8};U.prototype.blocks=function(z,J,ee){for(var O=this.fin?0:2048,te,Ae,Ee,Be,qe,He,$e,Lt,ot,vt,yt,Ct,St,bt,xt,wt,st,ct,nt,lt=this.h[0],fe=this.h[1],R=this.h[2],F=this.h[3],H=this.h[4],ae=this.h[5],oe=this.h[6],Ce=this.h[7],Se=this.h[8],Ve=this.h[9],Ge=this.r[0],Je=this.r[1],At=this.r[2],we=this.r[3],jt=this.r[4],nr=this.r[5],ir=this.r[6],Wt=this.r[7],er=this.r[8],tr=this.r[9];ee>=16;)te=z[J+0]&255|(z[J+1]&255)<<8,lt+=te&8191,Ae=z[J+2]&255|(z[J+3]&255)<<8,fe+=(te>>>13|Ae<<3)&8191,Ee=z[J+4]&255|(z[J+5]&255)<<8,R+=(Ae>>>10|Ee<<6)&8191,Be=z[J+6]&255|(z[J+7]&255)<<8,F+=(Ee>>>7|Be<<9)&8191,qe=z[J+8]&255|(z[J+9]&255)<<8,H+=(Be>>>4|qe<<12)&8191,ae+=qe>>>1&8191,He=z[J+10]&255|(z[J+11]&255)<<8,oe+=(qe>>>14|He<<2)&8191,$e=z[J+12]&255|(z[J+13]&255)<<8,Ce+=(He>>>11|$e<<5)&8191,Lt=z[J+14]&255|(z[J+15]&255)<<8,Se+=($e>>>8|Lt<<8)&8191,Ve+=Lt>>>5|O,ot=0,vt=ot,vt+=lt*Ge,vt+=fe*(5*tr),vt+=R*(5*er),vt+=F*(5*Wt),vt+=H*(5*ir),ot=vt>>>13,vt&=8191,vt+=ae*(5*nr),vt+=oe*(5*jt),vt+=Ce*(5*we),vt+=Se*(5*At),vt+=Ve*(5*Je),ot+=vt>>>13,vt&=8191,yt=ot,yt+=lt*Je,yt+=fe*Ge,yt+=R*(5*tr),yt+=F*(5*er),yt+=H*(5*Wt),ot=yt>>>13,yt&=8191,yt+=ae*(5*ir),yt+=oe*(5*nr),yt+=Ce*(5*jt),yt+=Se*(5*we),yt+=Ve*(5*At),ot+=yt>>>13,yt&=8191,Ct=ot,Ct+=lt*At,Ct+=fe*Je,Ct+=R*Ge,Ct+=F*(5*tr),Ct+=H*(5*er),ot=Ct>>>13,Ct&=8191,Ct+=ae*(5*Wt),Ct+=oe*(5*ir),Ct+=Ce*(5*nr),Ct+=Se*(5*jt),Ct+=Ve*(5*we),ot+=Ct>>>13,Ct&=8191,St=ot,St+=lt*we,St+=fe*At,St+=R*Je,St+=F*Ge,St+=H*(5*tr),ot=St>>>13,St&=8191,St+=ae*(5*er),St+=oe*(5*Wt),St+=Ce*(5*ir),St+=Se*(5*nr),St+=Ve*(5*jt),ot+=St>>>13,St&=8191,bt=ot,bt+=lt*jt,bt+=fe*we,bt+=R*At,bt+=F*Je,bt+=H*Ge,ot=bt>>>13,bt&=8191,bt+=ae*(5*tr),bt+=oe*(5*er),bt+=Ce*(5*Wt),bt+=Se*(5*ir),bt+=Ve*(5*nr),ot+=bt>>>13,bt&=8191,xt=ot,xt+=lt*nr,xt+=fe*jt,xt+=R*we,xt+=F*At,xt+=H*Je,ot=xt>>>13,xt&=8191,xt+=ae*Ge,xt+=oe*(5*tr),xt+=Ce*(5*er),xt+=Se*(5*Wt),xt+=Ve*(5*ir),ot+=xt>>>13,xt&=8191,wt=ot,wt+=lt*ir,wt+=fe*nr,wt+=R*jt,wt+=F*we,wt+=H*At,ot=wt>>>13,wt&=8191,wt+=ae*Je,wt+=oe*Ge,wt+=Ce*(5*tr),wt+=Se*(5*er),wt+=Ve*(5*Wt),ot+=wt>>>13,wt&=8191,st=ot,st+=lt*Wt,st+=fe*ir,st+=R*nr,st+=F*jt,st+=H*we,ot=st>>>13,st&=8191,st+=ae*At,st+=oe*Je,st+=Ce*Ge,st+=Se*(5*tr),st+=Ve*(5*er),ot+=st>>>13,st&=8191,ct=ot,ct+=lt*er,ct+=fe*Wt,ct+=R*ir,ct+=F*nr,ct+=H*jt,ot=ct>>>13,ct&=8191,ct+=ae*we,ct+=oe*At,ct+=Ce*Je,ct+=Se*Ge,ct+=Ve*(5*tr),ot+=ct>>>13,ct&=8191,nt=ot,nt+=lt*tr,nt+=fe*er,nt+=R*Wt,nt+=F*ir,nt+=H*nr,ot=nt>>>13,nt&=8191,nt+=ae*jt,nt+=oe*we,nt+=Ce*At,nt+=Se*Je,nt+=Ve*Ge,ot+=nt>>>13,nt&=8191,ot=(ot<<2)+ot|0,ot=ot+vt|0,vt=ot&8191,ot=ot>>>13,yt+=ot,lt=vt,fe=yt,R=Ct,F=St,H=bt,ae=xt,oe=wt,Ce=st,Se=ct,Ve=nt,J+=16,ee-=16;this.h[0]=lt,this.h[1]=fe,this.h[2]=R,this.h[3]=F,this.h[4]=H,this.h[5]=ae,this.h[6]=oe,this.h[7]=Ce,this.h[8]=Se,this.h[9]=Ve},U.prototype.finish=function(z,J){var ee=new Uint16Array(10),O,te,Ae,Ee;if(this.leftover){for(Ee=this.leftover,this.buffer[Ee++]=1;Ee<16;Ee++)this.buffer[Ee]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(O=this.h[1]>>>13,this.h[1]&=8191,Ee=2;Ee<10;Ee++)this.h[Ee]+=O,O=this.h[Ee]>>>13,this.h[Ee]&=8191;for(this.h[0]+=O*5,O=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=O,O=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=O,ee[0]=this.h[0]+5,O=ee[0]>>>13,ee[0]&=8191,Ee=1;Ee<10;Ee++)ee[Ee]=this.h[Ee]+O,O=ee[Ee]>>>13,ee[Ee]&=8191;for(ee[9]-=1<<13,te=(O^1)-1,Ee=0;Ee<10;Ee++)ee[Ee]&=te;for(te=~te,Ee=0;Ee<10;Ee++)this.h[Ee]=this.h[Ee]&te|ee[Ee];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Ae=this.h[0]+this.pad[0],this.h[0]=Ae&65535,Ee=1;Ee<8;Ee++)Ae=(this.h[Ee]+this.pad[Ee]|0)+(Ae>>>16)|0,this.h[Ee]=Ae&65535;z[J+0]=this.h[0]>>>0&255,z[J+1]=this.h[0]>>>8&255,z[J+2]=this.h[1]>>>0&255,z[J+3]=this.h[1]>>>8&255,z[J+4]=this.h[2]>>>0&255,z[J+5]=this.h[2]>>>8&255,z[J+6]=this.h[3]>>>0&255,z[J+7]=this.h[3]>>>8&255,z[J+8]=this.h[4]>>>0&255,z[J+9]=this.h[4]>>>8&255,z[J+10]=this.h[5]>>>0&255,z[J+11]=this.h[5]>>>8&255,z[J+12]=this.h[6]>>>0&255,z[J+13]=this.h[6]>>>8&255,z[J+14]=this.h[7]>>>0&255,z[J+15]=this.h[7]>>>8&255},U.prototype.update=function(z,J,ee){var O,te;if(this.leftover){for(te=16-this.leftover,te>ee&&(te=ee),O=0;O=16&&(te=ee-ee%16,this.blocks(z,J,te),J+=te,ee-=te),ee){for(O=0;O>16&1),Ae[ee-1]&=65535;Ae[15]=Ee[15]-32767-(Ae[14]>>16&1),te=Ae[15]>>16&1,Ae[14]&=65535,T(Ee,Ae,1-te)}for(ee=0;ee<16;ee++)z[2*ee]=Ee[ee]&255,z[2*ee+1]=Ee[ee]>>8}function C(z,J){var ee=new Uint8Array(32),O=new Uint8Array(32);return E(ee,z),E(O,J),x(ee,0,O,0)}function I(z){var J=new Uint8Array(32);return E(J,z),J[0]&1}function m(z,J){var ee;for(ee=0;ee<16;ee++)z[ee]=J[2*ee]+(J[2*ee+1]<<8);z[15]&=32767}function B(z,J,ee){for(var O=0;O<16;O++)z[O]=J[O]+ee[O]}function ne(z,J,ee){for(var O=0;O<16;O++)z[O]=J[O]-ee[O]}function de(z,J,ee){var O,te,Ae=0,Ee=0,Be=0,qe=0,He=0,$e=0,Lt=0,ot=0,vt=0,yt=0,Ct=0,St=0,bt=0,xt=0,wt=0,st=0,ct=0,nt=0,lt=0,fe=0,R=0,F=0,H=0,ae=0,oe=0,Ce=0,Se=0,Ve=0,Ge=0,Je=0,At=0,we=ee[0],jt=ee[1],nr=ee[2],ir=ee[3],Wt=ee[4],er=ee[5],tr=ee[6],jr=ee[7],fr=ee[8],Rr=ee[9],Or=ee[10],Nr=ee[11],Hr=ee[12],yn=ee[13],bn=ee[14],wn=ee[15];O=J[0],Ae+=O*we,Ee+=O*jt,Be+=O*nr,qe+=O*ir,He+=O*Wt,$e+=O*er,Lt+=O*tr,ot+=O*jr,vt+=O*fr,yt+=O*Rr,Ct+=O*Or,St+=O*Nr,bt+=O*Hr,xt+=O*yn,wt+=O*bn,st+=O*wn,O=J[1],Ee+=O*we,Be+=O*jt,qe+=O*nr,He+=O*ir,$e+=O*Wt,Lt+=O*er,ot+=O*tr,vt+=O*jr,yt+=O*fr,Ct+=O*Rr,St+=O*Or,bt+=O*Nr,xt+=O*Hr,wt+=O*yn,st+=O*bn,ct+=O*wn,O=J[2],Be+=O*we,qe+=O*jt,He+=O*nr,$e+=O*ir,Lt+=O*Wt,ot+=O*er,vt+=O*tr,yt+=O*jr,Ct+=O*fr,St+=O*Rr,bt+=O*Or,xt+=O*Nr,wt+=O*Hr,st+=O*yn,ct+=O*bn,nt+=O*wn,O=J[3],qe+=O*we,He+=O*jt,$e+=O*nr,Lt+=O*ir,ot+=O*Wt,vt+=O*er,yt+=O*tr,Ct+=O*jr,St+=O*fr,bt+=O*Rr,xt+=O*Or,wt+=O*Nr,st+=O*Hr,ct+=O*yn,nt+=O*bn,lt+=O*wn,O=J[4],He+=O*we,$e+=O*jt,Lt+=O*nr,ot+=O*ir,vt+=O*Wt,yt+=O*er,Ct+=O*tr,St+=O*jr,bt+=O*fr,xt+=O*Rr,wt+=O*Or,st+=O*Nr,ct+=O*Hr,nt+=O*yn,lt+=O*bn,fe+=O*wn,O=J[5],$e+=O*we,Lt+=O*jt,ot+=O*nr,vt+=O*ir,yt+=O*Wt,Ct+=O*er,St+=O*tr,bt+=O*jr,xt+=O*fr,wt+=O*Rr,st+=O*Or,ct+=O*Nr,nt+=O*Hr,lt+=O*yn,fe+=O*bn,R+=O*wn,O=J[6],Lt+=O*we,ot+=O*jt,vt+=O*nr,yt+=O*ir,Ct+=O*Wt,St+=O*er,bt+=O*tr,xt+=O*jr,wt+=O*fr,st+=O*Rr,ct+=O*Or,nt+=O*Nr,lt+=O*Hr,fe+=O*yn,R+=O*bn,F+=O*wn,O=J[7],ot+=O*we,vt+=O*jt,yt+=O*nr,Ct+=O*ir,St+=O*Wt,bt+=O*er,xt+=O*tr,wt+=O*jr,st+=O*fr,ct+=O*Rr,nt+=O*Or,lt+=O*Nr,fe+=O*Hr,R+=O*yn,F+=O*bn,H+=O*wn,O=J[8],vt+=O*we,yt+=O*jt,Ct+=O*nr,St+=O*ir,bt+=O*Wt,xt+=O*er,wt+=O*tr,st+=O*jr,ct+=O*fr,nt+=O*Rr,lt+=O*Or,fe+=O*Nr,R+=O*Hr,F+=O*yn,H+=O*bn,ae+=O*wn,O=J[9],yt+=O*we,Ct+=O*jt,St+=O*nr,bt+=O*ir,xt+=O*Wt,wt+=O*er,st+=O*tr,ct+=O*jr,nt+=O*fr,lt+=O*Rr,fe+=O*Or,R+=O*Nr,F+=O*Hr,H+=O*yn,ae+=O*bn,oe+=O*wn,O=J[10],Ct+=O*we,St+=O*jt,bt+=O*nr,xt+=O*ir,wt+=O*Wt,st+=O*er,ct+=O*tr,nt+=O*jr,lt+=O*fr,fe+=O*Rr,R+=O*Or,F+=O*Nr,H+=O*Hr,ae+=O*yn,oe+=O*bn,Ce+=O*wn,O=J[11],St+=O*we,bt+=O*jt,xt+=O*nr,wt+=O*ir,st+=O*Wt,ct+=O*er,nt+=O*tr,lt+=O*jr,fe+=O*fr,R+=O*Rr,F+=O*Or,H+=O*Nr,ae+=O*Hr,oe+=O*yn,Ce+=O*bn,Se+=O*wn,O=J[12],bt+=O*we,xt+=O*jt,wt+=O*nr,st+=O*ir,ct+=O*Wt,nt+=O*er,lt+=O*tr,fe+=O*jr,R+=O*fr,F+=O*Rr,H+=O*Or,ae+=O*Nr,oe+=O*Hr,Ce+=O*yn,Se+=O*bn,Ve+=O*wn,O=J[13],xt+=O*we,wt+=O*jt,st+=O*nr,ct+=O*ir,nt+=O*Wt,lt+=O*er,fe+=O*tr,R+=O*jr,F+=O*fr,H+=O*Rr,ae+=O*Or,oe+=O*Nr,Ce+=O*Hr,Se+=O*yn,Ve+=O*bn,Ge+=O*wn,O=J[14],wt+=O*we,st+=O*jt,ct+=O*nr,nt+=O*ir,lt+=O*Wt,fe+=O*er,R+=O*tr,F+=O*jr,H+=O*fr,ae+=O*Rr,oe+=O*Or,Ce+=O*Nr,Se+=O*Hr,Ve+=O*yn,Ge+=O*bn,Je+=O*wn,O=J[15],st+=O*we,ct+=O*jt,nt+=O*nr,lt+=O*ir,fe+=O*Wt,R+=O*er,F+=O*tr,H+=O*jr,ae+=O*fr,oe+=O*Rr,Ce+=O*Or,Se+=O*Nr,Ve+=O*Hr,Ge+=O*yn,Je+=O*bn,At+=O*wn,Ae+=38*ct,Ee+=38*nt,Be+=38*lt,qe+=38*fe,He+=38*R,$e+=38*F,Lt+=38*H,ot+=38*ae,vt+=38*oe,yt+=38*Ce,Ct+=38*Se,St+=38*Ve,bt+=38*Ge,xt+=38*Je,wt+=38*At,te=1,O=Ae+te+65535,te=Math.floor(O/65536),Ae=O-te*65536,O=Ee+te+65535,te=Math.floor(O/65536),Ee=O-te*65536,O=Be+te+65535,te=Math.floor(O/65536),Be=O-te*65536,O=qe+te+65535,te=Math.floor(O/65536),qe=O-te*65536,O=He+te+65535,te=Math.floor(O/65536),He=O-te*65536,O=$e+te+65535,te=Math.floor(O/65536),$e=O-te*65536,O=Lt+te+65535,te=Math.floor(O/65536),Lt=O-te*65536,O=ot+te+65535,te=Math.floor(O/65536),ot=O-te*65536,O=vt+te+65535,te=Math.floor(O/65536),vt=O-te*65536,O=yt+te+65535,te=Math.floor(O/65536),yt=O-te*65536,O=Ct+te+65535,te=Math.floor(O/65536),Ct=O-te*65536,O=St+te+65535,te=Math.floor(O/65536),St=O-te*65536,O=bt+te+65535,te=Math.floor(O/65536),bt=O-te*65536,O=xt+te+65535,te=Math.floor(O/65536),xt=O-te*65536,O=wt+te+65535,te=Math.floor(O/65536),wt=O-te*65536,O=st+te+65535,te=Math.floor(O/65536),st=O-te*65536,Ae+=te-1+37*(te-1),te=1,O=Ae+te+65535,te=Math.floor(O/65536),Ae=O-te*65536,O=Ee+te+65535,te=Math.floor(O/65536),Ee=O-te*65536,O=Be+te+65535,te=Math.floor(O/65536),Be=O-te*65536,O=qe+te+65535,te=Math.floor(O/65536),qe=O-te*65536,O=He+te+65535,te=Math.floor(O/65536),He=O-te*65536,O=$e+te+65535,te=Math.floor(O/65536),$e=O-te*65536,O=Lt+te+65535,te=Math.floor(O/65536),Lt=O-te*65536,O=ot+te+65535,te=Math.floor(O/65536),ot=O-te*65536,O=vt+te+65535,te=Math.floor(O/65536),vt=O-te*65536,O=yt+te+65535,te=Math.floor(O/65536),yt=O-te*65536,O=Ct+te+65535,te=Math.floor(O/65536),Ct=O-te*65536,O=St+te+65535,te=Math.floor(O/65536),St=O-te*65536,O=bt+te+65535,te=Math.floor(O/65536),bt=O-te*65536,O=xt+te+65535,te=Math.floor(O/65536),xt=O-te*65536,O=wt+te+65535,te=Math.floor(O/65536),wt=O-te*65536,O=st+te+65535,te=Math.floor(O/65536),st=O-te*65536,Ae+=te-1+37*(te-1),z[0]=Ae,z[1]=Ee,z[2]=Be,z[3]=qe,z[4]=He,z[5]=$e,z[6]=Lt,z[7]=ot,z[8]=vt,z[9]=yt,z[10]=Ct,z[11]=St,z[12]=bt,z[13]=xt,z[14]=wt,z[15]=st}function $(z,J){de(z,J,J)}function he(z,J){var ee=r(),O;for(O=0;O<16;O++)ee[O]=J[O];for(O=253;O>=0;O--)$(ee,ee),O!==2&&O!==4&&de(ee,ee,J);for(O=0;O<16;O++)z[O]=ee[O]}function X(z,J){var ee=r(),O;for(O=0;O<16;O++)ee[O]=J[O];for(O=250;O>=0;O--)$(ee,ee),O!==1&&de(ee,ee,J);for(O=0;O<16;O++)z[O]=ee[O]}function se(z,J,ee){var O=new Uint8Array(32),te=new Float64Array(80),Ae,Ee,Be=r(),qe=r(),He=r(),$e=r(),Lt=r(),ot=r();for(Ee=0;Ee<31;Ee++)O[Ee]=J[Ee];for(O[31]=J[31]&127|64,O[0]&=248,m(te,ee),Ee=0;Ee<16;Ee++)qe[Ee]=te[Ee],$e[Ee]=Be[Ee]=He[Ee]=0;for(Be[0]=$e[0]=1,Ee=254;Ee>=0;--Ee)Ae=O[Ee>>>3]>>>(Ee&7)&1,T(Be,qe,Ae),T(He,$e,Ae),B(Lt,Be,He),ne(Be,Be,He),B(He,qe,$e),ne(qe,qe,$e),$($e,Lt),$(ot,Be),de(Be,He,Be),de(He,qe,Lt),B(Lt,Be,He),ne(Be,Be,He),$(qe,Be),ne(He,$e,ot),de(Be,He,l),B(Be,Be,$e),de(He,He,Be),de(Be,$e,ot),de($e,qe,te),$(qe,Lt),T(Be,qe,Ae),T(He,$e,Ae);for(Ee=0;Ee<16;Ee++)te[Ee+16]=Be[Ee],te[Ee+32]=He[Ee],te[Ee+48]=qe[Ee],te[Ee+64]=$e[Ee];var vt=te.subarray(32),yt=te.subarray(16);return he(vt,vt),de(yt,yt,vt),E(z,yt),0}function pe(z,J){return se(z,J,i)}function W(z,J){return n(J,32),pe(z,J)}function q(z,J,ee){var O=new Uint8Array(32);return se(O,ee,J),L(z,o,O,j)}var ye=f,xe=g;function Me(z,J,ee,O,te,Ae){var Ee=new Uint8Array(32);return q(Ee,te,Ae),ye(z,J,ee,O,Ee)}function Q(z,J,ee,O,te,Ae){var Ee=new Uint8Array(32);return q(Ee,te,Ae),xe(z,J,ee,O,Ee)}var 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];function D(z,J,ee,O){for(var te=new Int32Array(16),Ae=new Int32Array(16),Ee,Be,qe,He,$e,Lt,ot,vt,yt,Ct,St,bt,xt,wt,st,ct,nt,lt,fe,R,F,H,ae,oe,Ce,Se,Ve=z[0],Ge=z[1],Je=z[2],At=z[3],we=z[4],jt=z[5],nr=z[6],ir=z[7],Wt=J[0],er=J[1],tr=J[2],jr=J[3],fr=J[4],Rr=J[5],Or=J[6],Nr=J[7],Hr=0;O>=128;){for(fe=0;fe<16;fe++)R=8*fe+Hr,te[fe]=ee[R+0]<<24|ee[R+1]<<16|ee[R+2]<<8|ee[R+3],Ae[fe]=ee[R+4]<<24|ee[R+5]<<16|ee[R+6]<<8|ee[R+7];for(fe=0;fe<80;fe++)if(Ee=Ve,Be=Ge,qe=Je,He=At,$e=we,Lt=jt,ot=nr,vt=ir,yt=Wt,Ct=er,St=tr,bt=jr,xt=fr,wt=Rr,st=Or,ct=Nr,F=ir,H=Nr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=(we>>>14|fr<<32-14)^(we>>>18|fr<<32-18)^(fr>>>41-32|we<<32-(41-32)),H=(fr>>>14|we<<32-14)^(fr>>>18|we<<32-18)^(we>>>41-32|fr<<32-(41-32)),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=we&jt^~we&nr,H=fr&Rr^~fr&Or,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=N[fe*2],H=N[fe*2+1],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=te[fe%16],H=Ae[fe%16],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,nt=Ce&65535|Se<<16,lt=ae&65535|oe<<16,F=nt,H=lt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=(Ve>>>28|Wt<<32-28)^(Wt>>>34-32|Ve<<32-(34-32))^(Wt>>>39-32|Ve<<32-(39-32)),H=(Wt>>>28|Ve<<32-28)^(Ve>>>34-32|Wt<<32-(34-32))^(Ve>>>39-32|Wt<<32-(39-32)),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,F=Ve&Ge^Ve&Je^Ge&Je,H=Wt&er^Wt&tr^er&tr,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,vt=Ce&65535|Se<<16,ct=ae&65535|oe<<16,F=He,H=bt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=nt,H=lt,ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,He=Ce&65535|Se<<16,bt=ae&65535|oe<<16,Ge=Ee,Je=Be,At=qe,we=He,jt=$e,nr=Lt,ir=ot,Ve=vt,er=yt,tr=Ct,jr=St,fr=bt,Rr=xt,Or=wt,Nr=st,Wt=ct,fe%16===15)for(R=0;R<16;R++)F=te[R],H=Ae[R],ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=te[(R+9)%16],H=Ae[(R+9)%16],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,nt=te[(R+1)%16],lt=Ae[(R+1)%16],F=(nt>>>1|lt<<32-1)^(nt>>>8|lt<<32-8)^nt>>>7,H=(lt>>>1|nt<<32-1)^(lt>>>8|nt<<32-8)^(lt>>>7|nt<<32-7),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,nt=te[(R+14)%16],lt=Ae[(R+14)%16],F=(nt>>>19|lt<<32-19)^(lt>>>61-32|nt<<32-(61-32))^nt>>>6,H=(lt>>>19|nt<<32-19)^(nt>>>61-32|lt<<32-(61-32))^(lt>>>6|nt<<32-6),ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,te[R]=Ce&65535|Se<<16,Ae[R]=ae&65535|oe<<16;F=Ve,H=Wt,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[0],H=J[0],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[0]=Ve=Ce&65535|Se<<16,J[0]=Wt=ae&65535|oe<<16,F=Ge,H=er,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[1],H=J[1],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[1]=Ge=Ce&65535|Se<<16,J[1]=er=ae&65535|oe<<16,F=Je,H=tr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[2],H=J[2],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[2]=Je=Ce&65535|Se<<16,J[2]=tr=ae&65535|oe<<16,F=At,H=jr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[3],H=J[3],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[3]=At=Ce&65535|Se<<16,J[3]=jr=ae&65535|oe<<16,F=we,H=fr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[4],H=J[4],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[4]=we=Ce&65535|Se<<16,J[4]=fr=ae&65535|oe<<16,F=jt,H=Rr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[5],H=J[5],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[5]=jt=Ce&65535|Se<<16,J[5]=Rr=ae&65535|oe<<16,F=nr,H=Or,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[6],H=J[6],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[6]=nr=Ce&65535|Se<<16,J[6]=Or=ae&65535|oe<<16,F=ir,H=Nr,ae=H&65535,oe=H>>>16,Ce=F&65535,Se=F>>>16,F=z[7],H=J[7],ae+=H&65535,oe+=H>>>16,Ce+=F&65535,Se+=F>>>16,oe+=ae>>>16,Ce+=oe>>>16,Se+=Ce>>>16,z[7]=ir=Ce&65535|Se<<16,J[7]=Nr=ae&65535|oe<<16,Hr+=128,O-=128}return O}function G(z,J,ee){var O=new Int32Array(8),te=new Int32Array(8),Ae=new Uint8Array(256),Ee,Be=ee;for(O[0]=1779033703,O[1]=3144134277,O[2]=1013904242,O[3]=2773480762,O[4]=1359893119,O[5]=2600822924,O[6]=528734635,O[7]=1541459225,te[0]=4089235720,te[1]=2227873595,te[2]=4271175723,te[3]=1595750129,te[4]=2917565137,te[5]=725511199,te[6]=4215389547,te[7]=327033209,D(O,te,J,ee),ee%=128,Ee=0;Ee=0;--te)O=ee[te/8|0]>>(te&7)&1,_e(z,J,O),me(J,z),me(z,z),_e(z,J,O)}function Re(z,J){var ee=[r(),r(),r(),r()];w(ee[0],h),w(ee[1],d),w(ee[2],s),de(ee[3],h,d),Fe(z,ee,J)}function le(z,J,ee){var O=new Uint8Array(64),te=[r(),r(),r(),r()],Ae;for(ee||n(J,32),G(O,J,32),O[0]&=248,O[31]&=127,O[31]|=64,Re(te,O),Pe(z,te),Ae=0;Ae<32;Ae++)J[Ae+32]=z[Ae];return 0}var Y=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function re(z,J){var ee,O,te,Ae;for(O=63;O>=32;--O){for(ee=0,te=O-32,Ae=O-12;te>4)*Y[te],ee=J[te]>>8,J[te]&=255;for(te=0;te<32;te++)J[te]-=ee*Y[te];for(O=0;O<32;O++)J[O+1]+=J[O]>>8,z[O]=J[O]&255}function ge(z){var J=new Float64Array(64),ee;for(ee=0;ee<64;ee++)J[ee]=z[ee];for(ee=0;ee<64;ee++)z[ee]=0;re(z,J)}function be(z,J,ee,O){var te=new Uint8Array(64),Ae=new Uint8Array(64),Ee=new Uint8Array(64),Be,qe,He=new Float64Array(64),$e=[r(),r(),r(),r()];G(te,O,32),te[0]&=248,te[31]&=127,te[31]|=64;var Lt=ee+64;for(Be=0;Be>7&&ne(z[0],a,z[0]),de(z[3],z[0],z[1]),0)}function Ie(z,J,ee,O){var te,Ae=new Uint8Array(32),Ee=new Uint8Array(64),Be=[r(),r(),r(),r()],qe=[r(),r(),r(),r()];if(ee<64||ce(qe,O))return-1;for(te=0;te=0},t.sign.keyPair=function(){var z=new Uint8Array(tt),J=new Uint8Array(Nt);return le(z,J),{publicKey:z,secretKey:J}},t.sign.keyPair.fromSecretKey=function(z){if(at(z),z.length!==Nt)throw new Error("bad secret key size");for(var J=new Uint8Array(tt),ee=0;ee=e.length)throw new Error("Index is out of buffer");const r=e.slice(0,t),n=e.slice(t);return[r,n]}function s2(e){let t="";return e.forEach(r=>{t+=("0"+(r&255).toString(16)).slice(-2)}),t}function lp(e){if(e.length%2!==0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let r=0;r{var o,i;if(!((o=t==null?void 0:t.signal)===null||o===void 0)&&o.aborted){n(new Mt("Delay aborted"));return}const a=setTimeout(()=>r(),e);(i=t==null?void 0:t.signal)===null||i===void 0||i.addEventListener("abort",()=>{clearTimeout(a),n(new Mt("Delay aborted"))})})})}function qi(e){const t=new AbortController;return e!=null&&e.aborted?t.abort():e==null||e.addEventListener("abort",()=>t.abort(),{once:!0}),t}function Tf(e,t){var r,n;return pt(this,void 0,void 0,function*(){const o=(r=t==null?void 0:t.attempts)!==null&&r!==void 0?r:10,i=(n=t==null?void 0:t.delayMs)!==null&&n!==void 0?n:200,a=qi(t==null?void 0:t.signal);if(typeof e!="function")throw new Mt(`Expected a function, got ${typeof e}`);let s=0,l;for(;spt(this,void 0,void 0,function*(){if(i=h??null,a==null||a.abort(),a=qi(h),a.signal.aborted)throw new Mt("Resource creation was aborted");n=d??null;const p=e(a.signal,...d);o=p;const v=yield p;if(o!==p&&v!==r)throw yield t(v),new Mt("Resource creation was aborted by a new resource creation");return r=v,r});return{create:s,current:()=>r??null,dispose:()=>pt(this,void 0,void 0,function*(){try{const h=r;r=null;const d=o;o=null;try{a==null||a.abort()}catch{}yield Promise.allSettled([h?t(h):Promise.resolve(),d?t(yield d):Promise.resolve()])}catch{}}),recreate:h=>pt(this,void 0,void 0,function*(){const d=r,p=o,v=n,b=i;if(yield SM(h),d===r&&p===o&&v===n&&b===i)return yield s(i,...v??[]);throw new Mt("Resource recreation was aborted by a new resource creation")})}}function yF(e,t){const r=t==null?void 0:t.timeout,n=t==null?void 0:t.signal,o=qi(n);return new Promise((i,a)=>{if(o.signal.aborted){a(new Mt("Operation aborted"));return}let s;typeof r<"u"&&(s=setTimeout(()=>{o.abort(),a(new Mt(`Timeout after ${r}ms`))},r)),o.signal.addEventListener("abort",()=>{clearTimeout(s),a(new Mt("Operation aborted"))},{once:!0});const l={timeout:r,abort:o.signal};e(i,a,l).finally(()=>clearTimeout(s))})}class l2{constructor(t,r,n,o,i){this.bridgeUrl=r,this.sessionId=n,this.listener=o,this.errorsListener=i,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=5e3,this.eventSource=vF((a,s)=>pt(this,void 0,void 0,function*(){const l={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:a,openingDeadlineMS:s};return yield bF(l)}),a=>pt(this,void 0,void 0,function*(){a.close()})),this.bridgeGatewayStorage=new pF(t,r)}get isReady(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)===EventSource.OPEN}get isClosed(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)!==EventSource.OPEN}get isConnecting(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)===EventSource.CONNECTING}registerSession(t){return pt(this,void 0,void 0,function*(){yield this.eventSource.create(t==null?void 0:t.signal,t==null?void 0:t.openingDeadlineMS)})}send(t,r,n,o){var i;return pt(this,void 0,void 0,function*(){const a={};typeof o=="number"?a.ttl=o:(a.ttl=o==null?void 0:o.ttl,a.signal=o==null?void 0:o.signal,a.attempts=o==null?void 0:o.attempts);const s=new URL(_M(this.bridgeUrl,this.postPath));s.searchParams.append("client_id",this.sessionId),s.searchParams.append("to",r),s.searchParams.append("ttl",((a==null?void 0:a.ttl)||this.defaultTtl).toString()),s.searchParams.append("topic",n);const l=Tw.encode(t);yield Tf(u=>pt(this,void 0,void 0,function*(){const c=yield this.post(s,l,u.signal);if(!c.ok)throw new Mt(`Bridge send failed, status ${c.status}`)}),{attempts:(i=a==null?void 0:a.attempts)!==null&&i!==void 0?i:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:a==null?void 0:a.signal})})}pause(){this.eventSource.dispose().catch(t=>yo(`Bridge pause failed, ${t}`))}unPause(){return pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(t=>yo(`Bridge close failed, ${t}`))})}setListener(t){this.listener=t}setErrorsListener(t){this.errorsListener=t}post(t,r,n){return pt(this,void 0,void 0,function*(){const o=yield fetch(t,{method:"post",body:r,signal:n});if(!o.ok)throw new Mt(`Bridge send failed, status ${o.status}`);return o})}errorsHandler(t,r){return pt(this,void 0,void 0,function*(){if(this.isConnecting){yo("Bridge error",JSON.stringify(r));return}if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return t.close(),Kr(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Mt("Bridge error, unknown state")})}messagesHandler(t){return pt(this,void 0,void 0,function*(){if(t.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(t.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(t.data)}catch(n){throw new Mt(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function bF(e){return pt(this,void 0,void 0,function*(){return yield yF((t,r,n)=>pt(this,void 0,void 0,function*(){var o;const a=qi(n.signal).signal;if(a.aborted){r(new Mt("Bridge connection aborted"));return}const s=new URL(_M(e.bridgeUrl,e.ssePath));s.searchParams.append("client_id",e.sessionId);const l=yield e.bridgeGatewayStorage.getLastEventId();if(l&&s.searchParams.append("last_event_id",l),a.aborted){r(new Mt("Bridge connection aborted"));return}const u=new EventSource(s.toString());u.onerror=c=>pt(this,void 0,void 0,function*(){if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}try{const h=yield e.errorHandler(u,c);h!==u&&u.close(),h&&h!==u&&t(h)}catch(h){u.close(),r(h)}}),u.onopen=()=>{if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}t(u)},u.onmessage=c=>{if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}e.messageHandler(c)},(o=e.signal)===null||o===void 0||o.addEventListener("abort",()=>{u.close(),r(new Mt("Bridge connection aborted"))})}),{timeout:e.openingDeadlineMS,signal:e.signal})})}function Bf(e){return!("connectEvent"in e)}class fd{constructor(t){this.storage=t,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(t){return pt(this,void 0,void 0,function*(){if(t.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(t));if(!Bf(t)){const n={sessionKeyPair:t.session.sessionCrypto.stringifyKeypair(),walletPublicKey:t.session.walletPublicKey,bridgeUrl:t.session.bridgeUrl},o={type:"http",connectEvent:t.connectEvent,session:n,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(o))}const r={type:"http",connectionSource:t.connectionSource,sessionCrypto:t.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.storage.getItem(this.storeKey);if(!t)return null;const r=JSON.parse(t);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Qb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Qb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read HTTP connection source while nothing is stored");if(t.type==="injected")throw new Mt("Trying to read HTTP connection source while injected connection is stored");return t})}getHttpPendingConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read HTTP connection source while nothing is stored");if(t.type==="injected")throw new Mt("Trying to read HTTP connection source while injected connection is stored");if(!Bf(t))throw new Mt("Trying to read HTTP-pending connection while http connection is stored");return t})}getInjectedConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read Injected bridge connection source while nothing is stored");if((t==null?void 0:t.type)==="http")throw new Mt("Trying to read Injected bridge connection source while HTTP connection is stored");return t})}storedConnectionType(){return pt(this,void 0,void 0,function*(){const t=yield this.storage.getItem(this.storeKey);return t?JSON.parse(t).type:null})}storeLastWalletEventId(t){return pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!Bf(r))return r.lastWalletEventId=t,this.storeConnection(r)})}getLastWalletEventId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(t&&"lastWalletEventId"in t)return t.lastWalletEventId})}increaseNextRpcRequestId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(t&&"nextRpcRequestId"in t){const r=t.nextRpcRequestId||0;return t.nextRpcRequestId=r+1,this.storeConnection(t)}})}getNextRpcRequestId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();return t&&"nextRpcRequestId"in t&&t.nextRpcRequestId||0})}}const CM=2;class dd{constructor(t,r){this.storage=t,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=5e3,this.connectionStorage=new fd(t)}static fromStorage(t){return pt(this,void 0,void 0,function*(){const n=yield new fd(t).getHttpConnection();return Bf(n)?new dd(t,n.connectionSource):new dd(t,{bridgeUrl:n.session.bridgeUrl})})}connect(t,r){var n;const o=qi(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,this.closeGateways();const i=new Qb;this.session={sessionCrypto:i,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:i}).then(()=>pt(this,void 0,void 0,function*(){o.signal.aborted||(yield Tf(s=>this.openGateways(i,{openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:s==null?void 0:s.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:o.signal}))}));const a="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(a,t)}restoreConnection(t){var r,n;return pt(this,void 0,void 0,function*(){const o=qi(t==null?void 0:t.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=o,o.signal.aborted)return;this.closeGateways();const i=yield this.connectionStorage.getHttpConnection();if(!i||o.signal.aborted)return;const a=(n=t==null?void 0:t.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(Bf(i))return this.session={sessionCrypto:i.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(i.sessionCrypto,{openingDeadlineMS:a,signal:o==null?void 0:o.signal});if(Array.isArray(this.walletConnectionSource))throw new Mt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=i.session,this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new l2(this.storage,this.walletConnectionSource.bridgeUrl,i.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!o.signal.aborted){this.listeners.forEach(s=>s(i.connectEvent));try{yield Tf(s=>this.gateway.registerSession({openingDeadlineMS:a,signal:s.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:o.signal})}catch{yield this.disconnect({signal:o.signal});return}}})}sendRequest(t,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((o,i)=>pt(this,void 0,void 0,function*(){var a;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Mt("Trying to send bridge request without session");const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Kr("Send http-bridge request:",Object.assign(Object.assign({},t),{id:s}));const l=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{id:s})),lp(this.session.walletPublicKey));try{yield this.gateway.send(l,this.session.walletPublicKey,t.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(a=n==null?void 0:n.onRequestSent)===null||a===void 0||a.call(n),this.pendingRequests.set(s.toString(),o)}catch(u){i(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(t){return pt(this,void 0,void 0,function*(){return new Promise(r=>pt(this,void 0,void 0,function*(){let n=!1,o=null;const i=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const a=qi(t==null?void 0:t.signal);o=setTimeout(()=>{a.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:i,signal:a.signal,attempts:1})}catch(a){Kr("Disconnect error:",a),n||this.removeBridgeAndSession().then(r)}finally{o&&clearTimeout(o),i()}}))})}listen(t){return this.listeners.push(t),()=>this.listeners=this.listeners.filter(r=>r!==t)}pause(){var t;(t=this.gateway)===null||t===void 0||t.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return pt(this,void 0,void 0,function*(){const t=this.pendingGateways.map(r=>r.unPause());this.gateway&&t.push(this.gateway.unPause()),yield Promise.all(t)})}pendingGatewaysListener(t,r,n){return pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(t)){yield t.close();return}return this.closeGateways({except:t}),this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=t,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(t){return pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(Tw.decode(t.message).toUint8Array(),lp(t.from)));if(Kr("Wallet message received:",r),!("event"in r)){const o=r.id.toString(),i=this.pendingRequests.get(o);if(!i){Kr(`Response id ${o} doesn't match any request's id`);return}i(r),this.pendingRequests.delete(o);return}if(r.id!==void 0){const o=yield this.connectionStorage.getLastWalletEventId();if(o!==void 0&&r.id<=o){yo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${o}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,t.from)),r.event==="disconnect"&&(Kr("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(o=>o(r))})}gatewayErrorsListener(t){return pt(this,void 0,void 0,function*(){throw new Mt(`Bridge error ${JSON.stringify(t)}`)})}updateSession(t,r){return pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=t.payload.items.find(i=>i.name==="ton_addr"),o=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:t.id,connectEvent:o,nextRpcRequestId:0})})}removeBridgeAndSession(){return pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(t,r){return Ws(t)?this.generateTGUniversalLink(t,r):this.generateRegularUniversalLink(t,r)}generateRegularUniversalLink(t,r){const n=new URL(t);return n.searchParams.append("v",CM.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(t,r){const o=this.generateRegularUniversalLink("about:blank",r).split("?")[1],i="tonconnect-"+xM(o),a=this.convertToDirectLink(t),s=new URL(a);return s.searchParams.append("startapp",i),s.toString()}convertToDirectLink(t){const r=new URL(t);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(t,r){return pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const o=new l2(this.storage,n.bridgeUrl,t.sessionId,()=>{},()=>{});return o.setListener(i=>this.pendingGatewaysListener(o,n.bridgeUrl,i)),o}),yield Promise.allSettled(this.pendingGateways.map(n=>Tf(o=>this.pendingGateways.some(i=>i===n)?n.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:o.signal}):n.close(),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new l2(this.storage,this.walletConnectionSource.bridgeUrl,t.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(t){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(t==null?void 0:t.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function Xx(e,t){return EM(e,[t])}function EM(e,t){return!e||typeof e!="object"?!1:t.every(r=>r in e)}function wF(e){try{return!Xx(e,"tonconnect")||!Xx(e.tonconnect,"walletInfo")?!1:EM(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}let lf=class{constructor(){this.storage={}}static getInstance(){return lf.instance||(lf.instance=new lf),lf.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(t){var r;return(r=this.storage[t])!==null&&r!==void 0?r:null}key(t){var r;const n=Object.keys(this.storage);return t<0||t>=n.length?null:(r=n[t])!==null&&r!==void 0?r:null}removeItem(t){delete this.storage[t]}setItem(t,r){this.storage[t]=r}};function P1(){if(!(typeof window>"u"))return window}function _F(){const e=P1();if(!e)return[];try{return Object.keys(e)}catch{return[]}}function xF(){if(!(typeof document>"u"))return document}function SF(){var e;const t=(e=P1())===null||e===void 0?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}function CF(){if(EF())return localStorage;if(kF())throw new Mt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return lf.getInstance()}function EF(){try{return typeof localStorage<"u"}catch{return!1}}function kF(){return typeof _t<"u"&&_t.versions!=null&&_t.versions.node!=null}class Yn{constructor(t,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=Yn.window;if(!Yn.isWindowContainsWallet(n,r))throw new Rw;this.connectionStorage=new fd(t),this.injectedWallet=n[r].tonconnect}static fromStorage(t){return pt(this,void 0,void 0,function*(){const n=yield new fd(t).getInjectedConnection();return new Yn(t,n.jsBridgeKey)})}static isWalletInjected(t){return Yn.isWindowContainsWallet(this.window,t)}static isInsideWalletBrowser(t){return Yn.isWindowContainsWallet(this.window,t)?this.window[t].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?_F().filter(([n,o])=>wF(o)).map(([n,o])=>({name:o.tonconnect.walletInfo.name,appName:o.tonconnect.walletInfo.app_name,aboutUrl:o.tonconnect.walletInfo.about_url,imageUrl:o.tonconnect.walletInfo.image,tondns:o.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:o.tonconnect.isWalletBrowser,platforms:o.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(t,r){return!!t&&r in t&&typeof t[r]=="object"&&"tonconnect"in t[r]}connect(t){this._connect(CM,t)}restoreConnection(){return pt(this,void 0,void 0,function*(){try{Kr("Injected Provider restoring connection...");const t=yield this.injectedWallet.restoreConnection();Kr("Injected Provider restoring connection response",t),t.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(t))):yield this.connectionStorage.removeConnection()}catch(t){yield this.connectionStorage.removeConnection(),console.error(t)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return pt(this,void 0,void 0,function*(){return new Promise(t=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(t)};try{this.injectedWallet.disconnect(),r()}catch(n){Kr(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var t;this.listenSubscriptions=!1,this.listeners=[],(t=this.unsubscribeCallback)===null||t===void 0||t.call(this)}listen(t){return this.listeners.push(t),()=>this.listeners=this.listeners.filter(r=>r!==t)}sendRequest(t,r){var n;return pt(this,void 0,void 0,function*(){const o={};typeof r=="function"?o.onRequestSent=r:(o.onRequestSent=r==null?void 0:r.onRequestSent,o.signal=r==null?void 0:r.signal);const i=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Kr("Send injected-bridge request:",Object.assign(Object.assign({},t),{id:i}));const a=this.injectedWallet.send(Object.assign(Object.assign({},t),{id:i}));return a.then(s=>Kr("Wallet message received:",s)),(n=o==null?void 0:o.onRequestSent)===null||n===void 0||n.call(o),a})}_connect(t,r){return pt(this,void 0,void 0,function*(){try{Kr(`Injected Provider connect request: protocolVersion: ${t}, message:`,r);const n=yield this.injectedWallet.connect(t,r);Kr("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(o=>o(n))}catch(n){Kr("Injected Provider connect error:",n);const o={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(i=>i(o))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(t=>{Kr("Wallet message received:",t),this.listenSubscriptions&&this.listeners.forEach(r=>r(t)),t.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}Yn.window=P1();class AF{constructor(){this.localStorage=CF()}getItem(t){return pt(this,void 0,void 0,function*(){return this.localStorage.getItem(t)})}removeItem(t){return pt(this,void 0,void 0,function*(){this.localStorage.removeItem(t)})}setItem(t,r){return pt(this,void 0,void 0,function*(){this.localStorage.setItem(t,r)})}}function Vs(e){return MF(e)&&e.injected}function R1(e){return Vs(e)&&e.embedded}function MF(e){return"jsBridgeKey"in e}function Nw(e){return"bridgeUrl"in e}const IF=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class Xb{constructor(t){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",t!=null&&t.walletsListSource&&(this.walletsListSource=t.walletsListSource),t!=null&&t.cacheTTLMs&&(this.cacheTTLMs=t.cacheTTLMs)}getWallets(){return pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(R1);return r.length!==1?null:r[0]})}fetchWalletsList(){return pt(this,void 0,void 0,function*(){let t=[];try{if(t=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(t))throw new Ow("Wrong wallets list format, wallets list must be an array.");const o=t.filter(i=>!this.isCorrectWalletConfigDTO(i));o.length&&(yo(`Wallet(s) ${o.map(i=>i.name).join(", ")} config format is wrong. They were removed from the wallets list.`),t=t.filter(i=>this.isCorrectWalletConfigDTO(i)))}catch(n){yo(n),t=IF}let r=[];try{r=Yn.getCurrentlyInjectedWallets()}catch(n){yo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(t),r)})}walletConfigDTOListToWalletConfigList(t){return t.map(r=>{const o={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(i=>{if(i.type==="sse"&&(o.bridgeUrl=i.url,o.universalLink=r.universal_url,o.deepLink=r.deepLink),i.type==="js"){const a=i.key;o.jsBridgeKey=a,o.injected=Yn.isWalletInjected(a),o.embedded=Yn.isInsideWalletBrowser(a)}}),o})}mergeWalletsLists(t,r){return[...new Set(t.concat(r).map(o=>o.name)).values()].map(o=>{const i=t.find(s=>s.name===o),a=r.find(s=>s.name===o);return Object.assign(Object.assign({},i&&Object.assign({},i)),a&&Object.assign({},a))})}isCorrectWalletConfigDTO(t){if(!t||typeof t!="object")return!1;const r="name"in t,n="app_name"in t,o="image"in t,i="about_url"in t,a="platforms"in t;if(!r||!o||!i||!a||!n||!t.platforms||!Array.isArray(t.platforms)||!t.platforms.length||!("bridge"in t)||!Array.isArray(t.bridge)||!t.bridge.length)return!1;const s=t.bridge;if(s.some(c=>!c||typeof c!="object"||!("type"in c)))return!1;const l=s.find(c=>c.type==="sse");if(l&&(!("url"in l)||!l.url||!t.universal_url))return!1;const u=s.find(c=>c.type==="js");return!(u&&(!("key"in u)||!u.key))}}class fp extends Mt{get info(){return"Wallet doesn't support requested feature method."}constructor(...t){super(...t),Object.setPrototypeOf(this,fp.prototype)}}function TF(e,t){const r=e.includes("SendTransaction"),n=e.find(o=>o&&typeof o=="object"&&o.name==="SendTransaction");if(!r&&!n)throw new fp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var s,l;return{address:(s=a.address)!==null&&s!==void 0?s:null,amount:(l=a.amount)!==null&&l!==void 0?l:null}})}}function OM(e,t,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},ic(e,t)),Lw(t,r))}function NM(e,t,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},ic(e,t)),Lw(t,r))}function LM(e,t,r,n,o){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:o??null},ic(e,t)),Lw(t,r))}function DM(e,t,r){return Object.assign({type:"disconnection",scope:r},ic(e,t))}class UM{constructor(){this.window=P1()}dispatchEvent(t,r){var n;return pt(this,void 0,void 0,function*(){const o=new CustomEvent(t,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(o)})}addEventListener(t,r,n){var o;return pt(this,void 0,void 0,function*(){return(o=this.window)===null||o===void 0||o.addEventListener(t,r,n),()=>{var i;return(i=this.window)===null||i===void 0?void 0:i.removeEventListener(t,r)}})}}class BF{constructor(t){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=t==null?void 0:t.eventDispatcher)!==null&&r!==void 0?r:new UM,this.tonConnectSdkVersion=t.tonConnectSdkVersion,this.init().catch()}get version(){return Nl({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",AM(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return pt(this,void 0,void 0,function*(){return new Promise((t,r)=>pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{t(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",kM())}catch(n){r(n)}}))})}dispatchUserActionEvent(t){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${t.type}`,t).catch()}catch{}}trackConnectionStarted(...t){try{const r=MM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...t){try{const r=IM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...t){try{const r=TM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...t){try{const r=BM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...t){try{const r=PM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...t){try{const r=RM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...t){try{const r=DM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...t){try{const r=OM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...t){try{const r=NM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...t){try{const r=LM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}}const PF="3.0.3";class tl{constructor(t){if(this.walletsList=new Xb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(t==null?void 0:t.manifestUrl)||SF(),storage:(t==null?void 0:t.storage)||new AF},this.walletsList=new Xb({walletsListSource:t==null?void 0:t.walletsListSource,cacheTTLMs:t==null?void 0:t.walletsListCacheTTLMs}),this.tracker=new BF({eventDispatcher:t==null?void 0:t.eventDispatcher,tonConnectSdkVersion:PF}),!this.dappSettings.manifestUrl)throw new Bw("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fd(this.dappSettings.storage),t!=null&&t.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var t;return((t=this._wallet)===null||t===void 0?void 0:t.account)||null}get wallet(){return this._wallet}set wallet(t){this._wallet=t,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(t,r){return this.statusChangeSubscriptions.push(t),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==t),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(t,r){var n,o;const i={};if(typeof r=="object"&&"tonProof"in r&&(i.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(i.request=r==null?void 0:r.request,i.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,i.signal=r==null?void 0:r.signal),this.connected)throw new Pw;const a=qi(i==null?void 0:i.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=a,a.signal.aborted)throw new Mt("Connection was aborted");return(o=this.provider)===null||o===void 0||o.closeConnection(),this.provider=this.createProvider(t),a.signal.addEventListener("abort",()=>{var s;(s=this.provider)===null||s===void 0||s.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(i==null?void 0:i.request),{openingDeadlineMS:i==null?void 0:i.openingDeadlineMS,signal:a.signal})}restoreConnection(t){var r,n;return pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const o=qi(t==null?void 0:t.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=o,o.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[i,a]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(o.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let s=null;try{switch(i){case"http":s=yield dd.fromStorage(this.dappSettings.storage);break;case"injected":s=yield Yn.fromStorage(this.dappSettings.storage);break;default:if(a)s=this.createProvider(a);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),s==null||s.closeConnection(),s=null;return}if(o.signal.aborted){s==null||s.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!s){yo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=s,s.listen(this.walletEventsListener.bind(this));const l=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),s==null||s.closeConnection(),s=null};return o.signal.addEventListener("abort",l),yield Tf(u=>pt(this,void 0,void 0,function*(){yield s==null?void 0:s.restoreConnection({openingDeadlineMS:t==null?void 0:t.openingDeadlineMS,signal:u.signal}),o.signal.removeEventListener("abort",l),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:t==null?void 0:t.signal})})}sendTransaction(t,r){return pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const o=qi(n==null?void 0:n.signal);if(o.signal.aborted)throw new Mt("Transaction sending was aborted");this.checkConnection(),TF(this.wallet.device.features,{requiredMessagesNumber:t.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,t);const{validUntil:i}=t,a=lF(t,["validUntil"]),s=t.from||this.account.address,l=t.network||this.account.chain,u=yield this.provider.sendRequest(qh.convertToRpcRequest(Object.assign(Object.assign({},a),{valid_until:i,from:s,network:l})),{onRequestSent:n.onRequestSent,signal:o.signal});if(qh.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,t,u.error.message,u.error.code),qh.parseAndThrowError(u);const c=qh.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,t,c),c})}disconnect(t){var r;return pt(this,void 0,void 0,function*(){if(!this.connected)throw new up;const n=qi(t==null?void 0:t.signal),o=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Mt("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),o==null||o.abort()})}pauseConnection(){var t;((t=this.provider)===null||t===void 0?void 0:t.type)==="http"&&this.provider.pause()}unPauseConnection(){var t;return((t=this.provider)===null||t===void 0?void 0:t.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const t=xF();if(t)try{t.addEventListener("visibilitychange",()=>{t.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){yo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(t){let r;return!Array.isArray(t)&&uF(t)?r=new Yn(this.dappSettings.storage,t.jsBridgeKey):r=new dd(this.dappSettings.storage,t),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(t){switch(t.event){case"connect":this.onWalletConnected(t.payload);break;case"connect_error":this.onWalletConnectError(t.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(t){const r=t.items.find(i=>i.name==="ton_addr"),n=t.items.find(i=>i.name==="ton_proof");if(!r)throw new Mt("ton_addr connection item was not found");const o={device:t.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(o.connectItems={tonProof:n}),this.wallet=o,this.tracker.trackConnectionCompleted(o)}onWalletConnectError(t){const r=fF.parseError(t);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Kr(r),this.tracker.trackConnectionError(t.message,t.code),r instanceof M1||r instanceof A1)throw yo(r),r}onWalletDisconnected(t){this.tracker.trackDisconnection(this.wallet,t),this.wallet=null}checkConnection(){if(!this.connected)throw new up}createConnectRequest(t){const r=[{name:"ton_addr"}];return t!=null&&t.tonProof&&r.push({name:"ton_proof",payload:t.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}tl.walletsList=new Xb;tl.isWalletInjected=e=>Yn.isWalletInjected(e);tl.isInsideWalletBrowser=e=>Yn.isInsideWalletBrowser(e);const RF=81,OF=128;function Dw(e,t=!1){const{wc:r,hex:n}=NF(e);let o=RF;t&&(o|=OF);const i=new Int8Array(34);i[0]=o,i[1]=r,i.set(n,2);const a=new Uint8Array(36);return a.set(i),a.set(LF(i),34),Tw.encode(a).replace(/\+/g,"-").replace(/\//g,"_")}function NF(e){if(!e.includes(":"))throw new lu(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(t.length!==2)throw new lu(`Wrong address ${e}. Address must include ":" only once.`);const r=parseInt(t[0]);if(r!==0&&r!==-1)throw new lu(`Wrong address ${e}. WC must be eq 0 or -1, but ${r} received.`);const n=t[1];if((n==null?void 0:n.length)!==64)throw new lu(`Wrong address ${e}. Hex part must be 64bytes length, but ${n==null?void 0:n.length} received.`);return{wc:r,hex:DF(n)}}function LF(e){let r=0;const n=new Uint8Array(e.length+2);n.set(e);for(let o of n){let i=128;for(;i>0;)r<<=1,o&i&&(r+=1),i>>=1,r>65535&&(r&=65535,r^=4129)}return new Uint8Array([Math.floor(r/256),r%256])}const Jb={};for(let e=0;e<=255;e++){let t=e.toString(16);t.length<2&&(t="0"+t),Jb[t]=e}function DF(e){e=e.toLowerCase();const t=e.length;if(t%2!==0)throw new cp("Hex string must have length a multiple of 2: "+e);const r=t/2,n=new Uint8Array(r);for(let o=0;o0?Ie.length===2?typeof Ie[1]==s?this[Ie[0]]=Ie[1].call(this,Te):this[Ie[0]]=Ie[1]:Ie.length===3?typeof Ie[1]===s&&!(Ie[1].exec&&Ie[1].test)?this[Ie[0]]=Te?Ie[1].call(this,Te,Ie[2]):n:this[Ie[0]]=Te?Te.replace(Ie[1],Ie[2]):n:Ie.length===4&&(this[Ie[0]]=Te?Ie[3].call(this,Te.replace(Ie[1],Ie[2])):n):this[Ie]=Te||n;re+=2}},D=function(le,Y){for(var re in Y)if(typeof Y[re]===u&&Y[re].length>0){for(var ge=0;ge2&&(ke[d]="iPad",ke[v]=P),ke},this.getEngine=function(){var ke={};return ke[p]=n,ke[S]=n,N.call(ke,ge,ce.engine),ke},this.getOS=function(){var ke={};return ke[p]=n,ke[S]=n,N.call(ke,ge,ce.os),Ie&&!ke[p]&&be&&be.platform&&be.platform!="Unknown"&&(ke[p]=be.platform.replace(/chrome os/i,se).replace(/macos/i,pe)),ke},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ge},this.setUA=function(ke){return ge=typeof ke===c&&ke.length>K?Q(ke,K):ke,this},this.setUA(ge),this};Pe.VERSION=o,Pe.BROWSER=q([p,S,h]),Pe.CPU=q([x]),Pe.DEVICE=q([d,b,v,k,M,L,P,j,V]),Pe.ENGINE=Pe.OS=q([p,S]),e.exports&&(t=e.exports=Pe),t.UAParser=Pe;var Fe=typeof r!==l&&(r.jQuery||r.Zepto);if(Fe&&!Fe.ua){var Re=new Pe;Fe.ua=Re.getResult(),Fe.ua.get=function(){return Re.getUA()},Fe.ua.set=function(le){Re.setUA(le);var Y=Re.getResult();for(var re in Y)Fe.ua[re]=Y[re]}}})(typeof window=="object"?window:Ze)})(UF,dp);const jF=dp;var FF=function(t){return zF(t)&&!$F(t)};function zF(e){return!!e&&typeof e=="object"}function $F(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||VF(e)}var qF=typeof Symbol=="function"&&Symbol.for,WF=qF?Symbol.for("react.element"):60103;function VF(e){return e.$$typeof===WF}function HF(e){return Array.isArray(e)?[]:{}}function hd(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Lu(HF(e),e,t):e}function KF(e,t,r){return e.concat(t).map(function(n){return hd(n,r)})}function ZF(e,t){if(!t.customMerge)return Lu;var r=t.customMerge(e);return typeof r=="function"?r:Lu}function GF(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function Jx(e){return Object.keys(e).concat(GF(e))}function jM(e,t){try{return t in e}catch{return!1}}function YF(e,t){return jM(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function QF(e,t,r){var n={};return r.isMergeableObject(e)&&Jx(e).forEach(function(o){n[o]=hd(e[o],r)}),Jx(t).forEach(function(o){YF(e,o)||(jM(e,o)&&r.isMergeableObject(t[o])?n[o]=ZF(o,r)(e[o],t[o],r):n[o]=hd(t[o],r))}),n}function Lu(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||KF,r.isMergeableObject=r.isMergeableObject||FF,r.cloneUnlessOtherwiseSpecified=hd;var n=Array.isArray(t),o=Array.isArray(e),i=n===o;return i?n?r.arrayMerge(e,t,r):QF(e,t,r):hd(t,r)}Lu.all=function(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,o){return Lu(n,o,r)},{})};var XF=Lu,JF=XF,e4={},ez={get exports(){return e4},set exports(e){e4=e}};/*! +***************************************************************************** */function aF(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o{var o,i;if(!((o=t==null?void 0:t.signal)===null||o===void 0)&&o.aborted){n(new Mt("Delay aborted"));return}const a=setTimeout(()=>r(),e);(i=t==null?void 0:t.signal)===null||i===void 0||i.addEventListener("abort",()=>{clearTimeout(a),n(new Mt("Delay aborted"))})})})}function qi(e){const t=new AbortController;return e!=null&&e.aborted?t.abort():e==null||e.addEventListener("abort",()=>t.abort(),{once:!0}),t}function Tf(e,t){var r,n;return pt(this,void 0,void 0,function*(){const o=(r=t==null?void 0:t.attempts)!==null&&r!==void 0?r:10,i=(n=t==null?void 0:t.delayMs)!==null&&n!==void 0?n:200,a=qi(t==null?void 0:t.signal);if(typeof e!="function")throw new Mt(`Expected a function, got ${typeof e}`);let s=0,l;for(;spt(this,void 0,void 0,function*(){if(i=h??null,a==null||a.abort(),a=qi(h),a.signal.aborted)throw new Mt("Resource creation was aborted");n=d??null;const p=e(a.signal,...d);o=p;const v=yield p;if(o!==p&&v!==r)throw yield t(v),new Mt("Resource creation was aborted by a new resource creation");return r=v,r});return{create:s,current:()=>r??null,dispose:()=>pt(this,void 0,void 0,function*(){try{const h=r;r=null;const d=o;o=null;try{a==null||a.abort()}catch{}yield Promise.allSettled([h?t(h):Promise.resolve(),d?t(yield d):Promise.resolve()])}catch{}}),recreate:h=>pt(this,void 0,void 0,function*(){const d=r,p=o,v=n,b=i;if(yield CM(h),d===r&&p===o&&v===n&&b===i)return yield s(i,...v??[]);throw new Mt("Resource recreation was aborted by a new resource creation")})}}function mF(e,t){const r=t==null?void 0:t.timeout,n=t==null?void 0:t.signal,o=qi(n);return new Promise((i,a)=>{if(o.signal.aborted){a(new Mt("Operation aborted"));return}let s;typeof r<"u"&&(s=setTimeout(()=>{o.abort(),a(new Mt(`Timeout after ${r}ms`))},r)),o.signal.addEventListener("abort",()=>{clearTimeout(s),a(new Mt("Operation aborted"))},{once:!0});const l={timeout:r,abort:o.signal};e(i,a,l).finally(()=>clearTimeout(s))})}class l2{constructor(t,r,n,o,i){this.bridgeUrl=r,this.sessionId=n,this.listener=o,this.errorsListener=i,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=5e3,this.eventSource=gF((a,s)=>pt(this,void 0,void 0,function*(){const l={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:a,openingDeadlineMS:s};return yield vF(l)}),a=>pt(this,void 0,void 0,function*(){a.close()})),this.bridgeGatewayStorage=new dF(t,r)}get isReady(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)===EventSource.OPEN}get isClosed(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)!==EventSource.OPEN}get isConnecting(){const t=this.eventSource.current();return(t==null?void 0:t.readyState)===EventSource.CONNECTING}registerSession(t){return pt(this,void 0,void 0,function*(){yield this.eventSource.create(t==null?void 0:t.signal,t==null?void 0:t.openingDeadlineMS)})}send(t,r,n,o){var i;return pt(this,void 0,void 0,function*(){const a={};typeof o=="number"?a.ttl=o:(a.ttl=o==null?void 0:o.ttl,a.signal=o==null?void 0:o.signal,a.attempts=o==null?void 0:o.attempts);const s=new URL(xM(this.bridgeUrl,this.postPath));s.searchParams.append("client_id",this.sessionId),s.searchParams.append("to",r),s.searchParams.append("ttl",((a==null?void 0:a.ttl)||this.defaultTtl).toString()),s.searchParams.append("topic",n);const l=Iw.encode(t);yield Tf(u=>pt(this,void 0,void 0,function*(){const c=yield this.post(s,l,u.signal);if(!c.ok)throw new Mt(`Bridge send failed, status ${c.status}`)}),{attempts:(i=a==null?void 0:a.attempts)!==null&&i!==void 0?i:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:a==null?void 0:a.signal})})}pause(){this.eventSource.dispose().catch(t=>yo(`Bridge pause failed, ${t}`))}unPause(){return pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(t=>yo(`Bridge close failed, ${t}`))})}setListener(t){this.listener=t}setErrorsListener(t){this.errorsListener=t}post(t,r,n){return pt(this,void 0,void 0,function*(){const o=yield fetch(t,{method:"post",body:r,signal:n});if(!o.ok)throw new Mt(`Bridge send failed, status ${o.status}`);return o})}errorsHandler(t,r){return pt(this,void 0,void 0,function*(){if(this.isConnecting){yo("Bridge error",JSON.stringify(r));return}if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return t.close(),Kr(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Mt("Bridge error, unknown state")})}messagesHandler(t){return pt(this,void 0,void 0,function*(){if(t.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(t.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(t.data)}catch(n){throw new Mt(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function vF(e){return pt(this,void 0,void 0,function*(){return yield mF((t,r,n)=>pt(this,void 0,void 0,function*(){var o;const a=qi(n.signal).signal;if(a.aborted){r(new Mt("Bridge connection aborted"));return}const s=new URL(xM(e.bridgeUrl,e.ssePath));s.searchParams.append("client_id",e.sessionId);const l=yield e.bridgeGatewayStorage.getLastEventId();if(l&&s.searchParams.append("last_event_id",l),a.aborted){r(new Mt("Bridge connection aborted"));return}const u=new EventSource(s.toString());u.onerror=c=>pt(this,void 0,void 0,function*(){if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}try{const h=yield e.errorHandler(u,c);h!==u&&u.close(),h&&h!==u&&t(h)}catch(h){u.close(),r(h)}}),u.onopen=()=>{if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}t(u)},u.onmessage=c=>{if(a.aborted){u.close(),r(new Mt("Bridge connection aborted"));return}e.messageHandler(c)},(o=e.signal)===null||o===void 0||o.addEventListener("abort",()=>{u.close(),r(new Mt("Bridge connection aborted"))})}),{timeout:e.openingDeadlineMS,signal:e.signal})})}function Bf(e){return!("connectEvent"in e)}class fd{constructor(t){this.storage=t,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(t){return pt(this,void 0,void 0,function*(){if(t.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(t));if(!Bf(t)){const n={sessionKeyPair:t.session.sessionCrypto.stringifyKeypair(),walletPublicKey:t.session.walletPublicKey,bridgeUrl:t.session.bridgeUrl},o={type:"http",connectEvent:t.connectEvent,session:n,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(o))}const r={type:"http",connectionSource:t.connectionSource,sessionCrypto:t.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.storage.getItem(this.storeKey);if(!t)return null;const r=JSON.parse(t);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Yb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Yb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read HTTP connection source while nothing is stored");if(t.type==="injected")throw new Mt("Trying to read HTTP connection source while injected connection is stored");return t})}getHttpPendingConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read HTTP connection source while nothing is stored");if(t.type==="injected")throw new Mt("Trying to read HTTP connection source while injected connection is stored");if(!Bf(t))throw new Mt("Trying to read HTTP-pending connection while http connection is stored");return t})}getInjectedConnection(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(!t)throw new Mt("Trying to read Injected bridge connection source while nothing is stored");if((t==null?void 0:t.type)==="http")throw new Mt("Trying to read Injected bridge connection source while HTTP connection is stored");return t})}storedConnectionType(){return pt(this,void 0,void 0,function*(){const t=yield this.storage.getItem(this.storeKey);return t?JSON.parse(t).type:null})}storeLastWalletEventId(t){return pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!Bf(r))return r.lastWalletEventId=t,this.storeConnection(r)})}getLastWalletEventId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(t&&"lastWalletEventId"in t)return t.lastWalletEventId})}increaseNextRpcRequestId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();if(t&&"nextRpcRequestId"in t){const r=t.nextRpcRequestId||0;return t.nextRpcRequestId=r+1,this.storeConnection(t)}})}getNextRpcRequestId(){return pt(this,void 0,void 0,function*(){const t=yield this.getConnection();return t&&"nextRpcRequestId"in t&&t.nextRpcRequestId||0})}}const EM=2;class dd{constructor(t,r){this.storage=t,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=5e3,this.connectionStorage=new fd(t)}static fromStorage(t){return pt(this,void 0,void 0,function*(){const n=yield new fd(t).getHttpConnection();return Bf(n)?new dd(t,n.connectionSource):new dd(t,{bridgeUrl:n.session.bridgeUrl})})}connect(t,r){var n;const o=qi(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,this.closeGateways();const i=new Yb;this.session={sessionCrypto:i,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:i}).then(()=>pt(this,void 0,void 0,function*(){o.signal.aborted||(yield Tf(s=>this.openGateways(i,{openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:s==null?void 0:s.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:o.signal}))}));const a="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(a,t)}restoreConnection(t){var r,n;return pt(this,void 0,void 0,function*(){const o=qi(t==null?void 0:t.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=o,o.signal.aborted)return;this.closeGateways();const i=yield this.connectionStorage.getHttpConnection();if(!i||o.signal.aborted)return;const a=(n=t==null?void 0:t.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(Bf(i))return this.session={sessionCrypto:i.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(i.sessionCrypto,{openingDeadlineMS:a,signal:o==null?void 0:o.signal});if(Array.isArray(this.walletConnectionSource))throw new Mt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=i.session,this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new l2(this.storage,this.walletConnectionSource.bridgeUrl,i.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!o.signal.aborted){this.listeners.forEach(s=>s(i.connectEvent));try{yield Tf(s=>this.gateway.registerSession({openingDeadlineMS:a,signal:s.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:o.signal})}catch{yield this.disconnect({signal:o.signal});return}}})}sendRequest(t,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((o,i)=>pt(this,void 0,void 0,function*(){var a;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Mt("Trying to send bridge request without session");const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Kr("Send http-bridge request:",Object.assign(Object.assign({},t),{id:s}));const l=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{id:s})),lp(this.session.walletPublicKey));try{yield this.gateway.send(l,this.session.walletPublicKey,t.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(a=n==null?void 0:n.onRequestSent)===null||a===void 0||a.call(n),this.pendingRequests.set(s.toString(),o)}catch(u){i(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(t){return pt(this,void 0,void 0,function*(){return new Promise(r=>pt(this,void 0,void 0,function*(){let n=!1,o=null;const i=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const a=qi(t==null?void 0:t.signal);o=setTimeout(()=>{a.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:i,signal:a.signal,attempts:1})}catch(a){Kr("Disconnect error:",a),n||this.removeBridgeAndSession().then(r)}finally{o&&clearTimeout(o),i()}}))})}listen(t){return this.listeners.push(t),()=>this.listeners=this.listeners.filter(r=>r!==t)}pause(){var t;(t=this.gateway)===null||t===void 0||t.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return pt(this,void 0,void 0,function*(){const t=this.pendingGateways.map(r=>r.unPause());this.gateway&&t.push(this.gateway.unPause()),yield Promise.all(t)})}pendingGatewaysListener(t,r,n){return pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(t)){yield t.close();return}return this.closeGateways({except:t}),this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=t,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(t){return pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(Iw.decode(t.message).toUint8Array(),lp(t.from)));if(Kr("Wallet message received:",r),!("event"in r)){const o=r.id.toString(),i=this.pendingRequests.get(o);if(!i){Kr(`Response id ${o} doesn't match any request's id`);return}i(r),this.pendingRequests.delete(o);return}if(r.id!==void 0){const o=yield this.connectionStorage.getLastWalletEventId();if(o!==void 0&&r.id<=o){yo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${o}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,t.from)),r.event==="disconnect"&&(Kr("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(o=>o(r))})}gatewayErrorsListener(t){return pt(this,void 0,void 0,function*(){throw new Mt(`Bridge error ${JSON.stringify(t)}`)})}updateSession(t,r){return pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=t.payload.items.find(i=>i.name==="ton_addr"),o=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:t.id,connectEvent:o,nextRpcRequestId:0})})}removeBridgeAndSession(){return pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(t,r){return Ws(t)?this.generateTGUniversalLink(t,r):this.generateRegularUniversalLink(t,r)}generateRegularUniversalLink(t,r){const n=new URL(t);return n.searchParams.append("v",EM.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(t,r){const o=this.generateRegularUniversalLink("about:blank",r).split("?")[1],i="tonconnect-"+SM(o),a=this.convertToDirectLink(t),s=new URL(a);return s.searchParams.append("startapp",i),s.toString()}convertToDirectLink(t){const r=new URL(t);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(t,r){return pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const o=new l2(this.storage,n.bridgeUrl,t.sessionId,()=>{},()=>{});return o.setListener(i=>this.pendingGatewaysListener(o,n.bridgeUrl,i)),o}),yield Promise.allSettled(this.pendingGateways.map(n=>Tf(o=>this.pendingGateways.some(i=>i===n)?n.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:o.signal}):n.close(),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Kr("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new l2(this.storage,this.walletConnectionSource.bridgeUrl,t.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(t){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(t==null?void 0:t.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function Jx(e,t){return kM(e,[t])}function kM(e,t){return!e||typeof e!="object"?!1:t.every(r=>r in e)}function yF(e){try{return!Jx(e,"tonconnect")||!Jx(e.tonconnect,"walletInfo")?!1:kM(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}let lf=class{constructor(){this.storage={}}static getInstance(){return lf.instance||(lf.instance=new lf),lf.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(t){var r;return(r=this.storage[t])!==null&&r!==void 0?r:null}key(t){var r;const n=Object.keys(this.storage);return t<0||t>=n.length?null:(r=n[t])!==null&&r!==void 0?r:null}removeItem(t){delete this.storage[t]}setItem(t,r){this.storage[t]=r}};function P1(){if(!(typeof window>"u"))return window}function bF(){const e=P1();if(!e)return[];try{return Object.keys(e)}catch{return[]}}function wF(){if(!(typeof document>"u"))return document}function _F(){var e;const t=(e=P1())===null||e===void 0?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}function xF(){if(SF())return localStorage;if(CF())throw new Mt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return lf.getInstance()}function SF(){try{return typeof localStorage<"u"}catch{return!1}}function CF(){return typeof _t<"u"&&_t.versions!=null&&_t.versions.node!=null}class Yn{constructor(t,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=Yn.window;if(!Yn.isWindowContainsWallet(n,r))throw new Pw;this.connectionStorage=new fd(t),this.injectedWallet=n[r].tonconnect}static fromStorage(t){return pt(this,void 0,void 0,function*(){const n=yield new fd(t).getInjectedConnection();return new Yn(t,n.jsBridgeKey)})}static isWalletInjected(t){return Yn.isWindowContainsWallet(this.window,t)}static isInsideWalletBrowser(t){return Yn.isWindowContainsWallet(this.window,t)?this.window[t].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?bF().filter(([n,o])=>yF(o)).map(([n,o])=>({name:o.tonconnect.walletInfo.name,appName:o.tonconnect.walletInfo.app_name,aboutUrl:o.tonconnect.walletInfo.about_url,imageUrl:o.tonconnect.walletInfo.image,tondns:o.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:o.tonconnect.isWalletBrowser,platforms:o.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(t,r){return!!t&&r in t&&typeof t[r]=="object"&&"tonconnect"in t[r]}connect(t){this._connect(EM,t)}restoreConnection(){return pt(this,void 0,void 0,function*(){try{Kr("Injected Provider restoring connection...");const t=yield this.injectedWallet.restoreConnection();Kr("Injected Provider restoring connection response",t),t.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(t))):yield this.connectionStorage.removeConnection()}catch(t){yield this.connectionStorage.removeConnection(),console.error(t)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return pt(this,void 0,void 0,function*(){return new Promise(t=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(t)};try{this.injectedWallet.disconnect(),r()}catch(n){Kr(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var t;this.listenSubscriptions=!1,this.listeners=[],(t=this.unsubscribeCallback)===null||t===void 0||t.call(this)}listen(t){return this.listeners.push(t),()=>this.listeners=this.listeners.filter(r=>r!==t)}sendRequest(t,r){var n;return pt(this,void 0,void 0,function*(){const o={};typeof r=="function"?o.onRequestSent=r:(o.onRequestSent=r==null?void 0:r.onRequestSent,o.signal=r==null?void 0:r.signal);const i=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Kr("Send injected-bridge request:",Object.assign(Object.assign({},t),{id:i}));const a=this.injectedWallet.send(Object.assign(Object.assign({},t),{id:i}));return a.then(s=>Kr("Wallet message received:",s)),(n=o==null?void 0:o.onRequestSent)===null||n===void 0||n.call(o),a})}_connect(t,r){return pt(this,void 0,void 0,function*(){try{Kr(`Injected Provider connect request: protocolVersion: ${t}, message:`,r);const n=yield this.injectedWallet.connect(t,r);Kr("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(o=>o(n))}catch(n){Kr("Injected Provider connect error:",n);const o={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(i=>i(o))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(t=>{Kr("Wallet message received:",t),this.listenSubscriptions&&this.listeners.forEach(r=>r(t)),t.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}Yn.window=P1();class EF{constructor(){this.localStorage=xF()}getItem(t){return pt(this,void 0,void 0,function*(){return this.localStorage.getItem(t)})}removeItem(t){return pt(this,void 0,void 0,function*(){this.localStorage.removeItem(t)})}setItem(t,r){return pt(this,void 0,void 0,function*(){this.localStorage.setItem(t,r)})}}function Vs(e){return kF(e)&&e.injected}function R1(e){return Vs(e)&&e.embedded}function kF(e){return"jsBridgeKey"in e}function Ow(e){return"bridgeUrl"in e}const AF=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class Qb{constructor(t){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",t!=null&&t.walletsListSource&&(this.walletsListSource=t.walletsListSource),t!=null&&t.cacheTTLMs&&(this.cacheTTLMs=t.cacheTTLMs)}getWallets(){return pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(R1);return r.length!==1?null:r[0]})}fetchWalletsList(){return pt(this,void 0,void 0,function*(){let t=[];try{if(t=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(t))throw new Rw("Wrong wallets list format, wallets list must be an array.");const o=t.filter(i=>!this.isCorrectWalletConfigDTO(i));o.length&&(yo(`Wallet(s) ${o.map(i=>i.name).join(", ")} config format is wrong. They were removed from the wallets list.`),t=t.filter(i=>this.isCorrectWalletConfigDTO(i)))}catch(n){yo(n),t=AF}let r=[];try{r=Yn.getCurrentlyInjectedWallets()}catch(n){yo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(t),r)})}walletConfigDTOListToWalletConfigList(t){return t.map(r=>{const o={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(i=>{if(i.type==="sse"&&(o.bridgeUrl=i.url,o.universalLink=r.universal_url,o.deepLink=r.deepLink),i.type==="js"){const a=i.key;o.jsBridgeKey=a,o.injected=Yn.isWalletInjected(a),o.embedded=Yn.isInsideWalletBrowser(a)}}),o})}mergeWalletsLists(t,r){return[...new Set(t.concat(r).map(o=>o.name)).values()].map(o=>{const i=t.find(s=>s.name===o),a=r.find(s=>s.name===o);return Object.assign(Object.assign({},i&&Object.assign({},i)),a&&Object.assign({},a))})}isCorrectWalletConfigDTO(t){if(!t||typeof t!="object")return!1;const r="name"in t,n="app_name"in t,o="image"in t,i="about_url"in t,a="platforms"in t;if(!r||!o||!i||!a||!n||!t.platforms||!Array.isArray(t.platforms)||!t.platforms.length||!("bridge"in t)||!Array.isArray(t.bridge)||!t.bridge.length)return!1;const s=t.bridge;if(s.some(c=>!c||typeof c!="object"||!("type"in c)))return!1;const l=s.find(c=>c.type==="sse");if(l&&(!("url"in l)||!l.url||!t.universal_url))return!1;const u=s.find(c=>c.type==="js");return!(u&&(!("key"in u)||!u.key))}}class fp extends Mt{get info(){return"Wallet doesn't support requested feature method."}constructor(...t){super(...t),Object.setPrototypeOf(this,fp.prototype)}}function MF(e,t){const r=e.includes("SendTransaction"),n=e.find(o=>o&&typeof o=="object"&&o.name==="SendTransaction");if(!r&&!n)throw new fp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var s,l;return{address:(s=a.address)!==null&&s!==void 0?s:null,amount:(l=a.amount)!==null&&l!==void 0?l:null}})}}function NM(e,t,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},ic(e,t)),Nw(t,r))}function LM(e,t,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},ic(e,t)),Nw(t,r))}function DM(e,t,r,n,o){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:o??null},ic(e,t)),Nw(t,r))}function UM(e,t,r){return Object.assign({type:"disconnection",scope:r},ic(e,t))}class jM{constructor(){this.window=P1()}dispatchEvent(t,r){var n;return pt(this,void 0,void 0,function*(){const o=new CustomEvent(t,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(o)})}addEventListener(t,r,n){var o;return pt(this,void 0,void 0,function*(){return(o=this.window)===null||o===void 0||o.addEventListener(t,r,n),()=>{var i;return(i=this.window)===null||i===void 0?void 0:i.removeEventListener(t,r)}})}}class IF{constructor(t){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=t==null?void 0:t.eventDispatcher)!==null&&r!==void 0?r:new jM,this.tonConnectSdkVersion=t.tonConnectSdkVersion,this.init().catch()}get version(){return Nl({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",MM(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return pt(this,void 0,void 0,function*(){return new Promise((t,r)=>pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{t(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",AM())}catch(n){r(n)}}))})}dispatchUserActionEvent(t){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${t.type}`,t).catch()}catch{}}trackConnectionStarted(...t){try{const r=IM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...t){try{const r=TM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...t){try{const r=BM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...t){try{const r=PM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...t){try{const r=RM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...t){try{const r=OM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...t){try{const r=UM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...t){try{const r=NM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...t){try{const r=LM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...t){try{const r=DM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}}const TF="3.0.3";class tl{constructor(t){if(this.walletsList=new Qb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(t==null?void 0:t.manifestUrl)||_F(),storage:(t==null?void 0:t.storage)||new EF},this.walletsList=new Qb({walletsListSource:t==null?void 0:t.walletsListSource,cacheTTLMs:t==null?void 0:t.walletsListCacheTTLMs}),this.tracker=new IF({eventDispatcher:t==null?void 0:t.eventDispatcher,tonConnectSdkVersion:TF}),!this.dappSettings.manifestUrl)throw new Tw("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fd(this.dappSettings.storage),t!=null&&t.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var t;return((t=this._wallet)===null||t===void 0?void 0:t.account)||null}get wallet(){return this._wallet}set wallet(t){this._wallet=t,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(t,r){return this.statusChangeSubscriptions.push(t),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==t),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(t,r){var n,o;const i={};if(typeof r=="object"&&"tonProof"in r&&(i.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(i.request=r==null?void 0:r.request,i.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,i.signal=r==null?void 0:r.signal),this.connected)throw new Bw;const a=qi(i==null?void 0:i.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=a,a.signal.aborted)throw new Mt("Connection was aborted");return(o=this.provider)===null||o===void 0||o.closeConnection(),this.provider=this.createProvider(t),a.signal.addEventListener("abort",()=>{var s;(s=this.provider)===null||s===void 0||s.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(i==null?void 0:i.request),{openingDeadlineMS:i==null?void 0:i.openingDeadlineMS,signal:a.signal})}restoreConnection(t){var r,n;return pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const o=qi(t==null?void 0:t.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=o,o.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[i,a]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(o.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let s=null;try{switch(i){case"http":s=yield dd.fromStorage(this.dappSettings.storage);break;case"injected":s=yield Yn.fromStorage(this.dappSettings.storage);break;default:if(a)s=this.createProvider(a);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),s==null||s.closeConnection(),s=null;return}if(o.signal.aborted){s==null||s.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!s){yo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=s,s.listen(this.walletEventsListener.bind(this));const l=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),s==null||s.closeConnection(),s=null};return o.signal.addEventListener("abort",l),yield Tf(u=>pt(this,void 0,void 0,function*(){yield s==null?void 0:s.restoreConnection({openingDeadlineMS:t==null?void 0:t.openingDeadlineMS,signal:u.signal}),o.signal.removeEventListener("abort",l),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:t==null?void 0:t.signal})})}sendTransaction(t,r){return pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const o=qi(n==null?void 0:n.signal);if(o.signal.aborted)throw new Mt("Transaction sending was aborted");this.checkConnection(),MF(this.wallet.device.features,{requiredMessagesNumber:t.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,t);const{validUntil:i}=t,a=aF(t,["validUntil"]),s=t.from||this.account.address,l=t.network||this.account.chain,u=yield this.provider.sendRequest(qh.convertToRpcRequest(Object.assign(Object.assign({},a),{valid_until:i,from:s,network:l})),{onRequestSent:n.onRequestSent,signal:o.signal});if(qh.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,t,u.error.message,u.error.code),qh.parseAndThrowError(u);const c=qh.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,t,c),c})}disconnect(t){var r;return pt(this,void 0,void 0,function*(){if(!this.connected)throw new up;const n=qi(t==null?void 0:t.signal),o=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Mt("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),o==null||o.abort()})}pauseConnection(){var t;((t=this.provider)===null||t===void 0?void 0:t.type)==="http"&&this.provider.pause()}unPauseConnection(){var t;return((t=this.provider)===null||t===void 0?void 0:t.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const t=wF();if(t)try{t.addEventListener("visibilitychange",()=>{t.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){yo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(t){let r;return!Array.isArray(t)&&sF(t)?r=new Yn(this.dappSettings.storage,t.jsBridgeKey):r=new dd(this.dappSettings.storage,t),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(t){switch(t.event){case"connect":this.onWalletConnected(t.payload);break;case"connect_error":this.onWalletConnectError(t.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(t){const r=t.items.find(i=>i.name==="ton_addr"),n=t.items.find(i=>i.name==="ton_proof");if(!r)throw new Mt("ton_addr connection item was not found");const o={device:t.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(o.connectItems={tonProof:n}),this.wallet=o,this.tracker.trackConnectionCompleted(o)}onWalletConnectError(t){const r=uF.parseError(t);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Kr(r),this.tracker.trackConnectionError(t.message,t.code),r instanceof M1||r instanceof A1)throw yo(r),r}onWalletDisconnected(t){this.tracker.trackDisconnection(this.wallet,t),this.wallet=null}checkConnection(){if(!this.connected)throw new up}createConnectRequest(t){const r=[{name:"ton_addr"}];return t!=null&&t.tonProof&&r.push({name:"ton_proof",payload:t.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}tl.walletsList=new Qb;tl.isWalletInjected=e=>Yn.isWalletInjected(e);tl.isInsideWalletBrowser=e=>Yn.isInsideWalletBrowser(e);const BF=81,PF=128;function Lw(e,t=!1){const{wc:r,hex:n}=RF(e);let o=BF;t&&(o|=PF);const i=new Int8Array(34);i[0]=o,i[1]=r,i.set(n,2);const a=new Uint8Array(36);return a.set(i),a.set(OF(i),34),Iw.encode(a).replace(/\+/g,"-").replace(/\//g,"_")}function RF(e){if(!e.includes(":"))throw new lu(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(t.length!==2)throw new lu(`Wrong address ${e}. Address must include ":" only once.`);const r=parseInt(t[0]);if(r!==0&&r!==-1)throw new lu(`Wrong address ${e}. WC must be eq 0 or -1, but ${r} received.`);const n=t[1];if((n==null?void 0:n.length)!==64)throw new lu(`Wrong address ${e}. Hex part must be 64bytes length, but ${n==null?void 0:n.length} received.`);return{wc:r,hex:NF(n)}}function OF(e){let r=0;const n=new Uint8Array(e.length+2);n.set(e);for(let o of n){let i=128;for(;i>0;)r<<=1,o&i&&(r+=1),i>>=1,r>65535&&(r&=65535,r^=4129)}return new Uint8Array([Math.floor(r/256),r%256])}const Xb={};for(let e=0;e<=255;e++){let t=e.toString(16);t.length<2&&(t="0"+t),Xb[t]=e}function NF(e){e=e.toLowerCase();const t=e.length;if(t%2!==0)throw new cp("Hex string must have length a multiple of 2: "+e);const r=t/2,n=new Uint8Array(r);for(let o=0;o0?Ie.length===2?typeof Ie[1]==s?this[Ie[0]]=Ie[1].call(this,Te):this[Ie[0]]=Ie[1]:Ie.length===3?typeof Ie[1]===s&&!(Ie[1].exec&&Ie[1].test)?this[Ie[0]]=Te?Ie[1].call(this,Te,Ie[2]):n:this[Ie[0]]=Te?Te.replace(Ie[1],Ie[2]):n:Ie.length===4&&(this[Ie[0]]=Te?Ie[3].call(this,Te.replace(Ie[1],Ie[2])):n):this[Ie]=Te||n;re+=2}},D=function(le,Y){for(var re in Y)if(typeof Y[re]===u&&Y[re].length>0){for(var ge=0;ge2&&(ke[d]="iPad",ke[v]=P),ke},this.getEngine=function(){var ke={};return ke[p]=n,ke[S]=n,N.call(ke,ge,ce.engine),ke},this.getOS=function(){var ke={};return ke[p]=n,ke[S]=n,N.call(ke,ge,ce.os),Ie&&!ke[p]&&be&&be.platform&&be.platform!="Unknown"&&(ke[p]=be.platform.replace(/chrome os/i,se).replace(/macos/i,pe)),ke},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ge},this.setUA=function(ke){return ge=typeof ke===c&&ke.length>K?Q(ke,K):ke,this},this.setUA(ge),this};Pe.VERSION=o,Pe.BROWSER=q([p,S,h]),Pe.CPU=q([x]),Pe.DEVICE=q([d,b,v,k,M,L,P,j,V]),Pe.ENGINE=Pe.OS=q([p,S]),e.exports&&(t=e.exports=Pe),t.UAParser=Pe;var Fe=typeof r!==l&&(r.jQuery||r.Zepto);if(Fe&&!Fe.ua){var Re=new Pe;Fe.ua=Re.getResult(),Fe.ua.get=function(){return Re.getUA()},Fe.ua.set=function(le){Re.setUA(le);var Y=Re.getResult();for(var re in Y)Fe.ua[re]=Y[re]}}})(typeof window=="object"?window:Ke)})(LF,dp);const DF=dp;var UF=function(t){return jF(t)&&!FF(t)};function jF(e){return!!e&&typeof e=="object"}function FF(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||qF(e)}var zF=typeof Symbol=="function"&&Symbol.for,$F=zF?Symbol.for("react.element"):60103;function qF(e){return e.$$typeof===$F}function WF(e){return Array.isArray(e)?[]:{}}function hd(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Lu(WF(e),e,t):e}function VF(e,t,r){return e.concat(t).map(function(n){return hd(n,r)})}function HF(e,t){if(!t.customMerge)return Lu;var r=t.customMerge(e);return typeof r=="function"?r:Lu}function KF(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function e7(e){return Object.keys(e).concat(KF(e))}function FM(e,t){try{return t in e}catch{return!1}}function ZF(e,t){return FM(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function GF(e,t,r){var n={};return r.isMergeableObject(e)&&e7(e).forEach(function(o){n[o]=hd(e[o],r)}),e7(t).forEach(function(o){ZF(e,o)||(FM(e,o)&&r.isMergeableObject(t[o])?n[o]=HF(o,r)(e[o],t[o],r):n[o]=hd(t[o],r))}),n}function Lu(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||VF,r.isMergeableObject=r.isMergeableObject||UF,r.cloneUnlessOtherwiseSpecified=hd;var n=Array.isArray(t),o=Array.isArray(e),i=n===o;return i?n?r.arrayMerge(e,t,r):GF(e,t,r):hd(t,r)}Lu.all=function(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,o){return Lu(n,o,r)},{})};var YF=Lu,QF=YF,Jb={},XF={get exports(){return Jb},set exports(e){Jb=e}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var i="",a=0;at in e?tz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ur=(e,t)=>{for(var r in t||(t={}))iz.call(t,r)&&t4(e,r,t[r]);if(e7)for(var r of e7(t))oz.call(t,r)&&t4(e,r,t[r]);return e},ui=(e,t)=>rz(e,nz(t)),Bt=(e,t,r)=>(t4(e,typeof t!="symbol"?t+"":t,r),r),ar=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{s(r.next(l))}catch(u){o(u)}},a=l=>{try{s(r.throw(l))}catch(u){o(u)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,a);s((r=r.apply(e,t)).next())}),t7,r7,n7,i7,o7,a7,s7,l7;const Ar={};function az(e){Ar.context=e}const sz=(e,t)=>e===t,eo=Symbol("solid-proxy"),r4=Symbol("solid-track"),hp={equals:sz};let FM=HM;const ca=1,pp=2,zM={owned:null,cleanups:null,context:null,owner:null},u2={};var Gr=null;let Hs=null,Mr=null,Mn=null,Zo=null,Uw=0;function Pf(e,t){const r=Mr,n=Gr,o=e.length===0,i=o?zM:{owned:null,cleanups:null,context:null,owner:t===void 0?n:t},a=o?e:()=>e(()=>un(()=>D1(i)));Gr=i,Mr=null;try{return ts(a,!0)}finally{Mr=r,Gr=n}}function Rt(e,t){t=t?Object.assign({},hp,t):hp;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=o=>(typeof o=="function"&&(o=o(r.value)),VM(r,o));return[WM.bind(r),n]}function gp(e,t,r){const n=L1(e,t,!0,ca);oc(n)}function Vt(e,t,r){const n=L1(e,t,!1,ca);oc(n)}function ln(e,t,r){FM=gz;const n=L1(e,t,!1,ca);n.user=!0,Zo?Zo.push(n):oc(n)}function ft(e,t,r){r=r?Object.assign({},hp,r):hp;const n=L1(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,oc(n),WM.bind(n)}function lz(e,t,r){let n,o,i;arguments.length===2&&typeof t=="object"||arguments.length===1?(n=!0,o=e,i=t||{}):(n=e,o=t,i=r||{});let a=null,s=u2,l=null,u=!1,c="initialValue"in i,h=typeof n=="function"&&ft(n);const d=new Set,[p,v]=(i.storage||Rt)(i.initialValue),[b,S]=Rt(void 0),[x,k]=Rt(void 0,{equals:!1}),[M,P]=Rt(c?"ready":"unresolved");if(Ar.context){l=`${Ar.context.id}${Ar.context.count++}`;let Z;i.ssrLoadFrom==="initial"?s=i.initialValue:Ar.load&&(Z=Ar.load(l))&&(s=Z[0])}function L(Z,ue,U,_){return a===Z&&(a=null,c=!0,(Z===s||ue===s)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(_,{value:ue})),s=u2,j(ue,U)),ue}function j(Z,ue){ts(()=>{ue===void 0&&v(()=>Z),P(ue!==void 0?"errored":"ready"),S(ue);for(const U of d.keys())U.decrement();d.clear()},!1)}function V(){const Z=dz,ue=p(),U=b();if(U!==void 0&&!a)throw U;return Mr&&!Mr.user&&Z&&gp(()=>{x(),a&&(Z.resolved||d.has(Z)||(Z.increment(),d.add(Z)))}),ue}function K(Z=!0){if(Z!==!1&&u)return;u=!1;const ue=h?h():n;if(ue==null||ue===!1){L(a,un(p));return}const U=s!==u2?s:un(()=>o(ue,{value:p(),refetching:Z}));return typeof U!="object"||!(U&&"then"in U)?(L(a,U,void 0,ue),U):(a=U,u=!0,queueMicrotask(()=>u=!1),ts(()=>{P(c?"refreshing":"pending"),k()},!1),U.then(_=>L(U,_,void 0,ue),_=>L(U,void 0,ZM(_),ue)))}return Object.defineProperties(V,{state:{get:()=>M()},error:{get:()=>b()},loading:{get(){const Z=M();return Z==="pending"||Z==="refreshing"}},latest:{get(){if(!c)return V();const Z=b();if(Z&&!a)throw Z;return p()}}}),h?gp(()=>K(!1)):K(!1),[V,{refetch:K,mutate:v}]}function $M(e){return ts(e,!1)}function un(e){if(Mr===null)return e();const t=Mr;Mr=null;try{return e()}finally{Mr=t}}function uz(e,t,r){const n=Array.isArray(e);let o,i=r&&r.defer;return a=>{let s;if(n){s=Array(e.length);for(let u=0;ut(s,o,a));return o=s,l}}function cz(e){ln(()=>un(e))}function zn(e){return Gr===null||(Gr.cleanups===null?Gr.cleanups=[e]:Gr.cleanups.push(e)),e}function qM(){return Mr}function fz(){return Gr}function O1(e,t){const r=Symbol("context");return{id:r,Provider:mz(r),defaultValue:e}}function $n(e){let t;return(t=YM(Gr,e.id))!==void 0?t:e.defaultValue}function N1(e){const t=ft(e),r=ft(()=>n4(t()));return r.toArray=()=>{const n=r();return Array.isArray(n)?n:n!=null?[n]:[]},r}let dz;function WM(){const e=Hs;if(this.sources&&(this.state||e))if(this.state===ca||e)oc(this);else{const t=Mn;Mn=null,ts(()=>vp(this),!1),Mn=t}if(Mr){const t=this.observers?this.observers.length:0;Mr.sources?(Mr.sources.push(this),Mr.sourceSlots.push(t)):(Mr.sources=[this],Mr.sourceSlots=[t]),this.observers?(this.observers.push(Mr),this.observerSlots.push(Mr.sources.length-1)):(this.observers=[Mr],this.observerSlots=[Mr.sources.length-1])}return this.value}function VM(e,t,r){let n=e.value;return(!e.comparator||!e.comparator(n,t))&&(e.value=t,e.observers&&e.observers.length&&ts(()=>{for(let o=0;o1e6)throw Mn=[],new Error},!1)),t}function oc(e){if(!e.fn)return;D1(e);const t=Gr,r=Mr,n=Uw;Mr=Gr=e,hz(e,e.value,n),Mr=r,Gr=t}function hz(e,t,r){let n;try{n=e.fn(t)}catch(o){e.pure&&(e.state=ca,e.owned&&e.owned.forEach(D1),e.owned=null),GM(o)}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?VM(e,n):e.value=n,e.updatedAt=r)}function L1(e,t,r,n=ca,o){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Gr,context:null,pure:r};return Gr===null||Gr!==zM&&(Gr.owned?Gr.owned.push(i):Gr.owned=[i]),i}function mp(e){const t=Hs;if(e.state===0||t)return;if(e.state===pp||t)return vp(e);if(e.suspense&&un(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;n--)if(e=r[n],e.state===ca||t)oc(e);else if(e.state===pp||t){const o=Mn;Mn=null,ts(()=>vp(e,r[0]),!1),Mn=o}}function ts(e,t){if(Mn)return e();let r=!1;t||(Mn=[]),Zo?r=!0:Zo=[],Uw++;try{const n=e();return pz(r),n}catch(n){r||(Zo=null),Mn=null,GM(n)}}function pz(e){if(Mn&&(HM(Mn),Mn=null),e)return;const t=Zo;Zo=null,t.length&&ts(()=>FM(t),!1)}function HM(e){for(let t=0;to=un(()=>(Gr.context={[e]:n.value},N1(()=>n.children))),void 0),o}}const vz=Symbol("fallback");function u7(e){for(let t=0;t1?[]:null;return zn(()=>u7(i)),()=>{let l=e()||[],u,c;return l[r4],un(()=>{let d=l.length,p,v,b,S,x,k,M,P,L;if(d===0)a!==0&&(u7(i),i=[],n=[],o=[],a=0,s&&(s=[])),r.fallback&&(n=[vz],o[0]=Pf(j=>(i[0]=j,r.fallback())),a=1);else if(a===0){for(o=new Array(d),c=0;c=k&&P>=k&&n[M]===l[P];M--,P--)b[P]=o[M],S[P]=i[M],s&&(x[P]=s[M]);for(p=new Map,v=new Array(P+1),c=P;c>=k;c--)L=l[c],u=p.get(L),v[c]=u===void 0?-1:u,p.set(L,c);for(u=k;u<=M;u++)L=n[u],c=p.get(L),c!==void 0&&c!==-1?(b[c]=o[u],S[c]=i[u],s&&(x[c]=s[u]),c=v[c],p.set(L,c)):i[u]();for(c=k;ce(t||{}))}function Wh(){return!0}const i4={get(e,t,r){return t===eo?r:e.get(t)},has(e,t){return t===eo?!0:e.has(t)},set:Wh,deleteProperty:Wh,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Wh,deleteProperty:Wh}},ownKeys(e){return e.keys()}};function c2(e){return(e=typeof e=="function"?e():e)?e:{}}function bo(...e){let t=!1;for(let n=0;n=0;o--){const i=c2(e[o])[n];if(i!==void 0)return i}},has(n){for(let o=e.length-1;o>=0;o--)if(n in c2(e[o]))return!0;return!1},keys(){const n=[];for(let o=0;o=0;n--)if(e[n]){const o=Object.getOwnPropertyDescriptors(e[n]);for(const i in o)i in r||Object.defineProperty(r,i,{enumerable:!0,get(){for(let a=e.length-1;a>=0;a--){const s=(e[a]||{})[i];if(s!==void 0)return s}}})}return r}function jw(e,...t){const r=new Set(t.flat());if(eo in e){const o=t.map(i=>new Proxy({get(a){return i.includes(a)?e[a]:void 0},has(a){return i.includes(a)&&a in e},keys(){return i.filter(a=>a in e)}},i4));return o.push(new Proxy({get(i){return r.has(i)?void 0:e[i]},has(i){return r.has(i)?!1:i in e},keys(){return Object.keys(e).filter(i=>!r.has(i))}},i4)),o}const n=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(n).filter(o=>!r.has(o))),t.map(o=>{const i={};for(let a=0;ae.fallback};return ft(yz(()=>e.each,e.children,t||void 0))}function Dt(e){let t=!1;const r=e.keyed,n=ft(()=>e.when,void 0,{equals:(o,i)=>t?o===i:!o==!i});return ft(()=>{const o=n();if(o){const i=e.children,a=typeof i=="function"&&i.length>0;return t=r||a,a?un(()=>i(o)):i}return e.fallback},void 0,void 0)}function Hd(e){let t=!1,r=!1;const n=(a,s)=>a[0]===s[0]&&(t?a[1]===s[1]:!a[1]==!s[1])&&a[2]===s[2],o=N1(()=>e.children),i=ft(()=>{let a=o();Array.isArray(a)||(a=[a]);for(let s=0;s{const[a,s,l]=i();if(a<0)return e.fallback;const u=l.children,c=typeof u=="function"&&u.length>0;return t=r||c,c?un(()=>u(s)):u},void 0,void 0)}function pn(e){return e}const bz=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],wz=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...bz]),_z=new Set(["innerHTML","textContent","innerText","children"]),xz=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),c7=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),Sz=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Cz=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Ez={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function kz(e,t,r){let n=r.length,o=t.length,i=n,a=0,s=0,l=t[o-1].nextSibling,u=null;for(;ac-s){const v=t[a];for(;s{o=i,t===document?e():An(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{o(),t.textContent=""}}function Zt(e,t,r){if(typeof window>"u")return null;const n=document.createElement("template");n.innerHTML=e;let o=n.content.firstChild;return r&&(o=o.firstChild),o}function Mz(e,t=window.document){const r=t[f7]||(t[f7]=new Set);for(let n=0,o=e.length;no.call(e,r[1],i))}else e.addEventListener(t,r)}function Bz(e,t,r={}){const n=Object.keys(t||{}),o=Object.keys(r);let i,a;for(i=0,a=o.length;io.children=Du(e,t.children,o.children)),Vt(()=>t.ref&&t.ref(e)),Vt(()=>Rz(e,t,r,!0,o,!0)),o}function Rf(e,t,r){return un(()=>e(t,r))}function An(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return Du(e,t,n,r);Vt(o=>Du(e,t(),o,r),n)}function Rz(e,t,r,n,o={},i=!1){t||(t={});for(const a in o)if(!(a in t)){if(a==="children")continue;o[a]=h7(e,a,null,o[a],r,i)}for(const a in t){if(a==="children"){n||Du(e,t.children);continue}const s=t[a];o[a]=h7(e,a,s,o[a],r,i)}}function Oz(e){let t,r;return!Ar.context||!(t=Ar.registry.get(r=Dz()))?e.cloneNode(!0):(Ar.completed&&Ar.completed.add(t),Ar.registry.delete(r),t)}function Nz(e){return e.toLowerCase().replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function d7(e,t,r){const n=t.trim().split(/\s+/);for(let o=0,i=n.length;o-1&&Ez[t.split(":")[0]];u?Iz(e,u,t,r):Et(e,xz[t]||t,r)}return r}function Lz(e){const t=`$$${e.type}`;let r=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==r&&Object.defineProperty(e,"target",{configurable:!0,value:r}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return r||document}}),Ar.registry&&!Ar.done&&(Ar.done=!0,document.querySelectorAll("[id^=pl-]").forEach(n=>{for(;n&&n.nodeType!==8&&n.nodeValue!=="pl-"+e;){let o=n.nextSibling;n.remove(),n=o}n&&n.remove()}));r;){const n=r[t];if(n&&!r.disabled){const o=r[`${t}Data`];if(o!==void 0?n.call(r,o,e):n.call(r,e),e.cancelBubble)return}r=r._$host||r.parentNode||r.host}}function Du(e,t,r,n,o){for(Ar.context&&!r&&(r=[...e.childNodes]);typeof r=="function";)r=r();if(t===r)return r;const i=typeof t,a=n!==void 0;if(e=a&&r[0]&&r[0].parentNode||e,i==="string"||i==="number"){if(Ar.context)return r;if(i==="number"&&(t=t.toString()),a){let s=r[0];s&&s.nodeType===3?s.data=t:s=document.createTextNode(t),r=Vl(e,r,n,s)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||i==="boolean"){if(Ar.context)return r;r=Vl(e,r,n)}else{if(i==="function")return Vt(()=>{let s=t();for(;typeof s=="function";)s=s();r=Du(e,s,r,n)}),()=>r;if(Array.isArray(t)){const s=[],l=r&&Array.isArray(r);if(o4(s,t,r,o))return Vt(()=>r=Du(e,s,r,n,!0)),()=>r;if(Ar.context){if(!s.length)return r;for(let u=0;u=0;a--){const s=t[a];if(o!==s){const l=s.parentNode===e;!i&&!a?l?e.replaceChild(o,s):e.insertBefore(o,r):l&&s.remove()}else i=!0}}else e.insertBefore(o,r);return[o]}function Dz(){const e=Ar.context;return`${e.id}${e.count++}`}const Uz="http://www.w3.org/2000/svg";function XM(e,t=!1){return t?document.createElementNS(Uz,e):document.createElement(e)}function JM(e){const{useShadow:t}=e,r=document.createTextNode(""),n=e.mount||document.body;function o(){if(Ar.context){const[i,a]=Rt(!1);return queueMicrotask(()=>a(!0)),()=>i()&&e.children}else return()=>e.children}if(n instanceof HTMLHeadElement){const[i,a]=Rt(!1),s=()=>a(!0);Pf(l=>An(n,()=>i()?l():o()(),null)),zn(()=>{Ar.context?queueMicrotask(s):s()})}else{const i=XM(e.isSVG?"g":"div",e.isSVG),a=t&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get(){return r.parentNode},configurable:!0}),An(a,o()),n.appendChild(i),e.ref&&e.ref(i),zn(()=>n.removeChild(i))}return r}function Uu(e){const[t,r]=jw(e,["component"]),n=ft(()=>t.component);return ft(()=>{const o=n();switch(typeof o){case"function":return un(()=>o(r));case"string":const i=Cz.has(o),a=Ar.context?Oz():XM(o,i);return QM(a,r,i),a}})}var Tr=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(Tr||{});let jz={data:""},Fz=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||jz,zz=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,$z=/\/\*[^]*?\*\/| +/g,g7=/\n+/g,Ps=(e,t)=>{let r="",n="",o="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+a+";":n+=i[1]=="f"?Ps(a,i):i+"{"+Ps(a,i[1]=="k"?"":t)+"}":typeof a=="object"?n+=Ps(a,t?t.replace(/([^,])+/g,s=>i.replace(/(^:.*)|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,s):s?s+" "+l:l)):i):a!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=Ps.p?Ps.p(i,a):i+":"+a+";")}return r+(t&&o?t+"{"+o+"}":o)+n},Oo={},eI=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+eI(e[r]);return t}return e},qz=(e,t,r,n,o)=>{let i=eI(e),a=Oo[i]||(Oo[i]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(i));if(!Oo[a]){let l=i!==e?e:(u=>{let c,h,d=[{}];for(;c=zz.exec(u.replace($z,""));)c[4]?d.shift():c[3]?(h=c[3].replace(g7," ").trim(),d.unshift(d[0][h]=d[0][h]||{})):d[0][c[1]]=c[2].replace(g7," ").trim();return d[0]})(e);Oo[a]=Ps(o?{["@keyframes "+a]:l}:l,r?"":"."+a)}let s=r&&Oo.g?Oo.g:null;return r&&(Oo.g=Oo[a]),((l,u,c,h)=>{h?u.data=u.data.replace(h,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(Oo[a],t,n,s),a},Wz=(e,t,r)=>e.reduce((n,o,i)=>{let a=t[i];if(a&&a.call){let s=a(r),l=s&&s.props&&s.props.className||/^go/.test(s)&&s;a=l?"."+l:s&&typeof s=="object"?s.props?"":Ps(s,""):s===!1?"":s}return n+o+(a??"")},"");function oa(e){let t=this||{},r=e.call?e(t.p):e;return qz(r.unshift?r.raw?Wz(r,[].slice.call(arguments,1),t.p):r.reduce((n,o)=>Object.assign(n,o&&o.call?o(t.p):o),{}):r,Fz(t.target),t.g,t.o,t.k)}oa.bind({g:1});let Vz=oa.bind({k:1});const zw=O1();function Hz(e){return ie(zw.Provider,{value:e.theme,get children(){return e.children}})}function gr(){return $n(zw)}function tI(e){let t=this||{};return(...r)=>{const n=o=>{const i=$n(zw),a=bo(o,{theme:i}),s=bo(a,{get class(){const p=a.class,v="class"in a&&/^go[0-9]+/.test(p);let b=oa.apply({target:t.target,o:v,p:a,g:t.g},r);return[p,b].filter(Boolean).join(" ")}}),[l,u]=jw(s,["as","theme"]),c=u,h=l.as||e;let d;return typeof h=="function"?d=h(c):t.g==1?(d=document.createElement(h),QM(d,c)):d=Uu(bo({component:h},c)),d};return n.class=o=>un(()=>oa.apply({target:t.target,p:o,g:t.g},r)),n}}const je=new Proxy(tI,{get(e,t){return e(t)}});function Kz(){const e=tI.call({g:1},"div").apply(null,arguments);return function(r){return e(r),null}}const jo="tc-root",$w="tc-disable-scroll",f2="tc-using-mouse",Zz=()=>{document.body.addEventListener("mousedown",()=>document.body.classList.add(f2)),document.body.addEventListener("keydown",t=>{t.key==="Tab"&&document.body.classList.remove(f2)});const e=Kz` +*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var i="",a=0;at in e?JF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ur=(e,t)=>{for(var r in t||(t={}))rz.call(t,r)&&e4(e,r,t[r]);if(t7)for(var r of t7(t))nz.call(t,r)&&e4(e,r,t[r]);return e},ui=(e,t)=>ez(e,tz(t)),Bt=(e,t,r)=>(e4(e,typeof t!="symbol"?t+"":t,r),r),ar=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{s(r.next(l))}catch(u){o(u)}},a=l=>{try{s(r.throw(l))}catch(u){o(u)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,a);s((r=r.apply(e,t)).next())}),r7,n7,i7,o7,a7,s7,l7,u7;const Ar={};function iz(e){Ar.context=e}const oz=(e,t)=>e===t,eo=Symbol("solid-proxy"),t4=Symbol("solid-track"),hp={equals:oz};let zM=KM;const ca=1,pp=2,$M={owned:null,cleanups:null,context:null,owner:null},u2={};var Gr=null;let Hs=null,Mr=null,Mn=null,Zo=null,Dw=0;function Pf(e,t){const r=Mr,n=Gr,o=e.length===0,i=o?$M:{owned:null,cleanups:null,context:null,owner:t===void 0?n:t},a=o?e:()=>e(()=>un(()=>D1(i)));Gr=i,Mr=null;try{return ts(a,!0)}finally{Mr=r,Gr=n}}function Rt(e,t){t=t?Object.assign({},hp,t):hp;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=o=>(typeof o=="function"&&(o=o(r.value)),HM(r,o));return[VM.bind(r),n]}function gp(e,t,r){const n=L1(e,t,!0,ca);oc(n)}function Vt(e,t,r){const n=L1(e,t,!1,ca);oc(n)}function ln(e,t,r){zM=hz;const n=L1(e,t,!1,ca);n.user=!0,Zo?Zo.push(n):oc(n)}function ft(e,t,r){r=r?Object.assign({},hp,r):hp;const n=L1(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,oc(n),VM.bind(n)}function az(e,t,r){let n,o,i;arguments.length===2&&typeof t=="object"||arguments.length===1?(n=!0,o=e,i=t||{}):(n=e,o=t,i=r||{});let a=null,s=u2,l=null,u=!1,c="initialValue"in i,h=typeof n=="function"&&ft(n);const d=new Set,[p,v]=(i.storage||Rt)(i.initialValue),[b,S]=Rt(void 0),[x,k]=Rt(void 0,{equals:!1}),[M,P]=Rt(c?"ready":"unresolved");if(Ar.context){l=`${Ar.context.id}${Ar.context.count++}`;let Z;i.ssrLoadFrom==="initial"?s=i.initialValue:Ar.load&&(Z=Ar.load(l))&&(s=Z[0])}function L(Z,ue,U,_){return a===Z&&(a=null,c=!0,(Z===s||ue===s)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(_,{value:ue})),s=u2,j(ue,U)),ue}function j(Z,ue){ts(()=>{ue===void 0&&v(()=>Z),P(ue!==void 0?"errored":"ready"),S(ue);for(const U of d.keys())U.decrement();d.clear()},!1)}function V(){const Z=cz,ue=p(),U=b();if(U!==void 0&&!a)throw U;return Mr&&!Mr.user&&Z&&gp(()=>{x(),a&&(Z.resolved||d.has(Z)||(Z.increment(),d.add(Z)))}),ue}function K(Z=!0){if(Z!==!1&&u)return;u=!1;const ue=h?h():n;if(ue==null||ue===!1){L(a,un(p));return}const U=s!==u2?s:un(()=>o(ue,{value:p(),refetching:Z}));return typeof U!="object"||!(U&&"then"in U)?(L(a,U,void 0,ue),U):(a=U,u=!0,queueMicrotask(()=>u=!1),ts(()=>{P(c?"refreshing":"pending"),k()},!1),U.then(_=>L(U,_,void 0,ue),_=>L(U,void 0,GM(_),ue)))}return Object.defineProperties(V,{state:{get:()=>M()},error:{get:()=>b()},loading:{get(){const Z=M();return Z==="pending"||Z==="refreshing"}},latest:{get(){if(!c)return V();const Z=b();if(Z&&!a)throw Z;return p()}}}),h?gp(()=>K(!1)):K(!1),[V,{refetch:K,mutate:v}]}function qM(e){return ts(e,!1)}function un(e){if(Mr===null)return e();const t=Mr;Mr=null;try{return e()}finally{Mr=t}}function sz(e,t,r){const n=Array.isArray(e);let o,i=r&&r.defer;return a=>{let s;if(n){s=Array(e.length);for(let u=0;ut(s,o,a));return o=s,l}}function lz(e){ln(()=>un(e))}function zn(e){return Gr===null||(Gr.cleanups===null?Gr.cleanups=[e]:Gr.cleanups.push(e)),e}function WM(){return Mr}function uz(){return Gr}function O1(e,t){const r=Symbol("context");return{id:r,Provider:pz(r),defaultValue:e}}function $n(e){let t;return(t=QM(Gr,e.id))!==void 0?t:e.defaultValue}function N1(e){const t=ft(e),r=ft(()=>r4(t()));return r.toArray=()=>{const n=r();return Array.isArray(n)?n:n!=null?[n]:[]},r}let cz;function VM(){const e=Hs;if(this.sources&&(this.state||e))if(this.state===ca||e)oc(this);else{const t=Mn;Mn=null,ts(()=>vp(this),!1),Mn=t}if(Mr){const t=this.observers?this.observers.length:0;Mr.sources?(Mr.sources.push(this),Mr.sourceSlots.push(t)):(Mr.sources=[this],Mr.sourceSlots=[t]),this.observers?(this.observers.push(Mr),this.observerSlots.push(Mr.sources.length-1)):(this.observers=[Mr],this.observerSlots=[Mr.sources.length-1])}return this.value}function HM(e,t,r){let n=e.value;return(!e.comparator||!e.comparator(n,t))&&(e.value=t,e.observers&&e.observers.length&&ts(()=>{for(let o=0;o1e6)throw Mn=[],new Error},!1)),t}function oc(e){if(!e.fn)return;D1(e);const t=Gr,r=Mr,n=Dw;Mr=Gr=e,fz(e,e.value,n),Mr=r,Gr=t}function fz(e,t,r){let n;try{n=e.fn(t)}catch(o){e.pure&&(e.state=ca,e.owned&&e.owned.forEach(D1),e.owned=null),YM(o)}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?HM(e,n):e.value=n,e.updatedAt=r)}function L1(e,t,r,n=ca,o){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Gr,context:null,pure:r};return Gr===null||Gr!==$M&&(Gr.owned?Gr.owned.push(i):Gr.owned=[i]),i}function mp(e){const t=Hs;if(e.state===0||t)return;if(e.state===pp||t)return vp(e);if(e.suspense&&un(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;n--)if(e=r[n],e.state===ca||t)oc(e);else if(e.state===pp||t){const o=Mn;Mn=null,ts(()=>vp(e,r[0]),!1),Mn=o}}function ts(e,t){if(Mn)return e();let r=!1;t||(Mn=[]),Zo?r=!0:Zo=[],Dw++;try{const n=e();return dz(r),n}catch(n){r||(Zo=null),Mn=null,YM(n)}}function dz(e){if(Mn&&(KM(Mn),Mn=null),e)return;const t=Zo;Zo=null,t.length&&ts(()=>zM(t),!1)}function KM(e){for(let t=0;to=un(()=>(Gr.context={[e]:n.value},N1(()=>n.children))),void 0),o}}const gz=Symbol("fallback");function c7(e){for(let t=0;t1?[]:null;return zn(()=>c7(i)),()=>{let l=e()||[],u,c;return l[t4],un(()=>{let d=l.length,p,v,b,S,x,k,M,P,L;if(d===0)a!==0&&(c7(i),i=[],n=[],o=[],a=0,s&&(s=[])),r.fallback&&(n=[gz],o[0]=Pf(j=>(i[0]=j,r.fallback())),a=1);else if(a===0){for(o=new Array(d),c=0;c=k&&P>=k&&n[M]===l[P];M--,P--)b[P]=o[M],S[P]=i[M],s&&(x[P]=s[M]);for(p=new Map,v=new Array(P+1),c=P;c>=k;c--)L=l[c],u=p.get(L),v[c]=u===void 0?-1:u,p.set(L,c);for(u=k;u<=M;u++)L=n[u],c=p.get(L),c!==void 0&&c!==-1?(b[c]=o[u],S[c]=i[u],s&&(x[c]=s[u]),c=v[c],p.set(L,c)):i[u]();for(c=k;ce(t||{}))}function Wh(){return!0}const n4={get(e,t,r){return t===eo?r:e.get(t)},has(e,t){return t===eo?!0:e.has(t)},set:Wh,deleteProperty:Wh,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Wh,deleteProperty:Wh}},ownKeys(e){return e.keys()}};function c2(e){return(e=typeof e=="function"?e():e)?e:{}}function bo(...e){let t=!1;for(let n=0;n=0;o--){const i=c2(e[o])[n];if(i!==void 0)return i}},has(n){for(let o=e.length-1;o>=0;o--)if(n in c2(e[o]))return!0;return!1},keys(){const n=[];for(let o=0;o=0;n--)if(e[n]){const o=Object.getOwnPropertyDescriptors(e[n]);for(const i in o)i in r||Object.defineProperty(r,i,{enumerable:!0,get(){for(let a=e.length-1;a>=0;a--){const s=(e[a]||{})[i];if(s!==void 0)return s}}})}return r}function Uw(e,...t){const r=new Set(t.flat());if(eo in e){const o=t.map(i=>new Proxy({get(a){return i.includes(a)?e[a]:void 0},has(a){return i.includes(a)&&a in e},keys(){return i.filter(a=>a in e)}},n4));return o.push(new Proxy({get(i){return r.has(i)?void 0:e[i]},has(i){return r.has(i)?!1:i in e},keys(){return Object.keys(e).filter(i=>!r.has(i))}},n4)),o}const n=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(n).filter(o=>!r.has(o))),t.map(o=>{const i={};for(let a=0;ae.fallback};return ft(mz(()=>e.each,e.children,t||void 0))}function Dt(e){let t=!1;const r=e.keyed,n=ft(()=>e.when,void 0,{equals:(o,i)=>t?o===i:!o==!i});return ft(()=>{const o=n();if(o){const i=e.children,a=typeof i=="function"&&i.length>0;return t=r||a,a?un(()=>i(o)):i}return e.fallback},void 0,void 0)}function Hd(e){let t=!1,r=!1;const n=(a,s)=>a[0]===s[0]&&(t?a[1]===s[1]:!a[1]==!s[1])&&a[2]===s[2],o=N1(()=>e.children),i=ft(()=>{let a=o();Array.isArray(a)||(a=[a]);for(let s=0;s{const[a,s,l]=i();if(a<0)return e.fallback;const u=l.children,c=typeof u=="function"&&u.length>0;return t=r||c,c?un(()=>u(s)):u},void 0,void 0)}function pn(e){return e}const vz=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],yz=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...vz]),bz=new Set(["innerHTML","textContent","innerText","children"]),wz=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),f7=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),_z=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),xz=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Sz={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Cz(e,t,r){let n=r.length,o=t.length,i=n,a=0,s=0,l=t[o-1].nextSibling,u=null;for(;ac-s){const v=t[a];for(;s{o=i,t===document?e():An(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{o(),t.textContent=""}}function Zt(e,t,r){if(typeof window>"u")return null;const n=document.createElement("template");n.innerHTML=e;let o=n.content.firstChild;return r&&(o=o.firstChild),o}function kz(e,t=window.document){const r=t[d7]||(t[d7]=new Set);for(let n=0,o=e.length;no.call(e,r[1],i))}else e.addEventListener(t,r)}function Iz(e,t,r={}){const n=Object.keys(t||{}),o=Object.keys(r);let i,a;for(i=0,a=o.length;io.children=Du(e,t.children,o.children)),Vt(()=>t.ref&&t.ref(e)),Vt(()=>Bz(e,t,r,!0,o,!0)),o}function Rf(e,t,r){return un(()=>e(t,r))}function An(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return Du(e,t,n,r);Vt(o=>Du(e,t(),o,r),n)}function Bz(e,t,r,n,o={},i=!1){t||(t={});for(const a in o)if(!(a in t)){if(a==="children")continue;o[a]=p7(e,a,null,o[a],r,i)}for(const a in t){if(a==="children"){n||Du(e,t.children);continue}const s=t[a];o[a]=p7(e,a,s,o[a],r,i)}}function Pz(e){let t,r;return!Ar.context||!(t=Ar.registry.get(r=Nz()))?e.cloneNode(!0):(Ar.completed&&Ar.completed.add(t),Ar.registry.delete(r),t)}function Rz(e){return e.toLowerCase().replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function h7(e,t,r){const n=t.trim().split(/\s+/);for(let o=0,i=n.length;o-1&&Sz[t.split(":")[0]];u?Az(e,u,t,r):Et(e,wz[t]||t,r)}return r}function Oz(e){const t=`$$${e.type}`;let r=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==r&&Object.defineProperty(e,"target",{configurable:!0,value:r}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return r||document}}),Ar.registry&&!Ar.done&&(Ar.done=!0,document.querySelectorAll("[id^=pl-]").forEach(n=>{for(;n&&n.nodeType!==8&&n.nodeValue!=="pl-"+e;){let o=n.nextSibling;n.remove(),n=o}n&&n.remove()}));r;){const n=r[t];if(n&&!r.disabled){const o=r[`${t}Data`];if(o!==void 0?n.call(r,o,e):n.call(r,e),e.cancelBubble)return}r=r._$host||r.parentNode||r.host}}function Du(e,t,r,n,o){for(Ar.context&&!r&&(r=[...e.childNodes]);typeof r=="function";)r=r();if(t===r)return r;const i=typeof t,a=n!==void 0;if(e=a&&r[0]&&r[0].parentNode||e,i==="string"||i==="number"){if(Ar.context)return r;if(i==="number"&&(t=t.toString()),a){let s=r[0];s&&s.nodeType===3?s.data=t:s=document.createTextNode(t),r=Vl(e,r,n,s)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||i==="boolean"){if(Ar.context)return r;r=Vl(e,r,n)}else{if(i==="function")return Vt(()=>{let s=t();for(;typeof s=="function";)s=s();r=Du(e,s,r,n)}),()=>r;if(Array.isArray(t)){const s=[],l=r&&Array.isArray(r);if(i4(s,t,r,o))return Vt(()=>r=Du(e,s,r,n,!0)),()=>r;if(Ar.context){if(!s.length)return r;for(let u=0;u=0;a--){const s=t[a];if(o!==s){const l=s.parentNode===e;!i&&!a?l?e.replaceChild(o,s):e.insertBefore(o,r):l&&s.remove()}else i=!0}}else e.insertBefore(o,r);return[o]}function Nz(){const e=Ar.context;return`${e.id}${e.count++}`}const Lz="http://www.w3.org/2000/svg";function JM(e,t=!1){return t?document.createElementNS(Lz,e):document.createElement(e)}function eI(e){const{useShadow:t}=e,r=document.createTextNode(""),n=e.mount||document.body;function o(){if(Ar.context){const[i,a]=Rt(!1);return queueMicrotask(()=>a(!0)),()=>i()&&e.children}else return()=>e.children}if(n instanceof HTMLHeadElement){const[i,a]=Rt(!1),s=()=>a(!0);Pf(l=>An(n,()=>i()?l():o()(),null)),zn(()=>{Ar.context?queueMicrotask(s):s()})}else{const i=JM(e.isSVG?"g":"div",e.isSVG),a=t&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get(){return r.parentNode},configurable:!0}),An(a,o()),n.appendChild(i),e.ref&&e.ref(i),zn(()=>n.removeChild(i))}return r}function Uu(e){const[t,r]=Uw(e,["component"]),n=ft(()=>t.component);return ft(()=>{const o=n();switch(typeof o){case"function":return un(()=>o(r));case"string":const i=xz.has(o),a=Ar.context?Pz():JM(o,i);return XM(a,r,i),a}})}var Tr=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(Tr||{});let Dz={data:""},Uz=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||Dz,jz=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Fz=/\/\*[^]*?\*\/| +/g,m7=/\n+/g,Ps=(e,t)=>{let r="",n="",o="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+a+";":n+=i[1]=="f"?Ps(a,i):i+"{"+Ps(a,i[1]=="k"?"":t)+"}":typeof a=="object"?n+=Ps(a,t?t.replace(/([^,])+/g,s=>i.replace(/(^:.*)|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,s):s?s+" "+l:l)):i):a!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=Ps.p?Ps.p(i,a):i+":"+a+";")}return r+(t&&o?t+"{"+o+"}":o)+n},Oo={},tI=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+tI(e[r]);return t}return e},zz=(e,t,r,n,o)=>{let i=tI(e),a=Oo[i]||(Oo[i]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(i));if(!Oo[a]){let l=i!==e?e:(u=>{let c,h,d=[{}];for(;c=jz.exec(u.replace(Fz,""));)c[4]?d.shift():c[3]?(h=c[3].replace(m7," ").trim(),d.unshift(d[0][h]=d[0][h]||{})):d[0][c[1]]=c[2].replace(m7," ").trim();return d[0]})(e);Oo[a]=Ps(o?{["@keyframes "+a]:l}:l,r?"":"."+a)}let s=r&&Oo.g?Oo.g:null;return r&&(Oo.g=Oo[a]),((l,u,c,h)=>{h?u.data=u.data.replace(h,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(Oo[a],t,n,s),a},$z=(e,t,r)=>e.reduce((n,o,i)=>{let a=t[i];if(a&&a.call){let s=a(r),l=s&&s.props&&s.props.className||/^go/.test(s)&&s;a=l?"."+l:s&&typeof s=="object"?s.props?"":Ps(s,""):s===!1?"":s}return n+o+(a??"")},"");function oa(e){let t=this||{},r=e.call?e(t.p):e;return zz(r.unshift?r.raw?$z(r,[].slice.call(arguments,1),t.p):r.reduce((n,o)=>Object.assign(n,o&&o.call?o(t.p):o),{}):r,Uz(t.target),t.g,t.o,t.k)}oa.bind({g:1});let qz=oa.bind({k:1});const Fw=O1();function Wz(e){return ie(Fw.Provider,{value:e.theme,get children(){return e.children}})}function gr(){return $n(Fw)}function rI(e){let t=this||{};return(...r)=>{const n=o=>{const i=$n(Fw),a=bo(o,{theme:i}),s=bo(a,{get class(){const p=a.class,v="class"in a&&/^go[0-9]+/.test(p);let b=oa.apply({target:t.target,o:v,p:a,g:t.g},r);return[p,b].filter(Boolean).join(" ")}}),[l,u]=Uw(s,["as","theme"]),c=u,h=l.as||e;let d;return typeof h=="function"?d=h(c):t.g==1?(d=document.createElement(h),XM(d,c)):d=Uu(bo({component:h},c)),d};return n.class=o=>un(()=>oa.apply({target:t.target,p:o,g:t.g},r)),n}}const je=new Proxy(rI,{get(e,t){return e(t)}});function Vz(){const e=rI.call({g:1},"div").apply(null,arguments);return function(r){return e(r),null}}const jo="tc-root",zw="tc-disable-scroll",f2="tc-using-mouse",Hz=()=>{document.body.addEventListener("mousedown",()=>document.body.classList.add(f2)),document.body.addEventListener("keydown",t=>{t.key==="Tab"&&document.body.classList.remove(f2)});const e=Vz` ${jo} * { margin: 0; padding: 0; @@ -106,7 +106,7 @@ PERFORMANCE OF THIS SOFTWARE. outline: none; } - body.${$w} { + body.${zw} { position: fixed; overflow-y: scroll; right: 0; @@ -116,14 +116,14 @@ PERFORMANCE OF THIS SOFTWARE. body.${f2} ${jo} *:focus { outline: none; } -`;return ie(e,{})};function Gz(e){e[0]==="#"&&(e=e.slice(1));const t=parseInt(e,16),r=t>>16&255,n=t>>8&255,o=t&255;return[r,n,o].join(",")}function Kd(e,t){return e[0]==="#"&&(e=Gz(e)),`rgba(${e}, ${t})`}function wo(e){return e.toString()+"px"}const uf=class{constructor(){Bt(this,"storage",{})}static getInstance(){return uf.instance||(uf.instance=new uf),uf.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var t;return(t=this.storage[e])!=null?t:null}key(e){var t;const r=Object.keys(this.storage);return e<0||e>=r.length?null:(t=r[e])!=null?t:null}removeItem(e){delete this.storage[e]}setItem(e,t){this.storage[e]=t}};let rI=uf;Bt(rI,"instance");class Fr extends Mt{constructor(...t){super(...t),Object.setPrototypeOf(this,Fr.prototype)}}function b0(...e){try{console.debug("[TON_CONNECT_UI]",...e)}catch{}}function Yz(...e){try{console.error("[TON_CONNECT_UI]",...e)}catch{}}function Qz(...e){try{console.warn("[TON_CONNECT_UI]",...e)}catch{}}function yp(e,t="_self"){b0("openLink",e,t),window.open(e,t,"noopener noreferrer")}function xr(e){yp(e,"_blank")}function Ta(e,t){const r=()=>{$t("safari")||ho("android")&&$t("firefox")||t()},n=setTimeout(()=>r(),200);window.addEventListener("blur",()=>clearTimeout(n),{once:!0}),yp(e,"_self")}function Xz(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?Tr.LIGHT:Tr.DARK}function Jz(e){const t=r=>e(r.matches?Tr.DARK:Tr.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}function e$(){document.documentElement.scrollHeight!==document.documentElement.clientHeight&&(document.body.style.top=wo(-document.documentElement.scrollTop),document.body.classList.add($w))}function t$(){document.body.classList.remove($w),document.documentElement.scrollTo({top:-parseFloat(getComputedStyle(document.body).top)}),document.body.style.top="auto"}function r$(){document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart","")}function n$(){customElements.define(jo,class extends HTMLElement{})}function nI(e){return ar(this,null,function*(){yield new Promise(t=>requestAnimationFrame(t)),e()})}function i$(e){return ar(this,null,function*(){return yield new Promise(t=>requestAnimationFrame(t)),e()})}function iI(e){document.readyState!=="complete"?window.addEventListener("load",()=>nI(()=>iI(e)),{once:!0}):e.forEach(t=>{const r=new window.Image;r.src=t})}function fa(){if(typeof window<"u")return window}function qw(){if(o$())return localStorage;if(a$())throw new Fr("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return rI.getInstance()}function o$(){try{return typeof localStorage<"u"}catch{return!1}}function a$(){return typeof _t<"u"&&_t.versions!=null&&_t.versions.node!=null}function Ww(){var e,t,r;const n=new jF().getResult(),o=(e=n.os.name)==null?void 0:e.toLowerCase(),i=(t=n.device.model)==null?void 0:t.toLowerCase();let a;switch(!0){case i==="ipad":a="ipad";break;case o==="ios":a="ios";break;case o==="android":a="android";break;case o==="mac os":a="macos";break;case o==="linux":a="linux";break;case(o==null?void 0:o.includes("windows")):a="windows";break}const s=(r=n.browser.name)==null?void 0:r.toLowerCase();let l;switch(!0){case s==="chrome":l="chrome";break;case s==="firefox":l="firefox";break;case(s==null?void 0:s.includes("safari")):l="safari";break;case(s==null?void 0:s.includes("opera")):l="opera";break}return{os:a,browser:l}}function ho(...e){return e.includes(Ww().os)}function $t(...e){return e.includes(Ww().browser)}function Vh(e,t){const r=new URL(e);return t+r.search}class s${constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_wallet-info"),this.localStorage=qw()}setWalletInfo(t){this.localStorage.setItem(this.storageKey,JSON.stringify(t))}getWalletInfo(){const t=this.localStorage.getItem(this.storageKey);return t?JSON.parse(t):null}removeWalletInfo(){this.localStorage.removeItem(this.storageKey)}}class l${constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_preferred-wallet"),this.localStorage=qw()}setPreferredWalletAppName(t){this.localStorage.setItem(this.storageKey,t)}getPreferredWalletAppName(){return this.localStorage.getItem(this.storageKey)||void 0}}class oI{constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_last-selected-wallet-info"),this.localStorage=qw()}setLastSelectedWalletInfo(t){this.localStorage.setItem(this.storageKey,JSON.stringify(t))}getLastSelectedWalletInfo(){const t=this.localStorage.getItem(this.storageKey);return t?JSON.parse(t):null}removeLastSelectedWalletInfo(){this.localStorage.removeItem(this.storageKey)}}const[a4,m7]=Rt({status:"closed",closeReason:null}),v7=ft(()=>a4().status==="opened"),[bp,y7]=Rt({status:"closed",closeReason:null}),b7=ft(()=>bp().status==="opened"),u$=ft(()=>{const e=bp();return e.status==="opened"?e.walletInfo:null});let uu=typeof window<"u"?new oI:void 0;const[c$,f$]=Rt((uu==null?void 0:uu.getLastSelectedWalletInfo())||null),gn=e=>{uu||(uu=new oI),e?uu.setLastSelectedWalletInfo(e):uu.removeLastSelectedWalletInfo(),f$(e)},[Fo,cu]=Rt(null),d$={close:"Close",openWallet:"Open wallet",copyLink:"Copy Link",linkCopied:"Link Copied",copied:"Copied",yourWallet:"Your Wallet",retry:"Retry",get:"GET",mobile:"Mobile",browserExtension:"Browser Extension",desktop:"Desktop"},h$={connectWallet:"Connect Wallet",dropdown:{copy:"Copy address",copied:"Address copied!",disconnect:"Disconnect"}},p$={confirm:{header:"Open {{ name }} to confirm the transaction."},transactionSent:{header:"Transaction sent",text:"Your transaction will be processed in a few seconds."},transactionCanceled:{header:"Transaction canceled",text:"There will be no changes to your account."}},g$={walletOn:"Wallet On",recent:"Recent",installed:"Installed",popular:"Popular"},m$={loading:"Loading wallets",wallets:"Wallets",mobileUniversalModal:{connectYourWallet:"Connect your wallet",openWalletOnTelegramOrSelect:"Open Wallet in Telegram or select your wallet to connect",openWalletOnTelegram:"Open Wallet in Telegram",openLink:"Open Link",scan:"Scan with your mobile wallet"},desktopUniversalModal:{connectYourWallet:"Connect your wallet",scan:"Scan with your mobile wallet",availableWallets:"Available wallets"},mobileConnectionModal:{showQR:"Show QR Code",scanQR:"Scan the QR code below with your phone’s or {{ name }}’s camera",continueIn:"Continue in {{ name }}…",connectionDeclined:"Connection declined"},desktopConnectionModal:{scanQR:"Scan the QR code below with your phone’s or {{ name }}’s camera",continueInExtension:"Continue in {{ name }} browser extension…",dontHaveExtension:"Seems you don't have installed {{ name }} browser extension",getWallet:"Get {{ name }}",continueOnDesktop:"Continue in {{ name }} on desktop…",openWalletOnTelegram:"Open Wallet in Telegram on desktop",connectionDeclined:"Connection declined"},infoModal:{whatIsAWallet:"What is a wallet",secureDigitalAssets:"Secure digital assets storage",walletProtects:"A wallet protects and manages your digital assets including TON, tokens and collectables.",controlIdentity:"Control your Web3 identity",manageIdentity:"Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem.",effortlessCryptoTransactions:"Effortless crypto transactions",easilySend:"Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications.",getAWallet:"Get a Wallet"}},v$={confirmTransaction:{header:"Confirm the transaction in {{ name }}",text:"It will only take a moment."},transactionSent:"$notifications.transactionSent",transactionCanceled:"$notifications.transactionCanceled"},y$={common:d$,button:h$,notifications:p$,walletItem:g$,walletModal:m$,actionModal:v$},b$={close:"Закрыть",openWallet:"Открыть кошелёк",copyLink:"Копировать ссылку",linkCopied:"Ссылка скопирована",copied:"Ссылка скопирована",yourWallet:"Ваш кошелёк",retry:"Повторить",get:"Скачать",mobile:"Мобильный",browserExtension:"Расширение",desktop:"Десктоп"},w$={connectWallet:"Подключить кошелёк",dropdown:{copy:"Скопировать адрес",copied:"Адрес скопирован!",disconnect:"Отключить кошелёк"}},_$={confirm:{header:"Откройте {{ name }}, чтобы подтвердить транзакцию."},transactionSent:{header:"Транзакция отправлена",text:"Ваша транзакция будет обработана через несколько секунд."},transactionCanceled:{header:"Транзакция отменена",text:"Состояние вашего счёта не изменится."}},x$={walletOn:"Wallet в",recent:"Недавний",installed:"Установлен",popular:"Популярен"},S$={loading:"Кошельки загружаются",wallets:"Кошельки",mobileUniversalModal:{connectYourWallet:"Подключите кошелёк",openWalletOnTelegramOrSelect:"Подключите Wallet в Telegram или выберете кошелёк для подключения",openWalletOnTelegram:"Открыть Wallet в Telegram",openLink:"Открыть ссылку",scan:"Отсканируйте камерой вашего телефона"},desktopUniversalModal:{connectYourWallet:"Подключите кошелёк",scan:"Отсканируйте QR-код камерой вашего телефона",availableWallets:"Доступные кошельки"},mobileConnectionModal:{showQR:"Показать QR-код",scanQR:"Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона",continueIn:"Продолжите в {{ name }}…",connectionDeclined:"Подключение отклонено"},desktopConnectionModal:{scanQR:"Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона",continueInExtension:"Откройте браузерное расширение {{ name }}",dontHaveExtension:"Похоже, у вас не установлено браузерное расширение {{ name }}",getWallet:"Скачать {{ name }}",continueOnDesktop:"Откройте {{ name }} на компьютере…",openWalletOnTelegram:"Открыть Wallet в Telegram",connectionDeclined:"Подключение отклонено"},infoModal:{whatIsAWallet:"Что такое кошелёк?",secureDigitalAssets:"Надежное хранилище цифровых активов",walletProtects:"Кошелёк защищает ваши цифровые активы, включая TON, токены и предметы коллекционирования, и управляет ими.",controlIdentity:"Контроль своей личности Web3",manageIdentity:"Управляйте своей цифровой идентификацией и с легкостью получайте доступ к децентрализованным приложениям. Сохраняйте контроль над своими данными и безопасно участвуйте в экосистеме блокчейна.",effortlessCryptoTransactions:"Простые криптотранзакции",easilySend:"Легко отправляйте, получайте и отслеживайте свои криптовалюты. Оптимизируйте свои операции с помощью децентрализованных приложений.",getAWallet:"Скачать кошелёк"}},C$={confirmTransaction:{header:"Подтвердите действие в {{ name }}",text:"Это займет пару секунд."},transactionSent:"$notifications.transactionSent",transactionCanceled:"$notifications.transactionCanceled"},E$={common:b$,button:w$,notifications:_$,walletItem:x$,walletModal:S$,actionModal:C$},k$={en:w7(y$),ru:w7(E$)};function w7(e){const t="$",r=n=>{Object.entries(n).forEach(([o,i])=>{if(typeof i=="object"&&i)return r(i);if(typeof i=="string"){if(i[0]===t){const a=i.slice(1).split(".");let s=e;a.forEach(l=>{if(l in s)s=s[l];else throw new Error(`Cannot parse translations: there is no property ${l} in translation`)}),n[o]=s}i.slice(0,2)===`\\${t}`&&(n[o]=i.slice(1))}})};return r(e),e}const ac=O1(),s4=Symbol("store-raw"),pd=Symbol("store-node"),A$=Symbol("store-name");function aI(e,t){let r=e[eo];if(!r&&(Object.defineProperty(e,eo,{value:r=new Proxy(e,T$)}),!Array.isArray(e))){const n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;ie[eo][t]),r}function sI(e){if(qM()){const t=Vw(e);(t._||(t._=lI()))()}}function I$(e){return sI(e),Reflect.ownKeys(e)}function lI(e){const[t,r]=Rt(e,{equals:!1,internal:!0});return t.$=r,t}const T$={get(e,t,r){if(t===s4)return e;if(t===eo)return r;if(t===r4)return sI(e),r;const n=Vw(e),o=n.hasOwnProperty(t);let i=o?n[t]():e[t];if(t===pd||t==="__proto__")return i;if(!o){const a=Object.getOwnPropertyDescriptor(e,t);qM()&&(typeof i!="function"||e.hasOwnProperty(t))&&!(a&&a.get)&&(i=l4(n,t,i)())}return wp(i)?aI(i):i},has(e,t){return t===s4||t===eo||t===r4||t===pd||t==="__proto__"?!0:(this.get(e,t,e),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:I$,getOwnPropertyDescriptor:M$};function _p(e,t,r,n=!1){if(!n&&e[t]===r)return;const o=e[t],i=e.length;r===void 0?delete e[t]:e[t]=r;let a=Vw(e),s;(s=l4(a,t,o))&&s.$(()=>r),Array.isArray(e)&&e.length!==i&&(s=l4(a,"length",i))&&s.$(e.length),(s=a._)&&s.$()}function uI(e,t){const r=Object.keys(t);for(let n=0;n1){n=t.shift();const a=typeof n,s=Array.isArray(e);if(Array.isArray(n)){for(let l=0;l1){cf(e[n],t,[n].concat(r));return}o=e[n],r=[n].concat(r)}let i=t[0];typeof i=="function"&&(i=i(o,r),i===o)||n===void 0&&i==null||(i=ju(i),n===void 0||wp(o)&&wp(i)&&!Array.isArray(i)?uI(o,i):_p(e,n,i))}function Hw(...[e,t]){const r=ju(e||{}),n=Array.isArray(r),o=aI(r);function i(...a){$M(()=>{n&&a.length===1?B$(r,a[0]):cf(r,a)})}return[o,i]}const cI={constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#0098EA",telegramButton:"#0098EA",icon:{primary:"#0F0F0F",secondary:"#7A8999",tertiary:"#C1CAD2",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#FFFFFF",secondary:"#F1F3F5",segment:"#FFFFFF",tint:"#F1F3F5",qr:"#F1F3F5"},text:{primary:"#0F0F0F",secondary:"#6A7785"}},P$={constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#E5E5EA",telegramButton:"#31A6F5",icon:{primary:"#E5E5EA",secondary:"#909099",tertiary:"#434347",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#121214",secondary:"#18181A",segment:"#262629",tint:"#222224",qr:"#FFFFFF"},text:{primary:"#E5E5EA",secondary:"#7D7D85"}};/*! +`;return ie(e,{})};function Kz(e){e[0]==="#"&&(e=e.slice(1));const t=parseInt(e,16),r=t>>16&255,n=t>>8&255,o=t&255;return[r,n,o].join(",")}function Kd(e,t){return e[0]==="#"&&(e=Kz(e)),`rgba(${e}, ${t})`}function wo(e){return e.toString()+"px"}const uf=class{constructor(){Bt(this,"storage",{})}static getInstance(){return uf.instance||(uf.instance=new uf),uf.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var t;return(t=this.storage[e])!=null?t:null}key(e){var t;const r=Object.keys(this.storage);return e<0||e>=r.length?null:(t=r[e])!=null?t:null}removeItem(e){delete this.storage[e]}setItem(e,t){this.storage[e]=t}};let nI=uf;Bt(nI,"instance");class Fr extends Mt{constructor(...t){super(...t),Object.setPrototypeOf(this,Fr.prototype)}}function b0(...e){try{console.debug("[TON_CONNECT_UI]",...e)}catch{}}function Zz(...e){try{console.error("[TON_CONNECT_UI]",...e)}catch{}}function Gz(...e){try{console.warn("[TON_CONNECT_UI]",...e)}catch{}}function yp(e,t="_self"){b0("openLink",e,t),window.open(e,t,"noopener noreferrer")}function xr(e){yp(e,"_blank")}function Ta(e,t){const r=()=>{$t("safari")||ho("android")&&$t("firefox")||t()},n=setTimeout(()=>r(),200);window.addEventListener("blur",()=>clearTimeout(n),{once:!0}),yp(e,"_self")}function Yz(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?Tr.LIGHT:Tr.DARK}function Qz(e){const t=r=>e(r.matches?Tr.DARK:Tr.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}function Xz(){document.documentElement.scrollHeight!==document.documentElement.clientHeight&&(document.body.style.top=wo(-document.documentElement.scrollTop),document.body.classList.add(zw))}function Jz(){document.body.classList.remove(zw),document.documentElement.scrollTo({top:-parseFloat(getComputedStyle(document.body).top)}),document.body.style.top="auto"}function e$(){document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart","")}function t$(){customElements.define(jo,class extends HTMLElement{})}function iI(e){return ar(this,null,function*(){yield new Promise(t=>requestAnimationFrame(t)),e()})}function r$(e){return ar(this,null,function*(){return yield new Promise(t=>requestAnimationFrame(t)),e()})}function oI(e){document.readyState!=="complete"?window.addEventListener("load",()=>iI(()=>oI(e)),{once:!0}):e.forEach(t=>{const r=new window.Image;r.src=t})}function fa(){if(typeof window<"u")return window}function $w(){if(n$())return localStorage;if(i$())throw new Fr("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return nI.getInstance()}function n$(){try{return typeof localStorage<"u"}catch{return!1}}function i$(){return typeof _t<"u"&&_t.versions!=null&&_t.versions.node!=null}function qw(){var e,t,r;const n=new DF().getResult(),o=(e=n.os.name)==null?void 0:e.toLowerCase(),i=(t=n.device.model)==null?void 0:t.toLowerCase();let a;switch(!0){case i==="ipad":a="ipad";break;case o==="ios":a="ios";break;case o==="android":a="android";break;case o==="mac os":a="macos";break;case o==="linux":a="linux";break;case(o==null?void 0:o.includes("windows")):a="windows";break}const s=(r=n.browser.name)==null?void 0:r.toLowerCase();let l;switch(!0){case s==="chrome":l="chrome";break;case s==="firefox":l="firefox";break;case(s==null?void 0:s.includes("safari")):l="safari";break;case(s==null?void 0:s.includes("opera")):l="opera";break}return{os:a,browser:l}}function ho(...e){return e.includes(qw().os)}function $t(...e){return e.includes(qw().browser)}function Vh(e,t){const r=new URL(e);return t+r.search}class o${constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_wallet-info"),this.localStorage=$w()}setWalletInfo(t){this.localStorage.setItem(this.storageKey,JSON.stringify(t))}getWalletInfo(){const t=this.localStorage.getItem(this.storageKey);return t?JSON.parse(t):null}removeWalletInfo(){this.localStorage.removeItem(this.storageKey)}}class a${constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_preferred-wallet"),this.localStorage=$w()}setPreferredWalletAppName(t){this.localStorage.setItem(this.storageKey,t)}getPreferredWalletAppName(){return this.localStorage.getItem(this.storageKey)||void 0}}class aI{constructor(){Bt(this,"localStorage"),Bt(this,"storageKey","ton-connect-ui_last-selected-wallet-info"),this.localStorage=$w()}setLastSelectedWalletInfo(t){this.localStorage.setItem(this.storageKey,JSON.stringify(t))}getLastSelectedWalletInfo(){const t=this.localStorage.getItem(this.storageKey);return t?JSON.parse(t):null}removeLastSelectedWalletInfo(){this.localStorage.removeItem(this.storageKey)}}const[o4,v7]=Rt({status:"closed",closeReason:null}),y7=ft(()=>o4().status==="opened"),[bp,b7]=Rt({status:"closed",closeReason:null}),w7=ft(()=>bp().status==="opened"),s$=ft(()=>{const e=bp();return e.status==="opened"?e.walletInfo:null});let uu=typeof window<"u"?new aI:void 0;const[l$,u$]=Rt((uu==null?void 0:uu.getLastSelectedWalletInfo())||null),gn=e=>{uu||(uu=new aI),e?uu.setLastSelectedWalletInfo(e):uu.removeLastSelectedWalletInfo(),u$(e)},[Fo,cu]=Rt(null),c$={close:"Close",openWallet:"Open wallet",copyLink:"Copy Link",linkCopied:"Link Copied",copied:"Copied",yourWallet:"Your Wallet",retry:"Retry",get:"GET",mobile:"Mobile",browserExtension:"Browser Extension",desktop:"Desktop"},f$={connectWallet:"Connect Wallet",dropdown:{copy:"Copy address",copied:"Address copied!",disconnect:"Disconnect"}},d$={confirm:{header:"Open {{ name }} to confirm the transaction."},transactionSent:{header:"Transaction sent",text:"Your transaction will be processed in a few seconds."},transactionCanceled:{header:"Transaction canceled",text:"There will be no changes to your account."}},h$={walletOn:"Wallet On",recent:"Recent",installed:"Installed",popular:"Popular"},p$={loading:"Loading wallets",wallets:"Wallets",mobileUniversalModal:{connectYourWallet:"Connect your wallet",openWalletOnTelegramOrSelect:"Open Wallet in Telegram or select your wallet to connect",openWalletOnTelegram:"Open Wallet in Telegram",openLink:"Open Link",scan:"Scan with your mobile wallet"},desktopUniversalModal:{connectYourWallet:"Connect your wallet",scan:"Scan with your mobile wallet",availableWallets:"Available wallets"},mobileConnectionModal:{showQR:"Show QR Code",scanQR:"Scan the QR code below with your phone’s or {{ name }}’s camera",continueIn:"Continue in {{ name }}…",connectionDeclined:"Connection declined"},desktopConnectionModal:{scanQR:"Scan the QR code below with your phone’s or {{ name }}’s camera",continueInExtension:"Continue in {{ name }} browser extension…",dontHaveExtension:"Seems you don't have installed {{ name }} browser extension",getWallet:"Get {{ name }}",continueOnDesktop:"Continue in {{ name }} on desktop…",openWalletOnTelegram:"Open Wallet in Telegram on desktop",connectionDeclined:"Connection declined"},infoModal:{whatIsAWallet:"What is a wallet",secureDigitalAssets:"Secure digital assets storage",walletProtects:"A wallet protects and manages your digital assets including TON, tokens and collectables.",controlIdentity:"Control your Web3 identity",manageIdentity:"Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem.",effortlessCryptoTransactions:"Effortless crypto transactions",easilySend:"Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications.",getAWallet:"Get a Wallet"}},g$={confirmTransaction:{header:"Confirm the transaction in {{ name }}",text:"It will only take a moment."},transactionSent:"$notifications.transactionSent",transactionCanceled:"$notifications.transactionCanceled"},m$={common:c$,button:f$,notifications:d$,walletItem:h$,walletModal:p$,actionModal:g$},v$={close:"Закрыть",openWallet:"Открыть кошелёк",copyLink:"Копировать ссылку",linkCopied:"Ссылка скопирована",copied:"Ссылка скопирована",yourWallet:"Ваш кошелёк",retry:"Повторить",get:"Скачать",mobile:"Мобильный",browserExtension:"Расширение",desktop:"Десктоп"},y$={connectWallet:"Подключить кошелёк",dropdown:{copy:"Скопировать адрес",copied:"Адрес скопирован!",disconnect:"Отключить кошелёк"}},b$={confirm:{header:"Откройте {{ name }}, чтобы подтвердить транзакцию."},transactionSent:{header:"Транзакция отправлена",text:"Ваша транзакция будет обработана через несколько секунд."},transactionCanceled:{header:"Транзакция отменена",text:"Состояние вашего счёта не изменится."}},w$={walletOn:"Wallet в",recent:"Недавний",installed:"Установлен",popular:"Популярен"},_$={loading:"Кошельки загружаются",wallets:"Кошельки",mobileUniversalModal:{connectYourWallet:"Подключите кошелёк",openWalletOnTelegramOrSelect:"Подключите Wallet в Telegram или выберете кошелёк для подключения",openWalletOnTelegram:"Открыть Wallet в Telegram",openLink:"Открыть ссылку",scan:"Отсканируйте камерой вашего телефона"},desktopUniversalModal:{connectYourWallet:"Подключите кошелёк",scan:"Отсканируйте QR-код камерой вашего телефона",availableWallets:"Доступные кошельки"},mobileConnectionModal:{showQR:"Показать QR-код",scanQR:"Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона",continueIn:"Продолжите в {{ name }}…",connectionDeclined:"Подключение отклонено"},desktopConnectionModal:{scanQR:"Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона",continueInExtension:"Откройте браузерное расширение {{ name }}",dontHaveExtension:"Похоже, у вас не установлено браузерное расширение {{ name }}",getWallet:"Скачать {{ name }}",continueOnDesktop:"Откройте {{ name }} на компьютере…",openWalletOnTelegram:"Открыть Wallet в Telegram",connectionDeclined:"Подключение отклонено"},infoModal:{whatIsAWallet:"Что такое кошелёк?",secureDigitalAssets:"Надежное хранилище цифровых активов",walletProtects:"Кошелёк защищает ваши цифровые активы, включая TON, токены и предметы коллекционирования, и управляет ими.",controlIdentity:"Контроль своей личности Web3",manageIdentity:"Управляйте своей цифровой идентификацией и с легкостью получайте доступ к децентрализованным приложениям. Сохраняйте контроль над своими данными и безопасно участвуйте в экосистеме блокчейна.",effortlessCryptoTransactions:"Простые криптотранзакции",easilySend:"Легко отправляйте, получайте и отслеживайте свои криптовалюты. Оптимизируйте свои операции с помощью децентрализованных приложений.",getAWallet:"Скачать кошелёк"}},x$={confirmTransaction:{header:"Подтвердите действие в {{ name }}",text:"Это займет пару секунд."},transactionSent:"$notifications.transactionSent",transactionCanceled:"$notifications.transactionCanceled"},S$={common:v$,button:y$,notifications:b$,walletItem:w$,walletModal:_$,actionModal:x$},C$={en:_7(m$),ru:_7(S$)};function _7(e){const t="$",r=n=>{Object.entries(n).forEach(([o,i])=>{if(typeof i=="object"&&i)return r(i);if(typeof i=="string"){if(i[0]===t){const a=i.slice(1).split(".");let s=e;a.forEach(l=>{if(l in s)s=s[l];else throw new Error(`Cannot parse translations: there is no property ${l} in translation`)}),n[o]=s}i.slice(0,2)===`\\${t}`&&(n[o]=i.slice(1))}})};return r(e),e}const ac=O1(),a4=Symbol("store-raw"),pd=Symbol("store-node"),E$=Symbol("store-name");function sI(e,t){let r=e[eo];if(!r&&(Object.defineProperty(e,eo,{value:r=new Proxy(e,M$)}),!Array.isArray(e))){const n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;ie[eo][t]),r}function lI(e){if(WM()){const t=Ww(e);(t._||(t._=uI()))()}}function A$(e){return lI(e),Reflect.ownKeys(e)}function uI(e){const[t,r]=Rt(e,{equals:!1,internal:!0});return t.$=r,t}const M$={get(e,t,r){if(t===a4)return e;if(t===eo)return r;if(t===t4)return lI(e),r;const n=Ww(e),o=n.hasOwnProperty(t);let i=o?n[t]():e[t];if(t===pd||t==="__proto__")return i;if(!o){const a=Object.getOwnPropertyDescriptor(e,t);WM()&&(typeof i!="function"||e.hasOwnProperty(t))&&!(a&&a.get)&&(i=s4(n,t,i)())}return wp(i)?sI(i):i},has(e,t){return t===a4||t===eo||t===t4||t===pd||t==="__proto__"?!0:(this.get(e,t,e),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:A$,getOwnPropertyDescriptor:k$};function _p(e,t,r,n=!1){if(!n&&e[t]===r)return;const o=e[t],i=e.length;r===void 0?delete e[t]:e[t]=r;let a=Ww(e),s;(s=s4(a,t,o))&&s.$(()=>r),Array.isArray(e)&&e.length!==i&&(s=s4(a,"length",i))&&s.$(e.length),(s=a._)&&s.$()}function cI(e,t){const r=Object.keys(t);for(let n=0;n1){n=t.shift();const a=typeof n,s=Array.isArray(e);if(Array.isArray(n)){for(let l=0;l1){cf(e[n],t,[n].concat(r));return}o=e[n],r=[n].concat(r)}let i=t[0];typeof i=="function"&&(i=i(o,r),i===o)||n===void 0&&i==null||(i=ju(i),n===void 0||wp(o)&&wp(i)&&!Array.isArray(i)?cI(o,i):_p(e,n,i))}function Vw(...[e,t]){const r=ju(e||{}),n=Array.isArray(r),o=sI(r);function i(...a){qM(()=>{n&&a.length===1?I$(r,a[0]):cf(r,a)})}return[o,i]}const fI={constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#0098EA",telegramButton:"#0098EA",icon:{primary:"#0F0F0F",secondary:"#7A8999",tertiary:"#C1CAD2",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#FFFFFF",secondary:"#F1F3F5",segment:"#FFFFFF",tint:"#F1F3F5",qr:"#F1F3F5"},text:{primary:"#0F0F0F",secondary:"#6A7785"}},T$={constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#E5E5EA",telegramButton:"#31A6F5",icon:{primary:"#E5E5EA",secondary:"#909099",tertiary:"#434347",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#121214",secondary:"#18181A",segment:"#262629",tint:"#222224",qr:"#FFFFFF"},text:{primary:"#E5E5EA",secondary:"#7D7D85"}};/*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. - */function _7(e){return Object.prototype.toString.call(e)==="[object Object]"}function R$(e){var t,r;return _7(e)===!1?!1:(t=e.constructor,t===void 0?!0:(r=t.prototype,!(_7(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}function ja(e,t){return e?JF(t,e,{arrayMerge:(n,o,i)=>o,isMergeableObject:R$}):t}const[O$,Kw]=Hw({theme:Tr.LIGHT,colors:cI,borderRadius:"m"}),fI={[Tr.LIGHT]:cI,[Tr.DARK]:P$},fo={[Tr.LIGHT]:void 0,[Tr.DARK]:void 0};function d2(e,t){t&&(fo[Tr.DARK]=ja(t[Tr.DARK],fo[Tr.DARK]),fo[Tr.LIGHT]=ja(t[Tr.LIGHT],fo[Tr.LIGHT])),Kw({theme:e,colors:ja(fo[e],fI[e])})}function N$(e){Kw({borderRadius:e})}function L$(e){fo[Tr.DARK]=ja(e[Tr.DARK],fo[Tr.DARK]),fo[Tr.LIGHT]=ja(e[Tr.LIGHT],fo[Tr.LIGHT]),Kw(t=>({colors:ja(fo[t.theme],fI[t.theme])}))}const D$=je.div` + */function x7(e){return Object.prototype.toString.call(e)==="[object Object]"}function B$(e){var t,r;return x7(e)===!1?!1:(t=e.constructor,t===void 0?!0:(r=t.prototype,!(x7(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}function ja(e,t){return e?QF(t,e,{arrayMerge:(n,o,i)=>o,isMergeableObject:B$}):t}const[P$,Hw]=Vw({theme:Tr.LIGHT,colors:fI,borderRadius:"m"}),dI={[Tr.LIGHT]:fI,[Tr.DARK]:T$},fo={[Tr.LIGHT]:void 0,[Tr.DARK]:void 0};function d2(e,t){t&&(fo[Tr.DARK]=ja(t[Tr.DARK],fo[Tr.DARK]),fo[Tr.LIGHT]=ja(t[Tr.LIGHT],fo[Tr.LIGHT])),Hw({theme:e,colors:ja(fo[e],dI[e])})}function R$(e){Hw({borderRadius:e})}function O$(e){fo[Tr.DARK]=ja(e[Tr.DARK],fo[Tr.DARK]),fo[Tr.LIGHT]=ja(e[Tr.LIGHT],fo[Tr.LIGHT]),Hw(t=>({colors:ja(fo[t.theme],dI[t.theme])}))}const N$=je.div` background-color: ${e=>e.theme.colors.background.secondary}; -`,Ll=e=>{let t;const[r,n]=Rt(null);return ln(()=>{const o=new window.Image;return o.src=e.src,o.alt=e.alt||"",o.setAttribute("draggable","false"),e.class&&o.classList.add(e.class),o.complete?n(o):(o.addEventListener("load",()=>n(o)),()=>o.removeEventListener("load",()=>n(o)))}),[ie(Dt,{get when(){return r()},get children(){return r()}}),ie(Dt,{get when(){return!r()},get children(){return ie(D$,{get class(){return e.class},ref(o){const i=t;typeof i=="function"?i(o):t=o}})}})]};let Ks={};try{let e=location.hash.toString();Ks=U$(e)}catch{}let gd="unknown";Ks!=null&&Ks.tgWebAppPlatform&&(gd=(t7=Ks.tgWebAppPlatform)!=null?t7:"unknown");if(gd==="unknown"){const e=fa();gd=(i7=(n7=(r7=e==null?void 0:e.Telegram)==null?void 0:r7.WebApp)==null?void 0:n7.platform)!=null?i7:"unknown"}let xp="6.0";Ks!=null&&Ks.tgWebAppVersion&&(xp=Ks.tgWebAppVersion);if(!xp){const e=fa();xp=(s7=(a7=(o7=e==null?void 0:e.Telegram)==null?void 0:o7.WebApp)==null?void 0:a7.version)!=null?s7:"6.0"}function Wo(...e){return e.includes(gd)}function aa(){var e;return gd!=="unknown"||!!((e=fa())!=null&&e.TelegramWebviewProxy)}function Zw(){hI("web_app_expand",{})}function ff(e,t){const r=new URL(e);if(r.protocol!=="http:"&&r.protocol!=="https:"){if(t)return t();throw new Fr(`Url protocol is not supported: ${r}`)}if(r.hostname!=="t.me"){if(t)return t();throw new Fr(`Url host is not supported: ${r}`)}const n=r.pathname+r.search;dI()||z$("6.1")?hI("web_app_open_tg_link",{path_full:n}):xr("https://t.me"+n)}function dI(){try{const e=fa();return e?e.parent!=null&&e!==e.parent:!1}catch{return!1}}function hI(e,t){try{const r=fa();if(!r)throw new Fr("Can't post event to parent window: window is not defined");if(r.TelegramWebviewProxy!==void 0)b0("postEvent",e,t),r.TelegramWebviewProxy.postEvent(e,JSON.stringify(t));else if(r.external&&"notify"in r.external)b0("postEvent",e,t),r.external.notify(JSON.stringify({eventType:e,eventData:t}));else if(dI()){const n="*",o=JSON.stringify({eventType:e,eventData:t});b0("postEvent",e,t),r.parent.postMessage(o,n)}else throw new Fr("Can't post event to TMA")}catch(r){Yz(`Can't post event to parent window: ${r}`)}}function U$(e){e=e.replace(/^#/,"");let t={};if(!e.length)return t;if(e.indexOf("=")<0&&e.indexOf("?")<0)return t._path=Sp(e),t;let r=e.indexOf("?");if(r>=0){let o=e.substr(0,r);t._path=Sp(o),e=e.substr(r+1)}let n=j$(e);for(let o in n)t[o]=n[o];return t}function Sp(e){try{return e=e.replace(/\+/g,"%20"),decodeURIComponent(e)}catch{return e}}function j$(e){let t={};if(!e.length)return t;let r=e.split("&"),n,o,i,a;for(n=0;ns?1:-1;return 0}function z$(e){return F$(xp,e)>=0}const js={mobile:440,tablet:1020};function fu(e){const t=fa();if(!t)return e==="desktop";if(Wo("weba"))return!0;const r=t.innerWidth;switch(e){case"desktop":return r>js.tablet;case"tablet":return r>js.mobile;default:case"mobile":return r<=js.mobile||ho("ios","android","ipad")}}function vi(e){switch(e){case"mobile":return`@media (max-width: ${js.mobile}px)`;case"tablet":return`@media (max-width: ${js.tablet}px) (min-width: ${js.mobile}px)`;default:case"desktop":return`@media (min-width: ${js.tablet}px)`}}const Zd="@media (hover: none)",Gd="@media not all and (hover: none)",$$={m:"100vh",s:"8px",none:"0"},h2={s:.02,m:.04},q$=je.button` +`,Ll=e=>{let t;const[r,n]=Rt(null);return ln(()=>{const o=new window.Image;return o.src=e.src,o.alt=e.alt||"",o.setAttribute("draggable","false"),e.class&&o.classList.add(e.class),o.complete?n(o):(o.addEventListener("load",()=>n(o)),()=>o.removeEventListener("load",()=>n(o)))}),[ie(Dt,{get when(){return r()},get children(){return r()}}),ie(Dt,{get when(){return!r()},get children(){return ie(N$,{get class(){return e.class},ref(o){const i=t;typeof i=="function"?i(o):t=o}})}})]};let Ks={};try{let e=location.hash.toString();Ks=L$(e)}catch{}let gd="unknown";Ks!=null&&Ks.tgWebAppPlatform&&(gd=(r7=Ks.tgWebAppPlatform)!=null?r7:"unknown");if(gd==="unknown"){const e=fa();gd=(o7=(i7=(n7=e==null?void 0:e.Telegram)==null?void 0:n7.WebApp)==null?void 0:i7.platform)!=null?o7:"unknown"}let xp="6.0";Ks!=null&&Ks.tgWebAppVersion&&(xp=Ks.tgWebAppVersion);if(!xp){const e=fa();xp=(l7=(s7=(a7=e==null?void 0:e.Telegram)==null?void 0:a7.WebApp)==null?void 0:s7.version)!=null?l7:"6.0"}function Wo(...e){return e.includes(gd)}function aa(){var e;return gd!=="unknown"||!!((e=fa())!=null&&e.TelegramWebviewProxy)}function Kw(){pI("web_app_expand",{})}function ff(e,t){const r=new URL(e);if(r.protocol!=="http:"&&r.protocol!=="https:"){if(t)return t();throw new Fr(`Url protocol is not supported: ${r}`)}if(r.hostname!=="t.me"){if(t)return t();throw new Fr(`Url host is not supported: ${r}`)}const n=r.pathname+r.search;hI()||j$("6.1")?pI("web_app_open_tg_link",{path_full:n}):xr("https://t.me"+n)}function hI(){try{const e=fa();return e?e.parent!=null&&e!==e.parent:!1}catch{return!1}}function pI(e,t){try{const r=fa();if(!r)throw new Fr("Can't post event to parent window: window is not defined");if(r.TelegramWebviewProxy!==void 0)b0("postEvent",e,t),r.TelegramWebviewProxy.postEvent(e,JSON.stringify(t));else if(r.external&&"notify"in r.external)b0("postEvent",e,t),r.external.notify(JSON.stringify({eventType:e,eventData:t}));else if(hI()){const n="*",o=JSON.stringify({eventType:e,eventData:t});b0("postEvent",e,t),r.parent.postMessage(o,n)}else throw new Fr("Can't post event to TMA")}catch(r){Zz(`Can't post event to parent window: ${r}`)}}function L$(e){e=e.replace(/^#/,"");let t={};if(!e.length)return t;if(e.indexOf("=")<0&&e.indexOf("?")<0)return t._path=Sp(e),t;let r=e.indexOf("?");if(r>=0){let o=e.substr(0,r);t._path=Sp(o),e=e.substr(r+1)}let n=D$(e);for(let o in n)t[o]=n[o];return t}function Sp(e){try{return e=e.replace(/\+/g,"%20"),decodeURIComponent(e)}catch{return e}}function D$(e){let t={};if(!e.length)return t;let r=e.split("&"),n,o,i,a;for(n=0;ns?1:-1;return 0}function j$(e){return U$(xp,e)>=0}const js={mobile:440,tablet:1020};function fu(e){const t=fa();if(!t)return e==="desktop";if(Wo("weba"))return!0;const r=t.innerWidth;switch(e){case"desktop":return r>js.tablet;case"tablet":return r>js.mobile;default:case"mobile":return r<=js.mobile||ho("ios","android","ipad")}}function vi(e){switch(e){case"mobile":return`@media (max-width: ${js.mobile}px)`;case"tablet":return`@media (max-width: ${js.tablet}px) (min-width: ${js.mobile}px)`;default:case"desktop":return`@media (min-width: ${js.tablet}px)`}}const Zd="@media (hover: none)",Gd="@media not all and (hover: none)",F$={m:"100vh",s:"8px",none:"0"},h2={s:.02,m:.04},z$=je.button` display: ${e=>e.leftIcon||e.rightIcon?"flex":"inline-block"}; gap: ${e=>e.leftIcon||e.rightIcon?"6px":"unset"}; align-items: ${e=>e.leftIcon||e.rightIcon?"center":"unset"}; @@ -135,7 +135,7 @@ PERFORMANCE OF THIS SOFTWARE. padding-left: ${e=>e.leftIcon&&e.appearance!=="flat"?"12px":"16px"}; padding-right: ${e=>e.rightIcon&&e.appearance!=="flat"?"12px":"16px"}; border: none; - border-radius: ${e=>$$[e.theme.borderRadius]}; + border-radius: ${e=>F$[e.theme.borderRadius]}; cursor: ${e=>e.disabled?"not-allowed":"pointer"}; font-size: 14px; @@ -159,10 +159,10 @@ PERFORMANCE OF THIS SOFTWARE. transform: ${e=>e.disabled?"unset":`scale(${1-h2[e.scale]*2})`}; } } -`;function Yd(e){const t=un(()=>Object.keys(e).filter(n=>n.startsWith("data-"))),[r]=jw(e,t);return r}const $r=e=>{const t=Yd(e);return ie(q$,bo({get appearance(){return e.appearance||"primary"},get class(){return e.class},onClick:r=>{var n;return(n=e.onClick)==null?void 0:n.call(e,r)},onMouseEnter:r=>{var n;return(n=e.onMouseEnter)==null?void 0:n.call(e,r)},onMouseLeave:r=>{var n;return(n=e.onMouseLeave)==null?void 0:n.call(e,r)},ref(r){const n=e.ref;typeof n=="function"?n(r):e.ref=r},get disabled(){return e.disabled},get scale(){return e.scale||"m"},get leftIcon(){return!!e.leftIcon},get rightIcon(){return!!e.rightIcon},"data-tc-button":"true"},t,{get children(){return[ft(()=>e.leftIcon),ft(()=>e.children),ft(()=>e.rightIcon)]}}))};function Cp(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}const Gw=e=>{let t,r=!0;const[n,o]=Rt(),[i,a]=Rt(),s=N1(()=>e.children),{onBeforeEnter:l,onEnter:u,onAfterEnter:c,onBeforeExit:h,onExit:d,onAfterExit:p}=e,v=ft(()=>{const x=e.name||"s";return{enterActiveClass:e.enterActiveClass||x+"-enter-active",enterClass:e.enterClass||x+"-enter",enterToClass:e.enterToClass||x+"-enter-to",exitActiveClass:e.exitActiveClass||x+"-exit-active",exitClass:e.exitClass||x+"-exit",exitToClass:e.exitToClass||x+"-exit-to"}});function b(x,k){if(!r||e.appear){let M=function(V){x&&(!V||V.target===x)&&(x.removeEventListener("transitionend",M),x.removeEventListener("animationend",M),x.classList.remove(...L),x.classList.remove(...j),$M(()=>{n()!==x&&o(x),i()===x&&a(void 0)}),c&&c(x),e.mode==="inout"&&S(x,k))};const P=v().enterClass.split(" "),L=v().enterActiveClass.split(" "),j=v().enterToClass.split(" ");l&&l(x),x.classList.add(...P),x.classList.add(...L),Cp(()=>{x.classList.remove(...P),x.classList.add(...j),u&&u(x,()=>M()),(!u||u.length<2)&&(x.addEventListener("transitionend",M),x.addEventListener("animationend",M))})}k&&!e.mode?a(x):o(x)}function S(x,k){const M=v().exitClass.split(" "),P=v().exitActiveClass.split(" "),L=v().exitToClass.split(" ");if(!k.parentNode)return j();h&&h(k),k.classList.add(...M),k.classList.add(...P),Cp(()=>{k.classList.remove(...M),k.classList.add(...L)}),d&&d(k,()=>j()),(!d||d.length<2)&&(k.addEventListener("transitionend",j),k.addEventListener("animationend",j));function j(V){(!V||V.target===k)&&(k.removeEventListener("transitionend",j),k.removeEventListener("animationend",j),k.classList.remove(...P),k.classList.remove(...L),n()===k&&o(void 0),p&&p(k),e.mode==="outin"&&b(x,k))}}return gp(x=>{for(t=s();typeof t=="function";)t=t();return un(()=>(t&&t!==x&&(e.mode!=="outin"?b(t,x):r&&o(t)),x&&x!==t&&e.mode!=="inout"&&S(t,x),r=!1,t))}),[n,i]};function Hh(e){const{top:t,bottom:r,left:n,right:o,width:i,height:a}=e.getBoundingClientRect(),s=e.parentNode.getBoundingClientRect();return{top:t-s.top,bottom:r,left:n-s.left,right:o,width:i,height:a}}const W$=e=>{const t=N1(()=>e.children),r=ft(()=>{const p=e.name||"s";return{enterActiveClass:e.enterActiveClass||p+"-enter-active",enterClass:e.enterClass||p+"-enter",enterToClass:e.enterToClass||p+"-enter-to",exitActiveClass:e.exitActiveClass||p+"-exit-active",exitClass:e.exitClass||p+"-exit",exitToClass:e.exitToClass||p+"-exit-to",moveClass:e.moveClass||p+"-move"}}),{onBeforeEnter:n,onEnter:o,onAfterEnter:i,onBeforeExit:a,onExit:s,onAfterExit:l}=e,[u,c]=Rt();let h=[],d=!0;return gp(()=>{const p=t(),v=[...p],b=new Set(p),S=new Set(h),x=r().enterClass.split(" "),k=r().enterActiveClass.split(" "),M=r().enterToClass.split(" "),P=r().exitClass.split(" "),L=r().exitActiveClass.split(" "),j=r().exitToClass.split(" ");for(let V=0;V{K.classList.remove(...x),K.classList.add(...M),o&&o(K,()=>Z()),(!o||o.length<2)&&(K.addEventListener("transitionend",Z),K.addEventListener("animationend",Z))})}}for(let V=0;VU!==K),c(h))};v.splice(V,0,K),a&&a(K),K.classList.add(...P),K.classList.add(...L),Cp(()=>{K.classList.remove(...P),K.classList.add(...j)}),s&&s(K,()=>Z()),(!s||s.length<2)&&(K.addEventListener("transitionend",Z),K.addEventListener("animationend",Z))}}h=v,c(v)}),ln(p=>{const v=u();return v.forEach(b=>{let S;(S=p.get(b))?S.new&&(S.new=!1,S.newPos=Hh(b)):p.set(b,S={pos:Hh(b),new:!d}),S.new&&b.addEventListener("transitionend",()=>{S.new=!1,b.parentNode&&(S.newPos=Hh(b))},{once:!0}),S.newPos&&(S.pos=S.newPos),S.newPos=Hh(b)}),d?(d=!1,p):(v.forEach(b=>{const S=p.get(b),x=S.pos,k=S.newPos,M=x.left-k.left,P=x.top-k.top;if(M||P){S.moved=!0;const L=b.style;L.transform=`translate(${M}px,${P}px)`,L.transitionDuration="0s"}}),document.body.offsetHeight,v.forEach(b=>{const S=p.get(b);if(S.moved){let x=function(P){P&&P.target!==b||!b.parentNode||(!P||/transform$/.test(P.propertyName))&&(b.removeEventListener("transitionend",x),b.classList.remove(...M))};S.moved=!1;const k=b.style,M=r().moveClass.split(" ");b.classList.add(...M),k.transform=k.transitionDuration="",b.addEventListener("transitionend",x)}}),p)},new Map),u};function V$(e,t){const r=n=>{var o;return!e.contains(n.target)&&((o=t())==null?void 0:o())};document.body.addEventListener("click",r),zn(()=>document.body.removeEventListener("click",r))}function H$(e,t){const r=n=>{var o,i;n.key==="Escape"&&((o=document.activeElement)==null||o.blur(),(i=t())==null||i())};document.body.addEventListener("keydown",r),zn(()=>document.body.removeEventListener("keydown",r))}function K$(e,t){const{isEnabled:r,onClose:n}=t();if(!r||!(Ww().os==="android"))return;window.history.pushState(Z$,"");const i=a=>{a.preventDefault(),n()};window.addEventListener("popstate",i,{once:!0}),zn(()=>{window.removeEventListener("popstate",i),nI(()=>{var a;((a=window.history.state)==null?void 0:a[pI])===!0&&window.history.back()})})}const pI="androidBackHandler",Z$={[pI]:!0},G$=Zt('',4,!0),Y$={left:0,top:90,right:180,bottom:270},gI=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary,n=()=>e.direction||"left",o=je("svg")` - transform: rotate(${i=>Y$[i.svgDirection]}deg); +`;function Yd(e){const t=un(()=>Object.keys(e).filter(n=>n.startsWith("data-"))),[r]=Uw(e,t);return r}const $r=e=>{const t=Yd(e);return ie(z$,bo({get appearance(){return e.appearance||"primary"},get class(){return e.class},onClick:r=>{var n;return(n=e.onClick)==null?void 0:n.call(e,r)},onMouseEnter:r=>{var n;return(n=e.onMouseEnter)==null?void 0:n.call(e,r)},onMouseLeave:r=>{var n;return(n=e.onMouseLeave)==null?void 0:n.call(e,r)},ref(r){const n=e.ref;typeof n=="function"?n(r):e.ref=r},get disabled(){return e.disabled},get scale(){return e.scale||"m"},get leftIcon(){return!!e.leftIcon},get rightIcon(){return!!e.rightIcon},"data-tc-button":"true"},t,{get children(){return[ft(()=>e.leftIcon),ft(()=>e.children),ft(()=>e.rightIcon)]}}))};function Cp(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}const Zw=e=>{let t,r=!0;const[n,o]=Rt(),[i,a]=Rt(),s=N1(()=>e.children),{onBeforeEnter:l,onEnter:u,onAfterEnter:c,onBeforeExit:h,onExit:d,onAfterExit:p}=e,v=ft(()=>{const x=e.name||"s";return{enterActiveClass:e.enterActiveClass||x+"-enter-active",enterClass:e.enterClass||x+"-enter",enterToClass:e.enterToClass||x+"-enter-to",exitActiveClass:e.exitActiveClass||x+"-exit-active",exitClass:e.exitClass||x+"-exit",exitToClass:e.exitToClass||x+"-exit-to"}});function b(x,k){if(!r||e.appear){let M=function(V){x&&(!V||V.target===x)&&(x.removeEventListener("transitionend",M),x.removeEventListener("animationend",M),x.classList.remove(...L),x.classList.remove(...j),qM(()=>{n()!==x&&o(x),i()===x&&a(void 0)}),c&&c(x),e.mode==="inout"&&S(x,k))};const P=v().enterClass.split(" "),L=v().enterActiveClass.split(" "),j=v().enterToClass.split(" ");l&&l(x),x.classList.add(...P),x.classList.add(...L),Cp(()=>{x.classList.remove(...P),x.classList.add(...j),u&&u(x,()=>M()),(!u||u.length<2)&&(x.addEventListener("transitionend",M),x.addEventListener("animationend",M))})}k&&!e.mode?a(x):o(x)}function S(x,k){const M=v().exitClass.split(" "),P=v().exitActiveClass.split(" "),L=v().exitToClass.split(" ");if(!k.parentNode)return j();h&&h(k),k.classList.add(...M),k.classList.add(...P),Cp(()=>{k.classList.remove(...M),k.classList.add(...L)}),d&&d(k,()=>j()),(!d||d.length<2)&&(k.addEventListener("transitionend",j),k.addEventListener("animationend",j));function j(V){(!V||V.target===k)&&(k.removeEventListener("transitionend",j),k.removeEventListener("animationend",j),k.classList.remove(...P),k.classList.remove(...L),n()===k&&o(void 0),p&&p(k),e.mode==="outin"&&b(x,k))}}return gp(x=>{for(t=s();typeof t=="function";)t=t();return un(()=>(t&&t!==x&&(e.mode!=="outin"?b(t,x):r&&o(t)),x&&x!==t&&e.mode!=="inout"&&S(t,x),r=!1,t))}),[n,i]};function Hh(e){const{top:t,bottom:r,left:n,right:o,width:i,height:a}=e.getBoundingClientRect(),s=e.parentNode.getBoundingClientRect();return{top:t-s.top,bottom:r,left:n-s.left,right:o,width:i,height:a}}const $$=e=>{const t=N1(()=>e.children),r=ft(()=>{const p=e.name||"s";return{enterActiveClass:e.enterActiveClass||p+"-enter-active",enterClass:e.enterClass||p+"-enter",enterToClass:e.enterToClass||p+"-enter-to",exitActiveClass:e.exitActiveClass||p+"-exit-active",exitClass:e.exitClass||p+"-exit",exitToClass:e.exitToClass||p+"-exit-to",moveClass:e.moveClass||p+"-move"}}),{onBeforeEnter:n,onEnter:o,onAfterEnter:i,onBeforeExit:a,onExit:s,onAfterExit:l}=e,[u,c]=Rt();let h=[],d=!0;return gp(()=>{const p=t(),v=[...p],b=new Set(p),S=new Set(h),x=r().enterClass.split(" "),k=r().enterActiveClass.split(" "),M=r().enterToClass.split(" "),P=r().exitClass.split(" "),L=r().exitActiveClass.split(" "),j=r().exitToClass.split(" ");for(let V=0;V{K.classList.remove(...x),K.classList.add(...M),o&&o(K,()=>Z()),(!o||o.length<2)&&(K.addEventListener("transitionend",Z),K.addEventListener("animationend",Z))})}}for(let V=0;VU!==K),c(h))};v.splice(V,0,K),a&&a(K),K.classList.add(...P),K.classList.add(...L),Cp(()=>{K.classList.remove(...P),K.classList.add(...j)}),s&&s(K,()=>Z()),(!s||s.length<2)&&(K.addEventListener("transitionend",Z),K.addEventListener("animationend",Z))}}h=v,c(v)}),ln(p=>{const v=u();return v.forEach(b=>{let S;(S=p.get(b))?S.new&&(S.new=!1,S.newPos=Hh(b)):p.set(b,S={pos:Hh(b),new:!d}),S.new&&b.addEventListener("transitionend",()=>{S.new=!1,b.parentNode&&(S.newPos=Hh(b))},{once:!0}),S.newPos&&(S.pos=S.newPos),S.newPos=Hh(b)}),d?(d=!1,p):(v.forEach(b=>{const S=p.get(b),x=S.pos,k=S.newPos,M=x.left-k.left,P=x.top-k.top;if(M||P){S.moved=!0;const L=b.style;L.transform=`translate(${M}px,${P}px)`,L.transitionDuration="0s"}}),document.body.offsetHeight,v.forEach(b=>{const S=p.get(b);if(S.moved){let x=function(P){P&&P.target!==b||!b.parentNode||(!P||/transform$/.test(P.propertyName))&&(b.removeEventListener("transitionend",x),b.classList.remove(...M))};S.moved=!1;const k=b.style,M=r().moveClass.split(" ");b.classList.add(...M),k.transform=k.transitionDuration="",b.addEventListener("transitionend",x)}}),p)},new Map),u};function q$(e,t){const r=n=>{var o;return!e.contains(n.target)&&((o=t())==null?void 0:o())};document.body.addEventListener("click",r),zn(()=>document.body.removeEventListener("click",r))}function W$(e,t){const r=n=>{var o,i;n.key==="Escape"&&((o=document.activeElement)==null||o.blur(),(i=t())==null||i())};document.body.addEventListener("keydown",r),zn(()=>document.body.removeEventListener("keydown",r))}function V$(e,t){const{isEnabled:r,onClose:n}=t();if(!r||!(qw().os==="android"))return;window.history.pushState(H$,"");const i=a=>{a.preventDefault(),n()};window.addEventListener("popstate",i,{once:!0}),zn(()=>{window.removeEventListener("popstate",i),iI(()=>{var a;((a=window.history.state)==null?void 0:a[gI])===!0&&window.history.back()})})}const gI="androidBackHandler",H$={[gI]:!0},K$=Zt('',4,!0),Z$={left:0,top:90,right:180,bottom:270},mI=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary,n=()=>e.direction||"left",o=je("svg")` + transform: rotate(${i=>Z$[i.svgDirection]}deg); transition: transform 0.1s ease-in-out; - `;return ie(o,{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",get svgDirection(){return n()},get children(){const i=G$.cloneNode(!0);return Vt(()=>Et(i,"fill",r())),i}})},Q$=Zt(''),X$=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=Q$.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},J$=je.button` + `;return ie(o,{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",get svgDirection(){return n()},get children(){const i=K$.cloneNode(!0);return Vt(()=>Et(i,"fill",r())),i}})},G$=Zt(''),Y$=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=G$.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},Q$=je.button` padding: 0; display: flex; justify-content: center; @@ -191,7 +191,7 @@ PERFORMANCE OF THIS SOFTWARE. transform: scale(0.92); } } -`,Dl=e=>{const t=Yd(e),r=()=>e.icon||"close";return ie(J$,bo({get class(){return e.class},onClick:()=>e.onClick(),"data-tc-icon-button":"true"},t,{get children(){return[ie(Dt,{get when(){return!!e.children},get children(){return e.children}}),ie(Dt,{get when(){return!e.children},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return r()==="close"},get children(){return ie(X$,{get fill(){return e.fill}})}}),ie(pn,{get when(){return r()==="arrow"},get children(){return ie(gI,{get fill(){return e.fill}})}}),ie(pn,{get when(){return r()==="question"},get children(){return ie(nW,{get fill(){return e.fill}})}}),ie(pn,{get when(){return typeof r()!="string"},get children(){return r()}})]}})}})]}}))},Su={m:"24px",s:"16px",none:"0"},eq=je.div` +`,Dl=e=>{const t=Yd(e),r=()=>e.icon||"close";return ie(Q$,bo({get class(){return e.class},onClick:()=>e.onClick(),"data-tc-icon-button":"true"},t,{get children(){return[ie(Dt,{get when(){return!!e.children},get children(){return e.children}}),ie(Dt,{get when(){return!e.children},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return r()==="close"},get children(){return ie(Y$,{get fill(){return e.fill}})}}),ie(pn,{get when(){return r()==="arrow"},get children(){return ie(mI,{get fill(){return e.fill}})}}),ie(pn,{get when(){return r()==="question"},get children(){return ie(tW,{get fill(){return e.fill}})}}),ie(pn,{get when(){return typeof r()!="string"},get children(){return r()}})]}})}})]}}))},Su={m:"24px",s:"16px",none:"0"},X$=je.div` display: flex; position: fixed; z-index: 1000; @@ -206,7 +206,7 @@ PERFORMANCE OF THIS SOFTWARE. ${vi("mobile")} { padding-bottom: 0; } -`,tq=oa` +`,J$=oa` box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 16px 64px rgba(0, 0, 0, 0.16); width: fit-content; margin: auto; @@ -216,7 +216,7 @@ PERFORMANCE OF THIS SOFTWARE. height: fit-content; margin: auto 0 0 0; } -`,rq=je.div` +`,eq=je.div` position: relative; min-height: 100px; width: 416px; @@ -230,20 +230,20 @@ PERFORMANCE OF THIS SOFTWARE. ${vi("mobile")} { width: 100%; } -`,nq=je(Dl)` +`,tq=je(Dl)` position: absolute; right: 16px; top: 16px; -`,iq=je.div` +`,rq=je.div` display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 16px 18px; border-radius: 0 0 ${e=>Su[e.theme.borderRadius]} ${e=>Su[e.theme.borderRadius]}; -`,oq=je(Dl)` +`,nq=je(Dl)` background-color: ${e=>Kd(e.theme.colors.icon.secondary,.12)}; -`;class aq{constructor(){Bt(this,"currentTime",0)}}const df=class{constructor(){Bt(this,"currentTime",0),Bt(this,"playbackRate",1),Bt(this,"startTime",null),Bt(this,"timeline",new aq),Bt(this,"finished",Promise.resolve(this)),Bt(this,"effect",null),Bt(this,"id",""),Bt(this,"pending",!1),Bt(this,"playState","finished"),Bt(this,"replaceState","active"),Bt(this,"ready",Promise.resolve(this)),Bt(this,"oncancel",null),Bt(this,"onfinish",null),Bt(this,"onremove",null)}static create(){return df._instance||(Qz("Animation is not supported in this environment: please consider using the `web-animations-js` polyfill to provide a fallback implementation of the Web Animations API."),df._instance=new df),df._instance}cancel(){}finish(){}pause(){}play(){}reverse(){}addEventListener(e,t,r){}dispatchEvent(e){return!1}removeEventListener(e,t,r){}updatePlaybackRate(e){}commitStyles(){}persist(){}};let mI=df;Bt(mI,"_instance",null);function po(e,t,r){return"animate"in e?e.animate(t,r):mI.create()}const sq=Zt("
"),lq=V$,uq=H$,cq=K$,vI=e=>{const t=gr(),r=Yd(e);return ln(()=>{e.opened?e$():t$()}),ie(Gw,{onBeforeEnter:n=>{const o=fu("mobile")?200:100;po(n,[{opacity:0},{opacity:1}],{duration:o}),fu("mobile")&&po(n.firstElementChild,[{transform:"translateY(390px)"},{transform:"translateY(0)"}],{duration:o})},onExit:(n,o)=>{const i=fu("mobile")?200:100,a=po(n,[{opacity:1},{opacity:0}],{duration:i});if(fu("mobile")){const s=po(n.firstElementChild,[{transform:"translateY(0)"},{transform:"translateY(390px)"}],{duration:i});Promise.all([a.finished,s.finished]).then(o)}else a.finished.then(o)},get children(){return ie(Dt,{get when(){return e.opened},get children(){return ie(eq,bo({"data-tc-modal":"true"},r,{get children(){const n=sq.cloneNode(!0);return Rf(cq,n,()=>({isEnabled:e.enableAndroidBackHandler,onClose:()=>e.onClose()})),Rf(uq,n,()=>()=>e.onClose()),Rf(lq,n,()=>()=>e.onClose()),An(n,ie(rq,{get class(){return e.class},get children(){return[ie(nq,{icon:"close",onClick:()=>e.onClose()}),ft(()=>e.children)]}}),null),An(n,ie(Dt,{get when(){return e.onClickQuestion},get children(){return ie(iq,{get children(){return[ie(tW,{}),ie(oq,{get onClick(){return e.onClickQuestion},icon:"question"})]}})}}),null),Vt(()=>Fw(n,y0(tq,oa` +`;class iq{constructor(){Bt(this,"currentTime",0)}}const df=class{constructor(){Bt(this,"currentTime",0),Bt(this,"playbackRate",1),Bt(this,"startTime",null),Bt(this,"timeline",new iq),Bt(this,"finished",Promise.resolve(this)),Bt(this,"effect",null),Bt(this,"id",""),Bt(this,"pending",!1),Bt(this,"playState","finished"),Bt(this,"replaceState","active"),Bt(this,"ready",Promise.resolve(this)),Bt(this,"oncancel",null),Bt(this,"onfinish",null),Bt(this,"onremove",null)}static create(){return df._instance||(Gz("Animation is not supported in this environment: please consider using the `web-animations-js` polyfill to provide a fallback implementation of the Web Animations API."),df._instance=new df),df._instance}cancel(){}finish(){}pause(){}play(){}reverse(){}addEventListener(e,t,r){}dispatchEvent(e){return!1}removeEventListener(e,t,r){}updatePlaybackRate(e){}commitStyles(){}persist(){}};let vI=df;Bt(vI,"_instance",null);function po(e,t,r){return"animate"in e?e.animate(t,r):vI.create()}const oq=Zt("
"),aq=q$,sq=W$,lq=V$,yI=e=>{const t=gr(),r=Yd(e);return ln(()=>{e.opened?Xz():Jz()}),ie(Zw,{onBeforeEnter:n=>{const o=fu("mobile")?200:100;po(n,[{opacity:0},{opacity:1}],{duration:o}),fu("mobile")&&po(n.firstElementChild,[{transform:"translateY(390px)"},{transform:"translateY(0)"}],{duration:o})},onExit:(n,o)=>{const i=fu("mobile")?200:100,a=po(n,[{opacity:1},{opacity:0}],{duration:i});if(fu("mobile")){const s=po(n.firstElementChild,[{transform:"translateY(0)"},{transform:"translateY(390px)"}],{duration:i});Promise.all([a.finished,s.finished]).then(o)}else a.finished.then(o)},get children(){return ie(Dt,{get when(){return e.opened},get children(){return ie(X$,bo({"data-tc-modal":"true"},r,{get children(){const n=oq.cloneNode(!0);return Rf(lq,n,()=>({isEnabled:e.enableAndroidBackHandler,onClose:()=>e.onClose()})),Rf(sq,n,()=>()=>e.onClose()),Rf(aq,n,()=>()=>e.onClose()),An(n,ie(eq,{get class(){return e.class},get children(){return[ie(tq,{icon:"close",onClick:()=>e.onClose()}),ft(()=>e.children)]}}),null),An(n,ie(Dt,{get when(){return e.onClickQuestion},get children(){return ie(rq,{get children(){return[ie(Jq,{}),ie(nq,{get onClick(){return e.onClickQuestion},icon:"question"})]}})}}),null),Vt(()=>jw(n,y0(J$,oa` border-radius: ${Su[t.borderRadius]}; background-color: ${t.colors.background.tint}; @@ -251,7 +251,7 @@ PERFORMANCE OF THIS SOFTWARE. border-radius: ${Su[t.borderRadius]} ${Su[t.borderRadius]} 0 0; } - `))),n}}))}})}})},fq={m:"22px",s:"12px",none:"0"},dq={m:"18px",s:"8px",none:"0"},hq=je.div` + `))),n}}))}})}})},uq={m:"22px",s:"12px",none:"0"},cq={m:"18px",s:"8px",none:"0"},fq=je.div` display: grid; grid-template: 1fr / 1fr 1fr; width: fit-content; @@ -260,10 +260,10 @@ PERFORMANCE OF THIS SOFTWARE. position: relative; padding: 4px; - border-radius: ${e=>fq[e.theme.borderRadius]}; + border-radius: ${e=>uq[e.theme.borderRadius]}; background-color: ${e=>e.theme.colors.background.secondary}; -`,pq=je.div` +`,dq=je.div` position: absolute; top: 4px; left: 4px; @@ -271,15 +271,15 @@ PERFORMANCE OF THIS SOFTWARE. height: calc(100% - 8px); width: calc(50% - 4px); - border-radius: ${e=>dq[e.theme.borderRadius]}; + border-radius: ${e=>cq[e.theme.borderRadius]}; background-color: ${e=>e.theme.colors.background.segment}; transform: ${e=>e.right?"translateX(100%)":"translateX(0)"}; transition: transform 0.13s ease-in-out; -`,x7=je.input` +`,S7=je.input` display: none; -`,S7=je.label` +`,C7=je.label` padding: 9px 12px; z-index: 1; @@ -294,7 +294,7 @@ PERFORMANCE OF THIS SOFTWARE. > * { ${e=>e.isActive?"":`color: ${e.theme.colors.text.secondary};`} } -`,gq=e=>{const t="tabBar"+Math.floor(Math.random()*1e4);return ie(hq,{get class(){return e.class},"data-tc-tab-bar":"true",get children(){return[ie(pq,{get right(){return e.selectedTabIndex===1}}),ie(S7,{get isActive(){return e.selectedTabIndex===0},get children(){return[ie(x7,{type:"radio",name:t,get checked(){return e.selectedTabIndex===0},onInput:()=>{var r;return(r=e.onSelectedTabIndexChange)==null?void 0:r.call(e,0)}}),ft(()=>e.tab1)]}}),ie(S7,{get isActive(){return e.selectedTabIndex===1},get children(){return[ie(x7,{type:"radio",get checked(){return e.selectedTabIndex===1},name:t,onInput:()=>{var r;return(r=e.onSelectedTabIndexChange)==null?void 0:r.call(e,1)}}),ft(()=>e.tab2)]}})]}})},mq={m:"16px",s:"12px",none:"0"},vq={m:"12px",s:"8px",none:"0"},yI=256,u4=60,C7=48,E7=24,w0=je.div` +`,hq=e=>{const t="tabBar"+Math.floor(Math.random()*1e4);return ie(fq,{get class(){return e.class},"data-tc-tab-bar":"true",get children(){return[ie(dq,{get right(){return e.selectedTabIndex===1}}),ie(C7,{get isActive(){return e.selectedTabIndex===0},get children(){return[ie(S7,{type:"radio",name:t,get checked(){return e.selectedTabIndex===0},onInput:()=>{var r;return(r=e.onSelectedTabIndexChange)==null?void 0:r.call(e,0)}}),ft(()=>e.tab1)]}}),ie(C7,{get isActive(){return e.selectedTabIndex===1},get children(){return[ie(S7,{type:"radio",get checked(){return e.selectedTabIndex===1},name:t,onInput:()=>{var r;return(r=e.onSelectedTabIndexChange)==null?void 0:r.call(e,1)}}),ft(()=>e.tab2)]}})]}})},pq={m:"16px",s:"12px",none:"0"},gq={m:"12px",s:"8px",none:"0"},bI=256,l4=60,E7=48,k7=24,w0=je.div` width: 52px; height: 52px; background: transparent; @@ -306,14 +306,14 @@ PERFORMANCE OF THIS SOFTWARE. align-items: center; justify-content: center; transition: transform 0.125s ease-in-out; -`,yq=je.button` +`,mq=je.button` display: flex; align-items: center; position: relative; background-color: ${e=>e.theme.colors.background.qr}; - border-radius: ${e=>mq[e.theme.borderRadius]}; - padding: ${wo(E7)} 0; - height: ${wo(yI+E7*2)}; + border-radius: ${e=>pq[e.theme.borderRadius]}; + padding: ${wo(k7)} 0; + height: ${wo(bI+k7*2)}; width: 100%; overflow: hidden; @@ -341,7 +341,7 @@ PERFORMANCE OF THIS SOFTWARE. } } } -`,bq=je.div` +`,vq=je.div` position: relative; width: fit-content; @@ -360,21 +360,21 @@ PERFORMANCE OF THIS SOFTWARE. path { fill: ${e=>e.theme.colors.constant.black}; } -`,wq=je.div` +`,yq=je.div` position: absolute; - width: ${wo(u4)}; - height: ${wo(u4)}; + width: ${wo(l4)}; + height: ${wo(l4)}; background: ${e=>e.theme.colors.background.qr}; display: flex; align-items: center; justify-content: center; -`,_q=je(Ll)` +`,bq=je(Ll)` width: ${e=>wo(e.size)}; height: ${e=>wo(e.size)}; - border-radius: ${e=>vq[e.theme.borderRadius]}; + border-radius: ${e=>gq[e.theme.borderRadius]}; background-color: ${e=>e.theme.colors.background.qr}; -`,xq=je.div` +`,wq=je.div` position: absolute; bottom: 14px; left: 50%; @@ -389,16 +389,16 @@ PERFORMANCE OF THIS SOFTWARE. filter: drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.08)); background-color: ${e=>e.theme.colors.background.segment}; -`;var bI={exports:{}};(function(e,t){var r=function(){var n=function(L,j){var V=236,K=17,Z=L,ue=i[j],U=null,_=0,y=null,f=[],g={},w=function(X,se){_=Z*4+17,U=function(pe){for(var W=new Array(pe),q=0;q=7&&I(X),y==null&&(y=de(Z,ue,f)),B(y,se)},A=function(X,se){for(var pe=-1;pe<=7;pe+=1)if(!(X+pe<=-1||_<=X+pe))for(var W=-1;W<=7;W+=1)se+W<=-1||_<=se+W||(0<=pe&&pe<=6&&(W==0||W==6)||0<=W&&W<=6&&(pe==0||pe==6)||2<=pe&&pe<=4&&2<=W&&W<=4?U[X+pe][se+W]=!0:U[X+pe][se+W]=!1)},T=function(){for(var X=0,se=0,pe=0;pe<8;pe+=1){w(!0,pe);var W=s.getLostPoint(g);(pe==0||X>W)&&(X=W,se=pe)}return se},E=function(){for(var X=8;X<_-8;X+=1)U[X][6]==null&&(U[X][6]=X%2==0);for(var se=8;se<_-8;se+=1)U[6][se]==null&&(U[6][se]=se%2==0)},C=function(){for(var X=s.getPatternPosition(Z),se=0;se>pe&1)==1;U[Math.floor(pe/3)][pe%3+_-8-3]=W}for(var pe=0;pe<18;pe+=1){var W=!X&&(se>>pe&1)==1;U[pe%3+_-8-3][Math.floor(pe/3)]=W}},m=function(X,se){for(var pe=ue<<3|se,W=s.getBCHTypeInfo(pe),q=0;q<15;q+=1){var ye=!X&&(W>>q&1)==1;q<6?U[q][8]=ye:q<8?U[q+1][8]=ye:U[_-15+q][8]=ye}for(var q=0;q<15;q+=1){var ye=!X&&(W>>q&1)==1;q<8?U[8][_-q-1]=ye:q<9?U[8][15-q-1+1]=ye:U[8][15-q-1]=ye}U[_-8][8]=!X},B=function(X,se){for(var pe=-1,W=_-1,q=7,ye=0,xe=s.getMaskFunction(se),Me=_-1;Me>0;Me-=2)for(Me==6&&(Me-=1);;){for(var Q=0;Q<2;Q+=1)if(U[W][Me-Q]==null){var N=!1;ye>>q&1)==1);var D=xe(W,Me-Q);D&&(N=!N),U[W][Me-Q]=N,q-=1,q==-1&&(ye+=1,q=7)}if(W+=pe,W<0||_<=W){W-=pe,pe=-pe;break}}},ne=function(X,se){for(var pe=0,W=0,q=0,ye=new Array(se.length),xe=new Array(se.length),Me=0;Me=0?_e.getAt(Pe):0}}for(var Fe=0,D=0;DMe*8)throw"code length overflow. ("+q.getLengthInBits()+">"+Me*8+")";for(q.getLengthInBits()+4<=Me*8&&q.put(0,4);q.getLengthInBits()%8!=0;)q.putBit(!1);for(;!(q.getLengthInBits()>=Me*8||(q.put(V,8),q.getLengthInBits()>=Me*8));)q.put(K,8);return ne(q,W)};g.addData=function(X,se){se=se||"Byte";var pe=null;switch(se){case"Numeric":pe=d(X);break;case"Alphanumeric":pe=p(X);break;case"Byte":pe=v(X);break;case"Kanji":pe=b(X);break;default:throw"mode:"+se}f.push(pe),y=null},g.isDark=function(X,se){if(X<0||_<=X||se<0||_<=se)throw X+","+se;return U[X][se]},g.getModuleCount=function(){return _},g.make=function(){if(Z<1){for(var X=1;X<40;X++){for(var se=c.getRSBlocks(X,ue),pe=h(),W=0;W"u"?X*4:se;var pe="";pe+='";for(var q=0;q';pe+=""}return pe+="",pe+="
",pe},g.createSvgTag=function(X,se,pe,W){var q={};typeof arguments[0]=="object"&&(q=arguments[0],X=q.cellSize,se=q.margin,pe=q.alt,W=q.title),X=X||2,se=typeof se>"u"?X*4:se,pe=typeof pe=="string"?{text:pe}:pe||{},pe.text=pe.text||null,pe.id=pe.text?pe.id||"qrcode-description":null,W=typeof W=="string"?{text:W}:W||{},W.text=W.text||null,W.id=W.text?W.id||"qrcode-title":null;var ye=g.getModuleCount()*X+se*2,xe,Me,Q,N,D="",G;for(G="l"+X+",0 0,"+X+" -"+X+",0 0,-"+X+"z ",D+=''+$(W.text)+"":"",D+=pe.text?''+$(pe.text)+"":"",D+='',D+='"u"?X*4:se;var pe=g.getModuleCount()*X+se*2,W=se,q=pe-se;return P(pe,pe,function(ye,xe){if(W<=ye&&ye"u"?X*4:se;var W=g.getModuleCount()*X+se*2,q="";return q+="",q};var $=function(X){for(var se="",pe=0;pe":se+=">";break;case"&":se+="&";break;case'"':se+=""";break;default:se+=W;break}}return se},he=function(X){var se=1;X=typeof X>"u"?se*2:X;var pe=g.getModuleCount()*se+X*2,W=X,q=pe-X,ye,xe,Me,Q,N,D={"██":"█","█ ":"▀"," █":"▄"," ":" "},G={"██":"▀","█ ":"▀"," █":" "," ":" "},me="";for(ye=0;ye=q?G[N]:D[N];me+=` +`;var wI={exports:{}};(function(e,t){var r=function(){var n=function(L,j){var V=236,K=17,Z=L,ue=i[j],U=null,_=0,y=null,f=[],g={},w=function(X,se){_=Z*4+17,U=function(pe){for(var W=new Array(pe),q=0;q=7&&I(X),y==null&&(y=de(Z,ue,f)),B(y,se)},A=function(X,se){for(var pe=-1;pe<=7;pe+=1)if(!(X+pe<=-1||_<=X+pe))for(var W=-1;W<=7;W+=1)se+W<=-1||_<=se+W||(0<=pe&&pe<=6&&(W==0||W==6)||0<=W&&W<=6&&(pe==0||pe==6)||2<=pe&&pe<=4&&2<=W&&W<=4?U[X+pe][se+W]=!0:U[X+pe][se+W]=!1)},T=function(){for(var X=0,se=0,pe=0;pe<8;pe+=1){w(!0,pe);var W=s.getLostPoint(g);(pe==0||X>W)&&(X=W,se=pe)}return se},E=function(){for(var X=8;X<_-8;X+=1)U[X][6]==null&&(U[X][6]=X%2==0);for(var se=8;se<_-8;se+=1)U[6][se]==null&&(U[6][se]=se%2==0)},C=function(){for(var X=s.getPatternPosition(Z),se=0;se>pe&1)==1;U[Math.floor(pe/3)][pe%3+_-8-3]=W}for(var pe=0;pe<18;pe+=1){var W=!X&&(se>>pe&1)==1;U[pe%3+_-8-3][Math.floor(pe/3)]=W}},m=function(X,se){for(var pe=ue<<3|se,W=s.getBCHTypeInfo(pe),q=0;q<15;q+=1){var ye=!X&&(W>>q&1)==1;q<6?U[q][8]=ye:q<8?U[q+1][8]=ye:U[_-15+q][8]=ye}for(var q=0;q<15;q+=1){var ye=!X&&(W>>q&1)==1;q<8?U[8][_-q-1]=ye:q<9?U[8][15-q-1+1]=ye:U[8][15-q-1]=ye}U[_-8][8]=!X},B=function(X,se){for(var pe=-1,W=_-1,q=7,ye=0,xe=s.getMaskFunction(se),Me=_-1;Me>0;Me-=2)for(Me==6&&(Me-=1);;){for(var Q=0;Q<2;Q+=1)if(U[W][Me-Q]==null){var N=!1;ye>>q&1)==1);var D=xe(W,Me-Q);D&&(N=!N),U[W][Me-Q]=N,q-=1,q==-1&&(ye+=1,q=7)}if(W+=pe,W<0||_<=W){W-=pe,pe=-pe;break}}},ne=function(X,se){for(var pe=0,W=0,q=0,ye=new Array(se.length),xe=new Array(se.length),Me=0;Me=0?_e.getAt(Pe):0}}for(var Fe=0,D=0;DMe*8)throw"code length overflow. ("+q.getLengthInBits()+">"+Me*8+")";for(q.getLengthInBits()+4<=Me*8&&q.put(0,4);q.getLengthInBits()%8!=0;)q.putBit(!1);for(;!(q.getLengthInBits()>=Me*8||(q.put(V,8),q.getLengthInBits()>=Me*8));)q.put(K,8);return ne(q,W)};g.addData=function(X,se){se=se||"Byte";var pe=null;switch(se){case"Numeric":pe=d(X);break;case"Alphanumeric":pe=p(X);break;case"Byte":pe=v(X);break;case"Kanji":pe=b(X);break;default:throw"mode:"+se}f.push(pe),y=null},g.isDark=function(X,se){if(X<0||_<=X||se<0||_<=se)throw X+","+se;return U[X][se]},g.getModuleCount=function(){return _},g.make=function(){if(Z<1){for(var X=1;X<40;X++){for(var se=c.getRSBlocks(X,ue),pe=h(),W=0;W"u"?X*4:se;var pe="";pe+='";for(var q=0;q';pe+=""}return pe+="",pe+="
",pe},g.createSvgTag=function(X,se,pe,W){var q={};typeof arguments[0]=="object"&&(q=arguments[0],X=q.cellSize,se=q.margin,pe=q.alt,W=q.title),X=X||2,se=typeof se>"u"?X*4:se,pe=typeof pe=="string"?{text:pe}:pe||{},pe.text=pe.text||null,pe.id=pe.text?pe.id||"qrcode-description":null,W=typeof W=="string"?{text:W}:W||{},W.text=W.text||null,W.id=W.text?W.id||"qrcode-title":null;var ye=g.getModuleCount()*X+se*2,xe,Me,Q,N,D="",G;for(G="l"+X+",0 0,"+X+" -"+X+",0 0,-"+X+"z ",D+=''+$(W.text)+"":"",D+=pe.text?''+$(pe.text)+"":"",D+='',D+='"u"?X*4:se;var pe=g.getModuleCount()*X+se*2,W=se,q=pe-se;return P(pe,pe,function(ye,xe){if(W<=ye&&ye"u"?X*4:se;var W=g.getModuleCount()*X+se*2,q="";return q+="",q};var $=function(X){for(var se="",pe=0;pe":se+=">";break;case"&":se+="&";break;case'"':se+=""";break;default:se+=W;break}}return se},he=function(X){var se=1;X=typeof X>"u"?se*2:X;var pe=g.getModuleCount()*se+X*2,W=X,q=pe-X,ye,xe,Me,Q,N,D={"██":"█","█ ":"▀"," █":"▄"," ":" "},G={"██":"▀","█ ":"▀"," █":" "," ":" "},me="";for(ye=0;ye=q?G[N]:D[N];me+=` `}return pe%2&&X>0?me.substring(0,me.length-pe-1)+Array(pe+1).join("▀"):me.substring(0,me.length-1)};return g.createASCII=function(X,se){if(X=X||1,X<2)return he(se);X-=1,se=typeof se>"u"?X*2:se;var pe=g.getModuleCount()*X+se*2,W=se,q=pe-se,ye,xe,Me,Q,N=Array(X+1).join("██"),D=Array(X+1).join(" "),G="",me="";for(ye=0;ye>>8),ue.push(y&255)):ue.push(K)}}return ue}};var o={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3},i={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var L=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],j=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,V=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,K=1<<14|1<<12|1<<10|1<<4|1<<1,Z={},ue=function(U){for(var _=0;U!=0;)_+=1,U>>>=1;return _};return Z.getBCHTypeInfo=function(U){for(var _=U<<10;ue(_)-ue(j)>=0;)_^=j<=0;)_^=V<5&&(y+=3+w-5)}for(var f=0;f<_-1;f+=1)for(var g=0;g<_-1;g+=1){var C=0;U.isDark(f,g)&&(C+=1),U.isDark(f+1,g)&&(C+=1),U.isDark(f,g+1)&&(C+=1),U.isDark(f+1,g+1)&&(C+=1),(C==0||C==4)&&(y+=3)}for(var f=0;f<_;f+=1)for(var g=0;g<_-6;g+=1)U.isDark(f,g)&&!U.isDark(f,g+1)&&U.isDark(f,g+2)&&U.isDark(f,g+3)&&U.isDark(f,g+4)&&!U.isDark(f,g+5)&&U.isDark(f,g+6)&&(y+=40);for(var g=0;g<_;g+=1)for(var f=0;f<_-6;f+=1)U.isDark(f,g)&&!U.isDark(f+1,g)&&U.isDark(f+2,g)&&U.isDark(f+3,g)&&U.isDark(f+4,g)&&!U.isDark(f+5,g)&&U.isDark(f+6,g)&&(y+=40);for(var I=0,g=0;g<_;g+=1)for(var f=0;f<_;f+=1)U.isDark(f,g)&&(I+=1);var m=Math.abs(100*I/_/_-50)/5;return y+=m*10,y},Z}(),l=function(){for(var L=new Array(256),j=new Array(256),V=0;V<8;V+=1)L[V]=1<=256;)Z-=255;return L[Z]},K}();function u(L,j){if(typeof L.length>"u")throw L.length+"/"+j;var V=function(){for(var Z=0;Z"u")throw"bad rs block @ typeNumber:"+Z+"/errorCorrectionLevel:"+ue;for(var _=U.length/3,y=[],f=0;f<_;f+=1)for(var g=U[f*3+0],w=U[f*3+1],A=U[f*3+2],T=0;T>>7-K%8&1)==1},V.put=function(K,Z){for(var ue=0;ue>>Z-ue-1&1)==1)},V.getLengthInBits=function(){return j},V.putBit=function(K){var Z=Math.floor(j/8);L.length<=Z&&L.push(0),K&&(L[Z]|=128>>>j%8),j+=1},V},d=function(L){var j=o.MODE_NUMBER,V=L,K={};K.getMode=function(){return j},K.getLength=function(U){return V.length},K.write=function(U){for(var _=V,y=0;y+2<_.length;)U.put(Z(_.substring(y,y+3)),10),y+=3;y<_.length&&(_.length-y==1?U.put(Z(_.substring(y,y+1)),4):_.length-y==2&&U.put(Z(_.substring(y,y+2)),7))};var Z=function(U){for(var _=0,y=0;y>>8&255)*192+(y&255),ue.put(y,13),_+=2}if(_>>8)},j.writeBytes=function(V,K,Z){K=K||0,Z=Z||V.length;for(var ue=0;ue0&&(V+=","),V+=L[K];return V+="]",V},j},x=function(){var L=0,j=0,V=0,K="",Z={},ue=function(_){K+=String.fromCharCode(U(_&63))},U=function(_){if(!(_<0)){if(_<26)return 65+_;if(_<52)return 97+(_-26);if(_<62)return 48+(_-52);if(_==62)return 43;if(_==63)return 47}throw"n:"+_};return Z.writeByte=function(_){for(L=L<<8|_&255,j+=8,V+=1;j>=6;)ue(L>>>j-6),j-=6},Z.flush=function(){if(j>0&&(ue(L<<6-j),L=0,j=0),V%3!=0)for(var _=3-V%3,y=0;y<_;y+=1)K+="="},Z.toString=function(){return K},Z},k=function(L){var j=L,V=0,K=0,Z=0,ue={};ue.read=function(){for(;Z<8;){if(V>=j.length){if(Z==0)return-1;throw"unexpected end of file./"+Z}var _=j.charAt(V);if(V+=1,_=="=")return Z=0,-1;if(_.match(/^\s$/))continue;K=K<<6|U(_.charCodeAt(0)),Z+=6}var y=K>>>Z-8&255;return Z-=8,y};var U=function(_){if(65<=_&&_<=90)return _-65;if(97<=_&&_<=122)return _-97+26;if(48<=_&&_<=57)return _-48+52;if(_==43)return 62;if(_==47)return 63;throw"c:"+_};return ue},M=function(L,j){var V=L,K=j,Z=new Array(L*j),ue={};ue.setPixel=function(f,g,w){Z[g*V+f]=w},ue.write=function(f){f.writeString("GIF87a"),f.writeShort(V),f.writeShort(K),f.writeByte(128),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(255),f.writeByte(255),f.writeByte(255),f.writeString(","),f.writeShort(0),f.writeShort(0),f.writeShort(V),f.writeShort(K),f.writeByte(0);var g=2,w=_(g);f.writeByte(g);for(var A=0;w.length-A>255;)f.writeByte(255),f.writeBytes(w,A,255),A+=255;f.writeByte(w.length-A),f.writeBytes(w,A,w.length-A),f.writeByte(0),f.writeString(";")};var U=function(f){var g=f,w=0,A=0,T={};return T.write=function(E,C){if(E>>>C)throw"length over";for(;w+C>=8;)g.writeByte(255&(E<>>=8-w,A=0,w=0;A=E<0&&g.writeByte(A)},T},_=function(f){for(var g=1<>6,128|l&63):l<55296||l>=57344?a.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|i.charCodeAt(s)&1023),a.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return a}return o(n)}})(),function(n){e.exports=n()}(function(){return r})})(bI);const Sq=bI.exports;function Yw(e){return ar(this,null,function*(){try{if(!(navigator!=null&&navigator.clipboard))throw new Fr("Clipboard API not available");return yield navigator.clipboard.writeText(e)}catch{}Cq(e)})}function Cq(e){const t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}const Eq=Zt("
"),U1=e=>{let t,r,n;const[o,i]=Rt(!1),[a,s]=Rt(C7);ln(()=>{const d=Sq(0,"L");d.addData(e.sourceUrl),d.make(),t.innerHTML=d.createSvgTag(4,0);const p=t.firstElementChild.clientWidth,v=Math.round(yI/p*1e5)/1e5;if(n){const b=Math.ceil(u4/(v*4))*4,S=wo(Math.ceil((p-b)/(2*4))*4);n.style.top=S,n.style.left=S,n.style.height=wo(b),n.style.width=wo(b),s(Math.round(C7/v))}r.style.transform=`scale(${v})`});let l=null;return ie(yq,{get class(){return e.class},onClick:()=>{i(!0),Yw(e.sourceUrl),l!=null&&clearTimeout(l),l=setTimeout(()=>i(!1),1500)},get children(){return[ie(bq,{ref(c){const h=r;typeof h=="function"?h(c):r=c},get children(){return[(()=>{const c=Eq.cloneNode(!0),h=t;return typeof h=="function"?Rf(h,c):t=c,c})(),ie(Dt,{get when(){return e.imageUrl},get children(){return ie(wq,{ref(c){const h=n;typeof h=="function"?h(c):n=c},get children(){return ie(_q,{get src(){return e.imageUrl},alt:"",get size(){return a()}})}})}})]}}),ie(Gw,{onBeforeEnter:c=>{po(c,[{opacity:0,transform:"translate(-50%, 44px)"},{opacity:1,transform:"translate(-50%, 0)"}],{duration:150,easing:"ease-out"})},onExit:(c,h)=>{po(c,[{opacity:1,transform:"translate(-50%, 0)"},{opacity:0,transform:"translate(-50%, 44px)"}],{duration:150,easing:"ease-out"}).finished.then(()=>{h()})},get children(){return ie(Dt,{get when(){return o()&&!e.disableCopy},get children(){return ie(xq,{get children(){return[ie(Xw,{size:"xs"}),ie(di,{translationKey:"common.linkCopied",children:"Link Copied"})]}})}})}}),ie(Dt,{get when(){return!e.disableCopy},get children(){return ie(w0,{get children(){return ie(xI,{})}})}})]}})};var c4=(e,t,r)=>{const n=t.trim().split(".").reduce((o,i)=>o?o[i]:void 0,e);return n!==void 0?n:r},kq=(e,t,r=/{{(.*?)}}/g)=>e.replace(r,(n,o)=>c4(t,o,"")),Aq=(e={},t=navigator.language in e?navigator.language:Object.keys(e)[0])=>{const[r,n]=Rt(t),[o,i]=Hw(e);return[(l,u,c)=>{const h=c4(o[r()],l,c||"");return typeof h=="function"?h(u):typeof h=="string"?kq(h,u||{}):h},{add(l,u){i(l,c=>Object.assign(c||{},u))},locale:l=>l?n(l):r(),dict:l=>c4(o,l)}]},wI=O1({}),Bo=()=>$n(wI);const Mq=je.div` +`}return G.substring(0,G.length-1)},g.renderTo2dContext=function(X,se){se=se||2;for(var pe=g.getModuleCount(),W=0;W>>8),ue.push(y&255)):ue.push(K)}}return ue}};var o={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3},i={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var L=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],j=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,V=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,K=1<<14|1<<12|1<<10|1<<4|1<<1,Z={},ue=function(U){for(var _=0;U!=0;)_+=1,U>>>=1;return _};return Z.getBCHTypeInfo=function(U){for(var _=U<<10;ue(_)-ue(j)>=0;)_^=j<=0;)_^=V<5&&(y+=3+w-5)}for(var f=0;f<_-1;f+=1)for(var g=0;g<_-1;g+=1){var C=0;U.isDark(f,g)&&(C+=1),U.isDark(f+1,g)&&(C+=1),U.isDark(f,g+1)&&(C+=1),U.isDark(f+1,g+1)&&(C+=1),(C==0||C==4)&&(y+=3)}for(var f=0;f<_;f+=1)for(var g=0;g<_-6;g+=1)U.isDark(f,g)&&!U.isDark(f,g+1)&&U.isDark(f,g+2)&&U.isDark(f,g+3)&&U.isDark(f,g+4)&&!U.isDark(f,g+5)&&U.isDark(f,g+6)&&(y+=40);for(var g=0;g<_;g+=1)for(var f=0;f<_-6;f+=1)U.isDark(f,g)&&!U.isDark(f+1,g)&&U.isDark(f+2,g)&&U.isDark(f+3,g)&&U.isDark(f+4,g)&&!U.isDark(f+5,g)&&U.isDark(f+6,g)&&(y+=40);for(var I=0,g=0;g<_;g+=1)for(var f=0;f<_;f+=1)U.isDark(f,g)&&(I+=1);var m=Math.abs(100*I/_/_-50)/5;return y+=m*10,y},Z}(),l=function(){for(var L=new Array(256),j=new Array(256),V=0;V<8;V+=1)L[V]=1<=256;)Z-=255;return L[Z]},K}();function u(L,j){if(typeof L.length>"u")throw L.length+"/"+j;var V=function(){for(var Z=0;Z"u")throw"bad rs block @ typeNumber:"+Z+"/errorCorrectionLevel:"+ue;for(var _=U.length/3,y=[],f=0;f<_;f+=1)for(var g=U[f*3+0],w=U[f*3+1],A=U[f*3+2],T=0;T>>7-K%8&1)==1},V.put=function(K,Z){for(var ue=0;ue>>Z-ue-1&1)==1)},V.getLengthInBits=function(){return j},V.putBit=function(K){var Z=Math.floor(j/8);L.length<=Z&&L.push(0),K&&(L[Z]|=128>>>j%8),j+=1},V},d=function(L){var j=o.MODE_NUMBER,V=L,K={};K.getMode=function(){return j},K.getLength=function(U){return V.length},K.write=function(U){for(var _=V,y=0;y+2<_.length;)U.put(Z(_.substring(y,y+3)),10),y+=3;y<_.length&&(_.length-y==1?U.put(Z(_.substring(y,y+1)),4):_.length-y==2&&U.put(Z(_.substring(y,y+2)),7))};var Z=function(U){for(var _=0,y=0;y>>8&255)*192+(y&255),ue.put(y,13),_+=2}if(_>>8)},j.writeBytes=function(V,K,Z){K=K||0,Z=Z||V.length;for(var ue=0;ue0&&(V+=","),V+=L[K];return V+="]",V},j},x=function(){var L=0,j=0,V=0,K="",Z={},ue=function(_){K+=String.fromCharCode(U(_&63))},U=function(_){if(!(_<0)){if(_<26)return 65+_;if(_<52)return 97+(_-26);if(_<62)return 48+(_-52);if(_==62)return 43;if(_==63)return 47}throw"n:"+_};return Z.writeByte=function(_){for(L=L<<8|_&255,j+=8,V+=1;j>=6;)ue(L>>>j-6),j-=6},Z.flush=function(){if(j>0&&(ue(L<<6-j),L=0,j=0),V%3!=0)for(var _=3-V%3,y=0;y<_;y+=1)K+="="},Z.toString=function(){return K},Z},k=function(L){var j=L,V=0,K=0,Z=0,ue={};ue.read=function(){for(;Z<8;){if(V>=j.length){if(Z==0)return-1;throw"unexpected end of file./"+Z}var _=j.charAt(V);if(V+=1,_=="=")return Z=0,-1;if(_.match(/^\s$/))continue;K=K<<6|U(_.charCodeAt(0)),Z+=6}var y=K>>>Z-8&255;return Z-=8,y};var U=function(_){if(65<=_&&_<=90)return _-65;if(97<=_&&_<=122)return _-97+26;if(48<=_&&_<=57)return _-48+52;if(_==43)return 62;if(_==47)return 63;throw"c:"+_};return ue},M=function(L,j){var V=L,K=j,Z=new Array(L*j),ue={};ue.setPixel=function(f,g,w){Z[g*V+f]=w},ue.write=function(f){f.writeString("GIF87a"),f.writeShort(V),f.writeShort(K),f.writeByte(128),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(255),f.writeByte(255),f.writeByte(255),f.writeString(","),f.writeShort(0),f.writeShort(0),f.writeShort(V),f.writeShort(K),f.writeByte(0);var g=2,w=_(g);f.writeByte(g);for(var A=0;w.length-A>255;)f.writeByte(255),f.writeBytes(w,A,255),A+=255;f.writeByte(w.length-A),f.writeBytes(w,A,w.length-A),f.writeByte(0),f.writeString(";")};var U=function(f){var g=f,w=0,A=0,T={};return T.write=function(E,C){if(E>>>C)throw"length over";for(;w+C>=8;)g.writeByte(255&(E<>>=8-w,A=0,w=0;A=E<0&&g.writeByte(A)},T},_=function(f){for(var g=1<>6,128|l&63):l<55296||l>=57344?a.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|i.charCodeAt(s)&1023),a.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return a}return o(n)}})(),function(n){e.exports=n()}(function(){return r})})(wI);const _q=wI.exports;function Gw(e){return ar(this,null,function*(){try{if(!(navigator!=null&&navigator.clipboard))throw new Fr("Clipboard API not available");return yield navigator.clipboard.writeText(e)}catch{}xq(e)})}function xq(e){const t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}const Sq=Zt("
"),U1=e=>{let t,r,n;const[o,i]=Rt(!1),[a,s]=Rt(E7);ln(()=>{const d=_q(0,"L");d.addData(e.sourceUrl),d.make(),t.innerHTML=d.createSvgTag(4,0);const p=t.firstElementChild.clientWidth,v=Math.round(bI/p*1e5)/1e5;if(n){const b=Math.ceil(l4/(v*4))*4,S=wo(Math.ceil((p-b)/(2*4))*4);n.style.top=S,n.style.left=S,n.style.height=wo(b),n.style.width=wo(b),s(Math.round(E7/v))}r.style.transform=`scale(${v})`});let l=null;return ie(mq,{get class(){return e.class},onClick:()=>{i(!0),Gw(e.sourceUrl),l!=null&&clearTimeout(l),l=setTimeout(()=>i(!1),1500)},get children(){return[ie(vq,{ref(c){const h=r;typeof h=="function"?h(c):r=c},get children(){return[(()=>{const c=Sq.cloneNode(!0),h=t;return typeof h=="function"?Rf(h,c):t=c,c})(),ie(Dt,{get when(){return e.imageUrl},get children(){return ie(yq,{ref(c){const h=n;typeof h=="function"?h(c):n=c},get children(){return ie(bq,{get src(){return e.imageUrl},alt:"",get size(){return a()}})}})}})]}}),ie(Zw,{onBeforeEnter:c=>{po(c,[{opacity:0,transform:"translate(-50%, 44px)"},{opacity:1,transform:"translate(-50%, 0)"}],{duration:150,easing:"ease-out"})},onExit:(c,h)=>{po(c,[{opacity:1,transform:"translate(-50%, 0)"},{opacity:0,transform:"translate(-50%, 44px)"}],{duration:150,easing:"ease-out"}).finished.then(()=>{h()})},get children(){return ie(Dt,{get when(){return o()&&!e.disableCopy},get children(){return ie(wq,{get children(){return[ie(Qw,{size:"xs"}),ie(di,{translationKey:"common.linkCopied",children:"Link Copied"})]}})}})}}),ie(Dt,{get when(){return!e.disableCopy},get children(){return ie(w0,{get children(){return ie(SI,{})}})}})]}})};var u4=(e,t,r)=>{const n=t.trim().split(".").reduce((o,i)=>o?o[i]:void 0,e);return n!==void 0?n:r},Cq=(e,t,r=/{{(.*?)}}/g)=>e.replace(r,(n,o)=>u4(t,o,"")),Eq=(e={},t=navigator.language in e?navigator.language:Object.keys(e)[0])=>{const[r,n]=Rt(t),[o,i]=Vw(e);return[(l,u,c)=>{const h=u4(o[r()],l,c||"");return typeof h=="function"?h(u):typeof h=="string"?Cq(h,u||{}):h},{add(l,u){i(l,c=>Object.assign(c||{},u))},locale:l=>l?n(l):r(),dict:l=>u4(o,l)}]},_I=O1({}),Bo=()=>$n(_I);const kq=je.div` font-style: normal; font-weight: ${e=>e.fontWeight}; font-size: ${e=>e.fontSize}; line-height: ${e=>e.lineHeight}; color: ${e=>e.color}; -`,di=e=>{const t=gr(),[r]=Bo();let n;const o=()=>e.color||t.colors.text.primary,i=bo({fontSize:"14px",fontWeight:"510",lineHeight:"130%"},e);return ln(()=>{n&&i.cursor!=="unset"&&getComputedStyle(n).cursor!=="pointer"&&(n.style.cursor="default")}),ie(Mq,{get fontSize(){return i.fontSize},get fontWeight(){return i.fontWeight},get lineHeight(){return i.lineHeight},get color(){return o()},get class(){return i.class},ref(a){const s=n;typeof s=="function"?s(a):n=a},"data-tc-text":"true",get children(){var a;return ft(()=>!!i.translationKey)()?r(i.translationKey,i.translationValues,(a=i.children)==null?void 0:a.toString()):i.children}})},Iq=je.div` +`,di=e=>{const t=gr(),[r]=Bo();let n;const o=()=>e.color||t.colors.text.primary,i=bo({fontSize:"14px",fontWeight:"510",lineHeight:"130%"},e);return ln(()=>{n&&i.cursor!=="unset"&&getComputedStyle(n).cursor!=="pointer"&&(n.style.cursor="default")}),ie(kq,{get fontSize(){return i.fontSize},get fontWeight(){return i.fontWeight},get lineHeight(){return i.lineHeight},get color(){return o()},get class(){return i.class},ref(a){const s=n;typeof s=="function"?s(a):n=a},"data-tc-text":"true",get children(){var a;return ft(()=>!!i.translationKey)()?r(i.translationKey,i.translationValues,(a=i.children)==null?void 0:a.toString()):i.children}})},Aq=je.div` position: relative; &::after { @@ -413,11 +413,11 @@ PERFORMANCE OF THIS SOFTWARE. border-radius: inherit; } -`,Tq=je(Ll)` +`,Mq=je(Ll)` width: 100%; height: 100%; border-radius: inherit; -`,_I=e=>ie(Iq,{get class(){return e.class},get children(){return ie(Tq,{get src(){return e.src}})}}),Bq={m:"16px",s:"12px",none:"0"},Pq={m:"6px",s:"6px",none:"0"},Rq=je.button` +`,xI=e=>ie(Aq,{get class(){return e.class},get children(){return ie(Mq,{get src(){return e.src}})}}),Iq={m:"16px",s:"12px",none:"0"},Tq={m:"6px",s:"6px",none:"0"},Bq=je.button` position: relative; cursor: pointer; border: none; @@ -450,21 +450,21 @@ PERFORMANCE OF THIS SOFTWARE. transform: scale(0.92); } } -`,Oq=je(_I)` +`,Pq=je(xI)` width: 60px; height: 60px; - border-radius: ${e=>Bq[e.theme.borderRadius]}; + border-radius: ${e=>Iq[e.theme.borderRadius]}; margin-bottom: 8px; -`,Nq=je(Ll)` +`,Rq=je(Ll)` position: absolute; right: 10px; top: 50px; width: 24px; height: 24px; - border-radius: ${e=>Pq[e.theme.borderRadius]}; + border-radius: ${e=>Tq[e.theme.borderRadius]}; box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.08); -`,Lq=je(di)` +`,Oq=je(di)` max-width: 90px; font-weight: 590; white-space: nowrap; @@ -474,7 +474,7 @@ PERFORMANCE OF THIS SOFTWARE. ${vi("mobile")} { max-width: 80px; } -`,Dq=je(di)` +`,Nq=je(di)` font-weight: 510; max-width: 90px; white-space: nowrap; @@ -485,7 +485,7 @@ PERFORMANCE OF THIS SOFTWARE. ${vi("mobile")} { max-width: 80px; } -`,Ep=e=>ie(Rq,{get class(){return e.class},onClick:()=>e.onClick(),"data-tc-wallet-item":"true",get children(){return[ft(()=>ft(()=>typeof e.icon=="string")()?ie(Oq,{get src(){return e.icon}}):e.icon),ft(()=>ft(()=>!!e.badgeUrl)()&&ie(Nq,{get src(){return e.badgeUrl}})),ie(Lq,{get children(){return e.name}}),ft(()=>ft(()=>!!e.secondLine)()&&ie(Dq,{get colorPrimary(){var t;return(t=e.secondLineColorPrimary)!=null?t:!0},get children(){return e.secondLine}}))]}}),Uq=je.h1` +`,Ep=e=>ie(Bq,{get class(){return e.class},onClick:()=>e.onClick(),"data-tc-wallet-item":"true",get children(){return[ft(()=>ft(()=>typeof e.icon=="string")()?ie(Pq,{get src(){return e.icon}}):e.icon),ft(()=>ft(()=>!!e.badgeUrl)()&&ie(Rq,{get src(){return e.badgeUrl}})),ie(Oq,{get children(){return e.name}}),ft(()=>ft(()=>!!e.secondLine)()&&ie(Nq,{get colorPrimary(){var t;return(t=e.secondLineColorPrimary)!=null?t:!0},get children(){return e.secondLine}}))]}}),Lq=je.h1` font-style: normal; font-weight: 700; font-size: 20px; @@ -499,7 +499,7 @@ PERFORMANCE OF THIS SOFTWARE. margin-bottom: 0; cursor: default; -`,Po=e=>{const[t]=Bo();return ie(Uq,{get class(){return e.class},"data-tc-h1":"true",get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},jq=je.h2` +`,Po=e=>{const[t]=Bo();return ie(Lq,{get class(){return e.class},"data-tc-h1":"true",get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},Dq=je.h2` font-style: normal; font-weight: 510; font-size: 16px; @@ -513,7 +513,7 @@ PERFORMANCE OF THIS SOFTWARE. margin-bottom: 32px; cursor: default; -`,hs=e=>{const[t]=Bo();return ie(jq,{get class(){return e.class},"data-tc-h2":"true",get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},Fq=je.h3` +`,hs=e=>{const[t]=Bo();return ie(Dq,{get class(){return e.class},"data-tc-h2":"true",get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},Uq=je.h3` font-style: normal; font-weight: 590; font-size: 16px; @@ -525,7 +525,7 @@ PERFORMANCE OF THIS SOFTWARE. margin-bottom: 0; cursor: default; -`,Qw=e=>{const[t]=Bo();return ie(Fq,{"data-tc-h3":"true",get class(){return e.class},get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},zq=Zt(''),$q=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=zq.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=r(),s=r();return a!==i._v$&&Et(n,"fill",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},qq=Zt(''),Wq=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=qq.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},Vq=Zt(''),Hq=Zt(''),Kq=Zt(''),Xw=e=>{const t=gr(),r=()=>e.size||"s",n=()=>e.fill||t.colors.icon.success;return ft((()=>{const o=ft(()=>r()==="xs");return()=>o()?(()=>{const i=Vq.cloneNode(!0),a=i.firstChild,s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$&&Et(i,"class",u._v$=c),h!==u._v$2&&Et(s,"fill",u._v$2=h),d!==u._v$3&&Et(l,"stroke",u._v$3=d),u},{_v$:void 0,_v$2:void 0,_v$3:void 0}),i})():(()=>{const i=ft(()=>r()==="s");return()=>i()?(()=>{const a=Hq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$4&&Et(a,"class",u._v$4=c),h!==u._v$5&&Et(s,"fill",u._v$5=h),d!==u._v$6&&Et(l,"fill",u._v$6=d),u},{_v$4:void 0,_v$5:void 0,_v$6:void 0}),a})():(()=>{const a=Kq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$7&&Et(a,"class",u._v$7=c),h!==u._v$8&&Et(s,"fill",u._v$8=h),d!==u._v$9&&Et(l,"fill",u._v$9=d),u},{_v$7:void 0,_v$8:void 0,_v$9:void 0}),a})()})()})())},Zq=Zt(''),Gq=Zt(''),Yq=Zt(''),j1=e=>{const t=gr(),r=()=>e.size||"m",n=()=>e.fill||t.colors.icon.error;return ft((()=>{const o=ft(()=>r()==="m");return()=>o()?(()=>{const i=Zq.cloneNode(!0),a=i.firstChild,s=a.nextSibling;return Vt(l=>{const u=e.class,c=n(),h=t.colors.constant.white;return u!==l._v$&&Et(i,"class",l._v$=u),c!==l._v$2&&Et(a,"fill",l._v$2=c),h!==l._v$3&&Et(s,"fill",l._v$3=h),l},{_v$:void 0,_v$2:void 0,_v$3:void 0}),i})():(()=>{const i=ft(()=>r()==="s");return()=>i()?(()=>{const a=Gq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$4&&Et(a,"class",u._v$4=c),h!==u._v$5&&Et(s,"fill",u._v$5=h),d!==u._v$6&&Et(l,"stroke",u._v$6=d),u},{_v$4:void 0,_v$5:void 0,_v$6:void 0}),a})():(()=>{const a=Yq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$7&&Et(a,"class",u._v$7=c),h!==u._v$8&&Et(s,"fill",u._v$8=h),d!==u._v$9&&Et(l,"fill",u._v$9=d),u},{_v$7:void 0,_v$8:void 0,_v$9:void 0}),a})()})()})())},Qq=Zt(''),Xq=Zt(''),Jq=Zt(''),da=e=>{const t=gr(),r=()=>e.size||"xs",n=()=>e.fill||t.colors.icon.tertiary,o=Vz` +`,Yw=e=>{const[t]=Bo();return ie(Uq,{"data-tc-h3":"true",get class(){return e.class},get children(){var r;return ft(()=>!!e.translationKey)()?t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString()):e.children}})},jq=Zt(''),Fq=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=jq.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=r(),s=r();return a!==i._v$&&Et(n,"fill",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},zq=Zt(''),$q=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=zq.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},qq=Zt(''),Wq=Zt(''),Vq=Zt(''),Qw=e=>{const t=gr(),r=()=>e.size||"s",n=()=>e.fill||t.colors.icon.success;return ft((()=>{const o=ft(()=>r()==="xs");return()=>o()?(()=>{const i=qq.cloneNode(!0),a=i.firstChild,s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$&&Et(i,"class",u._v$=c),h!==u._v$2&&Et(s,"fill",u._v$2=h),d!==u._v$3&&Et(l,"stroke",u._v$3=d),u},{_v$:void 0,_v$2:void 0,_v$3:void 0}),i})():(()=>{const i=ft(()=>r()==="s");return()=>i()?(()=>{const a=Wq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$4&&Et(a,"class",u._v$4=c),h!==u._v$5&&Et(s,"fill",u._v$5=h),d!==u._v$6&&Et(l,"fill",u._v$6=d),u},{_v$4:void 0,_v$5:void 0,_v$6:void 0}),a})():(()=>{const a=Vq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$7&&Et(a,"class",u._v$7=c),h!==u._v$8&&Et(s,"fill",u._v$8=h),d!==u._v$9&&Et(l,"fill",u._v$9=d),u},{_v$7:void 0,_v$8:void 0,_v$9:void 0}),a})()})()})())},Hq=Zt(''),Kq=Zt(''),Zq=Zt(''),j1=e=>{const t=gr(),r=()=>e.size||"m",n=()=>e.fill||t.colors.icon.error;return ft((()=>{const o=ft(()=>r()==="m");return()=>o()?(()=>{const i=Hq.cloneNode(!0),a=i.firstChild,s=a.nextSibling;return Vt(l=>{const u=e.class,c=n(),h=t.colors.constant.white;return u!==l._v$&&Et(i,"class",l._v$=u),c!==l._v$2&&Et(a,"fill",l._v$2=c),h!==l._v$3&&Et(s,"fill",l._v$3=h),l},{_v$:void 0,_v$2:void 0,_v$3:void 0}),i})():(()=>{const i=ft(()=>r()==="s");return()=>i()?(()=>{const a=Kq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$4&&Et(a,"class",u._v$4=c),h!==u._v$5&&Et(s,"fill",u._v$5=h),d!==u._v$6&&Et(l,"stroke",u._v$6=d),u},{_v$4:void 0,_v$5:void 0,_v$6:void 0}),a})():(()=>{const a=Zq.cloneNode(!0),s=a.firstChild,l=s.nextSibling;return Vt(u=>{const c=e.class,h=n(),d=t.colors.constant.white;return c!==u._v$7&&Et(a,"class",u._v$7=c),h!==u._v$8&&Et(s,"fill",u._v$8=h),d!==u._v$9&&Et(l,"fill",u._v$9=d),u},{_v$7:void 0,_v$8:void 0,_v$9:void 0}),a})()})()})())},Gq=Zt(''),Yq=Zt(''),Qq=Zt(''),da=e=>{const t=gr(),r=()=>e.size||"xs",n=()=>e.fill||t.colors.icon.tertiary,o=qz` 0% { transform: rotate(0deg); } @@ -534,21 +534,21 @@ PERFORMANCE OF THIS SOFTWARE. } `,i=oa` animation: ${o} 1s linear infinite; - `;return ft((()=>{const a=ft(()=>r()==="xs");return()=>a()?(()=>{const s=Qq.cloneNode(!0),l=s.firstChild;return Vt(u=>{const c=y0(i,e.class),h=n();return c!==u._v$&&Et(s,"class",u._v$=c),h!==u._v$2&&Et(l,"fill",u._v$2=h),u},{_v$:void 0,_v$2:void 0}),s})():(()=>{const s=ft(()=>r()==="s");return()=>s()?(()=>{const l=Xq.cloneNode(!0),u=l.firstChild;return Vt(c=>{const h=y0(i,e.class),d=n();return h!==c._v$3&&Et(l,"class",c._v$3=h),d!==c._v$4&&Et(u,"fill",c._v$4=d),c},{_v$3:void 0,_v$4:void 0}),l})():(()=>{const l=Jq.cloneNode(!0),u=l.firstChild;return Vt(c=>{const h=y0(i,e.class),d=n();return h!==c._v$5&&Et(l,"class",c._v$5=h),d!==c._v$6&&Et(u,"stroke",c._v$6=d),c},{_v$5:void 0,_v$6:void 0}),l})()})()})())},eW=Zt(''),tW=()=>{const e=gr(),t=()=>e.theme===Tr.DARK?e.colors.constant.white:e.colors.constant.black;return(()=>{const r=eW.cloneNode(!0),n=r.firstChild,o=n.nextSibling,i=o.nextSibling;return Vt(()=>Et(i,"fill",t())),r})()},rW=Zt(''),nW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=rW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},iW=Zt(''),oW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=iW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},aW=Zt(''),sW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=aW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},lW=Zt(''),uW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=lW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},cW=Zt(''),Of=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=cW.cloneNode(!0),o=n.firstChild,i=o.firstChild;return Vt(()=>Et(i,"fill",r())),n})()},fW=Zt(''),k7=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=fW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},dW=Zt(''),hW=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=dW.cloneNode(!0),o=n.firstChild,i=o.firstChild;return Vt(()=>Et(i,"fill",r())),n})()},pW=Zt(''),gW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=pW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},mW=Zt(''),vW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=mW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},yW=Zt(''),bW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=yW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},wW=Zt(''),_W=e=>{const t=gr(),r=()=>e.fill||t.colors.constant.white;return(()=>{const n=wW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},xW=Zt(''),SW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=xW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},CW=Zt(''),xI=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=CW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=r(),s=r();return a!==i._v$&&Et(n,"fill",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},EW=Zt(''),f4=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=EW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},kW={m:"16px",s:"12px",none:"0"},AW={m:"6px",s:"6px",none:"0"},MW=je.div` + `;return ft((()=>{const a=ft(()=>r()==="xs");return()=>a()?(()=>{const s=Gq.cloneNode(!0),l=s.firstChild;return Vt(u=>{const c=y0(i,e.class),h=n();return c!==u._v$&&Et(s,"class",u._v$=c),h!==u._v$2&&Et(l,"fill",u._v$2=h),u},{_v$:void 0,_v$2:void 0}),s})():(()=>{const s=ft(()=>r()==="s");return()=>s()?(()=>{const l=Yq.cloneNode(!0),u=l.firstChild;return Vt(c=>{const h=y0(i,e.class),d=n();return h!==c._v$3&&Et(l,"class",c._v$3=h),d!==c._v$4&&Et(u,"fill",c._v$4=d),c},{_v$3:void 0,_v$4:void 0}),l})():(()=>{const l=Qq.cloneNode(!0),u=l.firstChild;return Vt(c=>{const h=y0(i,e.class),d=n();return h!==c._v$5&&Et(l,"class",c._v$5=h),d!==c._v$6&&Et(u,"stroke",c._v$6=d),c},{_v$5:void 0,_v$6:void 0}),l})()})()})())},Xq=Zt(''),Jq=()=>{const e=gr(),t=()=>e.theme===Tr.DARK?e.colors.constant.white:e.colors.constant.black;return(()=>{const r=Xq.cloneNode(!0),n=r.firstChild,o=n.nextSibling,i=o.nextSibling;return Vt(()=>Et(i,"fill",t())),r})()},eW=Zt(''),tW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=eW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},rW=Zt(''),nW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=rW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},iW=Zt(''),oW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=iW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},aW=Zt(''),sW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=aW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},lW=Zt(''),Of=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=lW.cloneNode(!0),o=n.firstChild,i=o.firstChild;return Vt(()=>Et(i,"fill",r())),n})()},uW=Zt(''),A7=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=uW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},cW=Zt(''),fW=e=>{const t=gr(),r=()=>e.fill||t.colors.accent;return(()=>{const n=cW.cloneNode(!0),o=n.firstChild,i=o.firstChild;return Vt(()=>Et(i,"fill",r())),n})()},dW=Zt(''),hW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=dW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},pW=Zt(''),gW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=pW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},mW=Zt(''),vW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=mW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},yW=Zt(''),bW=e=>{const t=gr(),r=()=>e.fill||t.colors.constant.white;return(()=>{const n=yW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},wW=Zt(''),_W=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=wW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},xW=Zt(''),SI=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=xW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=r(),s=r();return a!==i._v$&&Et(n,"fill",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},SW=Zt(''),c4=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.secondary;return(()=>{const n=SW.cloneNode(!0),o=n.firstChild;return Vt(()=>Et(o,"fill",r())),n})()},CW={m:"16px",s:"12px",none:"0"},EW={m:"6px",s:"6px",none:"0"},kW=je.div` width: 60px; height: 60px; padding: 8px; margin-bottom: 8px; - border-radius: ${e=>kW[e.theme.borderRadius]}; + border-radius: ${e=>CW[e.theme.borderRadius]}; background-color: ${e=>e.theme.colors.background.tint}; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 4px; -`,IW=je(_I)` +`,AW=je(xI)` width: 20px; height: 20px; - border-radius: ${e=>AW[e.theme.borderRadius]}; -`,SI=e=>ie(Ep,{get name(){return e.labelLine1},get secondLine(){return e.labelLine2},get icon(){return ie(MW,{get children(){return ie(Vd,{each:[0,1,2,3],children:t=>ie(IW,{get src(){return e.images[t]}})})}})},onClick:()=>e.onClick()}),Go="telegram-wallet",Qd={TON:"https://raw.githubusercontent.com/ton-connect/sdk/main/assets/ton-icon-48.png",TG:"https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png"},CI=e=>{const[t]=Bo(),r=()=>{if(e.wallet.appName!==Go){if("isPreferred"in e.wallet&&e.wallet.isPreferred)return t("walletItem.recent",{},"Recent");if(Vs(e.wallet))return t("walletItem.installed",{},"Installed");if(e.wallet.name==="Tonkeeper")return t("walletItem.popular",{},"Popular")}};return ft((()=>{const n=ft(()=>e.wallet.appName===Go);return()=>n()?ie(Ep,{get icon(){return e.wallet.imageUrl},get name(){return t("walletItem.walletOn",{},"Wallet On")},secondLine:"Telegram",get badgeUrl(){return Qd.TG},onClick:()=>e.onClick()}):ie(Ep,{get icon(){return e.wallet.imageUrl},get name(){return e.wallet.name},get secondLine(){return r()},secondLineColorPrimary:!1,onClick:()=>e.onClick()})})())},TW=je.div` + border-radius: ${e=>EW[e.theme.borderRadius]}; +`,CI=e=>ie(Ep,{get name(){return e.labelLine1},get secondLine(){return e.labelLine2},get icon(){return ie(kW,{get children(){return ie(Vd,{each:[0,1,2,3],children:t=>ie(AW,{get src(){return e.images[t]}})})}})},onClick:()=>e.onClick()}),Go="telegram-wallet",Qd={TON:"https://raw.githubusercontent.com/ton-connect/sdk/main/assets/ton-icon-48.png",TG:"https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png"},EI=e=>{const[t]=Bo(),r=()=>{if(e.wallet.appName!==Go){if("isPreferred"in e.wallet&&e.wallet.isPreferred)return t("walletItem.recent",{},"Recent");if(Vs(e.wallet))return t("walletItem.installed",{},"Installed");if(e.wallet.name==="Tonkeeper")return t("walletItem.popular",{},"Popular")}};return ft((()=>{const n=ft(()=>e.wallet.appName===Go);return()=>n()?ie(Ep,{get icon(){return e.wallet.imageUrl},get name(){return t("walletItem.walletOn",{},"Wallet On")},secondLine:"Telegram",get badgeUrl(){return Qd.TG},onClick:()=>e.onClick()}):ie(Ep,{get icon(){return e.wallet.imageUrl},get name(){return e.wallet.name},get secondLine(){return r()},secondLineColorPrimary:!1,onClick:()=>e.onClick()})})())},MW=je.div` width: 100%; overflow-y: auto; max-height: ${e=>e.maxHeight}; @@ -565,7 +565,7 @@ PERFORMANCE OF THIS SOFTWARE. &&::-webkit-scrollbar-thumb { display: none; } -`,BW=je.div` +`,IW=je.div` height: 1px; margin: 0 -24px; width: calc(100% + 48px); @@ -577,21 +577,21 @@ PERFORMANCE OF THIS SOFTWARE. width: 100%; margin: 0; } -`,[PW,RW]=Rt(((l7=fa())==null?void 0:l7.innerHeight)||0);fa()&&window.addEventListener("resize",()=>RW(window.innerHeight));const[Fu,OW]=Rt(fu("mobile")),kp=()=>OW(fu("mobile"));fa()&&(window.addEventListener("resize",()=>kp()),window.addEventListener("load",()=>kp(),{once:!0}));const EI=e=>{const[t,r]=Rt(!1),n=a=>{r(a.target.scrollTop>0)},o=()=>Fu()?150:200,i=()=>e.maxHeight!==void 0?`${e.maxHeight}px`:`${PW()-o()}px`;return[ie(BW,{get isShown(){return t()}}),ie(TW,{get maxHeight(){return i()},onScroll:n,get class(){return e.class},get children(){return e.children}})]},NW=je.a` +`,[TW,BW]=Rt(((u7=fa())==null?void 0:u7.innerHeight)||0);fa()&&window.addEventListener("resize",()=>BW(window.innerHeight));const[Fu,PW]=Rt(fu("mobile")),kp=()=>PW(fu("mobile"));fa()&&(window.addEventListener("resize",()=>kp()),window.addEventListener("load",()=>kp(),{once:!0}));const kI=e=>{const[t,r]=Rt(!1),n=a=>{r(a.target.scrollTop>0)},o=()=>Fu()?150:200,i=()=>e.maxHeight!==void 0?`${e.maxHeight}px`:`${TW()-o()}px`;return[ie(IW,{get isShown(){return t()}}),ie(MW,{get maxHeight(){return i()},onScroll:n,get class(){return e.class},get children(){return e.children}})]},RW=je.a` display: block; text-decoration: unset; -`,Ap=e=>ie(NW,bo({get href(){return e.href},get target(){return e.blank?"_blank":"_self"},get class(){return e.class}},()=>e.blank?{rel:"noreferrer noopener"}:{},{get children(){return e.children}})),ps=O1(),LW=Zt(''),DW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=LW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},UW=Zt(''),jW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=UW.cloneNode(!0),o=n.firstChild,i=o.nextSibling;return Vt(a=>{const s=r(),l=r();return s!==a._v$&&Et(o,"fill",a._v$=s),l!==a._v$2&&Et(i,"fill",a._v$2=l),a},{_v$:void 0,_v$2:void 0}),n})()},FW={m:"8px",s:"4px",none:"0"},zW={m:"16px",s:"8px",none:"0"},$W=je.div` +`,Ap=e=>ie(RW,bo({get href(){return e.href},get target(){return e.blank?"_blank":"_self"},get class(){return e.class}},()=>e.blank?{rel:"noreferrer noopener"}:{},{get children(){return e.children}})),ps=O1(),OW=Zt(''),NW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=OW.cloneNode(!0),o=n.firstChild;return Vt(i=>{const a=e.class,s=r();return a!==i._v$&&Et(n,"class",i._v$=a),s!==i._v$2&&Et(o,"fill",i._v$2=s),i},{_v$:void 0,_v$2:void 0}),n})()},LW=Zt(''),DW=e=>{const t=gr(),r=()=>e.fill||t.colors.icon.primary;return(()=>{const n=LW.cloneNode(!0),o=n.firstChild,i=o.nextSibling;return Vt(a=>{const s=r(),l=r();return s!==a._v$&&Et(o,"fill",a._v$=s),l!==a._v$2&&Et(i,"fill",a._v$2=l),a},{_v$:void 0,_v$2:void 0}),n})()},UW={m:"8px",s:"4px",none:"0"},jW={m:"16px",s:"8px",none:"0"},FW=je.div` width: 256px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16); - border-radius: ${e=>zW[e.theme.borderRadius]}; + border-radius: ${e=>jW[e.theme.borderRadius]}; background-color: ${e=>e.theme.colors.background.primary} color: ${e=>e.theme.colors.text.primary} -`,qW=je.ul` +`,zW=je.ul` background-color: ${e=>e.theme.colors.background.primary}; padding: 8px; -`,A7=je.button` +`,M7=je.button` display: flex; align-items: center; gap: 8px; @@ -601,7 +601,7 @@ PERFORMANCE OF THIS SOFTWARE. background-color: ${e=>e.theme.colors.background.primary}; border: none; - border-radius: ${e=>FW[e.theme.borderRadius]}; + border-radius: ${e=>UW[e.theme.borderRadius]}; cursor: pointer; transition: background-color, transform 0.1s ease-in-out; @@ -613,7 +613,7 @@ PERFORMANCE OF THIS SOFTWARE. &:active { transform: scale(0.96); } -`,M7=Zt("
  • "),p2=e=>ie(di,{get translationKey(){return e.translationKey},fontSize:"15px",fontWeight:"590",get children(){return e.children}}),WW=e=>{const t=$n(ps),[r,n]=Rt(!1),o=()=>ar(void 0,null,function*(){const a=Dw(t.account.address,t.account.chain===cd.TESTNET);yield Yw(a),n(!0),setTimeout(()=>n(!1),1e3)}),i=()=>{t.disconnect(),e.onClose()};return ie($W,{ref(a){const s=e.ref;typeof s=="function"?s(a):e.ref=a},get class(){return e.class},"data-tc-dropdown":"true",get children(){return ie(qW,{get children(){return[(()=>{const a=M7.cloneNode(!0);return An(a,ie(A7,{onClick:()=>o(),get children(){return[ie(DW,{}),ie(Dt,{get when(){return!r()},get children(){return ie(p2,{translationKey:"button.dropdown.copy",children:"Copy address"})}}),ie(Dt,{get when(){return r()},get children(){return ie(p2,{translationKey:"button.dropdown.copied",children:"Address copied!"})}})]}})),a})(),(()=>{const a=M7.cloneNode(!0);return An(a,ie(A7,{onClick:()=>i(),get children(){return[ie(jW,{}),ie(p2,{translationKey:"button.dropdown.disconnect",children:"Disconnect"})]}})),a})()]}})}})},VW={m:"16px",s:"8px",none:"0"},HW=je.div` +`,I7=Zt("
  • "),p2=e=>ie(di,{get translationKey(){return e.translationKey},fontSize:"15px",fontWeight:"590",get children(){return e.children}}),$W=e=>{const t=$n(ps),[r,n]=Rt(!1),o=()=>ar(void 0,null,function*(){const a=Lw(t.account.address,t.account.chain===cd.TESTNET);yield Gw(a),n(!0),setTimeout(()=>n(!1),1e3)}),i=()=>{t.disconnect(),e.onClose()};return ie(FW,{ref(a){const s=e.ref;typeof s=="function"?s(a):e.ref=a},get class(){return e.class},"data-tc-dropdown":"true",get children(){return ie(zW,{get children(){return[(()=>{const a=I7.cloneNode(!0);return An(a,ie(M7,{onClick:()=>o(),get children(){return[ie(NW,{}),ie(Dt,{get when(){return!r()},get children(){return ie(p2,{translationKey:"button.dropdown.copy",children:"Copy address"})}}),ie(Dt,{get when(){return r()},get children(){return ie(p2,{translationKey:"button.dropdown.copied",children:"Address copied!"})}})]}})),a})(),(()=>{const a=I7.cloneNode(!0);return An(a,ie(M7,{onClick:()=>i(),get children(){return[ie(DW,{}),ie(p2,{translationKey:"button.dropdown.disconnect",children:"Disconnect"})]}})),a})()]}})}})},qW={m:"16px",s:"8px",none:"0"},WW=je.div` width: 256px; padding: 12px 16px; display: flex; @@ -621,26 +621,26 @@ PERFORMANCE OF THIS SOFTWARE. background-color: ${e=>e.theme.colors.background.primary}; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16); - border-radius: ${e=>VW[e.theme.borderRadius]}; -`,KW=je.div` + border-radius: ${e=>qW[e.theme.borderRadius]}; +`,VW=je.div` width: 192px; > h3 { font-size: 15px; } -`,ZW=je(di)` +`,HW=je(di)` margin-top: 4px; color: ${e=>e.theme.colors.text.secondary}; -`,Jw=e=>{const t=Yd(e);return ie(HW,bo({get class(){return e.class},"data-tc-notification":"true"},t,{get children(){return[ie(KW,{get children(){return[ie(Qw,{get translationKey(){return e.header.translationKey},get translationValues(){return e.header.translationValues},get children(){return e.children}}),ie(Dt,{get when(){return e.text},get children(){return ie(ZW,{get translationKey(){return e.text.translationKey},get translationValues(){return e.text.translationValues}})}})]}}),ft(()=>e.icon)]}}))},GW=je(da)` +`,Xw=e=>{const t=Yd(e);return ie(WW,bo({get class(){return e.class},"data-tc-notification":"true"},t,{get children(){return[ie(VW,{get children(){return[ie(Yw,{get translationKey(){return e.header.translationKey},get translationValues(){return e.header.translationValues},get children(){return e.children}}),ie(Dt,{get when(){return e.text},get children(){return ie(HW,{get translationKey(){return e.text.translationKey},get translationValues(){return e.text.translationValues}})}})]}}),ft(()=>e.icon)]}}))},KW=je(da)` align-self: center; -`,YW=e=>{const t=$n(ps),[r]=Bo(),n=()=>t.wallet&&"name"in t.wallet?t.wallet.name:r("common.yourWallet",{},"Your wallet");return ie(Jw,{get header(){return{translationKey:"notifications.confirm.header",translationValues:{name:n()}}},get class(){return e.class},get icon(){return ie(GW,{})},"data-tc-notification-confirm":"true",children:"Confirm operation in your wallet"})},QW=je(j1)` +`,ZW=e=>{const t=$n(ps),[r]=Bo(),n=()=>t.wallet&&"name"in t.wallet?t.wallet.name:r("common.yourWallet",{},"Your wallet");return ie(Xw,{get header(){return{translationKey:"notifications.confirm.header",translationValues:{name:n()}}},get class(){return e.class},get icon(){return ie(KW,{})},"data-tc-notification-confirm":"true",children:"Confirm operation in your wallet"})},GW=je(j1)` margin-top: 2px; -`,XW=e=>ie(Jw,{header:{translationKey:"notifications.transactionCanceled.header"},text:{translationKey:"notifications.transactionCanceled.text"},get icon(){return ie(QW,{size:"xs"})},get class(){return e.class},"data-tc-notification-tx-cancelled":"true",children:"Transaction cancelled"}),JW=je(Xw)` +`,YW=e=>ie(Xw,{header:{translationKey:"notifications.transactionCanceled.header"},text:{translationKey:"notifications.transactionCanceled.text"},get icon(){return ie(GW,{size:"xs"})},get class(){return e.class},"data-tc-notification-tx-cancelled":"true",children:"Transaction cancelled"}),QW=je(Qw)` margin-top: 2px; -`,eV=e=>ie(Jw,{header:{translationKey:"notifications.transactionSent.header"},text:{translationKey:"notifications.transactionSent.text"},get icon(){return ie(JW,{})},get class(){return e.class},"data-tc-notification-tx-sent":"true",children:"Transaction sent"}),g2=oa` +`,XW=e=>ie(Xw,{header:{translationKey:"notifications.transactionSent.header"},text:{translationKey:"notifications.transactionSent.text"},get icon(){return ie(QW,{})},get class(){return e.class},"data-tc-notification-tx-sent":"true",children:"Transaction sent"}),g2=oa` transform: translateY(-8px); margin-bottom: 12px; -`,tV={timeout:4500},[I7,rV]=Rt(null);function nV(e){const{timeout:t}=ur(ur({},tV),e),[r,n]=Rt([]),[o,i]=Rt([]);return ln(uz(Fo,a=>{var s;if(!a||!a.showNotification||I7()===a||((s=I7())==null?void 0:s.name)==="confirm-transaction"&&a.name==="confirm-transaction")return;rV(a),n(c=>c.filter(h=>h.action!=="confirm-transaction"));const l={action:a.name};n(c=>[...c,l]);const u=setTimeout(()=>{n(c=>c.filter(h=>h!==l)),i(c=>c.filter(h=>h!==u))},t);i(c=>[...c,u])})),zn(()=>{o().forEach(a=>clearTimeout(a))}),r}const iV=Zt('
    '),oV=e=>{const t=nV();return(()=>{const r=iV.cloneNode(!0);return An(r,ie(W$,{onBeforeEnter:n=>{po(n,[{opacity:0,transform:"translateY(0)"},{opacity:1,transform:"translateY(-8px)"}],{duration:200})},onExit:(n,o)=>{po(n,[{opacity:1,transform:"translateY(-8px)"},{opacity:0,transform:"translateY(-30px)"}],{duration:200}).finished.then(o)},get children(){return ie(Vd,{get each(){return t()},children:n=>ie(Hd,{get children(){return[ie(pn,{get when(){return n.action==="transaction-sent"},get children(){return ie(eV,{class:g2})}}),ie(pn,{get when(){return n.action==="transaction-canceled"},get children(){return ie(XW,{class:g2})}}),ie(pn,{get when(){return n.action==="confirm-transaction"},get children(){return ie(YW,{class:g2})}})]}})})}})),Vt(()=>Fw(r,e.class)),r})()},kI=je($r)` +`,JW={timeout:4500},[T7,eV]=Rt(null);function tV(e){const{timeout:t}=ur(ur({},JW),e),[r,n]=Rt([]),[o,i]=Rt([]);return ln(sz(Fo,a=>{var s;if(!a||!a.showNotification||T7()===a||((s=T7())==null?void 0:s.name)==="confirm-transaction"&&a.name==="confirm-transaction")return;eV(a),n(c=>c.filter(h=>h.action!=="confirm-transaction"));const l={action:a.name};n(c=>[...c,l]);const u=setTimeout(()=>{n(c=>c.filter(h=>h!==l)),i(c=>c.filter(h=>h!==u))},t);i(c=>[...c,u])})),zn(()=>{o().forEach(a=>clearTimeout(a))}),r}const rV=Zt('
    '),nV=e=>{const t=tV();return(()=>{const r=rV.cloneNode(!0);return An(r,ie($$,{onBeforeEnter:n=>{po(n,[{opacity:0,transform:"translateY(0)"},{opacity:1,transform:"translateY(-8px)"}],{duration:200})},onExit:(n,o)=>{po(n,[{opacity:1,transform:"translateY(-8px)"},{opacity:0,transform:"translateY(-30px)"}],{duration:200}).finished.then(o)},get children(){return ie(Vd,{get each(){return t()},children:n=>ie(Hd,{get children(){return[ie(pn,{get when(){return n.action==="transaction-sent"},get children(){return ie(XW,{class:g2})}}),ie(pn,{get when(){return n.action==="transaction-canceled"},get children(){return ie(YW,{class:g2})}}),ie(pn,{get when(){return n.action==="confirm-transaction"},get children(){return ie(ZW,{class:g2})}})]}})})}})),Vt(()=>jw(r,e.class)),r})()},AI=je($r)` background-color: ${e=>e.theme.colors.connectButton.background}; color: ${e=>e.theme.colors.connectButton.foreground}; box-shadow: ${e=>`0 4px 24px ${Kd(e.theme.colors.constant.black,.16)}`}; @@ -650,12 +650,12 @@ PERFORMANCE OF THIS SOFTWARE. align-items: center; gap: 4px; height: 40px; -`,aV=je(kI)` +`,iV=je(AI)` padding: 12px 16px; min-width: 148px; justify-content: center; background-color: ${e=>e.theme.colors.background.primary}; -`,sV=je($r)` +`,oV=je($r)` min-width: 148px; height: 40px; @@ -666,23 +666,23 @@ PERFORMANCE OF THIS SOFTWARE. display: flex; align-items: center; justify-content: center; -`,lV=je(da)` +`,aV=je(da)` height: 18px; width: 18px; -`,uV=je.div` +`,sV=je.div` width: fit-content; display: flex; flex-direction: column; align-items: flex-end; -`,cV=je(WW)` +`,lV=je($W)` box-sizing: border-box; overflow: hidden; margin-top: 12px; -`,fV=je(oV)` +`,uV=je(nV)` > div:first-child { margin-top: 20px; } -`;function AI(e){return e.split("-")[0]}function dV(e){return e.split("-")[1]}function hV(e){return["top","bottom"].includes(AI(e))?"x":"y"}function pV(e){return e==="y"?"height":"width"}function T7(e,t,r){let{reference:n,floating:o}=e;const i=n.x+n.width/2-o.width/2,a=n.y+n.height/2-o.height/2,s=hV(t),l=pV(s),u=n[l]/2-o[l]/2,c=AI(t),h=s==="x";let d;switch(c){case"top":d={x:i,y:n.y-o.height};break;case"bottom":d={x:i,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:a};break;case"left":d={x:n.x-o.width,y:a};break;default:d={x:n.x,y:n.y}}switch(dV(t)){case"start":d[s]-=u*(r&&h?-1:1);break;case"end":d[s]+=u*(r&&h?-1:1);break}return d}const gV=(e,t,r)=>ar(void 0,null,function*(){const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),l=yield a.isRTL==null?void 0:a.isRTL(t);if({}.NODE_ENV!=="production"){if(a==null&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),s.filter(b=>{let{name:S}=b;return S==="autoPlacement"||S==="flip"}).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));(!e||!t)&&console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let u=yield a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:h}=T7(u,n,l),d=n,p={},v=0;for(let b=0;b50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),L&&v<=50){v++,typeof L=="object"&&(L.placement&&(d=L.placement),L.rects&&(u=L.rects===!0?yield a.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:c,y:h}=T7(u,d,l)),b=-1;continue}}return{x:c,y:h,placement:d,strategy:o,middlewareData:p}});function B7(e){return ui(ur({},e),{top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height})}function ha(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Co(e){return ha(e).getComputedStyle(e)}function rs(e){return II(e)?(e.nodeName||"").toLowerCase():""}let Kh;function MI(){if(Kh)return Kh;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Kh=e.brands.map(t=>t.brand+"/"+t.version).join(" "),Kh):navigator.userAgent}function Eo(e){return e instanceof ha(e).HTMLElement}function Ii(e){return e instanceof ha(e).Element}function II(e){return e instanceof ha(e).Node}function P7(e){if(typeof ShadowRoot>"u")return!1;const t=ha(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function F1(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=Co(e);return/auto|scroll|overlay|hidden/.test(t+n+r)&&!["inline","contents"].includes(o)}function mV(e){return["table","td","th"].includes(rs(e))}function e5(e){const t=/firefox/i.test(MI()),r=Co(e),n=r.backdropFilter||r.WebkitBackdropFilter;return r.transform!=="none"||r.perspective!=="none"||(n?n!=="none":!1)||t&&r.willChange==="filter"||t&&(r.filter?r.filter!=="none":!1)||["transform","perspective"].some(o=>r.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{const i=r.contain;return i!=null?i.includes(o):!1})}function TI(){return!/^((?!chrome|android).)*safari/i.test(MI())}function t5(e){return["html","body","#document"].includes(rs(e))}const R7=Math.min,Nf=Math.max,O7=Math.round,d4={x:1,y:1};function md(e){const t=!Ii(e)&&e.contextElement?e.contextElement:Ii(e)?e:null;if(!t)return d4;const r=t.getBoundingClientRect(),n=Co(t);if(n.boxSizing!=="border-box")return Eo(t)?{x:t.offsetWidth>0&&O7(r.width)/t.offsetWidth||1,y:t.offsetHeight>0&&O7(r.height)/t.offsetHeight||1}:d4;let o=r.width/parseFloat(n.width),i=r.height/parseFloat(n.height);return(!o||!Number.isFinite(o))&&(o=1),(!i||!Number.isFinite(i))&&(i=1),{x:o,y:i}}function ns(e,t,r,n){var o,i,a,s;t===void 0&&(t=!1),r===void 0&&(r=!1);const l=e.getBoundingClientRect();let u=d4;t&&(n?Ii(n)&&(u=md(n)):u=md(e));const c=Ii(e)?ha(e):window,h=!TI()&&r,d=(l.left+(h&&(o=(i=c.visualViewport)==null?void 0:i.offsetLeft)!=null?o:0))/u.x,p=(l.top+(h&&(a=(s=c.visualViewport)==null?void 0:s.offsetTop)!=null?a:0))/u.y,v=l.width/u.x,b=l.height/u.y;return{width:v,height:b,top:p,right:d+v,bottom:p+b,left:d,x:d,y:p}}function gs(e){return((II(e)?e.ownerDocument:e.document)||window.document).documentElement}function z1(e){return Ii(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function BI(e){return ns(gs(e)).left+z1(e).scrollLeft}function vV(e,t,r){const n=Eo(t),o=gs(t),i=ns(e,!0,r==="fixed",t);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(n||!n&&r!=="fixed")if((rs(t)!=="body"||F1(o))&&(a=z1(t)),Eo(t)){const l=ns(t,!0);s.x=l.x+t.clientLeft,s.y=l.y+t.clientTop}else o&&(s.x=BI(o));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function vd(e){if(rs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||(P7(e)?e.host:null)||gs(e);return P7(t)?t.host:t}function N7(e){return!Eo(e)||Co(e).position==="fixed"?null:e.offsetParent}function yV(e){let t=vd(e);for(;Eo(t)&&!t5(t);){if(e5(t))return t;t=vd(t)}return null}function L7(e){const t=ha(e);let r=N7(e);for(;r&&mV(r)&&Co(r).position==="static";)r=N7(r);return r&&(rs(r)==="html"||rs(r)==="body"&&Co(r).position==="static"&&!e5(r))?t:r||yV(e)||t}function bV(e){if(Eo(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=ns(e);return{width:t.width,height:t.height}}function wV(e){let{rect:t,offsetParent:r,strategy:n}=e;const o=Eo(r),i=gs(r);if(r===i)return t;let a={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((o||!o&&n!=="fixed")&&((rs(r)!=="body"||F1(i))&&(a=z1(r)),Eo(r))){const u=ns(r);s=md(r),l.x=u.x+r.clientLeft,l.y=u.y+r.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-a.scrollLeft*s.x+l.x,y:t.y*s.y-a.scrollTop*s.y+l.y}}function _V(e,t){const r=ha(e),n=gs(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const u=TI();(u||!u&&t==="fixed")&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}function xV(e){var t;const r=gs(e),n=z1(e),o=(t=e.ownerDocument)==null?void 0:t.body,i=Nf(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Nf(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let s=-n.scrollLeft+BI(e);const l=-n.scrollTop;return Co(o||r).direction==="rtl"&&(s+=Nf(r.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}function PI(e){const t=vd(e);return t5(t)?e.ownerDocument.body:Eo(t)&&F1(t)?t:PI(t)}function Lf(e,t){var r;t===void 0&&(t=[]);const n=PI(e),o=n===((r=e.ownerDocument)==null?void 0:r.body),i=ha(n);return o?t.concat(i,i.visualViewport||[],F1(n)?n:[]):t.concat(n,Lf(n))}function SV(e,t){const r=ns(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=Eo(e)?md(e):{x:1,y:1},a=e.clientWidth*i.x,s=e.clientHeight*i.y,l=o*i.x,u=n*i.y;return{top:u,left:l,right:l+a,bottom:u+s,x:l,y:u,width:a,height:s}}function D7(e,t,r){return t==="viewport"?B7(_V(e,r)):Ii(t)?SV(t,r):B7(xV(gs(e)))}function CV(e,t){const r=t.get(e);if(r)return r;let n=Lf(e).filter(s=>Ii(s)&&rs(s)!=="body"),o=null;const i=Co(e).position==="fixed";let a=i?vd(e):e;for(;Ii(a)&&!t5(a);){const s=Co(a),l=e5(a);(i?!l&&!o:!l&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position))?n=n.filter(c=>c!==a):o=s,a=vd(a)}return t.set(e,n),n}function EV(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?CV(t,this._c):[].concat(r),n],s=a[0],l=a.reduce((u,c)=>{const h=D7(t,c,o);return u.top=Nf(h.top,u.top),u.right=R7(h.right,u.right),u.bottom=R7(h.bottom,u.bottom),u.left=Nf(h.left,u.left),u},D7(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}const kV={getClippingRect:EV,convertOffsetParentRelativeRectToViewportRelativeRect:wV,isElement:Ii,getDimensions:bV,getOffsetParent:L7,getDocumentElement:gs,getScale:md,getElementRects(e){return ar(this,null,function*(){let{reference:t,floating:r,strategy:n}=e;const o=this.getOffsetParent||L7,i=this.getDimensions;return{reference:vV(t,yield o(r),n),floating:ur({x:0,y:0},yield i(r))}})},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Co(e).direction==="rtl"};function AV(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=n,l=o&&!s,u=l||i?[...Ii(e)?Lf(e):e.contextElement?Lf(e.contextElement):[],...Lf(t)]:[];u.forEach(v=>{l&&v.addEventListener("scroll",r,{passive:!0}),i&&v.addEventListener("resize",r)});let c=null;if(a){let v=!0;c=new ResizeObserver(()=>{v||r(),v=!1}),Ii(e)&&!s&&c.observe(e),!Ii(e)&&e.contextElement&&!s&&c.observe(e.contextElement),c.observe(t)}let h,d=s?ns(e):null;s&&p();function p(){const v=ns(e);d&&(v.x!==d.x||v.y!==d.y||v.width!==d.width||v.height!==d.height)&&r(),d=v,h=requestAnimationFrame(p)}return r(),()=>{var v;u.forEach(b=>{l&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),(v=c)==null||v.disconnect(),c=null,s&&cancelAnimationFrame(h)}}const MV=(e,t,r)=>{const n=new Map,o=ur({platform:kV},r),i=ui(ur({},o.platform),{_c:n});return gV(e,t,ui(ur({},o),{platform:i}))};function IV(e,t,r){let n=()=>{var h;return(h=r==null?void 0:r.placement)!=null?h:"bottom"},o=()=>{var h;return(h=r==null?void 0:r.strategy)!=null?h:"absolute"},[i,a]=Rt({x:null,y:null,placement:n(),strategy:o(),middlewareData:{}}),[s,l]=Rt();ln(()=>{let h=s();if(h)throw h.value});let u=ft(()=>(e(),t(),{}));function c(){let h=e(),d=t();if(h&&d){let p=u();MV(h,d,{middleware:r==null?void 0:r.middleware,placement:n(),strategy:o()}).then(v=>{p===u()&&a(v)},v=>{l(v)})}}return ln(()=>{let h=e(),d=t();if(r==null||r.middleware,n(),o(),h&&d)if(r!=null&&r.whileElementsMounted){let p=r.whileElementsMounted(h,d,c);p&&zn(p)}else c()}),{get x(){return i().x},get y(){return i().y},get placement(){return i().placement},get strategy(){return i().strategy},get middlewareData(){return i().middlewareData},update:c}}const TV=Zt(''),BV=()=>{const e=gr(),t=$n(ac),r=$n(ps),[n,o]=Rt(!1),[i,a]=Rt(t.account),[s,l]=Rt(!t.account);let u;const[c,h]=Rt(),[d,p]=Rt(),v=IV(d,c,{whileElementsMounted:AV,placement:"bottom-end"}),b=()=>{const k=i();if(k){const M=Dw(k.address,k.chain===cd.TESTNET);return M.slice(0,4)+"…"+M.slice(-4)}return""};r.connectionRestored.then(()=>l(!1));const S=t.onStatusChange(k=>{if(!k){o(!1),a(null),l(!1);return}a(k.account),l(!1)}),x=k=>{if(!i()||!n())return;const M=d().contains(k.target),P=u.contains(k.target);!M&&!P&&o(!1)};return cz(()=>{document.body.addEventListener("click",x)}),zn(()=>{document.body.removeEventListener("click",x),S()}),ie(Uu,{component:jo,get children(){return[ie(Dt,{get when(){return s()},get children(){return ie(sV,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return ie(lV,{})}})}}),ie(Dt,{get when(){return!s()},get children(){return[ie(Dt,{get when(){return!i()},get children(){return ie(kI,{onClick:()=>r.openModal(),"data-tc-connect-button":"true",scale:"s",get children(){return[ie(Wq,{get fill(){return e.colors.connectButton.foreground}}),ie(di,{translationKey:"button.connectWallet",fontSize:"15px",lineHeight:"18px",fontWeight:"590",get color(){return e.colors.connectButton.foreground},children:"Connect wallet"})]}})}}),ie(Dt,{get when(){return i()},get children(){return ie(uV,{get children(){return[ie(aV,{onClick:()=>o(k=>!k),ref:p,"data-tc-dropdown-button":"true",scale:"s",get children(){return[ie(di,{fontSize:"15px",fontWeight:"590",lineHeight:"18px",get children(){return b()}}),ie(gI,{direction:"bottom"})]}}),ie(JM,{get children(){const k=un(()=>document.importNode(TV,!0));return Rf(h,k),k.style.setProperty("z-index","999"),k._$owner=fz(),An(k,ie(Gw,{onBeforeEnter:M=>{po(M,[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"translateY(0)"}],{duration:150})},onExit:(M,P)=>{po(M,[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:"translateY(-8px)"}],{duration:150}).finished.then(P)},get children(){return ie(Dt,{get when(){return n()},get children(){return ie(cV,{get hidden(){return!n()},onClose:()=>o(!1),ref(M){const P=u;typeof P=="function"?P(M):u=M}})}})}}),null),An(k,ie(fV,{}),null),Vt(M=>{var P,L;const j=v.strategy,V=`${(P=v.y)!=null?P:0}px`,K=`${(L=v.x)!=null?L:0}px`;return j!==M._v$&&k.style.setProperty("position",M._v$=j),V!==M._v$2&&k.style.setProperty("top",M._v$2=V),K!==M._v$3&&k.style.setProperty("left",M._v$3=K),M},{_v$:void 0,_v$2:void 0,_v$3:void 0}),k}})]}})}})]}})]}})},RI=je(vI)` +`;function MI(e){return e.split("-")[0]}function cV(e){return e.split("-")[1]}function fV(e){return["top","bottom"].includes(MI(e))?"x":"y"}function dV(e){return e==="y"?"height":"width"}function B7(e,t,r){let{reference:n,floating:o}=e;const i=n.x+n.width/2-o.width/2,a=n.y+n.height/2-o.height/2,s=fV(t),l=dV(s),u=n[l]/2-o[l]/2,c=MI(t),h=s==="x";let d;switch(c){case"top":d={x:i,y:n.y-o.height};break;case"bottom":d={x:i,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:a};break;case"left":d={x:n.x-o.width,y:a};break;default:d={x:n.x,y:n.y}}switch(cV(t)){case"start":d[s]-=u*(r&&h?-1:1);break;case"end":d[s]+=u*(r&&h?-1:1);break}return d}const hV=(e,t,r)=>ar(void 0,null,function*(){const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),l=yield a.isRTL==null?void 0:a.isRTL(t);if({}.NODE_ENV!=="production"){if(a==null&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),s.filter(b=>{let{name:S}=b;return S==="autoPlacement"||S==="flip"}).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));(!e||!t)&&console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let u=yield a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:h}=B7(u,n,l),d=n,p={},v=0;for(let b=0;b50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),L&&v<=50){v++,typeof L=="object"&&(L.placement&&(d=L.placement),L.rects&&(u=L.rects===!0?yield a.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:c,y:h}=B7(u,d,l)),b=-1;continue}}return{x:c,y:h,placement:d,strategy:o,middlewareData:p}});function P7(e){return ui(ur({},e),{top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height})}function ha(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Co(e){return ha(e).getComputedStyle(e)}function rs(e){return TI(e)?(e.nodeName||"").toLowerCase():""}let Kh;function II(){if(Kh)return Kh;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Kh=e.brands.map(t=>t.brand+"/"+t.version).join(" "),Kh):navigator.userAgent}function Eo(e){return e instanceof ha(e).HTMLElement}function Ii(e){return e instanceof ha(e).Element}function TI(e){return e instanceof ha(e).Node}function R7(e){if(typeof ShadowRoot>"u")return!1;const t=ha(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function F1(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=Co(e);return/auto|scroll|overlay|hidden/.test(t+n+r)&&!["inline","contents"].includes(o)}function pV(e){return["table","td","th"].includes(rs(e))}function Jw(e){const t=/firefox/i.test(II()),r=Co(e),n=r.backdropFilter||r.WebkitBackdropFilter;return r.transform!=="none"||r.perspective!=="none"||(n?n!=="none":!1)||t&&r.willChange==="filter"||t&&(r.filter?r.filter!=="none":!1)||["transform","perspective"].some(o=>r.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{const i=r.contain;return i!=null?i.includes(o):!1})}function BI(){return!/^((?!chrome|android).)*safari/i.test(II())}function e5(e){return["html","body","#document"].includes(rs(e))}const O7=Math.min,Nf=Math.max,N7=Math.round,f4={x:1,y:1};function md(e){const t=!Ii(e)&&e.contextElement?e.contextElement:Ii(e)?e:null;if(!t)return f4;const r=t.getBoundingClientRect(),n=Co(t);if(n.boxSizing!=="border-box")return Eo(t)?{x:t.offsetWidth>0&&N7(r.width)/t.offsetWidth||1,y:t.offsetHeight>0&&N7(r.height)/t.offsetHeight||1}:f4;let o=r.width/parseFloat(n.width),i=r.height/parseFloat(n.height);return(!o||!Number.isFinite(o))&&(o=1),(!i||!Number.isFinite(i))&&(i=1),{x:o,y:i}}function ns(e,t,r,n){var o,i,a,s;t===void 0&&(t=!1),r===void 0&&(r=!1);const l=e.getBoundingClientRect();let u=f4;t&&(n?Ii(n)&&(u=md(n)):u=md(e));const c=Ii(e)?ha(e):window,h=!BI()&&r,d=(l.left+(h&&(o=(i=c.visualViewport)==null?void 0:i.offsetLeft)!=null?o:0))/u.x,p=(l.top+(h&&(a=(s=c.visualViewport)==null?void 0:s.offsetTop)!=null?a:0))/u.y,v=l.width/u.x,b=l.height/u.y;return{width:v,height:b,top:p,right:d+v,bottom:p+b,left:d,x:d,y:p}}function gs(e){return((TI(e)?e.ownerDocument:e.document)||window.document).documentElement}function z1(e){return Ii(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function PI(e){return ns(gs(e)).left+z1(e).scrollLeft}function gV(e,t,r){const n=Eo(t),o=gs(t),i=ns(e,!0,r==="fixed",t);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(n||!n&&r!=="fixed")if((rs(t)!=="body"||F1(o))&&(a=z1(t)),Eo(t)){const l=ns(t,!0);s.x=l.x+t.clientLeft,s.y=l.y+t.clientTop}else o&&(s.x=PI(o));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function vd(e){if(rs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||(R7(e)?e.host:null)||gs(e);return R7(t)?t.host:t}function L7(e){return!Eo(e)||Co(e).position==="fixed"?null:e.offsetParent}function mV(e){let t=vd(e);for(;Eo(t)&&!e5(t);){if(Jw(t))return t;t=vd(t)}return null}function D7(e){const t=ha(e);let r=L7(e);for(;r&&pV(r)&&Co(r).position==="static";)r=L7(r);return r&&(rs(r)==="html"||rs(r)==="body"&&Co(r).position==="static"&&!Jw(r))?t:r||mV(e)||t}function vV(e){if(Eo(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=ns(e);return{width:t.width,height:t.height}}function yV(e){let{rect:t,offsetParent:r,strategy:n}=e;const o=Eo(r),i=gs(r);if(r===i)return t;let a={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((o||!o&&n!=="fixed")&&((rs(r)!=="body"||F1(i))&&(a=z1(r)),Eo(r))){const u=ns(r);s=md(r),l.x=u.x+r.clientLeft,l.y=u.y+r.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-a.scrollLeft*s.x+l.x,y:t.y*s.y-a.scrollTop*s.y+l.y}}function bV(e,t){const r=ha(e),n=gs(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const u=BI();(u||!u&&t==="fixed")&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}function wV(e){var t;const r=gs(e),n=z1(e),o=(t=e.ownerDocument)==null?void 0:t.body,i=Nf(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Nf(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let s=-n.scrollLeft+PI(e);const l=-n.scrollTop;return Co(o||r).direction==="rtl"&&(s+=Nf(r.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}function RI(e){const t=vd(e);return e5(t)?e.ownerDocument.body:Eo(t)&&F1(t)?t:RI(t)}function Lf(e,t){var r;t===void 0&&(t=[]);const n=RI(e),o=n===((r=e.ownerDocument)==null?void 0:r.body),i=ha(n);return o?t.concat(i,i.visualViewport||[],F1(n)?n:[]):t.concat(n,Lf(n))}function _V(e,t){const r=ns(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=Eo(e)?md(e):{x:1,y:1},a=e.clientWidth*i.x,s=e.clientHeight*i.y,l=o*i.x,u=n*i.y;return{top:u,left:l,right:l+a,bottom:u+s,x:l,y:u,width:a,height:s}}function U7(e,t,r){return t==="viewport"?P7(bV(e,r)):Ii(t)?_V(t,r):P7(wV(gs(e)))}function xV(e,t){const r=t.get(e);if(r)return r;let n=Lf(e).filter(s=>Ii(s)&&rs(s)!=="body"),o=null;const i=Co(e).position==="fixed";let a=i?vd(e):e;for(;Ii(a)&&!e5(a);){const s=Co(a),l=Jw(a);(i?!l&&!o:!l&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position))?n=n.filter(c=>c!==a):o=s,a=vd(a)}return t.set(e,n),n}function SV(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?xV(t,this._c):[].concat(r),n],s=a[0],l=a.reduce((u,c)=>{const h=U7(t,c,o);return u.top=Nf(h.top,u.top),u.right=O7(h.right,u.right),u.bottom=O7(h.bottom,u.bottom),u.left=Nf(h.left,u.left),u},U7(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}const CV={getClippingRect:SV,convertOffsetParentRelativeRectToViewportRelativeRect:yV,isElement:Ii,getDimensions:vV,getOffsetParent:D7,getDocumentElement:gs,getScale:md,getElementRects(e){return ar(this,null,function*(){let{reference:t,floating:r,strategy:n}=e;const o=this.getOffsetParent||D7,i=this.getDimensions;return{reference:gV(t,yield o(r),n),floating:ur({x:0,y:0},yield i(r))}})},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Co(e).direction==="rtl"};function EV(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=n,l=o&&!s,u=l||i?[...Ii(e)?Lf(e):e.contextElement?Lf(e.contextElement):[],...Lf(t)]:[];u.forEach(v=>{l&&v.addEventListener("scroll",r,{passive:!0}),i&&v.addEventListener("resize",r)});let c=null;if(a){let v=!0;c=new ResizeObserver(()=>{v||r(),v=!1}),Ii(e)&&!s&&c.observe(e),!Ii(e)&&e.contextElement&&!s&&c.observe(e.contextElement),c.observe(t)}let h,d=s?ns(e):null;s&&p();function p(){const v=ns(e);d&&(v.x!==d.x||v.y!==d.y||v.width!==d.width||v.height!==d.height)&&r(),d=v,h=requestAnimationFrame(p)}return r(),()=>{var v;u.forEach(b=>{l&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),(v=c)==null||v.disconnect(),c=null,s&&cancelAnimationFrame(h)}}const kV=(e,t,r)=>{const n=new Map,o=ur({platform:CV},r),i=ui(ur({},o.platform),{_c:n});return hV(e,t,ui(ur({},o),{platform:i}))};function AV(e,t,r){let n=()=>{var h;return(h=r==null?void 0:r.placement)!=null?h:"bottom"},o=()=>{var h;return(h=r==null?void 0:r.strategy)!=null?h:"absolute"},[i,a]=Rt({x:null,y:null,placement:n(),strategy:o(),middlewareData:{}}),[s,l]=Rt();ln(()=>{let h=s();if(h)throw h.value});let u=ft(()=>(e(),t(),{}));function c(){let h=e(),d=t();if(h&&d){let p=u();kV(h,d,{middleware:r==null?void 0:r.middleware,placement:n(),strategy:o()}).then(v=>{p===u()&&a(v)},v=>{l(v)})}}return ln(()=>{let h=e(),d=t();if(r==null||r.middleware,n(),o(),h&&d)if(r!=null&&r.whileElementsMounted){let p=r.whileElementsMounted(h,d,c);p&&zn(p)}else c()}),{get x(){return i().x},get y(){return i().y},get placement(){return i().placement},get strategy(){return i().strategy},get middlewareData(){return i().middlewareData},update:c}}const MV=Zt(''),IV=()=>{const e=gr(),t=$n(ac),r=$n(ps),[n,o]=Rt(!1),[i,a]=Rt(t.account),[s,l]=Rt(!t.account);let u;const[c,h]=Rt(),[d,p]=Rt(),v=AV(d,c,{whileElementsMounted:EV,placement:"bottom-end"}),b=()=>{const k=i();if(k){const M=Lw(k.address,k.chain===cd.TESTNET);return M.slice(0,4)+"…"+M.slice(-4)}return""};r.connectionRestored.then(()=>l(!1));const S=t.onStatusChange(k=>{if(!k){o(!1),a(null),l(!1);return}a(k.account),l(!1)}),x=k=>{if(!i()||!n())return;const M=d().contains(k.target),P=u.contains(k.target);!M&&!P&&o(!1)};return lz(()=>{document.body.addEventListener("click",x)}),zn(()=>{document.body.removeEventListener("click",x),S()}),ie(Uu,{component:jo,get children(){return[ie(Dt,{get when(){return s()},get children(){return ie(oV,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return ie(aV,{})}})}}),ie(Dt,{get when(){return!s()},get children(){return[ie(Dt,{get when(){return!i()},get children(){return ie(AI,{onClick:()=>r.openModal(),"data-tc-connect-button":"true",scale:"s",get children(){return[ie($q,{get fill(){return e.colors.connectButton.foreground}}),ie(di,{translationKey:"button.connectWallet",fontSize:"15px",lineHeight:"18px",fontWeight:"590",get color(){return e.colors.connectButton.foreground},children:"Connect wallet"})]}})}}),ie(Dt,{get when(){return i()},get children(){return ie(sV,{get children(){return[ie(iV,{onClick:()=>o(k=>!k),ref:p,"data-tc-dropdown-button":"true",scale:"s",get children(){return[ie(di,{fontSize:"15px",fontWeight:"590",lineHeight:"18px",get children(){return b()}}),ie(mI,{direction:"bottom"})]}}),ie(eI,{get children(){const k=un(()=>document.importNode(MV,!0));return Rf(h,k),k.style.setProperty("z-index","999"),k._$owner=uz(),An(k,ie(Zw,{onBeforeEnter:M=>{po(M,[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"translateY(0)"}],{duration:150})},onExit:(M,P)=>{po(M,[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:"translateY(-8px)"}],{duration:150}).finished.then(P)},get children(){return ie(Dt,{get when(){return n()},get children(){return ie(lV,{get hidden(){return!n()},onClose:()=>o(!1),ref(M){const P=u;typeof P=="function"?P(M):u=M}})}})}}),null),An(k,ie(uV,{}),null),Vt(M=>{var P,L;const j=v.strategy,V=`${(P=v.y)!=null?P:0}px`,K=`${(L=v.x)!=null?L:0}px`;return j!==M._v$&&k.style.setProperty("position",M._v$=j),V!==M._v$2&&k.style.setProperty("top",M._v$2=V),K!==M._v$3&&k.style.setProperty("left",M._v$3=K),M},{_v$:void 0,_v$2:void 0,_v$3:void 0}),k}})]}})}})]}})]}})},OI=je(yI)` padding-left: 24px; padding-right: 24px; padding-top: 18px; @@ -694,13 +694,13 @@ PERFORMANCE OF THIS SOFTWARE. min-height: 364px; } -`,OI=je(Po)` +`,NI=je(Po)` margin-top: 12px; ${vi("mobile")} { padding: 0 10px; } -`,NI=je.div` +`,LI=je.div` margin: 30px 0; width: 100%; display: flex; @@ -714,13 +714,13 @@ PERFORMANCE OF THIS SOFTWARE. min-width: 84px; text-align: center; font-weight: 590; -`;je(gq)` +`;je(hq)` margin: 0 auto 22px; -`;const[rr,Zh]=Hw({buttonRootId:null,language:"en",returnStrategy:"back",twaReturnUrl:void 0,walletsListConfiguration:{},enableAndroidBackHandler:!0});function PV(e){return[...new Set(e)]}function RV(e,t,r){return t.map(n=>{const o=r.find(i=>i[e]===n[e]);return r=r.filter(i=>i[e]!==n[e]),o===void 0?n:o}).concat(r)}function OV(e){return"jsBridgeKey"in e?ui(ur({},e),{injected:tl.isWalletInjected(e.jsBridgeKey),embedded:tl.isInsideWalletBrowser(e.jsBridgeKey)}):e}function r5(e,t){var r;return t&&(r=t.includeWallets)!=null&&r.length&&(e=RV("name",e,t.includeWallets.map(OV))),e}function U7(e){return e.platforms.some(t=>["macos","linux","windows"].includes(t))}function Df(e){return e.platforms.some(t=>["ios","android"].includes(t))}function j7(e){return e.platforms.some(t=>["chrome","firefox","safari"].includes(t))}function Ea(e,t){return t?e.name.toLowerCase()===t.toLowerCase()||e.appName.toLowerCase()===t.toLowerCase():!1}const NV=je.div` +`;const[rr,Zh]=Vw({buttonRootId:null,language:"en",returnStrategy:"back",twaReturnUrl:void 0,walletsListConfiguration:{},enableAndroidBackHandler:!0});function TV(e){return[...new Set(e)]}function BV(e,t,r){return t.map(n=>{const o=r.find(i=>i[e]===n[e]);return r=r.filter(i=>i[e]!==n[e]),o===void 0?n:o}).concat(r)}function PV(e){return"jsBridgeKey"in e?ui(ur({},e),{injected:tl.isWalletInjected(e.jsBridgeKey),embedded:tl.isInsideWalletBrowser(e.jsBridgeKey)}):e}function t5(e,t){var r;return t&&(r=t.includeWallets)!=null&&r.length&&(e=BV("name",e,t.includeWallets.map(PV))),e}function j7(e){return e.platforms.some(t=>["macos","linux","windows"].includes(t))}function Df(e){return e.platforms.some(t=>["ios","android"].includes(t))}function F7(e){return e.platforms.some(t=>["chrome","firefox","safari"].includes(t))}function Ea(e,t){return t?e.name.toLowerCase()===t.toLowerCase()||e.appName.toLowerCase()===t.toLowerCase():!1}const RV=je.div` display: flex; flex-direction: column; align-items: center; -`,LV=je(Po)` +`,OV=je(Po)` margin-bottom: 18px; `;je.div` height: 1px; @@ -733,7 +733,7 @@ PERFORMANCE OF THIS SOFTWARE. ${vi("mobile")} { width: 100%; } -`;const DV=je.ul` +`;const NV=je.ul` display: grid; grid-template-columns: repeat(auto-fit, 92px); grid-template-rows: auto; @@ -758,16 +758,16 @@ PERFORMANCE OF THIS SOFTWARE. display: block; margin: 0 auto 1px; font-size: 15px; -`;const UV=je(Dl)` +`;const LV=je(Dl)` position: absolute; top: 16px; left: 16px; -`,jV=je(CI)` +`,DV=je(EI)` height: 100%; -`,FV=Zt("
  • "),zV=e=>{const t=()=>Fu()?void 0:510,r=()=>Fu()?e.walletsList.filter(Df):e.walletsList;return ie(NV,{"data-tc-wallets-modal-list":"true",get children(){return[ie(UV,{icon:"arrow",onClick:()=>e.onBack()}),ie(LV,{translationKey:"walletModal.wallets",children:"Wallets"}),ie(EI,{get maxHeight(){return t()},get children(){return ie(DV,{get children(){return ie(Vd,{get each(){return r()},children:n=>(()=>{const o=FV.cloneNode(!0);return An(o,ie(jV,{wallet:n,onClick:()=>e.onSelect(n)})),o})()})}})}})]}})},$V={m:"16px",s:"12px",none:"0"},qV={m:"6px",s:"6px",none:"0"},WV=je.div` +`,UV=Zt("
  • "),jV=e=>{const t=()=>Fu()?void 0:510,r=()=>Fu()?e.walletsList.filter(Df):e.walletsList;return ie(RV,{"data-tc-wallets-modal-list":"true",get children(){return[ie(LV,{icon:"arrow",onClick:()=>e.onBack()}),ie(OV,{translationKey:"walletModal.wallets",children:"Wallets"}),ie(kI,{get maxHeight(){return t()},get children(){return ie(NV,{get children(){return ie(Vd,{get each(){return r()},children:n=>(()=>{const o=UV.cloneNode(!0);return An(o,ie(DV,{wallet:n,onClick:()=>e.onSelect(n)})),o})()})}})}})]}})},FV={m:"16px",s:"12px",none:"0"},zV={m:"6px",s:"6px",none:"0"},$V=je.div` display: flex; flex-direction: column; -`,VV=je.div` +`,qV=je.div` flex: 1; margin-top: ${e=>e.qr?"0":"18px"}; display: flex; @@ -775,16 +775,16 @@ PERFORMANCE OF THIS SOFTWARE. align-items: center; justify-content: center; min-height: 232px; -`,HV=je(U1)` +`,WV=je(U1)` margin-bottom: 24px; -`,KV=je(Po)` +`,VV=je(Po)` max-width: 288px; margin: 0 auto 2px; -`,ZV=je(hs)` +`,HV=je(hs)` max-width: 288px; text-align: center; margin: 0 auto 20px; -`,GV=je(Dl)` +`,KV=je(Dl)` position: absolute; top: 16px; left: 16px; @@ -793,36 +793,36 @@ PERFORMANCE OF THIS SOFTWARE. justify-content: center; gap: 8px; padding-bottom: 16px; -`,YV=je(hf)` +`,ZV=je(hf)` padding-bottom: 0; `,m2=je($r)` margin-bottom: 24px; -`,QV=je(da)` +`,GV=je(da)` margin-bottom: 18px; margin-top: 2px; -`,XV=je(j1)` +`,YV=je(j1)` margin-bottom: 16px; `,Gh=je(hs)` color: ${e=>e.theme.colors.text.secondary}; text-align: center; margin-bottom: 20px; -`,JV=je($r)` +`,QV=je($r)` margin-top: -8px; margin-bottom: 24px; width: 100%; padding: 12px 12px 12px 20px; - border-radius: ${e=>$V[e.theme.borderRadius]}; + border-radius: ${e=>FV[e.theme.borderRadius]}; font-size: 16px; line-height: 20px; -`,eH=je(Ll)` +`,XV=je(Ll)` width: 32px; height: 32px; - border-radius: ${e=>qV[e.theme.borderRadius]}; -`,rn=e=>{const[t]=Bo();return ft(()=>{var r;return t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString())})};function cr(e,t){let r;typeof t=="string"?r=t:r=aa()?t.twaReturnUrl||t.returnStrategy:"none";const n=tH(e,"ret",r);if(!Ws(e))return n;const o=n.slice(n.lastIndexOf("&")+1);return n.slice(0,n.lastIndexOf("&"))+"-"+xM(o)}function Xd(e,t){t=ur({},t);const r=rH(e),n=new URL(r);if(n.searchParams.has("startapp")||n.searchParams.append("startapp","tonconnect"),aa())Wo("ios","android","macos")?(t.returnStrategy="back",t.twaReturnUrl=void 0,ff(cr(n.toString(),t))):Wo("tdesktop")||Wo("weba")?ff(cr(n.toString(),t)):Wo("web")?(t.returnStrategy="back",t.twaReturnUrl=void 0,ff(cr(n.toString(),t))):xr(cr(n.toString(),t));else if(ho("ios")){t.returnStrategy==="back"&&($t("safari")?t.returnStrategy="back":$t("chrome")?t.returnStrategy="googlechrome://":$t("firefox")?t.returnStrategy="firefox://":$t("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("android")){t.returnStrategy="none";const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("ipad")){t.returnStrategy==="back"&&($t("safari")?t.returnStrategy="back":$t("chrome")?t.returnStrategy="googlechrome://":$t("firefox")?t.returnStrategy="firefox://":$t("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("macos","windows","linux"))if(t.returnStrategy="none",t.twaReturnUrl=void 0,t.forceRedirect)xr(cr(n.toString(),t));else{const o=cr(n.toString(),t),i=Yh(o);Ta(i,()=>xr(o))}else xr(cr(n.toString(),t))}function Jd(e,t,r,n){if(r=ur({},r),aa())if(Wo("ios","android")){r.returnStrategy==="back"&&(r.returnStrategy="tg://resolve"),n("universal-link");const o=cr(e,r.returnStrategy);ff(o,()=>{n("universal-link"),xr(o)})}else if(Wo("macos","tdesktop")){r.returnStrategy==="back"&&(r.returnStrategy="tg://resolve");const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else if(Wo("weba")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy=location.href:$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href);const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else if(Wo("web")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy=location.href:$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href);const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else{n("universal-link");const o=cr(e,r.returnStrategy);xr(o)}else if(ho("ios"))r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),$t("chrome")?(n("universal-link"),yp(cr(e,r.returnStrategy),"_self")):(n("universal-link"),xr(cr(e,r.returnStrategy)));else if(ho("android"))r.returnStrategy==="back"&&($t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),n("universal-link"),xr(cr(e,r.returnStrategy));else if(ho("ipad"))r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),$t("chrome")?(n("universal-link"),yp(cr(e,r.returnStrategy),"_self")):(n("universal-link"),xr(cr(e,r.returnStrategy)));else if(ho("macos","windows","linux")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy="none");const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else n("universal-link"),xr(cr(e,r.returnStrategy))}function tH(e,t,r){const n=new URL(e);return n.searchParams.append(t,r),n.toString()}function rH(e){const t=new URL(e);return t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start"),t.toString()}function Yh(e){const t=new URL(e),[,r,n]=t.pathname.split("/"),o=t.searchParams.get("startapp");return`tg://resolve?domain=${r}&appname=${n}&startapp=${o}`}const LI=e=>{const[t,r]=Rt("mobile"),[n,o]=Rt(!1),[i,a]=Rt(),[s,l]=Rt(!0),u=$n(ac),c=u.onStatusChange(()=>{},()=>{e.wallet.appName!==Go&&o(!0)});zn(c);const h=()=>{try{const S=u.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest);a(S)}catch{}};ln(()=>{un(t)!=="extension"&&(Df(e.wallet)||U7(e.wallet))&&h()});const d=()=>{o(!1),t()==="extension"&&h(),r("mobile"),gn(ui(ur({},e.wallet),{openMethod:"qrcode"}))},p=()=>{o(!1),t()==="extension"&&h(),r("desktop");const S=!s();l(!1),Jd(i(),e.wallet.deepLink,{returnStrategy:rr.returnStrategy,forceRedirect:S},x=>{gn(ui(ur({},e.wallet),{openMethod:x}))})},v=()=>{const S=!s();l(!1),gn(ui(ur({},e.wallet),{openMethod:"universal-link"})),Xd(i(),{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:S})},b=()=>{o(!1),r("extension"),Vs(e.wallet)&&(gn(e.wallet),u.connect({jsBridgeKey:e.wallet.jsBridgeKey},e.additionalRequest))};return Df(e.wallet)?d():j7(e.wallet)?b():p(),ie(WV,{"data-tc-wallets-modal-connection-desktop":"true",get children(){return[ie(Dt,{get when(){return!e.backDisabled},get children(){return ie(GV,{icon:"arrow",onClick:()=>e.onBackClick()})}}),ie(KV,{get children(){return e.wallet.name}}),ie(Dt,{get when(){return t()==="mobile"},get children(){return ie(ZV,{translationKey:"walletModal.desktopConnectionModal.scanQR",get translationValues(){return{name:e.wallet.name}},get children(){return["Scan the QR code below with your phone’s or ",ft(()=>e.wallet.name),"’s camera"]}})}}),ie(VV,{get qr(){return t()==="mobile"},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return t()==="mobile"},get children(){return ie(HV,{disableCopy:!1,get sourceUrl(){return cr(i(),"none")},get imageUrl(){return e.wallet.imageUrl}})}}),ie(pn,{get when(){return n()},get children(){return[ie(XV,{size:"s"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.connectionDeclined",children:"Connection declined"}),ie(hf,{get children(){return ie($r,{get leftIcon(){return ie(Of,{})},get onClick(){return t()==="extension"?b:p},get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}})}})]}}),ie(pn,{get when(){return t()==="extension"},get children(){return[ie(Dt,{get when(){return Vs(e.wallet)},get children(){return[ie(QV,{size:"s"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.continueInExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name)," browser extension…"]}}),ie(hf,{get children(){return ie($r,{get leftIcon(){return ie(Of,{})},onClick:b,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}})}})]}}),ie(Dt,{get when(){return!Vs(e.wallet)},get children(){return[ie(Gh,{translationKey:"walletModal.desktopConnectionModal.dontHaveExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Seems you don't have installed ",ft(()=>e.wallet.name)," browser extension"]}}),ie(hf,{get children(){return ie(Ap,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(k7,{})},onClick:b,get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",ft(()=>e.wallet.name)]}})}})}})}})]}})]}}),ie(pn,{get when(){return t()==="desktop"},get children(){return[ie(da,{size:"m"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.continueOnDesktop",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name)," on desktop…"]}}),ie(hf,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:p,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie(Ap,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(k7,{})},get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",ft(()=>e.wallet.name)]}})}})}})]}})]}})]}})}}),ie(Dt,{get when(){return e.wallet.appName===Go},get children(){return ie(JV,{get rightIcon(){return ie(eH,{get src(){return Qd.TG}})},scale:"s",onClick:v,get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.openWalletOnTelegram",children:"Open Wallet in Telegram on desktop"})}})}}),ie(Dt,{get when(){return e.wallet.appName!==Go},get children(){return ie(YV,{get children(){return[ie(Dt,{get when(){return ft(()=>t()!=="mobile")()&&Df(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(sW,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.mobile",children:"Mobile"})}})}}),ie(Dt,{get when(){return ft(()=>t()!=="extension")()&&j7(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(oW,{})},onClick:b,get children(){return ie(rn,{translationKey:"common.browserExtension",children:"Browser Extension"})}})}}),ie(Dt,{get when(){return ft(()=>t()!=="desktop")()&&U7(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(uW,{})},onClick:p,get children(){return ie(rn,{translationKey:"common.desktop",children:"Desktop"})}})}})]}})}})]}})},nH=je.div``,iH=je(Dl)` + border-radius: ${e=>zV[e.theme.borderRadius]}; +`,rn=e=>{const[t]=Bo();return ft(()=>{var r;return t(e.translationKey,e.translationValues,(r=e.children)==null?void 0:r.toString())})};function cr(e,t){let r;typeof t=="string"?r=t:r=aa()?t.twaReturnUrl||t.returnStrategy:"none";const n=JV(e,"ret",r);if(!Ws(e))return n;const o=n.slice(n.lastIndexOf("&")+1);return n.slice(0,n.lastIndexOf("&"))+"-"+SM(o)}function Xd(e,t){t=ur({},t);const r=eH(e),n=new URL(r);if(n.searchParams.has("startapp")||n.searchParams.append("startapp","tonconnect"),aa())Wo("ios","android","macos")?(t.returnStrategy="back",t.twaReturnUrl=void 0,ff(cr(n.toString(),t))):Wo("tdesktop")||Wo("weba")?ff(cr(n.toString(),t)):Wo("web")?(t.returnStrategy="back",t.twaReturnUrl=void 0,ff(cr(n.toString(),t))):xr(cr(n.toString(),t));else if(ho("ios")){t.returnStrategy==="back"&&($t("safari")?t.returnStrategy="back":$t("chrome")?t.returnStrategy="googlechrome://":$t("firefox")?t.returnStrategy="firefox://":$t("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("android")){t.returnStrategy="none";const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("ipad")){t.returnStrategy==="back"&&($t("safari")?t.returnStrategy="back":$t("chrome")?t.returnStrategy="googlechrome://":$t("firefox")?t.returnStrategy="firefox://":$t("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const o=$t("chrome"),i=$t("firefox");if((o||i)&&!t.forceRedirect){const s=cr(n.toString(),t.returnStrategy),l=Yh(s);Ta(l,()=>xr(s))}else{const s=cr(n.toString(),t.returnStrategy);xr(s)}}else if(ho("macos","windows","linux"))if(t.returnStrategy="none",t.twaReturnUrl=void 0,t.forceRedirect)xr(cr(n.toString(),t));else{const o=cr(n.toString(),t),i=Yh(o);Ta(i,()=>xr(o))}else xr(cr(n.toString(),t))}function Jd(e,t,r,n){if(r=ur({},r),aa())if(Wo("ios","android")){r.returnStrategy==="back"&&(r.returnStrategy="tg://resolve"),n("universal-link");const o=cr(e,r.returnStrategy);ff(o,()=>{n("universal-link"),xr(o)})}else if(Wo("macos","tdesktop")){r.returnStrategy==="back"&&(r.returnStrategy="tg://resolve");const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else if(Wo("weba")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy=location.href:$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href);const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else if(Wo("web")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy=location.href:$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href);const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else{n("universal-link");const o=cr(e,r.returnStrategy);xr(o)}else if(ho("ios"))r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),$t("chrome")?(n("universal-link"),yp(cr(e,r.returnStrategy),"_self")):(n("universal-link"),xr(cr(e,r.returnStrategy)));else if(ho("android"))r.returnStrategy==="back"&&($t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),n("universal-link"),xr(cr(e,r.returnStrategy));else if(ho("ipad"))r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy=location.href),$t("chrome")?(n("universal-link"),yp(cr(e,r.returnStrategy),"_self")):(n("universal-link"),xr(cr(e,r.returnStrategy)));else if(ho("macos","windows","linux")){r.returnStrategy==="back"&&($t("safari")?r.returnStrategy="none":$t("chrome")?r.returnStrategy="googlechrome://":$t("firefox")?r.returnStrategy="firefox://":$t("opera")?r.returnStrategy="opera-http://":r.returnStrategy="none");const o=cr(e,r.returnStrategy);!!t&&!r.forceRedirect?(n("custom-deeplink"),Ta(Vh(o,t),()=>{n("universal-link"),xr(o)})):(n("universal-link"),xr(o))}else n("universal-link"),xr(cr(e,r.returnStrategy))}function JV(e,t,r){const n=new URL(e);return n.searchParams.append(t,r),n.toString()}function eH(e){const t=new URL(e);return t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start"),t.toString()}function Yh(e){const t=new URL(e),[,r,n]=t.pathname.split("/"),o=t.searchParams.get("startapp");return`tg://resolve?domain=${r}&appname=${n}&startapp=${o}`}const DI=e=>{const[t,r]=Rt("mobile"),[n,o]=Rt(!1),[i,a]=Rt(),[s,l]=Rt(!0),u=$n(ac),c=u.onStatusChange(()=>{},()=>{e.wallet.appName!==Go&&o(!0)});zn(c);const h=()=>{try{const S=u.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest);a(S)}catch{}};ln(()=>{un(t)!=="extension"&&(Df(e.wallet)||j7(e.wallet))&&h()});const d=()=>{o(!1),t()==="extension"&&h(),r("mobile"),gn(ui(ur({},e.wallet),{openMethod:"qrcode"}))},p=()=>{o(!1),t()==="extension"&&h(),r("desktop");const S=!s();l(!1),Jd(i(),e.wallet.deepLink,{returnStrategy:rr.returnStrategy,forceRedirect:S},x=>{gn(ui(ur({},e.wallet),{openMethod:x}))})},v=()=>{const S=!s();l(!1),gn(ui(ur({},e.wallet),{openMethod:"universal-link"})),Xd(i(),{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:S})},b=()=>{o(!1),r("extension"),Vs(e.wallet)&&(gn(e.wallet),u.connect({jsBridgeKey:e.wallet.jsBridgeKey},e.additionalRequest))};return Df(e.wallet)?d():F7(e.wallet)?b():p(),ie($V,{"data-tc-wallets-modal-connection-desktop":"true",get children(){return[ie(Dt,{get when(){return!e.backDisabled},get children(){return ie(KV,{icon:"arrow",onClick:()=>e.onBackClick()})}}),ie(VV,{get children(){return e.wallet.name}}),ie(Dt,{get when(){return t()==="mobile"},get children(){return ie(HV,{translationKey:"walletModal.desktopConnectionModal.scanQR",get translationValues(){return{name:e.wallet.name}},get children(){return["Scan the QR code below with your phone’s or ",ft(()=>e.wallet.name),"’s camera"]}})}}),ie(qV,{get qr(){return t()==="mobile"},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return t()==="mobile"},get children(){return ie(WV,{disableCopy:!1,get sourceUrl(){return cr(i(),"none")},get imageUrl(){return e.wallet.imageUrl}})}}),ie(pn,{get when(){return n()},get children(){return[ie(YV,{size:"s"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.connectionDeclined",children:"Connection declined"}),ie(hf,{get children(){return ie($r,{get leftIcon(){return ie(Of,{})},get onClick(){return t()==="extension"?b:p},get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}})}})]}}),ie(pn,{get when(){return t()==="extension"},get children(){return[ie(Dt,{get when(){return Vs(e.wallet)},get children(){return[ie(GV,{size:"s"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.continueInExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name)," browser extension…"]}}),ie(hf,{get children(){return ie($r,{get leftIcon(){return ie(Of,{})},onClick:b,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}})}})]}}),ie(Dt,{get when(){return!Vs(e.wallet)},get children(){return[ie(Gh,{translationKey:"walletModal.desktopConnectionModal.dontHaveExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Seems you don't have installed ",ft(()=>e.wallet.name)," browser extension"]}}),ie(hf,{get children(){return ie(Ap,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(A7,{})},onClick:b,get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",ft(()=>e.wallet.name)]}})}})}})}})]}})]}}),ie(pn,{get when(){return t()==="desktop"},get children(){return[ie(da,{size:"m"}),ie(Gh,{translationKey:"walletModal.desktopConnectionModal.continueOnDesktop",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name)," on desktop…"]}}),ie(hf,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:p,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie(Ap,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(A7,{})},get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",ft(()=>e.wallet.name)]}})}})}})]}})]}})]}})}}),ie(Dt,{get when(){return e.wallet.appName===Go},get children(){return ie(QV,{get rightIcon(){return ie(XV,{get src(){return Qd.TG}})},scale:"s",onClick:v,get children(){return ie(rn,{translationKey:"walletModal.desktopConnectionModal.openWalletOnTelegram",children:"Open Wallet in Telegram on desktop"})}})}}),ie(Dt,{get when(){return e.wallet.appName!==Go},get children(){return ie(ZV,{get children(){return[ie(Dt,{get when(){return ft(()=>t()!=="mobile")()&&Df(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(oW,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.mobile",children:"Mobile"})}})}}),ie(Dt,{get when(){return ft(()=>t()!=="extension")()&&F7(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(nW,{})},onClick:b,get children(){return ie(rn,{translationKey:"common.browserExtension",children:"Browser Extension"})}})}}),ie(Dt,{get when(){return ft(()=>t()!=="desktop")()&&j7(e.wallet)},get children(){return ie(m2,{appearance:"secondary",get leftIcon(){return ie(sW,{})},onClick:p,get children(){return ie(rn,{translationKey:"common.desktop",children:"Desktop"})}})}})]}})}})]}})},tH=je.div``,rH=je(Dl)` position: absolute; top: 16px; left: 16px; -`,oH=je(Po)` +`,nH=je(Po)` margin-bottom: 18px; `,v2=je.div` padding: 16px 0; @@ -831,20 +831,20 @@ PERFORMANCE OF THIS SOFTWARE. align-items: center; `,y2=oa` margin-bottom: 12px; -`,b2=je(Qw)` +`,b2=je(Yw)` text-align: center; margin-bottom: 4px; `,w2=je(di)` text-align: center; max-width: 352px; color: ${e=>e.theme.colors.text.secondary}; -`,aH=je.div` +`,iH=je.div` padding: 16px 24px 24px; display: flex; align-items: center; justify-content: center; gap: 8px; -`,sH={GET_A_WALLET:"https://ton.org/wallets?filters[wallet_features][slug][$in]=dapp-auth&pagination[limit]=-1"},DI=e=>ie(nH,{"data-tc-wallets-modal-info":"true",get children(){return[ie(iH,{icon:"arrow",onClick:()=>e.onBackClick()}),ie(oH,{translationKey:"walletModal.infoModal.whatIsAWallet",children:"What is a wallet"}),ie(EI,{get children(){return[ie(v2,{get children(){return[ie(gW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.secureDigitalAssets",children:"Secure digital assets storage"}),ie(w2,{translationKey:"walletModal.infoModal.walletProtects",children:"A wallet protects and manages your digital assets including TON, tokens and collectables."})]}}),ie(v2,{get children(){return[ie(vW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.controlIdentity",children:"Control your Web3 identity"}),ie(w2,{translationKey:"walletModal.infoModal.manageIdentity",children:"Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem."})]}}),ie(v2,{get children(){return[ie(bW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.effortlessCryptoTransactions",children:"Effortless crypto transactions"}),ie(w2,{translationKey:"walletModal.infoModal.easilySend",children:"Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications."})]}}),ie(aH,{get children(){return ie(Ap,{get href(){return sH.GET_A_WALLET},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(hW,{})},get children(){return ie(rn,{translationKey:"walletModal.infoModal.getAWallet",children:"Get a Wallet"})}})}})}})]}})]}}),lH=je.div``,uH=je.div` +`,oH={GET_A_WALLET:"https://ton.org/wallets?filters[wallet_features][slug][$in]=dapp-auth&pagination[limit]=-1"},UI=e=>ie(tH,{"data-tc-wallets-modal-info":"true",get children(){return[ie(rH,{icon:"arrow",onClick:()=>e.onBackClick()}),ie(nH,{translationKey:"walletModal.infoModal.whatIsAWallet",children:"What is a wallet"}),ie(kI,{get children(){return[ie(v2,{get children(){return[ie(hW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.secureDigitalAssets",children:"Secure digital assets storage"}),ie(w2,{translationKey:"walletModal.infoModal.walletProtects",children:"A wallet protects and manages your digital assets including TON, tokens and collectables."})]}}),ie(v2,{get children(){return[ie(gW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.controlIdentity",children:"Control your Web3 identity"}),ie(w2,{translationKey:"walletModal.infoModal.manageIdentity",children:"Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem."})]}}),ie(v2,{get children(){return[ie(vW,{class:y2}),ie(b2,{translationKey:"walletModal.infoModal.effortlessCryptoTransactions",children:"Effortless crypto transactions"}),ie(w2,{translationKey:"walletModal.infoModal.easilySend",children:"Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications."})]}}),ie(iH,{get children(){return ie(Ap,{get href(){return oH.GET_A_WALLET},blank:!0,get children(){return ie($r,{get rightIcon(){return ie(fW,{})},get children(){return ie(rn,{translationKey:"walletModal.infoModal.getAWallet",children:"Get a Wallet"})}})}})}})]}})]}}),aH=je.div``,sH=je.div` flex: 1; margin-top: 18px; display: flex; @@ -852,49 +852,49 @@ PERFORMANCE OF THIS SOFTWARE. align-items: center; justify-content: center; min-height: 232px; -`,cH=je(Po)` +`,lH=je(Po)` max-width: 262px; margin: 0 auto 8px; -`,fH=je(Dl)` +`,uH=je(Dl)` position: absolute; top: 16px; left: 16px; -`,dH=je.div` +`,cH=je.div` padding: 16px; display: flex; align-items: center; gap: 12px; border-top: 0.5px solid ${e=>Kd(e.theme.colors.icon.secondary,.2)}; -`,hH=je(Ll)` +`,fH=je(Ll)` width: 36px; height: 36px; border-radius: 10px; -`,pH=je(Ap)` +`,dH=je(Ap)` margin-left: auto; -`,gH=je(da)` +`,hH=je(da)` margin-bottom: 18px; margin-top: 2px; -`,mH=je(j1)` +`,pH=je(j1)` margin-bottom: 16px; -`,F7=je(hs)` +`,z7=je(hs)` color: ${e=>e.theme.colors.text.secondary}; text-align: center; margin-bottom: 20px; -`,z7=je.div` +`,$7=je.div` display: flex; justify-content: center; gap: 8px; padding-bottom: 16px; -`,vH=je(Po)` +`,gH=je(Po)` margin-bottom: 2px; padding: 0 64px; -`,yH=je(hs)` +`,mH=je(hs)` margin-bottom: 20px; padding: 0 64px; min-height: 44px; -`,bH=je.div` +`,vH=je.div` padding: 0 24px 24px; -`,wH=e=>[ie(vH,{get children(){return e.walletInfo.name}}),ie(yH,{translationKey:"walletModal.mobileConnectionModal.scanQR",get translationValues(){return{name:e.walletInfo.name}},get children(){return["Scan the QR code below with your phone’s or ",ft(()=>e.walletInfo.name),"’s camera"]}}),ie(bH,{get children(){return ie(U1,{get imageUrl(){return e.walletInfo.imageUrl},get sourceUrl(){return cr(e.universalLink,"none")},disableCopy:!0})}})],UI=e=>{const t=gr(),[r,n]=Rt(!0),[o,i]=Rt(!1),[a,s]=Rt(!1),l=$n(ac),u=l.onStatusChange(()=>{},()=>{s(!0)}),c=ft(()=>l.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest)),h=()=>{gn(ui(ur({},e.wallet),{openMethod:"universal-link"})),Xd(c(),{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:!0})},d=()=>{const S=c();if(Ws(S))return h();s(!1);const x=!r();n(!1),Jd(c(),e.wallet.deepLink,{returnStrategy:rr.returnStrategy,forceRedirect:x},k=>{gn(ui(ur({},e.wallet),{openMethod:k}))})},p=()=>{s(!1),i(!0),gn(ui(ur({},e.wallet),{openMethod:"qrcode"}))},v=()=>{i(!1),gn(ui(ur({},e.wallet),{openMethod:"universal-link"}))},b=()=>{o()?v():e.onBackClick()};return zn(u),d(),ie(lH,{"data-tc-wallets-modal-connection-mobile":"true",get children(){return[ie(Dt,{get when(){return!e.backDisabled||o()},get children(){return ie(fH,{icon:"arrow",onClick:b})}}),ie(Dt,{get when(){return o()},get children(){return ie(wH,{get universalLink(){return c()},get walletInfo(){return e.wallet}})}}),ie(Dt,{get when(){return!o()},get children(){return[ie(cH,{get children(){return e.wallet.name}}),ie(uH,{get children(){return[ie(Dt,{get when(){return a()},get children(){return[ie(mH,{size:"s"}),ie(F7,{translationKey:"walletModal.mobileConnectionModal.connectionDeclined",children:"Connection declined"}),ie(z7,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie($r,{get leftIcon(){return ie(f4,{get fill(){return t.colors.accent}})},onClick:p,get children(){return ie(rn,{translationKey:"walletModal.mobileConnectionModal.showQR",children:"Show QR Code"})}})]}})]}}),ie(Dt,{get when(){return!a()},get children(){return[ie(gH,{size:"s"}),ie(F7,{translationKey:"walletModal.mobileConnectionModal.continueIn",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name),"…"]}}),ie(z7,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie($r,{get leftIcon(){return ie(f4,{get fill(){return t.colors.accent}})},onClick:p,get children(){return ie(rn,{translationKey:"walletModal.mobileConnectionModal.showQR",children:"Show QR Code"})}})]}})]}})]}}),ie(dH,{get children(){return[ie(hH,{get src(){return e.wallet.imageUrl}}),ie(Qw,{get children(){return e.wallet.name}}),ie(pH,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get children(){return ie(rn,{translationKey:"common.get",children:"GET"})}})}})]}})]}})]}})},jI={m:"16px",s:"12px",none:"0"},_H={m:"6px",s:"6px",none:"0"},xH=je.ul` +`,yH=e=>[ie(gH,{get children(){return e.walletInfo.name}}),ie(mH,{translationKey:"walletModal.mobileConnectionModal.scanQR",get translationValues(){return{name:e.walletInfo.name}},get children(){return["Scan the QR code below with your phone’s or ",ft(()=>e.walletInfo.name),"’s camera"]}}),ie(vH,{get children(){return ie(U1,{get imageUrl(){return e.walletInfo.imageUrl},get sourceUrl(){return cr(e.universalLink,"none")},disableCopy:!0})}})],jI=e=>{const t=gr(),[r,n]=Rt(!0),[o,i]=Rt(!1),[a,s]=Rt(!1),l=$n(ac),u=l.onStatusChange(()=>{},()=>{s(!0)}),c=ft(()=>l.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest)),h=()=>{gn(ui(ur({},e.wallet),{openMethod:"universal-link"})),Xd(c(),{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:!0})},d=()=>{const S=c();if(Ws(S))return h();s(!1);const x=!r();n(!1),Jd(c(),e.wallet.deepLink,{returnStrategy:rr.returnStrategy,forceRedirect:x},k=>{gn(ui(ur({},e.wallet),{openMethod:k}))})},p=()=>{s(!1),i(!0),gn(ui(ur({},e.wallet),{openMethod:"qrcode"}))},v=()=>{i(!1),gn(ui(ur({},e.wallet),{openMethod:"universal-link"}))},b=()=>{o()?v():e.onBackClick()};return zn(u),d(),ie(aH,{"data-tc-wallets-modal-connection-mobile":"true",get children(){return[ie(Dt,{get when(){return!e.backDisabled||o()},get children(){return ie(uH,{icon:"arrow",onClick:b})}}),ie(Dt,{get when(){return o()},get children(){return ie(yH,{get universalLink(){return c()},get walletInfo(){return e.wallet}})}}),ie(Dt,{get when(){return!o()},get children(){return[ie(lH,{get children(){return e.wallet.name}}),ie(sH,{get children(){return[ie(Dt,{get when(){return a()},get children(){return[ie(pH,{size:"s"}),ie(z7,{translationKey:"walletModal.mobileConnectionModal.connectionDeclined",children:"Connection declined"}),ie($7,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie($r,{get leftIcon(){return ie(c4,{get fill(){return t.colors.accent}})},onClick:p,get children(){return ie(rn,{translationKey:"walletModal.mobileConnectionModal.showQR",children:"Show QR Code"})}})]}})]}}),ie(Dt,{get when(){return!a()},get children(){return[ie(hH,{size:"s"}),ie(z7,{translationKey:"walletModal.mobileConnectionModal.continueIn",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",ft(()=>e.wallet.name),"…"]}}),ie($7,{get children(){return[ie($r,{get leftIcon(){return ie(Of,{})},onClick:d,get children(){return ie(rn,{translationKey:"common.retry",children:"Retry"})}}),ie($r,{get leftIcon(){return ie(c4,{get fill(){return t.colors.accent}})},onClick:p,get children(){return ie(rn,{translationKey:"walletModal.mobileConnectionModal.showQR",children:"Show QR Code"})}})]}})]}})]}}),ie(cH,{get children(){return[ie(fH,{get src(){return e.wallet.imageUrl}}),ie(Yw,{get children(){return e.wallet.name}}),ie(dH,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return ie($r,{get children(){return ie(rn,{translationKey:"common.get",children:"GET"})}})}})]}})]}})]}})},FI={m:"16px",s:"12px",none:"0"},bH={m:"6px",s:"6px",none:"0"},wH=je.ul` display: flex; justify-content: space-between; margin: 0 auto; @@ -916,7 +916,7 @@ PERFORMANCE OF THIS SOFTWARE. > li { height: fit-content; } -`,$7=je.li` +`,q7=je.li` width: 82px; min-width: 82px; height: 124px; @@ -945,7 +945,7 @@ PERFORMANCE OF THIS SOFTWARE. transform: scale(0.92); } } -`,SH=je.div` +`,_H=je.div` width: 1px; margin: 0 10px; height: 24px; @@ -954,31 +954,31 @@ PERFORMANCE OF THIS SOFTWARE. background-color: ${e=>e.theme.colors.icon.secondary}; opacity: 0.2; -`,q7=je.div` +`,W7=je.div` width: 60px; height: 60px; - border-radius: ${e=>jI[e.theme.borderRadius]}; + border-radius: ${e=>FI[e.theme.borderRadius]}; display: flex; align-items: center; justify-content: center; background-color: ${e=>e.theme.colors.background.tint}; margin-bottom: 8px; -`,CH=je(Po)` +`,xH=je(Po)` margin-top: 38px; margin-bottom: 4px; padding: 0 24px; -`,EH=je(hs)` +`,SH=je(hs)` margin-bottom: 24px; padding: 0 24px; min-height: 44px; `;je($r)` display: block; margin: 0 auto; -`;const kH=je($r)` +`;const CH=je($r)` margin: 0 24px 24px; width: calc(100% - 48px); - border-radius: ${e=>jI[e.theme.borderRadius]}; + border-radius: ${e=>FI[e.theme.borderRadius]}; padding: 14px 16px 14px 14px; background-color: ${e=>e.theme.colors.telegramButton}; @@ -986,36 +986,36 @@ PERFORMANCE OF THIS SOFTWARE. font-weight: 590; font-size: 16px; line-height: 20px; -`,AH=je(Ll)` - border-radius: ${e=>_H[e.theme.borderRadius]}; +`,EH=je(Ll)` + border-radius: ${e=>bH[e.theme.borderRadius]}; width: 24px; height: 24px; -`,W7=je(Dl)` +`,V7=je(Dl)` position: absolute; top: 16px; left: 16px; -`,MH=je(Po)` +`,kH=je(Po)` margin-bottom: 2px; padding: 0 64px; -`,IH=je(hs)` +`,AH=je(hs)` margin-bottom: 20px; padding: 0 64px; -`,TH=je.div` +`,MH=je.div` padding: 0 24px 24px; -`,BH=e=>[ie(MH,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(IH,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),ie(TH,{get children(){return ie(U1,{get imageUrl(){return Qd.TON},get sourceUrl(){return cr(e.universalLink,"none")},disableCopy:!0})}})];function FI(e){const t=new Set(e.filter(Nw).map(r=>r.bridgeUrl));return Array.from(t).map(r=>({bridgeUrl:r}))}function zI(e,t){const r=new Set(e==null?void 0:e.map(o=>o.bridgeUrl)),n=new Set(t==null?void 0:t.map(o=>o.bridgeUrl));return r.size===n.size&&[...r].every(o=>n.has(o))}const V7=Zt("
  • "),PH=Zt('
    '),RH=e=>{const[t,r]=Rt(!1),[n,o]=Rt(!0),[i,a]=Rt(null),s=rr.connector,l=()=>e.walletsList.filter(M=>Df(M)&&M.appName!==Go),u=()=>l().length>7,c=ft(()=>FI(e.walletsList),null,{equals:zI}),h=()=>(i()||a(s.connect(c(),e.additionalRequest)),i());gn({openMethod:"universal-link"});const[d,p]=Rt(void 0),v=()=>ar(void 0,null,function*(){d()!==void 0&&clearTimeout(d()),yield Yw(h());const M=setTimeout(()=>p(void 0),1500);p(M)}),b=()=>{const M=!n();o(!1),Jd(h(),void 0,{returnStrategy:rr.returnStrategy,forceRedirect:M},P=>{gn({openMethod:P})})},S=()=>{a(null);const M=e.walletsList.find(j=>j.appName===Go);if(!M||!Nw(M))throw new Fr("@wallet bot not found in the wallets list");const P=s.connect({bridgeUrl:M.bridgeUrl,universalLink:M.universalLink},e.additionalRequest),L=!n();o(!1),Xd(P,{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:L})},x=()=>{r(!0),gn({openMethod:"qrcode"})},k=()=>{r(!1),gn({openMethod:"universal-link"})};return(()=>{const M=PH.cloneNode(!0);return An(M,ie(Dt,{get when(){return t()},get children(){return[ie(W7,{icon:"arrow",onClick:k}),ie(BH,{get universalLink(){return h()}})]}}),null),An(M,ie(Dt,{get when(){return!t()},get children(){return[ie(W7,{get icon(){return ie(f4,{})},onClick:x}),ie(CH,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(EH,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",children:"Open Wallet in Telegram or select your wallet to connect"}),ie(kH,{get leftIcon(){return ie(_W,{})},get rightIcon(){return ie(AH,{get src(){return Qd.TG}})},onClick:S,scale:"s",get children(){return ie(rn,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegram",children:"Open Wallet in Telegram"})}}),ie(xH,{get children(){return[ie(Vd,{get each(){return ft(()=>!!u())()?l().slice(0,4):l()},children:P=>(()=>{const L=V7.cloneNode(!0);return An(L,ie(Ep,{get icon(){return P.imageUrl},get name(){return P.name},onClick:()=>e.onSelect(P)})),L})()}),ie(Dt,{get when(){return u()},get children(){const P=V7.cloneNode(!0);return An(P,ie(SI,{labelLine1:"View all",labelLine2:"wallets",get images(){return l().slice(3,7).map(L=>L.imageUrl)},onClick:()=>e.onSelectAllWallets()})),P}}),ie(SH,{children:" "}),ie($7,{onClick:b,get children(){return[ie(q7,{get children(){return ie($q,{})}}),ie(di,{fontWeight:590,translationKey:"walletModal.mobileUniversalModal.openLink",children:"Open Link"})]}}),ie($7,{onClick:v,get children(){return[ie(q7,{get children(){return ft(()=>d()!==void 0)()?ie(SW,{}):ie(xI,{})}}),ie(di,{fontWeight:590,get translationKey(){return d()!==void 0?"common.copied":"common.copyLink"},get children(){return d()!==void 0?"Copied":"Copy Link"}})]}})]}})]}}),null),M})()},$I={m:"16px",s:"8px",none:"0"},OH={m:"8px",s:"4px",none:"0"},NH=je.div` +`,IH=e=>[ie(kH,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(AH,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),ie(MH,{get children(){return ie(U1,{get imageUrl(){return Qd.TON},get sourceUrl(){return cr(e.universalLink,"none")},disableCopy:!0})}})];function zI(e){const t=new Set(e.filter(Ow).map(r=>r.bridgeUrl));return Array.from(t).map(r=>({bridgeUrl:r}))}function $I(e,t){const r=new Set(e==null?void 0:e.map(o=>o.bridgeUrl)),n=new Set(t==null?void 0:t.map(o=>o.bridgeUrl));return r.size===n.size&&[...r].every(o=>n.has(o))}const H7=Zt("
  • "),TH=Zt('
    '),BH=e=>{const[t,r]=Rt(!1),[n,o]=Rt(!0),[i,a]=Rt(null),s=rr.connector,l=()=>e.walletsList.filter(M=>Df(M)&&M.appName!==Go),u=()=>l().length>7,c=ft(()=>zI(e.walletsList),null,{equals:$I}),h=()=>(i()||a(s.connect(c(),e.additionalRequest)),i());gn({openMethod:"universal-link"});const[d,p]=Rt(void 0),v=()=>ar(void 0,null,function*(){d()!==void 0&&clearTimeout(d()),yield Gw(h());const M=setTimeout(()=>p(void 0),1500);p(M)}),b=()=>{const M=!n();o(!1),Jd(h(),void 0,{returnStrategy:rr.returnStrategy,forceRedirect:M},P=>{gn({openMethod:P})})},S=()=>{a(null);const M=e.walletsList.find(j=>j.appName===Go);if(!M||!Ow(M))throw new Fr("@wallet bot not found in the wallets list");const P=s.connect({bridgeUrl:M.bridgeUrl,universalLink:M.universalLink},e.additionalRequest),L=!n();o(!1),Xd(P,{returnStrategy:rr.returnStrategy,twaReturnUrl:rr.twaReturnUrl,forceRedirect:L})},x=()=>{r(!0),gn({openMethod:"qrcode"})},k=()=>{r(!1),gn({openMethod:"universal-link"})};return(()=>{const M=TH.cloneNode(!0);return An(M,ie(Dt,{get when(){return t()},get children(){return[ie(V7,{icon:"arrow",onClick:k}),ie(IH,{get universalLink(){return h()}})]}}),null),An(M,ie(Dt,{get when(){return!t()},get children(){return[ie(V7,{get icon(){return ie(c4,{})},onClick:x}),ie(xH,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(SH,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",children:"Open Wallet in Telegram or select your wallet to connect"}),ie(CH,{get leftIcon(){return ie(bW,{})},get rightIcon(){return ie(EH,{get src(){return Qd.TG}})},onClick:S,scale:"s",get children(){return ie(rn,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegram",children:"Open Wallet in Telegram"})}}),ie(wH,{get children(){return[ie(Vd,{get each(){return ft(()=>!!u())()?l().slice(0,4):l()},children:P=>(()=>{const L=H7.cloneNode(!0);return An(L,ie(Ep,{get icon(){return P.imageUrl},get name(){return P.name},onClick:()=>e.onSelect(P)})),L})()}),ie(Dt,{get when(){return u()},get children(){const P=H7.cloneNode(!0);return An(P,ie(CI,{labelLine1:"View all",labelLine2:"wallets",get images(){return l().slice(3,7).map(L=>L.imageUrl)},onClick:()=>e.onSelectAllWallets()})),P}}),ie(_H,{children:" "}),ie(q7,{onClick:b,get children(){return[ie(W7,{get children(){return ie(Fq,{})}}),ie(di,{fontWeight:590,translationKey:"walletModal.mobileUniversalModal.openLink",children:"Open Link"})]}}),ie(q7,{onClick:v,get children(){return[ie(W7,{get children(){return ft(()=>d()!==void 0)()?ie(_W,{}):ie(SI,{})}}),ie(di,{fontWeight:590,get translationKey(){return d()!==void 0?"common.copied":"common.copyLink"},get children(){return d()!==void 0?"Copied":"Copy Link"}})]}})]}})]}}),null),M})()},qI={m:"16px",s:"8px",none:"0"},PH={m:"8px",s:"4px",none:"0"},RH=je.div` display: flex; flex-direction: column; align-items: center; padding-bottom: 16px; -`,LH=je(hs)` +`,OH=je(hs)` max-width: 320px; margin-top: 2px; margin-bottom: 20px; -`,DH=je(hs)` +`,NH=je(hs)` margin-bottom: 16px; -`,UH=je(U1)` +`,LH=je(U1)` margin-bottom: 24px; -`,jH=je.ul` +`,DH=je.ul` display: flex; `;je.div` display: flex; @@ -1028,7 +1028,7 @@ PERFORMANCE OF THIS SOFTWARE. width: 100%; padding: 0 16px; height: 56px; - border-radius: ${e=>$I[e.theme.borderRadius]}; + border-radius: ${e=>qI[e.theme.borderRadius]}; &:hover { ${e=>e.disableEventsAnimation?"transform: unset;":""} @@ -1047,7 +1047,7 @@ PERFORMANCE OF THIS SOFTWARE. transform: translateY(-16px); background-color: ${e=>e.theme.colors.background.primary}; - border-radius: ${e=>$I[e.theme.borderRadius]}; + border-radius: ${e=>qI[e.theme.borderRadius]}; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16); `;je.li` padding: 8px; @@ -1057,7 +1057,7 @@ PERFORMANCE OF THIS SOFTWARE. gap: 8px; cursor: pointer; - border-radius: ${e=>OH[e.theme.borderRadius]}; + border-radius: ${e=>PH[e.theme.borderRadius]}; transition: background-color, transform 0.1s ease-in-out; @@ -1083,14 +1083,14 @@ PERFORMANCE OF THIS SOFTWARE. `;je(di)` color: ${e=>e.theme.colors.text.secondary}; font-size: 16px; -`;const FH=Zt("
  • "),zH=e=>{const[t,r]=Rt(!1),n=rr.connector,o=ft(()=>FI(e.walletsList),null,{equals:zI});gn({openMethod:"qrcode"});const i=ft(()=>n.connect(o(),e.additionalRequest));return ie(NH,{onClick:()=>r(!1),"data-tc-wallets-modal-universal-desktop":"true",get children(){return[ie(Po,{translationKey:"walletModal.desktopUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(LH,{translationKey:"walletModal.desktopUniversalModal.scan",children:"Scan with your mobile wallet"}),ie(UH,{get sourceUrl(){return cr(i(),"none")},get disableCopy(){return t()},get imageUrl(){return Qd.TON}}),ie(DH,{translationKey:"walletModal.desktopUniversalModal.availableWallets",children:"Available wallets"}),ie(jH,{get children(){return[ie(Vd,{get each(){return e.walletsList.slice(0,3)},children:a=>(()=>{const s=FH.cloneNode(!0);return An(s,ie(CI,{wallet:a,onClick:()=>e.onSelect(a)})),s})()}),ie(SI,{labelLine1:"View all",labelLine2:"wallets",get images(){return e.walletsList.slice(3,7).map(a=>a.imageUrl)},onClick:()=>e.onSelectAllWallets()})]}})]}})},$H=()=>{const{locale:e}=Bo()[1];ln(()=>e(rr.language)),ln(()=>{v7()?kp():(i(null),s("universal"),u(!1))});const t=$n(ac),r=$n(ps),[n]=lz(()=>r.getWallets()),[o,i]=Rt(null),[a,s]=Rt("universal"),[l,u]=Rt(!1),c=ft(()=>{if(n.state!=="ready")return null;let k=r5(n(),rr.walletsListConfiguration);const M=k.filter(Vs),P=k.filter(Z=>!Vs(Z));k=(M||[]).concat(P);const L=rr.preferredWalletAppName,j=k.find(Z=>Ea(Z,L)),V=k.filter(Z=>Ea(Z,L)).length>=2;L&&j&&!V&&(k=[ui(ur({},j),{isPreferred:!0})].concat(k.filter(Z=>!Ea(Z,L))));const K=k.find(Z=>Ea(Z,Go));return K&&(k=[K].concat(k.filter(Z=>!Ea(Z,Go)))),k}),h=()=>{var k;return((k=rr.connectRequestParameters)==null?void 0:k.state)==="loading"},d=ft(()=>{var k;if(!h())return(k=rr.connectRequestParameters)==null?void 0:k.value}),p=k=>{r.closeModal(k)},v=t.onStatusChange(k=>{k&&p("wallet-selected")}),b=()=>{s("all-wallets")},S=()=>{s("universal")},x=()=>{i(null)};return zn(()=>{i(null),u(!1)}),zn(v),ie(RI,{get opened(){return v7()},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>p("action-cancelled"),onClickQuestion:()=>u(k=>!k),"data-tc-wallets-modal-container":"true",get children(){return[ie(Dt,{get when(){return l()},get children(){return ie(DI,{onBackClick:()=>u(!1)})}}),ie(Dt,{get when(){return!l()},get children(){return[ie(Dt,{get when(){return h()||!c()},get children(){return[ie(OI,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),ie(NI,{get children(){return ie(da,{size:"m"})}})]}}),ie(Dt,{get when(){return ft(()=>!h())()&&c()},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return o()},get children(){return ie(Uu,{get component(){return Fu()?UI:LI},get wallet(){return o()},get additionalRequest(){return d()},onBackClick:x})}}),ie(pn,{get when(){return a()==="universal"},get children(){return ie(Uu,{get component(){return Fu()?RH:zH},onSelect:i,get walletsList(){return c()},get additionalRequest(){return d()},onSelectAllWallets:b})}}),ie(pn,{get when(){return a()==="all-wallets"},get children(){return ie(zV,{get walletsList(){return c()},onBack:S,onSelect:i})}})]}})}})]}})]}})},qH=je.div` +`;const UH=Zt("
  • "),jH=e=>{const[t,r]=Rt(!1),n=rr.connector,o=ft(()=>zI(e.walletsList),null,{equals:$I});gn({openMethod:"qrcode"});const i=ft(()=>n.connect(o(),e.additionalRequest));return ie(RH,{onClick:()=>r(!1),"data-tc-wallets-modal-universal-desktop":"true",get children(){return[ie(Po,{translationKey:"walletModal.desktopUniversalModal.connectYourWallet",children:"Connect your wallet"}),ie(OH,{translationKey:"walletModal.desktopUniversalModal.scan",children:"Scan with your mobile wallet"}),ie(LH,{get sourceUrl(){return cr(i(),"none")},get disableCopy(){return t()},get imageUrl(){return Qd.TON}}),ie(NH,{translationKey:"walletModal.desktopUniversalModal.availableWallets",children:"Available wallets"}),ie(DH,{get children(){return[ie(Vd,{get each(){return e.walletsList.slice(0,3)},children:a=>(()=>{const s=UH.cloneNode(!0);return An(s,ie(EI,{wallet:a,onClick:()=>e.onSelect(a)})),s})()}),ie(CI,{labelLine1:"View all",labelLine2:"wallets",get images(){return e.walletsList.slice(3,7).map(a=>a.imageUrl)},onClick:()=>e.onSelectAllWallets()})]}})]}})},FH=()=>{const{locale:e}=Bo()[1];ln(()=>e(rr.language)),ln(()=>{y7()?kp():(i(null),s("universal"),u(!1))});const t=$n(ac),r=$n(ps),[n]=az(()=>r.getWallets()),[o,i]=Rt(null),[a,s]=Rt("universal"),[l,u]=Rt(!1),c=ft(()=>{if(n.state!=="ready")return null;let k=t5(n(),rr.walletsListConfiguration);const M=k.filter(Vs),P=k.filter(Z=>!Vs(Z));k=(M||[]).concat(P);const L=rr.preferredWalletAppName,j=k.find(Z=>Ea(Z,L)),V=k.filter(Z=>Ea(Z,L)).length>=2;L&&j&&!V&&(k=[ui(ur({},j),{isPreferred:!0})].concat(k.filter(Z=>!Ea(Z,L))));const K=k.find(Z=>Ea(Z,Go));return K&&(k=[K].concat(k.filter(Z=>!Ea(Z,Go)))),k}),h=()=>{var k;return((k=rr.connectRequestParameters)==null?void 0:k.state)==="loading"},d=ft(()=>{var k;if(!h())return(k=rr.connectRequestParameters)==null?void 0:k.value}),p=k=>{r.closeModal(k)},v=t.onStatusChange(k=>{k&&p("wallet-selected")}),b=()=>{s("all-wallets")},S=()=>{s("universal")},x=()=>{i(null)};return zn(()=>{i(null),u(!1)}),zn(v),ie(OI,{get opened(){return y7()},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>p("action-cancelled"),onClickQuestion:()=>u(k=>!k),"data-tc-wallets-modal-container":"true",get children(){return[ie(Dt,{get when(){return l()},get children(){return ie(UI,{onBackClick:()=>u(!1)})}}),ie(Dt,{get when(){return!l()},get children(){return[ie(Dt,{get when(){return h()||!c()},get children(){return[ie(NI,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),ie(LI,{get children(){return ie(da,{size:"m"})}})]}}),ie(Dt,{get when(){return ft(()=>!h())()&&c()},get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return o()},get children(){return ie(Uu,{get component(){return Fu()?jI:DI},get wallet(){return o()},get additionalRequest(){return d()},onBackClick:x})}}),ie(pn,{get when(){return a()==="universal"},get children(){return ie(Uu,{get component(){return Fu()?BH:jH},onSelect:i,get walletsList(){return c()},get additionalRequest(){return d()},onSelectAllWallets:b})}}),ie(pn,{get when(){return a()==="all-wallets"},get children(){return ie(jV,{get walletsList(){return c()},onBack:S,onSelect:i})}})]}})}})]}})]}})},zH=je.div` display: flex; flex-direction: column; align-items: center; padding-bottom: 8px; -`,WH=je(Po)` +`,$H=je(Po)` margin-top: 16px; -`,VH=je(di)` +`,qH=je(di)` font-weight: 510; font-size: 16px; line-height: 20px; @@ -1098,15 +1098,15 @@ PERFORMANCE OF THIS SOFTWARE. max-width: 250px; color: ${e=>e.theme.colors.text.secondary}; -`,HH=je($r)` +`,WH=je($r)` min-width: 112px; margin-top: 32px; -`,KH=je(da)` +`,VH=je(da)` height: 16px; width: 16px; -`,H7=je($r)` +`,K7=je($r)` margin-top: 32px; -`,n5=e=>{const t=Yd(e),r=$n(ps),[n,o]=Rt(!0),[i,a]=Rt(!1);ln(()=>{const c=Fo();a(!!c&&"sent"in c&&c.sent)});let s;r!=null&&r.wallet&&"universalLink"in r.wallet&&(r.wallet.openMethod==="universal-link"||Ws(r.wallet.universalLink)&&aa())&&(s=r.wallet.universalLink);let l;r!=null&&r.wallet&&"deepLink"in r.wallet&&(r.wallet.openMethod==="custom-deeplink"||Ws(r.wallet.deepLink)&&aa())&&(l=r.wallet.deepLink);const u=()=>{const c=Fo(),h="returnStrategy"in c?c.returnStrategy:rr.returnStrategy,d=!n();o(!1),Ws(s)?Xd(s,{returnStrategy:h,twaReturnUrl:"twaReturnUrl"in c?c.twaReturnUrl:rr.twaReturnUrl,forceRedirect:d}):Jd(s,l,{returnStrategy:h,forceRedirect:d},()=>{})};return ie(qH,bo(t,{get children(){return[ft(()=>e.icon),ie(WH,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),ie(VH,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),ie(Dt,{get when(){return!i()&&(e.showButton==="open-wallet"&&s||e.showButton!=="open-wallet")},get children(){return ie(HH,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return ie(KH,{})}})}}),ie(Dt,{get when(){return i()},get children(){return[ie(Dt,{get when(){return e.showButton!=="open-wallet"},get children(){return ie(H7,{onClick:()=>e.onClose(),get children(){return ie(rn,{translationKey:"common.close",children:"Close"})}})}}),ie(Dt,{get when(){return e.showButton==="open-wallet"&&s},get children(){return ie(H7,{onClick:u,get children(){return ie(rn,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},ZH=e=>{const t=$n(ps),[r]=Bo(),n=()=>t.wallet&&"name"in t.wallet?t.wallet.name:r("common.yourWallet",{},"Your wallet");return ie(n5,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:n()}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return ie(da,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},GH=e=>ie(n5,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return ie(j1,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),YH=e=>ie(n5,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return ie(Xw,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),QH=()=>ie(vI,{get opened(){var e;return ft(()=>Fo()!==null)()&&((e=Fo())==null?void 0:e.openModal)===!0},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>cu(null),"data-tc-actions-modal-container":"true",get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return Fo().name==="transaction-sent"},get children(){return ie(YH,{onClose:()=>cu(null)})}}),ie(pn,{get when(){return Fo().name==="transaction-canceled"},get children(){return ie(GH,{onClose:()=>cu(null)})}}),ie(pn,{get when(){return Fo().name==="confirm-transaction"},get children(){return ie(ZH,{onClose:()=>cu(null)})}})]}})}}),XH=()=>{const{locale:e}=Bo()[1];ln(()=>e(rr.language)),ln(()=>{b7()&&kp()});const t=$n(ac),r=$n(ps),[n,o]=Rt(!1),i=()=>{var u;return((u=rr.connectRequestParameters)==null?void 0:u.state)==="loading"},a=ft(()=>{var u;if(!i())return(u=rr.connectRequestParameters)==null?void 0:u.value}),s=u=>{r.closeSingleWalletModal(u)},l=t.onStatusChange(u=>{u&&s("wallet-selected")});return zn(l),zn(()=>{o(!1)}),ie(RI,{get opened(){return b7()},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>s("action-cancelled"),onClickQuestion:()=>o(u=>!u),"data-tc-wallets-modal-container":"true",get children(){return[ie(Dt,{get when(){return n()},get children(){return ie(DI,{onBackClick:()=>o(!1)})}}),ie(Dt,{get when(){return!n()},get children(){return[ie(Dt,{get when(){return i()},get children(){return[ie(OI,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),ie(NI,{get children(){return ie(da,{size:"m"})}})]}}),ie(Dt,{get when(){return!i()},get children(){return ie(Uu,{get component(){return Fu()?UI:LI},get wallet(){return u$()},get additionalRequest(){return a()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},JH=e=>{const t=Aq(k$,rr.language);return n$(),r$(),ie(wI.Provider,{value:t,get children(){return ie(ps.Provider,{get value(){return e.tonConnectUI},get children(){return ie(ac.Provider,{get value(){return rr.connector},get children(){return[ie(Zz,{}),ie(Hz,{theme:O$,get children(){return[ie(Dt,{get when(){return rr.buttonRootId},get children(){return ie(JM,{get mount(){return document.getElementById(rr.buttonRootId)},get children(){return ie(BV,{})}})}}),ie(Uu,{component:jo,get children(){return[ie($H,{}),ie(XH,{}),ie(QH,{})]}})]}})]}})}})}})},ai={openWalletsModal:()=>void setTimeout(()=>m7({status:"opened",closeReason:null})),closeWalletsModal:e=>void setTimeout(()=>m7({status:"closed",closeReason:e})),openSingleWalletModal:e=>{setTimeout(()=>y7({status:"opened",closeReason:null,walletInfo:e}))},closeSingleWalletModal:e=>void setTimeout(()=>y7({status:"closed",closeReason:e})),setAction:e=>void setTimeout(()=>cu(e)),clearAction:()=>void setTimeout(()=>cu(null)),getSelectedWalletInfo:()=>c$(),removeSelectedWalletInfo:()=>gn(null),renderApp:(e,t)=>Az(()=>ie(JH,{tonConnectUI:t}),document.getElementById(e))};class eK{constructor(t){Bt(this,"connector"),Bt(this,"setConnectRequestParametersCallback"),Bt(this,"consumers",[]),Bt(this,"tracker"),Bt(this,"state",a4()),this.connector=t.connector,this.tracker=t.tracker,this.setConnectRequestParametersCallback=t.setConnectRequestParametersCallback,ln(()=>{const r=a4();this.state=r,this.consumers.forEach(n=>n(r))})}open(){return ar(this,null,function*(){this.tracker.trackConnectionStarted();const r=(yield this.connector.getWallets()).find(R1);return r?this.connectEmbeddedWallet(r):this.openWalletsModal()})}close(t="action-cancelled"){t==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),ai.closeWalletsModal(t)}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}connectEmbeddedWallet(t){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;(n==null?void 0:n.state)==="loading"?this.setConnectRequestParametersCallback(r):r(n==null?void 0:n.value)}openWalletsModal(){return ar(this,null,function*(){return aa()&&Zw(),ai.openWalletsModal(),new Promise(t=>{const r=this.onStateChange(n=>{const{status:o}=n;o==="opened"&&(r(),t())})})})}}class tK{constructor(t){Bt(this,"connector"),Bt(this,"consumers",[]),this.connector=t.connector,ln(()=>{const r=Fo();this.consumers.forEach(n=>n(r))})}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}}class rK{constructor(t){Bt(this,"connector"),Bt(this,"setConnectRequestParametersCallback"),Bt(this,"consumers",[]),Bt(this,"tracker"),Bt(this,"state",bp()),this.connector=t.connector,this.tracker=t.tracker,this.setConnectRequestParametersCallback=t.setConnectRequestParametersCallback,ln(()=>{const r=bp();this.state=r,this.consumers.forEach(n=>n(r))})}open(t){return ar(this,null,function*(){this.tracker.trackConnectionStarted();const r=yield this.connector.getWallets(),n=r5(r,rr.walletsListConfiguration),o=n.find(R1);if(!!o)return this.connectEmbeddedWallet(o);const s=n.filter(Nw).find(c=>Ea(c,t));if(!!s)return this.openSingleWalletModal(s);const u=`Trying to open modal window with unknown wallet "${t}".`;throw this.tracker.trackConnectionError(u),new Fr(u)})}close(t="action-cancelled"){t==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),ai.closeSingleWalletModal("action-cancelled")}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}connectEmbeddedWallet(t){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;(n==null?void 0:n.state)==="loading"?this.setConnectRequestParametersCallback(r):r(n==null?void 0:n.value)}openSingleWalletModal(t){return ar(this,null,function*(){return aa()&&Zw(),ai.openSingleWalletModal(t),new Promise(r=>{const n=this.onStateChange(o=>{const{status:i}=o;i==="opened"&&(n(),r())})})})}}class nK{constructor(t){Bt(this,"eventPrefix","ton-connect-ui-"),Bt(this,"tonConnectUiVersion"),Bt(this,"tonConnectSdkVersion",null),Bt(this,"eventDispatcher");var r;this.eventDispatcher=(r=t==null?void 0:t.eventDispatcher)!=null?r:new UM,this.tonConnectUiVersion=t.tonConnectUiVersion,this.init().catch()}get version(){return Nl({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return ar(this,null,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch{}})}setRequestVersionHandler(){return ar(this,null,function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",()=>ar(this,null,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",AM(this.tonConnectUiVersion))}))})}requestTonConnectSdkVersion(){return ar(this,null,function*(){return new Promise((t,r)=>ar(this,null,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",n=>{t(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",kM())}catch(n){r(n)}}))})}dispatchUserActionEvent(t){var r;try{(r=this.eventDispatcher)==null||r.dispatchEvent(`${this.eventPrefix}${t.type}`,t).catch()}catch{}}trackConnectionStarted(...t){try{const r=MM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...t){try{const r=IM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...t){try{const r=TM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...t){try{const r=BM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...t){try{const r=PM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...t){try{const r=RM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...t){try{const r=DM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...t){try{const r=OM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...t){try{const r=NM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...t){try{const r=LM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}}const iK="2.0.5";class oK{constructor(t){if(Bt(this,"walletInfoStorage",new s$),Bt(this,"preferredWalletStorage",new l$),Bt(this,"tracker"),Bt(this,"walletInfo",null),Bt(this,"systemThemeChangeUnsubscribe",null),Bt(this,"actionsConfiguration"),Bt(this,"walletsList"),Bt(this,"connectRequestParametersCallback"),Bt(this,"connector"),Bt(this,"modal"),Bt(this,"singleWalletModal"),Bt(this,"transactionModal"),Bt(this,"connectionRestored",Promise.resolve(!1)),t&&"connector"in t&&t.connector)this.connector=t.connector;else if(t&&"manifestUrl"in t&&t.manifestUrl)this.connector=new tl({manifestUrl:t.manifestUrl,eventDispatcher:t==null?void 0:t.eventDispatcher});else throw new Fr("You have to specify a `manifestUrl` or a `connector` in the options.");this.tracker=new nK({eventDispatcher:t==null?void 0:t.eventDispatcher,tonConnectUiVersion:iK}),this.modal=new eK({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:o=>{this.connectRequestParametersCallback=o}}),this.singleWalletModal=new rK({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:o=>{this.connectRequestParametersCallback=o}}),this.transactionModal=new tK({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then(o=>iI(PV(o.map(i=>i.imageUrl))));const r=this.normalizeWidgetRoot(t==null?void 0:t.widgetRootId);this.subscribeToWalletChange(),(t==null?void 0:t.restoreConnection)!==!1&&(this.connectionRestored=i$(()=>ar(this,null,function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))),this.uiOptions=ja(t,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();Zh({connector:this.connector,preferredWalletAppName:n}),ai.renderApp(r,this)}static getWallets(){return tl.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?ur(ur({},this.connector.wallet),this.walletInfo):null}set uiOptions(t){var r,n,o,i,a;this.checkButtonRootExist(t.buttonRootId),this.actionsConfiguration=t.actionsConfiguration,(r=t.uiPreferences)!=null&&r.theme?((n=t.uiPreferences)==null?void 0:n.theme)!=="SYSTEM"?((o=this.systemThemeChangeUnsubscribe)==null||o.call(this),d2(t.uiPreferences.theme,t.uiPreferences.colorsSet)):(d2(Xz(),t.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=Jz(d2))):(i=t.uiPreferences)!=null&&i.colorsSet&&L$(t.uiPreferences.colorsSet),(a=t.uiPreferences)!=null&&a.borderRadius&&N$(t.uiPreferences.borderRadius),Zh(s=>{var l,u;const c=ja(ur(ur(ur(ur({},t.language&&{language:t.language}),!!((l=t.actionsConfiguration)!=null&&l.returnStrategy)&&{returnStrategy:t.actionsConfiguration.returnStrategy}),!!((u=t.actionsConfiguration)!=null&&u.twaReturnUrl)&&{twaReturnUrl:t.actionsConfiguration.twaReturnUrl}),!!t.walletsListConfiguration&&{walletsListConfiguration:t.walletsListConfiguration}),ju(s));return t.buttonRootId!==void 0&&(c.buttonRootId=t.buttonRootId),t.enableAndroidBackHandler!==void 0&&(c.enableAndroidBackHandler=t.enableAndroidBackHandler),c})}setConnectRequestParameters(t){var r;Zh({connectRequestParameters:t}),((t==null?void 0:t.state)==="ready"||!t)&&((r=this.connectRequestParametersCallback)==null||r.call(this,t==null?void 0:t.value))}getWallets(){return ar(this,null,function*(){return this.connector.getWallets()})}onStatusChange(t,r){return this.connector.onStatusChange(n=>ar(this,null,function*(){if(n){const o=yield this.getSelectedWalletInfo(n);t(ur(ur({},n),o||this.walletInfoStorage.getWalletInfo()))}else t(n)}),r)}openModal(){return ar(this,null,function*(){return this.modal.open()})}closeModal(t){this.modal.close(t)}onModalStateChange(t){return this.modal.onStateChange(t)}get modalState(){return this.modal.state}openSingleWalletModal(t){return ar(this,null,function*(){return this.singleWalletModal.open(t)})}closeSingleWalletModal(t){this.singleWalletModal.close(t)}onSingleWalletModalStateChange(t){return this.singleWalletModal.onStateChange(t)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return ar(this,null,function*(){const r=(yield this.getWallets()).find(R1);return r?yield this.connectEmbeddedWallet(r):yield this.connectExternalWallet()})}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),ai.clearAction(),ai.removeSelectedWalletInfo(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(t,r){return ar(this,null,function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,t),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,t,"Wallet was not connected"),new Fr("Connect wallet to send a transaction.");aa()&&Zw();const{notifications:n,modals:o,returnStrategy:i,twaReturnUrl:a,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(r);ai.setAction({name:"confirm-transaction",showNotification:n.includes("before"),openModal:o.includes("before"),sent:!1});const l=()=>{u.signal.aborted||(ai.setAction({name:"confirm-transaction",showNotification:n.includes("before"),openModal:o.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&(this.walletInfo.openMethod==="universal-link"||this.walletInfo.openMethod==="custom-deeplink")&&(Ws(this.walletInfo.universalLink)?Xd(this.walletInfo.universalLink,{returnStrategy:i,twaReturnUrl:a||rr.twaReturnUrl,forceRedirect:!1}):Jd(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:i,forceRedirect:!1},()=>{})))},u=new AbortController,c=this.onTransactionModalStateChange(h=>{h!=null&&h.openModal||(c(),h||u.abort())});try{const h=yield this.waitForSendTransaction({transaction:t,signal:u.signal},l);return this.tracker.trackTransactionSigned(this.wallet,t,h),ai.setAction({name:"transaction-sent",showNotification:n.includes("success"),openModal:o.includes("success")}),h}catch(h){throw ai.setAction({name:"transaction-canceled",showNotification:n.includes("error"),openModal:o.includes("error")}),h instanceof Mt?h:(console.error(h),new Fr("Unhandled error:"+h))}finally{c()}})}connectEmbeddedWallet(t){return ar(this,null,function*(){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;return(n==null?void 0:n.state)==="loading"?this.connectRequestParametersCallback=r:r(n==null?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})})}connectExternalWallet(){return ar(this,null,function*(){const t=new AbortController;ai.openWalletsModal();const r=this.onModalStateChange(n=>{const{status:o,closeReason:i}=n;o!=="opened"&&(r(),i==="action-cancelled"&&t.abort())});return yield this.waitForWalletConnection({ignoreErrors:!0,signal:t.signal})})}waitForWalletConnection(t){return ar(this,null,function*(){return new Promise((r,n)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:o=!1,signal:i=null}=t;if(i&&i.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),n(new Fr("Wallet was not connected"));const a=u=>ar(this,null,function*(){if(u)this.tracker.trackConnectionCompleted(u),l(),r(u);else{if(this.tracker.trackConnectionError("Connection was cancelled"),o)return;l(),n(new Fr("Wallet was not connected"))}}),s=u=>{this.tracker.trackConnectionError(u.message),!o&&(l(),n(u))},l=this.onStatusChange(u=>a(u),u=>s(u));i&&i.addEventListener("abort",()=>{l(),n(new Fr("Wallet was not connected"))},{once:!0})})})}waitForSendTransaction(t,r){return ar(this,null,function*(){return new Promise((n,o)=>{const{transaction:i,signal:a}=t;if(a.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),o(new Fr("Transaction was not sent"));const s=c=>ar(this,null,function*(){n(c)}),l=c=>{o(c)},u=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),o(new Fr("Transaction was not sent"))};a.addEventListener("abort",u,{once:!0}),this.connector.sendTransaction(i,{onRequestSent:r,signal:a}).then(c=>(a.removeEventListener("abort",u),s(c))).catch(c=>(a.removeEventListener("abort",u),l(c)))})})}onTransactionModalStateChange(t){return this.transactionModal.onStateChange(t)}subscribeToWalletChange(){this.connector.onStatusChange(t=>ar(this,null,function*(){var r;t?(yield this.updateWalletInfo(t),this.setPreferredWalletAppName(((r=this.walletInfo)==null?void 0:r.appName)||t.device.appName)):this.walletInfoStorage.removeWalletInfo()}))}setPreferredWalletAppName(t){this.preferredWalletStorage.setPreferredWalletAppName(t),Zh({preferredWalletAppName:t})}getSelectedWalletInfo(t){return ar(this,null,function*(){let r=ai.getSelectedWalletInfo();if(!r)return null;let n;if("name"in r)n=r;else{const i=r5(yield this.walletsList,rr.walletsListConfiguration).find(a=>Ea(a,t.device.appName));if(!i)throw new Fr(`Cannot find WalletInfo for the '${t.device.appName}' wallet`);n=ur(ur({},i),r)}return n})}updateWalletInfo(t){return ar(this,null,function*(){const r=yield this.getSelectedWalletInfo(t);if(r){this.walletInfo=r,this.walletInfoStorage.setWalletInfo(r);return}const n=this.walletInfoStorage.getWalletInfo();if(n){this.walletInfo=n;return}this.walletInfo=(yield this.walletsList).find(o=>Ea(o,t.device.appName))||null})}normalizeWidgetRoot(t){if(!t||!document.getElementById(t)){t="tc-widget-root";const r=document.createElement("div");r.id=t,document.body.appendChild(r)}return t}checkButtonRootExist(t){if(t!=null&&!document.getElementById(t))throw new Fr(`${t} element not found in the document.`)}getModalsAndNotificationsConfiguration(t){var r,n,o,i,a,s;const l=["before","success","error"];let u=l;(r=this.actionsConfiguration)!=null&&r.notifications&&((n=this.actionsConfiguration)==null?void 0:n.notifications)!=="all"&&(u=this.actionsConfiguration.notifications),t!=null&&t.notifications&&(t.notifications==="all"?u=l:u=t.notifications);let c=["before"];(o=this.actionsConfiguration)!=null&&o.modals&&(this.actionsConfiguration.modals==="all"?c=l:c=this.actionsConfiguration.modals),t!=null&&t.modals&&(t.modals==="all"?c=l:c=t.modals);const h=(t==null?void 0:t.returnStrategy)||((i=this.actionsConfiguration)==null?void 0:i.returnStrategy)||"back",d=(t==null?void 0:t.twaReturnUrl)||((a=this.actionsConfiguration)==null?void 0:a.twaReturnUrl);let p=(t==null?void 0:t.skipRedirectToWallet)||((s=this.actionsConfiguration)==null?void 0:s.skipRedirectToWallet)||"ios";return aa()&&(p="never"),{notifications:u,modals:c,returnStrategy:h,twaReturnUrl:d,skipRedirectToWallet:p}}}var aK=Object.defineProperty,Mp=Object.getOwnPropertySymbols,qI=Object.prototype.hasOwnProperty,WI=Object.prototype.propertyIsEnumerable,K7=(e,t,r)=>t in e?aK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sK=(e,t)=>{for(var r in t||(t={}))qI.call(t,r)&&K7(e,r,t[r]);if(Mp)for(var r of Mp(t))WI.call(t,r)&&K7(e,r,t[r]);return e},lK=(e,t)=>{var r={};for(var n in e)qI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mp)for(var n of Mp(e))t.indexOf(n)<0&&WI.call(e,n)&&(r[n]=e[n]);return r},VI={exports:{}},Pc={};/** +`,r5=e=>{const t=Yd(e),r=$n(ps),[n,o]=Rt(!0),[i,a]=Rt(!1);ln(()=>{const c=Fo();a(!!c&&"sent"in c&&c.sent)});let s;r!=null&&r.wallet&&"universalLink"in r.wallet&&(r.wallet.openMethod==="universal-link"||Ws(r.wallet.universalLink)&&aa())&&(s=r.wallet.universalLink);let l;r!=null&&r.wallet&&"deepLink"in r.wallet&&(r.wallet.openMethod==="custom-deeplink"||Ws(r.wallet.deepLink)&&aa())&&(l=r.wallet.deepLink);const u=()=>{const c=Fo(),h="returnStrategy"in c?c.returnStrategy:rr.returnStrategy,d=!n();o(!1),Ws(s)?Xd(s,{returnStrategy:h,twaReturnUrl:"twaReturnUrl"in c?c.twaReturnUrl:rr.twaReturnUrl,forceRedirect:d}):Jd(s,l,{returnStrategy:h,forceRedirect:d},()=>{})};return ie(zH,bo(t,{get children(){return[ft(()=>e.icon),ie($H,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),ie(qH,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),ie(Dt,{get when(){return!i()&&(e.showButton==="open-wallet"&&s||e.showButton!=="open-wallet")},get children(){return ie(WH,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return ie(VH,{})}})}}),ie(Dt,{get when(){return i()},get children(){return[ie(Dt,{get when(){return e.showButton!=="open-wallet"},get children(){return ie(K7,{onClick:()=>e.onClose(),get children(){return ie(rn,{translationKey:"common.close",children:"Close"})}})}}),ie(Dt,{get when(){return e.showButton==="open-wallet"&&s},get children(){return ie(K7,{onClick:u,get children(){return ie(rn,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},HH=e=>{const t=$n(ps),[r]=Bo(),n=()=>t.wallet&&"name"in t.wallet?t.wallet.name:r("common.yourWallet",{},"Your wallet");return ie(r5,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:n()}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return ie(da,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},KH=e=>ie(r5,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return ie(j1,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),ZH=e=>ie(r5,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return ie(Qw,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),GH=()=>ie(yI,{get opened(){var e;return ft(()=>Fo()!==null)()&&((e=Fo())==null?void 0:e.openModal)===!0},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>cu(null),"data-tc-actions-modal-container":"true",get children(){return ie(Hd,{get children(){return[ie(pn,{get when(){return Fo().name==="transaction-sent"},get children(){return ie(ZH,{onClose:()=>cu(null)})}}),ie(pn,{get when(){return Fo().name==="transaction-canceled"},get children(){return ie(KH,{onClose:()=>cu(null)})}}),ie(pn,{get when(){return Fo().name==="confirm-transaction"},get children(){return ie(HH,{onClose:()=>cu(null)})}})]}})}}),YH=()=>{const{locale:e}=Bo()[1];ln(()=>e(rr.language)),ln(()=>{w7()&&kp()});const t=$n(ac),r=$n(ps),[n,o]=Rt(!1),i=()=>{var u;return((u=rr.connectRequestParameters)==null?void 0:u.state)==="loading"},a=ft(()=>{var u;if(!i())return(u=rr.connectRequestParameters)==null?void 0:u.value}),s=u=>{r.closeSingleWalletModal(u)},l=t.onStatusChange(u=>{u&&s("wallet-selected")});return zn(l),zn(()=>{o(!1)}),ie(OI,{get opened(){return w7()},get enableAndroidBackHandler(){return rr.enableAndroidBackHandler},onClose:()=>s("action-cancelled"),onClickQuestion:()=>o(u=>!u),"data-tc-wallets-modal-container":"true",get children(){return[ie(Dt,{get when(){return n()},get children(){return ie(UI,{onBackClick:()=>o(!1)})}}),ie(Dt,{get when(){return!n()},get children(){return[ie(Dt,{get when(){return i()},get children(){return[ie(NI,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),ie(LI,{get children(){return ie(da,{size:"m"})}})]}}),ie(Dt,{get when(){return!i()},get children(){return ie(Uu,{get component(){return Fu()?jI:DI},get wallet(){return s$()},get additionalRequest(){return a()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},QH=e=>{const t=Eq(C$,rr.language);return t$(),e$(),ie(_I.Provider,{value:t,get children(){return ie(ps.Provider,{get value(){return e.tonConnectUI},get children(){return ie(ac.Provider,{get value(){return rr.connector},get children(){return[ie(Hz,{}),ie(Wz,{theme:P$,get children(){return[ie(Dt,{get when(){return rr.buttonRootId},get children(){return ie(eI,{get mount(){return document.getElementById(rr.buttonRootId)},get children(){return ie(IV,{})}})}}),ie(Uu,{component:jo,get children(){return[ie(FH,{}),ie(YH,{}),ie(GH,{})]}})]}})]}})}})}})},ai={openWalletsModal:()=>void setTimeout(()=>v7({status:"opened",closeReason:null})),closeWalletsModal:e=>void setTimeout(()=>v7({status:"closed",closeReason:e})),openSingleWalletModal:e=>{setTimeout(()=>b7({status:"opened",closeReason:null,walletInfo:e}))},closeSingleWalletModal:e=>void setTimeout(()=>b7({status:"closed",closeReason:e})),setAction:e=>void setTimeout(()=>cu(e)),clearAction:()=>void setTimeout(()=>cu(null)),getSelectedWalletInfo:()=>l$(),removeSelectedWalletInfo:()=>gn(null),renderApp:(e,t)=>Ez(()=>ie(QH,{tonConnectUI:t}),document.getElementById(e))};class XH{constructor(t){Bt(this,"connector"),Bt(this,"setConnectRequestParametersCallback"),Bt(this,"consumers",[]),Bt(this,"tracker"),Bt(this,"state",o4()),this.connector=t.connector,this.tracker=t.tracker,this.setConnectRequestParametersCallback=t.setConnectRequestParametersCallback,ln(()=>{const r=o4();this.state=r,this.consumers.forEach(n=>n(r))})}open(){return ar(this,null,function*(){this.tracker.trackConnectionStarted();const r=(yield this.connector.getWallets()).find(R1);return r?this.connectEmbeddedWallet(r):this.openWalletsModal()})}close(t="action-cancelled"){t==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),ai.closeWalletsModal(t)}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}connectEmbeddedWallet(t){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;(n==null?void 0:n.state)==="loading"?this.setConnectRequestParametersCallback(r):r(n==null?void 0:n.value)}openWalletsModal(){return ar(this,null,function*(){return aa()&&Kw(),ai.openWalletsModal(),new Promise(t=>{const r=this.onStateChange(n=>{const{status:o}=n;o==="opened"&&(r(),t())})})})}}class JH{constructor(t){Bt(this,"connector"),Bt(this,"consumers",[]),this.connector=t.connector,ln(()=>{const r=Fo();this.consumers.forEach(n=>n(r))})}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}}class eK{constructor(t){Bt(this,"connector"),Bt(this,"setConnectRequestParametersCallback"),Bt(this,"consumers",[]),Bt(this,"tracker"),Bt(this,"state",bp()),this.connector=t.connector,this.tracker=t.tracker,this.setConnectRequestParametersCallback=t.setConnectRequestParametersCallback,ln(()=>{const r=bp();this.state=r,this.consumers.forEach(n=>n(r))})}open(t){return ar(this,null,function*(){this.tracker.trackConnectionStarted();const r=yield this.connector.getWallets(),n=t5(r,rr.walletsListConfiguration),o=n.find(R1);if(!!o)return this.connectEmbeddedWallet(o);const s=n.filter(Ow).find(c=>Ea(c,t));if(!!s)return this.openSingleWalletModal(s);const u=`Trying to open modal window with unknown wallet "${t}".`;throw this.tracker.trackConnectionError(u),new Fr(u)})}close(t="action-cancelled"){t==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),ai.closeSingleWalletModal("action-cancelled")}onStateChange(t){return this.consumers.push(t),()=>{this.consumers=this.consumers.filter(r=>r!==t)}}connectEmbeddedWallet(t){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;(n==null?void 0:n.state)==="loading"?this.setConnectRequestParametersCallback(r):r(n==null?void 0:n.value)}openSingleWalletModal(t){return ar(this,null,function*(){return aa()&&Kw(),ai.openSingleWalletModal(t),new Promise(r=>{const n=this.onStateChange(o=>{const{status:i}=o;i==="opened"&&(n(),r())})})})}}class tK{constructor(t){Bt(this,"eventPrefix","ton-connect-ui-"),Bt(this,"tonConnectUiVersion"),Bt(this,"tonConnectSdkVersion",null),Bt(this,"eventDispatcher");var r;this.eventDispatcher=(r=t==null?void 0:t.eventDispatcher)!=null?r:new jM,this.tonConnectUiVersion=t.tonConnectUiVersion,this.init().catch()}get version(){return Nl({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return ar(this,null,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch{}})}setRequestVersionHandler(){return ar(this,null,function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",()=>ar(this,null,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",MM(this.tonConnectUiVersion))}))})}requestTonConnectSdkVersion(){return ar(this,null,function*(){return new Promise((t,r)=>ar(this,null,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",n=>{t(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",AM())}catch(n){r(n)}}))})}dispatchUserActionEvent(t){var r;try{(r=this.eventDispatcher)==null||r.dispatchEvent(`${this.eventPrefix}${t.type}`,t).catch()}catch{}}trackConnectionStarted(...t){try{const r=IM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...t){try{const r=TM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...t){try{const r=BM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...t){try{const r=PM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...t){try{const r=RM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...t){try{const r=OM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...t){try{const r=UM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...t){try{const r=NM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...t){try{const r=LM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...t){try{const r=DM(this.version,...t);this.dispatchUserActionEvent(r)}catch{}}}const rK="2.0.5";class nK{constructor(t){if(Bt(this,"walletInfoStorage",new o$),Bt(this,"preferredWalletStorage",new a$),Bt(this,"tracker"),Bt(this,"walletInfo",null),Bt(this,"systemThemeChangeUnsubscribe",null),Bt(this,"actionsConfiguration"),Bt(this,"walletsList"),Bt(this,"connectRequestParametersCallback"),Bt(this,"connector"),Bt(this,"modal"),Bt(this,"singleWalletModal"),Bt(this,"transactionModal"),Bt(this,"connectionRestored",Promise.resolve(!1)),t&&"connector"in t&&t.connector)this.connector=t.connector;else if(t&&"manifestUrl"in t&&t.manifestUrl)this.connector=new tl({manifestUrl:t.manifestUrl,eventDispatcher:t==null?void 0:t.eventDispatcher});else throw new Fr("You have to specify a `manifestUrl` or a `connector` in the options.");this.tracker=new tK({eventDispatcher:t==null?void 0:t.eventDispatcher,tonConnectUiVersion:rK}),this.modal=new XH({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:o=>{this.connectRequestParametersCallback=o}}),this.singleWalletModal=new eK({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:o=>{this.connectRequestParametersCallback=o}}),this.transactionModal=new JH({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then(o=>oI(TV(o.map(i=>i.imageUrl))));const r=this.normalizeWidgetRoot(t==null?void 0:t.widgetRootId);this.subscribeToWalletChange(),(t==null?void 0:t.restoreConnection)!==!1&&(this.connectionRestored=r$(()=>ar(this,null,function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))),this.uiOptions=ja(t,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();Zh({connector:this.connector,preferredWalletAppName:n}),ai.renderApp(r,this)}static getWallets(){return tl.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?ur(ur({},this.connector.wallet),this.walletInfo):null}set uiOptions(t){var r,n,o,i,a;this.checkButtonRootExist(t.buttonRootId),this.actionsConfiguration=t.actionsConfiguration,(r=t.uiPreferences)!=null&&r.theme?((n=t.uiPreferences)==null?void 0:n.theme)!=="SYSTEM"?((o=this.systemThemeChangeUnsubscribe)==null||o.call(this),d2(t.uiPreferences.theme,t.uiPreferences.colorsSet)):(d2(Yz(),t.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=Qz(d2))):(i=t.uiPreferences)!=null&&i.colorsSet&&O$(t.uiPreferences.colorsSet),(a=t.uiPreferences)!=null&&a.borderRadius&&R$(t.uiPreferences.borderRadius),Zh(s=>{var l,u;const c=ja(ur(ur(ur(ur({},t.language&&{language:t.language}),!!((l=t.actionsConfiguration)!=null&&l.returnStrategy)&&{returnStrategy:t.actionsConfiguration.returnStrategy}),!!((u=t.actionsConfiguration)!=null&&u.twaReturnUrl)&&{twaReturnUrl:t.actionsConfiguration.twaReturnUrl}),!!t.walletsListConfiguration&&{walletsListConfiguration:t.walletsListConfiguration}),ju(s));return t.buttonRootId!==void 0&&(c.buttonRootId=t.buttonRootId),t.enableAndroidBackHandler!==void 0&&(c.enableAndroidBackHandler=t.enableAndroidBackHandler),c})}setConnectRequestParameters(t){var r;Zh({connectRequestParameters:t}),((t==null?void 0:t.state)==="ready"||!t)&&((r=this.connectRequestParametersCallback)==null||r.call(this,t==null?void 0:t.value))}getWallets(){return ar(this,null,function*(){return this.connector.getWallets()})}onStatusChange(t,r){return this.connector.onStatusChange(n=>ar(this,null,function*(){if(n){const o=yield this.getSelectedWalletInfo(n);t(ur(ur({},n),o||this.walletInfoStorage.getWalletInfo()))}else t(n)}),r)}openModal(){return ar(this,null,function*(){return this.modal.open()})}closeModal(t){this.modal.close(t)}onModalStateChange(t){return this.modal.onStateChange(t)}get modalState(){return this.modal.state}openSingleWalletModal(t){return ar(this,null,function*(){return this.singleWalletModal.open(t)})}closeSingleWalletModal(t){this.singleWalletModal.close(t)}onSingleWalletModalStateChange(t){return this.singleWalletModal.onStateChange(t)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return ar(this,null,function*(){const r=(yield this.getWallets()).find(R1);return r?yield this.connectEmbeddedWallet(r):yield this.connectExternalWallet()})}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),ai.clearAction(),ai.removeSelectedWalletInfo(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(t,r){return ar(this,null,function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,t),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,t,"Wallet was not connected"),new Fr("Connect wallet to send a transaction.");aa()&&Kw();const{notifications:n,modals:o,returnStrategy:i,twaReturnUrl:a,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(r);ai.setAction({name:"confirm-transaction",showNotification:n.includes("before"),openModal:o.includes("before"),sent:!1});const l=()=>{u.signal.aborted||(ai.setAction({name:"confirm-transaction",showNotification:n.includes("before"),openModal:o.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&(this.walletInfo.openMethod==="universal-link"||this.walletInfo.openMethod==="custom-deeplink")&&(Ws(this.walletInfo.universalLink)?Xd(this.walletInfo.universalLink,{returnStrategy:i,twaReturnUrl:a||rr.twaReturnUrl,forceRedirect:!1}):Jd(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:i,forceRedirect:!1},()=>{})))},u=new AbortController,c=this.onTransactionModalStateChange(h=>{h!=null&&h.openModal||(c(),h||u.abort())});try{const h=yield this.waitForSendTransaction({transaction:t,signal:u.signal},l);return this.tracker.trackTransactionSigned(this.wallet,t,h),ai.setAction({name:"transaction-sent",showNotification:n.includes("success"),openModal:o.includes("success")}),h}catch(h){throw ai.setAction({name:"transaction-canceled",showNotification:n.includes("error"),openModal:o.includes("error")}),h instanceof Mt?h:(console.error(h),new Fr("Unhandled error:"+h))}finally{c()}})}connectEmbeddedWallet(t){return ar(this,null,function*(){const r=o=>{gn(t),this.connector.connect({jsBridgeKey:t.jsBridgeKey},o)},n=rr.connectRequestParameters;return(n==null?void 0:n.state)==="loading"?this.connectRequestParametersCallback=r:r(n==null?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})})}connectExternalWallet(){return ar(this,null,function*(){const t=new AbortController;ai.openWalletsModal();const r=this.onModalStateChange(n=>{const{status:o,closeReason:i}=n;o!=="opened"&&(r(),i==="action-cancelled"&&t.abort())});return yield this.waitForWalletConnection({ignoreErrors:!0,signal:t.signal})})}waitForWalletConnection(t){return ar(this,null,function*(){return new Promise((r,n)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:o=!1,signal:i=null}=t;if(i&&i.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),n(new Fr("Wallet was not connected"));const a=u=>ar(this,null,function*(){if(u)this.tracker.trackConnectionCompleted(u),l(),r(u);else{if(this.tracker.trackConnectionError("Connection was cancelled"),o)return;l(),n(new Fr("Wallet was not connected"))}}),s=u=>{this.tracker.trackConnectionError(u.message),!o&&(l(),n(u))},l=this.onStatusChange(u=>a(u),u=>s(u));i&&i.addEventListener("abort",()=>{l(),n(new Fr("Wallet was not connected"))},{once:!0})})})}waitForSendTransaction(t,r){return ar(this,null,function*(){return new Promise((n,o)=>{const{transaction:i,signal:a}=t;if(a.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),o(new Fr("Transaction was not sent"));const s=c=>ar(this,null,function*(){n(c)}),l=c=>{o(c)},u=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),o(new Fr("Transaction was not sent"))};a.addEventListener("abort",u,{once:!0}),this.connector.sendTransaction(i,{onRequestSent:r,signal:a}).then(c=>(a.removeEventListener("abort",u),s(c))).catch(c=>(a.removeEventListener("abort",u),l(c)))})})}onTransactionModalStateChange(t){return this.transactionModal.onStateChange(t)}subscribeToWalletChange(){this.connector.onStatusChange(t=>ar(this,null,function*(){var r;t?(yield this.updateWalletInfo(t),this.setPreferredWalletAppName(((r=this.walletInfo)==null?void 0:r.appName)||t.device.appName)):this.walletInfoStorage.removeWalletInfo()}))}setPreferredWalletAppName(t){this.preferredWalletStorage.setPreferredWalletAppName(t),Zh({preferredWalletAppName:t})}getSelectedWalletInfo(t){return ar(this,null,function*(){let r=ai.getSelectedWalletInfo();if(!r)return null;let n;if("name"in r)n=r;else{const i=t5(yield this.walletsList,rr.walletsListConfiguration).find(a=>Ea(a,t.device.appName));if(!i)throw new Fr(`Cannot find WalletInfo for the '${t.device.appName}' wallet`);n=ur(ur({},i),r)}return n})}updateWalletInfo(t){return ar(this,null,function*(){const r=yield this.getSelectedWalletInfo(t);if(r){this.walletInfo=r,this.walletInfoStorage.setWalletInfo(r);return}const n=this.walletInfoStorage.getWalletInfo();if(n){this.walletInfo=n;return}this.walletInfo=(yield this.walletsList).find(o=>Ea(o,t.device.appName))||null})}normalizeWidgetRoot(t){if(!t||!document.getElementById(t)){t="tc-widget-root";const r=document.createElement("div");r.id=t,document.body.appendChild(r)}return t}checkButtonRootExist(t){if(t!=null&&!document.getElementById(t))throw new Fr(`${t} element not found in the document.`)}getModalsAndNotificationsConfiguration(t){var r,n,o,i,a,s;const l=["before","success","error"];let u=l;(r=this.actionsConfiguration)!=null&&r.notifications&&((n=this.actionsConfiguration)==null?void 0:n.notifications)!=="all"&&(u=this.actionsConfiguration.notifications),t!=null&&t.notifications&&(t.notifications==="all"?u=l:u=t.notifications);let c=["before"];(o=this.actionsConfiguration)!=null&&o.modals&&(this.actionsConfiguration.modals==="all"?c=l:c=this.actionsConfiguration.modals),t!=null&&t.modals&&(t.modals==="all"?c=l:c=t.modals);const h=(t==null?void 0:t.returnStrategy)||((i=this.actionsConfiguration)==null?void 0:i.returnStrategy)||"back",d=(t==null?void 0:t.twaReturnUrl)||((a=this.actionsConfiguration)==null?void 0:a.twaReturnUrl);let p=(t==null?void 0:t.skipRedirectToWallet)||((s=this.actionsConfiguration)==null?void 0:s.skipRedirectToWallet)||"ios";return aa()&&(p="never"),{notifications:u,modals:c,returnStrategy:h,twaReturnUrl:d,skipRedirectToWallet:p}}}var iK=Object.defineProperty,Mp=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,VI=Object.prototype.propertyIsEnumerable,Z7=(e,t,r)=>t in e?iK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oK=(e,t)=>{for(var r in t||(t={}))WI.call(t,r)&&Z7(e,r,t[r]);if(Mp)for(var r of Mp(t))VI.call(t,r)&&Z7(e,r,t[r]);return e},aK=(e,t)=>{var r={};for(var n in e)WI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mp)for(var n of Mp(e))t.indexOf(n)<0&&VI.call(e,n)&&(r[n]=e[n]);return r},HI={exports:{}},Pc={};/** * @license React * react-jsx-runtime.production.min.js * @@ -1114,27 +1114,27 @@ PERFORMANCE OF THIS SOFTWARE. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Z7;function uK(){if(Z7)return Pc;Z7=1;var e=Dd,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(s,l,u){var c,h={},d=null,p=null;u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(s&&s.defaultProps)for(c in l=s.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:s,key:d,ref:p,props:h,_owner:o.current}}return Pc.Fragment=r,Pc.jsx=a,Pc.jsxs=a,Pc}(function(e){e.exports=uK()})(VI);const HI=VI.exports.jsx;function KI(){return typeof window<"u"}function cK(){return!KI()}const ZI=dt.createContext(null);let _2=null;const fK=e=>{var t=e,{children:r}=t,n=lK(t,["children"]);return KI()&&!_2&&(_2=new oK(n)),HI(ZI.Provider,{value:_2,children:r})},dK=dt.memo(fK);class i5 extends Fr{constructor(...t){super(...t),Object.setPrototypeOf(this,i5.prototype)}}class o5 extends i5{constructor(...t){super(...t),Object.setPrototypeOf(this,o5.prototype)}}function hK(e){if(!e)throw new o5("You should add on the top of the app to use TonConnect");return!0}function a5(){const e=dt.useContext(ZI),t=dt.useCallback(r=>{e&&(e.uiOptions=r)},[e]);return cK()?[null,()=>{}]:(hK(e),[e,t])}const G7="ton-connect-button",pK=({className:e,style:t})=>{const[r,n]=a5();return dt.useEffect(()=>(n({buttonRootId:G7}),()=>n({buttonRootId:null})),[n]),HI("div",{id:G7,className:e,style:sK({width:"fit-content"},t)})},gK=dt.memo(pK);function mK(){const[e]=a5(),[t,r]=dt.useState((e==null?void 0:e.wallet)||null);return dt.useEffect(()=>{if(e)return r(e.wallet),e.onStatusChange(n=>{r(n)})},[e]),t}function GI(e=!0){const t=mK();return dt.useMemo(()=>t?e?Dw(t.account.address,t.account.chain===cd.TESTNET):t.account.address:"",[t,e,t==null?void 0:t.account.address,t==null?void 0:t.account.chain])}var h4={},Y7=X2;h4.createRoot=Y7.createRoot,h4.hydrateRoot=Y7.hydrateRoot;var yd={},vK={get exports(){return yd},set exports(e){yd=e}},hr={};/** @license React v16.13.1 + */var G7;function sK(){if(G7)return Pc;G7=1;var e=Dd,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(s,l,u){var c,h={},d=null,p=null;u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(s&&s.defaultProps)for(c in l=s.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:s,key:d,ref:p,props:h,_owner:o.current}}return Pc.Fragment=r,Pc.jsx=a,Pc.jsxs=a,Pc}(function(e){e.exports=sK()})(HI);const KI=HI.exports.jsx;function ZI(){return typeof window<"u"}function lK(){return!ZI()}const GI=dt.createContext(null);let _2=null;const uK=e=>{var t=e,{children:r}=t,n=aK(t,["children"]);return ZI()&&!_2&&(_2=new nK(n)),KI(GI.Provider,{value:_2,children:r})},cK=dt.memo(uK);class n5 extends Fr{constructor(...t){super(...t),Object.setPrototypeOf(this,n5.prototype)}}class i5 extends n5{constructor(...t){super(...t),Object.setPrototypeOf(this,i5.prototype)}}function fK(e){if(!e)throw new i5("You should add on the top of the app to use TonConnect");return!0}function o5(){const e=dt.useContext(GI),t=dt.useCallback(r=>{e&&(e.uiOptions=r)},[e]);return lK()?[null,()=>{}]:(fK(e),[e,t])}const Y7="ton-connect-button",dK=({className:e,style:t})=>{const[r,n]=o5();return dt.useEffect(()=>(n({buttonRootId:Y7}),()=>n({buttonRootId:null})),[n]),KI("div",{id:Y7,className:e,style:oK({width:"fit-content"},t)})},hK=dt.memo(dK);function pK(){const[e]=o5(),[t,r]=dt.useState((e==null?void 0:e.wallet)||null);return dt.useEffect(()=>{if(e)return r(e.wallet),e.onStatusChange(n=>{r(n)})},[e]),t}function YI(e=!0){const t=pK();return dt.useMemo(()=>t?e?Lw(t.account.address,t.account.chain===cd.TESTNET):t.account.address:"",[t,e,t==null?void 0:t.account.address,t==null?void 0:t.account.chain])}var d4={},Q7=X2;d4.createRoot=Q7.createRoot,d4.hydrateRoot=Q7.hydrateRoot;var yd={},gK={get exports(){return yd},set exports(e){yd=e}},hr={};/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fn=typeof Symbol=="function"&&Symbol.for,s5=fn?Symbol.for("react.element"):60103,l5=fn?Symbol.for("react.portal"):60106,$1=fn?Symbol.for("react.fragment"):60107,q1=fn?Symbol.for("react.strict_mode"):60108,W1=fn?Symbol.for("react.profiler"):60114,V1=fn?Symbol.for("react.provider"):60109,H1=fn?Symbol.for("react.context"):60110,u5=fn?Symbol.for("react.async_mode"):60111,K1=fn?Symbol.for("react.concurrent_mode"):60111,Z1=fn?Symbol.for("react.forward_ref"):60112,G1=fn?Symbol.for("react.suspense"):60113,yK=fn?Symbol.for("react.suspense_list"):60120,Y1=fn?Symbol.for("react.memo"):60115,Q1=fn?Symbol.for("react.lazy"):60116,bK=fn?Symbol.for("react.block"):60121,wK=fn?Symbol.for("react.fundamental"):60117,_K=fn?Symbol.for("react.responder"):60118,xK=fn?Symbol.for("react.scope"):60119;function yi(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case s5:switch(e=e.type,e){case u5:case K1:case $1:case W1:case q1:case G1:return e;default:switch(e=e&&e.$$typeof,e){case H1:case Z1:case Q1:case Y1:case V1:return e;default:return t}}case l5:return t}}}function YI(e){return yi(e)===K1}hr.AsyncMode=u5;hr.ConcurrentMode=K1;hr.ContextConsumer=H1;hr.ContextProvider=V1;hr.Element=s5;hr.ForwardRef=Z1;hr.Fragment=$1;hr.Lazy=Q1;hr.Memo=Y1;hr.Portal=l5;hr.Profiler=W1;hr.StrictMode=q1;hr.Suspense=G1;hr.isAsyncMode=function(e){return YI(e)||yi(e)===u5};hr.isConcurrentMode=YI;hr.isContextConsumer=function(e){return yi(e)===H1};hr.isContextProvider=function(e){return yi(e)===V1};hr.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===s5};hr.isForwardRef=function(e){return yi(e)===Z1};hr.isFragment=function(e){return yi(e)===$1};hr.isLazy=function(e){return yi(e)===Q1};hr.isMemo=function(e){return yi(e)===Y1};hr.isPortal=function(e){return yi(e)===l5};hr.isProfiler=function(e){return yi(e)===W1};hr.isStrictMode=function(e){return yi(e)===q1};hr.isSuspense=function(e){return yi(e)===G1};hr.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===$1||e===K1||e===W1||e===q1||e===G1||e===yK||typeof e=="object"&&e!==null&&(e.$$typeof===Q1||e.$$typeof===Y1||e.$$typeof===V1||e.$$typeof===H1||e.$$typeof===Z1||e.$$typeof===wK||e.$$typeof===_K||e.$$typeof===xK||e.$$typeof===bK)};hr.typeOf=yi;(function(e){e.exports=hr})(vK);function SK(e){function t(m,B,ne,de,$){for(var he=0,X=0,se=0,pe=0,W,q,ye=0,xe=0,Me,Q=Me=W=0,N=0,D=0,G=0,me=0,_e=ne.length,Pe=_e-1,Fe,Re="",le="",Y="",re="",ge;N<_e;){if(q=ne.charCodeAt(N),N===Pe&&X+pe+se+he!==0&&(X!==0&&(q=X===47?10:47),pe=se=he=0,_e++,Pe++),X+pe+se+he===0){if(N===Pe&&(0W)&&(me=(Re=Re.replace(" ",":")).length),0de&&(de=(B=B.trim()).charCodeAt(0)),de){case 38:return B.replace(x,"$1"+m.trim());case 58:return m.trim()+B.replace(x,"$1"+m.trim());default:if(0<1*ne&&0X.charCodeAt(8))break;case 115:$=$.replace(X,"-webkit-"+X)+";"+$;break;case 207:case 102:$=$.replace(X,"-webkit-"+(102ne.charCodeAt(0)&&(ne=ne.trim()),I=ne,ne=[I],01?t-1:0),n=1;n0?" Args: "+r.join(", "):""))}var LK=function(){function e(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}var t=e.prototype;return t.indexOfGroup=function(r){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,i=o.length,a=i;r>=a;)(a<<=1)<0&&eh(16,""+r);this.groupSizes=new Uint32Array(a),this.groupSizes.set(o),this.length=a;for(var s=i;s=this.length||this.groupSizes[r]===0)return n;for(var o=this.groupSizes[r],i=this.indexOfGroup(r),a=i+o,s=i;s=Uf&&(Uf=t+1),_0.set(e,t),Tp.set(t,e)},jK="style["+zu+'][data-styled-version="5.3.6"]',FK=new RegExp("^"+zu+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),zK=function(e,t,r){for(var n,o=r.split(","),i=0,a=o.length;i=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(zu))return c}}(r),i=o!==void 0?o.nextSibling:null;n.setAttribute(zu,"active"),n.setAttribute("data-styled-version","5.3.6");var a=qK();return a&&n.setAttribute("nonce",a),r.insertBefore(n,i),n},WK=function(){function e(r){var n=this.element=JI(r);n.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var i=document.styleSheets,a=0,s=i.length;a=0){var o=document.createTextNode(n),i=this.nodes[r];return this.element.insertBefore(o,i||null),this.length++,!0}return!1},t.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.getRule=function(r){return r0&&(h+=d+",")}),i+=""+u+c+'{content:"'+h+`"}/*!sc*/ -`}}}return i}(this)},e}(),ZK=/(a)(d)/gi,iS=function(e){return String.fromCharCode(e+(e>25?39:97))};function g4(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=iS(t%52)+r;return(iS(t%52)+r).replace(ZK,"$1-$2")}var du=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},tT=function(e){return du(5381,e)};function GK(e){for(var t=0;t>>0);if(!r.hasNameForId(o,s)){var l=n(a,"."+s,void 0,o);r.insertRules(o,s,l)}i.push(s),this.staticRulesId=s}else{for(var u=this.rules.length,c=du(this.baseHash,n.hash),h="",d=0;d>>0);if(!r.hasNameForId(o,S)){var x=n(h,"."+S,void 0,o);r.insertRules(o,S,x)}i.push(S)}}return i.join(" ")},e}(),XK=/^\s*\/\/.*$/gm,JK=[":","[",".","#"];function eZ(e){var t,r,n,o,i=e===void 0?Fa:e,a=i.options,s=a===void 0?Fa:a,l=i.plugins,u=l===void 0?Ip:l,c=new SK(s),h=[],d=function(b){function S(x){if(x)try{b(x+"}")}catch{}}return function(x,k,M,P,L,j,V,K,Z,ue){switch(x){case 1:if(Z===0&&k.charCodeAt(0)===64)return b(k+";"),"";break;case 2:if(K===0)return k+"/*|*/";break;case 3:switch(K){case 102:case 112:return b(M[0]+k),"";default:return k+(ue===0?"/*|*/":"")}case-2:k.split("/*|*/}").forEach(S)}}}(function(b){h.push(b)}),p=function(b,S,x){return S===0&&JK.indexOf(x[r.length])!==-1||x.match(o)?b:"."+t};function v(b,S,x,k){k===void 0&&(k="&");var M=b.replace(XK,""),P=S&&x?x+" "+S+" { "+M+" }":M;return t=k,r=S,n=new RegExp("\\"+r+"\\b","g"),o=new RegExp("(\\"+r+"\\b){2,}"),c(x||!S?"":S,P)}return c.use([].concat(u,[function(b,S,x){b===2&&x.length&&x[0].lastIndexOf(r)>0&&(x[0]=x[0].replace(n,p))},d,function(b){if(b===-2){var S=h;return h=[],S}}])),v.hash=u.length?u.reduce(function(b,S){return S.name||eh(15),du(b,S.name)},5381).toString():"",v}var rT=Dd.createContext();rT.Consumer;var nT=Dd.createContext(),tZ=(nT.Consumer,new eT),m4=eZ();function rZ(){return dt.useContext(rT)||tZ}function nZ(){return dt.useContext(nT)||m4}var iT=function(){function e(t,r){var n=this;this.inject=function(o,i){i===void 0&&(i=m4);var a=n.name+i.hash;o.hasNameForId(n.id,a)||o.insertRules(n.id,a,i(n.rules,a,"@keyframes"))},this.toString=function(){return eh(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=r}return e.prototype.getName=function(t){return t===void 0&&(t=m4),this.name+t.hash},e}(),iZ=/([A-Z])/,oZ=/([A-Z])/g,aZ=/^ms-/,sZ=function(e){return"-"+e.toLowerCase()};function oS(e){return iZ.test(e)?e.replace(oZ,sZ).replace(aZ,"-ms-"):e}var aS=function(e){return e==null||e===!1||e===""};function $u(e,t,r,n){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a1?t-1:0),n=1;n?@[\\\]^`{|}~-]+/g,cZ=/(^-|-$)/g;function x2(e){return e.replace(uZ,"-").replace(cZ,"")}var aT=function(e){return g4(tT(e)>>>0)};function Xh(e){return typeof e=="string"&&!0}var v4=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},fZ=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function dZ(e,t,r){var n=e[r];v4(t)&&v4(n)?sT(n,t):e[r]=t}function sT(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n=0||(ue[K]=j[K]);return ue}(t,["componentId"]),L=M&&M+"-"+(Xh(k)?k:x2(rS(k)));return uT(k,Vo({},P,{attrs:d,componentId:L}),r)},Object.defineProperty(v,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(k){this._foldedDefaultProps=n?sT({},e.defaultProps,k):k}}),v.toString=function(){return"."+v.styledComponentId},o&&OK(v,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),v}var y4=function(e){return function t(r,n,o){if(o===void 0&&(o=Fa),!yd.isValidElementType(n))return eh(1,String(n));var i=function(){return r(n,o,oT.apply(void 0,arguments))};return i.withConfig=function(a){return t(r,n,Vo({},o,{},a))},i.attrs=function(a){return t(r,n,Vo({},o,{attrs:Array.prototype.concat(o.attrs,a).filter(Boolean)}))},i}(uT,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){y4[e]=y4(e)});function hZ(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;nW)&&(me=(Re=Re.replace(" ",":")).length),0de&&(de=(B=B.trim()).charCodeAt(0)),de){case 38:return B.replace(x,"$1"+m.trim());case 58:return m.trim()+B.replace(x,"$1"+m.trim());default:if(0<1*ne&&0X.charCodeAt(8))break;case 115:$=$.replace(X,"-webkit-"+X)+";"+$;break;case 207:case 102:$=$.replace(X,"-webkit-"+(102ne.charCodeAt(0)&&(ne=ne.trim()),I=ne,ne=[I],01?t-1:0),n=1;n0?" Args: "+r.join(", "):""))}var OK=function(){function e(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}var t=e.prototype;return t.indexOfGroup=function(r){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,i=o.length,a=i;r>=a;)(a<<=1)<0&&eh(16,""+r);this.groupSizes=new Uint32Array(a),this.groupSizes.set(o),this.length=a;for(var s=i;s=this.length||this.groupSizes[r]===0)return n;for(var o=this.groupSizes[r],i=this.indexOfGroup(r),a=i+o,s=i;s=Uf&&(Uf=t+1),_0.set(e,t),Tp.set(t,e)},DK="style["+zu+'][data-styled-version="5.3.6"]',UK=new RegExp("^"+zu+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),jK=function(e,t,r){for(var n,o=r.split(","),i=0,a=o.length;i=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(zu))return c}}(r),i=o!==void 0?o.nextSibling:null;n.setAttribute(zu,"active"),n.setAttribute("data-styled-version","5.3.6");var a=zK();return a&&n.setAttribute("nonce",a),r.insertBefore(n,i),n},$K=function(){function e(r){var n=this.element=eT(r);n.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var i=document.styleSheets,a=0,s=i.length;a=0){var o=document.createTextNode(n),i=this.nodes[r];return this.element.insertBefore(o,i||null),this.length++,!0}return!1},t.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.getRule=function(r){return r0&&(h+=d+",")}),i+=""+u+c+'{content:"'+h+`"}/*!sc*/ +`}}}return i}(this)},e}(),HK=/(a)(d)/gi,oS=function(e){return String.fromCharCode(e+(e>25?39:97))};function p4(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=oS(t%52)+r;return(oS(t%52)+r).replace(HK,"$1-$2")}var du=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},rT=function(e){return du(5381,e)};function KK(e){for(var t=0;t>>0);if(!r.hasNameForId(o,s)){var l=n(a,"."+s,void 0,o);r.insertRules(o,s,l)}i.push(s),this.staticRulesId=s}else{for(var u=this.rules.length,c=du(this.baseHash,n.hash),h="",d=0;d>>0);if(!r.hasNameForId(o,S)){var x=n(h,"."+S,void 0,o);r.insertRules(o,S,x)}i.push(S)}}return i.join(" ")},e}(),YK=/^\s*\/\/.*$/gm,QK=[":","[",".","#"];function XK(e){var t,r,n,o,i=e===void 0?Fa:e,a=i.options,s=a===void 0?Fa:a,l=i.plugins,u=l===void 0?Ip:l,c=new _K(s),h=[],d=function(b){function S(x){if(x)try{b(x+"}")}catch{}}return function(x,k,M,P,L,j,V,K,Z,ue){switch(x){case 1:if(Z===0&&k.charCodeAt(0)===64)return b(k+";"),"";break;case 2:if(K===0)return k+"/*|*/";break;case 3:switch(K){case 102:case 112:return b(M[0]+k),"";default:return k+(ue===0?"/*|*/":"")}case-2:k.split("/*|*/}").forEach(S)}}}(function(b){h.push(b)}),p=function(b,S,x){return S===0&&QK.indexOf(x[r.length])!==-1||x.match(o)?b:"."+t};function v(b,S,x,k){k===void 0&&(k="&");var M=b.replace(YK,""),P=S&&x?x+" "+S+" { "+M+" }":M;return t=k,r=S,n=new RegExp("\\"+r+"\\b","g"),o=new RegExp("(\\"+r+"\\b){2,}"),c(x||!S?"":S,P)}return c.use([].concat(u,[function(b,S,x){b===2&&x.length&&x[0].lastIndexOf(r)>0&&(x[0]=x[0].replace(n,p))},d,function(b){if(b===-2){var S=h;return h=[],S}}])),v.hash=u.length?u.reduce(function(b,S){return S.name||eh(15),du(b,S.name)},5381).toString():"",v}var nT=Dd.createContext();nT.Consumer;var iT=Dd.createContext(),JK=(iT.Consumer,new tT),g4=XK();function eZ(){return dt.useContext(nT)||JK}function tZ(){return dt.useContext(iT)||g4}var oT=function(){function e(t,r){var n=this;this.inject=function(o,i){i===void 0&&(i=g4);var a=n.name+i.hash;o.hasNameForId(n.id,a)||o.insertRules(n.id,a,i(n.rules,a,"@keyframes"))},this.toString=function(){return eh(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=r}return e.prototype.getName=function(t){return t===void 0&&(t=g4),this.name+t.hash},e}(),rZ=/([A-Z])/,nZ=/([A-Z])/g,iZ=/^ms-/,oZ=function(e){return"-"+e.toLowerCase()};function aS(e){return rZ.test(e)?e.replace(nZ,oZ).replace(iZ,"-ms-"):e}var sS=function(e){return e==null||e===!1||e===""};function $u(e,t,r,n){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a1?t-1:0),n=1;n?@[\\\]^`{|}~-]+/g,lZ=/(^-|-$)/g;function x2(e){return e.replace(sZ,"-").replace(lZ,"")}var sT=function(e){return p4(rT(e)>>>0)};function Xh(e){return typeof e=="string"&&!0}var m4=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},uZ=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function cZ(e,t,r){var n=e[r];m4(t)&&m4(n)?lT(n,t):e[r]=t}function lT(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n=0||(ue[K]=j[K]);return ue}(t,["componentId"]),L=M&&M+"-"+(Xh(k)?k:x2(nS(k)));return cT(k,Vo({},P,{attrs:d,componentId:L}),r)},Object.defineProperty(v,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(k){this._foldedDefaultProps=n?lT({},e.defaultProps,k):k}}),v.toString=function(){return"."+v.styledComponentId},o&&PK(v,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),v}var v4=function(e){return function t(r,n,o){if(o===void 0&&(o=Fa),!yd.isValidElementType(n))return eh(1,String(n));var i=function(){return r(n,o,aT.apply(void 0,arguments))};return i.withConfig=function(a){return t(r,n,Vo({},o,{},a))},i.attrs=function(a){return t(r,n,Vo({},o,{attrs:Array.prototype.concat(o.attrs,a).filter(Boolean)}))},i}(cT,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){v4[e]=v4(e)});function fZ(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n{let t=-1;return e%10===1?t=-1:e%10===2?t=0:e%10===3?t=1:e%10===4?t=2:e%10===5?t=3:e%10===6?t=4:e%10===7?t=5:e%10===8?t=6:e%10===9?t=7:(e===10||e===20||e===30||e===40||e===50||e===60)&&(t=8),Dr(EZ,{children:[Xe(lS,{src:pZ,alt:"Power Grey"}),t!==-1&&Xe(lS,{src:CZ[t],alt:`Power ${t+1}`})]})},AZ=dn.div` +`,CZ=({clickCount:e})=>{let t=-1;return e%10===1?t=-1:e%10===2?t=0:e%10===3?t=1:e%10===4?t=2:e%10===5?t=3:e%10===6?t=4:e%10===7?t=5:e%10===8?t=6:e%10===9?t=7:(e===10||e===20||e===30||e===40||e===50||e===60)&&(t=8),Dr(SZ,{children:[Xe(uS,{src:dZ,alt:"Power Grey"}),t!==-1&&Xe(uS,{src:xZ[t],alt:`Power ${t+1}`})]})},EZ=dn.div` position: absolute; top: 5px; left: 5px; @@ -1145,9 +1145,9 @@ PERFORMANCE OF THIS SOFTWARE. border-radius: 5px; z-index: 1000; font-size: 10px; -`,MZ=dn.span` +`,kZ=dn.span` font-size: 20px; // 2x larger -`,IZ=({clickCount:e})=>{const r=(i=>i<=10?"1/7":i<=20?"2/7":i<=30?"3/7":i<=40?"4/7":i<=50?"5/7":i<=60?"6/7":"7/7")(e),[n,o]=r.split("/");return Dr(AZ,{children:[Xe(MZ,{children:n}),"/",o]})},TZ=dn.div` +`,AZ=({clickCount:e})=>{const r=(i=>i<=10?"1/7":i<=20?"2/7":i<=30?"3/7":i<=40?"4/7":i<=50?"5/7":i<=60?"6/7":"7/7")(e),[n,o]=r.split("/");return Dr(EZ,{children:[Xe(kZ,{children:n}),"/",o]})},MZ=dn.div` position: absolute; top: 5px; right: 2px; @@ -1158,7 +1158,7 @@ PERFORMANCE OF THIS SOFTWARE. border-radius: 5px; z-index: 1000; font-size: 14px; -`,BZ=({startTime:e,gameStarted:t,endTime:r})=>{const[n,o]=dt.useState("0.00");return dt.useEffect(()=>{let i;return t&&e!==0&&r===0&&(i=setInterval(()=>{if(e===0||!t||r!==0){o("0.00");return}const u=(performance.now()-e)/1e3;o(u.toFixed(3))},10)),()=>clearInterval(i)},[e,t,r]),!t||r!==0?null:Dr(TZ,{children:[n," sec"]})},Wi=dn.button` +`,IZ=({startTime:e,gameStarted:t,endTime:r})=>{const[n,o]=dt.useState("0.00");return dt.useEffect(()=>{let i;return t&&e!==0&&r===0&&(i=setInterval(()=>{if(e===0||!t||r!==0){o("0.00");return}const u=(performance.now()-e)/1e3;o(u.toFixed(3))},10)),()=>clearInterval(i)},[e,t,r]),!t||r!==0?null:Dr(MZ,{children:[n," sec"]})},Wi=dn.button` background-color: grey; font-family: 'PublicPixel', sans-serif; color: var(--primary-text-color); @@ -1173,12 +1173,12 @@ PERFORMANCE OF THIS SOFTWARE. &:hover { background-color: var(--button-hover-color); } -`;function cT(e,t){return function(){return e.apply(t,arguments)}}const{toString:PZ}=Object.prototype,{getPrototypeOf:p5}=Object,X1=(e=>t=>{const r=PZ.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),to=e=>(e=e.toLowerCase(),t=>X1(t)===e),J1=e=>t=>typeof t===e,{isArray:sc}=Array,wd=J1("undefined");function RZ(e){return e!==null&&!wd(e)&&e.constructor!==null&&!wd(e.constructor)&&Ti(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const fT=to("ArrayBuffer");function OZ(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&fT(e.buffer),t}const NZ=J1("string"),Ti=J1("function"),dT=J1("number"),eg=e=>e!==null&&typeof e=="object",LZ=e=>e===!0||e===!1,x0=e=>{if(X1(e)!=="object")return!1;const t=p5(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},DZ=to("Date"),UZ=to("File"),jZ=to("Blob"),FZ=to("FileList"),zZ=e=>eg(e)&&Ti(e.pipe),$Z=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ti(e.append)&&((t=X1(e))==="formdata"||t==="object"&&Ti(e.toString)&&e.toString()==="[object FormData]"))},qZ=to("URLSearchParams"),[WZ,VZ,HZ,KZ]=["ReadableStream","Request","Response","Headers"].map(to),ZZ=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function th(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),sc(e))for(n=0,o=e.length;n0;)if(o=r[n],t===o.toLowerCase())return o;return null}const pT=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Zb)(),gT=e=>!wd(e)&&e!==pT;function b4(){const{caseless:e}=gT(this)&&this||{},t={},r=(n,o)=>{const i=e&&hT(t,o)||o;x0(t[i])&&x0(n)?t[i]=b4(t[i],n):x0(n)?t[i]=b4({},n):sc(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n(th(t,(o,i)=>{r&&Ti(o)?e[i]=cT(o,r):e[i]=o},{allOwnKeys:n}),e),YZ=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),QZ=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},XZ=(e,t,r,n)=>{let o,i,a;const s={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!n||n(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=r!==!1&&p5(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},JZ=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},eG=e=>{if(!e)return null;if(sc(e))return e;let t=e.length;if(!dT(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},tG=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&p5(Uint8Array)),rG=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=n.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},nG=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},iG=to("HTMLFormElement"),oG=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),uS=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),aG=to("RegExp"),mT=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};th(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(n[i]=a||o)}),Object.defineProperties(e,n)},sG=e=>{mT(e,(t,r)=>{if(Ti(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Ti(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},lG=(e,t)=>{const r={},n=o=>{o.forEach(i=>{r[i]=!0})};return sc(e)?n(e):n(String(e).split(t)),r},uG=()=>{},cG=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,C2="abcdefghijklmnopqrstuvwxyz",cS="0123456789",vT={DIGIT:cS,ALPHA:C2,ALPHA_DIGIT:C2+C2.toUpperCase()+cS},fG=(e=16,t=vT.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function dG(e){return!!(e&&Ti(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const hG=e=>{const t=new Array(10),r=(n,o)=>{if(eg(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;const i=sc(n)?[]:{};return th(n,(a,s)=>{const l=r(a,o+1);!wd(l)&&(i[s]=l)}),t[o]=void 0,i}}return n};return r(e,0)},pG=to("AsyncFunction"),gG=e=>e&&(eg(e)||Ti(e))&&Ti(e.then)&&Ti(e.catch),Ue={isArray:sc,isArrayBuffer:fT,isBuffer:RZ,isFormData:$Z,isArrayBufferView:OZ,isString:NZ,isNumber:dT,isBoolean:LZ,isObject:eg,isPlainObject:x0,isReadableStream:WZ,isRequest:VZ,isResponse:HZ,isHeaders:KZ,isUndefined:wd,isDate:DZ,isFile:UZ,isBlob:jZ,isRegExp:aG,isFunction:Ti,isStream:zZ,isURLSearchParams:qZ,isTypedArray:tG,isFileList:FZ,forEach:th,merge:b4,extend:GZ,trim:ZZ,stripBOM:YZ,inherits:QZ,toFlatObject:XZ,kindOf:X1,kindOfTest:to,endsWith:JZ,toArray:eG,forEachEntry:rG,matchAll:nG,isHTMLForm:iG,hasOwnProperty:uS,hasOwnProp:uS,reduceDescriptors:mT,freezeMethods:sG,toObjectSet:lG,toCamelCase:oG,noop:uG,toFiniteNumber:cG,findKey:hT,global:pT,isContextDefined:gT,ALPHABET:vT,generateString:fG,isSpecCompliantForm:dG,toJSONObject:hG,isAsyncFn:pG,isThenable:gG};function Ft(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}Ue.inherits(Ft,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ue.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const yT=Ft.prototype,bT={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{bT[e]={value:e}});Object.defineProperties(Ft,bT);Object.defineProperty(yT,"isAxiosError",{value:!0});Ft.from=(e,t,r,n,o,i)=>{const a=Object.create(yT);return Ue.toFlatObject(e,a,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),Ft.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};const mG=null;function w4(e){return Ue.isPlainObject(e)||Ue.isArray(e)}function wT(e){return Ue.endsWith(e,"[]")?e.slice(0,-2):e}function fS(e,t,r){return e?e.concat(t).map(function(o,i){return o=wT(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function vG(e){return Ue.isArray(e)&&!e.some(w4)}const yG=Ue.toFlatObject(Ue,{},null,function(t){return/^is[A-Z]/.test(t)});function tg(e,t,r){if(!Ue.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=Ue.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!Ue.isUndefined(S[b])});const n=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&Ue.isSpecCompliantForm(t);if(!Ue.isFunction(o))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(Ue.isDate(v))return v.toISOString();if(!l&&Ue.isBlob(v))throw new Ft("Blob is not supported. Use a Buffer instead.");return Ue.isArrayBuffer(v)||Ue.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Oe.Buffer.from(v):v}function c(v,b,S){let x=v;if(v&&!S&&typeof v=="object"){if(Ue.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=JSON.stringify(v);else if(Ue.isArray(v)&&vG(v)||(Ue.isFileList(v)||Ue.endsWith(b,"[]"))&&(x=Ue.toArray(v)))return b=wT(b),x.forEach(function(M,P){!(Ue.isUndefined(M)||M===null)&&t.append(a===!0?fS([b],P,i):a===null?b:b+"[]",u(M))}),!1}return w4(v)?!0:(t.append(fS(S,b,i),u(v)),!1)}const h=[],d=Object.assign(yG,{defaultVisitor:c,convertValue:u,isVisitable:w4});function p(v,b){if(!Ue.isUndefined(v)){if(h.indexOf(v)!==-1)throw Error("Circular reference detected in "+b.join("."));h.push(v),Ue.forEach(v,function(x,k){(!(Ue.isUndefined(x)||x===null)&&o.call(t,x,Ue.isString(k)?k.trim():k,b,d))===!0&&p(x,b?b.concat(k):[k])}),h.pop()}}if(!Ue.isObject(e))throw new TypeError("data must be an object");return p(e),t}function dS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function g5(e,t){this._pairs=[],e&&tg(e,this,t)}const _T=g5.prototype;_T.append=function(t,r){this._pairs.push([t,r])};_T.toString=function(t){const r=t?function(n){return t.call(this,n,dS)}:dS;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function bG(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function xT(e,t,r){if(!t)return e;const n=r&&r.encode||bG,o=r&&r.serialize;let i;if(o?i=o(t,r):i=Ue.isURLSearchParams(t)?t.toString():new g5(t,r).toString(n),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class wG{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ue.forEach(this.handlers,function(n){n!==null&&t(n)})}}const hS=wG,ST={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_G=typeof URLSearchParams<"u"?URLSearchParams:g5,xG=typeof FormData<"u"?FormData:null,SG=typeof Blob<"u"?Blob:null,CG={isBrowser:!0,classes:{URLSearchParams:_G,FormData:xG,Blob:SG},protocols:["http","https","file","blob","url","data"]},m5=typeof window<"u"&&typeof document<"u",EG=(e=>m5&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),kG=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),AG=m5&&window.location.href||"http://localhost",MG=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:m5,hasStandardBrowserEnv:EG,hasStandardBrowserWebWorkerEnv:kG,origin:AG},Symbol.toStringTag,{value:"Module"})),Yi={...MG,...CG};function IG(e,t){return tg(e,new Yi.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return Yi.isNode&&Ue.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function TG(e){return Ue.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function BG(e){const t={},r=Object.keys(e);let n;const o=r.length;let i;for(n=0;n=r.length;return a=!a&&Ue.isArray(o)?o.length:a,l?(Ue.hasOwnProp(o,a)?o[a]=[o[a],n]:o[a]=n,!s):((!o[a]||!Ue.isObject(o[a]))&&(o[a]=[]),t(r,n,o[a],i)&&Ue.isArray(o[a])&&(o[a]=BG(o[a])),!s)}if(Ue.isFormData(e)&&Ue.isFunction(e.entries)){const r={};return Ue.forEachEntry(e,(n,o)=>{t(TG(n),o,r,0)}),r}return null}function PG(e,t,r){if(Ue.isString(e))try{return(t||JSON.parse)(e),Ue.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const v5={transitional:ST,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=Ue.isObject(t);if(i&&Ue.isHTMLForm(t)&&(t=new FormData(t)),Ue.isFormData(t))return o?JSON.stringify(CT(t)):t;if(Ue.isArrayBuffer(t)||Ue.isBuffer(t)||Ue.isStream(t)||Ue.isFile(t)||Ue.isBlob(t)||Ue.isReadableStream(t))return t;if(Ue.isArrayBufferView(t))return t.buffer;if(Ue.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return IG(t,this.formSerializer).toString();if((s=Ue.isFileList(t))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return tg(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),PG(t)):t}],transformResponse:[function(t){const r=this.transitional||v5.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(Ue.isResponse(t)||Ue.isReadableStream(t))return t;if(t&&Ue.isString(t)&&(n&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(s){if(a)throw s.name==="SyntaxError"?Ft.from(s,Ft.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yi.classes.FormData,Blob:Yi.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ue.forEach(["delete","get","head","post","put","patch"],e=>{v5.headers[e]={}});const y5=v5,RG=Ue.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),OG=e=>{const t={};let r,n,o;return e&&e.split(` -`).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),n=a.substring(o+1).trim(),!(!r||t[r]&&RG[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},pS=Symbol("internals");function Rc(e){return e&&String(e).trim().toLowerCase()}function S0(e){return e===!1||e==null?e:Ue.isArray(e)?e.map(S0):String(e)}function NG(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const LG=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function E2(e,t,r,n,o){if(Ue.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!Ue.isString(t)){if(Ue.isString(n))return t.indexOf(n)!==-1;if(Ue.isRegExp(n))return n.test(t)}}function DG(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function UG(e,t){const r=Ue.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,i,a){return this[n].call(this,t,o,i,a)},configurable:!0})})}let rg=class{constructor(t){t&&this.set(t)}set(t,r,n){const o=this;function i(s,l,u){const c=Rc(l);if(!c)throw new Error("header name must be a non-empty string");const h=Ue.findKey(o,c);(!h||o[h]===void 0||u===!0||u===void 0&&o[h]!==!1)&&(o[h||l]=S0(s))}const a=(s,l)=>Ue.forEach(s,(u,c)=>i(u,c,l));if(Ue.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(Ue.isString(t)&&(t=t.trim())&&!LG(t))a(OG(t),r);else if(Ue.isHeaders(t))for(const[s,l]of t.entries())i(l,s,n);else t!=null&&i(r,t,n);return this}get(t,r){if(t=Rc(t),t){const n=Ue.findKey(this,t);if(n){const o=this[n];if(!r)return o;if(r===!0)return NG(o);if(Ue.isFunction(r))return r.call(this,o,n);if(Ue.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Rc(t),t){const n=Ue.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||E2(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let o=!1;function i(a){if(a=Rc(a),a){const s=Ue.findKey(n,a);s&&(!r||E2(n,n[s],s,r))&&(delete n[s],o=!0)}}return Ue.isArray(t)?t.forEach(i):i(t),o}clear(t){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const i=r[n];(!t||E2(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,n={};return Ue.forEach(this,(o,i)=>{const a=Ue.findKey(n,i);if(a){r[a]=S0(o),delete r[i];return}const s=t?DG(i):String(i).trim();s!==i&&delete r[i],r[s]=S0(o),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return Ue.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&Ue.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){const n=(this[pS]=this[pS]={accessors:{}}).accessors,o=this.prototype;function i(a){const s=Rc(a);n[s]||(UG(o,a),n[s]=!0)}return Ue.isArray(t)?t.forEach(i):i(t),this}};rg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(rg.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Ue.freezeMethods(rg);const Qi=rg;function k2(e,t){const r=this||y5,n=t||r,o=Qi.from(n.headers);let i=n.data;return Ue.forEach(e,function(s){i=s.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ET(e){return!!(e&&e.__CANCEL__)}function lc(e,t,r){Ft.call(this,e??"canceled",Ft.ERR_CANCELED,t,r),this.name="CanceledError"}Ue.inherits(lc,Ft,{__CANCEL__:!0});function kT(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Ft("Request failed with status code "+r.status,[Ft.ERR_BAD_REQUEST,Ft.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function jG(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function FG(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=n[i];a||(a=u),r[o]=l,n[o]=u;let h=i,d=0;for(;h!==o;)d+=r[h++],h=h%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-an)return o&&(clearTimeout(o),o=null),r=s,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,r=Date.now(),e.apply(null,arguments)),n-(s-r)))}}const Bp=(e,t,r=3)=>{let n=0;const o=FG(50,250);return zG(i=>{const a=i.loaded,s=i.lengthComputable?i.total:void 0,l=a-n,u=o(l),c=a<=s;n=a;const h={loaded:a,total:s,progress:s?a/s:void 0,bytes:l,rate:u||void 0,estimated:u&&s&&c?(s-a)/u:void 0,event:i,lengthComputable:s!=null};h[t?"download":"upload"]=!0,e(h)},r)},$G=Yi.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function o(i){let a=i;return t&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=o(window.location.href),function(a){const s=Ue.isString(a)?o(a):a;return s.protocol===n.protocol&&s.host===n.host}}():function(){return function(){return!0}}(),qG=Yi.hasStandardBrowserEnv?{write(e,t,r,n,o,i){const a=[e+"="+encodeURIComponent(t)];Ue.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Ue.isString(n)&&a.push("path="+n),Ue.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function WG(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function VG(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function AT(e,t){return e&&!WG(t)?VG(e,t):t}const gS=e=>e instanceof Qi?{...e}:e;function rl(e,t){t=t||{};const r={};function n(u,c,h){return Ue.isPlainObject(u)&&Ue.isPlainObject(c)?Ue.merge.call({caseless:h},u,c):Ue.isPlainObject(c)?Ue.merge({},c):Ue.isArray(c)?c.slice():c}function o(u,c,h){if(Ue.isUndefined(c)){if(!Ue.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function i(u,c){if(!Ue.isUndefined(c))return n(void 0,c)}function a(u,c){if(Ue.isUndefined(c)){if(!Ue.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function s(u,c,h){if(h in t)return n(u,c);if(h in e)return n(void 0,u)}const l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(u,c)=>o(gS(u),gS(c),!0)};return Ue.forEach(Object.keys(Object.assign({},e,t)),function(c){const h=l[c]||o,d=h(e[c],t[c],c);Ue.isUndefined(d)&&h!==s||(r[c]=d)}),r}const MT=e=>{const t=rl({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;t.headers=a=Qi.from(a),t.url=xT(AT(t.baseURL,t.url),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(Ue.isFormData(r)){if(Yi.hasStandardBrowserEnv||Yi.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[u,...c]=l?l.split(";").map(h=>h.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Yi.hasStandardBrowserEnv&&(n&&Ue.isFunction(n)&&(n=n(t)),n||n!==!1&&$G(t.url))){const u=o&&i&&qG.read(i);u&&a.set(o,u)}return t},HG=typeof XMLHttpRequest<"u",KG=HG&&function(e){return new Promise(function(r,n){const o=MT(e);let i=o.data;const a=Qi.from(o.headers).normalize();let{responseType:s}=o,l;function u(){o.cancelToken&&o.cancelToken.unsubscribe(l),o.signal&&o.signal.removeEventListener("abort",l)}let c=new XMLHttpRequest;c.open(o.method.toUpperCase(),o.url,!0),c.timeout=o.timeout;function h(){if(!c)return;const p=Qi.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),b={data:!s||s==="text"||s==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:p,config:e,request:c};kT(function(x){r(x),u()},function(x){n(x),u()},b),c=null}"onloadend"in c?c.onloadend=h:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(h)},c.onabort=function(){c&&(n(new Ft("Request aborted",Ft.ECONNABORTED,o,c)),c=null)},c.onerror=function(){n(new Ft("Network Error",Ft.ERR_NETWORK,o,c)),c=null},c.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||ST;o.timeoutErrorMessage&&(v=o.timeoutErrorMessage),n(new Ft(v,b.clarifyTimeoutError?Ft.ETIMEDOUT:Ft.ECONNABORTED,o,c)),c=null},i===void 0&&a.setContentType(null),"setRequestHeader"in c&&Ue.forEach(a.toJSON(),function(v,b){c.setRequestHeader(b,v)}),Ue.isUndefined(o.withCredentials)||(c.withCredentials=!!o.withCredentials),s&&s!=="json"&&(c.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&c.addEventListener("progress",Bp(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Bp(o.onUploadProgress)),(o.cancelToken||o.signal)&&(l=p=>{c&&(n(!p||p.type?new lc(null,e,c):p),c.abort(),c=null)},o.cancelToken&&o.cancelToken.subscribe(l),o.signal&&(o.signal.aborted?l():o.signal.addEventListener("abort",l)));const d=jG(o.url);if(d&&Yi.protocols.indexOf(d)===-1){n(new Ft("Unsupported protocol "+d+":",Ft.ERR_BAD_REQUEST,e));return}c.send(i||null)})},ZG=(e,t)=>{let r=new AbortController,n;const o=function(l){if(!n){n=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof Ft?u:new lc(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{o(new Ft(`timeout ${t} of ms exceeded`,Ft.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",o):l.unsubscribe(o))}),e=null)};e.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=a,[s,()=>{i&&clearTimeout(i),i=null}]},GG=ZG,YG=function*(e,t){let r=e.byteLength;if(!t||r{const i=QG(e,t,o);let a=0;return new ReadableStream({type:"bytes",async pull(s){const{done:l,value:u}=await i.next();if(l){s.close(),n();return}let c=u.byteLength;r&&r(a+=c),s.enqueue(new Uint8Array(u))},cancel(s){return n(s),i.return()}},{highWaterMark:2})},vS=(e,t)=>{const r=e!=null;return n=>setTimeout(()=>t({lengthComputable:r,total:e,loaded:n}))},ng=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",IT=ng&&typeof ReadableStream=="function",_4=ng&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),XG=IT&&(()=>{let e=!1;const t=new Request(Yi.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),yS=64*1024,x4=IT&&!!(()=>{try{return Ue.isReadableStream(new Response("").body)}catch{}})(),Pp={stream:x4&&(e=>e.body)};ng&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Pp[t]&&(Pp[t]=Ue.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new Ft(`Response type '${t}' is not supported`,Ft.ERR_NOT_SUPPORT,n)})})})(new Response);const JG=async e=>{if(e==null)return 0;if(Ue.isBlob(e))return e.size;if(Ue.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(Ue.isArrayBufferView(e))return e.byteLength;if(Ue.isURLSearchParams(e)&&(e=e+""),Ue.isString(e))return(await _4(e)).byteLength},eY=async(e,t)=>{const r=Ue.toFiniteNumber(e.getContentLength());return r??JG(t)},tY=ng&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:i,timeout:a,onDownloadProgress:s,onUploadProgress:l,responseType:u,headers:c,withCredentials:h="same-origin",fetchOptions:d}=MT(e);u=u?(u+"").toLowerCase():"text";let[p,v]=o||i||a?GG([o,i],a):[],b,S;const x=()=>{!b&&setTimeout(()=>{p&&p.unsubscribe()}),b=!0};let k;try{if(l&&XG&&r!=="get"&&r!=="head"&&(k=await eY(c,n))!==0){let j=new Request(t,{method:"POST",body:n,duplex:"half"}),V;Ue.isFormData(n)&&(V=j.headers.get("content-type"))&&c.setContentType(V),j.body&&(n=mS(j.body,yS,vS(k,Bp(l)),null,_4))}Ue.isString(h)||(h=h?"cors":"omit"),S=new Request(t,{...d,signal:p,method:r.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",withCredentials:h});let M=await fetch(S);const P=x4&&(u==="stream"||u==="response");if(x4&&(s||P)){const j={};["status","statusText","headers"].forEach(K=>{j[K]=M[K]});const V=Ue.toFiniteNumber(M.headers.get("content-length"));M=new Response(mS(M.body,yS,s&&vS(V,Bp(s,!0)),P&&x,_4),j)}u=u||"text";let L=await Pp[Ue.findKey(Pp,u)||"text"](M,e);return!P&&x(),v&&v(),await new Promise((j,V)=>{kT(j,V,{data:L,headers:Qi.from(M.headers),status:M.status,statusText:M.statusText,config:e,request:S})})}catch(M){throw x(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new Ft("Network Error",Ft.ERR_NETWORK,e,S),{cause:M.cause||M}):Ft.from(M,M&&M.code,e,S)}}),S4={http:mG,xhr:KG,fetch:tY};Ue.forEach(S4,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const bS=e=>`- ${e}`,rY=e=>Ue.isFunction(e)||e===null||e===!1,TT={getAdapter:e=>{e=Ue.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let i=0;i`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since : -`+i.map(bS).join(` -`):" "+bS(i[0]):"as no adapter specified";throw new Ft("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:S4};function A2(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lc(null,e)}function wS(e){return A2(e),e.headers=Qi.from(e.headers),e.data=k2.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),TT.getAdapter(e.adapter||y5.adapter)(e).then(function(n){return A2(e),n.data=k2.call(e,e.transformResponse,n),n.headers=Qi.from(n.headers),n},function(n){return ET(n)||(A2(e),n&&n.response&&(n.response.data=k2.call(e,e.transformResponse,n.response),n.response.headers=Qi.from(n.response.headers))),Promise.reject(n)})}const BT="1.7.2",b5={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{b5[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const _S={};b5.transitional=function(t,r,n){function o(i,a){return"[Axios v"+BT+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,s)=>{if(t===!1)throw new Ft(o(a," has been removed"+(r?" in "+r:"")),Ft.ERR_DEPRECATED);return r&&!_S[a]&&(_S[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,s):!0}};function nY(e,t,r){if(typeof e!="object")throw new Ft("options must be an object",Ft.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const i=n[o],a=t[i];if(a){const s=e[i],l=s===void 0||a(s,i,e);if(l!==!0)throw new Ft("option "+i+" must be "+l,Ft.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Ft("Unknown option "+i,Ft.ERR_BAD_OPTION)}}const C4={assertOptions:nY,validators:b5},va=C4.validators;let Rp=class{constructor(t){this.defaults=t,this.interceptors={request:new hS,response:new hS}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=rl(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&C4.assertOptions(n,{silentJSONParsing:va.transitional(va.boolean),forcedJSONParsing:va.transitional(va.boolean),clarifyTimeoutError:va.transitional(va.boolean)},!1),o!=null&&(Ue.isFunction(o)?r.paramsSerializer={serialize:o}:C4.assertOptions(o,{encode:va.function,serialize:va.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&Ue.merge(i.common,i[r.method]);i&&Ue.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),r.headers=Qi.concat(a,i);const s=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(l=l&&b.synchronous,s.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,h=0,d;if(!l){const v=[wS.bind(this),void 0];for(v.unshift.apply(v,s),v.push.apply(v,u),d=v.length,c=Promise.resolve(r);h{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(s=>{n.subscribe(s),i=s}).then(o);return a.cancel=function(){n.unsubscribe(i)},a},t(function(i,a,s){n.reason||(n.reason=new lc(i,a,s),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new PT(function(o){t=o}),cancel:t}}};const iY=PT;function oY(e){return function(r){return e.apply(null,r)}}function aY(e){return Ue.isObject(e)&&e.isAxiosError===!0}const E4={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(E4).forEach(([e,t])=>{E4[t]=e});const sY=E4;function RT(e){const t=new C0(e),r=cT(C0.prototype.request,t);return Ue.extend(r,C0.prototype,t,{allOwnKeys:!0}),Ue.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return RT(rl(e,o))},r}const Vr=RT(y5);Vr.Axios=C0;Vr.CanceledError=lc;Vr.CancelToken=iY;Vr.isCancel=ET;Vr.VERSION=BT;Vr.toFormData=tg;Vr.AxiosError=Ft;Vr.Cancel=Vr.CanceledError;Vr.all=function(t){return Promise.all(t)};Vr.spread=oY;Vr.isAxiosError=aY;Vr.mergeConfig=rl;Vr.AxiosHeaders=Qi;Vr.formToJSON=e=>CT(Ue.isHTMLForm(e)?new FormData(e):e);Vr.getAdapter=TT.getAdapter;Vr.HttpStatusCode=sY;Vr.default=Vr;const ig=Vr,{Axios:lY,AxiosError:uY,CanceledError:cY,isCancel:fY,CancelToken:dY,VERSION:hY,all:pY,Cancel:gY,isAxiosError:mY,spread:vY,toFormData:yY,AxiosHeaders:bY,HttpStatusCode:wY,formToJSON:_Y,getAdapter:xY,mergeConfig:SY}=ig,CY=Object.freeze(Object.defineProperty({__proto__:null,Axios:lY,AxiosError:uY,AxiosHeaders:bY,Cancel:gY,CancelToken:dY,CanceledError:cY,HttpStatusCode:wY,VERSION:hY,all:pY,default:ig,formToJSON:_Y,getAdapter:xY,isAxiosError:mY,isCancel:fY,mergeConfig:SY,spread:vY,toFormData:yY},Symbol.toStringTag,{value:"Module"}));/** +`;function fT(e,t){return function(){return e.apply(t,arguments)}}const{toString:TZ}=Object.prototype,{getPrototypeOf:h5}=Object,X1=(e=>t=>{const r=TZ.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),to=e=>(e=e.toLowerCase(),t=>X1(t)===e),J1=e=>t=>typeof t===e,{isArray:sc}=Array,wd=J1("undefined");function BZ(e){return e!==null&&!wd(e)&&e.constructor!==null&&!wd(e.constructor)&&Ti(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const dT=to("ArrayBuffer");function PZ(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dT(e.buffer),t}const RZ=J1("string"),Ti=J1("function"),hT=J1("number"),eg=e=>e!==null&&typeof e=="object",OZ=e=>e===!0||e===!1,x0=e=>{if(X1(e)!=="object")return!1;const t=h5(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},NZ=to("Date"),LZ=to("File"),DZ=to("Blob"),UZ=to("FileList"),jZ=e=>eg(e)&&Ti(e.pipe),FZ=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ti(e.append)&&((t=X1(e))==="formdata"||t==="object"&&Ti(e.toString)&&e.toString()==="[object FormData]"))},zZ=to("URLSearchParams"),[$Z,qZ,WZ,VZ]=["ReadableStream","Request","Response","Headers"].map(to),HZ=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function th(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),sc(e))for(n=0,o=e.length;n0;)if(o=r[n],t===o.toLowerCase())return o;return null}const gT=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Ke)(),mT=e=>!wd(e)&&e!==gT;function y4(){const{caseless:e}=mT(this)&&this||{},t={},r=(n,o)=>{const i=e&&pT(t,o)||o;x0(t[i])&&x0(n)?t[i]=y4(t[i],n):x0(n)?t[i]=y4({},n):sc(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n(th(t,(o,i)=>{r&&Ti(o)?e[i]=fT(o,r):e[i]=o},{allOwnKeys:n}),e),ZZ=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),GZ=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},YZ=(e,t,r,n)=>{let o,i,a;const s={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!n||n(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=r!==!1&&h5(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},QZ=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},XZ=e=>{if(!e)return null;if(sc(e))return e;let t=e.length;if(!hT(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},JZ=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&h5(Uint8Array)),eG=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=n.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},tG=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},rG=to("HTMLFormElement"),nG=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),cS=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),iG=to("RegExp"),vT=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};th(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(n[i]=a||o)}),Object.defineProperties(e,n)},oG=e=>{vT(e,(t,r)=>{if(Ti(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Ti(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},aG=(e,t)=>{const r={},n=o=>{o.forEach(i=>{r[i]=!0})};return sc(e)?n(e):n(String(e).split(t)),r},sG=()=>{},lG=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,C2="abcdefghijklmnopqrstuvwxyz",fS="0123456789",yT={DIGIT:fS,ALPHA:C2,ALPHA_DIGIT:C2+C2.toUpperCase()+fS},uG=(e=16,t=yT.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function cG(e){return!!(e&&Ti(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const fG=e=>{const t=new Array(10),r=(n,o)=>{if(eg(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;const i=sc(n)?[]:{};return th(n,(a,s)=>{const l=r(a,o+1);!wd(l)&&(i[s]=l)}),t[o]=void 0,i}}return n};return r(e,0)},dG=to("AsyncFunction"),hG=e=>e&&(eg(e)||Ti(e))&&Ti(e.then)&&Ti(e.catch);var Ue={isArray:sc,isArrayBuffer:dT,isBuffer:BZ,isFormData:FZ,isArrayBufferView:PZ,isString:RZ,isNumber:hT,isBoolean:OZ,isObject:eg,isPlainObject:x0,isReadableStream:$Z,isRequest:qZ,isResponse:WZ,isHeaders:VZ,isUndefined:wd,isDate:NZ,isFile:LZ,isBlob:DZ,isRegExp:iG,isFunction:Ti,isStream:jZ,isURLSearchParams:zZ,isTypedArray:JZ,isFileList:UZ,forEach:th,merge:y4,extend:KZ,trim:HZ,stripBOM:ZZ,inherits:GZ,toFlatObject:YZ,kindOf:X1,kindOfTest:to,endsWith:QZ,toArray:XZ,forEachEntry:eG,matchAll:tG,isHTMLForm:rG,hasOwnProperty:cS,hasOwnProp:cS,reduceDescriptors:vT,freezeMethods:oG,toObjectSet:aG,toCamelCase:nG,noop:sG,toFiniteNumber:lG,findKey:pT,global:gT,isContextDefined:mT,ALPHABET:yT,generateString:uG,isSpecCompliantForm:cG,toJSONObject:fG,isAsyncFn:dG,isThenable:hG};function Ft(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}Ue.inherits(Ft,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ue.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const bT=Ft.prototype,wT={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{wT[e]={value:e}});Object.defineProperties(Ft,wT);Object.defineProperty(bT,"isAxiosError",{value:!0});Ft.from=(e,t,r,n,o,i)=>{const a=Object.create(bT);return Ue.toFlatObject(e,a,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),Ft.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};var pG=null;function b4(e){return Ue.isPlainObject(e)||Ue.isArray(e)}function _T(e){return Ue.endsWith(e,"[]")?e.slice(0,-2):e}function dS(e,t,r){return e?e.concat(t).map(function(o,i){return o=_T(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function gG(e){return Ue.isArray(e)&&!e.some(b4)}const mG=Ue.toFlatObject(Ue,{},null,function(t){return/^is[A-Z]/.test(t)});function tg(e,t,r){if(!Ue.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=Ue.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!Ue.isUndefined(S[b])});const n=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&Ue.isSpecCompliantForm(t);if(!Ue.isFunction(o))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(Ue.isDate(v))return v.toISOString();if(!l&&Ue.isBlob(v))throw new Ft("Blob is not supported. Use a Buffer instead.");return Ue.isArrayBuffer(v)||Ue.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Oe.Buffer.from(v):v}function c(v,b,S){let x=v;if(v&&!S&&typeof v=="object"){if(Ue.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=JSON.stringify(v);else if(Ue.isArray(v)&&gG(v)||(Ue.isFileList(v)||Ue.endsWith(b,"[]"))&&(x=Ue.toArray(v)))return b=_T(b),x.forEach(function(M,P){!(Ue.isUndefined(M)||M===null)&&t.append(a===!0?dS([b],P,i):a===null?b:b+"[]",u(M))}),!1}return b4(v)?!0:(t.append(dS(S,b,i),u(v)),!1)}const h=[],d=Object.assign(mG,{defaultVisitor:c,convertValue:u,isVisitable:b4});function p(v,b){if(!Ue.isUndefined(v)){if(h.indexOf(v)!==-1)throw Error("Circular reference detected in "+b.join("."));h.push(v),Ue.forEach(v,function(x,k){(!(Ue.isUndefined(x)||x===null)&&o.call(t,x,Ue.isString(k)?k.trim():k,b,d))===!0&&p(x,b?b.concat(k):[k])}),h.pop()}}if(!Ue.isObject(e))throw new TypeError("data must be an object");return p(e),t}function hS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function p5(e,t){this._pairs=[],e&&tg(e,this,t)}const xT=p5.prototype;xT.append=function(t,r){this._pairs.push([t,r])};xT.toString=function(t){const r=t?function(n){return t.call(this,n,hS)}:hS;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function vG(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ST(e,t,r){if(!t)return e;const n=r&&r.encode||vG,o=r&&r.serialize;let i;if(o?i=o(t,r):i=Ue.isURLSearchParams(t)?t.toString():new p5(t,r).toString(n),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class yG{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ue.forEach(this.handlers,function(n){n!==null&&t(n)})}}var pS=yG,CT={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bG=typeof URLSearchParams<"u"?URLSearchParams:p5,wG=typeof FormData<"u"?FormData:null,_G=typeof Blob<"u"?Blob:null,xG={isBrowser:!0,classes:{URLSearchParams:bG,FormData:wG,Blob:_G},protocols:["http","https","file","blob","url","data"]};const g5=typeof window<"u"&&typeof document<"u",SG=(e=>g5&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),CG=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),EG=g5&&window.location.href||"http://localhost";var kG=Object.freeze({__proto__:null,hasBrowserEnv:g5,hasStandardBrowserWebWorkerEnv:CG,hasStandardBrowserEnv:SG,origin:EG}),Yi={...kG,...xG};function AG(e,t){return tg(e,new Yi.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return Yi.isNode&&Ue.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function MG(e){return Ue.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function IG(e){const t={},r=Object.keys(e);let n;const o=r.length;let i;for(n=0;n=r.length;return a=!a&&Ue.isArray(o)?o.length:a,l?(Ue.hasOwnProp(o,a)?o[a]=[o[a],n]:o[a]=n,!s):((!o[a]||!Ue.isObject(o[a]))&&(o[a]=[]),t(r,n,o[a],i)&&Ue.isArray(o[a])&&(o[a]=IG(o[a])),!s)}if(Ue.isFormData(e)&&Ue.isFunction(e.entries)){const r={};return Ue.forEachEntry(e,(n,o)=>{t(MG(n),o,r,0)}),r}return null}function TG(e,t,r){if(Ue.isString(e))try{return(t||JSON.parse)(e),Ue.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const m5={transitional:CT,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=Ue.isObject(t);if(i&&Ue.isHTMLForm(t)&&(t=new FormData(t)),Ue.isFormData(t))return o?JSON.stringify(ET(t)):t;if(Ue.isArrayBuffer(t)||Ue.isBuffer(t)||Ue.isStream(t)||Ue.isFile(t)||Ue.isBlob(t)||Ue.isReadableStream(t))return t;if(Ue.isArrayBufferView(t))return t.buffer;if(Ue.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return AG(t,this.formSerializer).toString();if((s=Ue.isFileList(t))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return tg(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),TG(t)):t}],transformResponse:[function(t){const r=this.transitional||m5.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(Ue.isResponse(t)||Ue.isReadableStream(t))return t;if(t&&Ue.isString(t)&&(n&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(s){if(a)throw s.name==="SyntaxError"?Ft.from(s,Ft.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yi.classes.FormData,Blob:Yi.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ue.forEach(["delete","get","head","post","put","patch"],e=>{m5.headers[e]={}});var v5=m5;const BG=Ue.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var PG=e=>{const t={};let r,n,o;return e&&e.split(` +`).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),n=a.substring(o+1).trim(),!(!r||t[r]&&BG[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const gS=Symbol("internals");function Rc(e){return e&&String(e).trim().toLowerCase()}function S0(e){return e===!1||e==null?e:Ue.isArray(e)?e.map(S0):String(e)}function RG(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const OG=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function E2(e,t,r,n,o){if(Ue.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!Ue.isString(t)){if(Ue.isString(n))return t.indexOf(n)!==-1;if(Ue.isRegExp(n))return n.test(t)}}function NG(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function LG(e,t){const r=Ue.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,i,a){return this[n].call(this,t,o,i,a)},configurable:!0})})}class rg{constructor(t){t&&this.set(t)}set(t,r,n){const o=this;function i(s,l,u){const c=Rc(l);if(!c)throw new Error("header name must be a non-empty string");const h=Ue.findKey(o,c);(!h||o[h]===void 0||u===!0||u===void 0&&o[h]!==!1)&&(o[h||l]=S0(s))}const a=(s,l)=>Ue.forEach(s,(u,c)=>i(u,c,l));if(Ue.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(Ue.isString(t)&&(t=t.trim())&&!OG(t))a(PG(t),r);else if(Ue.isHeaders(t))for(const[s,l]of t.entries())i(l,s,n);else t!=null&&i(r,t,n);return this}get(t,r){if(t=Rc(t),t){const n=Ue.findKey(this,t);if(n){const o=this[n];if(!r)return o;if(r===!0)return RG(o);if(Ue.isFunction(r))return r.call(this,o,n);if(Ue.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Rc(t),t){const n=Ue.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||E2(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let o=!1;function i(a){if(a=Rc(a),a){const s=Ue.findKey(n,a);s&&(!r||E2(n,n[s],s,r))&&(delete n[s],o=!0)}}return Ue.isArray(t)?t.forEach(i):i(t),o}clear(t){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const i=r[n];(!t||E2(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,n={};return Ue.forEach(this,(o,i)=>{const a=Ue.findKey(n,i);if(a){r[a]=S0(o),delete r[i];return}const s=t?NG(i):String(i).trim();s!==i&&delete r[i],r[s]=S0(o),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return Ue.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&Ue.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){const n=(this[gS]=this[gS]={accessors:{}}).accessors,o=this.prototype;function i(a){const s=Rc(a);n[s]||(LG(o,a),n[s]=!0)}return Ue.isArray(t)?t.forEach(i):i(t),this}}rg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(rg.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Ue.freezeMethods(rg);var Qi=rg;function k2(e,t){const r=this||v5,n=t||r,o=Qi.from(n.headers);let i=n.data;return Ue.forEach(e,function(s){i=s.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function kT(e){return!!(e&&e.__CANCEL__)}function lc(e,t,r){Ft.call(this,e??"canceled",Ft.ERR_CANCELED,t,r),this.name="CanceledError"}Ue.inherits(lc,Ft,{__CANCEL__:!0});function AT(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Ft("Request failed with status code "+r.status,[Ft.ERR_BAD_REQUEST,Ft.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function DG(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function UG(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=n[i];a||(a=u),r[o]=l,n[o]=u;let h=i,d=0;for(;h!==o;)d+=r[h++],h=h%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-an)return o&&(clearTimeout(o),o=null),r=s,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,r=Date.now(),e.apply(null,arguments)),n-(s-r)))}}var Bp=(e,t,r=3)=>{let n=0;const o=UG(50,250);return jG(i=>{const a=i.loaded,s=i.lengthComputable?i.total:void 0,l=a-n,u=o(l),c=a<=s;n=a;const h={loaded:a,total:s,progress:s?a/s:void 0,bytes:l,rate:u||void 0,estimated:u&&s&&c?(s-a)/u:void 0,event:i,lengthComputable:s!=null};h[t?"download":"upload"]=!0,e(h)},r)},FG=Yi.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function o(i){let a=i;return t&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=o(window.location.href),function(a){const s=Ue.isString(a)?o(a):a;return s.protocol===n.protocol&&s.host===n.host}}():function(){return function(){return!0}}(),zG=Yi.hasStandardBrowserEnv?{write(e,t,r,n,o,i){const a=[e+"="+encodeURIComponent(t)];Ue.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Ue.isString(n)&&a.push("path="+n),Ue.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $G(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qG(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function MT(e,t){return e&&!$G(t)?qG(e,t):t}const mS=e=>e instanceof Qi?{...e}:e;function rl(e,t){t=t||{};const r={};function n(u,c,h){return Ue.isPlainObject(u)&&Ue.isPlainObject(c)?Ue.merge.call({caseless:h},u,c):Ue.isPlainObject(c)?Ue.merge({},c):Ue.isArray(c)?c.slice():c}function o(u,c,h){if(Ue.isUndefined(c)){if(!Ue.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function i(u,c){if(!Ue.isUndefined(c))return n(void 0,c)}function a(u,c){if(Ue.isUndefined(c)){if(!Ue.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function s(u,c,h){if(h in t)return n(u,c);if(h in e)return n(void 0,u)}const l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(u,c)=>o(mS(u),mS(c),!0)};return Ue.forEach(Object.keys(Object.assign({},e,t)),function(c){const h=l[c]||o,d=h(e[c],t[c],c);Ue.isUndefined(d)&&h!==s||(r[c]=d)}),r}var IT=e=>{const t=rl({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;t.headers=a=Qi.from(a),t.url=ST(MT(t.baseURL,t.url),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(Ue.isFormData(r)){if(Yi.hasStandardBrowserEnv||Yi.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[u,...c]=l?l.split(";").map(h=>h.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Yi.hasStandardBrowserEnv&&(n&&Ue.isFunction(n)&&(n=n(t)),n||n!==!1&&FG(t.url))){const u=o&&i&&zG.read(i);u&&a.set(o,u)}return t};const WG=typeof XMLHttpRequest<"u";var VG=WG&&function(e){return new Promise(function(r,n){const o=IT(e);let i=o.data;const a=Qi.from(o.headers).normalize();let{responseType:s}=o,l;function u(){o.cancelToken&&o.cancelToken.unsubscribe(l),o.signal&&o.signal.removeEventListener("abort",l)}let c=new XMLHttpRequest;c.open(o.method.toUpperCase(),o.url,!0),c.timeout=o.timeout;function h(){if(!c)return;const p=Qi.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),b={data:!s||s==="text"||s==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:p,config:e,request:c};AT(function(x){r(x),u()},function(x){n(x),u()},b),c=null}"onloadend"in c?c.onloadend=h:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(h)},c.onabort=function(){c&&(n(new Ft("Request aborted",Ft.ECONNABORTED,o,c)),c=null)},c.onerror=function(){n(new Ft("Network Error",Ft.ERR_NETWORK,o,c)),c=null},c.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||CT;o.timeoutErrorMessage&&(v=o.timeoutErrorMessage),n(new Ft(v,b.clarifyTimeoutError?Ft.ETIMEDOUT:Ft.ECONNABORTED,o,c)),c=null},i===void 0&&a.setContentType(null),"setRequestHeader"in c&&Ue.forEach(a.toJSON(),function(v,b){c.setRequestHeader(b,v)}),Ue.isUndefined(o.withCredentials)||(c.withCredentials=!!o.withCredentials),s&&s!=="json"&&(c.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&c.addEventListener("progress",Bp(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Bp(o.onUploadProgress)),(o.cancelToken||o.signal)&&(l=p=>{c&&(n(!p||p.type?new lc(null,e,c):p),c.abort(),c=null)},o.cancelToken&&o.cancelToken.subscribe(l),o.signal&&(o.signal.aborted?l():o.signal.addEventListener("abort",l)));const d=DG(o.url);if(d&&Yi.protocols.indexOf(d)===-1){n(new Ft("Unsupported protocol "+d+":",Ft.ERR_BAD_REQUEST,e));return}c.send(i||null)})};const HG=(e,t)=>{let r=new AbortController,n;const o=function(l){if(!n){n=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof Ft?u:new lc(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{o(new Ft(`timeout ${t} of ms exceeded`,Ft.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",o):l.unsubscribe(o))}),e=null)};e.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=a,[s,()=>{i&&clearTimeout(i),i=null}]};var KG=HG;const ZG=function*(e,t){let r=e.byteLength;if(!t||r{const i=GG(e,t,o);let a=0;return new ReadableStream({type:"bytes",async pull(s){const{done:l,value:u}=await i.next();if(l){s.close(),n();return}let c=u.byteLength;r&&r(a+=c),s.enqueue(new Uint8Array(u))},cancel(s){return n(s),i.return()}},{highWaterMark:2})},yS=(e,t)=>{const r=e!=null;return n=>setTimeout(()=>t({lengthComputable:r,total:e,loaded:n}))},ng=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",TT=ng&&typeof ReadableStream=="function",w4=ng&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),YG=TT&&(()=>{let e=!1;const t=new Request(Yi.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),bS=64*1024,_4=TT&&!!(()=>{try{return Ue.isReadableStream(new Response("").body)}catch{}})(),Pp={stream:_4&&(e=>e.body)};ng&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Pp[t]&&(Pp[t]=Ue.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new Ft(`Response type '${t}' is not supported`,Ft.ERR_NOT_SUPPORT,n)})})})(new Response);const QG=async e=>{if(e==null)return 0;if(Ue.isBlob(e))return e.size;if(Ue.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(Ue.isArrayBufferView(e))return e.byteLength;if(Ue.isURLSearchParams(e)&&(e=e+""),Ue.isString(e))return(await w4(e)).byteLength},XG=async(e,t)=>{const r=Ue.toFiniteNumber(e.getContentLength());return r??QG(t)};var JG=ng&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:i,timeout:a,onDownloadProgress:s,onUploadProgress:l,responseType:u,headers:c,withCredentials:h="same-origin",fetchOptions:d}=IT(e);u=u?(u+"").toLowerCase():"text";let[p,v]=o||i||a?KG([o,i],a):[],b,S;const x=()=>{!b&&setTimeout(()=>{p&&p.unsubscribe()}),b=!0};let k;try{if(l&&YG&&r!=="get"&&r!=="head"&&(k=await XG(c,n))!==0){let j=new Request(t,{method:"POST",body:n,duplex:"half"}),V;Ue.isFormData(n)&&(V=j.headers.get("content-type"))&&c.setContentType(V),j.body&&(n=vS(j.body,bS,yS(k,Bp(l)),null,w4))}Ue.isString(h)||(h=h?"cors":"omit"),S=new Request(t,{...d,signal:p,method:r.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",withCredentials:h});let M=await fetch(S);const P=_4&&(u==="stream"||u==="response");if(_4&&(s||P)){const j={};["status","statusText","headers"].forEach(K=>{j[K]=M[K]});const V=Ue.toFiniteNumber(M.headers.get("content-length"));M=new Response(vS(M.body,bS,s&&yS(V,Bp(s,!0)),P&&x,w4),j)}u=u||"text";let L=await Pp[Ue.findKey(Pp,u)||"text"](M,e);return!P&&x(),v&&v(),await new Promise((j,V)=>{AT(j,V,{data:L,headers:Qi.from(M.headers),status:M.status,statusText:M.statusText,config:e,request:S})})}catch(M){throw x(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new Ft("Network Error",Ft.ERR_NETWORK,e,S),{cause:M.cause||M}):Ft.from(M,M&&M.code,e,S)}});const x4={http:pG,xhr:VG,fetch:JG};Ue.forEach(x4,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const wS=e=>`- ${e}`,eY=e=>Ue.isFunction(e)||e===null||e===!1;var BT={getAdapter:e=>{e=Ue.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let i=0;i`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since : +`+i.map(wS).join(` +`):" "+wS(i[0]):"as no adapter specified";throw new Ft("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:x4};function A2(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lc(null,e)}function _S(e){return A2(e),e.headers=Qi.from(e.headers),e.data=k2.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),BT.getAdapter(e.adapter||v5.adapter)(e).then(function(n){return A2(e),n.data=k2.call(e,e.transformResponse,n),n.headers=Qi.from(n.headers),n},function(n){return kT(n)||(A2(e),n&&n.response&&(n.response.data=k2.call(e,e.transformResponse,n.response),n.response.headers=Qi.from(n.response.headers))),Promise.reject(n)})}const PT="1.7.2",y5={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{y5[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const xS={};y5.transitional=function(t,r,n){function o(i,a){return"[Axios v"+PT+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,s)=>{if(t===!1)throw new Ft(o(a," has been removed"+(r?" in "+r:"")),Ft.ERR_DEPRECATED);return r&&!xS[a]&&(xS[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,s):!0}};function tY(e,t,r){if(typeof e!="object")throw new Ft("options must be an object",Ft.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const i=n[o],a=t[i];if(a){const s=e[i],l=s===void 0||a(s,i,e);if(l!==!0)throw new Ft("option "+i+" must be "+l,Ft.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Ft("Unknown option "+i,Ft.ERR_BAD_OPTION)}}var S4={assertOptions:tY,validators:y5};const va=S4.validators;class Rp{constructor(t){this.defaults=t,this.interceptors={request:new pS,response:new pS}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=rl(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&S4.assertOptions(n,{silentJSONParsing:va.transitional(va.boolean),forcedJSONParsing:va.transitional(va.boolean),clarifyTimeoutError:va.transitional(va.boolean)},!1),o!=null&&(Ue.isFunction(o)?r.paramsSerializer={serialize:o}:S4.assertOptions(o,{encode:va.function,serialize:va.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&Ue.merge(i.common,i[r.method]);i&&Ue.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),r.headers=Qi.concat(a,i);const s=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(l=l&&b.synchronous,s.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,h=0,d;if(!l){const v=[_S.bind(this),void 0];for(v.unshift.apply(v,s),v.push.apply(v,u),d=v.length,c=Promise.resolve(r);h{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(s=>{n.subscribe(s),i=s}).then(o);return a.cancel=function(){n.unsubscribe(i)},a},t(function(i,a,s){n.reason||(n.reason=new lc(i,a,s),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new b5(function(o){t=o}),cancel:t}}}var rY=b5;function nY(e){return function(r){return e.apply(null,r)}}function iY(e){return Ue.isObject(e)&&e.isAxiosError===!0}const C4={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(C4).forEach(([e,t])=>{C4[t]=e});var oY=C4;function RT(e){const t=new C0(e),r=fT(C0.prototype.request,t);return Ue.extend(r,C0.prototype,t,{allOwnKeys:!0}),Ue.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return RT(rl(e,o))},r}const Vr=RT(v5);Vr.Axios=C0;Vr.CanceledError=lc;Vr.CancelToken=rY;Vr.isCancel=kT;Vr.VERSION=PT;Vr.toFormData=tg;Vr.AxiosError=Ft;Vr.Cancel=Vr.CanceledError;Vr.all=function(t){return Promise.all(t)};Vr.spread=nY;Vr.isAxiosError=iY;Vr.mergeConfig=rl;Vr.AxiosHeaders=Qi;Vr.formToJSON=e=>ET(Ue.isHTMLForm(e)?new FormData(e):e);Vr.getAdapter=BT.getAdapter;Vr.HttpStatusCode=oY;Vr.default=Vr;var ig=Vr;/** * @license * Copyright 2017 Google LLC * @@ -1223,7 +1223,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const NT=function(e){const t=[];let r=0;for(let n=0;n>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},EY=function(e){const t=[];let r=0,n=0;for(;r191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((o&31)<<6|i&63)}else if(o>239&&o<365){const i=e[r++],a=e[r++],s=e[r++],l=((o&7)<<18|(i&63)<<12|(a&63)<<6|s&63)-65536;t[n++]=String.fromCharCode(55296+(l>>10)),t[n++]=String.fromCharCode(56320+(l&1023))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((o&15)<<12|(i&63)<<6|a&63)}}return t.join("")},w5={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let o=0;o>2,h=(i&3)<<4|s>>4;let d=(s&15)<<2|u>>6,p=u&63;l||(p=64,a||(d=64)),n.push(r[c],r[h],r[d],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(NT(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):EY(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let o=0;o>4;if(n.push(d),u!==64){const p=s<<4&240|u>>2;if(n.push(p),h!==64){const v=u<<6&192|h;n.push(v)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class kY extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const LT=function(e){const t=NT(e);return w5.encodeByteArray(t,!0)},Op=function(e){return LT(e).replace(/\./g,"")},k4=function(e){try{return w5.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/** + */const NT=function(e){const t=[];let r=0;for(let n=0;n>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},aY=function(e){const t=[];let r=0,n=0;for(;r191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((o&31)<<6|i&63)}else if(o>239&&o<365){const i=e[r++],a=e[r++],s=e[r++],l=((o&7)<<18|(i&63)<<12|(a&63)<<6|s&63)-65536;t[n++]=String.fromCharCode(55296+(l>>10)),t[n++]=String.fromCharCode(56320+(l&1023))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((o&15)<<12|(i&63)<<6|a&63)}}return t.join("")},w5={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let o=0;o>2,h=(i&3)<<4|s>>4;let d=(s&15)<<2|u>>6,p=u&63;l||(p=64,a||(d=64)),n.push(r[c],r[h],r[d],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(NT(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):aY(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let o=0;o>4;if(n.push(d),u!==64){const p=s<<4&240|u>>2;if(n.push(p),h!==64){const v=u<<6&192|h;n.push(v)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class sY extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const LT=function(e){const t=NT(e);return w5.encodeByteArray(t,!0)},Op=function(e){return LT(e).replace(/\./g,"")},E4=function(e){try{return w5.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/** * @license * Copyright 2017 Google LLC * @@ -1238,7 +1238,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function AY(e){return DT(void 0,e)}function DT(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)!t.hasOwnProperty(r)||!MY(r)||(e[r]=DT(e[r],t[r]));return e}function MY(e){return e!=="__proto__"}/** + */function lY(e){return DT(void 0,e)}function DT(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)!t.hasOwnProperty(r)||!uY(r)||(e[r]=DT(e[r],t[r]));return e}function uY(e){return e!=="__proto__"}/** * @license * Copyright 2022 Google LLC * @@ -1253,7 +1253,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function IY(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Zb<"u")return Zb;throw new Error("Unable to locate global object.")}/** + */function cY(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof W_<"u")return W_;throw new Error("Unable to locate global object.")}/** * @license * Copyright 2022 Google LLC * @@ -1268,7 +1268,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const TY=()=>IY().__FIREBASE_DEFAULTS__,BY=()=>{if(typeof _t>"u"||typeof _t.env>"u")return;const e={}.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},PY=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&k4(e[1]);return t&&JSON.parse(t)},UT=()=>{try{return TY()||BY()||PY()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},RY=e=>{var t,r;return(r=(t=UT())===null||t===void 0?void 0:t.emulatorHosts)===null||r===void 0?void 0:r[e]},OY=e=>{const t=RY(e);if(!t)return;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return t[0]==="["?[t.substring(1,r-1),n]:[t.substring(0,r),n]},jT=()=>{var e;return(e=UT())===null||e===void 0?void 0:e.config};/** + */const fY=()=>cY().__FIREBASE_DEFAULTS__,dY=()=>{if(typeof _t>"u"||typeof _t.env>"u")return;const e={}.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},hY=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&E4(e[1]);return t&&JSON.parse(t)},UT=()=>{try{return fY()||dY()||hY()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},pY=e=>{var t,r;return(r=(t=UT())===null||t===void 0?void 0:t.emulatorHosts)===null||r===void 0?void 0:r[e]},gY=e=>{const t=pY(e);if(!t)return;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return t[0]==="["?[t.substring(1,r-1),n]:[t.substring(0,r),n]},jT=()=>{var e;return(e=UT())===null||e===void 0?void 0:e.config};/** * @license * Copyright 2017 Google LLC * @@ -1298,7 +1298,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function NY(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r={alg:"none",type:"JWT"},n=t||"demo-project",o=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:o,exp:o+3600,auth_time:o,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e),s="";return[Op(JSON.stringify(r)),Op(JSON.stringify(a)),s].join(".")}/** + */function mY(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r={alg:"none",type:"JWT"},n=t||"demo-project",o=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:o,exp:o+3600,auth_time:o,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e),s="";return[Op(JSON.stringify(r)),Op(JSON.stringify(a)),s].join(".")}/** * @license * Copyright 2017 Google LLC * @@ -1313,7 +1313,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function LY(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function FT(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(LY())}function DY(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function zT(){return OT.NODE_ADMIN===!0}function UY(){try{return typeof indexedDB=="object"}catch{return!1}}function jY(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{var i;t(((i=o.error)===null||i===void 0?void 0:i.message)||"")}}catch(r){t(r)}})}/** + */function vY(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function FT(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(vY())}function yY(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function zT(){return OT.NODE_ADMIN===!0}function bY(){try{return typeof indexedDB=="object"}catch{return!1}}function wY(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{var i;t(((i=o.error)===null||i===void 0?void 0:i.message)||"")}}catch(r){t(r)}})}/** * @license * Copyright 2017 Google LLC * @@ -1328,7 +1328,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const FY="FirebaseError";class rh extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=FY,Object.setPrototypeOf(this,rh.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,$T.prototype.create)}}class $T{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},o=`${this.service}/${t}`,i=this.errors[t],a=i?zY(i,n):"Error",s=`${this.serviceName}: ${a} (${o}).`;return new rh(o,s,n)}}function zY(e,t){return e.replace($Y,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const $Y=/\{\$([^}]+)}/g;/** + */const _Y="FirebaseError";class rh extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=_Y,Object.setPrototypeOf(this,rh.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,$T.prototype.create)}}class $T{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},o=`${this.service}/${t}`,i=this.errors[t],a=i?xY(i,n):"Error",s=`${this.serviceName}: ${a} (${o}).`;return new rh(o,s,n)}}function xY(e,t){return e.replace(SY,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const SY=/\{\$([^}]+)}/g;/** * @license * Copyright 2017 Google LLC * @@ -1358,7 +1358,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const qT=function(e){let t={},r={},n={},o="";try{const i=e.split(".");t=_d(k4(i[0])||""),r=_d(k4(i[1])||""),o=i[2],n=r.d||{},delete r.d}catch{}return{header:t,claims:r,data:n,signature:o}},qY=function(e){const t=qT(e),r=t.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},WY=function(e){const t=qT(e).claims;return typeof t=="object"&&t.admin===!0};/** + */const qT=function(e){let t={},r={},n={},o="";try{const i=e.split(".");t=_d(E4(i[0])||""),r=_d(E4(i[1])||""),o=i[2],n=r.d||{},delete r.d}catch{}return{header:t,claims:r,data:n,signature:o}},CY=function(e){const t=qT(e),r=t.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},EY=function(e){const t=qT(e).claims;return typeof t=="object"&&t.admin===!0};/** * @license * Copyright 2017 Google LLC * @@ -1373,7 +1373,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function pa(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qu(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function xS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Np(e,t,r){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t.call(r,e[o],o,e));return n}function A4(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const o of r){if(!n.includes(o))return!1;const i=e[o],a=t[o];if(SS(i)&&SS(a)){if(!A4(i,a))return!1}else if(i!==a)return!1}for(const o of n)if(!r.includes(o))return!1;return!0}function SS(e){return e!==null&&typeof e=="object"}/** + */function pa(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qu(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function SS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Np(e,t,r){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t.call(r,e[o],o,e));return n}function k4(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const o of r){if(!n.includes(o))return!1;const i=e[o],a=t[o];if(CS(i)&&CS(a)){if(!k4(i,a))return!1}else if(i!==a)return!1}for(const o of n)if(!r.includes(o))return!1;return!0}function CS(e){return e!==null&&typeof e=="object"}/** * @license * Copyright 2017 Google LLC * @@ -1388,7 +1388,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function VY(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(o=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}/** + */function kY(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(o=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}/** * @license * Copyright 2017 Google LLC * @@ -1403,7 +1403,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class HY{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let t=1;t>>31)&4294967295}let o=this.chain_[0],i=this.chain_[1],a=this.chain_[2],s=this.chain_[3],l=this.chain_[4],u,c;for(let h=0;h<80;h++){h<40?h<20?(u=s^i&(a^s),c=1518500249):(u=i^a^s,c=1859775393):h<60?(u=i&a|s&(i|a),c=2400959708):(u=i^a^s,c=3395469782);const d=(o<<5|o>>>27)+u+l+c+n[h]&4294967295;l=s,s=a,a=(i<<30|i>>>2)&4294967295,i=o,o=d}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+s&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(t,r){if(t==null)return;r===void 0&&(r=t.length);const n=r-this.blockSize;let o=0;const i=this.buf_;let a=this.inbuf_;for(;o=56;o--)this.buf_[o]=r&255,r/=256;this.compress_(this.buf_);let n=0;for(let o=0;o<5;o++)for(let i=24;i>=0;i-=8)t[n]=this.chain_[o]>>i&255,++n;return t}}function _5(e,t){return`${e} failed: ${t} argument `}/** + */class AY{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let t=1;t>>31)&4294967295}let o=this.chain_[0],i=this.chain_[1],a=this.chain_[2],s=this.chain_[3],l=this.chain_[4],u,c;for(let h=0;h<80;h++){h<40?h<20?(u=s^i&(a^s),c=1518500249):(u=i^a^s,c=1859775393):h<60?(u=i&a|s&(i|a),c=2400959708):(u=i^a^s,c=3395469782);const d=(o<<5|o>>>27)+u+l+c+n[h]&4294967295;l=s,s=a,a=(i<<30|i>>>2)&4294967295,i=o,o=d}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+s&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(t,r){if(t==null)return;r===void 0&&(r=t.length);const n=r-this.blockSize;let o=0;const i=this.buf_;let a=this.inbuf_;for(;o=56;o--)this.buf_[o]=r&255,r/=256;this.compress_(this.buf_);let n=0;for(let o=0;o<5;o++)for(let i=24;i>=0;i-=8)t[n]=this.chain_[o]>>i&255,++n;return t}}function _5(e,t){return`${e} failed: ${t} argument `}/** * @license * Copyright 2017 Google LLC * @@ -1418,7 +1418,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const KY=function(e){const t=[];let r=0;for(let n=0;n=55296&&o<=56319){const i=o-55296;n++,it(n>6|192,t[r++]=o&63|128):o<65536?(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},ag=function(e){let t=0;for(let r=0;r=55296&&n<=56319?(t+=4,r++):t+=3}return t};/** + */const MY=function(e){const t=[];let r=0;for(let n=0;n=55296&&o<=56319){const i=o-55296;n++,it(n>6|192,t[r++]=o&63|128):o<65536?(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},ag=function(e){let t=0;for(let r=0;r=55296&&n<=56319?(t+=4,r++):t+=3}return t};/** * @license * Copyright 2021 Google LLC * @@ -1463,7 +1463,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class ZY{constructor(t,r){this.name=t,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const r=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(r)){const n=new og;if(this.instancesDeferred.set(r,n),this.isInitialized(r)||this.shouldAutoInitialize())try{const o=this.getOrInitializeService({instanceIdentifier:r});o&&n.resolve(o)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(t){var r;const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),o=(r=t==null?void 0:t.optional)!==null&&r!==void 0?r:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(o)return null;throw i}else{if(o)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(YY(t))try{this.getOrInitializeService({instanceIdentifier:Ms})}catch{}for(const[r,n]of this.instancesDeferred.entries()){const o=this.normalizeInstanceIdentifier(r);try{const i=this.getOrInitializeService({instanceIdentifier:o});n.resolve(i)}catch{}}}}clearInstance(t=Ms){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...t.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Ms){return this.instances.has(t)}getOptions(t=Ms){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:r={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const o=this.getOrInitializeService({instanceIdentifier:n,options:r});for(const[i,a]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(i);n===s&&a.resolve(o)}return o}onInit(t,r){var n;const o=this.normalizeInstanceIdentifier(r),i=(n=this.onInitCallbacks.get(o))!==null&&n!==void 0?n:new Set;i.add(t),this.onInitCallbacks.set(o,i);const a=this.instances.get(o);return a&&t(a,o),()=>{i.delete(t)}}invokeOnInitCallbacks(t,r){const n=this.onInitCallbacks.get(r);if(n)for(const o of n)try{o(t,r)}catch{}}getOrInitializeService({instanceIdentifier:t,options:r={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:GY(t),options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}return n||null}normalizeInstanceIdentifier(t=Ms){return this.component?this.component.multipleInstances?t:Ms:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function GY(e){return e===Ms?void 0:e}function YY(e){return e.instantiationMode==="EAGER"}/** + */class IY{constructor(t,r){this.name=t,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const r=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(r)){const n=new og;if(this.instancesDeferred.set(r,n),this.isInitialized(r)||this.shouldAutoInitialize())try{const o=this.getOrInitializeService({instanceIdentifier:r});o&&n.resolve(o)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(t){var r;const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),o=(r=t==null?void 0:t.optional)!==null&&r!==void 0?r:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(o)return null;throw i}else{if(o)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(BY(t))try{this.getOrInitializeService({instanceIdentifier:Ms})}catch{}for(const[r,n]of this.instancesDeferred.entries()){const o=this.normalizeInstanceIdentifier(r);try{const i=this.getOrInitializeService({instanceIdentifier:o});n.resolve(i)}catch{}}}}clearInstance(t=Ms){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...t.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Ms){return this.instances.has(t)}getOptions(t=Ms){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:r={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const o=this.getOrInitializeService({instanceIdentifier:n,options:r});for(const[i,a]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(i);n===s&&a.resolve(o)}return o}onInit(t,r){var n;const o=this.normalizeInstanceIdentifier(r),i=(n=this.onInitCallbacks.get(o))!==null&&n!==void 0?n:new Set;i.add(t),this.onInitCallbacks.set(o,i);const a=this.instances.get(o);return a&&t(a,o),()=>{i.delete(t)}}invokeOnInitCallbacks(t,r){const n=this.onInitCallbacks.get(r);if(n)for(const o of n)try{o(t,r)}catch{}}getOrInitializeService({instanceIdentifier:t,options:r={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:TY(t),options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}return n||null}normalizeInstanceIdentifier(t=Ms){return this.component?this.component.multipleInstances?t:Ms:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function TY(e){return e===Ms?void 0:e}function BY(e){return e.instantiationMode==="EAGER"}/** * @license * Copyright 2019 Google LLC * @@ -1478,7 +1478,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class QY{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const r=this.getProvider(t.name);if(r.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);r.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const r=new ZY(t,this);return this.providers.set(t,r),r}getProviders(){return Array.from(this.providers.values())}}/** + */class PY{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const r=this.getProvider(t.name);if(r.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);r.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const r=new IY(t,this);return this.providers.set(t,r),r}getProviders(){return Array.from(this.providers.values())}}/** * @license * Copyright 2017 Google LLC * @@ -1493,7 +1493,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var yr;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(yr||(yr={}));const XY={debug:yr.DEBUG,verbose:yr.VERBOSE,info:yr.INFO,warn:yr.WARN,error:yr.ERROR,silent:yr.SILENT},JY=yr.INFO,eQ={[yr.DEBUG]:"log",[yr.VERBOSE]:"log",[yr.INFO]:"info",[yr.WARN]:"warn",[yr.ERROR]:"error"},tQ=(e,t,...r)=>{if(tt.some(r=>e instanceof r);let CS,ES;function nQ(){return CS||(CS=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function iQ(){return ES||(ES=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const VT=new WeakMap,M4=new WeakMap,HT=new WeakMap,M2=new WeakMap,x5=new WeakMap;function oQ(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{r(za(e.result)),o()},a=()=>{n(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",a)});return t.then(r=>{r instanceof IDBCursor&&VT.set(r,e)}).catch(()=>{}),x5.set(t,e),t}function aQ(e){if(M4.has(e))return;const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{r(),o()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});M4.set(e,t)}let I4={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return M4.get(e);if(t==="objectStoreNames")return e.objectStoreNames||HT.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return za(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function sQ(e){I4=e(I4)}function lQ(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(I2(this),t,...r);return HT.set(n,t.sort?t.sort():[t]),za(n)}:iQ().includes(e)?function(...t){return e.apply(I2(this),t),za(VT.get(this))}:function(...t){return za(e.apply(I2(this),t))}}function uQ(e){return typeof e=="function"?lQ(e):(e instanceof IDBTransaction&&aQ(e),rQ(e,nQ())?new Proxy(e,I4):e)}function za(e){if(e instanceof IDBRequest)return oQ(e);if(M2.has(e))return M2.get(e);const t=uQ(e);return t!==e&&(M2.set(e,t),x5.set(t,e)),t}const I2=e=>x5.get(e);function cQ(e,t,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){const a=indexedDB.open(e,t),s=za(a);return n&&a.addEventListener("upgradeneeded",l=>{n(za(a.result),l.oldVersion,l.newVersion,za(a.transaction),l)}),r&&a.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),o&&l.addEventListener("versionchange",u=>o(u.oldVersion,u.newVersion,u))}).catch(()=>{}),s}const fQ=["get","getKey","getAll","getAllKeys","count"],dQ=["put","add","delete","clear"],T2=new Map;function kS(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(T2.get(t))return T2.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=dQ.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||fQ.includes(r)))return;const i=async function(a,...s){const l=this.transaction(a,o?"readwrite":"readonly");let u=l.store;return n&&(u=u.index(s.shift())),(await Promise.all([u[r](...s),o&&l.done]))[0]};return T2.set(t,i),i}sQ(e=>({...e,get:(t,r,n)=>kS(t,r)||e.get(t,r,n),has:(t,r)=>!!kS(t,r)||e.has(t,r)}));/** + */var yr;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(yr||(yr={}));const RY={debug:yr.DEBUG,verbose:yr.VERBOSE,info:yr.INFO,warn:yr.WARN,error:yr.ERROR,silent:yr.SILENT},OY=yr.INFO,NY={[yr.DEBUG]:"log",[yr.VERBOSE]:"log",[yr.INFO]:"info",[yr.WARN]:"warn",[yr.ERROR]:"error"},LY=(e,t,...r)=>{if(tt.some(r=>e instanceof r);let ES,kS;function UY(){return ES||(ES=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function jY(){return kS||(kS=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const VT=new WeakMap,A4=new WeakMap,HT=new WeakMap,M2=new WeakMap,x5=new WeakMap;function FY(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{r(za(e.result)),o()},a=()=>{n(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",a)});return t.then(r=>{r instanceof IDBCursor&&VT.set(r,e)}).catch(()=>{}),x5.set(t,e),t}function zY(e){if(A4.has(e))return;const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{r(),o()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});A4.set(e,t)}let M4={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return A4.get(e);if(t==="objectStoreNames")return e.objectStoreNames||HT.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return za(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function $Y(e){M4=e(M4)}function qY(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(I2(this),t,...r);return HT.set(n,t.sort?t.sort():[t]),za(n)}:jY().includes(e)?function(...t){return e.apply(I2(this),t),za(VT.get(this))}:function(...t){return za(e.apply(I2(this),t))}}function WY(e){return typeof e=="function"?qY(e):(e instanceof IDBTransaction&&zY(e),DY(e,UY())?new Proxy(e,M4):e)}function za(e){if(e instanceof IDBRequest)return FY(e);if(M2.has(e))return M2.get(e);const t=WY(e);return t!==e&&(M2.set(e,t),x5.set(t,e)),t}const I2=e=>x5.get(e);function VY(e,t,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){const a=indexedDB.open(e,t),s=za(a);return n&&a.addEventListener("upgradeneeded",l=>{n(za(a.result),l.oldVersion,l.newVersion,za(a.transaction),l)}),r&&a.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),o&&l.addEventListener("versionchange",u=>o(u.oldVersion,u.newVersion,u))}).catch(()=>{}),s}const HY=["get","getKey","getAll","getAllKeys","count"],KY=["put","add","delete","clear"],T2=new Map;function AS(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(T2.get(t))return T2.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=KY.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||HY.includes(r)))return;const i=async function(a,...s){const l=this.transaction(a,o?"readwrite":"readonly");let u=l.store;return n&&(u=u.index(s.shift())),(await Promise.all([u[r](...s),o&&l.done]))[0]};return T2.set(t,i),i}$Y(e=>({...e,get:(t,r,n)=>AS(t,r)||e.get(t,r,n),has:(t,r)=>!!AS(t,r)||e.has(t,r)}));/** * @license * Copyright 2019 Google LLC * @@ -1508,7 +1508,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class hQ{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(pQ(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function pQ(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const T4="@firebase/app",AS="0.10.6";/** + */class ZY{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(GY(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function GY(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const I4="@firebase/app",MS="0.10.6";/** * @license * Copyright 2019 Google LLC * @@ -1523,7 +1523,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const nl=new WT("@firebase/app"),gQ="@firebase/app-compat",mQ="@firebase/analytics-compat",vQ="@firebase/analytics",yQ="@firebase/app-check-compat",bQ="@firebase/app-check",wQ="@firebase/auth",_Q="@firebase/auth-compat",xQ="@firebase/database",SQ="@firebase/database-compat",CQ="@firebase/functions",EQ="@firebase/functions-compat",kQ="@firebase/installations",AQ="@firebase/installations-compat",MQ="@firebase/messaging",IQ="@firebase/messaging-compat",TQ="@firebase/performance",BQ="@firebase/performance-compat",PQ="@firebase/remote-config",RQ="@firebase/remote-config-compat",OQ="@firebase/storage",NQ="@firebase/storage-compat",LQ="@firebase/firestore",DQ="@firebase/vertexai-preview",UQ="@firebase/firestore-compat",jQ="firebase",FQ="10.12.3";/** + */const nl=new WT("@firebase/app"),YY="@firebase/app-compat",QY="@firebase/analytics-compat",XY="@firebase/analytics",JY="@firebase/app-check-compat",eQ="@firebase/app-check",tQ="@firebase/auth",rQ="@firebase/auth-compat",nQ="@firebase/database",iQ="@firebase/database-compat",oQ="@firebase/functions",aQ="@firebase/functions-compat",sQ="@firebase/installations",lQ="@firebase/installations-compat",uQ="@firebase/messaging",cQ="@firebase/messaging-compat",fQ="@firebase/performance",dQ="@firebase/performance-compat",hQ="@firebase/remote-config",pQ="@firebase/remote-config-compat",gQ="@firebase/storage",mQ="@firebase/storage-compat",vQ="@firebase/firestore",yQ="@firebase/vertexai-preview",bQ="@firebase/firestore-compat",wQ="firebase",_Q="10.12.3";/** * @license * Copyright 2019 Google LLC * @@ -1538,7 +1538,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const B4="[DEFAULT]",zQ={[T4]:"fire-core",[gQ]:"fire-core-compat",[vQ]:"fire-analytics",[mQ]:"fire-analytics-compat",[bQ]:"fire-app-check",[yQ]:"fire-app-check-compat",[wQ]:"fire-auth",[_Q]:"fire-auth-compat",[xQ]:"fire-rtdb",[SQ]:"fire-rtdb-compat",[CQ]:"fire-fn",[EQ]:"fire-fn-compat",[kQ]:"fire-iid",[AQ]:"fire-iid-compat",[MQ]:"fire-fcm",[IQ]:"fire-fcm-compat",[TQ]:"fire-perf",[BQ]:"fire-perf-compat",[PQ]:"fire-rc",[RQ]:"fire-rc-compat",[OQ]:"fire-gcs",[NQ]:"fire-gcs-compat",[LQ]:"fire-fst",[UQ]:"fire-fst-compat",[DQ]:"fire-vertex","fire-js":"fire-js",[jQ]:"fire-js-all"};/** + */const T4="[DEFAULT]",xQ={[I4]:"fire-core",[YY]:"fire-core-compat",[XY]:"fire-analytics",[QY]:"fire-analytics-compat",[eQ]:"fire-app-check",[JY]:"fire-app-check-compat",[tQ]:"fire-auth",[rQ]:"fire-auth-compat",[nQ]:"fire-rtdb",[iQ]:"fire-rtdb-compat",[oQ]:"fire-fn",[aQ]:"fire-fn-compat",[sQ]:"fire-iid",[lQ]:"fire-iid-compat",[uQ]:"fire-fcm",[cQ]:"fire-fcm-compat",[fQ]:"fire-perf",[dQ]:"fire-perf-compat",[hQ]:"fire-rc",[pQ]:"fire-rc-compat",[gQ]:"fire-gcs",[mQ]:"fire-gcs-compat",[vQ]:"fire-fst",[bQ]:"fire-fst-compat",[yQ]:"fire-vertex","fire-js":"fire-js",[wQ]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * @@ -1553,7 +1553,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const Lp=new Map,$Q=new Map,P4=new Map;function MS(e,t){try{e.container.addComponent(t)}catch(r){nl.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Dp(e){const t=e.name;if(P4.has(t))return nl.debug(`There were multiple attempts to register component ${t}.`),!1;P4.set(t,e);for(const r of Lp.values())MS(r,e);for(const r of $Q.values())MS(r,e);return!0}function qQ(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}/** + */const Lp=new Map,SQ=new Map,B4=new Map;function IS(e,t){try{e.container.addComponent(t)}catch(r){nl.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Dp(e){const t=e.name;if(B4.has(t))return nl.debug(`There were multiple attempts to register component ${t}.`),!1;B4.set(t,e);for(const r of Lp.values())IS(r,e);for(const r of SQ.values())IS(r,e);return!0}function CQ(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}/** * @license * Copyright 2019 Google LLC * @@ -1568,7 +1568,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const WQ={["no-app"]:"No Firebase App '{$appName}' has been created - call initializeApp() first",["bad-app-name"]:"Illegal App name: '{$appName}'",["duplicate-app"]:"Firebase App named '{$appName}' already exists with different options or config",["app-deleted"]:"Firebase App named '{$appName}' already deleted",["server-app-deleted"]:"Firebase Server App has been deleted",["no-options"]:"Need to provide options, when not being deployed to hosting via source.",["invalid-app-argument"]:"firebase.{$appName}() takes either no argument or a Firebase App instance.",["invalid-log-argument"]:"First argument to `onLog` must be null or a function.",["idb-open"]:"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",["idb-get"]:"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",["idb-set"]:"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",["idb-delete"]:"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",["finalization-registry-not-supported"]:"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",["invalid-server-app-environment"]:"FirebaseServerApp is not for use in browser environments."},$a=new $T("app","Firebase",WQ);/** + */const EQ={["no-app"]:"No Firebase App '{$appName}' has been created - call initializeApp() first",["bad-app-name"]:"Illegal App name: '{$appName}'",["duplicate-app"]:"Firebase App named '{$appName}' already exists with different options or config",["app-deleted"]:"Firebase App named '{$appName}' already deleted",["server-app-deleted"]:"Firebase Server App has been deleted",["no-options"]:"Need to provide options, when not being deployed to hosting via source.",["invalid-app-argument"]:"firebase.{$appName}() takes either no argument or a Firebase App instance.",["invalid-log-argument"]:"First argument to `onLog` must be null or a function.",["idb-open"]:"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",["idb-get"]:"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",["idb-set"]:"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",["idb-delete"]:"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",["finalization-registry-not-supported"]:"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",["invalid-server-app-environment"]:"FirebaseServerApp is not for use in browser environments."},$a=new $T("app","Firebase",EQ);/** * @license * Copyright 2019 Google LLC * @@ -1583,7 +1583,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class VQ{constructor(t,r,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},r),this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new xd("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw $a.create("app-deleted",{appName:this._name})}}/** + */class kQ{constructor(t,r,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},r),this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new xd("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw $a.create("app-deleted",{appName:this._name})}}/** * @license * Copyright 2019 Google LLC * @@ -1598,7 +1598,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const HQ=FQ;function KT(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n=Object.assign({name:B4,automaticDataCollectionEnabled:!1},t),o=n.name;if(typeof o!="string"||!o)throw $a.create("bad-app-name",{appName:String(o)});if(r||(r=jT()),!r)throw $a.create("no-options");const i=Lp.get(o);if(i){if(A4(r,i.options)&&A4(n,i.config))return i;throw $a.create("duplicate-app",{appName:o})}const a=new QY(o);for(const l of P4.values())a.addComponent(l);const s=new VQ(r,n,a);return Lp.set(o,s),s}function KQ(e=B4){const t=Lp.get(e);if(!t&&e===B4&&jT())return KT();if(!t)throw $a.create("no-app",{appName:e});return t}function Cu(e,t,r){var n;let o=(n=zQ[e])!==null&&n!==void 0?n:e;r&&(o+=`-${r}`);const i=o.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const s=[`Unable to register library "${o}" with version "${t}":`];i&&s.push(`library name "${o}" contains illegal characters (whitespace or "/")`),i&&a&&s.push("and"),a&&s.push(`version name "${t}" contains illegal characters (whitespace or "/")`),nl.warn(s.join(" "));return}Dp(new xd(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}/** + */const AQ=_Q;function KT(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n=Object.assign({name:T4,automaticDataCollectionEnabled:!1},t),o=n.name;if(typeof o!="string"||!o)throw $a.create("bad-app-name",{appName:String(o)});if(r||(r=jT()),!r)throw $a.create("no-options");const i=Lp.get(o);if(i){if(k4(r,i.options)&&k4(n,i.config))return i;throw $a.create("duplicate-app",{appName:o})}const a=new PY(o);for(const l of B4.values())a.addComponent(l);const s=new kQ(r,n,a);return Lp.set(o,s),s}function MQ(e=T4){const t=Lp.get(e);if(!t&&e===T4&&jT())return KT();if(!t)throw $a.create("no-app",{appName:e});return t}function Cu(e,t,r){var n;let o=(n=xQ[e])!==null&&n!==void 0?n:e;r&&(o+=`-${r}`);const i=o.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const s=[`Unable to register library "${o}" with version "${t}":`];i&&s.push(`library name "${o}" contains illegal characters (whitespace or "/")`),i&&a&&s.push("and"),a&&s.push(`version name "${t}" contains illegal characters (whitespace or "/")`),nl.warn(s.join(" "));return}Dp(new xd(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}/** * @license * Copyright 2021 Google LLC * @@ -1613,7 +1613,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const ZQ="firebase-heartbeat-database",GQ=1,Sd="firebase-heartbeat-store";let B2=null;function ZT(){return B2||(B2=cQ(ZQ,GQ,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Sd)}catch(r){console.warn(r)}}}}).catch(e=>{throw $a.create("idb-open",{originalErrorMessage:e.message})})),B2}async function YQ(e){try{const r=(await ZT()).transaction(Sd),n=await r.objectStore(Sd).get(GT(e));return await r.done,n}catch(t){if(t instanceof rh)nl.warn(t.message);else{const r=$a.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});nl.warn(r.message)}}}async function IS(e,t){try{const n=(await ZT()).transaction(Sd,"readwrite");await n.objectStore(Sd).put(t,GT(e)),await n.done}catch(r){if(r instanceof rh)nl.warn(r.message);else{const n=$a.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});nl.warn(n.message)}}}function GT(e){return`${e.name}!${e.options.appId}`}/** + */const IQ="firebase-heartbeat-database",TQ=1,Sd="firebase-heartbeat-store";let B2=null;function ZT(){return B2||(B2=VY(IQ,TQ,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Sd)}catch(r){console.warn(r)}}}}).catch(e=>{throw $a.create("idb-open",{originalErrorMessage:e.message})})),B2}async function BQ(e){try{const r=(await ZT()).transaction(Sd),n=await r.objectStore(Sd).get(GT(e));return await r.done,n}catch(t){if(t instanceof rh)nl.warn(t.message);else{const r=$a.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});nl.warn(r.message)}}}async function TS(e,t){try{const n=(await ZT()).transaction(Sd,"readwrite");await n.objectStore(Sd).put(t,GT(e)),await n.done}catch(r){if(r instanceof rh)nl.warn(r.message);else{const n=$a.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});nl.warn(n.message)}}}function GT(e){return`${e.name}!${e.options.appId}`}/** * @license * Copyright 2021 Google LLC * @@ -1628,7 +1628,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const QQ=1024,XQ=30*24*60*60*1e3;class JQ{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new tX(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var t,r;const o=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=TS();if(!(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((r=this._heartbeatsCache)===null||r===void 0?void 0:r.heartbeats)==null))&&!(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:o}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const s=new Date(a.date).valueOf();return Date.now()-s<=XQ}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var t;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const r=TS(),{heartbeatsToSend:n,unsentEntries:o}=eX(this._heartbeatsCache.heartbeats),i=Op(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=r,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function TS(){return new Date().toISOString().substring(0,10)}function eX(e,t=QQ){const r=[];let n=e.slice();for(const o of e){const i=r.find(a=>a.agent===o.agent);if(i){if(i.dates.push(o.date),BS(r)>t){i.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),BS(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class tX{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return UY()?jY().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await YQ(this.app);return r!=null&&r.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return IS(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return IS(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...t.heartbeats]})}else return}}function BS(e){return Op(JSON.stringify({version:2,heartbeats:e})).length}/** + */const PQ=1024,RQ=30*24*60*60*1e3;class OQ{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new LQ(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var t,r;const o=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=BS();if(!(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((r=this._heartbeatsCache)===null||r===void 0?void 0:r.heartbeats)==null))&&!(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:o}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const s=new Date(a.date).valueOf();return Date.now()-s<=RQ}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var t;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const r=BS(),{heartbeatsToSend:n,unsentEntries:o}=NQ(this._heartbeatsCache.heartbeats),i=Op(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=r,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function BS(){return new Date().toISOString().substring(0,10)}function NQ(e,t=PQ){const r=[];let n=e.slice();for(const o of e){const i=r.find(a=>a.agent===o.agent);if(i){if(i.dates.push(o.date),PS(r)>t){i.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),PS(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class LQ{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bY()?wY().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await BQ(this.app);return r!=null&&r.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return TS(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return TS(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...t.heartbeats]})}else return}}function PS(e){return Op(JSON.stringify({version:2,heartbeats:e})).length}/** * @license * Copyright 2019 Google LLC * @@ -1643,7 +1643,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function rX(e){Dp(new xd("platform-logger",t=>new hQ(t),"PRIVATE")),Dp(new xd("heartbeat",t=>new JQ(t),"PRIVATE")),Cu(T4,AS,e),Cu(T4,AS,"esm2017"),Cu("fire-js","")}rX("");var nX="firebase",iX="10.12.3";/** + */function DQ(e){Dp(new xd("platform-logger",t=>new ZY(t),"PRIVATE")),Dp(new xd("heartbeat",t=>new OQ(t),"PRIVATE")),Cu(I4,MS,e),Cu(I4,MS,"esm2017"),Cu("fire-js","")}DQ("");var UQ="firebase",jQ="10.12.3";/** * @license * Copyright 2020 Google LLC * @@ -1658,7 +1658,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */Cu(nX,iX,"app");const PS="@firebase/database",RS="1.0.6";/** + */Cu(UQ,jQ,"app");const RS="@firebase/database",OS="1.0.6";/** * @license * Copyright 2019 Google LLC * @@ -1673,7 +1673,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let YT="";function oX(e){YT=e}/** + */let YT="";function FQ(e){YT=e}/** * @license * Copyright 2017 Google LLC * @@ -1688,7 +1688,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class aX{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,r){r==null?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Yr(r))}get(t){const r=this.domStorage_.getItem(this.prefixedName_(t));return r==null?null:_d(r)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}/** + */class zQ{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,r){r==null?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Yr(r))}get(t){const r=this.domStorage_.getItem(this.prefixedName_(t));return r==null?null:_d(r)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}/** * @license * Copyright 2017 Google LLC * @@ -1703,7 +1703,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class sX{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,r){r==null?delete this.cache_[t]:this.cache_[t]=r}get(t){return pa(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}/** + */class $Q{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,r){r==null?delete this.cache_[t]:this.cache_[t]=r}get(t){return pa(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}/** * @license * Copyright 2017 Google LLC * @@ -1718,7 +1718,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const QT=function(e){try{if(typeof window<"u"&&typeof window[e]<"u"){const t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new aX(t)}}catch{}return new sX},Fs=QT("localStorage"),R4=QT("sessionStorage");/** + */const QT=function(e){try{if(typeof window<"u"&&typeof window[e]<"u"){const t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new zQ(t)}}catch{}return new $Q},Fs=QT("localStorage"),P4=QT("sessionStorage");/** * @license * Copyright 2017 Google LLC * @@ -1733,7 +1733,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const Eu=new WT("@firebase/database"),lX=function(){let e=1;return function(){return e++}}(),XT=function(e){const t=KY(e),r=new HY;r.update(t);const n=r.digest();return w5.encodeByteArray(n)},nh=function(...e){let t="";for(let r=0;r{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},Wu="[MIN_NAME]",il="[MAX_NAME]",fc=function(e,t){if(e===t)return 0;if(e===Wu||t===il)return-1;if(t===Wu||e===il)return 1;{const r=NS(e),n=NS(t);return r!==null?n!==null?r-n===0?e.length-t.length:r-n:-1:n!==null?1:er?n.push(e.substring(o,r)):n.push(e.substring(o,o+t));return n};function ii(e,t){for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])}const tB=function(e){it(!JT(e),"Invalid JSON number");const t=11,r=52,n=(1<=Math.pow(2,1-n)?(s=Math.min(Math.floor(Math.log(e)/Math.LN2),n),i=s+n,a=Math.round(e*Math.pow(2,r-s)-Math.pow(2,r))):(i=0,a=Math.round(e/Math.pow(2,1-n-r))));const u=[];for(l=r;l;l-=1)u.push(a%2?1:0),a=Math.floor(a/2);for(l=t;l;l-=1)u.push(i%2?1:0),i=Math.floor(i/2);u.push(o?1:0),u.reverse();const c=u.join("");let h="";for(l=0;l<64;l+=8){let d=parseInt(c.substr(l,8),2).toString(16);d.length===1&&(d="0"+d),h=h+d}return h.toLowerCase()},hX=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},pX=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function gX(e,t){let r="Unknown Error";e==="too_big"?r="The data requested exceeds the maximum size that can be accessed with a single request.":e==="permission_denied"?r="Client doesn't have permission to access the desired data.":e==="unavailable"&&(r="The service is unavailable");const n=new Error(e+" at "+t._path.toString()+": "+r);return n.code=e.toUpperCase(),n}const mX=new RegExp("^-?(0*)\\d{1,10}$"),vX=-2147483648,yX=2147483647,NS=function(e){if(mX.test(e)){const t=Number(e);if(t>=vX&&t<=yX)return t}return null},dc=function(e){try{e()}catch(t){setTimeout(()=>{const r=t.stack||"";throw ni("Exception was thrown by user callback.",r),t},Math.floor(0))}},bX=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},jf=function(e,t){const r=setTimeout(e,t);return typeof r=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(r):typeof r=="object"&&r.unref&&r.unref(),r};/** + */const Eu=new WT("@firebase/database"),qQ=function(){let e=1;return function(){return e++}}(),XT=function(e){const t=MY(e),r=new AY;r.update(t);const n=r.digest();return w5.encodeByteArray(n)},nh=function(...e){let t="";for(let r=0;r{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},Wu="[MIN_NAME]",il="[MAX_NAME]",fc=function(e,t){if(e===t)return 0;if(e===Wu||t===il)return-1;if(t===Wu||e===il)return 1;{const r=LS(e),n=LS(t);return r!==null?n!==null?r-n===0?e.length-t.length:r-n:-1:n!==null?1:er?n.push(e.substring(o,r)):n.push(e.substring(o,o+t));return n};function ii(e,t){for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])}const tB=function(e){it(!JT(e),"Invalid JSON number");const t=11,r=52,n=(1<=Math.pow(2,1-n)?(s=Math.min(Math.floor(Math.log(e)/Math.LN2),n),i=s+n,a=Math.round(e*Math.pow(2,r-s)-Math.pow(2,r))):(i=0,a=Math.round(e/Math.pow(2,1-n-r))));const u=[];for(l=r;l;l-=1)u.push(a%2?1:0),a=Math.floor(a/2);for(l=t;l;l-=1)u.push(i%2?1:0),i=Math.floor(i/2);u.push(o?1:0),u.reverse();const c=u.join("");let h="";for(l=0;l<64;l+=8){let d=parseInt(c.substr(l,8),2).toString(16);d.length===1&&(d="0"+d),h=h+d}return h.toLowerCase()},ZQ=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},GQ=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function YQ(e,t){let r="Unknown Error";e==="too_big"?r="The data requested exceeds the maximum size that can be accessed with a single request.":e==="permission_denied"?r="Client doesn't have permission to access the desired data.":e==="unavailable"&&(r="The service is unavailable");const n=new Error(e+" at "+t._path.toString()+": "+r);return n.code=e.toUpperCase(),n}const QQ=new RegExp("^-?(0*)\\d{1,10}$"),XQ=-2147483648,JQ=2147483647,LS=function(e){if(QQ.test(e)){const t=Number(e);if(t>=XQ&&t<=JQ)return t}return null},dc=function(e){try{e()}catch(t){setTimeout(()=>{const r=t.stack||"";throw ni("Exception was thrown by user callback.",r),t},Math.floor(0))}},eX=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},jf=function(e,t){const r=setTimeout(e,t);return typeof r=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(r):typeof r=="object"&&r.unref&&r.unref(),r};/** * @license * Copyright 2021 Google LLC * @@ -1748,7 +1748,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class wX{constructor(t,r){this.appName_=t,this.appCheckProvider=r,this.appCheck=r==null?void 0:r.getImmediate({optional:!0}),this.appCheck||r==null||r.get().then(n=>this.appCheck=n)}getToken(t){return this.appCheck?this.appCheck.getToken(t):new Promise((r,n)=>{setTimeout(()=>{this.appCheck?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){var r;(r=this.appCheckProvider)===null||r===void 0||r.get().then(n=>n.addTokenListener(t))}notifyForInvalidToken(){ni(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}/** + */class tX{constructor(t,r){this.appName_=t,this.appCheckProvider=r,this.appCheck=r==null?void 0:r.getImmediate({optional:!0}),this.appCheck||r==null||r.get().then(n=>this.appCheck=n)}getToken(t){return this.appCheck?this.appCheck.getToken(t):new Promise((r,n)=>{setTimeout(()=>{this.appCheck?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){var r;(r=this.appCheckProvider)===null||r===void 0||r.get().then(n=>n.addTokenListener(t))}notifyForInvalidToken(){ni(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}/** * @license * Copyright 2017 Google LLC * @@ -1763,7 +1763,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class _X{constructor(t,r,n){this.appName_=t,this.firebaseOptions_=r,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(o=>this.auth_=o)}getToken(t){return this.auth_?this.auth_.getToken(t).catch(r=>r&&r.code==="auth/token-not-initialized"?(En("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(r)):new Promise((r,n)=>{setTimeout(()=>{this.auth_?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(r=>r.addAuthTokenListener(t))}removeTokenChangeListener(t){this.authProvider_.get().then(r=>r.removeAuthTokenListener(t))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',ni(t)}}class ku{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}ku.OWNER="owner";/** + */class rX{constructor(t,r,n){this.appName_=t,this.firebaseOptions_=r,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(o=>this.auth_=o)}getToken(t){return this.auth_?this.auth_.getToken(t).catch(r=>r&&r.code==="auth/token-not-initialized"?(En("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(r)):new Promise((r,n)=>{setTimeout(()=>{this.auth_?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(r=>r.addAuthTokenListener(t))}removeTokenChangeListener(t){this.authProvider_.get().then(r=>r.removeAuthTokenListener(t))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',ni(t)}}class ku{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}ku.OWNER="owner";/** * @license * Copyright 2017 Google LLC * @@ -1778,7 +1778,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const C5="5",rB="v",nB="s",iB="r",oB="f",aB=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,sB="ls",lB="p",N4="ac",uB="websocket",cB="long_polling";/** + */const C5="5",rB="v",nB="s",iB="r",oB="f",aB=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,sB="ls",lB="p",O4="ac",uB="websocket",cB="long_polling";/** * @license * Copyright 2017 Google LLC * @@ -1793,7 +1793,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class fB{constructor(t,r,n,o,i=!1,a="",s=!1,l=!1){this.secure=r,this.namespace=n,this.webSocketOnly=o,this.nodeAdmin=i,this.persistenceKey=a,this.includeNamespaceInQueryParams=s,this.isUsingEmulator=l,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Fs.get("host:"+t)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Fs.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",r=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${r}`}}function xX(e){return e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams}function dB(e,t,r){it(typeof t=="string","typeof type must == string"),it(typeof r=="object","typeof params must == object");let n;if(t===uB)n=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===cB)n=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+t);xX(e)&&(r.ns=e.namespace);const o=[];return ii(r,(i,a)=>{o.push(i+"="+a)}),n+o.join("&")}/** + */class fB{constructor(t,r,n,o,i=!1,a="",s=!1,l=!1){this.secure=r,this.namespace=n,this.webSocketOnly=o,this.nodeAdmin=i,this.persistenceKey=a,this.includeNamespaceInQueryParams=s,this.isUsingEmulator=l,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Fs.get("host:"+t)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Fs.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",r=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${r}`}}function nX(e){return e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams}function dB(e,t,r){it(typeof t=="string","typeof type must == string"),it(typeof r=="object","typeof params must == object");let n;if(t===uB)n=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===cB)n=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+t);nX(e)&&(r.ns=e.namespace);const o=[];return ii(r,(i,a)=>{o.push(i+"="+a)}),n+o.join("&")}/** * @license * Copyright 2017 Google LLC * @@ -1808,7 +1808,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class SX{constructor(){this.counters_={}}incrementCounter(t,r=1){pa(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=r}get(){return AY(this.counters_)}}/** + */class iX{constructor(){this.counters_={}}incrementCounter(t,r=1){pa(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=r}get(){return lY(this.counters_)}}/** * @license * Copyright 2017 Google LLC * @@ -1823,7 +1823,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const P2={},R2={};function E5(e){const t=e.toString();return P2[t]||(P2[t]=new SX),P2[t]}function CX(e,t){const r=e.toString();return R2[r]||(R2[r]=t()),R2[r]}/** + */const P2={},R2={};function E5(e){const t=e.toString();return P2[t]||(P2[t]=new iX),P2[t]}function oX(e,t){const r=e.toString();return R2[r]||(R2[r]=t()),R2[r]}/** * @license * Copyright 2017 Google LLC * @@ -1838,7 +1838,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class EX{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,r){this.closeAfterResponse=t,this.onClose=r,this.closeAfterResponse{this.onMessage_(n[o])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/** + */class aX{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,r){this.closeAfterResponse=t,this.onClose=r,this.closeAfterResponse{this.onMessage_(n[o])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/** * @license * Copyright 2017 Google LLC * @@ -1853,7 +1853,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const LS="start",kX="close",AX="pLPCommand",MX="pRTLPCB",hB="id",pB="pw",gB="ser",IX="cb",TX="seg",BX="ts",PX="d",RX="dframe",mB=1870,vB=30,OX=mB-vB,NX=25e3,LX=3e4;class hu{constructor(t,r,n,o,i,a,s){this.connId=t,this.repoInfo=r,this.applicationId=n,this.appCheckToken=o,this.authToken=i,this.transportSessionId=a,this.lastSessionId=s,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ih(t),this.stats_=E5(r),this.urlFn=l=>(this.appCheckToken&&(l[N4]=this.appCheckToken),dB(r,cB,l))}open(t,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new EX(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(LX)),fX(()=>{if(this.isClosed_)return;this.scriptTagHolder=new k5((...i)=>{const[a,s,l,u,c]=i;if(this.incrementIncomingBytes_(i),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,a===LS)this.id=s,this.password=l;else if(a===kX)s?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(s,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+a)},(...i)=>{const[a,s]=i;this.incrementIncomingBytes_(i),this.myPacketOrderer.handleResponse(a,s)},()=>{this.onClosed_()},this.urlFn);const n={};n[LS]="t",n[gB]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(n[IX]=this.scriptTagHolder.uniqueCallbackIdentifier),n[rB]=C5,this.transportSessionId&&(n[nB]=this.transportSessionId),this.lastSessionId&&(n[sB]=this.lastSessionId),this.applicationId&&(n[lB]=this.applicationId),this.appCheckToken&&(n[N4]=this.appCheckToken),typeof location<"u"&&location.hostname&&aB.test(location.hostname)&&(n[iB]=oB);const o=this.urlFn(n);this.log_("Connecting via long-poll to "+o),this.scriptTagHolder.addTag(o,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){hu.forceAllow_=!0}static forceDisallow(){hu.forceDisallow_=!0}static isAvailable(){return hu.forceAllow_?!0:!hu.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!hX()&&!pX()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const r=Yr(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=LT(r),o=eB(n,OX);for(let i=0;idocument.domain="'+document.domain+'";<\/script>');const a=""+i+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(s){En("frame writing exception"),s.stack&&En(s.stack),En(s)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",document.body){document.body.appendChild(t);try{t.contentWindow.document||En("No IE domain setting required")}catch{const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,r){for(this.myID=t,this.myPW=r,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t[hB]=this.myID,t[pB]=this.myPW,t[gB]=this.currentSerial;let r=this.urlFn(t),n="",o=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+vB+n.length<=mB;){const a=this.pendingSegs.shift();n=n+"&"+TX+o+"="+a.seg+"&"+BX+o+"="+a.ts+"&"+PX+o+"="+a.d,o++}return r=r+n,this.addLongPollTag_(r,this.currentSerial),!0}else return!1}enqueueSegment(t,r,n){this.pendingSegs.push({seg:t,ts:r,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,r){this.outstandingRequests.add(r);const n=()=>{this.outstandingRequests.delete(r),this.newRequest_()},o=setTimeout(n,Math.floor(NX)),i=()=>{clearTimeout(o),n()};this.addTag(t,i)}addTag(t,r){setTimeout(()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const o=n.readyState;(!o||o==="loaded"||o==="complete")&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),r())},n.onerror=()=>{En("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch{}},Math.floor(1))}}/** + */const DS="start",sX="close",lX="pLPCommand",uX="pRTLPCB",hB="id",pB="pw",gB="ser",cX="cb",fX="seg",dX="ts",hX="d",pX="dframe",mB=1870,vB=30,gX=mB-vB,mX=25e3,vX=3e4;class hu{constructor(t,r,n,o,i,a,s){this.connId=t,this.repoInfo=r,this.applicationId=n,this.appCheckToken=o,this.authToken=i,this.transportSessionId=a,this.lastSessionId=s,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ih(t),this.stats_=E5(r),this.urlFn=l=>(this.appCheckToken&&(l[O4]=this.appCheckToken),dB(r,cB,l))}open(t,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new aX(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(vX)),HQ(()=>{if(this.isClosed_)return;this.scriptTagHolder=new k5((...i)=>{const[a,s,l,u,c]=i;if(this.incrementIncomingBytes_(i),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,a===DS)this.id=s,this.password=l;else if(a===sX)s?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(s,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+a)},(...i)=>{const[a,s]=i;this.incrementIncomingBytes_(i),this.myPacketOrderer.handleResponse(a,s)},()=>{this.onClosed_()},this.urlFn);const n={};n[DS]="t",n[gB]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(n[cX]=this.scriptTagHolder.uniqueCallbackIdentifier),n[rB]=C5,this.transportSessionId&&(n[nB]=this.transportSessionId),this.lastSessionId&&(n[sB]=this.lastSessionId),this.applicationId&&(n[lB]=this.applicationId),this.appCheckToken&&(n[O4]=this.appCheckToken),typeof location<"u"&&location.hostname&&aB.test(location.hostname)&&(n[iB]=oB);const o=this.urlFn(n);this.log_("Connecting via long-poll to "+o),this.scriptTagHolder.addTag(o,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){hu.forceAllow_=!0}static forceDisallow(){hu.forceDisallow_=!0}static isAvailable(){return hu.forceAllow_?!0:!hu.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!ZQ()&&!GQ()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const r=Yr(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=LT(r),o=eB(n,gX);for(let i=0;idocument.domain="'+document.domain+'";<\/script>');const a=""+i+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(s){En("frame writing exception"),s.stack&&En(s.stack),En(s)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",document.body){document.body.appendChild(t);try{t.contentWindow.document||En("No IE domain setting required")}catch{const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,r){for(this.myID=t,this.myPW=r,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t[hB]=this.myID,t[pB]=this.myPW,t[gB]=this.currentSerial;let r=this.urlFn(t),n="",o=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+vB+n.length<=mB;){const a=this.pendingSegs.shift();n=n+"&"+fX+o+"="+a.seg+"&"+dX+o+"="+a.ts+"&"+hX+o+"="+a.d,o++}return r=r+n,this.addLongPollTag_(r,this.currentSerial),!0}else return!1}enqueueSegment(t,r,n){this.pendingSegs.push({seg:t,ts:r,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,r){this.outstandingRequests.add(r);const n=()=>{this.outstandingRequests.delete(r),this.newRequest_()},o=setTimeout(n,Math.floor(mX)),i=()=>{clearTimeout(o),n()};this.addTag(t,i)}addTag(t,r){setTimeout(()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const o=n.readyState;(!o||o==="loaded"||o==="complete")&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),r())},n.onerror=()=>{En("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch{}},Math.floor(1))}}/** * @license * Copyright 2017 Google LLC * @@ -1868,7 +1868,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const DX=16384,UX=45e3;let Up=null;typeof MozWebSocket<"u"?Up=MozWebSocket:typeof WebSocket<"u"&&(Up=WebSocket);class zi{constructor(t,r,n,o,i,a,s){this.connId=t,this.applicationId=n,this.appCheckToken=o,this.authToken=i,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ih(this.connId),this.stats_=E5(r),this.connURL=zi.connectionURL_(r,a,s,o,n),this.nodeAdmin=r.nodeAdmin}static connectionURL_(t,r,n,o,i){const a={};return a[rB]=C5,typeof location<"u"&&location.hostname&&aB.test(location.hostname)&&(a[iB]=oB),r&&(a[nB]=r),n&&(a[sB]=n),o&&(a[N4]=o),i&&(a[lB]=i),dB(t,uB,a)}open(t,r){this.onDisconnect=r,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Fs.set("previous_websocket_failure",!0);try{let n;zT(),this.mySock=new Up(this.connURL,[],n)}catch(n){this.log_("Error instantiating WebSocket.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=n=>{this.handleIncomingFrame(n)},this.mySock.onerror=n=>{this.log_("WebSocket error. Closing connection.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){zi.forceDisallow_=!0}static isAvailable(){let t=!1;if(typeof navigator<"u"&&navigator.userAgent){const r=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(r);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&Up!==null&&!zi.forceDisallow_}static previouslyFailed(){return Fs.isInMemoryStorage||Fs.get("previous_websocket_failure")===!0}markConnectionHealthy(){Fs.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const r=this.frames.join("");this.frames=null;const n=_d(r);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(it(this.frames===null,"We already have a frame buffer"),t.length<=6){const r=Number(t);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(this.mySock===null)return;const r=t.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{const n=this.extractFrameCount_(r);n!==null&&this.appendFrame_(n)}}send(t){this.resetKeepAlive();const r=Yr(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=eB(r,DX);n.length>1&&this.sendString_(String(n.length));for(let o=0;o{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(UX))}sendString_(t){try{this.mySock.send(t)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}zi.responsesRequiredToBeHealthy=2;zi.healthyTimeout=3e4;/** + */const yX=16384,bX=45e3;let Up=null;typeof MozWebSocket<"u"?Up=MozWebSocket:typeof WebSocket<"u"&&(Up=WebSocket);class zi{constructor(t,r,n,o,i,a,s){this.connId=t,this.applicationId=n,this.appCheckToken=o,this.authToken=i,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ih(this.connId),this.stats_=E5(r),this.connURL=zi.connectionURL_(r,a,s,o,n),this.nodeAdmin=r.nodeAdmin}static connectionURL_(t,r,n,o,i){const a={};return a[rB]=C5,typeof location<"u"&&location.hostname&&aB.test(location.hostname)&&(a[iB]=oB),r&&(a[nB]=r),n&&(a[sB]=n),o&&(a[O4]=o),i&&(a[lB]=i),dB(t,uB,a)}open(t,r){this.onDisconnect=r,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Fs.set("previous_websocket_failure",!0);try{let n;zT(),this.mySock=new Up(this.connURL,[],n)}catch(n){this.log_("Error instantiating WebSocket.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=n=>{this.handleIncomingFrame(n)},this.mySock.onerror=n=>{this.log_("WebSocket error. Closing connection.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){zi.forceDisallow_=!0}static isAvailable(){let t=!1;if(typeof navigator<"u"&&navigator.userAgent){const r=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(r);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&Up!==null&&!zi.forceDisallow_}static previouslyFailed(){return Fs.isInMemoryStorage||Fs.get("previous_websocket_failure")===!0}markConnectionHealthy(){Fs.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const r=this.frames.join("");this.frames=null;const n=_d(r);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(it(this.frames===null,"We already have a frame buffer"),t.length<=6){const r=Number(t);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(this.mySock===null)return;const r=t.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{const n=this.extractFrameCount_(r);n!==null&&this.appendFrame_(n)}}send(t){this.resetKeepAlive();const r=Yr(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=eB(r,yX);n.length>1&&this.sendString_(String(n.length));for(let o=0;o{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(bX))}sendString_(t){try{this.mySock.send(t)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}zi.responsesRequiredToBeHealthy=2;zi.healthyTimeout=3e4;/** * @license * Copyright 2017 Google LLC * @@ -1898,7 +1898,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const jX=6e4,FX=5e3,zX=10*1024,$X=100*1024,O2="t",DS="d",qX="s",US="r",WX="e",jS="o",FS="a",zS="n",$S="p",VX="h";class HX{constructor(t,r,n,o,i,a,s,l,u,c){this.id=t,this.repoInfo_=r,this.applicationId_=n,this.appCheckToken_=o,this.authToken_=i,this.onMessage_=a,this.onReady_=s,this.onDisconnect_=l,this.onKill_=u,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ih("c:"+this.id+":"),this.transportManager_=new Cd(r),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const r=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(r,n)},Math.floor(0));const o=t.healthyTimeout||0;o>0&&(this.healthyTimeout_=jf(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>$X?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>zX?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(o)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return r=>{t===this.conn_?this.onConnectionLost_(r):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return r=>{this.state_!==2&&(t===this.rx_?this.onPrimaryMessageReceived_(r):t===this.secondaryConn_?this.onSecondaryMessageReceived_(r):this.log_("message on old connection"))}}sendRequest(t){const r={t:"d",d:t};this.sendData_(r)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if(O2 in t){const r=t[O2];r===FS?this.upgradeIfSecondaryHealthy_():r===US?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===jS&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const r=Oc("t",t),n=Oc("d",t);if(r==="c")this.onSecondaryControl_(n);else if(r==="d")this.pendingDataMessages.push(n);else throw new Error("Unknown protocol layer: "+r)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:$S,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:FS,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:zS,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const r=Oc("t",t),n=Oc("d",t);r==="c"?this.onControl_(n):r==="d"&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const r=Oc(O2,t);if(DS in t){const n=t[DS];if(r===VX){const o=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(o.h=this.repoInfo_.host),this.onHandshake_(o)}else if(r===zS){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let o=0;o{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(jX))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,r){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(r,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):jf(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(FX))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:$S,d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===t||this.rx_===t)&&this.close()}onConnectionLost_(t){this.conn_=null,!t&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Fs.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(t)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/** + */const wX=6e4,_X=5e3,xX=10*1024,SX=100*1024,O2="t",US="d",CX="s",jS="r",EX="e",FS="o",zS="a",$S="n",qS="p",kX="h";class AX{constructor(t,r,n,o,i,a,s,l,u,c){this.id=t,this.repoInfo_=r,this.applicationId_=n,this.appCheckToken_=o,this.authToken_=i,this.onMessage_=a,this.onReady_=s,this.onDisconnect_=l,this.onKill_=u,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ih("c:"+this.id+":"),this.transportManager_=new Cd(r),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const r=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(r,n)},Math.floor(0));const o=t.healthyTimeout||0;o>0&&(this.healthyTimeout_=jf(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>SX?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>xX?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(o)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return r=>{t===this.conn_?this.onConnectionLost_(r):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return r=>{this.state_!==2&&(t===this.rx_?this.onPrimaryMessageReceived_(r):t===this.secondaryConn_?this.onSecondaryMessageReceived_(r):this.log_("message on old connection"))}}sendRequest(t){const r={t:"d",d:t};this.sendData_(r)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if(O2 in t){const r=t[O2];r===zS?this.upgradeIfSecondaryHealthy_():r===jS?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===FS&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const r=Oc("t",t),n=Oc("d",t);if(r==="c")this.onSecondaryControl_(n);else if(r==="d")this.pendingDataMessages.push(n);else throw new Error("Unknown protocol layer: "+r)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:qS,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:zS,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:$S,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const r=Oc("t",t),n=Oc("d",t);r==="c"?this.onControl_(n):r==="d"&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const r=Oc(O2,t);if(US in t){const n=t[US];if(r===kX){const o=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(o.h=this.repoInfo_.host),this.onHandshake_(o)}else if(r===$S){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let o=0;o{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(wX))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,r){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(r,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):jf(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(_X))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:qS,d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===t||this.rx_===t)&&this.close()}onConnectionLost_(t){this.conn_=null,!t&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Fs.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(t)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/** * @license * Copyright 2017 Google LLC * @@ -1958,7 +1958,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const qS=32,WS=768;class mr{constructor(t,r){if(r===void 0){this.pieces_=t.split("/");let n=0;for(let o=0;o0&&(this.pieces_[n]=this.pieces_[o],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=r}toString(){let t="";for(let r=this.pieceNum_;r=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function is(e){return e.pieces_.length-e.pieceNum_}function br(e){let t=e.pieceNum_;return t=e.pieces_.length)return null;const t=[];for(let r=e.pieceNum_;r0&&r.push(n[o])}return new mr(r,0)}function Qt(e){return e.pieceNum_>=e.pieces_.length}function jn(e,t){const r=Xt(e),n=Xt(t);if(r===null)return t;if(r===n)return jn(br(e),br(t));throw new Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function SB(e,t){if(is(e)!==is(t))return!1;for(let r=e.pieceNum_,n=t.pieceNum_;r<=e.pieces_.length;r++,n++)if(e.pieces_[r]!==t.pieces_[n])return!1;return!0}function Vi(e,t){let r=e.pieceNum_,n=t.pieceNum_;if(is(e)>is(t))return!1;for(;r0&&(e.byteLength_+=1),e.parts_.push(t),e.byteLength_+=ag(t),CB(e)}function YX(e){const t=e.parts_.pop();e.byteLength_-=ag(t),e.parts_.length>0&&(e.byteLength_-=1)}function CB(e){if(e.byteLength_>WS)throw new Error(e.errorPrefix_+"has a key path longer than "+WS+" bytes ("+e.byteLength_+").");if(e.parts_.length>qS)throw new Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+qS+") or object contains a cycle "+Is(e))}function Is(e){return e.parts_.length===0?"":"in property '"+e.parts_.join(".")+"'"}/** + */const WS=32,VS=768;class mr{constructor(t,r){if(r===void 0){this.pieces_=t.split("/");let n=0;for(let o=0;o0&&(this.pieces_[n]=this.pieces_[o],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=r}toString(){let t="";for(let r=this.pieceNum_;r=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function is(e){return e.pieces_.length-e.pieceNum_}function br(e){let t=e.pieceNum_;return t=e.pieces_.length)return null;const t=[];for(let r=e.pieceNum_;r0&&r.push(n[o])}return new mr(r,0)}function Qt(e){return e.pieceNum_>=e.pieces_.length}function jn(e,t){const r=Xt(e),n=Xt(t);if(r===null)return t;if(r===n)return jn(br(e),br(t));throw new Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function SB(e,t){if(is(e)!==is(t))return!1;for(let r=e.pieceNum_,n=t.pieceNum_;r<=e.pieces_.length;r++,n++)if(e.pieces_[r]!==t.pieces_[n])return!1;return!0}function Vi(e,t){let r=e.pieceNum_,n=t.pieceNum_;if(is(e)>is(t))return!1;for(;r0&&(e.byteLength_+=1),e.parts_.push(t),e.byteLength_+=ag(t),CB(e)}function BX(e){const t=e.parts_.pop();e.byteLength_-=ag(t),e.parts_.length>0&&(e.byteLength_-=1)}function CB(e){if(e.byteLength_>VS)throw new Error(e.errorPrefix_+"has a key path longer than "+VS+" bytes ("+e.byteLength_+").");if(e.parts_.length>WS)throw new Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+WS+") or object contains a cycle "+Is(e))}function Is(e){return e.parts_.length===0?"":"in property '"+e.parts_.join(".")+"'"}/** * @license * Copyright 2017 Google LLC * @@ -1988,10 +1988,10 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const Nc=1e3,QX=60*5*1e3,VS=30*1e3,XX=1.3,JX=3e4,eJ="server_kill",HS=3;class Yo extends yB{constructor(t,r,n,o,i,a,s,l){if(super(),this.repoInfo_=t,this.applicationId_=r,this.onDataUpdate_=n,this.onConnectStatus_=o,this.onServerInfoUpdate_=i,this.authTokenProvider_=a,this.appCheckTokenProvider_=s,this.authOverride_=l,this.id=Yo.nextPersistentConnectionId_++,this.log_=ih("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Nc,this.maxReconnectDelay_=QX,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!zT())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");A5.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")===-1&&jp.getInstance().on("online",this.onOnline_,this)}sendRequest(t,r,n){const o=++this.requestNumber_,i={r:o,a:t,b:r};this.log_(Yr(i)),it(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[o]=n)}get(t){this.initConnection_();const r=new og,o={action:"g",request:{p:t._path.toString(),q:t._queryObject},onComplete:a=>{const s=a.d;a.s==="ok"?r.resolve(s):r.reject(s)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;const i=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(i),r.promise}listen(t,r,n,o){this.initConnection_();const i=t._queryIdentifier,a=t._path.toString();this.log_("Listen called for "+a+" "+i),this.listens.has(a)||this.listens.set(a,new Map),it(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),it(!this.listens.get(a).has(i),"listen() called twice for same path/queryId.");const s={onComplete:o,hashFn:r,query:t,tag:n};this.listens.get(a).set(i,s),this.connected_&&this.sendListen_(s)}sendGet_(t){const r=this.outstandingGets_[t];this.sendRequest("g",r.request,n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(n)})}sendListen_(t){const r=t.query,n=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+n+" for "+o);const i={p:n},a="q";t.tag&&(i.q=r._queryObject,i.t=t.tag),i.h=t.hashFn(),this.sendRequest(a,i,s=>{const l=s.d,u=s.s;Yo.warnOnListenWarnings_(l,r),(this.listens.get(n)&&this.listens.get(n).get(o))===t&&(this.log_("listen response",s),u!=="ok"&&this.removeListen_(n,o),t.onComplete&&t.onComplete(u,l))})}static warnOnListenWarnings_(t,r){if(t&&typeof t=="object"&&pa(t,"w")){const n=qu(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',i=r._path.toString();ni(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${i} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&t.length===40||WY(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=VS)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,r=qY(t)?"auth":"gauth",n={cred:t};this.authOverride_===null?n.noauth=!0:typeof this.authOverride_=="object"&&(n.authvar=this.authOverride_),this.sendRequest(r,n,o=>{const i=o.s,a=o.d||"error";this.authToken_===t&&(i==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(i,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},t=>{const r=t.s,n=t.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,n)})}unlisten(t,r){const n=t._path.toString(),o=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+o),it(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,o)&&this.connected_&&this.sendUnlisten_(n,o,t._queryObject,r)}sendUnlisten_(t,r,n,o){this.log_("Unlisten on "+t+" for "+r);const i={p:t},a="n";o&&(i.q=n,i.t=o),this.sendRequest(a,i)}onDisconnectPut(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:r,onComplete:n})}onDisconnectMerge(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:r,onComplete:n})}onDisconnectCancel(t,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,r):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(t,r,n,o){const i={p:r,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(t,r,n,o){this.putInternal("p",t,r,n,o)}merge(t,r,n,o){this.putInternal("m",t,r,n,o)}putInternal(t,r,n,o,i){this.initConnection_();const a={p:r,d:n};i!==void 0&&(a.h=i),this.outstandingPuts_.push({action:t,request:a,onComplete:o}),this.outstandingPutCount_++;const s=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(s):this.log_("Buffering put: "+r)}sendPut_(t){const r=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,o=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(r,n,i=>{this.log_(r+" response",i),delete this.outstandingPuts_[t],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(i.s,i.d)})}reportStats(t){if(this.connected_){const r={c:t};this.log_("reportStats",r),this.sendRequest("s",r,n=>{if(n.s!=="ok"){const i=n.d;this.log_("reportStats","Error sending stats: "+i)}})}}onDataMessage_(t){if("r"in t){this.log_("from server: "+Yr(t));const r=t.r,n=this.requestCBHash_[r];n&&(delete this.requestCBHash_[r],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,r){this.log_("handleServerMessage",t,r),t==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):t==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):t==="c"?this.onListenRevoked_(r.p,r.q):t==="ac"?this.onAuthRevoked_(r.s,r.d):t==="apc"?this.onAppCheckRevoked_(r.s,r.d):t==="sd"?this.onSecurityDebugPacket_(r):O4("Unrecognized action received from server: "+Yr(t)+` -Are you using the latest client?`)}onReady_(t,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(t),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){it(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>JX&&(this.reconnectDelay_=Nc),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const t=new Date().getTime()-this.lastConnectionAttemptTime_;let r=Math.max(0,this.reconnectDelay_-t);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*XX)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+Yo.nextConnectionId_++,i=this.lastSessionId;let a=!1,s=null;const l=function(){s?s.close():(a=!0,n())},u=function(h){it(s,"sendRequest call when we're not connected not allowed."),s.sendRequest(h)};this.realtime_={close:l,sendRequest:u};const c=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[h,d]=await Promise.all([this.authTokenProvider_.getToken(c),this.appCheckTokenProvider_.getToken(c)]);a?En("getToken() completed but was canceled"):(En("getToken() completed. Creating connection."),this.authToken_=h&&h.accessToken,this.appCheckToken_=d&&d.token,s=new HX(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,r,n,p=>{ni(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(eJ)},i))}catch(h){this.log_("Failed to get token: "+h),a||(this.repoInfo_.nodeAdmin&&ni(h),l())}}}interrupt(t){En("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){En("Resuming connection for reason: "+t),delete this.interruptReasons_[t],xS(this.interruptReasons_)&&(this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const r=t-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let t=0;tS5(i)).join("$"):n="default";const o=this.removeListen_(t,n);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(t,r){const n=new mr(t).toString();let o;if(this.listens.has(n)){const i=this.listens.get(n);o=i.get(r),i.delete(r),i.size===0&&this.listens.delete(n)}else o=void 0;return o}onAuthRevoked_(t,r){En("Auth token revoked: "+t+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(t==="invalid_token"||t==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=HS&&(this.reconnectDelay_=VS,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,r){En("App check token revoked: "+t+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(t==="invalid_token"||t==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=HS&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace(` + */const Nc=1e3,PX=60*5*1e3,HS=30*1e3,RX=1.3,OX=3e4,NX="server_kill",KS=3;class Yo extends yB{constructor(t,r,n,o,i,a,s,l){if(super(),this.repoInfo_=t,this.applicationId_=r,this.onDataUpdate_=n,this.onConnectStatus_=o,this.onServerInfoUpdate_=i,this.authTokenProvider_=a,this.appCheckTokenProvider_=s,this.authOverride_=l,this.id=Yo.nextPersistentConnectionId_++,this.log_=ih("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Nc,this.maxReconnectDelay_=PX,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!zT())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");A5.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")===-1&&jp.getInstance().on("online",this.onOnline_,this)}sendRequest(t,r,n){const o=++this.requestNumber_,i={r:o,a:t,b:r};this.log_(Yr(i)),it(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[o]=n)}get(t){this.initConnection_();const r=new og,o={action:"g",request:{p:t._path.toString(),q:t._queryObject},onComplete:a=>{const s=a.d;a.s==="ok"?r.resolve(s):r.reject(s)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;const i=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(i),r.promise}listen(t,r,n,o){this.initConnection_();const i=t._queryIdentifier,a=t._path.toString();this.log_("Listen called for "+a+" "+i),this.listens.has(a)||this.listens.set(a,new Map),it(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),it(!this.listens.get(a).has(i),"listen() called twice for same path/queryId.");const s={onComplete:o,hashFn:r,query:t,tag:n};this.listens.get(a).set(i,s),this.connected_&&this.sendListen_(s)}sendGet_(t){const r=this.outstandingGets_[t];this.sendRequest("g",r.request,n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(n)})}sendListen_(t){const r=t.query,n=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+n+" for "+o);const i={p:n},a="q";t.tag&&(i.q=r._queryObject,i.t=t.tag),i.h=t.hashFn(),this.sendRequest(a,i,s=>{const l=s.d,u=s.s;Yo.warnOnListenWarnings_(l,r),(this.listens.get(n)&&this.listens.get(n).get(o))===t&&(this.log_("listen response",s),u!=="ok"&&this.removeListen_(n,o),t.onComplete&&t.onComplete(u,l))})}static warnOnListenWarnings_(t,r){if(t&&typeof t=="object"&&pa(t,"w")){const n=qu(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',i=r._path.toString();ni(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${i} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&t.length===40||EY(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=HS)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,r=CY(t)?"auth":"gauth",n={cred:t};this.authOverride_===null?n.noauth=!0:typeof this.authOverride_=="object"&&(n.authvar=this.authOverride_),this.sendRequest(r,n,o=>{const i=o.s,a=o.d||"error";this.authToken_===t&&(i==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(i,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},t=>{const r=t.s,n=t.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,n)})}unlisten(t,r){const n=t._path.toString(),o=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+o),it(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,o)&&this.connected_&&this.sendUnlisten_(n,o,t._queryObject,r)}sendUnlisten_(t,r,n,o){this.log_("Unlisten on "+t+" for "+r);const i={p:t},a="n";o&&(i.q=n,i.t=o),this.sendRequest(a,i)}onDisconnectPut(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:r,onComplete:n})}onDisconnectMerge(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:r,onComplete:n})}onDisconnectCancel(t,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,r):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(t,r,n,o){const i={p:r,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(t,r,n,o){this.putInternal("p",t,r,n,o)}merge(t,r,n,o){this.putInternal("m",t,r,n,o)}putInternal(t,r,n,o,i){this.initConnection_();const a={p:r,d:n};i!==void 0&&(a.h=i),this.outstandingPuts_.push({action:t,request:a,onComplete:o}),this.outstandingPutCount_++;const s=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(s):this.log_("Buffering put: "+r)}sendPut_(t){const r=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,o=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(r,n,i=>{this.log_(r+" response",i),delete this.outstandingPuts_[t],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(i.s,i.d)})}reportStats(t){if(this.connected_){const r={c:t};this.log_("reportStats",r),this.sendRequest("s",r,n=>{if(n.s!=="ok"){const i=n.d;this.log_("reportStats","Error sending stats: "+i)}})}}onDataMessage_(t){if("r"in t){this.log_("from server: "+Yr(t));const r=t.r,n=this.requestCBHash_[r];n&&(delete this.requestCBHash_[r],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,r){this.log_("handleServerMessage",t,r),t==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):t==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):t==="c"?this.onListenRevoked_(r.p,r.q):t==="ac"?this.onAuthRevoked_(r.s,r.d):t==="apc"?this.onAppCheckRevoked_(r.s,r.d):t==="sd"?this.onSecurityDebugPacket_(r):R4("Unrecognized action received from server: "+Yr(t)+` +Are you using the latest client?`)}onReady_(t,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(t),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){it(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>OX&&(this.reconnectDelay_=Nc),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const t=new Date().getTime()-this.lastConnectionAttemptTime_;let r=Math.max(0,this.reconnectDelay_-t);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*RX)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+Yo.nextConnectionId_++,i=this.lastSessionId;let a=!1,s=null;const l=function(){s?s.close():(a=!0,n())},u=function(h){it(s,"sendRequest call when we're not connected not allowed."),s.sendRequest(h)};this.realtime_={close:l,sendRequest:u};const c=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[h,d]=await Promise.all([this.authTokenProvider_.getToken(c),this.appCheckTokenProvider_.getToken(c)]);a?En("getToken() completed but was canceled"):(En("getToken() completed. Creating connection."),this.authToken_=h&&h.accessToken,this.appCheckToken_=d&&d.token,s=new AX(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,r,n,p=>{ni(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(NX)},i))}catch(h){this.log_("Failed to get token: "+h),a||(this.repoInfo_.nodeAdmin&&ni(h),l())}}}interrupt(t){En("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){En("Resuming connection for reason: "+t),delete this.interruptReasons_[t],SS(this.interruptReasons_)&&(this.reconnectDelay_=Nc,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const r=t-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let t=0;tS5(i)).join("$"):n="default";const o=this.removeListen_(t,n);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(t,r){const n=new mr(t).toString();let o;if(this.listens.has(n)){const i=this.listens.get(n);o=i.get(r),i.delete(r),i.size===0&&this.listens.delete(n)}else o=void 0;return o}onAuthRevoked_(t,r){En("Auth token revoked: "+t+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(t==="invalid_token"||t==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=KS&&(this.reconnectDelay_=HS,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,r){En("App check token revoked: "+t+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(t==="invalid_token"||t==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=KS&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace(` `,` -FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const r of t.values())this.sendListen_(r);for(let t=0;t0}peek(){if(this.nodeStack_.length===0)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class on{constructor(t,r,n,o,i){this.key=t,this.value=r,this.color=n??on.RED,this.left=o??Jn.EMPTY_NODE,this.right=i??Jn.EMPTY_NODE}copy(t,r,n,o,i){return new on(t??this.key,r??this.value,n??this.color,o??this.left,i??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,r,n){let o=this;const i=n(t,o.key);return i<0?o=o.copy(null,null,null,o.left.insert(t,r,n),null):i===0?o=o.copy(null,r,null,null,null):o=o.copy(null,null,null,null,o.right.insert(t,r,n)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return Jn.EMPTY_NODE;let t=this;return!t.left.isRed_()&&!t.left.left.isRed_()&&(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,r){let n,o;if(n=this,r(t,n.key)<0)!n.left.isEmpty()&&!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,r),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),!n.right.isEmpty()&&!n.right.isRed_()&&!n.right.left.isRed_()&&(n=n.moveRedRight_()),r(t,n.key)===0){if(n.right.isEmpty())return Jn.EMPTY_NODE;o=n.right.min_(),n=n.copy(o.key,o.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,r))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,on.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,on.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,r)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}on.RED=!0;on.BLACK=!1;class tJ{copy(t,r,n,o,i){return this}insert(t,r,n){return new on(t,r,null)}remove(t,r){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Jn{constructor(t,r=Jn.EMPTY_NODE){this.comparator_=t,this.root_=r}insert(t,r){return new Jn(this.comparator_,this.root_.insert(t,r,this.comparator_).copy(null,null,on.BLACK,null,null))}remove(t){return new Jn(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,on.BLACK,null,null))}get(t){let r,n=this.root_;for(;!n.isEmpty();){if(r=this.comparator_(t,n.key),r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}getPredecessorKey(t){let r,n=this.root_,o=null;for(;!n.isEmpty();)if(r=this.comparator_(t,n.key),r===0){if(n.left.isEmpty())return o?o.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}else r<0?n=n.left:r>0&&(o=n,n=n.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new e0(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!1,r)}getReverseIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!0,r)}getReverseIterator(t){return new e0(this.root_,null,this.comparator_,!0,t)}}Jn.EMPTY_NODE=new tJ;/** + */class e0{constructor(t,r,n,o,i=null){this.isReverse_=o,this.resultGenerator_=i,this.nodeStack_=[];let a=1;for(;!t.isEmpty();)if(t=t,a=r?n(t.key,r):1,o&&(a*=-1),a<0)this.isReverse_?t=t.left:t=t.right;else if(a===0){this.nodeStack_.push(t);break}else this.nodeStack_.push(t),this.isReverse_?t=t.right:t=t.left}getNext(){if(this.nodeStack_.length===0)return null;let t=this.nodeStack_.pop(),r;if(this.resultGenerator_?r=this.resultGenerator_(t.key,t.value):r={key:t.key,value:t.value},this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return r}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class on{constructor(t,r,n,o,i){this.key=t,this.value=r,this.color=n??on.RED,this.left=o??Jn.EMPTY_NODE,this.right=i??Jn.EMPTY_NODE}copy(t,r,n,o,i){return new on(t??this.key,r??this.value,n??this.color,o??this.left,i??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,r,n){let o=this;const i=n(t,o.key);return i<0?o=o.copy(null,null,null,o.left.insert(t,r,n),null):i===0?o=o.copy(null,r,null,null,null):o=o.copy(null,null,null,null,o.right.insert(t,r,n)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return Jn.EMPTY_NODE;let t=this;return!t.left.isRed_()&&!t.left.left.isRed_()&&(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,r){let n,o;if(n=this,r(t,n.key)<0)!n.left.isEmpty()&&!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,r),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),!n.right.isEmpty()&&!n.right.isRed_()&&!n.right.left.isRed_()&&(n=n.moveRedRight_()),r(t,n.key)===0){if(n.right.isEmpty())return Jn.EMPTY_NODE;o=n.right.min_(),n=n.copy(o.key,o.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,r))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,on.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,on.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,r)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}on.RED=!0;on.BLACK=!1;class LX{copy(t,r,n,o,i){return this}insert(t,r,n){return new on(t,r,null)}remove(t,r){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Jn{constructor(t,r=Jn.EMPTY_NODE){this.comparator_=t,this.root_=r}insert(t,r){return new Jn(this.comparator_,this.root_.insert(t,r,this.comparator_).copy(null,null,on.BLACK,null,null))}remove(t){return new Jn(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,on.BLACK,null,null))}get(t){let r,n=this.root_;for(;!n.isEmpty();){if(r=this.comparator_(t,n.key),r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}getPredecessorKey(t){let r,n=this.root_,o=null;for(;!n.isEmpty();)if(r=this.comparator_(t,n.key),r===0){if(n.left.isEmpty())return o?o.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}else r<0?n=n.left:r>0&&(o=n,n=n.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new e0(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!1,r)}getReverseIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!0,r)}getReverseIterator(t){return new e0(this.root_,null,this.comparator_,!0,t)}}Jn.EMPTY_NODE=new LX;/** * @license * Copyright 2017 Google LLC * @@ -2066,7 +2066,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function rJ(e,t){return fc(e.name,t.name)}function M5(e,t){return fc(e,t)}/** + */function DX(e,t){return fc(e.name,t.name)}function M5(e,t){return fc(e,t)}/** * @license * Copyright 2017 Google LLC * @@ -2081,7 +2081,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let L4;function nJ(e){L4=e}const kB=function(e){return typeof e=="number"?"number:"+tB(e):"string:"+e},AB=function(e){if(e.isLeafNode()){const t=e.val();it(typeof t=="string"||typeof t=="number"||typeof t=="object"&&pa(t,".sv"),"Priority must be a string or number.")}else it(e===L4||e.isEmpty(),"priority of unexpected type.");it(e===L4||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/** + */let N4;function UX(e){N4=e}const kB=function(e){return typeof e=="number"?"number:"+tB(e):"string:"+e},AB=function(e){if(e.isLeafNode()){const t=e.val();it(typeof t=="string"||typeof t=="number"||typeof t=="object"&&pa(t,".sv"),"Priority must be a string or number.")}else it(e===N4||e.isEmpty(),"priority of unexpected type.");it(e===N4||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/** * @license * Copyright 2017 Google LLC * @@ -2096,7 +2096,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let KS;class tn{constructor(t,r=tn.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=r,this.lazyHash_=null,it(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),AB(this.priorityNode_)}static set __childrenNodeConstructor(t){KS=t}static get __childrenNodeConstructor(){return KS}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new tn(this.value_,t)}getImmediateChild(t){return t===".priority"?this.priorityNode_:tn.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return Qt(t)?this:Xt(t)===".priority"?this.priorityNode_:tn.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,r){return null}updateImmediateChild(t,r){return t===".priority"?this.updatePriority(r):r.isEmpty()&&t!==".priority"?this:tn.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,r).updatePriority(this.priorityNode_)}updateChild(t,r){const n=Xt(t);return n===null?r:r.isEmpty()&&n!==".priority"?this:(it(n!==".priority"||is(t)===1,".priority must be the last token in a path"),this.updateImmediateChild(n,tn.__childrenNodeConstructor.EMPTY_NODE.updateChild(br(t),r)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,r){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+kB(this.priorityNode_.val())+":");const r=typeof this.value_;t+=r+":",r==="number"?t+=tB(this.value_):t+=this.value_,this.lazyHash_=XT(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===tn.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof tn.__childrenNodeConstructor?-1:(it(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const r=typeof t.value_,n=typeof this.value_,o=tn.VALUE_TYPE_ORDER.indexOf(r),i=tn.VALUE_TYPE_ORDER.indexOf(n);return it(o>=0,"Unknown leaf type: "+r),it(i>=0,"Unknown leaf type: "+n),o===i?n==="object"?0:this.value_=0,"Unknown leaf type: "+r),it(i>=0,"Unknown leaf type: "+n),o===i?n==="object"?0:this.value_parseInt(Math.log(i)/sJ,10),n=i=>parseInt(Array(i+1).join("1"),2);this.count=r(t+1),this.current_=this.count-1;const o=n(this.count);this.bits_=t+1&o}nextBitIsOne(){const t=!(this.bits_&1<parseInt(Math.log(i)/$X,10),n=i=>parseInt(Array(i+1).join("1"),2);this.count=r(t+1),this.current_=this.count-1;const o=n(this.count);this.bits_=t+1&o}nextBitIsOne(){const t=!(this.bits_&1<{r[a]=s.val(t),n++,i&&Ot.INTEGER_REGEXP_.test(a)?o=Math.max(o,Number(a)):i=!1}),!t&&i&&o<2*n){const a=[];for(const s in r)a[s]=r[s];return a}else return t&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let t="";this.getPriority().isEmpty()||(t+="priority:"+kB(this.getPriority().val())+":"),this.forEachChild(Ur,(r,n)=>{const o=n.hash();o!==""&&(t+=":"+r+":"+o)}),this.lazyHash_=t===""?"":XT(t)}return this.lazyHash_}getPredecessorChildName(t,r,n){const o=this.resolveIndex_(n);if(o){const i=o.getPredecessorKey(new Gt(t,r));return i?i.name:null}else return this.children_.getPredecessorKey(t)}getFirstChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.minKey();return n&&n.name}else return this.children_.minKey()}getFirstChild(t){const r=this.getFirstChildName(t);return r?new Gt(r,this.children_.get(r)):null}getLastChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.maxKey();return n&&n.name}else return this.children_.maxKey()}getLastChild(t){const r=this.getLastChildName(t);return r?new Gt(r,this.children_.get(r)):null}forEachChild(t,r){const n=this.resolveIndex_(t);return n?n.inorderTraversal(o=>r(o.name,o.node)):this.children_.inorderTraversal(r)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getIteratorFrom(t,o=>o);{const o=this.children_.getIteratorFrom(t.name,Gt.Wrap);let i=o.peek();for(;i!=null&&r.compare(i,t)<0;)o.getNext(),i=o.peek();return o}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getReverseIteratorFrom(t,o=>o);{const o=this.children_.getReverseIteratorFrom(t.name,Gt.Wrap);let i=o.peek();for(;i!=null&&r.compare(i,t)>0;)o.getNext(),i=o.peek();return o}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===oh?-1:0}withIndex(t){if(t===Au||this.indexMap_.hasIndex(t))return this;{const r=this.indexMap_.addIndex(t,this.children_);return new Ot(this.children_,this.priorityNode_,r)}}isIndexed(t){return t===Au||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const r=t;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){const n=this.getIterator(Ur),o=r.getIterator(Ur);let i=n.getNext(),a=o.getNext();for(;i&&a;){if(i.name!==a.name||!i.node.equals(a.node))return!1;i=n.getNext(),a=o.getNext()}return i===null&&a===null}else return!1;else return!1}}resolveIndex_(t){return t===Au?null:this.indexMap_.get(t.toString())}}Ot.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class uJ extends Ot{constructor(){super(new Jn(M5),Ot.EMPTY_NODE,Ho.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return Ot.EMPTY_NODE}isEmpty(){return!1}}const oh=new uJ;Object.defineProperties(Gt,{MIN:{value:new Gt(Wu,Ot.EMPTY_NODE)},MAX:{value:new Gt(il,oh)}});EB.__EMPTY_NODE=Ot.EMPTY_NODE;tn.__childrenNodeConstructor=Ot;nJ(oh);oJ(oh);/** + */let Lc;class Ot{constructor(t,r,n){this.children_=t,this.priorityNode_=r,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&AB(this.priorityNode_),this.children_.isEmpty()&&it(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return Lc||(Lc=new Ot(new Jn(M5),null,Ho.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Lc}updatePriority(t){return this.children_.isEmpty()?this:new Ot(this.children_,t,this.indexMap_)}getImmediateChild(t){if(t===".priority")return this.getPriority();{const r=this.children_.get(t);return r===null?Lc:r}}getChild(t){const r=Xt(t);return r===null?this:this.getImmediateChild(r).getChild(br(t))}hasChild(t){return this.children_.get(t)!==null}updateImmediateChild(t,r){if(it(r,"We should always be passing snapshot nodes"),t===".priority")return this.updatePriority(r);{const n=new Gt(t,r);let o,i;r.isEmpty()?(o=this.children_.remove(t),i=this.indexMap_.removeFromIndexes(n,this.children_)):(o=this.children_.insert(t,r),i=this.indexMap_.addToIndexes(n,this.children_));const a=o.isEmpty()?Lc:this.priorityNode_;return new Ot(o,a,i)}}updateChild(t,r){const n=Xt(t);if(n===null)return r;{it(Xt(t)!==".priority"||is(t)===1,".priority must be the last token in a path");const o=this.getImmediateChild(n).updateChild(br(t),r);return this.updateImmediateChild(n,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const r={};let n=0,o=0,i=!0;if(this.forEachChild(Ur,(a,s)=>{r[a]=s.val(t),n++,i&&Ot.INTEGER_REGEXP_.test(a)?o=Math.max(o,Number(a)):i=!1}),!t&&i&&o<2*n){const a=[];for(const s in r)a[s]=r[s];return a}else return t&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let t="";this.getPriority().isEmpty()||(t+="priority:"+kB(this.getPriority().val())+":"),this.forEachChild(Ur,(r,n)=>{const o=n.hash();o!==""&&(t+=":"+r+":"+o)}),this.lazyHash_=t===""?"":XT(t)}return this.lazyHash_}getPredecessorChildName(t,r,n){const o=this.resolveIndex_(n);if(o){const i=o.getPredecessorKey(new Gt(t,r));return i?i.name:null}else return this.children_.getPredecessorKey(t)}getFirstChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.minKey();return n&&n.name}else return this.children_.minKey()}getFirstChild(t){const r=this.getFirstChildName(t);return r?new Gt(r,this.children_.get(r)):null}getLastChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.maxKey();return n&&n.name}else return this.children_.maxKey()}getLastChild(t){const r=this.getLastChildName(t);return r?new Gt(r,this.children_.get(r)):null}forEachChild(t,r){const n=this.resolveIndex_(t);return n?n.inorderTraversal(o=>r(o.name,o.node)):this.children_.inorderTraversal(r)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getIteratorFrom(t,o=>o);{const o=this.children_.getIteratorFrom(t.name,Gt.Wrap);let i=o.peek();for(;i!=null&&r.compare(i,t)<0;)o.getNext(),i=o.peek();return o}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getReverseIteratorFrom(t,o=>o);{const o=this.children_.getReverseIteratorFrom(t.name,Gt.Wrap);let i=o.peek();for(;i!=null&&r.compare(i,t)>0;)o.getNext(),i=o.peek();return o}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===oh?-1:0}withIndex(t){if(t===Au||this.indexMap_.hasIndex(t))return this;{const r=this.indexMap_.addIndex(t,this.children_);return new Ot(this.children_,this.priorityNode_,r)}}isIndexed(t){return t===Au||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const r=t;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){const n=this.getIterator(Ur),o=r.getIterator(Ur);let i=n.getNext(),a=o.getNext();for(;i&&a;){if(i.name!==a.name||!i.node.equals(a.node))return!1;i=n.getNext(),a=o.getNext()}return i===null&&a===null}else return!1;else return!1}}resolveIndex_(t){return t===Au?null:this.indexMap_.get(t.toString())}}Ot.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class WX extends Ot{constructor(){super(new Jn(M5),Ot.EMPTY_NODE,Ho.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return Ot.EMPTY_NODE}isEmpty(){return!1}}const oh=new WX;Object.defineProperties(Gt,{MIN:{value:new Gt(Wu,Ot.EMPTY_NODE)},MAX:{value:new Gt(il,oh)}});EB.__EMPTY_NODE=Ot.EMPTY_NODE;tn.__childrenNodeConstructor=Ot;UX(oh);FX(oh);/** * @license * Copyright 2017 Google LLC * @@ -2171,7 +2171,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const cJ=!0;function an(e,t=null){if(e===null)return Ot.EMPTY_NODE;if(typeof e=="object"&&".priority"in e&&(t=e[".priority"]),it(t===null||typeof t=="string"||typeof t=="number"||typeof t=="object"&&".sv"in t,"Invalid priority type found: "+typeof t),typeof e=="object"&&".value"in e&&e[".value"]!==null&&(e=e[".value"]),typeof e!="object"||".sv"in e){const r=e;return new tn(r,an(t))}if(!(e instanceof Array)&&cJ){const r=[];let n=!1;if(ii(e,(a,s)=>{if(a.substring(0,1)!=="."){const l=an(s);l.isEmpty()||(n=n||!l.getPriority().isEmpty(),r.push(new Gt(a,l)))}}),r.length===0)return Ot.EMPTY_NODE;const i=Fp(r,rJ,a=>a.name,M5);if(n){const a=Fp(r,Ur.getCompare());return new Ot(i,an(t),new Ho({".priority":a},{".priority":Ur}))}else return new Ot(i,an(t),Ho.Default)}else{let r=Ot.EMPTY_NODE;return ii(e,(n,o)=>{if(pa(e,n)&&n.substring(0,1)!=="."){const i=an(o);(i.isLeafNode()||!i.isEmpty())&&(r=r.updateImmediateChild(n,i))}}),r.updatePriority(an(t))}}iJ(an);/** + */const VX=!0;function an(e,t=null){if(e===null)return Ot.EMPTY_NODE;if(typeof e=="object"&&".priority"in e&&(t=e[".priority"]),it(t===null||typeof t=="string"||typeof t=="number"||typeof t=="object"&&".sv"in t,"Invalid priority type found: "+typeof t),typeof e=="object"&&".value"in e&&e[".value"]!==null&&(e=e[".value"]),typeof e!="object"||".sv"in e){const r=e;return new tn(r,an(t))}if(!(e instanceof Array)&&VX){const r=[];let n=!1;if(ii(e,(a,s)=>{if(a.substring(0,1)!=="."){const l=an(s);l.isEmpty()||(n=n||!l.getPriority().isEmpty(),r.push(new Gt(a,l)))}}),r.length===0)return Ot.EMPTY_NODE;const i=Fp(r,DX,a=>a.name,M5);if(n){const a=Fp(r,Ur.getCompare());return new Ot(i,an(t),new Ho({".priority":a},{".priority":Ur}))}else return new Ot(i,an(t),Ho.Default)}else{let r=Ot.EMPTY_NODE;return ii(e,(n,o)=>{if(pa(e,n)&&n.substring(0,1)!=="."){const i=an(o);(i.isLeafNode()||!i.isEmpty())&&(r=r.updateImmediateChild(n,i))}}),r.updatePriority(an(t))}}jX(an);/** * @license * Copyright 2017 Google LLC * @@ -2186,7 +2186,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class fJ extends sg{constructor(t){super(),this.indexPath_=t,it(!Qt(t)&&Xt(t)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,r){const n=this.extractChild(t.node),o=this.extractChild(r.node),i=n.compareTo(o);return i===0?fc(t.name,r.name):i}makePost(t,r){const n=an(t),o=Ot.EMPTY_NODE.updateChild(this.indexPath_,n);return new Gt(r,o)}maxPost(){const t=Ot.EMPTY_NODE.updateChild(this.indexPath_,oh);return new Gt(il,t)}toString(){return _B(this.indexPath_,0).join("/")}}/** + */class HX extends sg{constructor(t){super(),this.indexPath_=t,it(!Qt(t)&&Xt(t)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,r){const n=this.extractChild(t.node),o=this.extractChild(r.node),i=n.compareTo(o);return i===0?fc(t.name,r.name):i}makePost(t,r){const n=an(t),o=Ot.EMPTY_NODE.updateChild(this.indexPath_,n);return new Gt(r,o)}maxPost(){const t=Ot.EMPTY_NODE.updateChild(this.indexPath_,oh);return new Gt(il,t)}toString(){return _B(this.indexPath_,0).join("/")}}/** * @license * Copyright 2017 Google LLC * @@ -2201,7 +2201,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class dJ extends sg{compare(t,r){const n=t.node.compareTo(r.node);return n===0?fc(t.name,r.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,r){return!t.equals(r)}minPost(){return Gt.MIN}maxPost(){return Gt.MAX}makePost(t,r){const n=an(t);return new Gt(r,n)}toString(){return".value"}}const hJ=new dJ;/** + */class KX extends sg{compare(t,r){const n=t.node.compareTo(r.node);return n===0?fc(t.name,r.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,r){return!t.equals(r)}minPost(){return Gt.MIN}maxPost(){return Gt.MAX}makePost(t,r){const n=an(t);return new Gt(r,n)}toString(){return".value"}}const ZX=new KX;/** * @license * Copyright 2017 Google LLC * @@ -2216,7 +2216,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function TB(e){return{type:"value",snapshotNode:e}}function Vu(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function Ed(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function kd(e,t,r){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:r}}function pJ(e,t){return{type:"child_moved",snapshotNode:t,childName:e}}/** + */function TB(e){return{type:"value",snapshotNode:e}}function Vu(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function Ed(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function kd(e,t,r){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:r}}function GX(e,t){return{type:"child_moved",snapshotNode:t,childName:e}}/** * @license * Copyright 2017 Google LLC * @@ -2261,7 +2261,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class gJ{constructor(t){this.withinDirectionalStart=r=>this.reverse_?this.withinEndPost(r):this.withinStartPost(r),this.withinDirectionalEnd=r=>this.reverse_?this.withinStartPost(r):this.withinEndPost(r),this.withinStartPost=r=>{const n=this.index_.compare(this.rangedFilter_.getStartPost(),r);return this.startIsInclusive_?n<=0:n<0},this.withinEndPost=r=>{const n=this.index_.compare(r,this.rangedFilter_.getEndPost());return this.endIsInclusive_?n<=0:n<0},this.rangedFilter_=new Ad(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,r,n,o,i,a){return this.rangedFilter_.matches(new Gt(r,n))||(n=Ot.EMPTY_NODE),t.getImmediateChild(r).equals(n)?t:t.numChildren()h(p,d)}else a=this.index_.getCompare();const s=t;it(s.numChildren()===this.limit_,"");const l=new Gt(r,n),u=this.reverse_?s.getFirstChild(this.index_):s.getLastChild(this.index_),c=this.rangedFilter_.matches(l);if(s.hasChild(r)){const h=s.getImmediateChild(r);let d=o.getChildAfterChild(this.index_,u,this.reverse_);for(;d!=null&&(d.name===r||s.hasChild(d.name));)d=o.getChildAfterChild(this.index_,d,this.reverse_);const p=d==null?1:a(d,l);if(c&&!n.isEmpty()&&p>=0)return i!=null&&i.trackChildChange(kd(r,n,h)),s.updateImmediateChild(r,n);{i!=null&&i.trackChildChange(Ed(r,h));const b=s.updateImmediateChild(r,Ot.EMPTY_NODE);return d!=null&&this.rangedFilter_.matches(d)?(i!=null&&i.trackChildChange(Vu(d.name,d.node)),b.updateImmediateChild(d.name,d.node)):b}}else return n.isEmpty()?t:c&&a(u,l)>=0?(i!=null&&(i.trackChildChange(Ed(u.name,u.node)),i.trackChildChange(Vu(r,n))),s.updateImmediateChild(r,n).updateImmediateChild(u.name,Ot.EMPTY_NODE)):t}}/** + */class YX{constructor(t){this.withinDirectionalStart=r=>this.reverse_?this.withinEndPost(r):this.withinStartPost(r),this.withinDirectionalEnd=r=>this.reverse_?this.withinStartPost(r):this.withinEndPost(r),this.withinStartPost=r=>{const n=this.index_.compare(this.rangedFilter_.getStartPost(),r);return this.startIsInclusive_?n<=0:n<0},this.withinEndPost=r=>{const n=this.index_.compare(r,this.rangedFilter_.getEndPost());return this.endIsInclusive_?n<=0:n<0},this.rangedFilter_=new Ad(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,r,n,o,i,a){return this.rangedFilter_.matches(new Gt(r,n))||(n=Ot.EMPTY_NODE),t.getImmediateChild(r).equals(n)?t:t.numChildren()h(p,d)}else a=this.index_.getCompare();const s=t;it(s.numChildren()===this.limit_,"");const l=new Gt(r,n),u=this.reverse_?s.getFirstChild(this.index_):s.getLastChild(this.index_),c=this.rangedFilter_.matches(l);if(s.hasChild(r)){const h=s.getImmediateChild(r);let d=o.getChildAfterChild(this.index_,u,this.reverse_);for(;d!=null&&(d.name===r||s.hasChild(d.name));)d=o.getChildAfterChild(this.index_,d,this.reverse_);const p=d==null?1:a(d,l);if(c&&!n.isEmpty()&&p>=0)return i!=null&&i.trackChildChange(kd(r,n,h)),s.updateImmediateChild(r,n);{i!=null&&i.trackChildChange(Ed(r,h));const b=s.updateImmediateChild(r,Ot.EMPTY_NODE);return d!=null&&this.rangedFilter_.matches(d)?(i!=null&&i.trackChildChange(Vu(d.name,d.node)),b.updateImmediateChild(d.name,d.node)):b}}else return n.isEmpty()?t:c&&a(u,l)>=0?(i!=null&&(i.trackChildChange(Ed(u.name,u.node)),i.trackChildChange(Vu(r,n))),s.updateImmediateChild(r,n).updateImmediateChild(u.name,Ot.EMPTY_NODE)):t}}/** * @license * Copyright 2017 Google LLC * @@ -2276,7 +2276,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class T5{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Ur}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return it(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return it(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Wu}hasEnd(){return this.endSet_}getIndexEndValue(){return it(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return it(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:il}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return it(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Ur}copy(){const t=new T5;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function mJ(e){return e.loadsAllData()?new I5(e.getIndex()):e.hasLimit()?new gJ(e):new Ad(e)}function ZS(e){const t={};if(e.isDefault())return t;let r;if(e.index_===Ur?r="$priority":e.index_===hJ?r="$value":e.index_===Au?r="$key":(it(e.index_ instanceof fJ,"Unrecognized index type!"),r=e.index_.toString()),t.orderBy=Yr(r),e.startSet_){const n=e.startAfterSet_?"startAfter":"startAt";t[n]=Yr(e.indexStartValue_),e.startNameSet_&&(t[n]+=","+Yr(e.indexStartName_))}if(e.endSet_){const n=e.endBeforeSet_?"endBefore":"endAt";t[n]=Yr(e.indexEndValue_),e.endNameSet_&&(t[n]+=","+Yr(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?t.limitToFirst=e.limit_:t.limitToLast=e.limit_),t}function GS(e){const t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let r=e.viewFrom_;r===""&&(e.isViewFromLeft()?r="l":r="r"),t.vf=r}return e.index_!==Ur&&(t.i=e.index_.toString()),t}/** + */class T5{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Ur}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return it(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return it(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Wu}hasEnd(){return this.endSet_}getIndexEndValue(){return it(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return it(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:il}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return it(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Ur}copy(){const t=new T5;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function QX(e){return e.loadsAllData()?new I5(e.getIndex()):e.hasLimit()?new YX(e):new Ad(e)}function GS(e){const t={};if(e.isDefault())return t;let r;if(e.index_===Ur?r="$priority":e.index_===ZX?r="$value":e.index_===Au?r="$key":(it(e.index_ instanceof HX,"Unrecognized index type!"),r=e.index_.toString()),t.orderBy=Yr(r),e.startSet_){const n=e.startAfterSet_?"startAfter":"startAt";t[n]=Yr(e.indexStartValue_),e.startNameSet_&&(t[n]+=","+Yr(e.indexStartName_))}if(e.endSet_){const n=e.endBeforeSet_?"endBefore":"endAt";t[n]=Yr(e.indexEndValue_),e.endNameSet_&&(t[n]+=","+Yr(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?t.limitToFirst=e.limit_:t.limitToLast=e.limit_),t}function YS(e){const t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let r=e.viewFrom_;r===""&&(e.isViewFromLeft()?r="l":r="r"),t.vf=r}return e.index_!==Ur&&(t.i=e.index_.toString()),t}/** * @license * Copyright 2017 Google LLC * @@ -2291,7 +2291,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class zp extends yB{constructor(t,r,n,o){super(),this.repoInfo_=t,this.onDataUpdate_=r,this.authTokenProvider_=n,this.appCheckTokenProvider_=o,this.log_=ih("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,r){return r!==void 0?"tag$"+r:(it(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}listen(t,r,n,o){const i=t._path.toString();this.log_("Listen called for "+i+" "+t._queryIdentifier);const a=zp.getListenId_(t,n),s={};this.listens_[a]=s;const l=ZS(t._queryParams);this.restRequest_(i+".json",l,(u,c)=>{let h=c;if(u===404&&(h=null,u=null),u===null&&this.onDataUpdate_(i,h,!1,n),qu(this.listens_,a)===s){let d;u?u===401?d="permission_denied":d="rest_error:"+u:d="ok",o(d,null)}})}unlisten(t,r){const n=zp.getListenId_(t,r);delete this.listens_[n]}get(t){const r=ZS(t._queryParams),n=t._path.toString(),o=new og;return this.restRequest_(n+".json",r,(i,a)=>{let s=a;i===404&&(s=null,i=null),i===null?(this.onDataUpdate_(n,s,!1,null),o.resolve(s)):o.reject(new Error(s))}),o.promise}refreshAuthToken(t){}restRequest_(t,r={},n){return r.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([o,i])=>{o&&o.accessToken&&(r.auth=o.accessToken),i&&i.token&&(r.ac=i.token);const a=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+VY(r);this.log_("Sending REST request for "+a);const s=new XMLHttpRequest;s.onreadystatechange=()=>{if(n&&s.readyState===4){this.log_("REST Response for "+a+" received. status:",s.status,"response:",s.responseText);let l=null;if(s.status>=200&&s.status<300){try{l=_d(s.responseText)}catch{ni("Failed to parse JSON response for "+a+": "+s.responseText)}n(null,l)}else s.status!==401&&s.status!==404&&ni("Got unsuccessful REST response for "+a+" Status: "+s.status),n(s.status);n=null}},s.open("GET",a,!0),s.send()})}}/** + */class zp extends yB{constructor(t,r,n,o){super(),this.repoInfo_=t,this.onDataUpdate_=r,this.authTokenProvider_=n,this.appCheckTokenProvider_=o,this.log_=ih("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,r){return r!==void 0?"tag$"+r:(it(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}listen(t,r,n,o){const i=t._path.toString();this.log_("Listen called for "+i+" "+t._queryIdentifier);const a=zp.getListenId_(t,n),s={};this.listens_[a]=s;const l=GS(t._queryParams);this.restRequest_(i+".json",l,(u,c)=>{let h=c;if(u===404&&(h=null,u=null),u===null&&this.onDataUpdate_(i,h,!1,n),qu(this.listens_,a)===s){let d;u?u===401?d="permission_denied":d="rest_error:"+u:d="ok",o(d,null)}})}unlisten(t,r){const n=zp.getListenId_(t,r);delete this.listens_[n]}get(t){const r=GS(t._queryParams),n=t._path.toString(),o=new og;return this.restRequest_(n+".json",r,(i,a)=>{let s=a;i===404&&(s=null,i=null),i===null?(this.onDataUpdate_(n,s,!1,null),o.resolve(s)):o.reject(new Error(s))}),o.promise}refreshAuthToken(t){}restRequest_(t,r={},n){return r.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([o,i])=>{o&&o.accessToken&&(r.auth=o.accessToken),i&&i.token&&(r.ac=i.token);const a=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+kY(r);this.log_("Sending REST request for "+a);const s=new XMLHttpRequest;s.onreadystatechange=()=>{if(n&&s.readyState===4){this.log_("REST Response for "+a+" received. status:",s.status,"response:",s.responseText);let l=null;if(s.status>=200&&s.status<300){try{l=_d(s.responseText)}catch{ni("Failed to parse JSON response for "+a+": "+s.responseText)}n(null,l)}else s.status!==401&&s.status!==404&&ni("Got unsuccessful REST response for "+a+" Status: "+s.status),n(s.status);n=null}},s.open("GET",a,!0),s.send()})}}/** * @license * Copyright 2017 Google LLC * @@ -2306,7 +2306,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class vJ{constructor(){this.rootNode_=Ot.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,r){this.rootNode_=this.rootNode_.updateChild(t,r)}}/** + */class XX{constructor(){this.rootNode_=Ot.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,r){this.rootNode_=this.rootNode_.updateChild(t,r)}}/** * @license * Copyright 2017 Google LLC * @@ -2321,7 +2321,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function $p(){return{value:null,children:new Map}}function BB(e,t,r){if(Qt(t))e.value=r,e.children.clear();else if(e.value!==null)e.value=e.value.updateChild(t,r);else{const n=Xt(t);e.children.has(n)||e.children.set(n,$p());const o=e.children.get(n);t=br(t),BB(o,t,r)}}function D4(e,t,r){e.value!==null?r(t,e.value):yJ(e,(n,o)=>{const i=new mr(t.toString()+"/"+n);D4(o,i,r)})}function yJ(e,t){e.children.forEach((r,n)=>{t(n,r)})}/** + */function $p(){return{value:null,children:new Map}}function BB(e,t,r){if(Qt(t))e.value=r,e.children.clear();else if(e.value!==null)e.value=e.value.updateChild(t,r);else{const n=Xt(t);e.children.has(n)||e.children.set(n,$p());const o=e.children.get(n);t=br(t),BB(o,t,r)}}function L4(e,t,r){e.value!==null?r(t,e.value):JX(e,(n,o)=>{const i=new mr(t.toString()+"/"+n);L4(o,i,r)})}function JX(e,t){e.children.forEach((r,n)=>{t(n,r)})}/** * @license * Copyright 2017 Google LLC * @@ -2336,7 +2336,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class bJ{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),r=Object.assign({},t);return this.last_&&ii(this.last_,(n,o)=>{r[n]=r[n]-o}),this.last_=t,r}}/** + */class eJ{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),r=Object.assign({},t);return this.last_&&ii(this.last_,(n,o)=>{r[n]=r[n]-o}),this.last_=t,r}}/** * @license * Copyright 2017 Google LLC * @@ -2351,7 +2351,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const YS=10*1e3,wJ=30*1e3,_J=5*60*1e3;class xJ{constructor(t,r){this.server_=r,this.statsToReport_={},this.statsListener_=new bJ(t);const n=YS+(wJ-YS)*Math.random();jf(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),r={};let n=!1;ii(t,(o,i)=>{i>0&&pa(this.statsToReport_,o)&&(r[o]=i,n=!0)}),n&&this.server_.reportStats(r),jf(this.reportStats_.bind(this),Math.floor(Math.random()*2*_J))}}/** + */const QS=10*1e3,tJ=30*1e3,rJ=5*60*1e3;class nJ{constructor(t,r){this.server_=r,this.statsToReport_={},this.statsListener_=new eJ(t);const n=QS+(tJ-QS)*Math.random();jf(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),r={};let n=!1;ii(t,(o,i)=>{i>0&&pa(this.statsToReport_,o)&&(r[o]=i,n=!0)}),n&&this.server_.reportStats(r),jf(this.reportStats_.bind(this),Math.floor(Math.random()*2*rJ))}}/** * @license * Copyright 2017 Google LLC * @@ -2456,7 +2456,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class SJ{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function CJ(e,t,r,n){const o=[],i=[];return t.forEach(a=>{a.type==="child_changed"&&e.index_.indexedValueChanged(a.oldSnap,a.snapshotNode)&&i.push(pJ(a.childName,a.snapshotNode))}),Dc(e,o,"child_removed",t,n,r),Dc(e,o,"child_added",t,n,r),Dc(e,o,"child_moved",i,n,r),Dc(e,o,"child_changed",t,n,r),Dc(e,o,"value",t,n,r),o}function Dc(e,t,r,n,o,i){const a=n.filter(s=>s.type===r);a.sort((s,l)=>kJ(e,s,l)),a.forEach(s=>{const l=EJ(e,s,i);o.forEach(u=>{u.respondsTo(s.type)&&t.push(u.createEvent(l,e.query_))})})}function EJ(e,t,r){return t.type==="value"||t.type==="child_removed"||(t.prevName=r.getPredecessorChildName(t.childName,t.snapshotNode,e.index_)),t}function kJ(e,t,r){if(t.childName==null||r.childName==null)throw uc("Should only compare child_ events.");const n=new Gt(t.childName,t.snapshotNode),o=new Gt(r.childName,r.snapshotNode);return e.index_.compare(n,o)}/** + */class iJ{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function oJ(e,t,r,n){const o=[],i=[];return t.forEach(a=>{a.type==="child_changed"&&e.index_.indexedValueChanged(a.oldSnap,a.snapshotNode)&&i.push(GX(a.childName,a.snapshotNode))}),Dc(e,o,"child_removed",t,n,r),Dc(e,o,"child_added",t,n,r),Dc(e,o,"child_moved",i,n,r),Dc(e,o,"child_changed",t,n,r),Dc(e,o,"value",t,n,r),o}function Dc(e,t,r,n,o,i){const a=n.filter(s=>s.type===r);a.sort((s,l)=>sJ(e,s,l)),a.forEach(s=>{const l=aJ(e,s,i);o.forEach(u=>{u.respondsTo(s.type)&&t.push(u.createEvent(l,e.query_))})})}function aJ(e,t,r){return t.type==="value"||t.type==="child_removed"||(t.prevName=r.getPredecessorChildName(t.childName,t.snapshotNode,e.index_)),t}function sJ(e,t,r){if(t.childName==null||r.childName==null)throw uc("Should only compare child_ events.");const n=new Gt(t.childName,t.snapshotNode),o=new Gt(r.childName,r.snapshotNode);return e.index_.compare(n,o)}/** * @license * Copyright 2017 Google LLC * @@ -2486,7 +2486,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let L2;const AJ=()=>(L2||(L2=new Jn(dX)),L2);class Sr{constructor(t,r=AJ()){this.value=t,this.children=r}static fromObject(t){let r=new Sr(null);return ii(t,(n,o)=>{r=r.set(new mr(n),o)}),r}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,r){if(this.value!=null&&r(this.value))return{path:sr(),value:this.value};if(Qt(t))return null;{const n=Xt(t),o=this.children.get(n);if(o!==null){const i=o.findRootMostMatchingPathAndValue(br(t),r);return i!=null?{path:Qr(new mr(n),i.path),value:i.value}:null}else return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,()=>!0)}subtree(t){if(Qt(t))return this;{const r=Xt(t),n=this.children.get(r);return n!==null?n.subtree(br(t)):new Sr(null)}}set(t,r){if(Qt(t))return new Sr(r,this.children);{const n=Xt(t),i=(this.children.get(n)||new Sr(null)).set(br(t),r),a=this.children.insert(n,i);return new Sr(this.value,a)}}remove(t){if(Qt(t))return this.children.isEmpty()?new Sr(null):new Sr(null,this.children);{const r=Xt(t),n=this.children.get(r);if(n){const o=n.remove(br(t));let i;return o.isEmpty()?i=this.children.remove(r):i=this.children.insert(r,o),this.value===null&&i.isEmpty()?new Sr(null):new Sr(this.value,i)}else return this}}get(t){if(Qt(t))return this.value;{const r=Xt(t),n=this.children.get(r);return n?n.get(br(t)):null}}setTree(t,r){if(Qt(t))return r;{const n=Xt(t),i=(this.children.get(n)||new Sr(null)).setTree(br(t),r);let a;return i.isEmpty()?a=this.children.remove(n):a=this.children.insert(n,i),new Sr(this.value,a)}}fold(t){return this.fold_(sr(),t)}fold_(t,r){const n={};return this.children.inorderTraversal((o,i)=>{n[o]=i.fold_(Qr(t,o),r)}),r(t,this.value,n)}findOnPath(t,r){return this.findOnPath_(t,sr(),r)}findOnPath_(t,r,n){const o=this.value?n(r,this.value):!1;if(o)return o;if(Qt(t))return null;{const i=Xt(t),a=this.children.get(i);return a?a.findOnPath_(br(t),Qr(r,i),n):null}}foreachOnPath(t,r){return this.foreachOnPath_(t,sr(),r)}foreachOnPath_(t,r,n){if(Qt(t))return this;{this.value&&n(r,this.value);const o=Xt(t),i=this.children.get(o);return i?i.foreachOnPath_(br(t),Qr(r,o),n):new Sr(null)}}foreach(t){this.foreach_(sr(),t)}foreach_(t,r){this.children.inorderTraversal((n,o)=>{o.foreach_(Qr(t,n),r)}),this.value&&r(t,this.value)}foreachChild(t){this.children.inorderTraversal((r,n)=>{n.value&&t(r,n.value)})}}/** + */let L2;const lJ=()=>(L2||(L2=new Jn(KQ)),L2);class Sr{constructor(t,r=lJ()){this.value=t,this.children=r}static fromObject(t){let r=new Sr(null);return ii(t,(n,o)=>{r=r.set(new mr(n),o)}),r}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,r){if(this.value!=null&&r(this.value))return{path:sr(),value:this.value};if(Qt(t))return null;{const n=Xt(t),o=this.children.get(n);if(o!==null){const i=o.findRootMostMatchingPathAndValue(br(t),r);return i!=null?{path:Qr(new mr(n),i.path),value:i.value}:null}else return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,()=>!0)}subtree(t){if(Qt(t))return this;{const r=Xt(t),n=this.children.get(r);return n!==null?n.subtree(br(t)):new Sr(null)}}set(t,r){if(Qt(t))return new Sr(r,this.children);{const n=Xt(t),i=(this.children.get(n)||new Sr(null)).set(br(t),r),a=this.children.insert(n,i);return new Sr(this.value,a)}}remove(t){if(Qt(t))return this.children.isEmpty()?new Sr(null):new Sr(null,this.children);{const r=Xt(t),n=this.children.get(r);if(n){const o=n.remove(br(t));let i;return o.isEmpty()?i=this.children.remove(r):i=this.children.insert(r,o),this.value===null&&i.isEmpty()?new Sr(null):new Sr(this.value,i)}else return this}}get(t){if(Qt(t))return this.value;{const r=Xt(t),n=this.children.get(r);return n?n.get(br(t)):null}}setTree(t,r){if(Qt(t))return r;{const n=Xt(t),i=(this.children.get(n)||new Sr(null)).setTree(br(t),r);let a;return i.isEmpty()?a=this.children.remove(n):a=this.children.insert(n,i),new Sr(this.value,a)}}fold(t){return this.fold_(sr(),t)}fold_(t,r){const n={};return this.children.inorderTraversal((o,i)=>{n[o]=i.fold_(Qr(t,o),r)}),r(t,this.value,n)}findOnPath(t,r){return this.findOnPath_(t,sr(),r)}findOnPath_(t,r,n){const o=this.value?n(r,this.value):!1;if(o)return o;if(Qt(t))return null;{const i=Xt(t),a=this.children.get(i);return a?a.findOnPath_(br(t),Qr(r,i),n):null}}foreachOnPath(t,r){return this.foreachOnPath_(t,sr(),r)}foreachOnPath_(t,r,n){if(Qt(t))return this;{this.value&&n(r,this.value);const o=Xt(t),i=this.children.get(o);return i?i.foreachOnPath_(br(t),Qr(r,o),n):new Sr(null)}}foreach(t){this.foreach_(sr(),t)}foreach_(t,r){this.children.inorderTraversal((n,o)=>{o.foreach_(Qr(t,n),r)}),this.value&&r(t,this.value)}foreachChild(t){this.children.inorderTraversal((r,n)=>{n.value&&t(r,n.value)})}}/** * @license * Copyright 2017 Google LLC * @@ -2501,7 +2501,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class Xi{constructor(t){this.writeTree_=t}static empty(){return new Xi(new Sr(null))}}function zf(e,t,r){if(Qt(t))return new Xi(new Sr(r));{const n=e.writeTree_.findRootMostValueAndPath(t);if(n!=null){const o=n.path;let i=n.value;const a=jn(o,t);return i=i.updateChild(a,r),new Xi(e.writeTree_.set(o,i))}else{const o=new Sr(r),i=e.writeTree_.setTree(t,o);return new Xi(i)}}}function QS(e,t,r){let n=e;return ii(r,(o,i)=>{n=zf(n,Qr(t,o),i)}),n}function XS(e,t){if(Qt(t))return Xi.empty();{const r=e.writeTree_.setTree(t,new Sr(null));return new Xi(r)}}function U4(e,t){return Ul(e,t)!=null}function Ul(e,t){const r=e.writeTree_.findRootMostValueAndPath(t);return r!=null?e.writeTree_.get(r.path).getChild(jn(r.path,t)):null}function JS(e){const t=[],r=e.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(Ur,(n,o)=>{t.push(new Gt(n,o))}):e.writeTree_.children.inorderTraversal((n,o)=>{o.value!=null&&t.push(new Gt(n,o.value))}),t}function qa(e,t){if(Qt(t))return e;{const r=Ul(e,t);return r!=null?new Xi(new Sr(r)):new Xi(e.writeTree_.subtree(t))}}function j4(e){return e.writeTree_.isEmpty()}function Hu(e,t){return OB(sr(),e.writeTree_,t)}function OB(e,t,r){if(t.value!=null)return r.updateChild(e,t.value);{let n=null;return t.children.inorderTraversal((o,i)=>{o===".priority"?(it(i.value!==null,"Priority writes must always be leaf nodes"),n=i.value):r=OB(Qr(e,o),i,r)}),!r.getChild(e).isEmpty()&&n!==null&&(r=r.updateChild(Qr(e,".priority"),n)),r}}/** + */class Xi{constructor(t){this.writeTree_=t}static empty(){return new Xi(new Sr(null))}}function zf(e,t,r){if(Qt(t))return new Xi(new Sr(r));{const n=e.writeTree_.findRootMostValueAndPath(t);if(n!=null){const o=n.path;let i=n.value;const a=jn(o,t);return i=i.updateChild(a,r),new Xi(e.writeTree_.set(o,i))}else{const o=new Sr(r),i=e.writeTree_.setTree(t,o);return new Xi(i)}}}function XS(e,t,r){let n=e;return ii(r,(o,i)=>{n=zf(n,Qr(t,o),i)}),n}function JS(e,t){if(Qt(t))return Xi.empty();{const r=e.writeTree_.setTree(t,new Sr(null));return new Xi(r)}}function D4(e,t){return Ul(e,t)!=null}function Ul(e,t){const r=e.writeTree_.findRootMostValueAndPath(t);return r!=null?e.writeTree_.get(r.path).getChild(jn(r.path,t)):null}function eC(e){const t=[],r=e.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(Ur,(n,o)=>{t.push(new Gt(n,o))}):e.writeTree_.children.inorderTraversal((n,o)=>{o.value!=null&&t.push(new Gt(n,o.value))}),t}function qa(e,t){if(Qt(t))return e;{const r=Ul(e,t);return r!=null?new Xi(new Sr(r)):new Xi(e.writeTree_.subtree(t))}}function U4(e){return e.writeTree_.isEmpty()}function Hu(e,t){return OB(sr(),e.writeTree_,t)}function OB(e,t,r){if(t.value!=null)return r.updateChild(e,t.value);{let n=null;return t.children.inorderTraversal((o,i)=>{o===".priority"?(it(i.value!==null,"Priority writes must always be leaf nodes"),n=i.value):r=OB(Qr(e,o),i,r)}),!r.getChild(e).isEmpty()&&n!==null&&(r=r.updateChild(Qr(e,".priority"),n)),r}}/** * @license * Copyright 2017 Google LLC * @@ -2516,7 +2516,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function ug(e,t){return UB(t,e)}function MJ(e,t,r,n,o){it(n>e.lastWriteId,"Stacking an older write on top of newer ones"),o===void 0&&(o=!0),e.allWrites.push({path:t,snap:r,writeId:n,visible:o}),o&&(e.visibleWrites=zf(e.visibleWrites,t,r)),e.lastWriteId=n}function IJ(e,t){for(let r=0;rs.writeId===t);it(r>=0,"removeWrite called with nonexistent writeId.");const n=e.allWrites[r];e.allWrites.splice(r,1);let o=n.visible,i=!1,a=e.allWrites.length-1;for(;o&&a>=0;){const s=e.allWrites[a];s.visible&&(a>=r&&BJ(s,n.path)?o=!1:Vi(n.path,s.path)&&(i=!0)),a--}if(o){if(i)return PJ(e),!0;if(n.snap)e.visibleWrites=XS(e.visibleWrites,n.path);else{const s=n.children;ii(s,l=>{e.visibleWrites=XS(e.visibleWrites,Qr(n.path,l))})}return!0}else return!1}function BJ(e,t){if(e.snap)return Vi(e.path,t);for(const r in e.children)if(e.children.hasOwnProperty(r)&&Vi(Qr(e.path,r),t))return!0;return!1}function PJ(e){e.visibleWrites=NB(e.allWrites,RJ,sr()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1}function RJ(e){return e.visible}function NB(e,t,r){let n=Xi.empty();for(let o=0;o{n=n.updateImmediateChild(i,a)}),n;if(r){const i=qa(e.visibleWrites,t);return r.forEachChild(Ur,(a,s)=>{const l=Hu(qa(i,new mr(a)),s);n=n.updateImmediateChild(a,l)}),JS(i).forEach(a=>{n=n.updateImmediateChild(a.name,a.node)}),n}else{const i=qa(e.visibleWrites,t);return JS(i).forEach(a=>{n=n.updateImmediateChild(a.name,a.node)}),n}}function NJ(e,t,r,n,o){it(n||o,"Either existingEventSnap or existingServerSnap must exist");const i=Qr(t,r);if(U4(e.visibleWrites,i))return null;{const a=qa(e.visibleWrites,i);return j4(a)?o.getChild(r):Hu(a,o.getChild(r))}}function LJ(e,t,r,n){const o=Qr(t,r),i=Ul(e.visibleWrites,o);if(i!=null)return i;if(n.isCompleteForChild(r)){const a=qa(e.visibleWrites,o);return Hu(a,n.getNode().getImmediateChild(r))}else return null}function DJ(e,t){return Ul(e.visibleWrites,t)}function UJ(e,t,r,n,o,i,a){let s;const l=qa(e.visibleWrites,t),u=Ul(l,sr());if(u!=null)s=u;else if(r!=null)s=Hu(l,r);else return[];if(s=s.withIndex(a),!s.isEmpty()&&!s.isLeafNode()){const c=[],h=a.getCompare(),d=i?s.getReverseIteratorFrom(n,a):s.getIteratorFrom(n,a);let p=d.getNext();for(;p&&c.lengthe.lastWriteId,"Stacking an older write on top of newer ones"),o===void 0&&(o=!0),e.allWrites.push({path:t,snap:r,writeId:n,visible:o}),o&&(e.visibleWrites=zf(e.visibleWrites,t,r)),e.lastWriteId=n}function cJ(e,t){for(let r=0;rs.writeId===t);it(r>=0,"removeWrite called with nonexistent writeId.");const n=e.allWrites[r];e.allWrites.splice(r,1);let o=n.visible,i=!1,a=e.allWrites.length-1;for(;o&&a>=0;){const s=e.allWrites[a];s.visible&&(a>=r&&dJ(s,n.path)?o=!1:Vi(n.path,s.path)&&(i=!0)),a--}if(o){if(i)return hJ(e),!0;if(n.snap)e.visibleWrites=JS(e.visibleWrites,n.path);else{const s=n.children;ii(s,l=>{e.visibleWrites=JS(e.visibleWrites,Qr(n.path,l))})}return!0}else return!1}function dJ(e,t){if(e.snap)return Vi(e.path,t);for(const r in e.children)if(e.children.hasOwnProperty(r)&&Vi(Qr(e.path,r),t))return!0;return!1}function hJ(e){e.visibleWrites=NB(e.allWrites,pJ,sr()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1}function pJ(e){return e.visible}function NB(e,t,r){let n=Xi.empty();for(let o=0;o{n=n.updateImmediateChild(i,a)}),n;if(r){const i=qa(e.visibleWrites,t);return r.forEachChild(Ur,(a,s)=>{const l=Hu(qa(i,new mr(a)),s);n=n.updateImmediateChild(a,l)}),eC(i).forEach(a=>{n=n.updateImmediateChild(a.name,a.node)}),n}else{const i=qa(e.visibleWrites,t);return eC(i).forEach(a=>{n=n.updateImmediateChild(a.name,a.node)}),n}}function mJ(e,t,r,n,o){it(n||o,"Either existingEventSnap or existingServerSnap must exist");const i=Qr(t,r);if(D4(e.visibleWrites,i))return null;{const a=qa(e.visibleWrites,i);return U4(a)?o.getChild(r):Hu(a,o.getChild(r))}}function vJ(e,t,r,n){const o=Qr(t,r),i=Ul(e.visibleWrites,o);if(i!=null)return i;if(n.isCompleteForChild(r)){const a=qa(e.visibleWrites,o);return Hu(a,n.getNode().getImmediateChild(r))}else return null}function yJ(e,t){return Ul(e.visibleWrites,t)}function bJ(e,t,r,n,o,i,a){let s;const l=qa(e.visibleWrites,t),u=Ul(l,sr());if(u!=null)s=u;else if(r!=null)s=Hu(l,r);else return[];if(s=s.withIndex(a),!s.isEmpty()&&!s.isLeafNode()){const c=[],h=a.getCompare(),d=i?s.getReverseIteratorFrom(n,a):s.getIteratorFrom(n,a);let p=d.getNext();for(;p&&c.length0||!e.eventCache.isFullyInitialized()||o&&!n.getNode().equals(i)||!n.getNode().getPriority().equals(i.getPriority()))&&r.push(TB(Wp(t)))}}function FB(e,t,r,n,o,i){const a=t.eventCache;if(Hp(n,r)!=null)return t;{let s,l;if(Qt(r))if(it(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){const u=al(t),c=u instanceof Ot?u:Ot.EMPTY_NODE,h=R5(n,c);s=e.filter.updateFullNode(t.eventCache.getNode(),h,i)}else{const u=Vp(n,al(t));s=e.filter.updateFullNode(t.eventCache.getNode(),u,i)}else{const u=Xt(r);if(u===".priority"){it(is(r)===1,"Can't have a priority with additional path components");const c=a.getNode();l=t.serverCache.getNode();const h=eC(n,r,c,l);h!=null?s=e.filter.updatePriority(c,h):s=a.getNode()}else{const c=br(r);let h;if(a.isCompleteForChild(u)){l=t.serverCache.getNode();const d=eC(n,r,a.getNode(),l);d!=null?h=a.getNode().getImmediateChild(u).updateChild(c,d):h=a.getNode().getImmediateChild(u)}else h=O5(n,u,t.serverCache);h!=null?s=e.filter.updateChild(a.getNode(),u,h,c,o,i):s=a.getNode()}}return Ff(t,s,a.isFullyInitialized()||Qt(r),e.filter.filtersNodes())}}function Kp(e,t,r,n,o,i,a,s){const l=t.serverCache;let u;const c=a?e.filter:e.filter.getIndexedFilter();if(Qt(r))u=c.updateFullNode(l.getNode(),n,null);else if(c.filtersNodes()&&!l.isFiltered()){const p=l.getNode().updateChild(r,n);u=c.updateFullNode(l.getNode(),p,null)}else{const p=Xt(r);if(!l.isCompleteForPath(r)&&is(r)>1)return t;const v=br(r),S=l.getNode().getImmediateChild(p).updateChild(v,n);p===".priority"?u=c.updatePriority(l.getNode(),S):u=c.updateChild(l.getNode(),p,S,v,jB,null)}const h=RB(t,u,l.isFullyInitialized()||Qt(r),c.filtersNodes()),d=new N5(o,h,i);return FB(e,h,r,o,d,s)}function F4(e,t,r,n,o,i,a){const s=t.eventCache;let l,u;const c=new N5(o,t,i);if(Qt(r))u=e.filter.updateFullNode(t.eventCache.getNode(),n,a),l=Ff(t,u,!0,e.filter.filtersNodes());else{const h=Xt(r);if(h===".priority")u=e.filter.updatePriority(t.eventCache.getNode(),n),l=Ff(t,u,s.isFullyInitialized(),s.isFiltered());else{const d=br(r),p=s.getNode().getImmediateChild(h);let v;if(Qt(d))v=n;else{const b=c.getCompleteChild(h);b!=null?wB(d)===".priority"&&b.getChild(xB(d)).isEmpty()?v=b:v=b.updateChild(d,n):v=Ot.EMPTY_NODE}if(p.equals(v))l=t;else{const b=e.filter.updateChild(s.getNode(),h,v,d,c,a);l=Ff(t,b,s.isFullyInitialized(),e.filter.filtersNodes())}}}return l}function tC(e,t){return e.eventCache.isCompleteForChild(t)}function KJ(e,t,r,n,o,i,a){let s=t;return n.foreach((l,u)=>{const c=Qr(r,l);tC(t,Xt(c))&&(s=F4(e,s,c,u,o,i,a))}),n.foreach((l,u)=>{const c=Qr(r,l);tC(t,Xt(c))||(s=F4(e,s,c,u,o,i,a))}),s}function rC(e,t,r){return r.foreach((n,o)=>{t=t.updateChild(n,o)}),t}function z4(e,t,r,n,o,i,a,s){if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let l=t,u;Qt(r)?u=n:u=new Sr(null).setTree(r,n);const c=t.serverCache.getNode();return u.children.inorderTraversal((h,d)=>{if(c.hasChild(h)){const p=t.serverCache.getNode().getImmediateChild(h),v=rC(e,p,d);l=Kp(e,l,new mr(h),v,o,i,a,s)}}),u.children.inorderTraversal((h,d)=>{const p=!t.serverCache.isCompleteForChild(h)&&d.value===null;if(!c.hasChild(h)&&!p){const v=t.serverCache.getNode().getImmediateChild(h),b=rC(e,v,d);l=Kp(e,l,new mr(h),b,o,i,a,s)}}),l}function ZJ(e,t,r,n,o,i,a){if(Hp(o,r)!=null)return t;const s=t.serverCache.isFiltered(),l=t.serverCache;if(n.value!=null){if(Qt(r)&&l.isFullyInitialized()||l.isCompleteForPath(r))return Kp(e,t,r,l.getNode().getChild(r),o,i,s,a);if(Qt(r)){let u=new Sr(null);return l.getNode().forEachChild(Au,(c,h)=>{u=u.set(new mr(c),h)}),z4(e,t,r,u,o,i,s,a)}else return t}else{let u=new Sr(null);return n.foreach((c,h)=>{const d=Qr(r,c);l.isCompleteForPath(d)&&(u=u.set(c,l.getNode().getChild(d)))}),z4(e,t,r,u,o,i,s,a)}}function GJ(e,t,r,n,o){const i=t.serverCache,a=RB(t,i.getNode(),i.isFullyInitialized()||Qt(r),i.isFiltered());return FB(e,a,r,n,jB,o)}function YJ(e,t,r,n,o,i){let a;if(Hp(n,r)!=null)return t;{const s=new N5(n,t,o),l=t.eventCache.getNode();let u;if(Qt(r)||Xt(r)===".priority"){let c;if(t.serverCache.isFullyInitialized())c=Vp(n,al(t));else{const h=t.serverCache.getNode();it(h instanceof Ot,"serverChildren would be complete if leaf node"),c=R5(n,h)}c=c,u=e.filter.updateFullNode(l,c,i)}else{const c=Xt(r);let h=O5(n,c,t.serverCache);h==null&&t.serverCache.isCompleteForChild(c)&&(h=l.getImmediateChild(c)),h!=null?u=e.filter.updateChild(l,c,h,br(r),s,i):t.eventCache.getNode().hasChild(c)?u=e.filter.updateChild(l,c,Ot.EMPTY_NODE,br(r),s,i):u=l,u.isEmpty()&&t.serverCache.isFullyInitialized()&&(a=Vp(n,al(t)),a.isLeafNode()&&(u=e.filter.updateFullNode(u,a,i)))}return a=t.serverCache.isFullyInitialized()||Hp(n,sr())!=null,Ff(t,u,a,e.filter.filtersNodes())}}/** + */function CJ(e){return{filter:e}}function EJ(e,t){it(t.eventCache.getNode().isIndexed(e.filter.getIndex()),"Event snap not indexed"),it(t.serverCache.getNode().isIndexed(e.filter.getIndex()),"Server snap not indexed")}function kJ(e,t,r,n,o){const i=new xJ;let a,s;if(r.type===Hi.OVERWRITE){const u=r;u.source.fromUser?a=j4(e,t,u.path,u.snap,n,o,i):(it(u.source.fromServer,"Unknown source."),s=u.source.tagged||t.serverCache.isFiltered()&&!Qt(u.path),a=Kp(e,t,u.path,u.snap,n,o,s,i))}else if(r.type===Hi.MERGE){const u=r;u.source.fromUser?a=MJ(e,t,u.path,u.children,n,o,i):(it(u.source.fromServer,"Unknown source."),s=u.source.tagged||t.serverCache.isFiltered(),a=F4(e,t,u.path,u.children,n,o,s,i))}else if(r.type===Hi.ACK_USER_WRITE){const u=r;u.revert?a=BJ(e,t,u.path,n,o,i):a=IJ(e,t,u.path,u.affectedTree,n,o,i)}else if(r.type===Hi.LISTEN_COMPLETE)a=TJ(e,t,r.path,n,i);else throw uc("Unknown operation type: "+r.type);const l=i.getChanges();return AJ(t,a,l),{viewCache:a,changes:l}}function AJ(e,t,r){const n=t.eventCache;if(n.isFullyInitialized()){const o=n.getNode().isLeafNode()||n.getNode().isEmpty(),i=Wp(e);(r.length>0||!e.eventCache.isFullyInitialized()||o&&!n.getNode().equals(i)||!n.getNode().getPriority().equals(i.getPriority()))&&r.push(TB(Wp(t)))}}function FB(e,t,r,n,o,i){const a=t.eventCache;if(Hp(n,r)!=null)return t;{let s,l;if(Qt(r))if(it(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){const u=al(t),c=u instanceof Ot?u:Ot.EMPTY_NODE,h=R5(n,c);s=e.filter.updateFullNode(t.eventCache.getNode(),h,i)}else{const u=Vp(n,al(t));s=e.filter.updateFullNode(t.eventCache.getNode(),u,i)}else{const u=Xt(r);if(u===".priority"){it(is(r)===1,"Can't have a priority with additional path components");const c=a.getNode();l=t.serverCache.getNode();const h=tC(n,r,c,l);h!=null?s=e.filter.updatePriority(c,h):s=a.getNode()}else{const c=br(r);let h;if(a.isCompleteForChild(u)){l=t.serverCache.getNode();const d=tC(n,r,a.getNode(),l);d!=null?h=a.getNode().getImmediateChild(u).updateChild(c,d):h=a.getNode().getImmediateChild(u)}else h=O5(n,u,t.serverCache);h!=null?s=e.filter.updateChild(a.getNode(),u,h,c,o,i):s=a.getNode()}}return Ff(t,s,a.isFullyInitialized()||Qt(r),e.filter.filtersNodes())}}function Kp(e,t,r,n,o,i,a,s){const l=t.serverCache;let u;const c=a?e.filter:e.filter.getIndexedFilter();if(Qt(r))u=c.updateFullNode(l.getNode(),n,null);else if(c.filtersNodes()&&!l.isFiltered()){const p=l.getNode().updateChild(r,n);u=c.updateFullNode(l.getNode(),p,null)}else{const p=Xt(r);if(!l.isCompleteForPath(r)&&is(r)>1)return t;const v=br(r),S=l.getNode().getImmediateChild(p).updateChild(v,n);p===".priority"?u=c.updatePriority(l.getNode(),S):u=c.updateChild(l.getNode(),p,S,v,jB,null)}const h=RB(t,u,l.isFullyInitialized()||Qt(r),c.filtersNodes()),d=new N5(o,h,i);return FB(e,h,r,o,d,s)}function j4(e,t,r,n,o,i,a){const s=t.eventCache;let l,u;const c=new N5(o,t,i);if(Qt(r))u=e.filter.updateFullNode(t.eventCache.getNode(),n,a),l=Ff(t,u,!0,e.filter.filtersNodes());else{const h=Xt(r);if(h===".priority")u=e.filter.updatePriority(t.eventCache.getNode(),n),l=Ff(t,u,s.isFullyInitialized(),s.isFiltered());else{const d=br(r),p=s.getNode().getImmediateChild(h);let v;if(Qt(d))v=n;else{const b=c.getCompleteChild(h);b!=null?wB(d)===".priority"&&b.getChild(xB(d)).isEmpty()?v=b:v=b.updateChild(d,n):v=Ot.EMPTY_NODE}if(p.equals(v))l=t;else{const b=e.filter.updateChild(s.getNode(),h,v,d,c,a);l=Ff(t,b,s.isFullyInitialized(),e.filter.filtersNodes())}}}return l}function rC(e,t){return e.eventCache.isCompleteForChild(t)}function MJ(e,t,r,n,o,i,a){let s=t;return n.foreach((l,u)=>{const c=Qr(r,l);rC(t,Xt(c))&&(s=j4(e,s,c,u,o,i,a))}),n.foreach((l,u)=>{const c=Qr(r,l);rC(t,Xt(c))||(s=j4(e,s,c,u,o,i,a))}),s}function nC(e,t,r){return r.foreach((n,o)=>{t=t.updateChild(n,o)}),t}function F4(e,t,r,n,o,i,a,s){if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let l=t,u;Qt(r)?u=n:u=new Sr(null).setTree(r,n);const c=t.serverCache.getNode();return u.children.inorderTraversal((h,d)=>{if(c.hasChild(h)){const p=t.serverCache.getNode().getImmediateChild(h),v=nC(e,p,d);l=Kp(e,l,new mr(h),v,o,i,a,s)}}),u.children.inorderTraversal((h,d)=>{const p=!t.serverCache.isCompleteForChild(h)&&d.value===null;if(!c.hasChild(h)&&!p){const v=t.serverCache.getNode().getImmediateChild(h),b=nC(e,v,d);l=Kp(e,l,new mr(h),b,o,i,a,s)}}),l}function IJ(e,t,r,n,o,i,a){if(Hp(o,r)!=null)return t;const s=t.serverCache.isFiltered(),l=t.serverCache;if(n.value!=null){if(Qt(r)&&l.isFullyInitialized()||l.isCompleteForPath(r))return Kp(e,t,r,l.getNode().getChild(r),o,i,s,a);if(Qt(r)){let u=new Sr(null);return l.getNode().forEachChild(Au,(c,h)=>{u=u.set(new mr(c),h)}),F4(e,t,r,u,o,i,s,a)}else return t}else{let u=new Sr(null);return n.foreach((c,h)=>{const d=Qr(r,c);l.isCompleteForPath(d)&&(u=u.set(c,l.getNode().getChild(d)))}),F4(e,t,r,u,o,i,s,a)}}function TJ(e,t,r,n,o){const i=t.serverCache,a=RB(t,i.getNode(),i.isFullyInitialized()||Qt(r),i.isFiltered());return FB(e,a,r,n,jB,o)}function BJ(e,t,r,n,o,i){let a;if(Hp(n,r)!=null)return t;{const s=new N5(n,t,o),l=t.eventCache.getNode();let u;if(Qt(r)||Xt(r)===".priority"){let c;if(t.serverCache.isFullyInitialized())c=Vp(n,al(t));else{const h=t.serverCache.getNode();it(h instanceof Ot,"serverChildren would be complete if leaf node"),c=R5(n,h)}c=c,u=e.filter.updateFullNode(l,c,i)}else{const c=Xt(r);let h=O5(n,c,t.serverCache);h==null&&t.serverCache.isCompleteForChild(c)&&(h=l.getImmediateChild(c)),h!=null?u=e.filter.updateChild(l,c,h,br(r),s,i):t.eventCache.getNode().hasChild(c)?u=e.filter.updateChild(l,c,Ot.EMPTY_NODE,br(r),s,i):u=l,u.isEmpty()&&t.serverCache.isFullyInitialized()&&(a=Vp(n,al(t)),a.isLeafNode()&&(u=e.filter.updateFullNode(u,a,i)))}return a=t.serverCache.isFullyInitialized()||Hp(n,sr())!=null,Ff(t,u,a,e.filter.filtersNodes())}}/** * @license * Copyright 2017 Google LLC * @@ -2576,7 +2576,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class QJ{constructor(t,r){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,o=new I5(n.getIndex()),i=mJ(n);this.processor_=qJ(i);const a=r.serverCache,s=r.eventCache,l=o.updateFullNode(Ot.EMPTY_NODE,a.getNode(),null),u=i.updateFullNode(Ot.EMPTY_NODE,s.getNode(),null),c=new os(l,a.isFullyInitialized(),o.filtersNodes()),h=new os(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=lg(h,c),this.eventGenerator_=new SJ(this.query_)}get query(){return this.query_}}function XJ(e){return e.viewCache_.serverCache.getNode()}function JJ(e){return Wp(e.viewCache_)}function eee(e,t){const r=al(e.viewCache_);return r&&(e.query._queryParams.loadsAllData()||!Qt(t)&&!r.getImmediateChild(Xt(t)).isEmpty())?r.getChild(t):null}function nC(e){return e.eventRegistrations_.length===0}function tee(e,t){e.eventRegistrations_.push(t)}function iC(e,t,r){const n=[];if(r){it(t==null,"A cancel should cancel all event registrations.");const o=e.query._path;e.eventRegistrations_.forEach(i=>{const a=i.createCancelEvent(r,o);a&&n.push(a)})}if(t){let o=[];for(let i=0;i{n.push(Vu(i,a))}),r.isFullyInitialized()&&n.push(TB(r.getNode())),zB(e,n,r.getNode(),t)}function zB(e,t,r,n){const o=n?[n]:e.eventRegistrations_;return CJ(e.eventGenerator_,t,r,o)}/** + */class PJ{constructor(t,r){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,o=new I5(n.getIndex()),i=QX(n);this.processor_=CJ(i);const a=r.serverCache,s=r.eventCache,l=o.updateFullNode(Ot.EMPTY_NODE,a.getNode(),null),u=i.updateFullNode(Ot.EMPTY_NODE,s.getNode(),null),c=new os(l,a.isFullyInitialized(),o.filtersNodes()),h=new os(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=lg(h,c),this.eventGenerator_=new iJ(this.query_)}get query(){return this.query_}}function RJ(e){return e.viewCache_.serverCache.getNode()}function OJ(e){return Wp(e.viewCache_)}function NJ(e,t){const r=al(e.viewCache_);return r&&(e.query._queryParams.loadsAllData()||!Qt(t)&&!r.getImmediateChild(Xt(t)).isEmpty())?r.getChild(t):null}function iC(e){return e.eventRegistrations_.length===0}function LJ(e,t){e.eventRegistrations_.push(t)}function oC(e,t,r){const n=[];if(r){it(t==null,"A cancel should cancel all event registrations.");const o=e.query._path;e.eventRegistrations_.forEach(i=>{const a=i.createCancelEvent(r,o);a&&n.push(a)})}if(t){let o=[];for(let i=0;i{n.push(Vu(i,a))}),r.isFullyInitialized()&&n.push(TB(r.getNode())),zB(e,n,r.getNode(),t)}function zB(e,t,r,n){const o=n?[n]:e.eventRegistrations_;return oJ(e.eventGenerator_,t,r,o)}/** * @license * Copyright 2017 Google LLC * @@ -2591,7 +2591,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let Zp;class $B{constructor(){this.views=new Map}}function nee(e){it(!Zp,"__referenceConstructor has already been defined"),Zp=e}function iee(){return it(Zp,"Reference.ts has not been loaded"),Zp}function oee(e){return e.views.size===0}function L5(e,t,r,n){const o=t.source.queryId;if(o!==null){const i=e.views.get(o);return it(i!=null,"SyncTree gave us an op for an invalid query."),oC(i,t,r,n)}else{let i=[];for(const a of e.views.values())i=i.concat(oC(a,t,r,n));return i}}function qB(e,t,r,n,o){const i=t._queryIdentifier,a=e.views.get(i);if(!a){let s=Vp(r,o?n:null),l=!1;s?l=!0:n instanceof Ot?(s=R5(r,n),l=!1):(s=Ot.EMPTY_NODE,l=!1);const u=lg(new os(s,l,!1),new os(n,o,!1));return new QJ(t,u)}return a}function aee(e,t,r,n,o,i){const a=qB(e,t,n,o,i);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,a),tee(a,r),ree(a,r)}function see(e,t,r,n){const o=t._queryIdentifier,i=[];let a=[];const s=as(e);if(o==="default")for(const[l,u]of e.views.entries())a=a.concat(iC(u,r,n)),nC(u)&&(e.views.delete(l),u.query._queryParams.loadsAllData()||i.push(u.query));else{const l=e.views.get(o);l&&(a=a.concat(iC(l,r,n)),nC(l)&&(e.views.delete(o),l.query._queryParams.loadsAllData()||i.push(l.query)))}return s&&!as(e)&&i.push(new(iee())(t._repo,t._path)),{removed:i,events:a}}function WB(e){const t=[];for(const r of e.views.values())r.query._queryParams.loadsAllData()||t.push(r);return t}function Wa(e,t){let r=null;for(const n of e.views.values())r=r||eee(n,t);return r}function VB(e,t){if(t._queryParams.loadsAllData())return cg(e);{const n=t._queryIdentifier;return e.views.get(n)}}function HB(e,t){return VB(e,t)!=null}function as(e){return cg(e)!=null}function cg(e){for(const t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}/** + */let Zp;class $B{constructor(){this.views=new Map}}function UJ(e){it(!Zp,"__referenceConstructor has already been defined"),Zp=e}function jJ(){return it(Zp,"Reference.ts has not been loaded"),Zp}function FJ(e){return e.views.size===0}function L5(e,t,r,n){const o=t.source.queryId;if(o!==null){const i=e.views.get(o);return it(i!=null,"SyncTree gave us an op for an invalid query."),aC(i,t,r,n)}else{let i=[];for(const a of e.views.values())i=i.concat(aC(a,t,r,n));return i}}function qB(e,t,r,n,o){const i=t._queryIdentifier,a=e.views.get(i);if(!a){let s=Vp(r,o?n:null),l=!1;s?l=!0:n instanceof Ot?(s=R5(r,n),l=!1):(s=Ot.EMPTY_NODE,l=!1);const u=lg(new os(s,l,!1),new os(n,o,!1));return new PJ(t,u)}return a}function zJ(e,t,r,n,o,i){const a=qB(e,t,n,o,i);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,a),LJ(a,r),DJ(a,r)}function $J(e,t,r,n){const o=t._queryIdentifier,i=[];let a=[];const s=as(e);if(o==="default")for(const[l,u]of e.views.entries())a=a.concat(oC(u,r,n)),iC(u)&&(e.views.delete(l),u.query._queryParams.loadsAllData()||i.push(u.query));else{const l=e.views.get(o);l&&(a=a.concat(oC(l,r,n)),iC(l)&&(e.views.delete(o),l.query._queryParams.loadsAllData()||i.push(l.query)))}return s&&!as(e)&&i.push(new(jJ())(t._repo,t._path)),{removed:i,events:a}}function WB(e){const t=[];for(const r of e.views.values())r.query._queryParams.loadsAllData()||t.push(r);return t}function Wa(e,t){let r=null;for(const n of e.views.values())r=r||NJ(n,t);return r}function VB(e,t){if(t._queryParams.loadsAllData())return cg(e);{const n=t._queryIdentifier;return e.views.get(n)}}function HB(e,t){return VB(e,t)!=null}function as(e){return cg(e)!=null}function cg(e){for(const t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}/** * @license * Copyright 2017 Google LLC * @@ -2606,7 +2606,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */let Gp;function lee(e){it(!Gp,"__referenceConstructor has already been defined"),Gp=e}function uee(){return it(Gp,"Reference.ts has not been loaded"),Gp}let cee=1;class aC{constructor(t){this.listenProvider_=t,this.syncPointTree_=new Sr(null),this.pendingWriteTree_=jJ(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function KB(e,t,r,n,o){return MJ(e.pendingWriteTree_,t,r,n,o),o?sh(e,new ol(PB(),t,r)):[]}function zs(e,t,r=!1){const n=IJ(e.pendingWriteTree_,t);if(TJ(e.pendingWriteTree_,t)){let i=new Sr(null);return n.snap!=null?i=i.set(sr(),!0):ii(n.children,a=>{i=i.set(new mr(a),!0)}),sh(e,new qp(n.path,i,r))}else return[]}function ah(e,t,r){return sh(e,new ol(B5(),t,r))}function fee(e,t,r){const n=Sr.fromObject(r);return sh(e,new Id(B5(),t,n))}function dee(e,t){return sh(e,new Md(B5(),t))}function hee(e,t,r){const n=U5(e,r);if(n){const o=j5(n),i=o.path,a=o.queryId,s=jn(i,t),l=new Md(P5(a),s);return F5(e,i,l)}else return[]}function ZB(e,t,r,n,o=!1){const i=t._path,a=e.syncPointTree_.get(i);let s=[];if(a&&(t._queryIdentifier==="default"||HB(a,t))){const l=see(a,t,r,n);oee(a)&&(e.syncPointTree_=e.syncPointTree_.remove(i));const u=l.removed;if(s=l.events,!o){const c=u.findIndex(d=>d._queryParams.loadsAllData())!==-1,h=e.syncPointTree_.findOnPath(i,(d,p)=>as(p));if(c&&!h){const d=e.syncPointTree_.subtree(i);if(!d.isEmpty()){const p=vee(d);for(let v=0;v0&&!n&&(c?e.listenProvider_.stopListening($f(t),null):u.forEach(d=>{const p=e.queryToTagMap.get(fg(d));e.listenProvider_.stopListening($f(d),p)}))}yee(e,u)}return s}function GB(e,t,r,n){const o=U5(e,n);if(o!=null){const i=j5(o),a=i.path,s=i.queryId,l=jn(a,t),u=new ol(P5(s),l,r);return F5(e,a,u)}else return[]}function pee(e,t,r,n){const o=U5(e,n);if(o){const i=j5(o),a=i.path,s=i.queryId,l=jn(a,t),u=Sr.fromObject(r),c=new Id(P5(s),l,u);return F5(e,a,c)}else return[]}function gee(e,t,r,n=!1){const o=t._path;let i=null,a=!1;e.syncPointTree_.foreachOnPath(o,(d,p)=>{const v=jn(d,o);i=i||Wa(p,v),a=a||as(p)});let s=e.syncPointTree_.get(o);s?(a=a||as(s),i=i||Wa(s,sr())):(s=new $B,e.syncPointTree_=e.syncPointTree_.set(o,s));let l;i!=null?l=!0:(l=!1,i=Ot.EMPTY_NODE,e.syncPointTree_.subtree(o).foreachChild((p,v)=>{const b=Wa(v,sr());b&&(i=i.updateImmediateChild(p,b))}));const u=HB(s,t);if(!u&&!t._queryParams.loadsAllData()){const d=fg(t);it(!e.queryToTagMap.has(d),"View does not exist, but we have a tag");const p=bee();e.queryToTagMap.set(d,p),e.tagToQueryMap.set(p,d)}const c=ug(e.pendingWriteTree_,o);let h=aee(s,t,r,c,i,l);if(!u&&!a&&!n){const d=VB(s,t);h=h.concat(wee(e,t,d))}return h}function D5(e,t,r){const o=e.pendingWriteTree_,i=e.syncPointTree_.findOnPath(t,(a,s)=>{const l=jn(a,t),u=Wa(s,l);if(u)return u});return LB(o,t,i,r,!0)}function mee(e,t){const r=t._path;let n=null;e.syncPointTree_.foreachOnPath(r,(u,c)=>{const h=jn(u,r);n=n||Wa(c,h)});let o=e.syncPointTree_.get(r);o?n=n||Wa(o,sr()):(o=new $B,e.syncPointTree_=e.syncPointTree_.set(r,o));const i=n!=null,a=i?new os(n,!0,!1):null,s=ug(e.pendingWriteTree_,t._path),l=qB(o,t,s,i?a.getNode():Ot.EMPTY_NODE,i);return JJ(l)}function sh(e,t){return YB(t,e.syncPointTree_,null,ug(e.pendingWriteTree_,sr()))}function YB(e,t,r,n){if(Qt(e.path))return QB(e,t,r,n);{const o=t.get(sr());r==null&&o!=null&&(r=Wa(o,sr()));let i=[];const a=Xt(e.path),s=e.operationForChild(a),l=t.children.get(a);if(l&&s){const u=r?r.getImmediateChild(a):null,c=DB(n,a);i=i.concat(YB(s,l,u,c))}return o&&(i=i.concat(L5(o,e,n,r))),i}}function QB(e,t,r,n){const o=t.get(sr());r==null&&o!=null&&(r=Wa(o,sr()));let i=[];return t.children.inorderTraversal((a,s)=>{const l=r?r.getImmediateChild(a):null,u=DB(n,a),c=e.operationForChild(a);c&&(i=i.concat(QB(c,s,l,u)))}),o&&(i=i.concat(L5(o,e,n,r))),i}function XB(e,t){const r=t.query,n=Td(e,r);return{hashFn:()=>(XJ(t)||Ot.EMPTY_NODE).hash(),onComplete:o=>{if(o==="ok")return n?hee(e,r._path,n):dee(e,r._path);{const i=gX(o,r);return ZB(e,r,null,i)}}}}function Td(e,t){const r=fg(t);return e.queryToTagMap.get(r)}function fg(e){return e._path.toString()+"$"+e._queryIdentifier}function U5(e,t){return e.tagToQueryMap.get(t)}function j5(e){const t=e.indexOf("$");return it(t!==-1&&t{if(r&&as(r))return[cg(r)];{let o=[];return r&&(o=WB(r)),ii(n,(i,a)=>{o=o.concat(a)}),o}})}function $f(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(uee())(e._repo,e._path):e}function yee(e,t){for(let r=0;r{if(!Qt(u)&&c&&as(c))return[cg(c).query];{let d=[];return c&&(d=d.concat(WB(c).map(p=>p.query))),ii(h,(p,v)=>{d=d.concat(v)}),d}});for(let u=0;u{i=i.set(new mr(a),!0)}),sh(e,new qp(n.path,i,r))}else return[]}function ah(e,t,r){return sh(e,new ol(B5(),t,r))}function HJ(e,t,r){const n=Sr.fromObject(r);return sh(e,new Id(B5(),t,n))}function KJ(e,t){return sh(e,new Md(B5(),t))}function ZJ(e,t,r){const n=U5(e,r);if(n){const o=j5(n),i=o.path,a=o.queryId,s=jn(i,t),l=new Md(P5(a),s);return F5(e,i,l)}else return[]}function ZB(e,t,r,n,o=!1){const i=t._path,a=e.syncPointTree_.get(i);let s=[];if(a&&(t._queryIdentifier==="default"||HB(a,t))){const l=$J(a,t,r,n);FJ(a)&&(e.syncPointTree_=e.syncPointTree_.remove(i));const u=l.removed;if(s=l.events,!o){const c=u.findIndex(d=>d._queryParams.loadsAllData())!==-1,h=e.syncPointTree_.findOnPath(i,(d,p)=>as(p));if(c&&!h){const d=e.syncPointTree_.subtree(i);if(!d.isEmpty()){const p=XJ(d);for(let v=0;v0&&!n&&(c?e.listenProvider_.stopListening($f(t),null):u.forEach(d=>{const p=e.queryToTagMap.get(fg(d));e.listenProvider_.stopListening($f(d),p)}))}JJ(e,u)}return s}function GB(e,t,r,n){const o=U5(e,n);if(o!=null){const i=j5(o),a=i.path,s=i.queryId,l=jn(a,t),u=new ol(P5(s),l,r);return F5(e,a,u)}else return[]}function GJ(e,t,r,n){const o=U5(e,n);if(o){const i=j5(o),a=i.path,s=i.queryId,l=jn(a,t),u=Sr.fromObject(r),c=new Id(P5(s),l,u);return F5(e,a,c)}else return[]}function YJ(e,t,r,n=!1){const o=t._path;let i=null,a=!1;e.syncPointTree_.foreachOnPath(o,(d,p)=>{const v=jn(d,o);i=i||Wa(p,v),a=a||as(p)});let s=e.syncPointTree_.get(o);s?(a=a||as(s),i=i||Wa(s,sr())):(s=new $B,e.syncPointTree_=e.syncPointTree_.set(o,s));let l;i!=null?l=!0:(l=!1,i=Ot.EMPTY_NODE,e.syncPointTree_.subtree(o).foreachChild((p,v)=>{const b=Wa(v,sr());b&&(i=i.updateImmediateChild(p,b))}));const u=HB(s,t);if(!u&&!t._queryParams.loadsAllData()){const d=fg(t);it(!e.queryToTagMap.has(d),"View does not exist, but we have a tag");const p=eee();e.queryToTagMap.set(d,p),e.tagToQueryMap.set(p,d)}const c=ug(e.pendingWriteTree_,o);let h=zJ(s,t,r,c,i,l);if(!u&&!a&&!n){const d=VB(s,t);h=h.concat(tee(e,t,d))}return h}function D5(e,t,r){const o=e.pendingWriteTree_,i=e.syncPointTree_.findOnPath(t,(a,s)=>{const l=jn(a,t),u=Wa(s,l);if(u)return u});return LB(o,t,i,r,!0)}function QJ(e,t){const r=t._path;let n=null;e.syncPointTree_.foreachOnPath(r,(u,c)=>{const h=jn(u,r);n=n||Wa(c,h)});let o=e.syncPointTree_.get(r);o?n=n||Wa(o,sr()):(o=new $B,e.syncPointTree_=e.syncPointTree_.set(r,o));const i=n!=null,a=i?new os(n,!0,!1):null,s=ug(e.pendingWriteTree_,t._path),l=qB(o,t,s,i?a.getNode():Ot.EMPTY_NODE,i);return OJ(l)}function sh(e,t){return YB(t,e.syncPointTree_,null,ug(e.pendingWriteTree_,sr()))}function YB(e,t,r,n){if(Qt(e.path))return QB(e,t,r,n);{const o=t.get(sr());r==null&&o!=null&&(r=Wa(o,sr()));let i=[];const a=Xt(e.path),s=e.operationForChild(a),l=t.children.get(a);if(l&&s){const u=r?r.getImmediateChild(a):null,c=DB(n,a);i=i.concat(YB(s,l,u,c))}return o&&(i=i.concat(L5(o,e,n,r))),i}}function QB(e,t,r,n){const o=t.get(sr());r==null&&o!=null&&(r=Wa(o,sr()));let i=[];return t.children.inorderTraversal((a,s)=>{const l=r?r.getImmediateChild(a):null,u=DB(n,a),c=e.operationForChild(a);c&&(i=i.concat(QB(c,s,l,u)))}),o&&(i=i.concat(L5(o,e,n,r))),i}function XB(e,t){const r=t.query,n=Td(e,r);return{hashFn:()=>(RJ(t)||Ot.EMPTY_NODE).hash(),onComplete:o=>{if(o==="ok")return n?ZJ(e,r._path,n):KJ(e,r._path);{const i=YQ(o,r);return ZB(e,r,null,i)}}}}function Td(e,t){const r=fg(t);return e.queryToTagMap.get(r)}function fg(e){return e._path.toString()+"$"+e._queryIdentifier}function U5(e,t){return e.tagToQueryMap.get(t)}function j5(e){const t=e.indexOf("$");return it(t!==-1&&t{if(r&&as(r))return[cg(r)];{let o=[];return r&&(o=WB(r)),ii(n,(i,a)=>{o=o.concat(a)}),o}})}function $f(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(WJ())(e._repo,e._path):e}function JJ(e,t){for(let r=0;r{if(!Qt(u)&&c&&as(c))return[cg(c).query];{let d=[];return c&&(d=d.concat(WB(c).map(p=>p.query))),ii(h,(p,v)=>{d=d.concat(v)}),d}});for(let u=0;u{const u=q5(l,t.getImmediateChild(s),r);u!==l&&(i=i.updateImmediateChild(s,u))}),i}}/** + */class z5{constructor(t){this.node_=t}getImmediateChild(t){const r=this.node_.getImmediateChild(t);return new z5(r)}node(){return this.node_}}class $5{constructor(t,r){this.syncTree_=t,this.path_=r}getImmediateChild(t){const r=Qr(this.path_,t);return new $5(this.syncTree_,r)}node(){return D5(this.syncTree_,this.path_)}}const ree=function(e){return e=e||{},e.timestamp=e.timestamp||new Date().getTime(),e},lC=function(e,t,r){if(!e||typeof e!="object")return e;if(it(".sv"in e,"Unexpected leaf node or priority contents"),typeof e[".sv"]=="string")return nee(e[".sv"],t,r);if(typeof e[".sv"]=="object")return iee(e[".sv"],t);it(!1,"Unexpected server value: "+JSON.stringify(e,null,2))},nee=function(e,t,r){switch(e){case"timestamp":return r.timestamp;default:it(!1,"Unexpected server value: "+e)}},iee=function(e,t,r){e.hasOwnProperty("increment")||it(!1,"Unexpected server value: "+JSON.stringify(e,null,2));const n=e.increment;typeof n!="number"&&it(!1,"Unexpected increment value: "+n);const o=t.node();if(it(o!==null&&typeof o<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!o.isLeafNode())return n;const a=o.getValue();return typeof a!="number"?n:a+n},oee=function(e,t,r,n){return q5(t,new $5(r,e),n)},JB=function(e,t,r){return q5(e,new z5(t),r)};function q5(e,t,r){const n=e.getPriority().val(),o=lC(n,t.getImmediateChild(".priority"),r);let i;if(e.isLeafNode()){const a=e,s=lC(a.getValue(),t,r);return s!==a.getValue()||o!==a.getPriority().val()?new tn(s,an(o)):e}else{const a=e;return i=a,o!==a.getPriority().val()&&(i=i.updatePriority(new tn(o))),a.forEachChild(Ur,(s,l)=>{const u=q5(l,t.getImmediateChild(s),r);u!==l&&(i=i.updateImmediateChild(s,u))}),i}}/** * @license * Copyright 2017 Google LLC * @@ -2636,7 +2636,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class W5{constructor(t="",r=null,n={children:{},childCount:0}){this.name=t,this.parent=r,this.node=n}}function V5(e,t){let r=t instanceof mr?t:new mr(t),n=e,o=Xt(r);for(;o!==null;){const i=qu(n.node.children,o)||{children:{},childCount:0};n=new W5(o,n,i),r=br(r),o=Xt(r)}return n}function hc(e){return e.node.value}function eP(e,t){e.node.value=t,$4(e)}function tP(e){return e.node.childCount>0}function Eee(e){return hc(e)===void 0&&!tP(e)}function dg(e,t){ii(e.node.children,(r,n)=>{t(new W5(r,e,n))})}function rP(e,t,r,n){r&&!n&&t(e),dg(e,o=>{rP(o,t,!0,n)}),r&&n&&t(e)}function kee(e,t,r){let n=r?e:e.parent;for(;n!==null;){if(t(n))return!0;n=n.parent}return!1}function lh(e){return new mr(e.parent===null?e.name:lh(e.parent)+"/"+e.name)}function $4(e){e.parent!==null&&Aee(e.parent,e.name,e)}function Aee(e,t,r){const n=Eee(r),o=pa(e.node.children,t);n&&o?(delete e.node.children[t],e.node.childCount--,$4(e)):!n&&!o&&(e.node.children[t]=r.node,e.node.childCount++,$4(e))}/** + */class W5{constructor(t="",r=null,n={children:{},childCount:0}){this.name=t,this.parent=r,this.node=n}}function V5(e,t){let r=t instanceof mr?t:new mr(t),n=e,o=Xt(r);for(;o!==null;){const i=qu(n.node.children,o)||{children:{},childCount:0};n=new W5(o,n,i),r=br(r),o=Xt(r)}return n}function hc(e){return e.node.value}function eP(e,t){e.node.value=t,z4(e)}function tP(e){return e.node.childCount>0}function aee(e){return hc(e)===void 0&&!tP(e)}function dg(e,t){ii(e.node.children,(r,n)=>{t(new W5(r,e,n))})}function rP(e,t,r,n){r&&!n&&t(e),dg(e,o=>{rP(o,t,!0,n)}),r&&n&&t(e)}function see(e,t,r){let n=r?e:e.parent;for(;n!==null;){if(t(n))return!0;n=n.parent}return!1}function lh(e){return new mr(e.parent===null?e.name:lh(e.parent)+"/"+e.name)}function z4(e){e.parent!==null&&lee(e.parent,e.name,e)}function lee(e,t,r){const n=aee(r),o=pa(e.node.children,t);n&&o?(delete e.node.children[t],e.node.childCount--,z4(e)):!n&&!o&&(e.node.children[t]=r.node,e.node.childCount++,z4(e))}/** * @license * Copyright 2017 Google LLC * @@ -2651,7 +2651,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const Mee=/[\[\].#$\/\u0000-\u001F\u007F]/,Iee=/[\[\].#$\u0000-\u001F\u007F]/,D2=10*1024*1024,nP=function(e){return typeof e=="string"&&e.length!==0&&!Mee.test(e)},iP=function(e){return typeof e=="string"&&e.length!==0&&!Iee.test(e)},Tee=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),iP(e)},Bee=function(e,t,r,n){n&&t===void 0||H5(_5(e,"value"),t,r)},H5=function(e,t,r){const n=r instanceof mr?new ZX(r,e):r;if(t===void 0)throw new Error(e+"contains undefined "+Is(n));if(typeof t=="function")throw new Error(e+"contains a function "+Is(n)+" with contents = "+t.toString());if(JT(t))throw new Error(e+"contains "+t.toString()+" "+Is(n));if(typeof t=="string"&&t.length>D2/3&&ag(t)>D2)throw new Error(e+"contains a string greater than "+D2+" utf8 bytes "+Is(n)+" ('"+t.substring(0,50)+"...')");if(t&&typeof t=="object"){let o=!1,i=!1;if(ii(t,(a,s)=>{if(a===".value")o=!0;else if(a!==".priority"&&a!==".sv"&&(i=!0,!nP(a)))throw new Error(e+" contains an invalid key ("+a+") "+Is(n)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);GX(n,a),H5(e,s,n),YX(n)}),o&&i)throw new Error(e+' contains ".value" child '+Is(n)+" in addition to actual children.")}},oP=function(e,t,r,n){if(!(n&&r===void 0)&&!iP(r))throw new Error(_5(e,t)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},Pee=function(e,t,r,n){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),oP(e,t,r,n)},Ree=function(e,t){if(Xt(t)===".info")throw new Error(e+" failed = Can't modify data under /.info/")},Oee=function(e,t){const r=t.path.toString();if(typeof t.repoInfo.host!="string"||t.repoInfo.host.length===0||!nP(t.repoInfo.namespace)&&t.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!Tee(r))throw new Error(_5(e,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/** + */const uee=/[\[\].#$\/\u0000-\u001F\u007F]/,cee=/[\[\].#$\u0000-\u001F\u007F]/,D2=10*1024*1024,nP=function(e){return typeof e=="string"&&e.length!==0&&!uee.test(e)},iP=function(e){return typeof e=="string"&&e.length!==0&&!cee.test(e)},fee=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),iP(e)},dee=function(e,t,r,n){n&&t===void 0||H5(_5(e,"value"),t,r)},H5=function(e,t,r){const n=r instanceof mr?new IX(r,e):r;if(t===void 0)throw new Error(e+"contains undefined "+Is(n));if(typeof t=="function")throw new Error(e+"contains a function "+Is(n)+" with contents = "+t.toString());if(JT(t))throw new Error(e+"contains "+t.toString()+" "+Is(n));if(typeof t=="string"&&t.length>D2/3&&ag(t)>D2)throw new Error(e+"contains a string greater than "+D2+" utf8 bytes "+Is(n)+" ('"+t.substring(0,50)+"...')");if(t&&typeof t=="object"){let o=!1,i=!1;if(ii(t,(a,s)=>{if(a===".value")o=!0;else if(a!==".priority"&&a!==".sv"&&(i=!0,!nP(a)))throw new Error(e+" contains an invalid key ("+a+") "+Is(n)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);TX(n,a),H5(e,s,n),BX(n)}),o&&i)throw new Error(e+' contains ".value" child '+Is(n)+" in addition to actual children.")}},oP=function(e,t,r,n){if(!(n&&r===void 0)&&!iP(r))throw new Error(_5(e,t)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},hee=function(e,t,r,n){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),oP(e,t,r,n)},pee=function(e,t){if(Xt(t)===".info")throw new Error(e+" failed = Can't modify data under /.info/")},gee=function(e,t){const r=t.path.toString();if(typeof t.repoInfo.host!="string"||t.repoInfo.host.length===0||!nP(t.repoInfo.namespace)&&t.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!fee(r))throw new Error(_5(e,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/** * @license * Copyright 2017 Google LLC * @@ -2666,7 +2666,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class Nee{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function aP(e,t){let r=null;for(let n=0;nVi(n,t)||Vi(t,n))}function Lee(e,t){e.recursionDepth_++;let r=!0;for(let n=0;nVi(n,t)||Vi(t,n))}function vee(e,t){e.recursionDepth_++;let r=!0;for(let n=0;n{lC(e,n,o,i,a)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>uC(e,!0),0);else{if(typeof r<"u"&&r!==null){if(typeof r!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Yr(r)}catch(n){throw new Error("Invalid authOverride provided: "+n)}}e.persistentConnection_=new Yo(e.repoInfo_,t,(n,o,i,a)=>{lC(e,n,o,i,a)},n=>{uC(e,n)},n=>{qee(e,n)},e.authTokenProvider_,e.appCheckProvider_,r),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(n=>{e.server_.refreshAuthToken(n)}),e.appCheckProvider_.addTokenChangeListener(n=>{e.server_.refreshAppCheckToken(n.token)}),e.statsReporter_=CX(e.repoInfo_,()=>new xJ(e.stats_,e.server_)),e.infoData_=new vJ,e.infoSyncTree_=new aC({startListening:(n,o,i,a)=>{let s=[];const l=e.infoData_.getNode(n._path);return l.isEmpty()||(s=ah(e.infoSyncTree_,n._path,l),setTimeout(()=>{a("ok")},0)),s},stopListening:()=>{}}),Z5(e,"connected",!1),e.serverSyncTree_=new aC({startListening:(n,o,i,a)=>(e.server_.listen(n,i,o,(s,l)=>{const u=a(s,l);ko(e.eventQueue_,n._path,u)}),[]),stopListening:(n,o)=>{e.server_.unlisten(n,o)}})}function $ee(e){const r=e.infoData_.getNode(new mr(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function K5(e){return _ee({timestamp:$ee(e)})}function lC(e,t,r,n,o){e.dataUpdateCount++;const i=new mr(t);r=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,r):r;let a=[];if(o)if(n){const l=Np(r,u=>an(u));a=pee(e.serverSyncTree_,i,l,o)}else{const l=an(r);a=GB(e.serverSyncTree_,i,l,o)}else if(n){const l=Np(r,u=>an(u));a=fee(e.serverSyncTree_,i,l)}else{const l=an(r);a=ah(e.serverSyncTree_,i,l)}let s=i;a.length>0&&(s=pg(e,i)),ko(e.eventQueue_,s,a)}function uC(e,t){Z5(e,"connected",t),t===!1&&Hee(e)}function qee(e,t){ii(t,(r,n)=>{Z5(e,r,n)})}function Z5(e,t,r){const n=new mr("/.info/"+t),o=an(r);e.infoData_.updateSnapshot(n,o);const i=ah(e.infoSyncTree_,n,o);ko(e.eventQueue_,n,i)}function sP(e){return e.nextWriteId_++}function Wee(e,t,r){const n=mee(e.serverSyncTree_,t);return n!=null?Promise.resolve(n):e.server_.get(t).then(o=>{const i=an(o).withIndex(t._queryParams.getIndex());gee(e.serverSyncTree_,t,r,!0);let a;if(t._queryParams.loadsAllData())a=ah(e.serverSyncTree_,t._path,i);else{const s=Td(e.serverSyncTree_,t);a=GB(e.serverSyncTree_,t._path,i,s)}return ko(e.eventQueue_,t._path,a),ZB(e.serverSyncTree_,t,r,null,!0),i},o=>(hg(e,"get for query "+Yr(t)+" failed: "+o),Promise.reject(new Error(o))))}function Vee(e,t,r,n,o){hg(e,"set",{path:t.toString(),value:r,priority:n});const i=K5(e),a=an(r,n),s=D5(e.serverSyncTree_,t),l=JB(a,s,i),u=sP(e),c=KB(e.serverSyncTree_,t,l,u,!0);aP(e.eventQueue_,c),e.server_.put(t.toString(),a.val(!0),(d,p)=>{const v=d==="ok";v||ni("set at "+t+" failed: "+d);const b=zs(e.serverSyncTree_,u,!v);ko(e.eventQueue_,t,b),Zee(e,o,d,p)});const h=dP(e,t);pg(e,h),ko(e.eventQueue_,h,[])}function Hee(e){hg(e,"onDisconnectEvents");const t=K5(e),r=$p();D4(e.onDisconnect_,sr(),(o,i)=>{const a=Cee(o,i,e.serverSyncTree_,t);BB(r,o,a)});let n=[];D4(r,sr(),(o,i)=>{n=n.concat(ah(e.serverSyncTree_,o,i));const a=dP(e,o);pg(e,a)}),e.onDisconnect_=$p(),ko(e.eventQueue_,sr(),n)}function Kee(e){e.persistentConnection_&&e.persistentConnection_.interrupt(Uee)}function hg(e,...t){let r="";e.persistentConnection_&&(r=e.persistentConnection_.id+":"),En(r,...t)}function Zee(e,t,r,n){t&&dc(()=>{if(r==="ok")t(null);else{const o=(r||"error").toUpperCase();let i=o;n&&(i+=": "+n);const a=new Error(i);a.code=o,t(a)}})}function lP(e,t,r){return D5(e.serverSyncTree_,t,r)||Ot.EMPTY_NODE}function G5(e,t=e.transactionQueueTree_){if(t||gg(e,t),hc(t)){const r=cP(e,t);it(r.length>0,"Sending zero length transaction queue"),r.every(o=>o.status===0)&&Gee(e,lh(t),r)}else tP(t)&&dg(t,r=>{G5(e,r)})}function Gee(e,t,r){const n=r.map(u=>u.currentWriteId),o=lP(e,t,n);let i=o;const a=o.hash();for(let u=0;u{hg(e,"transaction put response",{path:l.toString(),status:u});let c=[];if(u==="ok"){const h=[];for(let d=0;dr[d].onComplete(null,!0,r[d].currentOutputSnapshotResolved)),r[d].unwatcher();gg(e,V5(e.transactionQueueTree_,t)),G5(e,e.transactionQueueTree_),ko(e.eventQueue_,t,c);for(let d=0;ds.status===0).map(s=>s.currentWriteId);for(let s=0;s=jee)c=!0,h="maxretry",o=o.concat(zs(e.serverSyncTree_,l.currentWriteId,!0));else{const d=lP(e,l.path,a);l.currentInputSnapshot=d;const p=t[s].update(d.val());if(p!==void 0){H5("transaction failed: Data returned ",p,l.path);let v=an(p);typeof p=="object"&&p!=null&&pa(p,".priority")||(v=v.updatePriority(d.getPriority()));const S=l.currentWriteId,x=K5(e),k=JB(v,d,x);l.currentOutputSnapshotRaw=v,l.currentOutputSnapshotResolved=k,l.currentWriteId=sP(e),a.splice(a.indexOf(S),1),o=o.concat(KB(e.serverSyncTree_,l.path,k,l.currentWriteId,l.applyLocally)),o=o.concat(zs(e.serverSyncTree_,S,!0))}else c=!0,h="nodata",o=o.concat(zs(e.serverSyncTree_,l.currentWriteId,!0))}ko(e.eventQueue_,r,o),o=[],c&&(t[s].status=2,function(d){setTimeout(d,Math.floor(0))}(t[s].unwatcher),t[s].onComplete&&(h==="nodata"?n.push(()=>t[s].onComplete(null,!1,t[s].currentInputSnapshot)):n.push(()=>t[s].onComplete(new Error(h),!1,null))))}gg(e,e.transactionQueueTree_);for(let s=0;sn.order-o.order),r}function fP(e,t,r){const n=hc(t);if(n)for(let o=0;o{fP(e,o,r)})}function gg(e,t){const r=hc(t);if(r){let n=0;for(let o=0;o0?r:void 0)}dg(t,n=>{gg(e,n)})}function dP(e,t){const r=lh(uP(e,t)),n=V5(e.transactionQueueTree_,t);return kee(n,o=>{U2(e,o)}),U2(e,n),rP(n,o=>{U2(e,o)}),r}function U2(e,t){const r=hc(t);if(r){const n=[];let o=[],i=-1;for(let a=0;a{uC(e,n,o,i,a)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>cC(e,!0),0);else{if(typeof r<"u"&&r!==null){if(typeof r!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Yr(r)}catch(n){throw new Error("Invalid authOverride provided: "+n)}}e.persistentConnection_=new Yo(e.repoInfo_,t,(n,o,i,a)=>{uC(e,n,o,i,a)},n=>{cC(e,n)},n=>{Cee(e,n)},e.authTokenProvider_,e.appCheckProvider_,r),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(n=>{e.server_.refreshAuthToken(n)}),e.appCheckProvider_.addTokenChangeListener(n=>{e.server_.refreshAppCheckToken(n.token)}),e.statsReporter_=oX(e.repoInfo_,()=>new nJ(e.stats_,e.server_)),e.infoData_=new XX,e.infoSyncTree_=new sC({startListening:(n,o,i,a)=>{let s=[];const l=e.infoData_.getNode(n._path);return l.isEmpty()||(s=ah(e.infoSyncTree_,n._path,l),setTimeout(()=>{a("ok")},0)),s},stopListening:()=>{}}),Z5(e,"connected",!1),e.serverSyncTree_=new sC({startListening:(n,o,i,a)=>(e.server_.listen(n,i,o,(s,l)=>{const u=a(s,l);ko(e.eventQueue_,n._path,u)}),[]),stopListening:(n,o)=>{e.server_.unlisten(n,o)}})}function See(e){const r=e.infoData_.getNode(new mr(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function K5(e){return ree({timestamp:See(e)})}function uC(e,t,r,n,o){e.dataUpdateCount++;const i=new mr(t);r=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,r):r;let a=[];if(o)if(n){const l=Np(r,u=>an(u));a=GJ(e.serverSyncTree_,i,l,o)}else{const l=an(r);a=GB(e.serverSyncTree_,i,l,o)}else if(n){const l=Np(r,u=>an(u));a=HJ(e.serverSyncTree_,i,l)}else{const l=an(r);a=ah(e.serverSyncTree_,i,l)}let s=i;a.length>0&&(s=pg(e,i)),ko(e.eventQueue_,s,a)}function cC(e,t){Z5(e,"connected",t),t===!1&&Aee(e)}function Cee(e,t){ii(t,(r,n)=>{Z5(e,r,n)})}function Z5(e,t,r){const n=new mr("/.info/"+t),o=an(r);e.infoData_.updateSnapshot(n,o);const i=ah(e.infoSyncTree_,n,o);ko(e.eventQueue_,n,i)}function sP(e){return e.nextWriteId_++}function Eee(e,t,r){const n=QJ(e.serverSyncTree_,t);return n!=null?Promise.resolve(n):e.server_.get(t).then(o=>{const i=an(o).withIndex(t._queryParams.getIndex());YJ(e.serverSyncTree_,t,r,!0);let a;if(t._queryParams.loadsAllData())a=ah(e.serverSyncTree_,t._path,i);else{const s=Td(e.serverSyncTree_,t);a=GB(e.serverSyncTree_,t._path,i,s)}return ko(e.eventQueue_,t._path,a),ZB(e.serverSyncTree_,t,r,null,!0),i},o=>(hg(e,"get for query "+Yr(t)+" failed: "+o),Promise.reject(new Error(o))))}function kee(e,t,r,n,o){hg(e,"set",{path:t.toString(),value:r,priority:n});const i=K5(e),a=an(r,n),s=D5(e.serverSyncTree_,t),l=JB(a,s,i),u=sP(e),c=KB(e.serverSyncTree_,t,l,u,!0);aP(e.eventQueue_,c),e.server_.put(t.toString(),a.val(!0),(d,p)=>{const v=d==="ok";v||ni("set at "+t+" failed: "+d);const b=zs(e.serverSyncTree_,u,!v);ko(e.eventQueue_,t,b),Iee(e,o,d,p)});const h=dP(e,t);pg(e,h),ko(e.eventQueue_,h,[])}function Aee(e){hg(e,"onDisconnectEvents");const t=K5(e),r=$p();L4(e.onDisconnect_,sr(),(o,i)=>{const a=oee(o,i,e.serverSyncTree_,t);BB(r,o,a)});let n=[];L4(r,sr(),(o,i)=>{n=n.concat(ah(e.serverSyncTree_,o,i));const a=dP(e,o);pg(e,a)}),e.onDisconnect_=$p(),ko(e.eventQueue_,sr(),n)}function Mee(e){e.persistentConnection_&&e.persistentConnection_.interrupt(bee)}function hg(e,...t){let r="";e.persistentConnection_&&(r=e.persistentConnection_.id+":"),En(r,...t)}function Iee(e,t,r,n){t&&dc(()=>{if(r==="ok")t(null);else{const o=(r||"error").toUpperCase();let i=o;n&&(i+=": "+n);const a=new Error(i);a.code=o,t(a)}})}function lP(e,t,r){return D5(e.serverSyncTree_,t,r)||Ot.EMPTY_NODE}function G5(e,t=e.transactionQueueTree_){if(t||gg(e,t),hc(t)){const r=cP(e,t);it(r.length>0,"Sending zero length transaction queue"),r.every(o=>o.status===0)&&Tee(e,lh(t),r)}else tP(t)&&dg(t,r=>{G5(e,r)})}function Tee(e,t,r){const n=r.map(u=>u.currentWriteId),o=lP(e,t,n);let i=o;const a=o.hash();for(let u=0;u{hg(e,"transaction put response",{path:l.toString(),status:u});let c=[];if(u==="ok"){const h=[];for(let d=0;dr[d].onComplete(null,!0,r[d].currentOutputSnapshotResolved)),r[d].unwatcher();gg(e,V5(e.transactionQueueTree_,t)),G5(e,e.transactionQueueTree_),ko(e.eventQueue_,t,c);for(let d=0;ds.status===0).map(s=>s.currentWriteId);for(let s=0;s=wee)c=!0,h="maxretry",o=o.concat(zs(e.serverSyncTree_,l.currentWriteId,!0));else{const d=lP(e,l.path,a);l.currentInputSnapshot=d;const p=t[s].update(d.val());if(p!==void 0){H5("transaction failed: Data returned ",p,l.path);let v=an(p);typeof p=="object"&&p!=null&&pa(p,".priority")||(v=v.updatePriority(d.getPriority()));const S=l.currentWriteId,x=K5(e),k=JB(v,d,x);l.currentOutputSnapshotRaw=v,l.currentOutputSnapshotResolved=k,l.currentWriteId=sP(e),a.splice(a.indexOf(S),1),o=o.concat(KB(e.serverSyncTree_,l.path,k,l.currentWriteId,l.applyLocally)),o=o.concat(zs(e.serverSyncTree_,S,!0))}else c=!0,h="nodata",o=o.concat(zs(e.serverSyncTree_,l.currentWriteId,!0))}ko(e.eventQueue_,r,o),o=[],c&&(t[s].status=2,function(d){setTimeout(d,Math.floor(0))}(t[s].unwatcher),t[s].onComplete&&(h==="nodata"?n.push(()=>t[s].onComplete(null,!1,t[s].currentInputSnapshot)):n.push(()=>t[s].onComplete(new Error(h),!1,null))))}gg(e,e.transactionQueueTree_);for(let s=0;sn.order-o.order),r}function fP(e,t,r){const n=hc(t);if(n)for(let o=0;o{fP(e,o,r)})}function gg(e,t){const r=hc(t);if(r){let n=0;for(let o=0;o0?r:void 0)}dg(t,n=>{gg(e,n)})}function dP(e,t){const r=lh(uP(e,t)),n=V5(e.transactionQueueTree_,t);return see(n,o=>{U2(e,o)}),U2(e,n),rP(n,o=>{U2(e,o)}),r}function U2(e,t){const r=hc(t);if(r){const n=[];let o=[],i=-1;for(let a=0;a0){let o=r[n];try{o=decodeURIComponent(o.replace(/\+/g," "))}catch{}t+="/"+o}return t}function Xee(e){const t={};e.charAt(0)==="?"&&(e=e.substring(1));for(const r of e.split("&")){if(r.length===0)continue;const n=r.split("=");n.length===2?t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]):ni(`Invalid query segment '${r}' in query '${e}'`)}return t}const cC=function(e,t){const r=Jee(e),n=r.namespace;r.domain==="firebase.com"&&sa(r.host+" is no longer supported. Please use .firebaseio.com instead"),(!n||n==="undefined")&&r.domain!=="localhost"&&sa("Cannot parse Firebase url. Please use https://.firebaseio.com"),r.secure||cX();const o=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new fB(r.host,r.secure,n,o,t,"",n!==r.subdomain),path:new mr(r.pathString)}},Jee=function(e){let t="",r="",n="",o="",i="",a=!0,s="https",l=443;if(typeof e=="string"){let u=e.indexOf("//");u>=0&&(s=e.substring(0,u-1),e=e.substring(u+2));let c=e.indexOf("/");c===-1&&(c=e.length);let h=e.indexOf("?");h===-1&&(h=e.length),t=e.substring(0,Math.min(c,h)),c=0?(a=s==="https"||s==="wss",l=parseInt(t.substring(u+1),10)):u=t.length;const p=t.slice(0,u);if(p.toLowerCase()==="localhost")r="localhost";else if(p.split(".").length<=2)r=p;else{const v=t.indexOf(".");n=t.substring(0,v).toLowerCase(),r=t.substring(v+1),i=n}"ns"in d&&(i=d.ns)}return{host:t,port:l,domain:r,subdomain:n,secure:a,scheme:s,pathString:o,namespace:i}};/** + */function Pee(e){let t="";const r=e.split("/");for(let n=0;n0){let o=r[n];try{o=decodeURIComponent(o.replace(/\+/g," "))}catch{}t+="/"+o}return t}function Ree(e){const t={};e.charAt(0)==="?"&&(e=e.substring(1));for(const r of e.split("&")){if(r.length===0)continue;const n=r.split("=");n.length===2?t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]):ni(`Invalid query segment '${r}' in query '${e}'`)}return t}const fC=function(e,t){const r=Oee(e),n=r.namespace;r.domain==="firebase.com"&&sa(r.host+" is no longer supported. Please use .firebaseio.com instead"),(!n||n==="undefined")&&r.domain!=="localhost"&&sa("Cannot parse Firebase url. Please use https://.firebaseio.com"),r.secure||VQ();const o=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new fB(r.host,r.secure,n,o,t,"",n!==r.subdomain),path:new mr(r.pathString)}},Oee=function(e){let t="",r="",n="",o="",i="",a=!0,s="https",l=443;if(typeof e=="string"){let u=e.indexOf("//");u>=0&&(s=e.substring(0,u-1),e=e.substring(u+2));let c=e.indexOf("/");c===-1&&(c=e.length);let h=e.indexOf("?");h===-1&&(h=e.length),t=e.substring(0,Math.min(c,h)),c=0?(a=s==="https"||s==="wss",l=parseInt(t.substring(u+1),10)):u=t.length;const p=t.slice(0,u);if(p.toLowerCase()==="localhost")r="localhost";else if(p.split(".").length<=2)r=p;else{const v=t.indexOf(".");n=t.substring(0,v).toLowerCase(),r=t.substring(v+1),i=n}"ns"in d&&(i=d.ns)}return{host:t,port:l,domain:r,subdomain:n,secure:a,scheme:s,pathString:o,namespace:i}};/** * @license * Copyright 2017 Google LLC * @@ -2711,7 +2711,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class ete{constructor(t,r,n,o){this.eventType=t,this.eventRegistration=r,this.snapshot=n,this.prevName=o}getPath(){const t=this.snapshot.ref;return this.eventType==="value"?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+Yr(this.snapshot.exportVal())}}class tte{constructor(t,r,n){this.eventRegistration=t,this.error=r,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/** + */class Nee{constructor(t,r,n,o){this.eventType=t,this.eventRegistration=r,this.snapshot=n,this.prevName=o}getPath(){const t=this.snapshot.ref;return this.eventType==="value"?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+Yr(this.snapshot.exportVal())}}class Lee{constructor(t,r,n){this.eventRegistration=t,this.error=r,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/** * @license * Copyright 2017 Google LLC * @@ -2726,7 +2726,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class rte{constructor(t,r){this.snapshotCallback=t,this.cancelCallback=r}onValue(t,r){this.snapshotCallback.call(null,t,r)}onCancel(t){return it(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}/** + */class Dee{constructor(t,r){this.snapshotCallback=t,this.cancelCallback=r}onValue(t,r){this.snapshotCallback.call(null,t,r)}onCancel(t){return it(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}/** * @license * Copyright 2020 Google LLC * @@ -2741,7 +2741,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */class Y5{constructor(t,r,n,o){this._repo=t,this._path=r,this._queryParams=n,this._orderByCalled=o}get key(){return Qt(this._path)?null:wB(this._path)}get ref(){return new ga(this._repo,this._path)}get _queryIdentifier(){const t=GS(this._queryParams),r=S5(t);return r==="{}"?"default":r}get _queryObject(){return GS(this._queryParams)}isEqual(t){if(t=cc(t),!(t instanceof Y5))return!1;const r=this._repo===t._repo,n=SB(this._path,t._path),o=this._queryIdentifier===t._queryIdentifier;return r&&n&&o}toJSON(){return this.toString()}toString(){return this._repo.toString()+KX(this._path)}}class ga extends Y5{constructor(t,r){super(t,r,new T5,!1)}get parent(){const t=xB(this._path);return t===null?null:new ga(this._repo,t)}get root(){let t=this;for(;t.parent!==null;)t=t.parent;return t}}class Bd{constructor(t,r,n){this._node=t,this.ref=r,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const r=new mr(t),n=q4(this.ref,t);return new Bd(this._node.getChild(r),n,Ur)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(n,o)=>t(new Bd(o,q4(this.ref,n),Ur)))}hasChild(t){const r=new mr(t);return!this._node.getChild(r).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function hP(e,t){return e=cc(e),e._checkNotDeleted("ref"),t!==void 0?q4(e._root,t):e._root}function q4(e,t){return e=cc(e),Xt(e._path)===null?Pee("child","path",t,!1):oP("child","path",t,!1),new ga(e._repo,Qr(e._path,t))}function nte(e,t){e=cc(e),Ree("set",e._path),Bee("set",t,e._path,!1);const r=new og;return Vee(e._repo,e._path,t,null,r.wrapCallback(()=>{})),r.promise}function ite(e){e=cc(e);const t=new rte(()=>{}),r=new Q5(t);return Wee(e._repo,e,r).then(n=>new Bd(n,new ga(e._repo,e._path),e._queryParams.getIndex()))}class Q5{constructor(t){this.callbackContext=t}respondsTo(t){return t==="value"}createEvent(t,r){const n=r._queryParams.getIndex();return new ete("value",this,new Bd(t.snapshotNode,new ga(r._repo,r._path),n))}getEventRunner(t){return t.getEventType()==="cancel"?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,r){return this.callbackContext.hasCancelCallback?new tte(this,t,r):null}matches(t){return t instanceof Q5?!t.callbackContext||!this.callbackContext?!0:t.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}nee(ga);lee(ga);/** + */class Y5{constructor(t,r,n,o){this._repo=t,this._path=r,this._queryParams=n,this._orderByCalled=o}get key(){return Qt(this._path)?null:wB(this._path)}get ref(){return new ga(this._repo,this._path)}get _queryIdentifier(){const t=YS(this._queryParams),r=S5(t);return r==="{}"?"default":r}get _queryObject(){return YS(this._queryParams)}isEqual(t){if(t=cc(t),!(t instanceof Y5))return!1;const r=this._repo===t._repo,n=SB(this._path,t._path),o=this._queryIdentifier===t._queryIdentifier;return r&&n&&o}toJSON(){return this.toString()}toString(){return this._repo.toString()+MX(this._path)}}class ga extends Y5{constructor(t,r){super(t,r,new T5,!1)}get parent(){const t=xB(this._path);return t===null?null:new ga(this._repo,t)}get root(){let t=this;for(;t.parent!==null;)t=t.parent;return t}}class Bd{constructor(t,r,n){this._node=t,this.ref=r,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const r=new mr(t),n=$4(this.ref,t);return new Bd(this._node.getChild(r),n,Ur)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(n,o)=>t(new Bd(o,$4(this.ref,n),Ur)))}hasChild(t){const r=new mr(t);return!this._node.getChild(r).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function hP(e,t){return e=cc(e),e._checkNotDeleted("ref"),t!==void 0?$4(e._root,t):e._root}function $4(e,t){return e=cc(e),Xt(e._path)===null?hee("child","path",t,!1):oP("child","path",t,!1),new ga(e._repo,Qr(e._path,t))}function Uee(e,t){e=cc(e),pee("set",e._path),dee("set",t,e._path,!1);const r=new og;return kee(e._repo,e._path,t,null,r.wrapCallback(()=>{})),r.promise}function jee(e){e=cc(e);const t=new Dee(()=>{}),r=new Q5(t);return Eee(e._repo,e,r).then(n=>new Bd(n,new ga(e._repo,e._path),e._queryParams.getIndex()))}class Q5{constructor(t){this.callbackContext=t}respondsTo(t){return t==="value"}createEvent(t,r){const n=r._queryParams.getIndex();return new Nee("value",this,new Bd(t.snapshotNode,new ga(r._repo,r._path),n))}getEventRunner(t){return t.getEventType()==="cancel"?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,r){return this.callbackContext.hasCancelCallback?new Lee(this,t,r):null}matches(t){return t instanceof Q5?!t.callbackContext||!this.callbackContext?!0:t.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}UJ(ga);qJ(ga);/** * @license * Copyright 2020 Google LLC * @@ -2756,7 +2756,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */const ote="FIREBASE_DATABASE_EMULATOR_HOST",W4={};let ate=!1;function ste(e,t,r,n){e.repoInfo_=new fB(`${t}:${r}`,!1,e.repoInfo_.namespace,e.repoInfo_.webSocketOnly,e.repoInfo_.nodeAdmin,e.repoInfo_.persistenceKey,e.repoInfo_.includeNamespaceInQueryParams,!0),n&&(e.authTokenProvider_=n)}function lte(e,t,r,n,o){let i=n||e.options.databaseURL;i===void 0&&(e.options.projectId||sa("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),En("Using default host for project ",e.options.projectId),i=`${e.options.projectId}-default-rtdb.firebaseio.com`);let a=cC(i,o),s=a.repoInfo,l,u;typeof _t<"u"&&_t.env&&(u=_t.env[ote]),u?(l=!0,i=`http://${u}?ns=${s.namespace}`,a=cC(i,o),s=a.repoInfo):l=!a.repoInfo.secure;const c=o&&l?new ku(ku.OWNER):new _X(e.name,e.options,t);Oee("Invalid Firebase Database URL",a),Qt(a.path)||sa("Database URL must point to the root of a Firebase Database (not including a child path).");const h=cte(s,e,c,new wX(e.name,r));return new fte(h,e)}function ute(e,t){const r=W4[t];(!r||r[e.key]!==e)&&sa(`Database ${t}(${e.repoInfo_}) has already been deleted.`),Kee(e),delete r[e.key]}function cte(e,t,r,n){let o=W4[t.name];o||(o={},W4[t.name]=o);let i=o[e.toURLString()];return i&&sa("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new Fee(e,ate,r,n),o[e.toURLString()]=i,i}class fte{constructor(t,r){this._repoInternal=t,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(zee(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ga(this._repo,sr())),this._rootInternal}_delete(){return this._rootInternal!==null&&(ute(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){this._rootInternal===null&&sa("Cannot call "+t+" on a deleted database.")}}function dte(e=KQ(),t){const r=qQ(e,"database").getImmediate({identifier:t});if(!r._instanceStarted){const n=OY("database");n&&hte(r,...n)}return r}function hte(e,t,r,n={}){e=cc(e),e._checkNotDeleted("useEmulator"),e._instanceStarted&&sa("Cannot call useEmulator() after instance has already been initialized.");const o=e._repoInternal;let i;if(o.repoInfo_.nodeAdmin)n.mockUserToken&&sa('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),i=new ku(ku.OWNER);else if(n.mockUserToken){const a=typeof n.mockUserToken=="string"?n.mockUserToken:NY(n.mockUserToken,e.app.options.projectId);i=new ku(a)}ste(o,t,r,i)}/** + */const Fee="FIREBASE_DATABASE_EMULATOR_HOST",q4={};let zee=!1;function $ee(e,t,r,n){e.repoInfo_=new fB(`${t}:${r}`,!1,e.repoInfo_.namespace,e.repoInfo_.webSocketOnly,e.repoInfo_.nodeAdmin,e.repoInfo_.persistenceKey,e.repoInfo_.includeNamespaceInQueryParams,!0),n&&(e.authTokenProvider_=n)}function qee(e,t,r,n,o){let i=n||e.options.databaseURL;i===void 0&&(e.options.projectId||sa("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),En("Using default host for project ",e.options.projectId),i=`${e.options.projectId}-default-rtdb.firebaseio.com`);let a=fC(i,o),s=a.repoInfo,l,u;typeof _t<"u"&&_t.env&&(u=_t.env[Fee]),u?(l=!0,i=`http://${u}?ns=${s.namespace}`,a=fC(i,o),s=a.repoInfo):l=!a.repoInfo.secure;const c=o&&l?new ku(ku.OWNER):new rX(e.name,e.options,t);gee("Invalid Firebase Database URL",a),Qt(a.path)||sa("Database URL must point to the root of a Firebase Database (not including a child path).");const h=Vee(s,e,c,new tX(e.name,r));return new Hee(h,e)}function Wee(e,t){const r=q4[t];(!r||r[e.key]!==e)&&sa(`Database ${t}(${e.repoInfo_}) has already been deleted.`),Mee(e),delete r[e.key]}function Vee(e,t,r,n){let o=q4[t.name];o||(o={},q4[t.name]=o);let i=o[e.toURLString()];return i&&sa("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new _ee(e,zee,r,n),o[e.toURLString()]=i,i}class Hee{constructor(t,r){this._repoInternal=t,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(xee(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ga(this._repo,sr())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Wee(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){this._rootInternal===null&&sa("Cannot call "+t+" on a deleted database.")}}function Kee(e=MQ(),t){const r=CQ(e,"database").getImmediate({identifier:t});if(!r._instanceStarted){const n=gY("database");n&&Zee(r,...n)}return r}function Zee(e,t,r,n={}){e=cc(e),e._checkNotDeleted("useEmulator"),e._instanceStarted&&sa("Cannot call useEmulator() after instance has already been initialized.");const o=e._repoInternal;let i;if(o.repoInfo_.nodeAdmin)n.mockUserToken&&sa('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),i=new ku(ku.OWNER);else if(n.mockUserToken){const a=typeof n.mockUserToken=="string"?n.mockUserToken:mY(n.mockUserToken,e.app.options.projectId);i=new ku(a)}$ee(o,t,r,i)}/** * @license * Copyright 2021 Google LLC * @@ -2771,16 +2771,16 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function pte(e){oX(HQ),Dp(new xd("database",(t,{instanceIdentifier:r})=>{const n=t.getProvider("app").getImmediate(),o=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal");return lte(n,o,i,r)},"PUBLIC").setMultipleInstances(!0)),Cu(PS,RS,e),Cu(PS,RS,"esm2017")}Yo.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)};Yo.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)};pte();const gte={apiKey:"AIzaSyDdGHaeIrFIy-Xw_WR_Hl7I7E9Z55tUW_w",authDomain:"tapracesprint.firebaseapp.com",projectId:"tapracesprint",storageBucket:"tapracesprint.appspot.com",messagingSenderId:"447540828275",appId:"1:447540828275:web:77340961502f57723df206",measurementId:"G-6SBRL43LZM",databaseURL:"https://tapracesprint-default-rtdb.europe-west1.firebasedatabase.app/"},mte=KT(gte),pP=dte(mte),gP=hP(pP,"leaderboard");hP(pP,"users");const vte=async()=>{const t=(await ite(gP)).val();return t?Object.values(t):[]},fC=async e=>{const t={};e.forEach((r,n)=>{t[`entry_${n}`]=r}),await nte(gP,t)};var $i={},mg={},kn=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof kn<"u"&&kn,Zn={searchParams:"URLSearchParams"in kn,iterable:"Symbol"in kn&&"iterator"in Symbol,blob:"FileReader"in kn&&"Blob"in kn&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in kn,arrayBuffer:"ArrayBuffer"in kn};function yte(e){return e&&DataView.prototype.isPrototypeOf(e)}if(Zn.arrayBuffer)var bte=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],wte=ArrayBuffer.isView||function(e){return e&&bte.indexOf(Object.prototype.toString.call(e))>-1};function uh(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function X5(e){return typeof e!="string"&&(e=String(e)),e}function J5(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return Zn.iterable&&(t[Symbol.iterator]=function(){return t}),t}function Jr(e){this.map={},e instanceof Jr?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}Jr.prototype.append=function(e,t){e=uh(e),t=X5(t);var r=this.map[e];this.map[e]=r?r+", "+t:t};Jr.prototype.delete=function(e){delete this.map[uh(e)]};Jr.prototype.get=function(e){return e=uh(e),this.has(e)?this.map[e]:null};Jr.prototype.has=function(e){return this.map.hasOwnProperty(uh(e))};Jr.prototype.set=function(e,t){this.map[uh(e)]=X5(t)};Jr.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)};Jr.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),J5(e)};Jr.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),J5(e)};Jr.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),J5(e)};Zn.iterable&&(Jr.prototype[Symbol.iterator]=Jr.prototype.entries);function j2(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function mP(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function _te(e){var t=new FileReader,r=mP(t);return t.readAsArrayBuffer(e),r}function xte(e){var t=new FileReader,r=mP(t);return t.readAsText(e),r}function Ste(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?t:e}function sl(e,t){if(!(this instanceof sl))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof sl){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Jr(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new Jr(t.headers)),this.method=Ete(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}sl.prototype.clone=function(){return new sl(this,{body:this._bodyInit})};function kte(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(i))}}),t}function Ate(e){var t=new Jr,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(` -`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();t.append(i,a)}}),t}vP.call(sl.prototype);function Ao(e,t){if(!(this instanceof Ao))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new Jr(t.headers),this.url=t.url||"",this._initBody(e)}vP.call(Ao.prototype);Ao.prototype.clone=function(){return new Ao(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Jr(this.headers),url:this.url})};Ao.error=function(){var e=new Ao(null,{status:0,statusText:""});return e.type="error",e};var Mte=[301,302,303,307,308];Ao.redirect=function(e,t){if(Mte.indexOf(t)===-1)throw new RangeError("Invalid status code");return new Ao(null,{status:t,headers:{location:e}})};var Rs=kn.DOMException;try{new Rs}catch{Rs=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},Rs.prototype=Object.create(Error.prototype),Rs.prototype.constructor=Rs}function yP(e,t){return new Promise(function(r,n){var o=new sl(e,t);if(o.signal&&o.signal.aborted)return n(new Rs("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={status:i.status,statusText:i.statusText,headers:Ate(i.getAllResponseHeaders()||"")};l.url="responseURL"in i?i.responseURL:l.headers.get("X-Request-URL");var u="response"in i?i.response:i.responseText;setTimeout(function(){r(new Ao(u,l))},0)},i.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.onabort=function(){setTimeout(function(){n(new Rs("Aborted","AbortError"))},0)};function s(l){try{return l===""&&kn.location.href?kn.location.href:l}catch{return l}}i.open(o.method,s(o.url),!0),o.credentials==="include"?i.withCredentials=!0:o.credentials==="omit"&&(i.withCredentials=!1),"responseType"in i&&(Zn.blob?i.responseType="blob":Zn.arrayBuffer&&o.headers.get("Content-Type")&&o.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(i.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof Jr)?Object.getOwnPropertyNames(t.headers).forEach(function(l){i.setRequestHeader(l,X5(t.headers[l]))}):o.headers.forEach(function(l,u){i.setRequestHeader(u,l)}),o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}yP.polyfill=!0;kn.fetch||(kn.fetch=yP,kn.Headers=Jr,kn.Request=sl,kn.Response=Ao);self.fetch.bind(self);var Ite=Ze&&Ze.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{u(n.next(c))}catch(h){a(h)}}function l(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(mg,"__esModule",{value:!0});mg.Nodes=void 0;class Tte{constructor(){this.nodeIndex=-1,this.committee=new Set,this.topology=[]}init(t){return Ite(this,void 0,void 0,function*(){this.nodeIndex=-1,this.committee.clear(),this.topology=[];let r=[];try{r=yield(yield fetch(t)).json()}catch(n){throw new Error(`exception in fetch(${t}): ${n}`)}for(const n of r)n.Healthy==="1"&&this.topology.push(n);if(this.topology.length===0)throw new Error("no healthy nodes retrieved")})}getNextNode(t=!0){for(;;)return this.nodeIndex++,this.nodeIndex>=this.topology.length&&(this.nodeIndex=0),this.topology[this.nodeIndex]}getRandomNode(t=!0){const r=Math.floor(Math.random()*this.topology.length);return this.topology[r]}}mg.Nodes=Tte;var pc=Ze&&Ze.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{u(n.next(c))}catch(h){a(h)}}function l(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty($i,"__esModule",{value:!0});$i.getHttpV4Endpoint=$i.getHttpV4Endpoints=e6=$i.getHttpEndpoint=$i.getHttpEndpoints=$i.Access=void 0;const Bte=mg;class bP{constructor(){this.host="ton.access.orbs.network",this.urlVersion=1,this.nodes=new Bte.Nodes}init(){return pc(this,void 0,void 0,function*(){yield this.nodes.init(`https://${this.host}/nodes`)})}buildUrls(t,r,n){n||(n=""),n.length&&(n=n.replace(/^\/+/,""));const o=[],i=this.nodes.topology.length;for(let a=0;a0;)r<<=1,o&i&&(r+=1),i>>=1,r>65535&&(r&=65535,r^=4129)}return Oe.Buffer.from([Math.floor(r/256),r%256])}mc.crc16=Nte;var Lte=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},SP;Object.defineProperty(hi,"__esModule",{value:!0});hi.address=hi.Address=void 0;const Dte=Lte(gc),CP=mc,V4=17,EP=81,H4=128;function hC(e){if(typeof e=="string"&&!ji.isFriendly(e))throw new Error("Unknown address type");const t=Oe.Buffer.isBuffer(e)?e:Oe.Buffer.from(e,"base64");if(t.length!==36)throw new Error("Unknown address type: byte length is not equal to 36");const r=t.subarray(0,34),n=t.subarray(34,36),o=(0,CP.crc16)(r);if(!(o[0]===n[0]&&o[1]===n[1]))throw new Error("Invalid checksum: "+e);let i=r[0],a=!1,s=!1;if(i&H4&&(a=!0,i=i^H4),i!==V4&&i!==EP)throw"Unknown address tag";s=i===V4;let l=null;r[1]===255?l=-1:l=r[1];const u=r.subarray(2,34);return{isTestOnly:a,isBounceable:s,workchain:l,hashPart:u}}class ji{static isAddress(t){return t instanceof ji}static isFriendly(t){return!(t.length!==48||!/[A-Za-z0-9+/_-]+/.test(t))}static isRaw(t){if(t.indexOf(":")===-1)return!1;let[r,n]=t.split(":");return!(!Number.isInteger(parseFloat(r))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t=="string"?ji.parse(t).toString():t.toString()}static parse(t){if(ji.isFriendly(t))return this.parseFriendly(t).address;if(ji.isRaw(t))return this.parseRaw(t);throw new Error("Unknown address type: "+t)}static parseRaw(t){let r=parseInt(t.split(":")[0]),n=Oe.Buffer.from(t.split(":")[1],"hex");return new ji(r,n)}static parseFriendly(t){if(Oe.Buffer.isBuffer(t)){let r=hC(t);return{isBounceable:r.isBounceable,isTestOnly:r.isTestOnly,address:new ji(r.workchain,r.hashPart)}}else{let r=t.replace(/\-/g,"+").replace(/_/g,"/"),n=hC(r);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new ji(n.workchain,n.hashPart)}}}constructor(t,r){if(this.toRawString=()=>this.workChain+":"+this.hash.toString("hex"),this.toRaw=()=>{const n=Oe.Buffer.alloc(36);return n.set(this.hash),n.set([this.workChain,this.workChain,this.workChain,this.workChain],32),n},this.toStringBuffer=n=>{let o=n&&n.testOnly!==void 0?n.testOnly:!1,a=(n&&n.bounceable!==void 0?n.bounceable:!0)?V4:EP;o&&(a|=H4);const s=Oe.Buffer.alloc(34);s[0]=a,s[1]=this.workChain,s.set(this.hash,2);const l=Oe.Buffer.alloc(36);return l.set(s),l.set((0,CP.crc16)(s),34),l},this.toString=n=>{let o=n&&n.urlSafe!==void 0?n.urlSafe:!0,i=this.toStringBuffer(n);return o?i.toString("base64").replace(/\+/g,"-").replace(/\//g,"_"):i.toString("base64")},this[SP]=()=>this.toString(),r.length!==32)throw new Error("Invalid address hash length: "+r.length);this.workChain=t,this.hash=r,Object.freeze(this)}equals(t){return t.workChain!==this.workChain?!1:t.hash.equals(this.hash)}}hi.Address=ji;SP=Dte.default;function Ute(e){return ji.parse(e)}hi.address=Ute;var vc={},jte=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},kP;Object.defineProperty(vc,"__esModule",{value:!0});vc.ExternalAddress=void 0;const Fte=jte(gc);class t6{static isAddress(t){return t instanceof t6}constructor(t,r){this[kP]=()=>this.toString(),this.value=t,this.bits=r}toString(){return`External<${this.bits}:${this.value}>`}}vc.ExternalAddress=t6;kP=Fte.default;var vg={},ll={};Object.defineProperty(ll,"__esModule",{value:!0});ll.base32Decode=ll.base32Encode=void 0;const K4="abcdefghijklmnopqrstuvwxyz234567";function zte(e){const t=e.byteLength;let r=0,n=0,o="";for(let i=0;i=5;)o+=K4[n>>>r-5&31],r-=5;return r>0&&(o+=K4[n<<5-r&31]),o}ll.base32Encode=zte;function $te(e,t){const r=e.indexOf(t);if(r===-1)throw new Error("Invalid character found: "+t);return r}function qte(e){let t;t=e.toLowerCase();const{length:r}=t;let n=0,o=0,i=0;const a=Oe.Buffer.alloc(r*5/8|0);for(let s=0;s=8&&(a[i++]=o>>>n-8&255,n-=8);return a}ll.base32Decode=qte;var Wte=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},AP;Object.defineProperty(vg,"__esModule",{value:!0});vg.ADNLAddress=void 0;const Vte=Wte(gc),pC=ll,gC=mc;class Yp{static parseFriendly(t){if(t.length!==55)throw Error("Invalid address");t="f"+t;let r=(0,pC.base32Decode)(t);if(r[0]!==45)throw Error("Invalid address");let n=r.slice(33);if(!(0,gC.crc16)(r.slice(0,33)).equals(n))throw Error("Invalid address");return new Yp(r.slice(1,33))}static parseRaw(t){const r=Oe.Buffer.from(t,"base64");return new Yp(r)}constructor(t){if(this.toRaw=()=>this.address.toString("hex").toUpperCase(),this.toString=()=>{let r=Oe.Buffer.concat([Oe.Buffer.from([45]),this.address]),n=(0,gC.crc16)(r);return r=Oe.Buffer.concat([r,n]),(0,pC.base32Encode)(r).slice(1)},this[AP]=()=>this.toString(),t.length!==32)throw Error("Invalid address");this.address=t}equals(t){return this.address.equals(t.address)}}vg.ADNLAddress=Yp;AP=Vte.default;var yg={},_s={},Uc={},jc={},xs={},mC;function bg(){if(mC)return xs;mC=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.paddedBufferToBits=xs.bitsToPaddedBuffer=void 0;const e=wg(),t=ms();function r(o){let i=new e.BitBuilder(Math.ceil(o.length/8)*8);i.writeBits(o);let a=Math.ceil(o.length/8)*8-o.length;for(let s=0;s=0;a--)if(o[a]!==0){const s=o[a];let l=s&-s;l&1||(l=Math.log2(l)+1),a>0&&(i=a<<3),i+=8-l;break}return new t.BitString(o,0,i)}return xs.paddedBufferToBits=n,xs}var vC;function ms(){if(vC)return jc;vC=1;var e=Ze&&Ze.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t;Object.defineProperty(jc,"__esModule",{value:!0}),jc.BitString=void 0;const r=bg(),n=e(gc);let o=class{static isBitString(a){return a instanceof o}constructor(a,s,l){if(this[t]=()=>this.toString(),l<0)throw new Error(`Length ${l} is out of bounds`);this._length=l,this._data=a,this._offset=s}get length(){return this._length}at(a){if(a>=this._length)throw new Error(`Index ${a} > ${this._length} is out of bounds`);if(a<0)throw new Error(`Index ${a} < 0 is out of bounds`);let s=this._offset+a>>3,l=7-(this._offset+a)%8;return(this._data[s]&1<this._length)throw new Error(`Offset(${a}) > ${this._length} is out of bounds`);if(a<0)throw new Error(`Offset(${a}) < 0 is out of bounds`);if(s===0)return o.EMPTY;if(a+s>this._length)throw new Error(`Offset ${a} + Length ${s} > ${this._length} is out of bounds`);return new o(this._data,this._offset+a,s)}subbuffer(a,s){if(a>this._length)throw new Error(`Offset ${a} is out of bounds`);if(a<0)throw new Error(`Offset ${a} is out of bounds`);if(a+s>this._length)throw new Error(`Offset + Lenght = ${a+s} is out of bounds`);if(s%8!==0||(this._offset+a)%8!==0)return null;let l=this._offset+a>>3,u=l+(s>>3);return this._data.subarray(l,u)}equals(a){if(this._length!==a._length)return!1;for(let s=0;sthis._buffer.length*8)throw new Error("BitBuilder overflow");(typeof i=="boolean"&&i===!0||typeof i=="number"&&i>0)&&(this._buffer[a/8|0]|=1<<7-a%8),this._length++}writeBits(i){for(let a=0;athis._buffer.length*8)throw new Error("BitBuilder overflow");i.copy(this._buffer,this._length/8),this._length+=i.length*8}else for(let a=0;a=l)throw Error(`bitLength is too small for a value ${i}. Got ${a}`);if(this._length+a>this._buffer.length*8)throw new Error("BitBuilder overflow");const u=8-this._length%8;if(u>0){const c=Math.floor(this._length/8);if(a>BigInt(a-u));this._buffer[c]|=h,this._length+=u}}for(a-=u;a>0;)a>=8?(this._buffer[this._length/8]=Number(s>>BigInt(a-8)&0xffn),this._length+=8,a-=8):(this._buffer[this._length/8]=Number(s<=l)throw Error(`value is out of range for ${a} bits. Got ${i}`);s<0?(this.writeBit(!0),s=l+s):this.writeBit(!1),this.writeUint(s,a-1)}writeVarUint(i,a){let s=BigInt(i);if(a<0||!Number.isSafeInteger(a))throw Error(`invalid bit length. Got ${a}`);if(s<0)throw Error(`value is negative. Got ${i}`);if(s===0n){this.writeUint(0,a);return}const l=Math.ceil(s.toString(2).length/8),u=l*8;this.writeUint(l,a),this.writeUint(s,u)}writeVarInt(i,a){let s=BigInt(i);if(a<0||!Number.isSafeInteger(a))throw Error(`invalid bit length. Got ${a}`);if(s===0n){this.writeUint(0,a);return}let l=s>0?s:-s;const u=1+Math.ceil(l.toString(2).length/8),c=u*8;this.writeUint(u,a),this.writeInt(s,c)}writeCoins(i){this.writeVarUint(i,4)}writeAddress(i){if(i==null){this.writeUint(0,2);return}if(e.Address.isAddress(i)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(i.workChain,8),this.writeBuffer(i.hash);return}if(t.ExternalAddress.isAddress(i)){this.writeUint(1,2),this.writeUint(i.bits,9),this.writeUint(i.value,i.bits);return}throw Error(`Invalid address. Got ${i}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!==0)throw new Error("BitBuilder buffer is not byte aligned");return this._buffer.subarray(0,this._length/8)}};return Uc.BitBuilder=n,Uc}var Fc={},vs={};Object.defineProperty(vs,"__esModule",{value:!0});vs.CellType=void 0;var bC;(function(e){e[e.Ordinary=-1]="Ordinary",e[e.PrunedBranch=1]="PrunedBranch",e[e.Library=2]="Library",e[e.MerkleProof=3]="MerkleProof",e[e.MerkleUpdate=4]="MerkleUpdate"})(bC||(vs.CellType=bC={}));var zc={},$c={},qc={},_g={};Object.defineProperty(_g,"__esModule",{value:!0});_g.readUnaryLength=void 0;function Hte(e){let t=0;for(;e.loadBit();)t++;return t}_g.readUnaryLength=Hte;var wC;function r6(){if(wC)return qc;wC=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.generateMerkleProof=void 0;const e=en(),t=_g;function r(a){return(0,e.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(a.hash(0)).storeUint(a.depth(0),16).endCell({exotic:!0})}function n(a){return(0,e.beginCell)().storeUint(3,8).storeBuffer(a.hash(0)).storeUint(a.depth(0),16).storeRef(a).endCell({exotic:!0})}function o(a,s,l,u){const c=s.asCell();let h=s.loadBit()?1:0,d=0,p=a;if(h===0){d=(0,t.readUnaryLength)(s);for(let v=0;v0&&P.storeUint(BigInt("0b"+M),M.length),P}Tn.writeLabelShort=s;function l(M){return 1+M.length+1+M.length}function u(M,P,L){L.storeBit(1),L.storeBit(0);let j=Math.ceil(Math.log2(P+1));return L.storeUint(M.length,j),M.length>0&&L.storeUint(BigInt("0b"+M),M.length),L}Tn.writeLabelLong=u;function c(M,P){return 1+1+Math.ceil(Math.log2(P+1))+M.length}function h(M,P,L,j){j.storeBit(1),j.storeBit(1),j.storeBit(M);let V=Math.ceil(Math.log2(L+1));j.storeUint(P,V)}Tn.writeLabelSame=h;function d(M){return 1+1+1+Math.ceil(Math.log2(M+1))}function p(M){if(M.length===0||M.length===1)return!0;for(let P=1;P(0,l.deserializeInternalKey)(f))}values(){return Array.from(this._map.values())}store(f,g,w){if(this._map.size===0)f.storeBit(0);else{let A=this._key;g!=null&&(A=g);let T=this._value;if(w!=null&&(T=w),!A)throw Error("Key serializer is not defined");if(!T)throw Error("Value serializer is not defined");let E=new Map;for(const[I,m]of this._map)E.set(A.serialize((0,l.deserializeInternalKey)(I)),m);f.storeBit(1);let C=(0,t.beginCell)();(0,s.serializeDict)(E,A.bits,T.serialize,C),f.storeRef(C.endCell())}}storeDirect(f,g,w){if(this._map.size===0)throw Error("Cannot store empty dictionary directly");let A=this._key;g!=null&&(A=g);let T=this._value;if(w!=null&&(T=w),!A)throw Error("Key serializer is not defined");if(!T)throw Error("Value serializer is not defined");let E=new Map;for(const[C,I]of this._map)E.set(A.serialize((0,l.deserializeInternalKey)(C)),I);(0,s.serializeDict)(E,A.bits,T.serialize,f)}generateMerkleProof(f){return(0,o.generateMerkleProof)(this,f,this._key)}generateMerkleUpdate(f,g){return(0,i.generateMerkleUpdate)(this,f,this._key,g)}};$c.Dictionary=u,u.Keys={Address:()=>c(),BigInt:y=>h(y),Int:y=>d(y),BigUint:y=>p(y),Uint:y=>v(y),Buffer:y=>b(y),BitString:y=>S(y)},u.Values={BigInt:y=>k(y),Int:y=>x(y),BigVarInt:y=>M(y),BigUint:y=>j(y),Uint:y=>L(y),BigVarUint:y=>P(y),Bool:()=>V(),Address:()=>K(),Cell:()=>Z(),Buffer:y=>U(y),BitString:y=>_(y),Dictionary:(y,f)=>ue(y,f)};function c(){return{bits:267,serialize:y=>{if(!e.Address.isAddress(y))throw Error("Key is not an address");return(0,t.beginCell)().storeAddress(y).endCell().beginParse().preloadUintBig(267)},parse:y=>(0,t.beginCell)().storeUint(y,267).endCell().beginParse().loadAddress()}}function h(y){return{bits:y,serialize:f=>{if(typeof f!="bigint")throw Error("Key is not a bigint");return(0,t.beginCell)().storeInt(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadIntBig(y)}}function d(y){return{bits:y,serialize:f=>{if(typeof f!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(f))throw Error("Key is not a safe integer: "+f);return(0,t.beginCell)().storeInt(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadInt(y)}}function p(y){return{bits:y,serialize:f=>{if(typeof f!="bigint")throw Error("Key is not a bigint");if(f<0)throw Error("Key is negative: "+f);return(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)}}function v(y){return{bits:y,serialize:f=>{if(typeof f!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(f))throw Error("Key is not a safe integer: "+f);if(f<0)throw Error("Key is negative: "+f);return(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>Number((0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUint(y))}}function b(y){return{bits:y*8,serialize:f=>{if(!Oe.Buffer.isBuffer(f))throw Error("Key is not a buffer");return(0,t.beginCell)().storeBuffer(f).endCell().beginParse().loadUintBig(y*8)},parse:f=>(0,t.beginCell)().storeUint(f,y*8).endCell().beginParse().loadBuffer(y)}}function S(y){return{bits:y,serialize:f=>{if(!n.BitString.isBitString(f))throw Error("Key is not a BitString");return(0,t.beginCell)().storeBits(f).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadBits(y)}}function x(y){return{serialize:(f,g)=>{g.storeInt(f,y)},parse:f=>f.loadInt(y)}}function k(y){return{serialize:(f,g)=>{g.storeInt(f,y)},parse:f=>f.loadIntBig(y)}}function M(y){return{serialize:(f,g)=>{g.storeVarInt(f,y)},parse:f=>f.loadVarIntBig(y)}}function P(y){return{serialize:(f,g)=>{g.storeVarUint(f,y)},parse:f=>f.loadVarUintBig(y)}}function L(y){return{serialize:(f,g)=>{g.storeUint(f,y)},parse:f=>f.loadUint(y)}}function j(y){return{serialize:(f,g)=>{g.storeUint(f,y)},parse:f=>f.loadUintBig(y)}}function V(){return{serialize:(y,f)=>{f.storeBit(y)},parse:y=>y.loadBit()}}function K(){return{serialize:(y,f)=>{f.storeAddress(y)},parse:y=>y.loadAddress()}}function Z(){return{serialize:(y,f)=>{f.storeRef(y)},parse:y=>y.loadRef()}}function ue(y,f){return{serialize:(g,w)=>{g.store(w)},parse:g=>u.load(y,f,g)}}function U(y){return{serialize:(f,g)=>{if(f.length!==y)throw Error("Invalid buffer size");g.storeBuffer(f)},parse:f=>f.loadBuffer(y)}}function _(y){return{serialize:(f,g)=>{if(f.length!==y)throw Error("Invalid BitString size");g.storeBits(f)},parse:f=>f.loadBits(y)}}return $c}var No={},CC;function TP(){if(CC)return No;CC=1,Object.defineProperty(No,"__esModule",{value:!0}),No.writeString=No.stringToCell=No.readString=void 0;const e=en();function t(a){if(a.remainingBits%8!==0)throw new Error(`Invalid string length: ${a.remainingBits}`);if(a.remainingRefs!==0&&a.remainingRefs!==1)throw new Error(`invalid number of refs: ${a.remainingRefs}`);let s;return a.remainingBits===0?s=Oe.Buffer.alloc(0):s=a.loadBuffer(a.remainingBits/8),a.remainingRefs===1&&(s=Oe.Buffer.concat([s,t(a.loadRef().beginParse())])),s}function r(a){return t(a).toString()}No.readString=r;function n(a,s){if(a.length>0){let l=Math.floor(s.availableBits/8);if(a.length>l){let u=a.subarray(0,l),c=a.subarray(l);s=s.storeBuffer(u);let h=(0,e.beginCell)();n(c,h),s=s.storeRef(h.endCell())}else s=s.storeBuffer(a)}}function o(a){let s=(0,e.beginCell)();return n(Oe.Buffer.from(a),s),s.endCell()}No.stringToCell=o;function i(a,s){n(Oe.Buffer.from(a),s)}return No.writeString=i,No}var EC;function n6(){if(EC)return zc;EC=1;var e=Ze&&Ze.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t;Object.defineProperty(zc,"__esModule",{value:!0}),zc.Slice=void 0;const r=e(gc),n=jl(),o=en(),i=TP();let a=class{constructor(l,u){this[t]=()=>this.toString(),this._reader=l.clone(),this._refs=[...u],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(l){return this._reader.skip(l),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(l){return this._reader.loadBits(l)}preloadBits(l){return this._reader.preloadBits(l)}loadUint(l){return this._reader.loadUint(l)}loadUintBig(l){return this._reader.loadUintBig(l)}preloadUint(l){return this._reader.preloadUint(l)}preloadUintBig(l){return this._reader.preloadUintBig(l)}loadMaybeUint(l){return this.loadBit()?this.loadUint(l):null}loadMaybeUintBig(l){return this.loadBit()?this.loadUintBig(l):null}loadInt(l){return this._reader.loadInt(l)}loadIntBig(l){return this._reader.loadIntBig(l)}preloadInt(l){return this._reader.preloadInt(l)}preloadIntBig(l){return this._reader.preloadIntBig(l)}loadMaybeInt(l){return this.loadBit()?this.loadInt(l):null}loadMaybeIntBig(l){return this.loadBit()?this.loadIntBig(l):null}loadVarUint(l){return this._reader.loadVarUint(l)}loadVarUintBig(l){return this._reader.loadVarUintBig(l)}preloadVarUint(l){return this._reader.preloadVarUint(l)}preloadVarUintBig(l){return this._reader.preloadVarUintBig(l)}loadVarInt(l){return this._reader.loadVarInt(l)}loadVarIntBig(l){return this._reader.loadVarIntBig(l)}preloadVarInt(l){return this._reader.preloadVarInt(l)}preloadVarIntBig(l){return this._reader.preloadVarIntBig(l)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(l){return this._reader.loadBuffer(l)}preloadBuffer(l){return this._reader.preloadBuffer(l)}loadStringTail(){return(0,i.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,i.readString)(this):null}loadStringRefTail(){return(0,i.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){const l=this.loadMaybeRef();return l?(0,i.readString)(l.beginParse()):null}loadDict(l,u){return n.Dictionary.load(l,u,this)}loadDictDirect(l,u){return n.Dictionary.loadDirect(l,u,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw new Error("Slice is not empty")}asCell(){return(0,o.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,o.beginCell)().storeSlice(this)}clone(l=!1){if(l){let u=this._reader.clone();return u.reset(),new a(u,this._refs)}else{let u=new a(this._reader,this._refs);return u._refsOffset=this._refsOffset,u}}toString(){return this.asCell().toString()}};return zc.Slice=a,t=r.default,zc}var Cg={},ro={};Object.defineProperty(ro,"__esModule",{value:!0});ro.BitReader=void 0;const ere=hi,tre=vc;class i6{constructor(t,r=0){this._checkpoints=[],this._bits=t,this._offset=r}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(t){if(t<0||this._offset+t>this._bits.length)throw new Error(`Index ${this._offset+t} is out of bounds`);this._offset+=t}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let t=this._bits.at(this._offset);return this._offset++,t}preloadBit(){return this._bits.at(this._offset)}loadBits(t){let r=this._bits.substring(this._offset,t);return this._offset+=t,r}preloadBits(t){return this._bits.substring(this._offset,t)}loadBuffer(t){let r=this._preloadBuffer(t,this._offset);return this._offset+=t*8,r}preloadBuffer(t){return this._preloadBuffer(t,this._offset)}loadUint(t){return Number(this.loadUintBig(t))}loadUintBig(t){let r=this.preloadUintBig(t);return this._offset+=t,r}preloadUint(t){return Number(this._preloadUint(t,this._offset))}preloadUintBig(t){return this._preloadUint(t,this._offset)}loadInt(t){let r=this._preloadInt(t,this._offset);return this._offset+=t,Number(r)}loadIntBig(t){let r=this._preloadInt(t,this._offset);return this._offset+=t,r}preloadInt(t){return Number(this._preloadInt(t,this._offset))}preloadIntBig(t){return this._preloadInt(t,this._offset)}loadVarUint(t){let r=Number(this.loadUint(t));return Number(this.loadUintBig(r*8))}loadVarUintBig(t){let r=Number(this.loadUint(t));return this.loadUintBig(r*8)}preloadVarUint(t){let r=Number(this._preloadUint(t,this._offset));return Number(this._preloadUint(r*8,this._offset+t))}preloadVarUintBig(t){let r=Number(this._preloadUint(t,this._offset));return this._preloadUint(r*8,this._offset+t)}loadVarInt(t){let r=Number(this.loadUint(t));return Number(this.loadIntBig(r*8))}loadVarIntBig(t){let r=Number(this.loadUint(t));return this.loadIntBig(r*8)}preloadVarInt(t){let r=Number(this._preloadUint(t,this._offset));return Number(this._preloadInt(r*8,this._offset+t))}preloadVarIntBig(t){let r=Number(this._preloadUint(t,this._offset));return this._preloadInt(r*8,this._offset+t)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===2)return this._loadInternalAddress();throw new Error("Invalid address: "+t)}loadMaybeAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();throw new Error("Invalid address")}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadMaybeExternalAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadAddressAny(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();if(t===1)return this._loadExternalAddress();throw Error(t===3?"Unsupported":"Unreachable")}loadPaddedBits(t){if(t%8!==0)throw new Error("Invalid number of bits");let r=t;for(;;)if(this._bits.at(this._offset+r-1)){r--;break}else r--;let n=this._bits.substring(this._offset,r);return this._offset+=t,n}clone(){return new i6(this._bits,this._offset)}_preloadInt(t,r){if(t==0)return 0n;let n=this._bits.at(r),o=0n;for(let i=0;i>t-1)%2!==0}}_c.LevelMask=o6;function lre(e){return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}Object.defineProperty(wc,"__esModule",{value:!0});wc.exoticPruned=void 0;const ure=ro,kC=_c;function cre(e,t){let r=new ure.BitReader(e),n=r.loadUint(8);if(n!==1)throw new Error(`Pruned branch cell must have type 1, got "${n}"`);if(t.length!==0)throw new Error(`Pruned Branch cell can't has refs, got "${t.length}"`);let o;if(e.length===280)o=new kC.LevelMask(1);else{if(o=new kC.LevelMask(r.loadUint(8)),o.level<1||o.level>3)throw new Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);const l=8+8+o.apply(o.level-1).hashCount*(256+16);if(e.length!==l)throw new Error(`Pruned branch cell must have exactly ${l} bits, got "${e.length}"`)}let i=[],a=[],s=[];for(let l=0;l>1);return{type:Eg.CellType.MerkleProof,depths:r,hashes:n,mask:o}}function bre(e,t){(0,pre.exoticMerkleUpdate)(e,t);let r=[],n=[],o=new kg.LevelMask((t[0].level()|t[1].level())>>1);return{type:Eg.CellType.MerkleUpdate,depths:r,hashes:n,mask:o}}function wre(e,t){let n=new fre.BitReader(e).preloadUint(8);if(n===1)return mre(e,t);if(n===2)return vre(e,t);if(n===3)return yre(e,t);if(n===4)return bre(e,t);throw Error("Invalid exotic cell type: "+n)}Cg.resolveExotic=wre;var Ag={},Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.getRepr=Qo.getBitsDescriptor=Qo.getRefsDescriptor=void 0;const pf=vs,_re=bg();function BP(e,t,r){return e.length+(r!==pf.CellType.Ordinary?1:0)*8+t*32}Qo.getRefsDescriptor=BP;function PP(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}Qo.getBitsDescriptor=PP;function xre(e,t,r,n,o,i){const a=Math.ceil(t.length/8),s=Oe.Buffer.alloc(2+a+(2+32)*r.length);let l=0;s[l++]=BP(r,o,i),s[l++]=PP(e),(0,_re.bitsToPaddedBuffer)(t).copy(s,l),l+=a;for(const u of r){let c;i==pf.CellType.MerkleProof||i==pf.CellType.MerkleUpdate?c=u.depth(n+1):c=u.depth(n),s[l++]=Math.floor(c/256),s[l++]=c%256}for(const u of r){let c;i==pf.CellType.MerkleProof||i==pf.CellType.MerkleUpdate?c=u.hash(n+1):c=u.hash(n),c.copy(s,l),l+=32}return s}Qo.getRepr=xre;var F2={},Va={},Pd={},Sre={get exports(){return Pd},set exports(e){Pd=e}};(function(e,t){(function(r,n){e.exports=n()})(Ze,function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function n(le,Y,re,ge){var be,ce,Ie,ke=Y||[0],Te=(re=re||0)>>>3,ze=ge===-1?3:0;for(be=0;be>>2,ke.length<=ce&&ke.push(0),ke[ce]|=le[be]<<8*(ze+ge*(Ie%4));return{value:ke,binLen:8*le.length+re}}function o(le,Y,re){switch(Y){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(le){case"HEX":return function(ge,be,ce){return function(Ie,ke,Te,ze){var We,Ne,Ke,De;if(Ie.length%2!=0)throw new Error("String of HEX type must be in byte increments");var Le=ke||[0],gt=(Te=Te||0)>>>3,rt=ze===-1?3:0;for(We=0;We>>1)+gt)>>>2;Le.length<=Ke;)Le.push(0);Le[Ke]|=Ne<<8*(rt+ze*(De%4))}return{value:Le,binLen:4*Ie.length+Te}}(ge,be,ce,re)};case"TEXT":return function(ge,be,ce){return function(Ie,ke,Te,ze,We){var Ne,Ke,De,Le,gt,rt,Ye,kt,ht=0,tt=Te||[0],Nt=(ze=ze||0)>>>3;if(ke==="UTF8")for(Ye=We===-1?3:0,De=0;De(Ne=Ie.charCodeAt(De))?Ke.push(Ne):2048>Ne?(Ke.push(192|Ne>>>6),Ke.push(128|63&Ne)):55296>Ne||57344<=Ne?Ke.push(224|Ne>>>12,128|Ne>>>6&63,128|63&Ne):(De+=1,Ne=65536+((1023&Ne)<<10|1023&Ie.charCodeAt(De)),Ke.push(240|Ne>>>18,128|Ne>>>12&63,128|Ne>>>6&63,128|63&Ne)),Le=0;Le>>2;tt.length<=gt;)tt.push(0);tt[gt]|=Ke[Le]<<8*(Ye+We*(rt%4)),ht+=1}else for(Ye=We===-1?2:0,kt=ke==="UTF16LE"&&We!==1||ke!=="UTF16LE"&&We===1,De=0;De>>8),gt=(rt=ht+Nt)>>>2;tt.length<=gt;)tt.push(0);tt[gt]|=Ne<<8*(Ye+We*(rt%4)),ht+=2}return{value:tt,binLen:8*ht+ze}}(ge,Y,be,ce,re)};case"B64":return function(ge,be,ce){return function(Ie,ke,Te,ze){var We,Ne,Ke,De,Le,gt,rt=0,Ye=ke||[0],kt=(Te=Te||0)>>>3,ht=ze===-1?3:0,tt=Ie.indexOf("=");if(Ie.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(Ie=Ie.replace(/=/g,""),tt!==-1&&tt-1?t:e}function sl(e,t){if(!(this instanceof sl))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof sl){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Jr(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new Jr(t.headers)),this.method=ate(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}sl.prototype.clone=function(){return new sl(this,{body:this._bodyInit})};function ste(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(i))}}),t}function lte(e){var t=new Jr,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(` +`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();t.append(i,a)}}),t}vP.call(sl.prototype);function Ao(e,t){if(!(this instanceof Ao))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new Jr(t.headers),this.url=t.url||"",this._initBody(e)}vP.call(Ao.prototype);Ao.prototype.clone=function(){return new Ao(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Jr(this.headers),url:this.url})};Ao.error=function(){var e=new Ao(null,{status:0,statusText:""});return e.type="error",e};var ute=[301,302,303,307,308];Ao.redirect=function(e,t){if(ute.indexOf(t)===-1)throw new RangeError("Invalid status code");return new Ao(null,{status:t,headers:{location:e}})};var Rs=kn.DOMException;try{new Rs}catch{Rs=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},Rs.prototype=Object.create(Error.prototype),Rs.prototype.constructor=Rs}function yP(e,t){return new Promise(function(r,n){var o=new sl(e,t);if(o.signal&&o.signal.aborted)return n(new Rs("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={status:i.status,statusText:i.statusText,headers:lte(i.getAllResponseHeaders()||"")};l.url="responseURL"in i?i.responseURL:l.headers.get("X-Request-URL");var u="response"in i?i.response:i.responseText;setTimeout(function(){r(new Ao(u,l))},0)},i.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.onabort=function(){setTimeout(function(){n(new Rs("Aborted","AbortError"))},0)};function s(l){try{return l===""&&kn.location.href?kn.location.href:l}catch{return l}}i.open(o.method,s(o.url),!0),o.credentials==="include"?i.withCredentials=!0:o.credentials==="omit"&&(i.withCredentials=!1),"responseType"in i&&(Zn.blob?i.responseType="blob":Zn.arrayBuffer&&o.headers.get("Content-Type")&&o.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(i.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof Jr)?Object.getOwnPropertyNames(t.headers).forEach(function(l){i.setRequestHeader(l,X5(t.headers[l]))}):o.headers.forEach(function(l,u){i.setRequestHeader(u,l)}),o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}yP.polyfill=!0;kn.fetch||(kn.fetch=yP,kn.Headers=Jr,kn.Request=sl,kn.Response=Ao);self.fetch.bind(self);var cte=Ke&&Ke.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{u(n.next(c))}catch(h){a(h)}}function l(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(mg,"__esModule",{value:!0});mg.Nodes=void 0;class fte{constructor(){this.nodeIndex=-1,this.committee=new Set,this.topology=[]}init(t){return cte(this,void 0,void 0,function*(){this.nodeIndex=-1,this.committee.clear(),this.topology=[];let r=[];try{r=yield(yield fetch(t)).json()}catch(n){throw new Error(`exception in fetch(${t}): ${n}`)}for(const n of r)n.Healthy==="1"&&this.topology.push(n);if(this.topology.length===0)throw new Error("no healthy nodes retrieved")})}getNextNode(t=!0){for(;;)return this.nodeIndex++,this.nodeIndex>=this.topology.length&&(this.nodeIndex=0),this.topology[this.nodeIndex]}getRandomNode(t=!0){const r=Math.floor(Math.random()*this.topology.length);return this.topology[r]}}mg.Nodes=fte;var pc=Ke&&Ke.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{u(n.next(c))}catch(h){a(h)}}function l(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty($i,"__esModule",{value:!0});$i.getHttpV4Endpoint=$i.getHttpV4Endpoints=e6=$i.getHttpEndpoint=$i.getHttpEndpoints=$i.Access=void 0;const dte=mg;class bP{constructor(){this.host="ton.access.orbs.network",this.urlVersion=1,this.nodes=new dte.Nodes}init(){return pc(this,void 0,void 0,function*(){yield this.nodes.init(`https://${this.host}/nodes`)})}buildUrls(t,r,n){n||(n=""),n.length&&(n=n.replace(/^\/+/,""));const o=[],i=this.nodes.topology.length;for(let a=0;a0;)r<<=1,o&i&&(r+=1),i>>=1,r>65535&&(r&=65535,r^=4129)}return Oe.Buffer.from([Math.floor(r/256),r%256])}mc.crc16=mte;var vte=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},SP;Object.defineProperty(hi,"__esModule",{value:!0});hi.address=hi.Address=void 0;const yte=vte(gc),CP=mc,W4=17,EP=81,V4=128;function pC(e){if(typeof e=="string"&&!ji.isFriendly(e))throw new Error("Unknown address type");const t=Oe.Buffer.isBuffer(e)?e:Oe.Buffer.from(e,"base64");if(t.length!==36)throw new Error("Unknown address type: byte length is not equal to 36");const r=t.subarray(0,34),n=t.subarray(34,36),o=(0,CP.crc16)(r);if(!(o[0]===n[0]&&o[1]===n[1]))throw new Error("Invalid checksum: "+e);let i=r[0],a=!1,s=!1;if(i&V4&&(a=!0,i=i^V4),i!==W4&&i!==EP)throw"Unknown address tag";s=i===W4;let l=null;r[1]===255?l=-1:l=r[1];const u=r.subarray(2,34);return{isTestOnly:a,isBounceable:s,workchain:l,hashPart:u}}class ji{static isAddress(t){return t instanceof ji}static isFriendly(t){return!(t.length!==48||!/[A-Za-z0-9+/_-]+/.test(t))}static isRaw(t){if(t.indexOf(":")===-1)return!1;let[r,n]=t.split(":");return!(!Number.isInteger(parseFloat(r))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t=="string"?ji.parse(t).toString():t.toString()}static parse(t){if(ji.isFriendly(t))return this.parseFriendly(t).address;if(ji.isRaw(t))return this.parseRaw(t);throw new Error("Unknown address type: "+t)}static parseRaw(t){let r=parseInt(t.split(":")[0]),n=Oe.Buffer.from(t.split(":")[1],"hex");return new ji(r,n)}static parseFriendly(t){if(Oe.Buffer.isBuffer(t)){let r=pC(t);return{isBounceable:r.isBounceable,isTestOnly:r.isTestOnly,address:new ji(r.workchain,r.hashPart)}}else{let r=t.replace(/\-/g,"+").replace(/_/g,"/"),n=pC(r);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new ji(n.workchain,n.hashPart)}}}constructor(t,r){if(this.toRawString=()=>this.workChain+":"+this.hash.toString("hex"),this.toRaw=()=>{const n=Oe.Buffer.alloc(36);return n.set(this.hash),n.set([this.workChain,this.workChain,this.workChain,this.workChain],32),n},this.toStringBuffer=n=>{let o=n&&n.testOnly!==void 0?n.testOnly:!1,a=(n&&n.bounceable!==void 0?n.bounceable:!0)?W4:EP;o&&(a|=V4);const s=Oe.Buffer.alloc(34);s[0]=a,s[1]=this.workChain,s.set(this.hash,2);const l=Oe.Buffer.alloc(36);return l.set(s),l.set((0,CP.crc16)(s),34),l},this.toString=n=>{let o=n&&n.urlSafe!==void 0?n.urlSafe:!0,i=this.toStringBuffer(n);return o?i.toString("base64").replace(/\+/g,"-").replace(/\//g,"_"):i.toString("base64")},this[SP]=()=>this.toString(),r.length!==32)throw new Error("Invalid address hash length: "+r.length);this.workChain=t,this.hash=r,Object.freeze(this)}equals(t){return t.workChain!==this.workChain?!1:t.hash.equals(this.hash)}}hi.Address=ji;SP=yte.default;function bte(e){return ji.parse(e)}hi.address=bte;var vc={},wte=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},kP;Object.defineProperty(vc,"__esModule",{value:!0});vc.ExternalAddress=void 0;const _te=wte(gc);class t6{static isAddress(t){return t instanceof t6}constructor(t,r){this[kP]=()=>this.toString(),this.value=t,this.bits=r}toString(){return`External<${this.bits}:${this.value}>`}}vc.ExternalAddress=t6;kP=_te.default;var vg={},ll={};Object.defineProperty(ll,"__esModule",{value:!0});ll.base32Decode=ll.base32Encode=void 0;const H4="abcdefghijklmnopqrstuvwxyz234567";function xte(e){const t=e.byteLength;let r=0,n=0,o="";for(let i=0;i=5;)o+=H4[n>>>r-5&31],r-=5;return r>0&&(o+=H4[n<<5-r&31]),o}ll.base32Encode=xte;function Ste(e,t){const r=e.indexOf(t);if(r===-1)throw new Error("Invalid character found: "+t);return r}function Cte(e){let t;t=e.toLowerCase();const{length:r}=t;let n=0,o=0,i=0;const a=Oe.Buffer.alloc(r*5/8|0);for(let s=0;s=8&&(a[i++]=o>>>n-8&255,n-=8);return a}ll.base32Decode=Cte;var Ete=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},AP;Object.defineProperty(vg,"__esModule",{value:!0});vg.ADNLAddress=void 0;const kte=Ete(gc),gC=ll,mC=mc;class Yp{static parseFriendly(t){if(t.length!==55)throw Error("Invalid address");t="f"+t;let r=(0,gC.base32Decode)(t);if(r[0]!==45)throw Error("Invalid address");let n=r.slice(33);if(!(0,mC.crc16)(r.slice(0,33)).equals(n))throw Error("Invalid address");return new Yp(r.slice(1,33))}static parseRaw(t){const r=Oe.Buffer.from(t,"base64");return new Yp(r)}constructor(t){if(this.toRaw=()=>this.address.toString("hex").toUpperCase(),this.toString=()=>{let r=Oe.Buffer.concat([Oe.Buffer.from([45]),this.address]),n=(0,mC.crc16)(r);return r=Oe.Buffer.concat([r,n]),(0,gC.base32Encode)(r).slice(1)},this[AP]=()=>this.toString(),t.length!==32)throw Error("Invalid address");this.address=t}equals(t){return this.address.equals(t.address)}}vg.ADNLAddress=Yp;AP=kte.default;var yg={},_s={},Uc={},jc={},xs={},vC;function bg(){if(vC)return xs;vC=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.paddedBufferToBits=xs.bitsToPaddedBuffer=void 0;const e=wg(),t=ms();function r(o){let i=new e.BitBuilder(Math.ceil(o.length/8)*8);i.writeBits(o);let a=Math.ceil(o.length/8)*8-o.length;for(let s=0;s=0;a--)if(o[a]!==0){const s=o[a];let l=s&-s;l&1||(l=Math.log2(l)+1),a>0&&(i=a<<3),i+=8-l;break}return new t.BitString(o,0,i)}return xs.paddedBufferToBits=n,xs}var yC;function ms(){if(yC)return jc;yC=1;var e=Ke&&Ke.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t;Object.defineProperty(jc,"__esModule",{value:!0}),jc.BitString=void 0;const r=bg(),n=e(gc);let o=class{static isBitString(a){return a instanceof o}constructor(a,s,l){if(this[t]=()=>this.toString(),l<0)throw new Error(`Length ${l} is out of bounds`);this._length=l,this._data=a,this._offset=s}get length(){return this._length}at(a){if(a>=this._length)throw new Error(`Index ${a} > ${this._length} is out of bounds`);if(a<0)throw new Error(`Index ${a} < 0 is out of bounds`);let s=this._offset+a>>3,l=7-(this._offset+a)%8;return(this._data[s]&1<this._length)throw new Error(`Offset(${a}) > ${this._length} is out of bounds`);if(a<0)throw new Error(`Offset(${a}) < 0 is out of bounds`);if(s===0)return o.EMPTY;if(a+s>this._length)throw new Error(`Offset ${a} + Length ${s} > ${this._length} is out of bounds`);return new o(this._data,this._offset+a,s)}subbuffer(a,s){if(a>this._length)throw new Error(`Offset ${a} is out of bounds`);if(a<0)throw new Error(`Offset ${a} is out of bounds`);if(a+s>this._length)throw new Error(`Offset + Lenght = ${a+s} is out of bounds`);if(s%8!==0||(this._offset+a)%8!==0)return null;let l=this._offset+a>>3,u=l+(s>>3);return this._data.subarray(l,u)}equals(a){if(this._length!==a._length)return!1;for(let s=0;sthis._buffer.length*8)throw new Error("BitBuilder overflow");(typeof i=="boolean"&&i===!0||typeof i=="number"&&i>0)&&(this._buffer[a/8|0]|=1<<7-a%8),this._length++}writeBits(i){for(let a=0;athis._buffer.length*8)throw new Error("BitBuilder overflow");i.copy(this._buffer,this._length/8),this._length+=i.length*8}else for(let a=0;a=l)throw Error(`bitLength is too small for a value ${i}. Got ${a}`);if(this._length+a>this._buffer.length*8)throw new Error("BitBuilder overflow");const u=8-this._length%8;if(u>0){const c=Math.floor(this._length/8);if(a>BigInt(a-u));this._buffer[c]|=h,this._length+=u}}for(a-=u;a>0;)a>=8?(this._buffer[this._length/8]=Number(s>>BigInt(a-8)&0xffn),this._length+=8,a-=8):(this._buffer[this._length/8]=Number(s<=l)throw Error(`value is out of range for ${a} bits. Got ${i}`);s<0?(this.writeBit(!0),s=l+s):this.writeBit(!1),this.writeUint(s,a-1)}writeVarUint(i,a){let s=BigInt(i);if(a<0||!Number.isSafeInteger(a))throw Error(`invalid bit length. Got ${a}`);if(s<0)throw Error(`value is negative. Got ${i}`);if(s===0n){this.writeUint(0,a);return}const l=Math.ceil(s.toString(2).length/8),u=l*8;this.writeUint(l,a),this.writeUint(s,u)}writeVarInt(i,a){let s=BigInt(i);if(a<0||!Number.isSafeInteger(a))throw Error(`invalid bit length. Got ${a}`);if(s===0n){this.writeUint(0,a);return}let l=s>0?s:-s;const u=1+Math.ceil(l.toString(2).length/8),c=u*8;this.writeUint(u,a),this.writeInt(s,c)}writeCoins(i){this.writeVarUint(i,4)}writeAddress(i){if(i==null){this.writeUint(0,2);return}if(e.Address.isAddress(i)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(i.workChain,8),this.writeBuffer(i.hash);return}if(t.ExternalAddress.isAddress(i)){this.writeUint(1,2),this.writeUint(i.bits,9),this.writeUint(i.value,i.bits);return}throw Error(`Invalid address. Got ${i}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!==0)throw new Error("BitBuilder buffer is not byte aligned");return this._buffer.subarray(0,this._length/8)}};return Uc.BitBuilder=n,Uc}var Fc={},vs={};Object.defineProperty(vs,"__esModule",{value:!0});vs.CellType=void 0;var wC;(function(e){e[e.Ordinary=-1]="Ordinary",e[e.PrunedBranch=1]="PrunedBranch",e[e.Library=2]="Library",e[e.MerkleProof=3]="MerkleProof",e[e.MerkleUpdate=4]="MerkleUpdate"})(wC||(vs.CellType=wC={}));var zc={},$c={},qc={},_g={};Object.defineProperty(_g,"__esModule",{value:!0});_g.readUnaryLength=void 0;function Ate(e){let t=0;for(;e.loadBit();)t++;return t}_g.readUnaryLength=Ate;var _C;function r6(){if(_C)return qc;_C=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.generateMerkleProof=void 0;const e=en(),t=_g;function r(a){return(0,e.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(a.hash(0)).storeUint(a.depth(0),16).endCell({exotic:!0})}function n(a){return(0,e.beginCell)().storeUint(3,8).storeBuffer(a.hash(0)).storeUint(a.depth(0),16).storeRef(a).endCell({exotic:!0})}function o(a,s,l,u){const c=s.asCell();let h=s.loadBit()?1:0,d=0,p=a;if(h===0){d=(0,t.readUnaryLength)(s);for(let v=0;v0&&P.storeUint(BigInt("0b"+M),M.length),P}Tn.writeLabelShort=s;function l(M){return 1+M.length+1+M.length}function u(M,P,L){L.storeBit(1),L.storeBit(0);let j=Math.ceil(Math.log2(P+1));return L.storeUint(M.length,j),M.length>0&&L.storeUint(BigInt("0b"+M),M.length),L}Tn.writeLabelLong=u;function c(M,P){return 1+1+Math.ceil(Math.log2(P+1))+M.length}function h(M,P,L,j){j.storeBit(1),j.storeBit(1),j.storeBit(M);let V=Math.ceil(Math.log2(L+1));j.storeUint(P,V)}Tn.writeLabelSame=h;function d(M){return 1+1+1+Math.ceil(Math.log2(M+1))}function p(M){if(M.length===0||M.length===1)return!0;for(let P=1;P(0,l.deserializeInternalKey)(f))}values(){return Array.from(this._map.values())}store(f,g,w){if(this._map.size===0)f.storeBit(0);else{let A=this._key;g!=null&&(A=g);let T=this._value;if(w!=null&&(T=w),!A)throw Error("Key serializer is not defined");if(!T)throw Error("Value serializer is not defined");let E=new Map;for(const[I,m]of this._map)E.set(A.serialize((0,l.deserializeInternalKey)(I)),m);f.storeBit(1);let C=(0,t.beginCell)();(0,s.serializeDict)(E,A.bits,T.serialize,C),f.storeRef(C.endCell())}}storeDirect(f,g,w){if(this._map.size===0)throw Error("Cannot store empty dictionary directly");let A=this._key;g!=null&&(A=g);let T=this._value;if(w!=null&&(T=w),!A)throw Error("Key serializer is not defined");if(!T)throw Error("Value serializer is not defined");let E=new Map;for(const[C,I]of this._map)E.set(A.serialize((0,l.deserializeInternalKey)(C)),I);(0,s.serializeDict)(E,A.bits,T.serialize,f)}generateMerkleProof(f){return(0,o.generateMerkleProof)(this,f,this._key)}generateMerkleUpdate(f,g){return(0,i.generateMerkleUpdate)(this,f,this._key,g)}};$c.Dictionary=u,u.Keys={Address:()=>c(),BigInt:y=>h(y),Int:y=>d(y),BigUint:y=>p(y),Uint:y=>v(y),Buffer:y=>b(y),BitString:y=>S(y)},u.Values={BigInt:y=>k(y),Int:y=>x(y),BigVarInt:y=>M(y),BigUint:y=>j(y),Uint:y=>L(y),BigVarUint:y=>P(y),Bool:()=>V(),Address:()=>K(),Cell:()=>Z(),Buffer:y=>U(y),BitString:y=>_(y),Dictionary:(y,f)=>ue(y,f)};function c(){return{bits:267,serialize:y=>{if(!e.Address.isAddress(y))throw Error("Key is not an address");return(0,t.beginCell)().storeAddress(y).endCell().beginParse().preloadUintBig(267)},parse:y=>(0,t.beginCell)().storeUint(y,267).endCell().beginParse().loadAddress()}}function h(y){return{bits:y,serialize:f=>{if(typeof f!="bigint")throw Error("Key is not a bigint");return(0,t.beginCell)().storeInt(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadIntBig(y)}}function d(y){return{bits:y,serialize:f=>{if(typeof f!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(f))throw Error("Key is not a safe integer: "+f);return(0,t.beginCell)().storeInt(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadInt(y)}}function p(y){return{bits:y,serialize:f=>{if(typeof f!="bigint")throw Error("Key is not a bigint");if(f<0)throw Error("Key is negative: "+f);return(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)}}function v(y){return{bits:y,serialize:f=>{if(typeof f!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(f))throw Error("Key is not a safe integer: "+f);if(f<0)throw Error("Key is negative: "+f);return(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUintBig(y)},parse:f=>Number((0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadUint(y))}}function b(y){return{bits:y*8,serialize:f=>{if(!Oe.Buffer.isBuffer(f))throw Error("Key is not a buffer");return(0,t.beginCell)().storeBuffer(f).endCell().beginParse().loadUintBig(y*8)},parse:f=>(0,t.beginCell)().storeUint(f,y*8).endCell().beginParse().loadBuffer(y)}}function S(y){return{bits:y,serialize:f=>{if(!n.BitString.isBitString(f))throw Error("Key is not a BitString");return(0,t.beginCell)().storeBits(f).endCell().beginParse().loadUintBig(y)},parse:f=>(0,t.beginCell)().storeUint(f,y).endCell().beginParse().loadBits(y)}}function x(y){return{serialize:(f,g)=>{g.storeInt(f,y)},parse:f=>f.loadInt(y)}}function k(y){return{serialize:(f,g)=>{g.storeInt(f,y)},parse:f=>f.loadIntBig(y)}}function M(y){return{serialize:(f,g)=>{g.storeVarInt(f,y)},parse:f=>f.loadVarIntBig(y)}}function P(y){return{serialize:(f,g)=>{g.storeVarUint(f,y)},parse:f=>f.loadVarUintBig(y)}}function L(y){return{serialize:(f,g)=>{g.storeUint(f,y)},parse:f=>f.loadUint(y)}}function j(y){return{serialize:(f,g)=>{g.storeUint(f,y)},parse:f=>f.loadUintBig(y)}}function V(){return{serialize:(y,f)=>{f.storeBit(y)},parse:y=>y.loadBit()}}function K(){return{serialize:(y,f)=>{f.storeAddress(y)},parse:y=>y.loadAddress()}}function Z(){return{serialize:(y,f)=>{f.storeRef(y)},parse:y=>y.loadRef()}}function ue(y,f){return{serialize:(g,w)=>{g.store(w)},parse:g=>u.load(y,f,g)}}function U(y){return{serialize:(f,g)=>{if(f.length!==y)throw Error("Invalid buffer size");g.storeBuffer(f)},parse:f=>f.loadBuffer(y)}}function _(y){return{serialize:(f,g)=>{if(f.length!==y)throw Error("Invalid BitString size");g.storeBits(f)},parse:f=>f.loadBits(y)}}return $c}var No={},EC;function TP(){if(EC)return No;EC=1,Object.defineProperty(No,"__esModule",{value:!0}),No.writeString=No.stringToCell=No.readString=void 0;const e=en();function t(a){if(a.remainingBits%8!==0)throw new Error(`Invalid string length: ${a.remainingBits}`);if(a.remainingRefs!==0&&a.remainingRefs!==1)throw new Error(`invalid number of refs: ${a.remainingRefs}`);let s;return a.remainingBits===0?s=Oe.Buffer.alloc(0):s=a.loadBuffer(a.remainingBits/8),a.remainingRefs===1&&(s=Oe.Buffer.concat([s,t(a.loadRef().beginParse())])),s}function r(a){return t(a).toString()}No.readString=r;function n(a,s){if(a.length>0){let l=Math.floor(s.availableBits/8);if(a.length>l){let u=a.subarray(0,l),c=a.subarray(l);s=s.storeBuffer(u);let h=(0,e.beginCell)();n(c,h),s=s.storeRef(h.endCell())}else s=s.storeBuffer(a)}}function o(a){let s=(0,e.beginCell)();return n(Oe.Buffer.from(a),s),s.endCell()}No.stringToCell=o;function i(a,s){n(Oe.Buffer.from(a),s)}return No.writeString=i,No}var kC;function n6(){if(kC)return zc;kC=1;var e=Ke&&Ke.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t;Object.defineProperty(zc,"__esModule",{value:!0}),zc.Slice=void 0;const r=e(gc),n=jl(),o=en(),i=TP();let a=class{constructor(l,u){this[t]=()=>this.toString(),this._reader=l.clone(),this._refs=[...u],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(l){return this._reader.skip(l),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(l){return this._reader.loadBits(l)}preloadBits(l){return this._reader.preloadBits(l)}loadUint(l){return this._reader.loadUint(l)}loadUintBig(l){return this._reader.loadUintBig(l)}preloadUint(l){return this._reader.preloadUint(l)}preloadUintBig(l){return this._reader.preloadUintBig(l)}loadMaybeUint(l){return this.loadBit()?this.loadUint(l):null}loadMaybeUintBig(l){return this.loadBit()?this.loadUintBig(l):null}loadInt(l){return this._reader.loadInt(l)}loadIntBig(l){return this._reader.loadIntBig(l)}preloadInt(l){return this._reader.preloadInt(l)}preloadIntBig(l){return this._reader.preloadIntBig(l)}loadMaybeInt(l){return this.loadBit()?this.loadInt(l):null}loadMaybeIntBig(l){return this.loadBit()?this.loadIntBig(l):null}loadVarUint(l){return this._reader.loadVarUint(l)}loadVarUintBig(l){return this._reader.loadVarUintBig(l)}preloadVarUint(l){return this._reader.preloadVarUint(l)}preloadVarUintBig(l){return this._reader.preloadVarUintBig(l)}loadVarInt(l){return this._reader.loadVarInt(l)}loadVarIntBig(l){return this._reader.loadVarIntBig(l)}preloadVarInt(l){return this._reader.preloadVarInt(l)}preloadVarIntBig(l){return this._reader.preloadVarIntBig(l)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(l){return this._reader.loadBuffer(l)}preloadBuffer(l){return this._reader.preloadBuffer(l)}loadStringTail(){return(0,i.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,i.readString)(this):null}loadStringRefTail(){return(0,i.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){const l=this.loadMaybeRef();return l?(0,i.readString)(l.beginParse()):null}loadDict(l,u){return n.Dictionary.load(l,u,this)}loadDictDirect(l,u){return n.Dictionary.loadDirect(l,u,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw new Error("Slice is not empty")}asCell(){return(0,o.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,o.beginCell)().storeSlice(this)}clone(l=!1){if(l){let u=this._reader.clone();return u.reset(),new a(u,this._refs)}else{let u=new a(this._reader,this._refs);return u._refsOffset=this._refsOffset,u}}toString(){return this.asCell().toString()}};return zc.Slice=a,t=r.default,zc}var Cg={},ro={};Object.defineProperty(ro,"__esModule",{value:!0});ro.BitReader=void 0;const Nte=hi,Lte=vc;class i6{constructor(t,r=0){this._checkpoints=[],this._bits=t,this._offset=r}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(t){if(t<0||this._offset+t>this._bits.length)throw new Error(`Index ${this._offset+t} is out of bounds`);this._offset+=t}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let t=this._bits.at(this._offset);return this._offset++,t}preloadBit(){return this._bits.at(this._offset)}loadBits(t){let r=this._bits.substring(this._offset,t);return this._offset+=t,r}preloadBits(t){return this._bits.substring(this._offset,t)}loadBuffer(t){let r=this._preloadBuffer(t,this._offset);return this._offset+=t*8,r}preloadBuffer(t){return this._preloadBuffer(t,this._offset)}loadUint(t){return Number(this.loadUintBig(t))}loadUintBig(t){let r=this.preloadUintBig(t);return this._offset+=t,r}preloadUint(t){return Number(this._preloadUint(t,this._offset))}preloadUintBig(t){return this._preloadUint(t,this._offset)}loadInt(t){let r=this._preloadInt(t,this._offset);return this._offset+=t,Number(r)}loadIntBig(t){let r=this._preloadInt(t,this._offset);return this._offset+=t,r}preloadInt(t){return Number(this._preloadInt(t,this._offset))}preloadIntBig(t){return this._preloadInt(t,this._offset)}loadVarUint(t){let r=Number(this.loadUint(t));return Number(this.loadUintBig(r*8))}loadVarUintBig(t){let r=Number(this.loadUint(t));return this.loadUintBig(r*8)}preloadVarUint(t){let r=Number(this._preloadUint(t,this._offset));return Number(this._preloadUint(r*8,this._offset+t))}preloadVarUintBig(t){let r=Number(this._preloadUint(t,this._offset));return this._preloadUint(r*8,this._offset+t)}loadVarInt(t){let r=Number(this.loadUint(t));return Number(this.loadIntBig(r*8))}loadVarIntBig(t){let r=Number(this.loadUint(t));return this.loadIntBig(r*8)}preloadVarInt(t){let r=Number(this._preloadUint(t,this._offset));return Number(this._preloadInt(r*8,this._offset+t))}preloadVarIntBig(t){let r=Number(this._preloadUint(t,this._offset));return this._preloadInt(r*8,this._offset+t)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===2)return this._loadInternalAddress();throw new Error("Invalid address: "+t)}loadMaybeAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();throw new Error("Invalid address")}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadMaybeExternalAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadAddressAny(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();if(t===1)return this._loadExternalAddress();throw Error(t===3?"Unsupported":"Unreachable")}loadPaddedBits(t){if(t%8!==0)throw new Error("Invalid number of bits");let r=t;for(;;)if(this._bits.at(this._offset+r-1)){r--;break}else r--;let n=this._bits.substring(this._offset,r);return this._offset+=t,n}clone(){return new i6(this._bits,this._offset)}_preloadInt(t,r){if(t==0)return 0n;let n=this._bits.at(r),o=0n;for(let i=0;i>t-1)%2!==0}}_c.LevelMask=o6;function qte(e){return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}Object.defineProperty(wc,"__esModule",{value:!0});wc.exoticPruned=void 0;const Wte=ro,AC=_c;function Vte(e,t){let r=new Wte.BitReader(e),n=r.loadUint(8);if(n!==1)throw new Error(`Pruned branch cell must have type 1, got "${n}"`);if(t.length!==0)throw new Error(`Pruned Branch cell can't has refs, got "${t.length}"`);let o;if(e.length===280)o=new AC.LevelMask(1);else{if(o=new AC.LevelMask(r.loadUint(8)),o.level<1||o.level>3)throw new Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);const l=8+8+o.apply(o.level-1).hashCount*(256+16);if(e.length!==l)throw new Error(`Pruned branch cell must have exactly ${l} bits, got "${e.length}"`)}let i=[],a=[],s=[];for(let l=0;l>1);return{type:Eg.CellType.MerkleProof,depths:r,hashes:n,mask:o}}function ere(e,t){(0,Gte.exoticMerkleUpdate)(e,t);let r=[],n=[],o=new kg.LevelMask((t[0].level()|t[1].level())>>1);return{type:Eg.CellType.MerkleUpdate,depths:r,hashes:n,mask:o}}function tre(e,t){let n=new Hte.BitReader(e).preloadUint(8);if(n===1)return Qte(e,t);if(n===2)return Xte(e,t);if(n===3)return Jte(e,t);if(n===4)return ere(e,t);throw Error("Invalid exotic cell type: "+n)}Cg.resolveExotic=tre;var Ag={},Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.getRepr=Qo.getBitsDescriptor=Qo.getRefsDescriptor=void 0;const pf=vs,rre=bg();function BP(e,t,r){return e.length+(r!==pf.CellType.Ordinary?1:0)*8+t*32}Qo.getRefsDescriptor=BP;function PP(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}Qo.getBitsDescriptor=PP;function nre(e,t,r,n,o,i){const a=Math.ceil(t.length/8),s=Oe.Buffer.alloc(2+a+(2+32)*r.length);let l=0;s[l++]=BP(r,o,i),s[l++]=PP(e),(0,rre.bitsToPaddedBuffer)(t).copy(s,l),l+=a;for(const u of r){let c;i==pf.CellType.MerkleProof||i==pf.CellType.MerkleUpdate?c=u.depth(n+1):c=u.depth(n),s[l++]=Math.floor(c/256),s[l++]=c%256}for(const u of r){let c;i==pf.CellType.MerkleProof||i==pf.CellType.MerkleUpdate?c=u.hash(n+1):c=u.hash(n),c.copy(s,l),l+=32}return s}Qo.getRepr=nre;var F2={},Va={},Pd={},ire={get exports(){return Pd},set exports(e){Pd=e}};(function(e,t){(function(r,n){e.exports=n()})(Ke,function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function n(le,Y,re,ge){var be,ce,Ie,ke=Y||[0],Te=(re=re||0)>>>3,ze=ge===-1?3:0;for(be=0;be>>2,ke.length<=ce&&ke.push(0),ke[ce]|=le[be]<<8*(ze+ge*(Ie%4));return{value:ke,binLen:8*le.length+re}}function o(le,Y,re){switch(Y){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(le){case"HEX":return function(ge,be,ce){return function(Ie,ke,Te,ze){var We,Ne,Ze,De;if(Ie.length%2!=0)throw new Error("String of HEX type must be in byte increments");var Le=ke||[0],gt=(Te=Te||0)>>>3,rt=ze===-1?3:0;for(We=0;We>>1)+gt)>>>2;Le.length<=Ze;)Le.push(0);Le[Ze]|=Ne<<8*(rt+ze*(De%4))}return{value:Le,binLen:4*Ie.length+Te}}(ge,be,ce,re)};case"TEXT":return function(ge,be,ce){return function(Ie,ke,Te,ze,We){var Ne,Ze,De,Le,gt,rt,Ye,kt,ht=0,tt=Te||[0],Nt=(ze=ze||0)>>>3;if(ke==="UTF8")for(Ye=We===-1?3:0,De=0;De(Ne=Ie.charCodeAt(De))?Ze.push(Ne):2048>Ne?(Ze.push(192|Ne>>>6),Ze.push(128|63&Ne)):55296>Ne||57344<=Ne?Ze.push(224|Ne>>>12,128|Ne>>>6&63,128|63&Ne):(De+=1,Ne=65536+((1023&Ne)<<10|1023&Ie.charCodeAt(De)),Ze.push(240|Ne>>>18,128|Ne>>>12&63,128|Ne>>>6&63,128|63&Ne)),Le=0;Le>>2;tt.length<=gt;)tt.push(0);tt[gt]|=Ze[Le]<<8*(Ye+We*(rt%4)),ht+=1}else for(Ye=We===-1?2:0,kt=ke==="UTF16LE"&&We!==1||ke!=="UTF16LE"&&We===1,De=0;De>>8),gt=(rt=ht+Nt)>>>2;tt.length<=gt;)tt.push(0);tt[gt]|=Ne<<8*(Ye+We*(rt%4)),ht+=2}return{value:tt,binLen:8*ht+ze}}(ge,Y,be,ce,re)};case"B64":return function(ge,be,ce){return function(Ie,ke,Te,ze){var We,Ne,Ze,De,Le,gt,rt=0,Ye=ke||[0],kt=(Te=Te||0)>>>3,ht=ze===-1?3:0,tt=Ie.indexOf("=");if(Ie.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(Ie=Ie.replace(/=/g,""),tt!==-1&&tttypeof l=="bigint"?l.toString():l})(t=e.util||(e.util={})),function(n){n.mergeShapes=(o,i)=>({...o,...i})}(e.objectUtil||(e.objectUtil={})),e.ZodParsedType=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=n=>{switch(typeof n){case"undefined":return e.ZodParsedType.undefined;case"string":return e.ZodParsedType.string;case"number":return isNaN(n)?e.ZodParsedType.nan:e.ZodParsedType.number;case"boolean":return e.ZodParsedType.boolean;case"function":return e.ZodParsedType.function;case"bigint":return e.ZodParsedType.bigint;case"symbol":return e.ZodParsedType.symbol;case"object":return Array.isArray(n)?e.ZodParsedType.array:n===null?e.ZodParsedType.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?e.ZodParsedType.promise:typeof Map<"u"&&n instanceof Map?e.ZodParsedType.map:typeof Set<"u"&&n instanceof Set?e.ZodParsedType.set:typeof Date<"u"&&n instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}};e.getParsedType=r})(vh);var So={};Object.defineProperty(So,"__esModule",{value:!0});So.ZodError=So.quotelessJson=So.ZodIssueCode=void 0;const DR=vh;So.ZodIssueCode=DR.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);const koe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");So.quotelessJson=koe;class Od extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,l=0;for(;lr.message){const r={},n=[];for(const o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}So.ZodError=Od;Od.create=e=>new Od(e);Object.defineProperty(Vg,"__esModule",{value:!0});const Es=vh,Sn=So,Aoe=(e,t)=>{let r;switch(e.code){case Sn.ZodIssueCode.invalid_type:e.received===Es.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Sn.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Es.util.jsonStringifyReplacer)}`;break;case Sn.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Es.util.joinValues(e.keys,", ")}`;break;case Sn.ZodIssueCode.invalid_union:r="Invalid input";break;case Sn.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Es.util.joinValues(e.options)}`;break;case Sn.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Es.util.joinValues(e.options)}, received '${e.received}'`;break;case Sn.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Sn.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Sn.ZodIssueCode.invalid_date:r="Invalid date";break;case Sn.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Es.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Sn.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Sn.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Sn.ZodIssueCode.custom:r="Invalid input";break;case Sn.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Sn.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Sn.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,Es.util.assertNever(e)}return{message:r}};Vg.default=Aoe;var Moe=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});xo.getErrorMap=xo.setErrorMap=xo.defaultErrorMap=void 0;const UR=Moe(Vg);xo.defaultErrorMap=UR.default;let jR=UR.default;function Ioe(e){jR=e}xo.setErrorMap=Ioe;function Toe(){return jR}xo.getErrorMap=Toe;var p6={};(function(e){var t=Ze&&Ze.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.addIssueToContext=e.EMPTY_PATH=e.makeIssue=void 0;const r=xo,n=t(Vg),o=p=>{const{data:v,path:b,errorMaps:S,issueData:x}=p,k=[...b,...x.path||[]],M={...x,path:k};if(x.message!==void 0)return{...x,path:k,message:x.message};let P="";const L=S.filter(j=>!!j).slice().reverse();for(const j of L)P=j(M,{data:v,defaultError:P}).message;return{...x,path:k,message:P}};e.makeIssue=o,e.EMPTY_PATH=[];function i(p,v){const b=(0,r.getErrorMap)(),S=(0,e.makeIssue)({issueData:v,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,b,b===n.default?void 0:n.default].filter(x=>!!x)});p.common.issues.push(S)}e.addIssueToContext=i;class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(v,b){const S=[];for(const x of b){if(x.status==="aborted")return e.INVALID;x.status==="dirty"&&v.dirty(),S.push(x.value)}return{status:v.value,value:S}}static async mergeObjectAsync(v,b){const S=[];for(const x of b){const k=await x.key,M=await x.value;S.push({key:k,value:M})}return a.mergeObjectSync(v,S)}static mergeObjectSync(v,b){const S={};for(const x of b){const{key:k,value:M}=x;if(k.status==="aborted"||M.status==="aborted")return e.INVALID;k.status==="dirty"&&v.dirty(),M.status==="dirty"&&v.dirty(),k.value!=="__proto__"&&(typeof M.value<"u"||x.alwaysSet)&&(S[k.value]=M.value)}return{status:v.value,value:S}}}e.ParseStatus=a,e.INVALID=Object.freeze({status:"aborted"});const s=p=>({status:"dirty",value:p});e.DIRTY=s;const l=p=>({status:"valid",value:p});e.OK=l;const u=p=>p.status==="aborted";e.isAborted=u;const c=p=>p.status==="dirty";e.isDirty=c;const h=p=>p.status==="valid";e.isValid=h;const d=p=>typeof Promise<"u"&&p instanceof Promise;e.isAsync=d})(p6);var FR={};Object.defineProperty(FR,"__esModule",{value:!0});var zR={},$R={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0,function(t){t.errToObj=r=>typeof r=="string"?{message:r}:r||{},t.toString=r=>typeof r=="string"?r:r==null?void 0:r.message}(e.errorUtil||(e.errorUtil={}))})($R);(function(e){var t=Ze&&Ze.__classPrivateFieldGet||function(fe,R,F,H){if(F==="a"&&!H)throw new TypeError("Private accessor was defined without a getter");if(typeof R=="function"?fe!==R||!H:!R.has(fe))throw new TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?H:F==="a"?H.call(fe):H?H.value:R.get(fe)},r=Ze&&Ze.__classPrivateFieldSet||function(fe,R,F,H,ae){if(H==="m")throw new TypeError("Private method is not writable");if(H==="a"&&!ae)throw new TypeError("Private accessor was defined without a setter");if(typeof R=="function"?fe!==R||!ae:!R.has(fe))throw new TypeError("Cannot write private member to an object whose class did not declare it");return H==="a"?ae.call(fe,F):ae?ae.value=F:R.set(fe,F),F},n,o;Object.defineProperty(e,"__esModule",{value:!0}),e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.custom=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.datetimeRegex=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=e.discriminatedUnion=e.date=void 0;const i=xo,a=$R,s=p6,l=vh,u=So;class c{constructor(R,F,H,ae){this._cachedPath=[],this.parent=R,this.data=F,this._path=H,this._key=ae}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const h=(fe,R)=>{if((0,s.isValid)(R))return{success:!0,data:R.value};if(!fe.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const F=new u.ZodError(fe.common.issues);return this._error=F,this._error}}};function d(fe){if(!fe)return{};const{errorMap:R,invalid_type_error:F,required_error:H,description:ae}=fe;if(R&&(F||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return R?{errorMap:R,description:ae}:{errorMap:(Ce,Se)=>{var Ve,Ge;const{message:Je}=fe;return Ce.code==="invalid_enum_value"?{message:Je??Se.defaultError}:typeof Se.data>"u"?{message:(Ve=Je??H)!==null&&Ve!==void 0?Ve:Se.defaultError}:Ce.code!=="invalid_type"?{message:Se.defaultError}:{message:(Ge=Je??F)!==null&&Ge!==void 0?Ge:Se.defaultError}},description:ae}}class p{constructor(R){this.spa=this.safeParseAsync,this._def=R,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(R){return(0,l.getParsedType)(R.data)}_getOrReturnCtx(R,F){return F||{common:R.parent.common,data:R.data,parsedType:(0,l.getParsedType)(R.data),schemaErrorMap:this._def.errorMap,path:R.path,parent:R.parent}}_processInputParams(R){return{status:new s.ParseStatus,ctx:{common:R.parent.common,data:R.data,parsedType:(0,l.getParsedType)(R.data),schemaErrorMap:this._def.errorMap,path:R.path,parent:R.parent}}}_parseSync(R){const F=this._parse(R);if((0,s.isAsync)(F))throw new Error("Synchronous parse encountered promise.");return F}_parseAsync(R){const F=this._parse(R);return Promise.resolve(F)}parse(R,F){const H=this.safeParse(R,F);if(H.success)return H.data;throw H.error}safeParse(R,F){var H;const ae={common:{issues:[],async:(H=F==null?void 0:F.async)!==null&&H!==void 0?H:!1,contextualErrorMap:F==null?void 0:F.errorMap},path:(F==null?void 0:F.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:R,parsedType:(0,l.getParsedType)(R)},oe=this._parseSync({data:R,path:ae.path,parent:ae});return h(ae,oe)}async parseAsync(R,F){const H=await this.safeParseAsync(R,F);if(H.success)return H.data;throw H.error}async safeParseAsync(R,F){const H={common:{issues:[],contextualErrorMap:F==null?void 0:F.errorMap,async:!0},path:(F==null?void 0:F.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:R,parsedType:(0,l.getParsedType)(R)},ae=this._parse({data:R,path:H.path,parent:H}),oe=await((0,s.isAsync)(ae)?ae:Promise.resolve(ae));return h(H,oe)}refine(R,F){const H=ae=>typeof F=="string"||typeof F>"u"?{message:F}:typeof F=="function"?F(ae):F;return this._refinement((ae,oe)=>{const Ce=R(ae),Se=()=>oe.addIssue({code:u.ZodIssueCode.custom,...H(ae)});return typeof Promise<"u"&&Ce instanceof Promise?Ce.then(Ve=>Ve?!0:(Se(),!1)):Ce?!0:(Se(),!1)})}refinement(R,F){return this._refinement((H,ae)=>R(H)?!0:(ae.addIssue(typeof F=="function"?F(H,ae):F),!1))}_refinement(R){return new ge({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:R}})}superRefine(R){return this._refinement(R)}optional(){return be.create(this,this._def)}nullable(){return ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return se.create(this,this._def)}promise(){return re.create(this,this._def)}or(R){return q.create([this,R],this._def)}and(R){return Q.create(this,R,this._def)}transform(R){return new ge({...d(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:R}})}default(R){const F=typeof R=="function"?R:()=>R;return new Ie({...d(this._def),innerType:this,defaultValue:F,typeName:De.ZodDefault})}brand(){return new ze({typeName:De.ZodBranded,type:this,...d(this._def)})}catch(R){const F=typeof R=="function"?R:()=>R;return new ke({...d(this._def),innerType:this,catchValue:F,typeName:De.ZodCatch})}describe(R){const F=this.constructor;return new F({...this._def,description:R})}pipe(R){return We.create(this,R)}readonly(){return Ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}e.ZodType=p,e.Schema=p,e.ZodSchema=p;const v=/^c[^\s-]{8,}$/i,b=/^[0-9a-z]+$/,S=/^[0-9A-HJKMNP-TV-Z]{26}$/,x=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,k=/^[a-z0-9_-]{21}$/i,M=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,P=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,L="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let j;const V=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,K=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Z=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ue="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",U=new RegExp(`^${ue}$`);function _(fe){let R="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return fe.precision?R=`${R}\\.\\d{${fe.precision}}`:fe.precision==null&&(R=`${R}(\\.\\d+)?`),R}function y(fe){return new RegExp(`^${_(fe)}$`)}function f(fe){let R=`${ue}T${_(fe)}`;const F=[];return F.push(fe.local?"Z?":"Z"),fe.offset&&F.push("([+-]\\d{2}:?\\d{2})"),R=`${R}(${F.join("|")})`,new RegExp(`^${R}$`)}e.datetimeRegex=f;function g(fe,R){return!!((R==="v4"||!R)&&V.test(fe)||(R==="v6"||!R)&&K.test(fe))}class w extends p{_parse(R){if(this._def.coerce&&(R.data=String(R.data)),this._getType(R)!==l.ZodParsedType.string){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.string,received:oe.parsedType}),s.INVALID}const H=new s.ParseStatus;let ae;for(const oe of this._def.checks)if(oe.kind==="min")R.data.lengthoe.value&&(ae=this._getOrReturnCtx(R,ae),(0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.too_big,maximum:oe.value,type:"string",inclusive:!0,exact:!1,message:oe.message}),H.dirty());else if(oe.kind==="length"){const Ce=R.data.length>oe.value,Se=R.data.lengthR.test(ae),{validation:F,code:u.ZodIssueCode.invalid_string,...a.errorUtil.errToObj(H)})}_addCheck(R){return new w({...this._def,checks:[...this._def.checks,R]})}email(R){return this._addCheck({kind:"email",...a.errorUtil.errToObj(R)})}url(R){return this._addCheck({kind:"url",...a.errorUtil.errToObj(R)})}emoji(R){return this._addCheck({kind:"emoji",...a.errorUtil.errToObj(R)})}uuid(R){return this._addCheck({kind:"uuid",...a.errorUtil.errToObj(R)})}nanoid(R){return this._addCheck({kind:"nanoid",...a.errorUtil.errToObj(R)})}cuid(R){return this._addCheck({kind:"cuid",...a.errorUtil.errToObj(R)})}cuid2(R){return this._addCheck({kind:"cuid2",...a.errorUtil.errToObj(R)})}ulid(R){return this._addCheck({kind:"ulid",...a.errorUtil.errToObj(R)})}base64(R){return this._addCheck({kind:"base64",...a.errorUtil.errToObj(R)})}ip(R){return this._addCheck({kind:"ip",...a.errorUtil.errToObj(R)})}datetime(R){var F,H;return typeof R=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:R}):this._addCheck({kind:"datetime",precision:typeof(R==null?void 0:R.precision)>"u"?null:R==null?void 0:R.precision,offset:(F=R==null?void 0:R.offset)!==null&&F!==void 0?F:!1,local:(H=R==null?void 0:R.local)!==null&&H!==void 0?H:!1,...a.errorUtil.errToObj(R==null?void 0:R.message)})}date(R){return this._addCheck({kind:"date",message:R})}time(R){return typeof R=="string"?this._addCheck({kind:"time",precision:null,message:R}):this._addCheck({kind:"time",precision:typeof(R==null?void 0:R.precision)>"u"?null:R==null?void 0:R.precision,...a.errorUtil.errToObj(R==null?void 0:R.message)})}duration(R){return this._addCheck({kind:"duration",...a.errorUtil.errToObj(R)})}regex(R,F){return this._addCheck({kind:"regex",regex:R,...a.errorUtil.errToObj(F)})}includes(R,F){return this._addCheck({kind:"includes",value:R,position:F==null?void 0:F.position,...a.errorUtil.errToObj(F==null?void 0:F.message)})}startsWith(R,F){return this._addCheck({kind:"startsWith",value:R,...a.errorUtil.errToObj(F)})}endsWith(R,F){return this._addCheck({kind:"endsWith",value:R,...a.errorUtil.errToObj(F)})}min(R,F){return this._addCheck({kind:"min",value:R,...a.errorUtil.errToObj(F)})}max(R,F){return this._addCheck({kind:"max",value:R,...a.errorUtil.errToObj(F)})}length(R,F){return this._addCheck({kind:"length",value:R,...a.errorUtil.errToObj(F)})}nonempty(R){return this.min(1,a.errorUtil.errToObj(R))}trim(){return new w({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new w({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new w({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(R=>R.kind==="datetime")}get isDate(){return!!this._def.checks.find(R=>R.kind==="date")}get isTime(){return!!this._def.checks.find(R=>R.kind==="time")}get isDuration(){return!!this._def.checks.find(R=>R.kind==="duration")}get isEmail(){return!!this._def.checks.find(R=>R.kind==="email")}get isURL(){return!!this._def.checks.find(R=>R.kind==="url")}get isEmoji(){return!!this._def.checks.find(R=>R.kind==="emoji")}get isUUID(){return!!this._def.checks.find(R=>R.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(R=>R.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(R=>R.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(R=>R.kind==="cuid2")}get isULID(){return!!this._def.checks.find(R=>R.kind==="ulid")}get isIP(){return!!this._def.checks.find(R=>R.kind==="ip")}get isBase64(){return!!this._def.checks.find(R=>R.kind==="base64")}get minLength(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxLength(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.value{var R;return new w({checks:[],typeName:De.ZodString,coerce:(R=fe==null?void 0:fe.coerce)!==null&&R!==void 0?R:!1,...d(fe)})};function A(fe,R){const F=(fe.toString().split(".")[1]||"").length,H=(R.toString().split(".")[1]||"").length,ae=F>H?F:H,oe=parseInt(fe.toFixed(ae).replace(".","")),Ce=parseInt(R.toFixed(ae).replace(".",""));return oe%Ce/Math.pow(10,ae)}class T extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(R){if(this._def.coerce&&(R.data=Number(R.data)),this._getType(R)!==l.ZodParsedType.number){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.number,received:oe.parsedType}),s.INVALID}let H;const ae=new s.ParseStatus;for(const oe of this._def.checks)oe.kind==="int"?l.util.isInteger(R.data)||(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:oe.message}),ae.dirty()):oe.kind==="min"?(oe.inclusive?R.dataoe.value:R.data>=oe.value)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:oe.value,type:"number",inclusive:oe.inclusive,exact:!1,message:oe.message}),ae.dirty()):oe.kind==="multipleOf"?A(R.data,oe.value)!==0&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_multiple_of,multipleOf:oe.value,message:oe.message}),ae.dirty()):oe.kind==="finite"?Number.isFinite(R.data)||(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_finite,message:oe.message}),ae.dirty()):l.util.assertNever(oe);return{status:ae.value,value:R.data}}gte(R,F){return this.setLimit("min",R,!0,a.errorUtil.toString(F))}gt(R,F){return this.setLimit("min",R,!1,a.errorUtil.toString(F))}lte(R,F){return this.setLimit("max",R,!0,a.errorUtil.toString(F))}lt(R,F){return this.setLimit("max",R,!1,a.errorUtil.toString(F))}setLimit(R,F,H,ae){return new T({...this._def,checks:[...this._def.checks,{kind:R,value:F,inclusive:H,message:a.errorUtil.toString(ae)}]})}_addCheck(R){return new T({...this._def,checks:[...this._def.checks,R]})}int(R){return this._addCheck({kind:"int",message:a.errorUtil.toString(R)})}positive(R){return this._addCheck({kind:"min",value:0,inclusive:!1,message:a.errorUtil.toString(R)})}negative(R){return this._addCheck({kind:"max",value:0,inclusive:!1,message:a.errorUtil.toString(R)})}nonpositive(R){return this._addCheck({kind:"max",value:0,inclusive:!0,message:a.errorUtil.toString(R)})}nonnegative(R){return this._addCheck({kind:"min",value:0,inclusive:!0,message:a.errorUtil.toString(R)})}multipleOf(R,F){return this._addCheck({kind:"multipleOf",value:R,message:a.errorUtil.toString(F)})}finite(R){return this._addCheck({kind:"finite",message:a.errorUtil.toString(R)})}safe(R){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:a.errorUtil.toString(R)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:a.errorUtil.toString(R)})}get minValue(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxValue(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.valueR.kind==="int"||R.kind==="multipleOf"&&l.util.isInteger(R.value))}get isFinite(){let R=null,F=null;for(const H of this._def.checks){if(H.kind==="finite"||H.kind==="int"||H.kind==="multipleOf")return!0;H.kind==="min"?(F===null||H.value>F)&&(F=H.value):H.kind==="max"&&(R===null||H.valuenew T({checks:[],typeName:De.ZodNumber,coerce:(fe==null?void 0:fe.coerce)||!1,...d(fe)});class E extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(R){if(this._def.coerce&&(R.data=BigInt(R.data)),this._getType(R)!==l.ZodParsedType.bigint){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.bigint,received:oe.parsedType}),s.INVALID}let H;const ae=new s.ParseStatus;for(const oe of this._def.checks)oe.kind==="min"?(oe.inclusive?R.dataoe.value:R.data>=oe.value)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,type:"bigint",maximum:oe.value,inclusive:oe.inclusive,message:oe.message}),ae.dirty()):oe.kind==="multipleOf"?R.data%oe.value!==BigInt(0)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_multiple_of,multipleOf:oe.value,message:oe.message}),ae.dirty()):l.util.assertNever(oe);return{status:ae.value,value:R.data}}gte(R,F){return this.setLimit("min",R,!0,a.errorUtil.toString(F))}gt(R,F){return this.setLimit("min",R,!1,a.errorUtil.toString(F))}lte(R,F){return this.setLimit("max",R,!0,a.errorUtil.toString(F))}lt(R,F){return this.setLimit("max",R,!1,a.errorUtil.toString(F))}setLimit(R,F,H,ae){return new E({...this._def,checks:[...this._def.checks,{kind:R,value:F,inclusive:H,message:a.errorUtil.toString(ae)}]})}_addCheck(R){return new E({...this._def,checks:[...this._def.checks,R]})}positive(R){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:a.errorUtil.toString(R)})}negative(R){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:a.errorUtil.toString(R)})}nonpositive(R){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:a.errorUtil.toString(R)})}nonnegative(R){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:a.errorUtil.toString(R)})}multipleOf(R,F){return this._addCheck({kind:"multipleOf",value:R,message:a.errorUtil.toString(F)})}get minValue(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxValue(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.value{var R;return new E({checks:[],typeName:De.ZodBigInt,coerce:(R=fe==null?void 0:fe.coerce)!==null&&R!==void 0?R:!1,...d(fe)})};class C extends p{_parse(R){if(this._def.coerce&&(R.data=Boolean(R.data)),this._getType(R)!==l.ZodParsedType.boolean){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.boolean,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodBoolean=C,C.create=fe=>new C({typeName:De.ZodBoolean,coerce:(fe==null?void 0:fe.coerce)||!1,...d(fe)});class I extends p{_parse(R){if(this._def.coerce&&(R.data=new Date(R.data)),this._getType(R)!==l.ZodParsedType.date){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.date,received:oe.parsedType}),s.INVALID}if(isNaN(R.data.getTime())){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_date}),s.INVALID}const H=new s.ParseStatus;let ae;for(const oe of this._def.checks)oe.kind==="min"?R.data.getTime()oe.value&&(ae=this._getOrReturnCtx(R,ae),(0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.too_big,message:oe.message,inclusive:!0,exact:!1,maximum:oe.value,type:"date"}),H.dirty()):l.util.assertNever(oe);return{status:H.value,value:new Date(R.data.getTime())}}_addCheck(R){return new I({...this._def,checks:[...this._def.checks,R]})}min(R,F){return this._addCheck({kind:"min",value:R.getTime(),message:a.errorUtil.toString(F)})}max(R,F){return this._addCheck({kind:"max",value:R.getTime(),message:a.errorUtil.toString(F)})}get minDate(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R!=null?new Date(R):null}get maxDate(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.valuenew I({checks:[],coerce:(fe==null?void 0:fe.coerce)||!1,typeName:De.ZodDate,...d(fe)});class m extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.symbol){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.symbol,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodSymbol=m,m.create=fe=>new m({typeName:De.ZodSymbol,...d(fe)});class B extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.undefined){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.undefined,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodUndefined=B,B.create=fe=>new B({typeName:De.ZodUndefined,...d(fe)});class ne extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.null){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.null,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodNull=ne,ne.create=fe=>new ne({typeName:De.ZodNull,...d(fe)});class de extends p{constructor(){super(...arguments),this._any=!0}_parse(R){return(0,s.OK)(R.data)}}e.ZodAny=de,de.create=fe=>new de({typeName:De.ZodAny,...d(fe)});class $ extends p{constructor(){super(...arguments),this._unknown=!0}_parse(R){return(0,s.OK)(R.data)}}e.ZodUnknown=$,$.create=fe=>new $({typeName:De.ZodUnknown,...d(fe)});class he extends p{_parse(R){const F=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.never,received:F.parsedType}),s.INVALID}}e.ZodNever=he,he.create=fe=>new he({typeName:De.ZodNever,...d(fe)});class X extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.undefined){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.void,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodVoid=X,X.create=fe=>new X({typeName:De.ZodVoid,...d(fe)});class se extends p{_parse(R){const{ctx:F,status:H}=this._processInputParams(R),ae=this._def;if(F.parsedType!==l.ZodParsedType.array)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:F.parsedType}),s.INVALID;if(ae.exactLength!==null){const Ce=F.data.length>ae.exactLength.value,Se=F.data.lengthae.maxLength.value&&((0,s.addIssueToContext)(F,{code:u.ZodIssueCode.too_big,maximum:ae.maxLength.value,type:"array",inclusive:!0,exact:!1,message:ae.maxLength.message}),H.dirty()),F.common.async)return Promise.all([...F.data].map((Ce,Se)=>ae.type._parseAsync(new c(F,Ce,F.path,Se)))).then(Ce=>s.ParseStatus.mergeArray(H,Ce));const oe=[...F.data].map((Ce,Se)=>ae.type._parseSync(new c(F,Ce,F.path,Se)));return s.ParseStatus.mergeArray(H,oe)}get element(){return this._def.type}min(R,F){return new se({...this._def,minLength:{value:R,message:a.errorUtil.toString(F)}})}max(R,F){return new se({...this._def,maxLength:{value:R,message:a.errorUtil.toString(F)}})}length(R,F){return new se({...this._def,exactLength:{value:R,message:a.errorUtil.toString(F)}})}nonempty(R){return this.min(1,R)}}e.ZodArray=se,se.create=(fe,R)=>new se({type:fe,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...d(R)});function pe(fe){if(fe instanceof W){const R={};for(const F in fe.shape){const H=fe.shape[F];R[F]=be.create(pe(H))}return new W({...fe._def,shape:()=>R})}else return fe instanceof se?new se({...fe._def,type:pe(fe.element)}):fe instanceof be?be.create(pe(fe.unwrap())):fe instanceof ce?ce.create(pe(fe.unwrap())):fe instanceof N?N.create(fe.items.map(R=>pe(R))):fe}class W extends p{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const R=this._def.shape(),F=l.util.objectKeys(R);return this._cached={shape:R,keys:F}}_parse(R){if(this._getType(R)!==l.ZodParsedType.object){const Ge=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(Ge,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:Ge.parsedType}),s.INVALID}const{status:H,ctx:ae}=this._processInputParams(R),{shape:oe,keys:Ce}=this._getCached(),Se=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(const Ge in ae.data)Ce.includes(Ge)||Se.push(Ge);const Ve=[];for(const Ge of Ce){const Je=oe[Ge],At=ae.data[Ge];Ve.push({key:{status:"valid",value:Ge},value:Je._parse(new c(ae,At,ae.path,Ge)),alwaysSet:Ge in ae.data})}if(this._def.catchall instanceof he){const Ge=this._def.unknownKeys;if(Ge==="passthrough")for(const Je of Se)Ve.push({key:{status:"valid",value:Je},value:{status:"valid",value:ae.data[Je]}});else if(Ge==="strict")Se.length>0&&((0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.unrecognized_keys,keys:Se}),H.dirty());else if(Ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const Ge=this._def.catchall;for(const Je of Se){const At=ae.data[Je];Ve.push({key:{status:"valid",value:Je},value:Ge._parse(new c(ae,At,ae.path,Je)),alwaysSet:Je in ae.data})}}return ae.common.async?Promise.resolve().then(async()=>{const Ge=[];for(const Je of Ve){const At=await Je.key,we=await Je.value;Ge.push({key:At,value:we,alwaysSet:Je.alwaysSet})}return Ge}).then(Ge=>s.ParseStatus.mergeObjectSync(H,Ge)):s.ParseStatus.mergeObjectSync(H,Ve)}get shape(){return this._def.shape()}strict(R){return a.errorUtil.errToObj,new W({...this._def,unknownKeys:"strict",...R!==void 0?{errorMap:(F,H)=>{var ae,oe,Ce,Se;const Ve=(Ce=(oe=(ae=this._def).errorMap)===null||oe===void 0?void 0:oe.call(ae,F,H).message)!==null&&Ce!==void 0?Ce:H.defaultError;return F.code==="unrecognized_keys"?{message:(Se=a.errorUtil.errToObj(R).message)!==null&&Se!==void 0?Se:Ve}:{message:Ve}}}:{}})}strip(){return new W({...this._def,unknownKeys:"strip"})}passthrough(){return new W({...this._def,unknownKeys:"passthrough"})}extend(R){return new W({...this._def,shape:()=>({...this._def.shape(),...R})})}merge(R){return new W({unknownKeys:R._def.unknownKeys,catchall:R._def.catchall,shape:()=>({...this._def.shape(),...R._def.shape()}),typeName:De.ZodObject})}setKey(R,F){return this.augment({[R]:F})}catchall(R){return new W({...this._def,catchall:R})}pick(R){const F={};return l.util.objectKeys(R).forEach(H=>{R[H]&&this.shape[H]&&(F[H]=this.shape[H])}),new W({...this._def,shape:()=>F})}omit(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{R[H]||(F[H]=this.shape[H])}),new W({...this._def,shape:()=>F})}deepPartial(){return pe(this)}partial(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{const ae=this.shape[H];R&&!R[H]?F[H]=ae:F[H]=ae.optional()}),new W({...this._def,shape:()=>F})}required(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{if(R&&!R[H])F[H]=this.shape[H];else{let oe=this.shape[H];for(;oe instanceof be;)oe=oe._def.innerType;F[H]=oe}}),new W({...this._def,shape:()=>F})}keyof(){return Re(l.util.objectKeys(this.shape))}}e.ZodObject=W,W.create=(fe,R)=>new W({shape:()=>fe,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...d(R)}),W.strictCreate=(fe,R)=>new W({shape:()=>fe,unknownKeys:"strict",catchall:he.create(),typeName:De.ZodObject,...d(R)}),W.lazycreate=(fe,R)=>new W({shape:fe,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...d(R)});class q extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H=this._def.options;function ae(oe){for(const Se of oe)if(Se.result.status==="valid")return Se.result;for(const Se of oe)if(Se.result.status==="dirty")return F.common.issues.push(...Se.ctx.common.issues),Se.result;const Ce=oe.map(Se=>new u.ZodError(Se.ctx.common.issues));return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union,unionErrors:Ce}),s.INVALID}if(F.common.async)return Promise.all(H.map(async oe=>{const Ce={...F,common:{...F.common,issues:[]},parent:null};return{result:await oe._parseAsync({data:F.data,path:F.path,parent:Ce}),ctx:Ce}})).then(ae);{let oe;const Ce=[];for(const Ve of H){const Ge={...F,common:{...F.common,issues:[]},parent:null},Je=Ve._parseSync({data:F.data,path:F.path,parent:Ge});if(Je.status==="valid")return Je;Je.status==="dirty"&&!oe&&(oe={result:Je,ctx:Ge}),Ge.common.issues.length&&Ce.push(Ge.common.issues)}if(oe)return F.common.issues.push(...oe.ctx.common.issues),oe.result;const Se=Ce.map(Ve=>new u.ZodError(Ve));return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union,unionErrors:Se}),s.INVALID}}get options(){return this._def.options}}e.ZodUnion=q,q.create=(fe,R)=>new q({options:fe,typeName:De.ZodUnion,...d(R)});const ye=fe=>fe instanceof Pe?ye(fe.schema):fe instanceof ge?ye(fe.innerType()):fe instanceof Fe?[fe.value]:fe instanceof le?fe.options:fe instanceof Y?l.util.objectValues(fe.enum):fe instanceof Ie?ye(fe._def.innerType):fe instanceof B?[void 0]:fe instanceof ne?[null]:fe instanceof be?[void 0,...ye(fe.unwrap())]:fe instanceof ce?[null,...ye(fe.unwrap())]:fe instanceof ze||fe instanceof Ne?ye(fe.unwrap()):fe instanceof ke?ye(fe._def.innerType):[];class xe extends p{_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.object)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:F.parsedType}),s.INVALID;const H=this.discriminator,ae=F.data[H],oe=this.optionsMap.get(ae);return oe?F.common.async?oe._parseAsync({data:F.data,path:F.path,parent:F}):oe._parseSync({data:F.data,path:F.path,parent:F}):((0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[H]}),s.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(R,F,H){const ae=new Map;for(const oe of F){const Ce=ye(oe.shape[R]);if(!Ce.length)throw new Error(`A discriminator value for key \`${R}\` could not be extracted from all schema options`);for(const Se of Ce){if(ae.has(Se))throw new Error(`Discriminator property ${String(R)} has duplicate value ${String(Se)}`);ae.set(Se,oe)}}return new xe({typeName:De.ZodDiscriminatedUnion,discriminator:R,options:F,optionsMap:ae,...d(H)})}}e.ZodDiscriminatedUnion=xe;function Me(fe,R){const F=(0,l.getParsedType)(fe),H=(0,l.getParsedType)(R);if(fe===R)return{valid:!0,data:fe};if(F===l.ZodParsedType.object&&H===l.ZodParsedType.object){const ae=l.util.objectKeys(R),oe=l.util.objectKeys(fe).filter(Se=>ae.indexOf(Se)!==-1),Ce={...fe,...R};for(const Se of oe){const Ve=Me(fe[Se],R[Se]);if(!Ve.valid)return{valid:!1};Ce[Se]=Ve.data}return{valid:!0,data:Ce}}else if(F===l.ZodParsedType.array&&H===l.ZodParsedType.array){if(fe.length!==R.length)return{valid:!1};const ae=[];for(let oe=0;oe{if((0,s.isAborted)(oe)||(0,s.isAborted)(Ce))return s.INVALID;const Se=Me(oe.value,Ce.value);return Se.valid?(((0,s.isDirty)(oe)||(0,s.isDirty)(Ce))&&F.dirty(),{status:F.value,value:Se.data}):((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_intersection_types}),s.INVALID)};return H.common.async?Promise.all([this._def.left._parseAsync({data:H.data,path:H.path,parent:H}),this._def.right._parseAsync({data:H.data,path:H.path,parent:H})]).then(([oe,Ce])=>ae(oe,Ce)):ae(this._def.left._parseSync({data:H.data,path:H.path,parent:H}),this._def.right._parseSync({data:H.data,path:H.path,parent:H}))}}e.ZodIntersection=Q,Q.create=(fe,R,F)=>new Q({left:fe,right:R,typeName:De.ZodIntersection,...d(F)});class N extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.array)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:H.parsedType}),s.INVALID;if(H.data.lengththis._def.items.length&&((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty());const oe=[...H.data].map((Ce,Se)=>{const Ve=this._def.items[Se]||this._def.rest;return Ve?Ve._parse(new c(H,Ce,H.path,Se)):null}).filter(Ce=>!!Ce);return H.common.async?Promise.all(oe).then(Ce=>s.ParseStatus.mergeArray(F,Ce)):s.ParseStatus.mergeArray(F,oe)}get items(){return this._def.items}rest(R){return new N({...this._def,rest:R})}}e.ZodTuple=N,N.create=(fe,R)=>{if(!Array.isArray(fe))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:fe,typeName:De.ZodTuple,rest:null,...d(R)})};class D extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.object)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:H.parsedType}),s.INVALID;const ae=[],oe=this._def.keyType,Ce=this._def.valueType;for(const Se in H.data)ae.push({key:oe._parse(new c(H,Se,H.path,Se)),value:Ce._parse(new c(H,H.data[Se],H.path,Se)),alwaysSet:Se in H.data});return H.common.async?s.ParseStatus.mergeObjectAsync(F,ae):s.ParseStatus.mergeObjectSync(F,ae)}get element(){return this._def.valueType}static create(R,F,H){return F instanceof p?new D({keyType:R,valueType:F,typeName:De.ZodRecord,...d(H)}):new D({keyType:w.create(),valueType:R,typeName:De.ZodRecord,...d(F)})}}e.ZodRecord=D;class G extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.map)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.map,received:H.parsedType}),s.INVALID;const ae=this._def.keyType,oe=this._def.valueType,Ce=[...H.data.entries()].map(([Se,Ve],Ge)=>({key:ae._parse(new c(H,Se,H.path,[Ge,"key"])),value:oe._parse(new c(H,Ve,H.path,[Ge,"value"]))}));if(H.common.async){const Se=new Map;return Promise.resolve().then(async()=>{for(const Ve of Ce){const Ge=await Ve.key,Je=await Ve.value;if(Ge.status==="aborted"||Je.status==="aborted")return s.INVALID;(Ge.status==="dirty"||Je.status==="dirty")&&F.dirty(),Se.set(Ge.value,Je.value)}return{status:F.value,value:Se}})}else{const Se=new Map;for(const Ve of Ce){const Ge=Ve.key,Je=Ve.value;if(Ge.status==="aborted"||Je.status==="aborted")return s.INVALID;(Ge.status==="dirty"||Je.status==="dirty")&&F.dirty(),Se.set(Ge.value,Je.value)}return{status:F.value,value:Se}}}}e.ZodMap=G,G.create=(fe,R,F)=>new G({valueType:R,keyType:fe,typeName:De.ZodMap,...d(F)});class me extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.set)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.set,received:H.parsedType}),s.INVALID;const ae=this._def;ae.minSize!==null&&H.data.sizeae.maxSize.value&&((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:ae.maxSize.value,type:"set",inclusive:!0,exact:!1,message:ae.maxSize.message}),F.dirty());const oe=this._def.valueType;function Ce(Ve){const Ge=new Set;for(const Je of Ve){if(Je.status==="aborted")return s.INVALID;Je.status==="dirty"&&F.dirty(),Ge.add(Je.value)}return{status:F.value,value:Ge}}const Se=[...H.data.values()].map((Ve,Ge)=>oe._parse(new c(H,Ve,H.path,Ge)));return H.common.async?Promise.all(Se).then(Ve=>Ce(Ve)):Ce(Se)}min(R,F){return new me({...this._def,minSize:{value:R,message:a.errorUtil.toString(F)}})}max(R,F){return new me({...this._def,maxSize:{value:R,message:a.errorUtil.toString(F)}})}size(R,F){return this.min(R,F).max(R,F)}nonempty(R){return this.min(1,R)}}e.ZodSet=me,me.create=(fe,R)=>new me({valueType:fe,minSize:null,maxSize:null,typeName:De.ZodSet,...d(R)});class _e extends p{constructor(){super(...arguments),this.validate=this.implement}_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.function)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.function,received:F.parsedType}),s.INVALID;function H(Se,Ve){return(0,s.makeIssue)({data:Se,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter(Ge=>!!Ge),issueData:{code:u.ZodIssueCode.invalid_arguments,argumentsError:Ve}})}function ae(Se,Ve){return(0,s.makeIssue)({data:Se,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter(Ge=>!!Ge),issueData:{code:u.ZodIssueCode.invalid_return_type,returnTypeError:Ve}})}const oe={errorMap:F.common.contextualErrorMap},Ce=F.data;if(this._def.returns instanceof re){const Se=this;return(0,s.OK)(async function(...Ve){const Ge=new u.ZodError([]),Je=await Se._def.args.parseAsync(Ve,oe).catch(jt=>{throw Ge.addIssue(H(Ve,jt)),Ge}),At=await Reflect.apply(Ce,this,Je);return await Se._def.returns._def.type.parseAsync(At,oe).catch(jt=>{throw Ge.addIssue(ae(At,jt)),Ge})})}else{const Se=this;return(0,s.OK)(function(...Ve){const Ge=Se._def.args.safeParse(Ve,oe);if(!Ge.success)throw new u.ZodError([H(Ve,Ge.error)]);const Je=Reflect.apply(Ce,this,Ge.data),At=Se._def.returns.safeParse(Je,oe);if(!At.success)throw new u.ZodError([ae(Je,At.error)]);return At.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...R){return new _e({...this._def,args:N.create(R).rest($.create())})}returns(R){return new _e({...this._def,returns:R})}implement(R){return this.parse(R)}strictImplement(R){return this.parse(R)}static create(R,F,H){return new _e({args:R||N.create([]).rest($.create()),returns:F||$.create(),typeName:De.ZodFunction,...d(H)})}}e.ZodFunction=_e;class Pe extends p{get schema(){return this._def.getter()}_parse(R){const{ctx:F}=this._processInputParams(R);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}e.ZodLazy=Pe,Pe.create=(fe,R)=>new Pe({getter:fe,typeName:De.ZodLazy,...d(R)});class Fe extends p{_parse(R){if(R.data!==this._def.value){const F=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(F,{received:F.data,code:u.ZodIssueCode.invalid_literal,expected:this._def.value}),s.INVALID}return{status:"valid",value:R.data}}get value(){return this._def.value}}e.ZodLiteral=Fe,Fe.create=(fe,R)=>new Fe({value:fe,typeName:De.ZodLiteral,...d(R)});function Re(fe,R){return new le({values:fe,typeName:De.ZodEnum,...d(R)})}class le extends p{constructor(){super(...arguments),n.set(this,void 0)}_parse(R){if(typeof R.data!="string"){const F=this._getOrReturnCtx(R),H=this._def.values;return(0,s.addIssueToContext)(F,{expected:l.util.joinValues(H),received:F.parsedType,code:u.ZodIssueCode.invalid_type}),s.INVALID}if(t(this,n,"f")||r(this,n,new Set(this._def.values),"f"),!t(this,n,"f").has(R.data)){const F=this._getOrReturnCtx(R),H=this._def.values;return(0,s.addIssueToContext)(F,{received:F.data,code:u.ZodIssueCode.invalid_enum_value,options:H}),s.INVALID}return(0,s.OK)(R.data)}get options(){return this._def.values}get enum(){const R={};for(const F of this._def.values)R[F]=F;return R}get Values(){const R={};for(const F of this._def.values)R[F]=F;return R}get Enum(){const R={};for(const F of this._def.values)R[F]=F;return R}extract(R,F=this._def){return le.create(R,{...this._def,...F})}exclude(R,F=this._def){return le.create(this.options.filter(H=>!R.includes(H)),{...this._def,...F})}}e.ZodEnum=le,n=new WeakMap,le.create=Re;class Y extends p{constructor(){super(...arguments),o.set(this,void 0)}_parse(R){const F=l.util.getValidEnumValues(this._def.values),H=this._getOrReturnCtx(R);if(H.parsedType!==l.ZodParsedType.string&&H.parsedType!==l.ZodParsedType.number){const ae=l.util.objectValues(F);return(0,s.addIssueToContext)(H,{expected:l.util.joinValues(ae),received:H.parsedType,code:u.ZodIssueCode.invalid_type}),s.INVALID}if(t(this,o,"f")||r(this,o,new Set(l.util.getValidEnumValues(this._def.values)),"f"),!t(this,o,"f").has(R.data)){const ae=l.util.objectValues(F);return(0,s.addIssueToContext)(H,{received:H.data,code:u.ZodIssueCode.invalid_enum_value,options:ae}),s.INVALID}return(0,s.OK)(R.data)}get enum(){return this._def.values}}e.ZodNativeEnum=Y,o=new WeakMap,Y.create=(fe,R)=>new Y({values:fe,typeName:De.ZodNativeEnum,...d(R)});class re extends p{unwrap(){return this._def.type}_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.promise&&F.common.async===!1)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.promise,received:F.parsedType}),s.INVALID;const H=F.parsedType===l.ZodParsedType.promise?F.data:Promise.resolve(F.data);return(0,s.OK)(H.then(ae=>this._def.type.parseAsync(ae,{path:F.path,errorMap:F.common.contextualErrorMap})))}}e.ZodPromise=re,re.create=(fe,R)=>new re({type:fe,typeName:De.ZodPromise,...d(R)});class ge extends p{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(R){const{status:F,ctx:H}=this._processInputParams(R),ae=this._def.effect||null,oe={addIssue:Ce=>{(0,s.addIssueToContext)(H,Ce),Ce.fatal?F.abort():F.dirty()},get path(){return H.path}};if(oe.addIssue=oe.addIssue.bind(oe),ae.type==="preprocess"){const Ce=ae.transform(H.data,oe);if(H.common.async)return Promise.resolve(Ce).then(async Se=>{if(F.value==="aborted")return s.INVALID;const Ve=await this._def.schema._parseAsync({data:Se,path:H.path,parent:H});return Ve.status==="aborted"?s.INVALID:Ve.status==="dirty"||F.value==="dirty"?(0,s.DIRTY)(Ve.value):Ve});{if(F.value==="aborted")return s.INVALID;const Se=this._def.schema._parseSync({data:Ce,path:H.path,parent:H});return Se.status==="aborted"?s.INVALID:Se.status==="dirty"||F.value==="dirty"?(0,s.DIRTY)(Se.value):Se}}if(ae.type==="refinement"){const Ce=Se=>{const Ve=ae.refinement(Se,oe);if(H.common.async)return Promise.resolve(Ve);if(Ve instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Se};if(H.common.async===!1){const Se=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});return Se.status==="aborted"?s.INVALID:(Se.status==="dirty"&&F.dirty(),Ce(Se.value),{status:F.value,value:Se.value})}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then(Se=>Se.status==="aborted"?s.INVALID:(Se.status==="dirty"&&F.dirty(),Ce(Se.value).then(()=>({status:F.value,value:Se.value}))))}if(ae.type==="transform")if(H.common.async===!1){const Ce=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});if(!(0,s.isValid)(Ce))return Ce;const Se=ae.transform(Ce.value,oe);if(Se instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Se}}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then(Ce=>(0,s.isValid)(Ce)?Promise.resolve(ae.transform(Ce.value,oe)).then(Se=>({status:F.value,value:Se})):Ce);l.util.assertNever(ae)}}e.ZodEffects=ge,e.ZodTransformer=ge,ge.create=(fe,R,F)=>new ge({schema:fe,typeName:De.ZodEffects,effect:R,...d(F)}),ge.createWithPreprocess=(fe,R,F)=>new ge({schema:R,effect:{type:"preprocess",transform:fe},typeName:De.ZodEffects,...d(F)});class be extends p{_parse(R){return this._getType(R)===l.ZodParsedType.undefined?(0,s.OK)(void 0):this._def.innerType._parse(R)}unwrap(){return this._def.innerType}}e.ZodOptional=be,be.create=(fe,R)=>new be({innerType:fe,typeName:De.ZodOptional,...d(R)});class ce extends p{_parse(R){return this._getType(R)===l.ZodParsedType.null?(0,s.OK)(null):this._def.innerType._parse(R)}unwrap(){return this._def.innerType}}e.ZodNullable=ce,ce.create=(fe,R)=>new ce({innerType:fe,typeName:De.ZodNullable,...d(R)});class Ie extends p{_parse(R){const{ctx:F}=this._processInputParams(R);let H=F.data;return F.parsedType===l.ZodParsedType.undefined&&(H=this._def.defaultValue()),this._def.innerType._parse({data:H,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}e.ZodDefault=Ie,Ie.create=(fe,R)=>new Ie({innerType:fe,typeName:De.ZodDefault,defaultValue:typeof R.default=="function"?R.default:()=>R.default,...d(R)});class ke extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H={...F,common:{...F.common,issues:[]}},ae=this._def.innerType._parse({data:H.data,path:H.path,parent:{...H}});return(0,s.isAsync)(ae)?ae.then(oe=>({status:"valid",value:oe.status==="valid"?oe.value:this._def.catchValue({get error(){return new u.ZodError(H.common.issues)},input:H.data})})):{status:"valid",value:ae.status==="valid"?ae.value:this._def.catchValue({get error(){return new u.ZodError(H.common.issues)},input:H.data})}}removeCatch(){return this._def.innerType}}e.ZodCatch=ke,ke.create=(fe,R)=>new ke({innerType:fe,typeName:De.ZodCatch,catchValue:typeof R.catch=="function"?R.catch:()=>R.catch,...d(R)});class Te extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.nan){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.nan,received:H.parsedType}),s.INVALID}return{status:"valid",value:R.data}}}e.ZodNaN=Te,Te.create=fe=>new Te({typeName:De.ZodNaN,...d(fe)}),e.BRAND=Symbol("zod_brand");class ze extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H=F.data;return this._def.type._parse({data:H,path:F.path,parent:F})}unwrap(){return this._def.type}}e.ZodBranded=ze;class We extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.common.async)return(async()=>{const oe=await this._def.in._parseAsync({data:H.data,path:H.path,parent:H});return oe.status==="aborted"?s.INVALID:oe.status==="dirty"?(F.dirty(),(0,s.DIRTY)(oe.value)):this._def.out._parseAsync({data:oe.value,path:H.path,parent:H})})();{const ae=this._def.in._parseSync({data:H.data,path:H.path,parent:H});return ae.status==="aborted"?s.INVALID:ae.status==="dirty"?(F.dirty(),{status:"dirty",value:ae.value}):this._def.out._parseSync({data:ae.value,path:H.path,parent:H})}}static create(R,F){return new We({in:R,out:F,typeName:De.ZodPipeline})}}e.ZodPipeline=We;class Ne extends p{_parse(R){const F=this._def.innerType._parse(R),H=ae=>((0,s.isValid)(ae)&&(ae.value=Object.freeze(ae.value)),ae);return(0,s.isAsync)(F)?F.then(ae=>H(ae)):H(F)}unwrap(){return this._def.innerType}}e.ZodReadonly=Ne,Ne.create=(fe,R)=>new Ne({innerType:fe,typeName:De.ZodReadonly,...d(R)});function Ke(fe,R={},F){return fe?de.create().superRefine((H,ae)=>{var oe,Ce;if(!fe(H)){const Se=typeof R=="function"?R(H):typeof R=="string"?{message:R}:R,Ve=(Ce=(oe=Se.fatal)!==null&&oe!==void 0?oe:F)!==null&&Ce!==void 0?Ce:!0,Ge=typeof Se=="string"?{message:Se}:Se;ae.addIssue({code:"custom",...Ge,fatal:Ve})}}):de.create()}e.custom=Ke,e.late={object:W.lazycreate};var De;(function(fe){fe.ZodString="ZodString",fe.ZodNumber="ZodNumber",fe.ZodNaN="ZodNaN",fe.ZodBigInt="ZodBigInt",fe.ZodBoolean="ZodBoolean",fe.ZodDate="ZodDate",fe.ZodSymbol="ZodSymbol",fe.ZodUndefined="ZodUndefined",fe.ZodNull="ZodNull",fe.ZodAny="ZodAny",fe.ZodUnknown="ZodUnknown",fe.ZodNever="ZodNever",fe.ZodVoid="ZodVoid",fe.ZodArray="ZodArray",fe.ZodObject="ZodObject",fe.ZodUnion="ZodUnion",fe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",fe.ZodIntersection="ZodIntersection",fe.ZodTuple="ZodTuple",fe.ZodRecord="ZodRecord",fe.ZodMap="ZodMap",fe.ZodSet="ZodSet",fe.ZodFunction="ZodFunction",fe.ZodLazy="ZodLazy",fe.ZodLiteral="ZodLiteral",fe.ZodEnum="ZodEnum",fe.ZodEffects="ZodEffects",fe.ZodNativeEnum="ZodNativeEnum",fe.ZodOptional="ZodOptional",fe.ZodNullable="ZodNullable",fe.ZodDefault="ZodDefault",fe.ZodCatch="ZodCatch",fe.ZodPromise="ZodPromise",fe.ZodBranded="ZodBranded",fe.ZodPipeline="ZodPipeline",fe.ZodReadonly="ZodReadonly"})(De=e.ZodFirstPartyTypeKind||(e.ZodFirstPartyTypeKind={}));const Le=(fe,R={message:`Input not instance of ${fe.name}`})=>Ke(F=>F instanceof fe,R);e.instanceof=Le;const gt=w.create;e.string=gt;const rt=T.create;e.number=rt;const Ye=Te.create;e.nan=Ye;const kt=E.create;e.bigint=kt;const ht=C.create;e.boolean=ht;const tt=I.create;e.date=tt;const Nt=m.create;e.symbol=Nt;const It=B.create;e.undefined=It;const ut=ne.create;e.null=ut;const Yt=de.create;e.any=Yt;const Tt=$.create;e.unknown=Tt;const at=he.create;e.never=at;const lr=X.create;e.void=lr;const z=se.create;e.array=z;const J=W.create;e.object=J;const ee=W.strictCreate;e.strictObject=ee;const O=q.create;e.union=O;const te=xe.create;e.discriminatedUnion=te;const Ae=Q.create;e.intersection=Ae;const Ee=N.create;e.tuple=Ee;const Be=D.create;e.record=Be;const qe=G.create;e.map=qe;const He=me.create;e.set=He;const $e=_e.create;e.function=$e;const Lt=Pe.create;e.lazy=Lt;const ot=Fe.create;e.literal=ot;const vt=le.create;e.enum=vt;const yt=Y.create;e.nativeEnum=yt;const Ct=re.create;e.promise=Ct;const St=ge.create;e.effect=St,e.transformer=St;const bt=be.create;e.optional=bt;const xt=ce.create;e.nullable=xt;const wt=ge.createWithPreprocess;e.preprocess=wt;const st=We.create;e.pipeline=st;const ct=()=>gt().optional();e.ostring=ct;const nt=()=>rt().optional();e.onumber=nt;const lt=()=>ht().optional();e.oboolean=lt,e.coerce={string:fe=>w.create({...fe,coerce:!0}),number:fe=>T.create({...fe,coerce:!0}),boolean:fe=>C.create({...fe,coerce:!0}),bigint:fe=>E.create({...fe,coerce:!0}),date:fe=>I.create({...fe,coerce:!0})},e.NEVER=s.INVALID})(zR);(function(e){var t=Ze&&Ze.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i),Object.defineProperty(n,a,{enumerable:!0,get:function(){return o[i]}})}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ze&&Ze.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(xo,e),r(p6,e),r(FR,e),r(vh,e),r(zR,e),r(So,e)})(t3);(function(e){var t=Ze&&Ze.__createBinding||(Object.create?function(a,s,l,u){u===void 0&&(u=l),Object.defineProperty(a,u,{enumerable:!0,get:function(){return s[l]}})}:function(a,s,l,u){u===void 0&&(u=l),a[u]=s[l]}),r=Ze&&Ze.__setModuleDefault||(Object.create?function(a,s){Object.defineProperty(a,"default",{enumerable:!0,value:s})}:function(a,s){a.default=s}),n=Ze&&Ze.__importStar||function(a){if(a&&a.__esModule)return a;var s={};if(a!=null)for(var l in a)l!=="default"&&Object.prototype.hasOwnProperty.call(a,l)&&t(s,a,l);return r(s,a),s},o=Ze&&Ze.__exportStar||function(a,s){for(var l in a)l!=="default"&&!Object.prototype.hasOwnProperty.call(s,l)&&t(s,a,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;const i=n(t3);e.z=i,o(t3,e),e.default=i})(h6);const Boe="@ton/ton",Poe="14.0.0",Roe="https://github.com/ton-org/ton.git",Ooe="Whales Corp. ",Noe="MIT",Loe="dist/index.js",Doe=["dist"],Uoe={docs:"rm -fr docs && typedoc src/index.ts",build:"rm -fr dist && tsc --declaration",test:"jest --verbose --runInBand",release:"yarn build && yarn release-it --npm.yarn1"},joe={"@release-it/keep-a-changelog":"^5.0.0","@ton/core":"^0.56.0","@ton/crypto":"3.2.0","@ton/emulator":"^2.1.1","@types/jest":"^27.0.1","@types/node":"^16.7.10",buffer:"^6.0.3",expect:"^27.1.0",jest:"^27.1.0","jest-mock":"^27.1.0",karma:"^6.3.4","karma-chrome-launcher":"^3.1.0","karma-jasmine":"^4.0.1","karma-typescript":"^5.5.2","karma-webpack":"^5.0.0",prando:"^6.0.1","release-it":"^17.1.1","ts-jest":"^27.0.5","ts-loader":"^9.2.5","ts-node":"^10.7.0",typedoc:"^0.23.24",typescript:"^4.4.2",webpack:"^5.51.2"},Foe={axios:"^1.6.7",dataloader:"^2.0.0","symbol.inspect":"1.0.1",teslabot:"^1.3.0",zod:"^3.21.4"},zoe={"@ton/core":">=0.56.0","@ton/crypto":">=3.2.0"},$oe={access:"public",registry:"https://registry.npmjs.org/"},qoe="yarn@3.4.1",Woe={name:Boe,version:Poe,repository:Roe,author:Ooe,license:Noe,main:Loe,files:Doe,scripts:Uoe,devDependencies:joe,dependencies:Foe,peerDependencies:zoe,publishConfig:$oe,"release-it":{github:{release:!0},plugins:{"@release-it/keep-a-changelog":{filename:"CHANGELOG.md"}}},packageManager:qoe};var qR=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mh,"__esModule",{value:!0});mh.HttpApi=void 0;const Voe=Wg,$C=qR(Eoe),Hoe=qR(LR),et=h6,Koe=Woe.version,Qu=et.z.object({"@type":et.z.literal("ton.blockIdExt"),workchain:et.z.number(),shard:et.z.string(),seqno:et.z.number(),root_hash:et.z.string(),file_hash:et.z.string()}),Zoe=et.z.object({balance:et.z.union([et.z.number(),et.z.string()]),state:et.z.union([et.z.literal("active"),et.z.literal("uninitialized"),et.z.literal("frozen")]),data:et.z.string(),code:et.z.string(),last_transaction_id:et.z.object({"@type":et.z.literal("internal.transactionId"),lt:et.z.string(),hash:et.z.string()}),block_id:Qu,sync_utime:et.z.number()}),Goe=et.z.object({"@type":et.z.literal("ok")}),Yoe=et.z.object({"@type":et.z.literal("query.fees"),source_fees:et.z.object({"@type":et.z.literal("fees"),in_fwd_fee:et.z.number(),storage_fee:et.z.number(),gas_fee:et.z.number(),fwd_fee:et.z.number()})}),Qoe=et.z.object({gas_used:et.z.number(),exit_code:et.z.number(),stack:et.z.array(et.z.unknown())}),Xoe=et.z.union([et.z.object({"@type":et.z.literal("msg.dataRaw"),body:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataText"),text:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataDecryptedText"),text:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataEncryptedText"),text:et.z.string()})]),qC=et.z.object({source:et.z.string(),destination:et.z.string(),value:et.z.string(),fwd_fee:et.z.string(),ihr_fee:et.z.string(),created_lt:et.z.string(),body_hash:et.z.string(),msg_data:Xoe,message:et.z.string().optional()}),r3=et.z.object({data:et.z.string(),utime:et.z.number(),transaction_id:et.z.object({lt:et.z.string(),hash:et.z.string()}),fee:et.z.string(),storage_fee:et.z.string(),other_fee:et.z.string(),in_msg:et.z.union([et.z.undefined(),qC]),out_msgs:et.z.array(qC)}),WC=et.z.array(r3),Joe=et.z.object({state_root_hash:et.z.string(),last:Qu,init:Qu}),eae=et.z.object({shards:et.z.array(Qu)}),tae=et.z.object({"@type":et.z.literal("blocks.shortTxId"),mode:et.z.number(),account:et.z.string(),lt:et.z.string(),hash:et.z.string()}),VC=et.z.object({id:Qu,req_count:et.z.number(),incomplete:et.z.boolean(),transactions:et.z.array(tae)});class HC{constructor(t,r,n,o){this.namespace=t,this.cache=r,this.codec=n,this.keyEncoder=o}async get(t){let r=await this.cache.get(this.namespace,this.keyEncoder(t));if(r){let n=this.codec.safeParse(JSON.parse(r));if(n.success)return n.data}return null}async set(t,r){r!==null?await this.cache.set(this.namespace,this.keyEncoder(t),JSON.stringify(r)):await this.cache.set(this.namespace,this.keyEncoder(t),null)}}class rae{constructor(t,r){this.endpoint=t,this.cache=new Voe.InMemoryCache,this.parameters={timeout:(r==null?void 0:r.timeout)||3e4,apiKey:r==null?void 0:r.apiKey,adapter:r==null?void 0:r.adapter},this.shardCache=new HC("ton-shard",this.cache,et.z.array(Qu),n=>n+""),this.shardLoader=new $C.default(async n=>await Promise.all(n.map(async o=>{const i=await this.shardCache.get(o);if(i)return i;let a=(await this.doCall("shards",{seqno:o},eae)).shards;return await this.shardCache.set(o,a),a}))),this.shardTransactionsCache=new HC("ton-shard-tx",this.cache,VC,n=>n.workchain+":"+n.shard+":"+n.seqno),this.shardTransactionsLoader=new $C.default(async n=>await Promise.all(n.map(async o=>{const i=await this.shardTransactionsCache.get(o);if(i)return i;let a=await this.doCall("getBlockTransactions",{workchain:o.workchain,seqno:o.seqno,shard:o.shard},VC);return await this.shardTransactionsCache.set(o,a),a})),{cacheKeyFn:n=>n.workchain+":"+n.shard+":"+n.seqno})}getAddressInformation(t){return this.doCall("getAddressInformation",{address:t.toString()},Zoe)}async getTransactions(t,r){const n=r.inclusive;delete r.inclusive;let o;r.hash&&(o=Oe.Buffer.from(r.hash,"base64").toString("hex"));let i=r.limit;r.hash&&r.lt&&n!==!0&&i++;let a=await this.doCall("getTransactions",{address:t.toString(),...r,limit:i,hash:o},WC);return a.length>i&&(a=a.slice(0,i)),r.hash&&r.lt&&n!==!0&&a.shift(),a}async getMasterchainInfo(){return await this.doCall("getMasterchainInfo",{},Joe)}async getShards(t){return await this.shardLoader.load(t)}async getBlockTransactions(t,r,n){return await this.shardTransactionsLoader.load({workchain:t,seqno:r,shard:n})}async getTransaction(t,r,n){let o=Oe.Buffer.from(n,"base64").toString("hex"),a=(await this.doCall("getTransactions",{address:t.toString(),lt:r,hash:o,limit:1},WC)).find(s=>s.transaction_id.lt===r&&s.transaction_id.hash===n);return a||null}async callGetMethod(t,r,n){return await this.doCall("runGetMethod",{address:t.toString(),method:r,stack:nae(n)},Qoe)}async sendBoc(t){await this.doCall("sendBoc",{boc:t.toString("base64")},Goe)}async estimateFee(t,r){return await this.doCall("estimateFee",{address:t.toString(),body:r.body.toBoc().toString("base64"),init_data:r.initData?r.initData.toBoc().toString("base64"):"",init_code:r.initCode?r.initCode.toBoc().toString("base64"):"",ignore_chksig:r.ignoreSignature},Yoe)}async tryLocateResultTx(t,r,n){return await this.doCall("tryLocateResultTx",{source:t.toString(),destination:r.toString(),created_lt:n},r3)}async tryLocateSourceTx(t,r,n){return await this.doCall("tryLocateSourceTx",{source:t.toString(),destination:r.toString(),created_lt:n},r3)}async doCall(t,r,n){let o={"Content-Type":"application/json","X-Ton-Client-Version":Koe};this.parameters.apiKey&&(o["X-API-Key"]=this.parameters.apiKey);let i=await Hoe.default.post(this.endpoint,JSON.stringify({id:"1",jsonrpc:"2.0",method:t,params:r}),{headers:o,timeout:this.parameters.timeout,adapter:this.parameters.adapter});if(i.status!==200||!i.data.ok)throw Error("Received error: "+JSON.stringify(i.data));let a=n.safeParse(i.data.result);if(a.success)return a.data;throw Error("Malformed response: "+a.error.format()._errors.join(", "))}}mh.HttpApi=rae;function nae(e){let t=[];for(let r of e)if(r.type==="int")t.push(["num",r.value.toString()]);else if(r.type==="cell")t.push(["tvm.Cell",r.cell.toBoc().toString("base64")]);else if(r.type==="slice")t.push(["tvm.Slice",r.cell.toBoc().toString("base64")]);else if(r.type==="builder")t.push(["tvm.Builder",r.cell.toBoc().toString("base64")]);else throw Error("Unsupported stack item type: "+r.type);return t}var Hg={};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.TonClient=void 0;const iae=mh,vr=qt;class oae{constructor(t){this.parameters={endpoint:t.endpoint},this.api=new iae.HttpApi(this.parameters.endpoint,{timeout:t.timeout,apiKey:t.apiKey,adapter:t.httpAdapter})}async getBalance(t){return(await this.getContractState(t)).balance}async runMethod(t,r,n=[]){let o=await this.api.callGetMethod(t,r,n);if(o.exit_code!==0)throw Error("Unable to execute get method. Got exit_code: "+o.exit_code);return{gas_used:o.gas_used,stack:KC(o.stack)}}async callGetMethod(t,r,n=[]){return this.runMethod(t,r,n)}async runMethodWithError(t,r,n=[]){let o=await this.api.callGetMethod(t,r,n);return{gas_used:o.gas_used,stack:KC(o.stack),exit_code:o.exit_code}}async callGetMethodWithError(t,r,n=[]){return this.runMethodWithError(t,r,n)}async getTransactions(t,r){let n=await this.api.getTransactions(t,r),o=[];for(let i of n)o.push((0,vr.loadTransaction)(vr.Cell.fromBoc(Oe.Buffer.from(i.data,"base64"))[0].beginParse()));return o}async getTransaction(t,r,n){let o=await this.api.getTransaction(t,r,n);return o?(0,vr.loadTransaction)(vr.Cell.fromBoc(Oe.Buffer.from(o.data,"base64"))[0].beginParse()):null}async tryLocateResultTx(t,r,n){let o=await this.api.tryLocateResultTx(t,r,n);return(0,vr.loadTransaction)(vr.Cell.fromBase64(o.data).beginParse())}async tryLocateSourceTx(t,r,n){let o=await this.api.tryLocateSourceTx(t,r,n);return(0,vr.loadTransaction)(vr.Cell.fromBase64(o.data).beginParse())}async getMasterchainInfo(){let t=await this.api.getMasterchainInfo();return{workchain:t.init.workchain,shard:t.last.shard,initSeqno:t.init.seqno,latestSeqno:t.last.seqno}}async getWorkchainShards(t){return(await this.api.getShards(t)).map(n=>({workchain:n.workchain,shard:n.shard,seqno:n.seqno}))}async getShardTransactions(t,r,n){let o=await this.api.getBlockTransactions(t,r,n);if(o.incomplete)throw Error("Unsupported");return o.transactions.map(i=>({account:vr.Address.parseRaw(i.account),lt:i.lt,hash:i.hash}))}async sendMessage(t){const r=(0,vr.beginCell)().store((0,vr.storeMessage)(t)).endCell().toBoc();await this.api.sendBoc(r)}async sendFile(t){await this.api.sendBoc(t)}async estimateExternalMessageFee(t,r){return await this.api.estimateFee(t,{body:r.body,initCode:r.initCode,initData:r.initData,ignoreSignature:r.ignoreSignature})}async sendExternalMessage(t,r){if(await this.isContractDeployed(t.address)||!t.init){const n=(0,vr.external)({to:t.address,body:r});await this.sendMessage(n)}else{const n=(0,vr.external)({to:t.address,init:t.init,body:r});await this.sendMessage(n)}}async isContractDeployed(t){return(await this.getContractState(t)).state==="active"}async getContractState(t){let r=await this.api.getAddressInformation(t),n=BigInt(r.balance),o=r.state;return{balance:n,state:o,code:r.code!==""?Oe.Buffer.from(r.code,"base64"):null,data:r.data!==""?Oe.Buffer.from(r.data,"base64"):null,lastTransaction:r.last_transaction_id.lt!=="0"?{lt:r.last_transaction_id.lt,hash:r.last_transaction_id.hash}:null,blockId:{workchain:r.block_id.workchain,shard:r.block_id.shard,seqno:r.block_id.seqno},timestampt:r.sync_utime}}open(t){return(0,vr.openContract)(t,r=>n3(this,r.address,r.init))}provider(t,r){return n3(this,t,r??null)}}Hg.TonClient=oae;function Ts(e){const t=e["@type"];switch(t){case"tvm.list":case"tvm.tuple":return e.elements.map(Ts);case"tvm.cell":return vr.Cell.fromBoc(Oe.Buffer.from(e.bytes,"base64"))[0];case"tvm.slice":return vr.Cell.fromBoc(Oe.Buffer.from(e.bytes,"base64"))[0];case"tvm.stackEntryCell":return Ts(e.cell);case"tvm.stackEntrySlice":return Ts(e.slice);case"tvm.stackEntryTuple":return Ts(e.tuple);case"tvm.stackEntryList":return Ts(e.list);case"tvm.stackEntryNumber":return Ts(e.number);case"tvm.numberDecimal":return BigInt(e.number);default:throw Error("Unsupported item type: "+t)}}function aae(e){if(e[0]==="num"){let t=e[1];return t.startsWith("-")?{type:"int",value:-BigInt(t.slice(1))}:{type:"int",value:BigInt(t)}}else{if(e[0]==="null")return{type:"null"};if(e[0]==="cell")return{type:"cell",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="slice")return{type:"slice",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="builder")return{type:"builder",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="tuple"||e[0]==="list")return e[1].elements.length===0?{type:"null"}:{type:"tuple",items:e[1].elements.map(Ts)};throw Error("Unsupported stack item type: "+e[0])}}function KC(e){let t=[];for(let r of e)t.push(aae(r));return new vr.TupleReader(t)}function n3(e,t,r){return{async getState(){let n=await e.getContractState(t),o=n.balance,i=n.lastTransaction?{lt:BigInt(n.lastTransaction.lt),hash:Oe.Buffer.from(n.lastTransaction.hash,"base64")}:null,a;if(n.state==="active")a={type:"active",code:n.code?n.code:null,data:n.data?n.data:null};else if(n.state==="uninitialized")a={type:"uninit"};else if(n.state==="frozen")a={type:"frozen",stateHash:Oe.Buffer.alloc(0)};else throw Error("Unsupported state");return{balance:o,last:i,state:a}},async get(n,o){return{stack:(await e.callGetMethod(t,n,o)).stack}},async external(n){let o=null;r&&!await e.isContractDeployed(t)&&(o=r);const i=(0,vr.external)({to:t,init:o,body:n});let a=(0,vr.beginCell)().store((0,vr.storeMessage)(i)).endCell().toBoc();await e.sendFile(a)},async internal(n,o){let i=null;r&&!await e.isContractDeployed(t)&&(i=r);let a=!0;o.bounce!==null&&o.bounce!==void 0&&(a=o.bounce);let s;typeof o.value=="string"?s=(0,vr.toNano)(o.value):s=o.value;let l=null;typeof o.body=="string"?l=(0,vr.comment)(o.body):o.body&&(l=o.body),await n.send({to:t,value:s,bounce:a,sendMode:o.sendMode,init:i,body:l})},open(n){return(0,vr.openContract)(n,o=>n3(e,o.address,o.init??null))},getTransactions(n,o,i,a){return e.getTransactions(n,{limit:a??100,lt:o.toString(),hash:i.toString("base64"),inclusive:!0})}}}var Kg={},Zg={};Object.defineProperty(Zg,"__esModule",{value:!0});Zg.toUrlSafe=void 0;function sae(e){for(;e.indexOf("/")>=0;)e=e.replace("/","_");for(;e.indexOf("+")>=0;)e=e.replace("+","-");for(;e.indexOf("=")>=0;)e=e.replace("=","");return e}Zg.toUrlSafe=sae;var t0=Ze&&Ze.__classPrivateFieldSet||function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},Ut=Ze&&Ze.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},lae=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Vn,Hn,Kn,Pn;Object.defineProperty(Kg,"__esModule",{value:!0});Kg.TonClient4=void 0;const uae=lae(LR),Nn=qt,H2=Zg,ve=h6;class cae{constructor(t){Vn.set(this,void 0),Hn.set(this,void 0),Kn.set(this,void 0),Pn.set(this,void 0),t0(this,Pn,uae.default.create(),"f"),t0(this,Vn,t.endpoint,"f"),t0(this,Hn,t.timeout||5e3,"f"),t0(this,Kn,t.httpAdapter,"f"),t.requestInterceptor&&Ut(this,Pn,"f").interceptors.request.use(t.requestInterceptor)}async getLastBlock(){let t=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/latest",{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),r=fae.safeParse(t.data);if(!r.success)throw Error("Mailformed response: "+r.error.format()._errors.join(", "));return r.data}async getBlock(t){let r=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),n=ZC.safeParse(r.data);if(!n.success)throw Error("Mailformed response");if(!n.data.exist)throw Error("Block is out of scope");return n.data.block}async getBlockByUtime(t){let r=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/utime/"+t,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),n=ZC.safeParse(r.data);if(!n.success)throw Error("Mailformed response");if(!n.data.exist)throw Error("Block is out of scope");return n.data.block}async getAccount(t,r){let n=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0}),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),o=dae.safeParse(n.data);if(!o.success)throw Error("Mailformed response");return o.data}async getAccountLite(t,r){let n=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/lite",{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),o=hae.safeParse(n.data);if(!o.success)throw Error("Mailformed response");return o.data}async isContractDeployed(t,r){return(await this.getAccountLite(t,r)).account.state.type==="active"}async isAccountChanged(t,r,n){let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/changed/"+n.toString(10),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=pae.safeParse(o.data);if(!i.success)throw Error("Mailformed response");return i.data}async getAccountTransactions(t,r,n){let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/account/"+t.toString({urlSafe:!0})+"/tx/"+r.toString(10)+"/"+(0,H2.toUrlSafe)(n.toString("base64")),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=yae.safeParse(o.data);if(!i.success)throw Error("Mailformed response");let a=i.data,s=[],l=Nn.Cell.fromBoc(Oe.Buffer.from(a.boc,"base64"));for(let u=0;u0&&(n="/"+[...r].sort().join(","));let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/config"+n,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=mae.safeParse(o.data);if(!i.success)throw Error("Mailformed response");return i.data}async runMethod(t,r,n,o){let i=o&&o.length>0?"/"+(0,H2.toUrlSafe)((0,Nn.serializeTuple)(o).toBoc({idx:!1,crc32:!1}).toString("base64")):"",a=Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/run/"+encodeURIComponent(n)+i,s=await Ut(this,Pn,"f").get(a,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),l=gae.safeParse(s.data);if(!l.success)throw Error("Mailformed response");let u=l.data.resultRaw?(0,Nn.parseTuple)(Nn.Cell.fromBoc(Oe.Buffer.from(l.data.resultRaw,"base64"))[0]):[];return{exitCode:l.data.exitCode,result:u,resultRaw:l.data.resultRaw,block:l.data.block,shardBlock:l.data.shardBlock,reader:new Nn.TupleReader(u)}}async sendMessage(t){let r=await Ut(this,Pn,"f").post(Ut(this,Vn,"f")+"/send",{boc:t.toString("base64")},{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")});if(!vae.safeParse(r.data).success)throw Error("Mailformed response");return{status:r.data.status}}open(t){return(0,Nn.openContract)(t,r=>mf(this,null,r.address,r.init))}openAt(t,r){return(0,Nn.openContract)(r,n=>mf(this,t,n.address,n.init))}provider(t,r){return mf(this,null,t,r??null)}providerAt(t,r,n){return mf(this,t,r,n??null)}}Kg.TonClient4=cae;Vn=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,Pn=new WeakMap;function mf(e,t,r,n){return{async getState(){let o=t;o===null&&(o=(await e.getLastBlock()).last.seqno);let i=await e.getAccount(o,r),a=i.account.last?{lt:BigInt(i.account.last.lt),hash:Oe.Buffer.from(i.account.last.hash,"base64")}:null,s;if(i.account.state.type==="active")s={type:"active",code:i.account.state.code?Oe.Buffer.from(i.account.state.code,"base64"):null,data:i.account.state.data?Oe.Buffer.from(i.account.state.data,"base64"):null};else if(i.account.state.type==="uninit")s={type:"uninit"};else if(i.account.state.type==="frozen")s={type:"frozen",stateHash:Oe.Buffer.from(i.account.state.stateHash,"base64")};else throw Error("Unsupported state");return{balance:BigInt(i.account.balance.coins),last:a,state:s}},async get(o,i){let a=t;a===null&&(a=(await e.getLastBlock()).last.seqno);let s=await e.runMethod(a,r,o,i);if(s.exitCode!==0&&s.exitCode!==1)throw Error("Exit code: "+s.exitCode);return{stack:new Nn.TupleReader(s.result)}},async external(o){let i=await e.getLastBlock(),a=null;n&&(await e.getAccountLite(i.last.seqno,r)).account.state.type!=="active"&&(a=n);const s=(0,Nn.external)({to:r,init:a,body:o});let l=(0,Nn.beginCell)().store((0,Nn.storeMessage)(s)).endCell().toBoc();await e.sendMessage(l)},async internal(o,i){let a=await e.getLastBlock(),s=null;n&&(await e.getAccountLite(a.last.seqno,r)).account.state.type!=="active"&&(s=n);let l=!0;i.bounce!==null&&i.bounce!==void 0&&(l=i.bounce);let u;typeof i.value=="string"?u=(0,Nn.toNano)(i.value):u=i.value;let c=null;typeof i.body=="string"?c=(0,Nn.comment)(i.body):i.body&&(c=i.body),await o.send({to:r,value:u,bounce:l,sendMode:i.sendMode,init:s,body:c})},open(o){return(0,Nn.openContract)(o,i=>mf(e,t,i.address,i.init??null))},async getTransactions(o,i,a,s){const l=typeof s=="number";if(l&&s<=0)return[];let u=[];do{const c=await e.getAccountTransactions(o,i,a),h=c[0].tx,[d,p]=[h.lt,h.hash()];if(u.length>0&&d===i&&p.equals(a)&&c.shift(),c.length===0)break;const b=c[c.length-1].tx,[S,x]=[b.lt,b.hash()];if(S===i&&x.equals(a))break;u.push(...c.map(k=>k.tx)),i=S,a=x}while(l&&u.lengthu===o))==null?void 0:s[0];if(a===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${o}`);return{networkGlobalId:r,workChain:n,walletVersion:a,subwalletNumber:i}}Bl.loadWalletIdV5Beta=Mae;function Iae(e){return t=>{t.storeInt(e.networkGlobalId,32),t.storeInt(e.workChain,8),t.storeUint(HR[e.walletVersion],8),t.storeUint(e.subwalletNumber,32)}}Bl.storeWalletIdV5Beta=Iae;var XC;function KR(){if(XC)return Kc;XC=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.WalletContractV5Beta=void 0;const e=qt,t=Ro(),r=Bl;class n{static create(i){var s,l,u,c;const a={networkGlobalId:((s=i.walletId)==null?void 0:s.networkGlobalId)??-239,workChain:((l=i==null?void 0:i.walletId)==null?void 0:l.workChain)??0,subwalletNumber:((u=i==null?void 0:i.walletId)==null?void 0:u.subwalletNumber)??0,walletVersion:((c=i==null?void 0:i.walletId)==null?void 0:c.walletVersion)??"v5"};return new n(a,i.publicKey)}constructor(i,a){this.walletId=i,this.publicKey=a,this.walletId=i;let s=e.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAIwAIQgLkzzsvTG1qYeoPK1RH0mZ4WyavNjfbLe7mvNGqgm80Eg3NjhE=","base64"))[0],l=(0,e.beginCell)().storeInt(0,33).store((0,r.storeWalletIdV5Beta)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:s,data:l},this.address=(0,e.contractAddress)(this.walletId.workChain,{code:s,data:l})}async getBalance(i){return(await i.getState()).balance}async getSeqno(i){return(await i.getState()).state.type==="active"?(await i.get("seqno",[])).stack.readNumber():0}async getExtensions(i){return(await i.getState()).state.type==="active"?(await i.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(i){const a=await this.getExtensions(i);if(!a)return[];const s=e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(8),a);return s.keys().map(l=>{const u=s.get(l),c=l^u+1n;return e.Address.parseRaw(`${u}:${c.toString(16).padStart(64,"0")}`)})}async getIsSecretKeyAuthEnabled(i){return(await i.get("get_is_signature_auth_allowed",[])).stack.readNumber()!==0}async send(i,a){await i.external(a)}async sendTransfer(i,a){const s=await this.createTransfer(a);await this.send(i,s)}async sendAddExtension(i,a){const s=await this.createAddExtension(a);await this.send(i,s)}async sendRemoveExtension(i,a){const s=await this.createRemoveExtension(a);await this.send(i,s)}async sendActionsBatch(i,a){const s=await this.createRequest(a);await this.send(i,s)}createActions(i){return i.messages.map(s=>({type:"sendMsg",mode:i.sendMode,outMsg:s}))}createTransfer(i){return this.createRequest({...i,actions:this.createActions({messages:i.messages,sendMode:i.sendMode})})}createAddExtension(i){return this.createRequest({...i,actions:[{type:"addExtension",address:i.extensionAddress}]})}createRemoveExtension(i){return this.createRequest({...i,actions:[{type:"removeExtension",address:i.extensionAddress}]})}createRequest(i){return i.authType==="extension"?(0,t.createWalletTransferV5Beta)(i):(0,t.createWalletTransferV5Beta)({...i,walletId:(0,r.storeWalletIdV5Beta)(this.walletId)})}sender(i,a){return{send:async s=>{let l=await this.getSeqno(i),u=this.createTransfer({seqno:l,secretKey:a,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(i,u)}}}}return Kc.WalletContractV5Beta=n,n.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},Kc}var Ki={},Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.isOutActionBasic=Pl.isOutActionExtended=void 0;function ZR(e){return e.type==="setIsPublicKeyEnabled"||e.type==="addExtension"||e.type==="removeExtension"}Pl.isOutActionExtended=ZR;function Tae(e){return!ZR(e)}Pl.isOutActionBasic=Tae;Object.defineProperty(Ki,"__esModule",{value:!0});Ki.loadOutListExtendedV5Beta=Ki.storeOutListExtendedV5Beta=Ki.loadOutActionV5BetaExtended=Ki.storeOutActionExtendedV5Beta=void 0;const E0=qt,JC=Pl,GR=550222170;function Bae(e){return t=>{t.storeUint(GR,32).storeUint(e.isEnabled?1:0,1)}}const YR=474012575;function Pae(e){return t=>{t.storeUint(YR,32).storeAddress(e.address)}}const QR=1588524196;function Rae(e){return t=>{t.storeUint(QR,32).storeAddress(e.address)}}function XR(e){switch(e.type){case"setIsPublicKeyEnabled":return Bae(e);case"addExtension":return Pae(e);case"removeExtension":return Rae(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Ki.storeOutActionExtendedV5Beta=XR;function JR(e){const t=e.loadUint(32);switch(t){case GR:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case YR:return{type:"addExtension",address:e.loadAddress()};case QR:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Ki.loadOutActionV5BetaExtended=JR;function eO(e){const[t,...r]=e;if(!t||!(0,JC.isOutActionExtended)(t)){if(e.some(JC.isOutActionExtended))throw new Error("Can't serialize actions list: all extended actions must be placed before out actions");return n=>{n.storeUint(0,1).storeRef((0,E0.beginCell)().store((0,E0.storeOutList)(e)).endCell())}}return n=>{n.storeUint(1,1).store(XR(t)).storeRef((0,E0.beginCell)().store(eO(r)).endCell())}}Ki.storeOutListExtendedV5Beta=eO;function Oae(e){const t=[];for(;e.loadUint(1);){const n=JR(e);t.push(n),e=e.loadRef().beginParse()}const r=(0,E0.loadOutList)(e.loadRef().beginParse());if(r.some(n=>n.type==="setCode"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5");return t.concat(r)}Ki.loadOutListExtendedV5Beta=Oae;var Yg={};Object.defineProperty(Yg,"__esModule",{value:!0});Yg.signPayload=void 0;const Nae=Fl();function Lae(e,t,r){return"secretKey"in e?r((0,Nae.sign)(t.endCell().hash(),e.secretKey),t):e.signer(t.endCell()).then(n=>r(n,t))}Yg.signPayload=Lae;var Zc={},ea={};Object.defineProperty(ea,"__esModule",{value:!0});ea.storeWalletIdV5R1=ea.loadWalletIdV5R1=ea.isWalletIdV5R1ClientContext=void 0;const gu=qt;function tO(e){return typeof e!="number"}ea.isWalletIdV5R1ClientContext=tO;const rO={v5r1:0};function Dae(e,t){var a;const r=new gu.BitReader(new gu.BitString(typeof e=="bigint"?Oe.Buffer.from(e.toString(16),"hex"):e instanceof gu.Slice?e.loadBuffer(4):e,0,32)).loadInt(32),n=BigInt(r)^BigInt(t),o=(0,gu.beginCell)().storeInt(n,32).endCell().beginParse();if(o.loadUint(1)){const s=o.loadInt(8),l=o.loadUint(8),u=o.loadUint(15),c=(a=Object.entries(rO).find(([h,d])=>d===l))==null?void 0:a[0];if(c===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${l}`);return{networkGlobalId:t,context:{walletVersion:c,workChain:s,subwalletNumber:u}}}else{const s=o.loadUint(31);return{networkGlobalId:t,context:s}}}ea.loadWalletIdV5R1=Dae;function Uae(e){return t=>{let r;return tO(e.context)?r=(0,gu.beginCell)().storeUint(1,1).storeInt(e.context.workChain,8).storeUint(rO[e.context.walletVersion],8).storeUint(e.context.subwalletNumber,15).endCell().beginParse().loadInt(32):r=(0,gu.beginCell)().storeUint(0,1).storeUint(e.context,31).endCell().beginParse().loadInt(32),t.storeInt(BigInt(e.networkGlobalId)^BigInt(r),32)}}ea.storeWalletIdV5R1=Uae;var eE;function nO(){if(eE)return Zc;eE=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.WalletContractV5R1=void 0;const e=qt,t=Ro(),r=ea;class n{static create(i){var s,l,u;let a=0;return"workChain"in i&&i.workChain!=null&&(a=i.workChain),(s=i.walletId)!=null&&s.context&&(0,r.isWalletIdV5R1ClientContext)(i.walletId.context)&&i.walletId.context.workChain!=null&&(a=i.walletId.context.workChain),new n(a,i.publicKey,{networkGlobalId:((l=i.walletId)==null?void 0:l.networkGlobalId)??-239,context:((u=i.walletId)==null?void 0:u.context)??{workChain:0,walletVersion:"v5r1",subwalletNumber:0}})}constructor(i,a,s){this.publicKey=a,this.walletId=s,this.walletId=s;let l=e.Cell.fromBoc(Oe.Buffer.from("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e","hex"))[0],u=(0,e.beginCell)().storeUint(1,1).storeUint(0,32).store((0,r.storeWalletIdV5R1)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:l,data:u},this.address=(0,e.contractAddress)(i,{code:l,data:u})}async getBalance(i){return(await i.getState()).balance}async getSeqno(i){return(await i.getState()).state.type==="active"?(await i.get("seqno",[])).stack.readNumber():0}async getExtensions(i){return(await i.getState()).state.type==="active"?(await i.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(i){const a=await this.getExtensions(i);return a?e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(1),a).keys().map(l=>{const u=this.address.workChain;return e.Address.parseRaw(`${u}:${l.toString(16).padStart(64,"0")}`)}):[]}async getIsSecretKeyAuthEnabled(i){return(await i.get("is_signature_allowed",[])).stack.readBoolean()}async send(i,a){await i.external(a)}async sendTransfer(i,a){const s=await this.createTransfer(a);await this.send(i,s)}async sendAddExtension(i,a){const s=await this.createAddExtension(a);await this.send(i,s)}async sendRemoveExtension(i,a){const s=await this.createRemoveExtension(a);await this.send(i,s)}createActions(i){return i.messages.map(s=>({type:"sendMsg",mode:i.sendMode,outMsg:s}))}createTransfer(i){return this.createRequest({actions:this.createActions({messages:i.messages,sendMode:i.sendMode}),...i})}createAddExtension(i){return this.createRequest({actions:[{type:"addExtension",address:i.extensionAddress}],...i})}createRemoveExtension(i){return this.createRequest({actions:[{type:"removeExtension",address:i.extensionAddress}],...i})}createRequest(i){return i.authType==="extension"?(0,t.createWalletTransferV5R1)(i):(0,t.createWalletTransferV5R1)({...i,walletId:(0,r.storeWalletIdV5R1)(this.walletId)})}sender(i,a){return{send:async s=>{let l=await this.getSeqno(i),u=this.createTransfer({seqno:l,secretKey:a,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(i,u)}}}}return Zc.WalletContractV5R1=n,n.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},Zc}var Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.patchV5R1ActionsSendMode=Un.toSafeV5R1SendMode=Un.loadOutListExtendedV5R1=Un.storeOutListExtendedV5R1=Un.loadOutActionExtendedV5R1=Un.storeOutActionExtendedV5R1=void 0;const Nd=qt,tE=Pl,iO=4;function jae(e){return t=>{t.storeUint(iO,8).storeUint(e.isEnabled?1:0,1)}}const oO=2;function Fae(e){return t=>{t.storeUint(oO,8).storeAddress(e.address)}}const aO=3;function zae(e){return t=>{t.storeUint(aO,8).storeAddress(e.address)}}function g6(e){switch(e.type){case"setIsPublicKeyEnabled":return jae(e);case"addExtension":return Fae(e);case"removeExtension":return zae(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Un.storeOutActionExtendedV5R1=g6;function i3(e){const t=e.loadUint(8);switch(t){case iO:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case oO:return{type:"addExtension",address:e.loadAddress()};case aO:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Un.loadOutActionExtendedV5R1=i3;function $ae(e){const t=e.filter(tE.isOutActionExtended),r=e.filter(tE.isOutActionBasic);return n=>{const o=r.length?(0,Nd.beginCell)().store((0,Nd.storeOutList)(r.slice().reverse())):null;if(n.storeMaybeRef(o),t.length===0)n.storeUint(0,1);else{const[i,...a]=t;n.storeUint(1,1).store(g6(i)),a.length>0&&n.storeRef(sO(a))}}}Un.storeOutListExtendedV5R1=$ae;function sO(e){const[t,...r]=e;let n=(0,Nd.beginCell)().store(g6(t));return r.length>0&&(n=n.storeRef(sO(r))),n.endCell()}function qae(e){const t=[],r=e.loadMaybeRef();if(r){const n=(0,Nd.loadOutList)(r.beginParse());if(n.some(o=>o.type!=="sendMsg"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5r1");t.push(...n)}if(e.loadBoolean()){const n=i3(e);t.push(n)}for(;e.remainingRefs>0;){e=e.loadRef().beginParse();const n=i3(e);t.push(n)}return t}Un.loadOutListExtendedV5R1=qae;function lO(e,t){return t==="internal"||t==="extension"?e:e|Nd.SendMode.IGNORE_ERRORS}Un.toSafeV5R1SendMode=lO;function Wae(e,t){return e.map(r=>r.type==="sendMsg"?{...r,mode:lO(r.mode,t)}:r)}Un.patchV5R1ActionsSendMode=Wae;var rE;function Ro(){if(rE)return Bn;rE=1,Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.createWalletTransferV5R1=Bn.createWalletTransferV5Beta=Bn.createWalletTransferV4=Bn.createWalletTransferV3=Bn.createWalletTransferV2=Bn.createWalletTransferV1=void 0;const e=qt,t=Fl(),r=KR(),n=Ki,o=Yg,i=nO(),a=Un;function s(b,S){return(0,e.beginCell)().storeBuffer(b).storeBuilder(S).endCell()}function l(b,S){return(0,e.beginCell)().storeBuilder(S).storeBuffer(b).endCell()}function u(b){let S=(0,e.beginCell)().storeUint(b.seqno,32);b.message&&(S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(b.message))));let x=(0,t.sign)(S.endCell().hash(),b.secretKey);return(0,e.beginCell)().storeBuffer(x).storeBuilder(S).endCell()}Bn.createWalletTransferV1=u;function c(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.seqno,32);if(b.seqno===0)for(let M=0;M<32;M++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);for(let M of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(M)));let x=(0,t.sign)(S.endCell().hash(),b.secretKey);return(0,e.beginCell)().storeBuffer(x).storeBuilder(S).endCell()}Bn.createWalletTransferV2=c;function h(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.walletId,32);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);S.storeUint(b.seqno,32);for(let x of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(x)));return(0,o.signPayload)(b,S,s)}Bn.createWalletTransferV3=h;function d(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.walletId,32);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);S.storeUint(b.seqno,32),S.storeUint(0,8);for(let x of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(x)));return(0,o.signPayload)(b,S,s)}Bn.createWalletTransferV4=d;function p(b){if(b.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(b.authType==="extension")return(0,e.beginCell)().storeUint(r.WalletContractV5Beta.OpCodes.auth_extension,32).store((0,n.storeOutListExtendedV5Beta)(b.actions)).endCell();const S=(0,e.beginCell)().storeUint(b.authType==="internal"?r.WalletContractV5Beta.OpCodes.auth_signed_internal:r.WalletContractV5Beta.OpCodes.auth_signed_external,32).store(b.walletId);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);return S.storeUint(b.seqno,32).store((0,n.storeOutListExtendedV5Beta)(b.actions)),(0,o.signPayload)(b,S,l)}Bn.createWalletTransferV5Beta=p;function v(b){if(b.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(b={...b},b.authType==="extension")return(0,e.beginCell)().storeUint(i.WalletContractV5R1.OpCodes.auth_extension,32).storeUint(b.queryId??0,64).store((0,a.storeOutListExtendedV5R1)(b.actions)).endCell();b.actions=(0,a.patchV5R1ActionsSendMode)(b.actions,b.authType);const S=(0,e.beginCell)().storeUint(b.authType==="internal"?i.WalletContractV5R1.OpCodes.auth_signed_internal:i.WalletContractV5R1.OpCodes.auth_signed_external,32).store(b.walletId);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);return S.storeUint(b.seqno,32).store((0,a.storeOutListExtendedV5R1)(b.actions)),(0,o.signPayload)(b,S,l)}return Bn.createWalletTransferV5R1=v,Bn}Object.defineProperty(Gg,"__esModule",{value:!0});Gg.WalletContractV1R1=void 0;const Kl=qt,Vae=Ro();class m6{static create(t){return new m6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Kl.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEARAAAhP8AIN2k8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVEH98Ik=","base64"))[0],o=(0,Kl.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Kl.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){let r=await t.getState();return r.state.type==="active"?Kl.Cell.fromBoc(r.state.data)[0].beginParse().loadUint(32):0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Kl.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Vae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Kl.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Gg.WalletContractV1R1=m6;var Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});Qg.WalletContractV1R2=void 0;const Gc=qt,Hae=Ro();class v6{static create(t){return new v6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Gc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAUwAAov8AIN0gggFMl7qXMO1E0NcLH+Ck8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVNDieG8=","base64"))[0],o=(0,Gc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Gc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Gc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Hae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Gc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Qg.WalletContractV1R2=v6;var Xg={};Object.defineProperty(Xg,"__esModule",{value:!0});Xg.WalletContractV1R3=void 0;const Yc=qt,Kae=Ro();class y6{static create(t){return new y6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Yc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAXwAAuv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVLW4bkI=","base64"))[0],o=(0,Yc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Yc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Yc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Kae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Yc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Xg.WalletContractV1R3=y6;var Jg={};Object.defineProperty(Jg,"__esModule",{value:!0});Jg.WalletContractV2R1=void 0;const Qc=qt,Zae=Ro();class b6{static create(t){return new b6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Qc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAVwAAqv8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VShNwu2","base64"))[0],o=(0,Qc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Qc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Qc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Zae.createWalletTransferV2)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Qc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}Jg.WalletContractV2R1=b6;var em={};Object.defineProperty(em,"__esModule",{value:!0});em.WalletContractV2R2=void 0;const Xc=qt,Gae=Ro();class w6{static create(t){return new w6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Xc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAYwAAwv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VQETNeh","base64"))[0],o=(0,Xc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Xc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Xc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Gae.createWalletTransferV2)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Xc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}em.WalletContractV2R2=w6;var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.WalletContractV3R1=void 0;const Jc=qt,Yae=Ro();class _6{static create(t){return new _6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=Jc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=","base64"))[0],i=(0,Jc.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(r).endCell();this.init={code:o,data:i},this.address=(0,Jc.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Yae.createWalletTransferV3)({...t,sendMode:t.sendMode??Jc.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Jc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}tm.WalletContractV3R1=_6;var rm={};Object.defineProperty(rm,"__esModule",{value:!0});rm.WalletContractV3R2=void 0;const ef=qt,Qae=Ro();class x6{static create(t){return new x6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=ef.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=","base64"))[0],i=(0,ef.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(r).endCell();this.init={code:o,data:i},this.address=(0,ef.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Qae.createWalletTransferV3)({...t,sendMode:t.sendMode??ef.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,ef.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}rm.WalletContractV3R2=x6;var nm={};Object.defineProperty(nm,"__esModule",{value:!0});nm.WalletContractV4=void 0;const tf=qt,Xae=Ro();class S6{static create(t){return new S6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=tf.Cell.fromBoc(Oe.Buffer.from("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==","base64"))[0],i=(0,tf.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(this.publicKey).storeBit(0).endCell();this.init={code:o,data:i},this.address=(0,tf.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Xae.createWalletTransferV4)({...t,sendMode:t.sendMode??tf.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,tf.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}nm.WalletContractV4=S6;var uO={};(function(e){var t=Ze&&Ze.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(o,i);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,s)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ze&&Ze.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(KR(),e),r(Ki,e),r(Bl,e)})(uO);var cO={};(function(e){var t=Ze&&Ze.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(o,i);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,s)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ze&&Ze.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(nO(),e),r(Un,e),r(ea,e)})(cO);var im={};Object.defineProperty(im,"__esModule",{value:!0});im.JettonMaster=void 0;const Jae=qt;class C6{static create(t){return new C6(t)}constructor(t){this.address=t}async getWalletAddress(t,r){return(await t.get("get_wallet_address",[{type:"slice",cell:(0,Jae.beginCell)().storeAddress(r).endCell()}])).stack.readAddress()}async getJettonData(t){let r=await t.get("get_jetton_data",[]),n=r.stack.readBigNumber(),o=r.stack.readBoolean(),i=r.stack.readAddress(),a=r.stack.readCell(),s=r.stack.readCell();return{totalSupply:n,mintable:o,adminAddress:i,content:a,walletCode:s}}}im.JettonMaster=C6;var om={};Object.defineProperty(om,"__esModule",{value:!0});om.JettonWallet=void 0;class E6{static create(t){return new E6(t)}constructor(t){this.address=t}async getBalance(t){return(await t.getState()).state.type!=="active"?0n:(await t.get("get_wallet_data",[])).stack.readBigNumber()}}om.JettonWallet=E6;var yh={};Object.defineProperty(yh,"__esModule",{value:!0});yh.MultisigOrder=void 0;const nE=Fl(),r0=qt;class e1{constructor(t){this.signatures={},this.payload=t}static fromCell(t){var a;let r=t.beginParse(),n=(a=r.loadMaybeRef())==null?void 0:a.beginParse();const o=r.asCell();let i=new e1(o);if(n){for(;n.remainingBits>0;){const s=n.loadBuffer(64),l=n.loadUint(8);i.signatures[l]=s,n.remainingRefs>0?n=n.loadRef().asSlice():n.skip(1)}n.endParse()}return i}static fromPayload(t){return new e1(t)}addSignature(t,r,n){const o=this.payload.hash();if(!(0,nE.signVerify)(o,r,n.owners.get(t).slice(0,-1)))throw Error("invalid signature");this.signatures[t]=r}sign(t,r){const n=this.payload.hash();return this.signatures[t]=(0,nE.sign)(n,r),n}unionSignatures(t){this.signatures=Object.assign({},this.signatures,t.signatures)}clearSignatures(){this.signatures={}}toCell(t){let r=(0,r0.beginCell)().storeBit(0);for(const n in this.signatures){const o=this.signatures[n];r=(0,r0.beginCell)().storeBit(1).storeRef((0,r0.beginCell)().storeBuffer(o).storeUint(parseInt(n),8).storeBuilder(r).endCell())}return(0,r0.beginCell)().storeUint(t,8).storeBuilder(r).storeBuilder(this.payload.asBuilder()).endCell()}}yh.MultisigOrder=e1;var am={};Object.defineProperty(am,"__esModule",{value:!0});am.MultisigOrderBuilder=void 0;const rf=qt,ese=yh;class tse{constructor(t,r){this.messages=(0,rf.beginCell)(),this.queryId=0n,this.walletId=t,this.queryOffset=r||7200}addMessage(t,r){if(this.messages.refs>=4)throw Error("only 4 refs are allowed");this.updateQueryId(),this.messages.storeUint(r,8),this.messages.storeRef((0,rf.beginCell)().store((0,rf.storeMessageRelaxed)(t)).endCell())}clearMessages(){this.messages=(0,rf.beginCell)()}build(){return ese.MultisigOrder.fromPayload((0,rf.beginCell)().storeUint(this.walletId,32).storeUint(this.queryId,64).storeBuilder(this.messages).endCell())}updateQueryId(){const t=BigInt(Math.floor(Date.now()/1e3+this.queryOffset));this.queryId=t<<32n}}am.MultisigOrderBuilder=tse;var sm={};Object.defineProperty(sm,"__esModule",{value:!0});sm.MultisigWallet=void 0;const iE=Fl(),Rn=qt,rse=Rn.Cell.fromBase64("te6ccgECKwEABBgAART/APSkE/S88sgLAQIBIAIDAgFIBAUE2vIgxwCOgzDbPOCDCNcYIPkBAdMH2zwiwAAToVNxePQOb6Hyn9s8VBq6+RDyoAb0BCD5AQHTH1EYuvKq0z9wUwHwCgHCCAGDCryx8mhTFYBA9A5voSCYDqQgwgryZw7f+COqH1NAufJhVCOjU04gIyEiAgLMBgcCASAMDQIBIAgJAgFmCgsAA9GEAiPymAvHoHN9CYbZ5S7Z4BPHohwhJQAtAKkItdJEqCTItdKlwLUAdAT8ArobBKAATwhbpEx4CBukTDgAdAg10rDAJrUAvALyFjPFszJ4HHXI8gBzxb0AMmACASAODwIBIBQVARW77ZbVA0cFUg2zyCoCAUgQEQIBIBITAXOxHXQgwjXGCD5AQHTB4IB1MTtQ9hTIHj0Dm+h8p/XC/9eMfkQ8qCuAfQEIW6TW3Ey4PkBWNs8AaQBgJwA9rtqA6ADoAPoCAXoCEfyAgPyA3XlP+AXkegAA54tkwAAXrhlXP8EA1WZ2oexAAgEgFhcCASAYGQFRtyVbZ4YmRmpGEAgegc30McJNhFpAADMaYeYuAFrgJhwLb+4cC3d0bhAjAYm1WZtnhqvgb+2xxsoicAgej430pBHEoFpAADHDhBACGuQkuuBk9kUWE5kAOeLKhACQCB6IYFImHFImHFImXEA2YlzNijAjAgEgGhsAF7UGtc4QQDVZnah7EAIBIBwdAgOZOB4fARGsGm2eL4G2CUAjABWt+UEAzJV2oewYQAENqTbPBVfBYCMAFa3f3CCAarM7UPYgAiDbPALyZfgAUENxQxPbPO1UIyoACtP/0wcwBKDbPC+uUyCw8mISsQKkJbNTHLmwJYEA4aojoCi8sPJpggGGoPgBBZcCERACPj4wjo0REB/bPEDXePRDEL0F4lQWW1Rz51YQU9zbPFRxClR6vCQlKCYAIO1E0NMf0wfTB9M/9AT0BNEAXgGOGjDSAAHyo9MH0wdQA9cBIPkBBfkBFbrypFAD4GwhIddKqgIi10m68qtwVCATAAwByMv/ywcE1ts87VT4D3AlblOJvrGYEG4QLVDHXwePGzBUJANQTds8UFWgRlAQSRA6SwlTuds8UFQWf+L4AAeDJaGOLCaAQPSWb6UglDBTA7neII4WODk5CNIAAZfTBzAW8AcFkTDifwgHBZJsMeKz5jAGKicoKQBgcI4pA9CDCNcY0wf0BDBTFnj0Dm+h8qXXC/9URUT5EPKmrlIgsVIDvRShI27mbCIyAH5SML6OIF8D+ACTItdKmALTB9QC+wAC6DJwyMoAQBSAQPRDAvAHjhdxyMsAFMsHEssHWM8BWM8WQBOAQPRDAeIBII6KEEUQNEMA2zztVJJfBuIqABzIyx/LB8sHyz/0APQAyQ==");class k6{constructor(t,r,n,o,i){this.provider=null,this.owners=Rn.Dictionary.empty(),this.workchain=r,this.walletId=n,this.k=o;for(let a=0;a0;){const i=n.readTuple(),a=i.readNumber(),s=i.readNumber();i.pop();const l=i.readNumber();o.push({id:a,unfreezeAt:s,stakeHeld:l})}return o}async getPastElections(t){const r=await t.get("past_elections",[]),n=new xi.TupleReader(r.stack.readLispList()),o=[];for(;n.remaining>0;){const i=n.readTuple(),a=i.readNumber(),s=i.readNumber(),l=i.readNumber();i.pop();const u=i.readCell(),c=i.readBigNumber(),h=i.readBigNumber();let d=new Map;const p=u.beginParse().loadDictDirect(xi.Dictionary.Keys.Buffer(32),nse);for(const[v,b]of p)d.set(BigInt("0x"+v.toString("hex")).toString(10),{address:b.address,weight:b.weight,stake:b.stake});o.push({id:a,unfreezeAt:s,stakeHeld:l,totalStake:c,bonuses:h,frozen:d})}return o}async getElectionEntities(t){const r=await t.getState();if(r.state.type!=="active")throw Error("Unexpected error");const o=xi.Cell.fromBoc(r.state.data)[0].beginParse();if(!o.loadBit())return null;const i=o.loadRef().beginParse(),a=i.loadUint(32),s=i.loadUint(32),l=i.loadCoins(),u=i.loadCoins(),c=i.loadDict(xi.Dictionary.Keys.Buffer(32),ise);let h=[];if(c)for(const[d,p]of c)h.push({pubkey:d,stake:p.stake,address:p.address,adnl:p.adnl});return{minStake:l,allStakes:u,endElectionsTime:s,startWorkTime:a,entities:h}}async getActiveElectionId(t){const n=(await t.get("active_election_id",[])).stack.readNumber();return n>0?n:null}async getComplaints(t,r){const n=new xi.TupleBuilder;n.writeNumber(r);const o=await t.get("list_complaints",n.build());if(o.stack.peek().type==="null")return[];const i=new xi.TupleReader(o.stack.readLispList()),a=[];for(;i.remaining>0;){const s=i.readTuple(),l=s.readBigNumber(),u=s.readTuple(),c=u.readTuple(),h=Oe.Buffer.from(c.readBigNumber().toString(16),"hex");c.readCell();const d=c.readNumber(),p=c.readNumber(),v=new xi.Address(-1,Oe.Buffer.from(c.readBigNumber().toString(16),"hex")),b=c.readBigNumber(),S=c.readBigNumber(),x=c.readBigNumber(),k=[],M=new xi.TupleReader(u.readLispList());for(;M.remaining>0;)k.push(M.readNumber());const P=u.readBigNumber(),L=u.readBigNumber();a.push({id:l,publicKey:h,createdAt:d,severity:p,paid:b,suggestedFine:S,suggestedFinePart:x,rewardAddress:v,votes:k,remainingWeight:L,vsetId:P})}return a}}lm.ElectorContract=A6;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.parseFullConfig=Pt.loadConfigParamsAsSlice=Pt.loadConfigParamById=Pt.parseVotingSetup=Pt.parseProposalSetup=Pt.configParse29=Pt.configParse28=Pt.configParseMsgPrices=Pt.configParseGasLimitsPrices=Pt.configParseBridge=Pt.configParseValidatorSet=Pt.configParse12=Pt.configParseWorkchainDescriptor=Pt.configParse40=Pt.configParse8=Pt.configParse18=Pt.configParse17=Pt.configParse16=Pt.configParse15=Pt.configParse13=Pt.configParse5=Pt.configParseMasterAddressRequired=Pt.parseBridge=Pt.parseValidatorSet=Pt.configParseMasterAddress=void 0;const Qn=qt;function qf(e){return e?new Qn.Address(-1,e.loadBuffer(32)):null}Pt.configParseMasterAddress=qf;function oE(e){if(e.loadUint(32)!==2390828938)throw Error("Invalid config");return e.loadBuffer(32)}const aE={serialize(e,t){throw Error("not implemented")},parse(e){const t=e.loadUint(8);if(t===83)return{publicKey:oE(e),weight:e.loadUintBig(64),adnlAddress:null};if(t===115)return{publicKey:oE(e),weight:e.loadUintBig(64),adnlAddress:e.loadBuffer(32)};throw Error("Invalid config")}};function fO(e){const t=e.loadUint(8);if(t===17){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(16),i=e.loadUint(16),a=e.loadDictDirect(Qn.Dictionary.Keys.Uint(16),aE);return{timeSince:r,timeUntil:n,total:o,main:i,totalWeight:null,list:a}}else if(t===18){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(16),i=e.loadUint(16),a=e.loadUintBig(64),s=e.loadDict(Qn.Dictionary.Keys.Uint(16),aE);return{timeSince:r,timeUntil:n,total:o,main:i,totalWeight:a,list:s}}}Pt.parseValidatorSet=fO;function dO(e){const t=new Qn.Address(-1,e.loadBuffer(32)),r=new Qn.Address(-1,e.loadBuffer(32)),n=e.loadDict(Qn.Dictionary.Keys.Buffer(32),Qn.Dictionary.Values.Buffer(32)),o=new Map;for(const[a,s]of n)o.set(new Qn.Address(-1,a).toString(),s);const i=e.loadBuffer(32);return{bridgeAddress:t,oracleMultisigAddress:r,oracles:o,externalChainAddress:i}}Pt.parseBridge=dO;function o3(e){if(!e)throw Error("Invalid config");return qf(e)}Pt.configParseMasterAddressRequired=o3;function hO(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===1){const r=e.loadBit()?new Qn.Address(-1,e.loadBuffer(32)):null,n=e.loadUint(32),o=e.loadUint(32);return{blackholeAddr:r,feeBurnNominator:n,feeBurnDenominator:o}}throw new Error("Invalid config")}Pt.configParse5=hO;function ose(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===26){const r=e.loadCoins(),n=e.loadCoins(),o=e.loadCoins();return{deposit:r,bitPrice:n,cellPrice:o}}throw new Error("Invalid config")}Pt.configParse13=ose;function pO(e){if(!e)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32);return{validatorsElectedFor:t,electorsStartBefore:r,electorsEndBefore:n,stakeHeldFor:o}}Pt.configParse15=pO;function gO(e){if(!e)throw Error("Invalid config");const t=e.loadUint(16),r=e.loadUint(16),n=e.loadUint(16);return{maxValidators:t,maxMainValidators:r,minValidators:n}}Pt.configParse16=gO;function mO(e){if(!e)throw Error("Invalid config");const t=e.loadCoins(),r=e.loadCoins(),n=e.loadCoins(),o=e.loadUint(32);return{minStake:t,maxStake:r,minTotalStake:n,maxStakeFactor:o}}Pt.configParse17=mO;const ase={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==204)throw Error("Invalid config");const r=e.loadUint(32),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64);return{utime_since:r,bit_price_ps:n,cell_price_ps:o,mc_bit_price_ps:i,mc_cell_price_ps:a}}};function vO(e){if(!e)throw Error("Invalid config");return e.loadDictDirect(Qn.Dictionary.Keys.Buffer(4),ase).values()}Pt.configParse18=vO;function yO(e){if(!e)return{version:0,capabilities:0n};const t=e.loadUint(32),r=e.loadUintBig(64);return{version:t,capabilities:r}}Pt.configParse8=yO;function bO(e){if(!e)return null;if(e.loadUint(8)!==1)throw Error("Invalid config");const r=e.loadCoins(),n=e.loadCoins(),o=e.loadUint(16),i=e.loadUint(16),a=e.loadUint(16),s=e.loadUint(16),l=e.loadUint(16),u=e.loadUint(16),c=e.loadUint(16),h=e.loadUint(16),d=e.loadUint(16);return{defaultFlatFine:r,defaultProportionaFine:n,severityFlatMult:o,severityProportionalMult:i,unfunishableInterval:a,longInterval:s,longFlatMult:l,longProportionalMult:u,mediumInterval:c,mediumFlatMult:h,mediumProportionalMult:d}}Pt.configParse40=bO;function sse(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadBit(),a=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),h=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const d=e.loadUint(32),p=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:r,min_split:n,max_split:o,basic:i,active:a,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:h,format:{vmVersion:d,vmMode:p}}}Pt.configParseWorkchainDescriptor=sse;const lse={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadBit(),a=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),h=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const d=e.loadUint(32),p=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:r,min_split:n,max_split:o,basic:i,active:a,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:h,format:{vmVersion:d,vmMode:p}}}};function wO(e){if(!e)throw Error("Invalid config");const t=e.loadDict(Qn.Dictionary.Keys.Uint(32),lse);if(t)return t;throw Error("No workchains exist")}Pt.configParse12=wO;function Bs(e){return e?fO(e):null}Pt.configParseValidatorSet=Bs;function k0(e){return e?dO(e):null}Pt.configParseBridge=k0;function use(e){const t=e.loadUint(8);if(t===222){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64),s=e.loadUintBig(64),l=e.loadUintBig(64);return{gasPrice:r,gasLimit:n,specialGasLimit:o,gasCredit:i,blockGasLimit:a,freezeDueLimit:s,deleteDueLimit:l}}else if(t===221){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64),s=e.loadUintBig(64);return{gasPrice:r,gasLimit:n,gasCredit:o,blockGasLimit:i,freezeDueLimit:a,deleteDueLimit:s}}else throw Error("Invalid config")}function a3(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===209){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=use(e);return{flatLimit:r,flatGasPrice:n,other:o}}else throw Error("Invalid config")}Pt.configParseGasLimitsPrices=a3;function s3(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==234)throw new Error("Invalid msg prices param");return{lumpPrice:e.loadUintBig(64),bitPrice:e.loadUintBig(64),cellPrice:e.loadUintBig(64),ihrPriceFactor:e.loadUint(32),firstFrac:e.loadUint(16),nextFrac:e.loadUint(16)}}Pt.configParseMsgPrices=s3;function _O(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===193){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32);return{masterCatchainLifetime:r,shardCatchainLifetime:n,shardValidatorsLifetime:o,shardValidatorsCount:i}}if(t===194){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(32),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32);return{flags:r,suffleMasterValidators:n,masterCatchainLifetime:o,shardCatchainLifetime:i,shardValidatorsLifetime:a,shardValidatorsCount:s}}throw new Error("Invalid config")}Pt.configParse28=_O;function xO(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===214){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{roundCandidates:r,nextCandidateDelay:n,consensusTimeout:o,fastAttempts:i,attemptDuration:a,catchainMaxDeps:s,maxBlockBytes:l,maxColaltedBytes:u}}else if(t===215){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h}}else if(t===216){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32),d=e.loadUint(16);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h,protoVersion:d}}else if(t===217){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32),d=e.loadUint(16),p=e.loadUint(32);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h,protoVersion:d,catchainMaxBlocksCoeff:p}}throw new Error("Invalid config")}Pt.configParse29=xO;function l3(e){if(e.loadUint(8)!==54)throw new Error("Invalid config");const r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadUint(8),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{minTotalRounds:r,maxTotalRounds:n,minWins:o,maxLoses:i,minStoreSec:a,maxStoreSec:s,bitPrice:l,cellPrice:u}}Pt.parseProposalSetup=l3;function SO(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==145)throw new Error("Invalid config");const r=l3(e.loadRef().beginParse()),n=l3(e.loadRef().beginParse());return{normalParams:r,criticalParams:n}}Pt.parseVotingSetup=SO;function CO(e){return Qn.Cell.fromBase64(e).beginParse().loadDictDirect(Qn.Dictionary.Keys.Int(32),Qn.Dictionary.Values.Cell())}function cse(e,t){return CO(e).get(t)}Pt.loadConfigParamById=cse;function fse(e){const t=CO(e),r=new Map;for(const[n,o]of t)r.set(n,o.beginParse());return r}Pt.loadConfigParamsAsSlice=fse;function dse(e){return{configAddress:o3(e.get(0)),electorAddress:o3(e.get(1)),minterAddress:qf(e.get(2)),feeCollectorAddress:qf(e.get(3)),dnsRootAddress:qf(e.get(4)),burningConfig:hO(e.get(5)),globalVersion:yO(e.get(8)),workchains:wO(e.get(12)),voting:SO(e.get(11)),validators:{...pO(e.get(15)),...gO(e.get(16)),...mO(e.get(17))},storagePrices:vO(e.get(18)),gasPrices:{masterchain:a3(e.get(20)),workchain:a3(e.get(21))},msgPrices:{masterchain:s3(e.get(24)),workchain:s3(e.get(25))},validatorSets:{prevValidators:Bs(e.get(32)),prevTempValidators:Bs(e.get(33)),currentValidators:Bs(e.get(34)),currentTempValidators:Bs(e.get(35)),nextValidators:Bs(e.get(36)),nextTempValidators:Bs(e.get(37))},validatorsPunish:bO(e.get(40)),bridges:{ethereum:k0(e.get(71)),binance:k0(e.get(72)),polygon:k0(e.get(73))},catchain:_O(e.get(28)),consensus:xO(e.get(29))}}Pt.parseFullConfig=dse;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});ki.computeMessageForwardFees=ki.computeExternalMessageFees=ki.computeGasPrices=ki.computeFwdFees=ki.computeStorageFees=void 0;const Z2=qt;function hse(e){const{lastPaid:t,now:r,storagePrices:n,storageStat:o,special:i,masterchain:a}=e;if(r<=t||n.length===0||r>16n)}ki.computeGasPrices=pse;function gse(e,t){let r=t1(t);return r.bits-=t.bits.length,r.cells-=1,M6(e,BigInt(r.cells),BigInt(r.bits))}ki.computeExternalMessageFees=gse;function mse(e,t){let r=(0,Z2.loadMessageRelaxed)(t.beginParse()),n={bits:0,cells:0};if(r.init){const l=new Z2.Cell().asBuilder();(0,Z2.storeStateInit)(r.init)(l);const u=l.endCell();let c=t1(u);c.bits-=u.bits.length,c.cells-=1,n.bits+=c.bits,n.cells+=c.cells}let o=t1(r.body);o.bits-=r.body.bits.length,o.cells-=1,n.bits+=o.bits,n.cells+=o.cells;let i=M6(e,BigInt(n.cells),BigInt(n.bits)),a=i*BigInt(e.firstFrac)>>16n,s=i-a;return{fees:a,remaining:s}}ki.computeMessageForwardFees=mse;function t1(e){let t=e.bits.length,r=1;for(let n of e.refs){let o=t1(n);r+=o.cells,t+=o.bits}return{bits:t,cells:r}}function EO(e){let t=e%65536n,r=e>>16n;return t!==0n&&(r+=1n),r}(function(e){var t=Ze&&Ze.__createBinding||(Object.create?function(K,Z,ue,U){U===void 0&&(U=ue);var _=Object.getOwnPropertyDescriptor(Z,ue);(!_||("get"in _?!Z.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return Z[ue]}}),Object.defineProperty(K,U,_)}:function(K,Z,ue,U){U===void 0&&(U=ue),K[U]=Z[ue]}),r=Ze&&Ze.__exportStar||function(K,Z){for(var ue in K)ue!=="default"&&!Object.prototype.hasOwnProperty.call(Z,ue)&&t(Z,K,ue)};Object.defineProperty(e,"__esModule",{value:!0}),e.computeStorageFees=e.computeMessageForwardFees=e.computeGasPrices=e.computeFwdFees=e.computeExternalMessageFees=e.loadConfigParamsAsSlice=e.loadConfigParamById=e.parseFullConfig=e.parseVotingSetup=e.parseValidatorSet=e.parseProposalSetup=e.parseBridge=e.configParseWorkchainDescriptor=e.configParseValidatorSet=e.configParseMsgPrices=e.configParseMasterAddressRequired=e.configParseMasterAddress=e.configParseGasLimitsPrices=e.configParseBridge=e.configParse40=e.configParse29=e.configParse28=e.configParse18=e.configParse17=e.configParse16=e.configParse15=e.configParse13=e.configParse12=e.configParse8=e.configParse5=e.ElectorContract=e.MultisigWallet=e.MultisigOrderBuilder=e.MultisigOrder=e.JettonWallet=e.JettonMaster=e.WalletContractV5R1=e.WalletContractV5Beta=e.WalletContractV4=e.WalletContractV3R2=e.WalletContractV3R1=e.WalletContractV2R2=e.WalletContractV2R1=e.WalletContractV1R3=e.WalletContractV1R2=e.WalletContractV1R1=e.TonClient4=e.TonClient=e.HttpApi=void 0,r(qt,e);var n=mh;Object.defineProperty(e,"HttpApi",{enumerable:!0,get:function(){return n.HttpApi}});var o=Hg;Object.defineProperty(e,"TonClient",{enumerable:!0,get:function(){return o.TonClient}});var i=Kg;Object.defineProperty(e,"TonClient4",{enumerable:!0,get:function(){return i.TonClient4}});var a=Gg;Object.defineProperty(e,"WalletContractV1R1",{enumerable:!0,get:function(){return a.WalletContractV1R1}});var s=Qg;Object.defineProperty(e,"WalletContractV1R2",{enumerable:!0,get:function(){return s.WalletContractV1R2}});var l=Xg;Object.defineProperty(e,"WalletContractV1R3",{enumerable:!0,get:function(){return l.WalletContractV1R3}});var u=Jg;Object.defineProperty(e,"WalletContractV2R1",{enumerable:!0,get:function(){return u.WalletContractV2R1}});var c=em;Object.defineProperty(e,"WalletContractV2R2",{enumerable:!0,get:function(){return c.WalletContractV2R2}});var h=tm;Object.defineProperty(e,"WalletContractV3R1",{enumerable:!0,get:function(){return h.WalletContractV3R1}});var d=rm;Object.defineProperty(e,"WalletContractV3R2",{enumerable:!0,get:function(){return d.WalletContractV3R2}});var p=nm;Object.defineProperty(e,"WalletContractV4",{enumerable:!0,get:function(){return p.WalletContractV4}});var v=uO;Object.defineProperty(e,"WalletContractV5Beta",{enumerable:!0,get:function(){return v.WalletContractV5Beta}});var b=cO;Object.defineProperty(e,"WalletContractV5R1",{enumerable:!0,get:function(){return b.WalletContractV5R1}});var S=im;Object.defineProperty(e,"JettonMaster",{enumerable:!0,get:function(){return S.JettonMaster}});var x=om;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return x.JettonWallet}});var k=yh;Object.defineProperty(e,"MultisigOrder",{enumerable:!0,get:function(){return k.MultisigOrder}});var M=am;Object.defineProperty(e,"MultisigOrderBuilder",{enumerable:!0,get:function(){return M.MultisigOrderBuilder}});var P=sm;Object.defineProperty(e,"MultisigWallet",{enumerable:!0,get:function(){return P.MultisigWallet}});var L=lm;Object.defineProperty(e,"ElectorContract",{enumerable:!0,get:function(){return L.ElectorContract}});var j=Pt;Object.defineProperty(e,"configParse5",{enumerable:!0,get:function(){return j.configParse5}}),Object.defineProperty(e,"configParse8",{enumerable:!0,get:function(){return j.configParse8}}),Object.defineProperty(e,"configParse12",{enumerable:!0,get:function(){return j.configParse12}}),Object.defineProperty(e,"configParse13",{enumerable:!0,get:function(){return j.configParse13}}),Object.defineProperty(e,"configParse15",{enumerable:!0,get:function(){return j.configParse15}}),Object.defineProperty(e,"configParse16",{enumerable:!0,get:function(){return j.configParse16}}),Object.defineProperty(e,"configParse17",{enumerable:!0,get:function(){return j.configParse17}}),Object.defineProperty(e,"configParse18",{enumerable:!0,get:function(){return j.configParse18}}),Object.defineProperty(e,"configParse28",{enumerable:!0,get:function(){return j.configParse28}}),Object.defineProperty(e,"configParse29",{enumerable:!0,get:function(){return j.configParse29}}),Object.defineProperty(e,"configParse40",{enumerable:!0,get:function(){return j.configParse40}}),Object.defineProperty(e,"configParseBridge",{enumerable:!0,get:function(){return j.configParseBridge}}),Object.defineProperty(e,"configParseGasLimitsPrices",{enumerable:!0,get:function(){return j.configParseGasLimitsPrices}}),Object.defineProperty(e,"configParseMasterAddress",{enumerable:!0,get:function(){return j.configParseMasterAddress}}),Object.defineProperty(e,"configParseMasterAddressRequired",{enumerable:!0,get:function(){return j.configParseMasterAddressRequired}}),Object.defineProperty(e,"configParseMsgPrices",{enumerable:!0,get:function(){return j.configParseMsgPrices}}),Object.defineProperty(e,"configParseValidatorSet",{enumerable:!0,get:function(){return j.configParseValidatorSet}}),Object.defineProperty(e,"configParseWorkchainDescriptor",{enumerable:!0,get:function(){return j.configParseWorkchainDescriptor}}),Object.defineProperty(e,"parseBridge",{enumerable:!0,get:function(){return j.parseBridge}}),Object.defineProperty(e,"parseProposalSetup",{enumerable:!0,get:function(){return j.parseProposalSetup}}),Object.defineProperty(e,"parseValidatorSet",{enumerable:!0,get:function(){return j.parseValidatorSet}}),Object.defineProperty(e,"parseVotingSetup",{enumerable:!0,get:function(){return j.parseVotingSetup}}),Object.defineProperty(e,"parseFullConfig",{enumerable:!0,get:function(){return j.parseFullConfig}}),Object.defineProperty(e,"loadConfigParamById",{enumerable:!0,get:function(){return j.loadConfigParamById}}),Object.defineProperty(e,"loadConfigParamsAsSlice",{enumerable:!0,get:function(){return j.loadConfigParamsAsSlice}});var V=ki;Object.defineProperty(e,"computeExternalMessageFees",{enumerable:!0,get:function(){return V.computeExternalMessageFees}}),Object.defineProperty(e,"computeFwdFees",{enumerable:!0,get:function(){return V.computeFwdFees}}),Object.defineProperty(e,"computeGasPrices",{enumerable:!0,get:function(){return V.computeGasPrices}}),Object.defineProperty(e,"computeMessageForwardFees",{enumerable:!0,get:function(){return V.computeMessageForwardFees}}),Object.defineProperty(e,"computeStorageFees",{enumerable:!0,get:function(){return V.computeStorageFees}})})(ka);const G2={recordTime:40915,distributePrize:63655,withdrawFees:3243};class Mu{constructor(t,r){this.address=t,this.init=r}static createFromAddress(t){return new Mu(t)}static createFromConfig(t,r,n=0){const o=Mu.createDataCell(t),i={code:r,data:o};return new Mu(qt.contractAddress(n,i),i)}static createDataCell(t){return qt.beginCell().storeAddress(t).storeUint(0,64).storeUint(0,120).storeUint(0,32).storeUint(0,64).storeAddress(qt.Address.parse("0:0000000000000000000000000000000000000000000000000000000000000000")).storeDict(null).endCell()}async sendDeploy(t,r,n){await t.internal(r,{value:n,sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(68,32).endCell()})}async sendRecordTime(t,r,n){await t.internal(r,{value:n.value??qt.toNano("1.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.recordTime,32).storeUint(n.time,64).endCell()})}async sendDistributePrize(t,r,n){await t.internal(r,{value:n.value??qt.toNano("0.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.distributePrize,32).storeUint(n.tournamentNumber,32).endCell()})}async sendWithdrawFees(t,r,n){await t.internal(r,{value:n.value??qt.toNano("0.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.withdrawFees,32).endCell()})}async getInfo(t){const r=await t.get("get_info",[]);return{bestTime:r.stack.readNumber(),totalFees:r.stack.readBigNumber(),currentTournamentNumber:r.stack.readNumber(),bestPlayer:r.stack.readAddress()}}async getPlayerEntry(t,r){const n=await t.get("get_player_entry",[{type:"slice",cell:qt.beginCell().storeAddress(r).endCell()}]),o=n.stack.readNumber(),i=n.stack.readNumber(),a=n.stack.readNumber();return o===0&&i===0&&a===0?null:{time:o,timestamp:i,tournamentNumber:a}}}async function vse(e,t,r){var n,o;try{console.log("Starting interaction with Race contract...");const i=await e6({network:"testnet"}),a=new ka.TonClient({endpoint:i}),s=r.wallet;if(!s)throw new Error("No wallet connected");const l=(n=s.account)==null?void 0:n.publicKey;if(!l)throw new Error("No public key found");const u=Oe.Buffer.from(l,"hex"),c=ka.WalletContractV4.create({publicKey:u,workchain:0}),h=a.open(c),d={send:async P=>{var j;const L={validUntil:Math.floor(Date.now()/1e3)+60,messages:[{address:P.to.toString(),amount:P.value.toString(),payload:(j=P.body)==null?void 0:j.toBoc().toString("base64")}]};await r.sendTransaction(L)}},p=await h.getSeqno();console.log("Seqno: ",p);const v=ka.Address.parse("kQC_8HjVICJndonC88WPdsekT072YY0vvcj3I2oXgmEcDWT1"),b=Mu.createFromAddress(v);console.log(`Race contract address: ${v.toString()}`);const S=a.provider(v),x=ka.Address.parse(e);await b.sendRecordTime(S,d,{time:Math.floor(t*1e3),value:ka.toNano("1.1")});let k=p;for(;k===p;)console.log("Waiting for transaction to confirm..."),await yse(1500),k=await h.getSeqno();console.log("Transaction confirmed!");const M=await b.getInfo(S);console.log("Best Time:",M.bestTime),console.log("Total Fees:",M.totalFees.toString()),console.log("Current Tournament Number:",M.currentTournamentNumber),console.log("Best Player Address:",M.bestPlayer.toString())}catch(i){ig.isAxiosError(i)?(console.error("Axios error:",i.message),console.error("Response data:",(o=i.response)==null?void 0:o.data)):console.error("Unexpected error:",i)}}function yse(e){return new Promise(t=>setTimeout(t,e))}async function bse(e,t){var r;try{const n=Mu.createFromAddress(t),o=t.toString();console.log(`Race contract address: ${o}`);const i=e.provider(t),a=await n.getInfo(i),l=` - Best Time: ${(a.bestTime/1e3).toFixed(3)} seconds +`+String(n)));J4(t);for(var o=0;o0&&Object.prototype.hasOwnProperty.call(e,e.length-1))}var aoe=Xie,h6={},e3={},xo={},Vg={},vh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0;var t;(function(n){n.assertEqual=s=>s;function o(s){}n.assertIs=o;function i(s){throw new Error}n.assertNever=i,n.arrayToEnum=s=>{const l={};for(const u of s)l[u]=u;return l},n.getValidEnumValues=s=>{const l=n.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),u={};for(const c of l)u[c]=s[c];return n.objectValues(u)},n.objectValues=s=>n.objectKeys(s).map(function(l){return s[l]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const l=[];for(const u in s)Object.prototype.hasOwnProperty.call(s,u)&&l.push(u);return l},n.find=(s,l)=>{for(const u of s)if(l(u))return u},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function a(s,l=" | "){return s.map(u=>typeof u=="string"?`'${u}'`:u).join(l)}n.joinValues=a,n.jsonStringifyReplacer=(s,l)=>typeof l=="bigint"?l.toString():l})(t=e.util||(e.util={})),function(n){n.mergeShapes=(o,i)=>({...o,...i})}(e.objectUtil||(e.objectUtil={})),e.ZodParsedType=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=n=>{switch(typeof n){case"undefined":return e.ZodParsedType.undefined;case"string":return e.ZodParsedType.string;case"number":return isNaN(n)?e.ZodParsedType.nan:e.ZodParsedType.number;case"boolean":return e.ZodParsedType.boolean;case"function":return e.ZodParsedType.function;case"bigint":return e.ZodParsedType.bigint;case"symbol":return e.ZodParsedType.symbol;case"object":return Array.isArray(n)?e.ZodParsedType.array:n===null?e.ZodParsedType.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?e.ZodParsedType.promise:typeof Map<"u"&&n instanceof Map?e.ZodParsedType.map:typeof Set<"u"&&n instanceof Set?e.ZodParsedType.set:typeof Date<"u"&&n instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}};e.getParsedType=r})(vh);var So={};Object.defineProperty(So,"__esModule",{value:!0});So.ZodError=So.quotelessJson=So.ZodIssueCode=void 0;const LR=vh;So.ZodIssueCode=LR.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);const soe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");So.quotelessJson=soe;class Od extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,l=0;for(;lr.message){const r={},n=[];for(const o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}So.ZodError=Od;Od.create=e=>new Od(e);Object.defineProperty(Vg,"__esModule",{value:!0});const Es=vh,Sn=So,loe=(e,t)=>{let r;switch(e.code){case Sn.ZodIssueCode.invalid_type:e.received===Es.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Sn.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Es.util.jsonStringifyReplacer)}`;break;case Sn.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Es.util.joinValues(e.keys,", ")}`;break;case Sn.ZodIssueCode.invalid_union:r="Invalid input";break;case Sn.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Es.util.joinValues(e.options)}`;break;case Sn.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Es.util.joinValues(e.options)}, received '${e.received}'`;break;case Sn.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Sn.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Sn.ZodIssueCode.invalid_date:r="Invalid date";break;case Sn.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Es.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Sn.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Sn.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Sn.ZodIssueCode.custom:r="Invalid input";break;case Sn.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Sn.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Sn.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,Es.util.assertNever(e)}return{message:r}};Vg.default=loe;var uoe=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});xo.getErrorMap=xo.setErrorMap=xo.defaultErrorMap=void 0;const DR=uoe(Vg);xo.defaultErrorMap=DR.default;let UR=DR.default;function coe(e){UR=e}xo.setErrorMap=coe;function foe(){return UR}xo.getErrorMap=foe;var p6={};(function(e){var t=Ke&&Ke.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.addIssueToContext=e.EMPTY_PATH=e.makeIssue=void 0;const r=xo,n=t(Vg),o=p=>{const{data:v,path:b,errorMaps:S,issueData:x}=p,k=[...b,...x.path||[]],M={...x,path:k};if(x.message!==void 0)return{...x,path:k,message:x.message};let P="";const L=S.filter(j=>!!j).slice().reverse();for(const j of L)P=j(M,{data:v,defaultError:P}).message;return{...x,path:k,message:P}};e.makeIssue=o,e.EMPTY_PATH=[];function i(p,v){const b=(0,r.getErrorMap)(),S=(0,e.makeIssue)({issueData:v,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,b,b===n.default?void 0:n.default].filter(x=>!!x)});p.common.issues.push(S)}e.addIssueToContext=i;class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(v,b){const S=[];for(const x of b){if(x.status==="aborted")return e.INVALID;x.status==="dirty"&&v.dirty(),S.push(x.value)}return{status:v.value,value:S}}static async mergeObjectAsync(v,b){const S=[];for(const x of b){const k=await x.key,M=await x.value;S.push({key:k,value:M})}return a.mergeObjectSync(v,S)}static mergeObjectSync(v,b){const S={};for(const x of b){const{key:k,value:M}=x;if(k.status==="aborted"||M.status==="aborted")return e.INVALID;k.status==="dirty"&&v.dirty(),M.status==="dirty"&&v.dirty(),k.value!=="__proto__"&&(typeof M.value<"u"||x.alwaysSet)&&(S[k.value]=M.value)}return{status:v.value,value:S}}}e.ParseStatus=a,e.INVALID=Object.freeze({status:"aborted"});const s=p=>({status:"dirty",value:p});e.DIRTY=s;const l=p=>({status:"valid",value:p});e.OK=l;const u=p=>p.status==="aborted";e.isAborted=u;const c=p=>p.status==="dirty";e.isDirty=c;const h=p=>p.status==="valid";e.isValid=h;const d=p=>typeof Promise<"u"&&p instanceof Promise;e.isAsync=d})(p6);var jR={};Object.defineProperty(jR,"__esModule",{value:!0});var FR={},zR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0,function(t){t.errToObj=r=>typeof r=="string"?{message:r}:r||{},t.toString=r=>typeof r=="string"?r:r==null?void 0:r.message}(e.errorUtil||(e.errorUtil={}))})(zR);(function(e){var t=Ke&&Ke.__classPrivateFieldGet||function(fe,R,F,H){if(F==="a"&&!H)throw new TypeError("Private accessor was defined without a getter");if(typeof R=="function"?fe!==R||!H:!R.has(fe))throw new TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?H:F==="a"?H.call(fe):H?H.value:R.get(fe)},r=Ke&&Ke.__classPrivateFieldSet||function(fe,R,F,H,ae){if(H==="m")throw new TypeError("Private method is not writable");if(H==="a"&&!ae)throw new TypeError("Private accessor was defined without a setter");if(typeof R=="function"?fe!==R||!ae:!R.has(fe))throw new TypeError("Cannot write private member to an object whose class did not declare it");return H==="a"?ae.call(fe,F):ae?ae.value=F:R.set(fe,F),F},n,o;Object.defineProperty(e,"__esModule",{value:!0}),e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.custom=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.datetimeRegex=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=e.discriminatedUnion=e.date=void 0;const i=xo,a=zR,s=p6,l=vh,u=So;class c{constructor(R,F,H,ae){this._cachedPath=[],this.parent=R,this.data=F,this._path=H,this._key=ae}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const h=(fe,R)=>{if((0,s.isValid)(R))return{success:!0,data:R.value};if(!fe.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const F=new u.ZodError(fe.common.issues);return this._error=F,this._error}}};function d(fe){if(!fe)return{};const{errorMap:R,invalid_type_error:F,required_error:H,description:ae}=fe;if(R&&(F||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return R?{errorMap:R,description:ae}:{errorMap:(Ce,Se)=>{var Ve,Ge;const{message:Je}=fe;return Ce.code==="invalid_enum_value"?{message:Je??Se.defaultError}:typeof Se.data>"u"?{message:(Ve=Je??H)!==null&&Ve!==void 0?Ve:Se.defaultError}:Ce.code!=="invalid_type"?{message:Se.defaultError}:{message:(Ge=Je??F)!==null&&Ge!==void 0?Ge:Se.defaultError}},description:ae}}class p{constructor(R){this.spa=this.safeParseAsync,this._def=R,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(R){return(0,l.getParsedType)(R.data)}_getOrReturnCtx(R,F){return F||{common:R.parent.common,data:R.data,parsedType:(0,l.getParsedType)(R.data),schemaErrorMap:this._def.errorMap,path:R.path,parent:R.parent}}_processInputParams(R){return{status:new s.ParseStatus,ctx:{common:R.parent.common,data:R.data,parsedType:(0,l.getParsedType)(R.data),schemaErrorMap:this._def.errorMap,path:R.path,parent:R.parent}}}_parseSync(R){const F=this._parse(R);if((0,s.isAsync)(F))throw new Error("Synchronous parse encountered promise.");return F}_parseAsync(R){const F=this._parse(R);return Promise.resolve(F)}parse(R,F){const H=this.safeParse(R,F);if(H.success)return H.data;throw H.error}safeParse(R,F){var H;const ae={common:{issues:[],async:(H=F==null?void 0:F.async)!==null&&H!==void 0?H:!1,contextualErrorMap:F==null?void 0:F.errorMap},path:(F==null?void 0:F.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:R,parsedType:(0,l.getParsedType)(R)},oe=this._parseSync({data:R,path:ae.path,parent:ae});return h(ae,oe)}async parseAsync(R,F){const H=await this.safeParseAsync(R,F);if(H.success)return H.data;throw H.error}async safeParseAsync(R,F){const H={common:{issues:[],contextualErrorMap:F==null?void 0:F.errorMap,async:!0},path:(F==null?void 0:F.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:R,parsedType:(0,l.getParsedType)(R)},ae=this._parse({data:R,path:H.path,parent:H}),oe=await((0,s.isAsync)(ae)?ae:Promise.resolve(ae));return h(H,oe)}refine(R,F){const H=ae=>typeof F=="string"||typeof F>"u"?{message:F}:typeof F=="function"?F(ae):F;return this._refinement((ae,oe)=>{const Ce=R(ae),Se=()=>oe.addIssue({code:u.ZodIssueCode.custom,...H(ae)});return typeof Promise<"u"&&Ce instanceof Promise?Ce.then(Ve=>Ve?!0:(Se(),!1)):Ce?!0:(Se(),!1)})}refinement(R,F){return this._refinement((H,ae)=>R(H)?!0:(ae.addIssue(typeof F=="function"?F(H,ae):F),!1))}_refinement(R){return new ge({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:R}})}superRefine(R){return this._refinement(R)}optional(){return be.create(this,this._def)}nullable(){return ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return se.create(this,this._def)}promise(){return re.create(this,this._def)}or(R){return q.create([this,R],this._def)}and(R){return Q.create(this,R,this._def)}transform(R){return new ge({...d(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:R}})}default(R){const F=typeof R=="function"?R:()=>R;return new Ie({...d(this._def),innerType:this,defaultValue:F,typeName:De.ZodDefault})}brand(){return new ze({typeName:De.ZodBranded,type:this,...d(this._def)})}catch(R){const F=typeof R=="function"?R:()=>R;return new ke({...d(this._def),innerType:this,catchValue:F,typeName:De.ZodCatch})}describe(R){const F=this.constructor;return new F({...this._def,description:R})}pipe(R){return We.create(this,R)}readonly(){return Ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}e.ZodType=p,e.Schema=p,e.ZodSchema=p;const v=/^c[^\s-]{8,}$/i,b=/^[0-9a-z]+$/,S=/^[0-9A-HJKMNP-TV-Z]{26}$/,x=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,k=/^[a-z0-9_-]{21}$/i,M=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,P=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,L="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let j;const V=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,K=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Z=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ue="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",U=new RegExp(`^${ue}$`);function _(fe){let R="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return fe.precision?R=`${R}\\.\\d{${fe.precision}}`:fe.precision==null&&(R=`${R}(\\.\\d+)?`),R}function y(fe){return new RegExp(`^${_(fe)}$`)}function f(fe){let R=`${ue}T${_(fe)}`;const F=[];return F.push(fe.local?"Z?":"Z"),fe.offset&&F.push("([+-]\\d{2}:?\\d{2})"),R=`${R}(${F.join("|")})`,new RegExp(`^${R}$`)}e.datetimeRegex=f;function g(fe,R){return!!((R==="v4"||!R)&&V.test(fe)||(R==="v6"||!R)&&K.test(fe))}class w extends p{_parse(R){if(this._def.coerce&&(R.data=String(R.data)),this._getType(R)!==l.ZodParsedType.string){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.string,received:oe.parsedType}),s.INVALID}const H=new s.ParseStatus;let ae;for(const oe of this._def.checks)if(oe.kind==="min")R.data.lengthoe.value&&(ae=this._getOrReturnCtx(R,ae),(0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.too_big,maximum:oe.value,type:"string",inclusive:!0,exact:!1,message:oe.message}),H.dirty());else if(oe.kind==="length"){const Ce=R.data.length>oe.value,Se=R.data.lengthR.test(ae),{validation:F,code:u.ZodIssueCode.invalid_string,...a.errorUtil.errToObj(H)})}_addCheck(R){return new w({...this._def,checks:[...this._def.checks,R]})}email(R){return this._addCheck({kind:"email",...a.errorUtil.errToObj(R)})}url(R){return this._addCheck({kind:"url",...a.errorUtil.errToObj(R)})}emoji(R){return this._addCheck({kind:"emoji",...a.errorUtil.errToObj(R)})}uuid(R){return this._addCheck({kind:"uuid",...a.errorUtil.errToObj(R)})}nanoid(R){return this._addCheck({kind:"nanoid",...a.errorUtil.errToObj(R)})}cuid(R){return this._addCheck({kind:"cuid",...a.errorUtil.errToObj(R)})}cuid2(R){return this._addCheck({kind:"cuid2",...a.errorUtil.errToObj(R)})}ulid(R){return this._addCheck({kind:"ulid",...a.errorUtil.errToObj(R)})}base64(R){return this._addCheck({kind:"base64",...a.errorUtil.errToObj(R)})}ip(R){return this._addCheck({kind:"ip",...a.errorUtil.errToObj(R)})}datetime(R){var F,H;return typeof R=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:R}):this._addCheck({kind:"datetime",precision:typeof(R==null?void 0:R.precision)>"u"?null:R==null?void 0:R.precision,offset:(F=R==null?void 0:R.offset)!==null&&F!==void 0?F:!1,local:(H=R==null?void 0:R.local)!==null&&H!==void 0?H:!1,...a.errorUtil.errToObj(R==null?void 0:R.message)})}date(R){return this._addCheck({kind:"date",message:R})}time(R){return typeof R=="string"?this._addCheck({kind:"time",precision:null,message:R}):this._addCheck({kind:"time",precision:typeof(R==null?void 0:R.precision)>"u"?null:R==null?void 0:R.precision,...a.errorUtil.errToObj(R==null?void 0:R.message)})}duration(R){return this._addCheck({kind:"duration",...a.errorUtil.errToObj(R)})}regex(R,F){return this._addCheck({kind:"regex",regex:R,...a.errorUtil.errToObj(F)})}includes(R,F){return this._addCheck({kind:"includes",value:R,position:F==null?void 0:F.position,...a.errorUtil.errToObj(F==null?void 0:F.message)})}startsWith(R,F){return this._addCheck({kind:"startsWith",value:R,...a.errorUtil.errToObj(F)})}endsWith(R,F){return this._addCheck({kind:"endsWith",value:R,...a.errorUtil.errToObj(F)})}min(R,F){return this._addCheck({kind:"min",value:R,...a.errorUtil.errToObj(F)})}max(R,F){return this._addCheck({kind:"max",value:R,...a.errorUtil.errToObj(F)})}length(R,F){return this._addCheck({kind:"length",value:R,...a.errorUtil.errToObj(F)})}nonempty(R){return this.min(1,a.errorUtil.errToObj(R))}trim(){return new w({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new w({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new w({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(R=>R.kind==="datetime")}get isDate(){return!!this._def.checks.find(R=>R.kind==="date")}get isTime(){return!!this._def.checks.find(R=>R.kind==="time")}get isDuration(){return!!this._def.checks.find(R=>R.kind==="duration")}get isEmail(){return!!this._def.checks.find(R=>R.kind==="email")}get isURL(){return!!this._def.checks.find(R=>R.kind==="url")}get isEmoji(){return!!this._def.checks.find(R=>R.kind==="emoji")}get isUUID(){return!!this._def.checks.find(R=>R.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(R=>R.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(R=>R.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(R=>R.kind==="cuid2")}get isULID(){return!!this._def.checks.find(R=>R.kind==="ulid")}get isIP(){return!!this._def.checks.find(R=>R.kind==="ip")}get isBase64(){return!!this._def.checks.find(R=>R.kind==="base64")}get minLength(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxLength(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.value{var R;return new w({checks:[],typeName:De.ZodString,coerce:(R=fe==null?void 0:fe.coerce)!==null&&R!==void 0?R:!1,...d(fe)})};function A(fe,R){const F=(fe.toString().split(".")[1]||"").length,H=(R.toString().split(".")[1]||"").length,ae=F>H?F:H,oe=parseInt(fe.toFixed(ae).replace(".","")),Ce=parseInt(R.toFixed(ae).replace(".",""));return oe%Ce/Math.pow(10,ae)}class T extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(R){if(this._def.coerce&&(R.data=Number(R.data)),this._getType(R)!==l.ZodParsedType.number){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.number,received:oe.parsedType}),s.INVALID}let H;const ae=new s.ParseStatus;for(const oe of this._def.checks)oe.kind==="int"?l.util.isInteger(R.data)||(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:oe.message}),ae.dirty()):oe.kind==="min"?(oe.inclusive?R.dataoe.value:R.data>=oe.value)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:oe.value,type:"number",inclusive:oe.inclusive,exact:!1,message:oe.message}),ae.dirty()):oe.kind==="multipleOf"?A(R.data,oe.value)!==0&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_multiple_of,multipleOf:oe.value,message:oe.message}),ae.dirty()):oe.kind==="finite"?Number.isFinite(R.data)||(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_finite,message:oe.message}),ae.dirty()):l.util.assertNever(oe);return{status:ae.value,value:R.data}}gte(R,F){return this.setLimit("min",R,!0,a.errorUtil.toString(F))}gt(R,F){return this.setLimit("min",R,!1,a.errorUtil.toString(F))}lte(R,F){return this.setLimit("max",R,!0,a.errorUtil.toString(F))}lt(R,F){return this.setLimit("max",R,!1,a.errorUtil.toString(F))}setLimit(R,F,H,ae){return new T({...this._def,checks:[...this._def.checks,{kind:R,value:F,inclusive:H,message:a.errorUtil.toString(ae)}]})}_addCheck(R){return new T({...this._def,checks:[...this._def.checks,R]})}int(R){return this._addCheck({kind:"int",message:a.errorUtil.toString(R)})}positive(R){return this._addCheck({kind:"min",value:0,inclusive:!1,message:a.errorUtil.toString(R)})}negative(R){return this._addCheck({kind:"max",value:0,inclusive:!1,message:a.errorUtil.toString(R)})}nonpositive(R){return this._addCheck({kind:"max",value:0,inclusive:!0,message:a.errorUtil.toString(R)})}nonnegative(R){return this._addCheck({kind:"min",value:0,inclusive:!0,message:a.errorUtil.toString(R)})}multipleOf(R,F){return this._addCheck({kind:"multipleOf",value:R,message:a.errorUtil.toString(F)})}finite(R){return this._addCheck({kind:"finite",message:a.errorUtil.toString(R)})}safe(R){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:a.errorUtil.toString(R)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:a.errorUtil.toString(R)})}get minValue(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxValue(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.valueR.kind==="int"||R.kind==="multipleOf"&&l.util.isInteger(R.value))}get isFinite(){let R=null,F=null;for(const H of this._def.checks){if(H.kind==="finite"||H.kind==="int"||H.kind==="multipleOf")return!0;H.kind==="min"?(F===null||H.value>F)&&(F=H.value):H.kind==="max"&&(R===null||H.valuenew T({checks:[],typeName:De.ZodNumber,coerce:(fe==null?void 0:fe.coerce)||!1,...d(fe)});class E extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(R){if(this._def.coerce&&(R.data=BigInt(R.data)),this._getType(R)!==l.ZodParsedType.bigint){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.bigint,received:oe.parsedType}),s.INVALID}let H;const ae=new s.ParseStatus;for(const oe of this._def.checks)oe.kind==="min"?(oe.inclusive?R.dataoe.value:R.data>=oe.value)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,type:"bigint",maximum:oe.value,inclusive:oe.inclusive,message:oe.message}),ae.dirty()):oe.kind==="multipleOf"?R.data%oe.value!==BigInt(0)&&(H=this._getOrReturnCtx(R,H),(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.not_multiple_of,multipleOf:oe.value,message:oe.message}),ae.dirty()):l.util.assertNever(oe);return{status:ae.value,value:R.data}}gte(R,F){return this.setLimit("min",R,!0,a.errorUtil.toString(F))}gt(R,F){return this.setLimit("min",R,!1,a.errorUtil.toString(F))}lte(R,F){return this.setLimit("max",R,!0,a.errorUtil.toString(F))}lt(R,F){return this.setLimit("max",R,!1,a.errorUtil.toString(F))}setLimit(R,F,H,ae){return new E({...this._def,checks:[...this._def.checks,{kind:R,value:F,inclusive:H,message:a.errorUtil.toString(ae)}]})}_addCheck(R){return new E({...this._def,checks:[...this._def.checks,R]})}positive(R){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:a.errorUtil.toString(R)})}negative(R){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:a.errorUtil.toString(R)})}nonpositive(R){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:a.errorUtil.toString(R)})}nonnegative(R){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:a.errorUtil.toString(R)})}multipleOf(R,F){return this._addCheck({kind:"multipleOf",value:R,message:a.errorUtil.toString(F)})}get minValue(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R}get maxValue(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.value{var R;return new E({checks:[],typeName:De.ZodBigInt,coerce:(R=fe==null?void 0:fe.coerce)!==null&&R!==void 0?R:!1,...d(fe)})};class C extends p{_parse(R){if(this._def.coerce&&(R.data=Boolean(R.data)),this._getType(R)!==l.ZodParsedType.boolean){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.boolean,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodBoolean=C,C.create=fe=>new C({typeName:De.ZodBoolean,coerce:(fe==null?void 0:fe.coerce)||!1,...d(fe)});class I extends p{_parse(R){if(this._def.coerce&&(R.data=new Date(R.data)),this._getType(R)!==l.ZodParsedType.date){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.date,received:oe.parsedType}),s.INVALID}if(isNaN(R.data.getTime())){const oe=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(oe,{code:u.ZodIssueCode.invalid_date}),s.INVALID}const H=new s.ParseStatus;let ae;for(const oe of this._def.checks)oe.kind==="min"?R.data.getTime()oe.value&&(ae=this._getOrReturnCtx(R,ae),(0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.too_big,message:oe.message,inclusive:!0,exact:!1,maximum:oe.value,type:"date"}),H.dirty()):l.util.assertNever(oe);return{status:H.value,value:new Date(R.data.getTime())}}_addCheck(R){return new I({...this._def,checks:[...this._def.checks,R]})}min(R,F){return this._addCheck({kind:"min",value:R.getTime(),message:a.errorUtil.toString(F)})}max(R,F){return this._addCheck({kind:"max",value:R.getTime(),message:a.errorUtil.toString(F)})}get minDate(){let R=null;for(const F of this._def.checks)F.kind==="min"&&(R===null||F.value>R)&&(R=F.value);return R!=null?new Date(R):null}get maxDate(){let R=null;for(const F of this._def.checks)F.kind==="max"&&(R===null||F.valuenew I({checks:[],coerce:(fe==null?void 0:fe.coerce)||!1,typeName:De.ZodDate,...d(fe)});class m extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.symbol){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.symbol,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodSymbol=m,m.create=fe=>new m({typeName:De.ZodSymbol,...d(fe)});class B extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.undefined){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.undefined,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodUndefined=B,B.create=fe=>new B({typeName:De.ZodUndefined,...d(fe)});class ne extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.null){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.null,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodNull=ne,ne.create=fe=>new ne({typeName:De.ZodNull,...d(fe)});class de extends p{constructor(){super(...arguments),this._any=!0}_parse(R){return(0,s.OK)(R.data)}}e.ZodAny=de,de.create=fe=>new de({typeName:De.ZodAny,...d(fe)});class $ extends p{constructor(){super(...arguments),this._unknown=!0}_parse(R){return(0,s.OK)(R.data)}}e.ZodUnknown=$,$.create=fe=>new $({typeName:De.ZodUnknown,...d(fe)});class he extends p{_parse(R){const F=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.never,received:F.parsedType}),s.INVALID}}e.ZodNever=he,he.create=fe=>new he({typeName:De.ZodNever,...d(fe)});class X extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.undefined){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.void,received:H.parsedType}),s.INVALID}return(0,s.OK)(R.data)}}e.ZodVoid=X,X.create=fe=>new X({typeName:De.ZodVoid,...d(fe)});class se extends p{_parse(R){const{ctx:F,status:H}=this._processInputParams(R),ae=this._def;if(F.parsedType!==l.ZodParsedType.array)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:F.parsedType}),s.INVALID;if(ae.exactLength!==null){const Ce=F.data.length>ae.exactLength.value,Se=F.data.lengthae.maxLength.value&&((0,s.addIssueToContext)(F,{code:u.ZodIssueCode.too_big,maximum:ae.maxLength.value,type:"array",inclusive:!0,exact:!1,message:ae.maxLength.message}),H.dirty()),F.common.async)return Promise.all([...F.data].map((Ce,Se)=>ae.type._parseAsync(new c(F,Ce,F.path,Se)))).then(Ce=>s.ParseStatus.mergeArray(H,Ce));const oe=[...F.data].map((Ce,Se)=>ae.type._parseSync(new c(F,Ce,F.path,Se)));return s.ParseStatus.mergeArray(H,oe)}get element(){return this._def.type}min(R,F){return new se({...this._def,minLength:{value:R,message:a.errorUtil.toString(F)}})}max(R,F){return new se({...this._def,maxLength:{value:R,message:a.errorUtil.toString(F)}})}length(R,F){return new se({...this._def,exactLength:{value:R,message:a.errorUtil.toString(F)}})}nonempty(R){return this.min(1,R)}}e.ZodArray=se,se.create=(fe,R)=>new se({type:fe,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...d(R)});function pe(fe){if(fe instanceof W){const R={};for(const F in fe.shape){const H=fe.shape[F];R[F]=be.create(pe(H))}return new W({...fe._def,shape:()=>R})}else return fe instanceof se?new se({...fe._def,type:pe(fe.element)}):fe instanceof be?be.create(pe(fe.unwrap())):fe instanceof ce?ce.create(pe(fe.unwrap())):fe instanceof N?N.create(fe.items.map(R=>pe(R))):fe}class W extends p{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const R=this._def.shape(),F=l.util.objectKeys(R);return this._cached={shape:R,keys:F}}_parse(R){if(this._getType(R)!==l.ZodParsedType.object){const Ge=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(Ge,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:Ge.parsedType}),s.INVALID}const{status:H,ctx:ae}=this._processInputParams(R),{shape:oe,keys:Ce}=this._getCached(),Se=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(const Ge in ae.data)Ce.includes(Ge)||Se.push(Ge);const Ve=[];for(const Ge of Ce){const Je=oe[Ge],At=ae.data[Ge];Ve.push({key:{status:"valid",value:Ge},value:Je._parse(new c(ae,At,ae.path,Ge)),alwaysSet:Ge in ae.data})}if(this._def.catchall instanceof he){const Ge=this._def.unknownKeys;if(Ge==="passthrough")for(const Je of Se)Ve.push({key:{status:"valid",value:Je},value:{status:"valid",value:ae.data[Je]}});else if(Ge==="strict")Se.length>0&&((0,s.addIssueToContext)(ae,{code:u.ZodIssueCode.unrecognized_keys,keys:Se}),H.dirty());else if(Ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const Ge=this._def.catchall;for(const Je of Se){const At=ae.data[Je];Ve.push({key:{status:"valid",value:Je},value:Ge._parse(new c(ae,At,ae.path,Je)),alwaysSet:Je in ae.data})}}return ae.common.async?Promise.resolve().then(async()=>{const Ge=[];for(const Je of Ve){const At=await Je.key,we=await Je.value;Ge.push({key:At,value:we,alwaysSet:Je.alwaysSet})}return Ge}).then(Ge=>s.ParseStatus.mergeObjectSync(H,Ge)):s.ParseStatus.mergeObjectSync(H,Ve)}get shape(){return this._def.shape()}strict(R){return a.errorUtil.errToObj,new W({...this._def,unknownKeys:"strict",...R!==void 0?{errorMap:(F,H)=>{var ae,oe,Ce,Se;const Ve=(Ce=(oe=(ae=this._def).errorMap)===null||oe===void 0?void 0:oe.call(ae,F,H).message)!==null&&Ce!==void 0?Ce:H.defaultError;return F.code==="unrecognized_keys"?{message:(Se=a.errorUtil.errToObj(R).message)!==null&&Se!==void 0?Se:Ve}:{message:Ve}}}:{}})}strip(){return new W({...this._def,unknownKeys:"strip"})}passthrough(){return new W({...this._def,unknownKeys:"passthrough"})}extend(R){return new W({...this._def,shape:()=>({...this._def.shape(),...R})})}merge(R){return new W({unknownKeys:R._def.unknownKeys,catchall:R._def.catchall,shape:()=>({...this._def.shape(),...R._def.shape()}),typeName:De.ZodObject})}setKey(R,F){return this.augment({[R]:F})}catchall(R){return new W({...this._def,catchall:R})}pick(R){const F={};return l.util.objectKeys(R).forEach(H=>{R[H]&&this.shape[H]&&(F[H]=this.shape[H])}),new W({...this._def,shape:()=>F})}omit(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{R[H]||(F[H]=this.shape[H])}),new W({...this._def,shape:()=>F})}deepPartial(){return pe(this)}partial(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{const ae=this.shape[H];R&&!R[H]?F[H]=ae:F[H]=ae.optional()}),new W({...this._def,shape:()=>F})}required(R){const F={};return l.util.objectKeys(this.shape).forEach(H=>{if(R&&!R[H])F[H]=this.shape[H];else{let oe=this.shape[H];for(;oe instanceof be;)oe=oe._def.innerType;F[H]=oe}}),new W({...this._def,shape:()=>F})}keyof(){return Re(l.util.objectKeys(this.shape))}}e.ZodObject=W,W.create=(fe,R)=>new W({shape:()=>fe,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...d(R)}),W.strictCreate=(fe,R)=>new W({shape:()=>fe,unknownKeys:"strict",catchall:he.create(),typeName:De.ZodObject,...d(R)}),W.lazycreate=(fe,R)=>new W({shape:fe,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...d(R)});class q extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H=this._def.options;function ae(oe){for(const Se of oe)if(Se.result.status==="valid")return Se.result;for(const Se of oe)if(Se.result.status==="dirty")return F.common.issues.push(...Se.ctx.common.issues),Se.result;const Ce=oe.map(Se=>new u.ZodError(Se.ctx.common.issues));return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union,unionErrors:Ce}),s.INVALID}if(F.common.async)return Promise.all(H.map(async oe=>{const Ce={...F,common:{...F.common,issues:[]},parent:null};return{result:await oe._parseAsync({data:F.data,path:F.path,parent:Ce}),ctx:Ce}})).then(ae);{let oe;const Ce=[];for(const Ve of H){const Ge={...F,common:{...F.common,issues:[]},parent:null},Je=Ve._parseSync({data:F.data,path:F.path,parent:Ge});if(Je.status==="valid")return Je;Je.status==="dirty"&&!oe&&(oe={result:Je,ctx:Ge}),Ge.common.issues.length&&Ce.push(Ge.common.issues)}if(oe)return F.common.issues.push(...oe.ctx.common.issues),oe.result;const Se=Ce.map(Ve=>new u.ZodError(Ve));return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union,unionErrors:Se}),s.INVALID}}get options(){return this._def.options}}e.ZodUnion=q,q.create=(fe,R)=>new q({options:fe,typeName:De.ZodUnion,...d(R)});const ye=fe=>fe instanceof Pe?ye(fe.schema):fe instanceof ge?ye(fe.innerType()):fe instanceof Fe?[fe.value]:fe instanceof le?fe.options:fe instanceof Y?l.util.objectValues(fe.enum):fe instanceof Ie?ye(fe._def.innerType):fe instanceof B?[void 0]:fe instanceof ne?[null]:fe instanceof be?[void 0,...ye(fe.unwrap())]:fe instanceof ce?[null,...ye(fe.unwrap())]:fe instanceof ze||fe instanceof Ne?ye(fe.unwrap()):fe instanceof ke?ye(fe._def.innerType):[];class xe extends p{_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.object)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:F.parsedType}),s.INVALID;const H=this.discriminator,ae=F.data[H],oe=this.optionsMap.get(ae);return oe?F.common.async?oe._parseAsync({data:F.data,path:F.path,parent:F}):oe._parseSync({data:F.data,path:F.path,parent:F}):((0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[H]}),s.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(R,F,H){const ae=new Map;for(const oe of F){const Ce=ye(oe.shape[R]);if(!Ce.length)throw new Error(`A discriminator value for key \`${R}\` could not be extracted from all schema options`);for(const Se of Ce){if(ae.has(Se))throw new Error(`Discriminator property ${String(R)} has duplicate value ${String(Se)}`);ae.set(Se,oe)}}return new xe({typeName:De.ZodDiscriminatedUnion,discriminator:R,options:F,optionsMap:ae,...d(H)})}}e.ZodDiscriminatedUnion=xe;function Me(fe,R){const F=(0,l.getParsedType)(fe),H=(0,l.getParsedType)(R);if(fe===R)return{valid:!0,data:fe};if(F===l.ZodParsedType.object&&H===l.ZodParsedType.object){const ae=l.util.objectKeys(R),oe=l.util.objectKeys(fe).filter(Se=>ae.indexOf(Se)!==-1),Ce={...fe,...R};for(const Se of oe){const Ve=Me(fe[Se],R[Se]);if(!Ve.valid)return{valid:!1};Ce[Se]=Ve.data}return{valid:!0,data:Ce}}else if(F===l.ZodParsedType.array&&H===l.ZodParsedType.array){if(fe.length!==R.length)return{valid:!1};const ae=[];for(let oe=0;oe{if((0,s.isAborted)(oe)||(0,s.isAborted)(Ce))return s.INVALID;const Se=Me(oe.value,Ce.value);return Se.valid?(((0,s.isDirty)(oe)||(0,s.isDirty)(Ce))&&F.dirty(),{status:F.value,value:Se.data}):((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_intersection_types}),s.INVALID)};return H.common.async?Promise.all([this._def.left._parseAsync({data:H.data,path:H.path,parent:H}),this._def.right._parseAsync({data:H.data,path:H.path,parent:H})]).then(([oe,Ce])=>ae(oe,Ce)):ae(this._def.left._parseSync({data:H.data,path:H.path,parent:H}),this._def.right._parseSync({data:H.data,path:H.path,parent:H}))}}e.ZodIntersection=Q,Q.create=(fe,R,F)=>new Q({left:fe,right:R,typeName:De.ZodIntersection,...d(F)});class N extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.array)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:H.parsedType}),s.INVALID;if(H.data.lengththis._def.items.length&&((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty());const oe=[...H.data].map((Ce,Se)=>{const Ve=this._def.items[Se]||this._def.rest;return Ve?Ve._parse(new c(H,Ce,H.path,Se)):null}).filter(Ce=>!!Ce);return H.common.async?Promise.all(oe).then(Ce=>s.ParseStatus.mergeArray(F,Ce)):s.ParseStatus.mergeArray(F,oe)}get items(){return this._def.items}rest(R){return new N({...this._def,rest:R})}}e.ZodTuple=N,N.create=(fe,R)=>{if(!Array.isArray(fe))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:fe,typeName:De.ZodTuple,rest:null,...d(R)})};class D extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.object)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:H.parsedType}),s.INVALID;const ae=[],oe=this._def.keyType,Ce=this._def.valueType;for(const Se in H.data)ae.push({key:oe._parse(new c(H,Se,H.path,Se)),value:Ce._parse(new c(H,H.data[Se],H.path,Se)),alwaysSet:Se in H.data});return H.common.async?s.ParseStatus.mergeObjectAsync(F,ae):s.ParseStatus.mergeObjectSync(F,ae)}get element(){return this._def.valueType}static create(R,F,H){return F instanceof p?new D({keyType:R,valueType:F,typeName:De.ZodRecord,...d(H)}):new D({keyType:w.create(),valueType:R,typeName:De.ZodRecord,...d(F)})}}e.ZodRecord=D;class G extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.map)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.map,received:H.parsedType}),s.INVALID;const ae=this._def.keyType,oe=this._def.valueType,Ce=[...H.data.entries()].map(([Se,Ve],Ge)=>({key:ae._parse(new c(H,Se,H.path,[Ge,"key"])),value:oe._parse(new c(H,Ve,H.path,[Ge,"value"]))}));if(H.common.async){const Se=new Map;return Promise.resolve().then(async()=>{for(const Ve of Ce){const Ge=await Ve.key,Je=await Ve.value;if(Ge.status==="aborted"||Je.status==="aborted")return s.INVALID;(Ge.status==="dirty"||Je.status==="dirty")&&F.dirty(),Se.set(Ge.value,Je.value)}return{status:F.value,value:Se}})}else{const Se=new Map;for(const Ve of Ce){const Ge=Ve.key,Je=Ve.value;if(Ge.status==="aborted"||Je.status==="aborted")return s.INVALID;(Ge.status==="dirty"||Je.status==="dirty")&&F.dirty(),Se.set(Ge.value,Je.value)}return{status:F.value,value:Se}}}}e.ZodMap=G,G.create=(fe,R,F)=>new G({valueType:R,keyType:fe,typeName:De.ZodMap,...d(F)});class me extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.parsedType!==l.ZodParsedType.set)return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.set,received:H.parsedType}),s.INVALID;const ae=this._def;ae.minSize!==null&&H.data.sizeae.maxSize.value&&((0,s.addIssueToContext)(H,{code:u.ZodIssueCode.too_big,maximum:ae.maxSize.value,type:"set",inclusive:!0,exact:!1,message:ae.maxSize.message}),F.dirty());const oe=this._def.valueType;function Ce(Ve){const Ge=new Set;for(const Je of Ve){if(Je.status==="aborted")return s.INVALID;Je.status==="dirty"&&F.dirty(),Ge.add(Je.value)}return{status:F.value,value:Ge}}const Se=[...H.data.values()].map((Ve,Ge)=>oe._parse(new c(H,Ve,H.path,Ge)));return H.common.async?Promise.all(Se).then(Ve=>Ce(Ve)):Ce(Se)}min(R,F){return new me({...this._def,minSize:{value:R,message:a.errorUtil.toString(F)}})}max(R,F){return new me({...this._def,maxSize:{value:R,message:a.errorUtil.toString(F)}})}size(R,F){return this.min(R,F).max(R,F)}nonempty(R){return this.min(1,R)}}e.ZodSet=me,me.create=(fe,R)=>new me({valueType:fe,minSize:null,maxSize:null,typeName:De.ZodSet,...d(R)});class _e extends p{constructor(){super(...arguments),this.validate=this.implement}_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.function)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.function,received:F.parsedType}),s.INVALID;function H(Se,Ve){return(0,s.makeIssue)({data:Se,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter(Ge=>!!Ge),issueData:{code:u.ZodIssueCode.invalid_arguments,argumentsError:Ve}})}function ae(Se,Ve){return(0,s.makeIssue)({data:Se,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter(Ge=>!!Ge),issueData:{code:u.ZodIssueCode.invalid_return_type,returnTypeError:Ve}})}const oe={errorMap:F.common.contextualErrorMap},Ce=F.data;if(this._def.returns instanceof re){const Se=this;return(0,s.OK)(async function(...Ve){const Ge=new u.ZodError([]),Je=await Se._def.args.parseAsync(Ve,oe).catch(jt=>{throw Ge.addIssue(H(Ve,jt)),Ge}),At=await Reflect.apply(Ce,this,Je);return await Se._def.returns._def.type.parseAsync(At,oe).catch(jt=>{throw Ge.addIssue(ae(At,jt)),Ge})})}else{const Se=this;return(0,s.OK)(function(...Ve){const Ge=Se._def.args.safeParse(Ve,oe);if(!Ge.success)throw new u.ZodError([H(Ve,Ge.error)]);const Je=Reflect.apply(Ce,this,Ge.data),At=Se._def.returns.safeParse(Je,oe);if(!At.success)throw new u.ZodError([ae(Je,At.error)]);return At.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...R){return new _e({...this._def,args:N.create(R).rest($.create())})}returns(R){return new _e({...this._def,returns:R})}implement(R){return this.parse(R)}strictImplement(R){return this.parse(R)}static create(R,F,H){return new _e({args:R||N.create([]).rest($.create()),returns:F||$.create(),typeName:De.ZodFunction,...d(H)})}}e.ZodFunction=_e;class Pe extends p{get schema(){return this._def.getter()}_parse(R){const{ctx:F}=this._processInputParams(R);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}e.ZodLazy=Pe,Pe.create=(fe,R)=>new Pe({getter:fe,typeName:De.ZodLazy,...d(R)});class Fe extends p{_parse(R){if(R.data!==this._def.value){const F=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(F,{received:F.data,code:u.ZodIssueCode.invalid_literal,expected:this._def.value}),s.INVALID}return{status:"valid",value:R.data}}get value(){return this._def.value}}e.ZodLiteral=Fe,Fe.create=(fe,R)=>new Fe({value:fe,typeName:De.ZodLiteral,...d(R)});function Re(fe,R){return new le({values:fe,typeName:De.ZodEnum,...d(R)})}class le extends p{constructor(){super(...arguments),n.set(this,void 0)}_parse(R){if(typeof R.data!="string"){const F=this._getOrReturnCtx(R),H=this._def.values;return(0,s.addIssueToContext)(F,{expected:l.util.joinValues(H),received:F.parsedType,code:u.ZodIssueCode.invalid_type}),s.INVALID}if(t(this,n,"f")||r(this,n,new Set(this._def.values),"f"),!t(this,n,"f").has(R.data)){const F=this._getOrReturnCtx(R),H=this._def.values;return(0,s.addIssueToContext)(F,{received:F.data,code:u.ZodIssueCode.invalid_enum_value,options:H}),s.INVALID}return(0,s.OK)(R.data)}get options(){return this._def.values}get enum(){const R={};for(const F of this._def.values)R[F]=F;return R}get Values(){const R={};for(const F of this._def.values)R[F]=F;return R}get Enum(){const R={};for(const F of this._def.values)R[F]=F;return R}extract(R,F=this._def){return le.create(R,{...this._def,...F})}exclude(R,F=this._def){return le.create(this.options.filter(H=>!R.includes(H)),{...this._def,...F})}}e.ZodEnum=le,n=new WeakMap,le.create=Re;class Y extends p{constructor(){super(...arguments),o.set(this,void 0)}_parse(R){const F=l.util.getValidEnumValues(this._def.values),H=this._getOrReturnCtx(R);if(H.parsedType!==l.ZodParsedType.string&&H.parsedType!==l.ZodParsedType.number){const ae=l.util.objectValues(F);return(0,s.addIssueToContext)(H,{expected:l.util.joinValues(ae),received:H.parsedType,code:u.ZodIssueCode.invalid_type}),s.INVALID}if(t(this,o,"f")||r(this,o,new Set(l.util.getValidEnumValues(this._def.values)),"f"),!t(this,o,"f").has(R.data)){const ae=l.util.objectValues(F);return(0,s.addIssueToContext)(H,{received:H.data,code:u.ZodIssueCode.invalid_enum_value,options:ae}),s.INVALID}return(0,s.OK)(R.data)}get enum(){return this._def.values}}e.ZodNativeEnum=Y,o=new WeakMap,Y.create=(fe,R)=>new Y({values:fe,typeName:De.ZodNativeEnum,...d(R)});class re extends p{unwrap(){return this._def.type}_parse(R){const{ctx:F}=this._processInputParams(R);if(F.parsedType!==l.ZodParsedType.promise&&F.common.async===!1)return(0,s.addIssueToContext)(F,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.promise,received:F.parsedType}),s.INVALID;const H=F.parsedType===l.ZodParsedType.promise?F.data:Promise.resolve(F.data);return(0,s.OK)(H.then(ae=>this._def.type.parseAsync(ae,{path:F.path,errorMap:F.common.contextualErrorMap})))}}e.ZodPromise=re,re.create=(fe,R)=>new re({type:fe,typeName:De.ZodPromise,...d(R)});class ge extends p{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(R){const{status:F,ctx:H}=this._processInputParams(R),ae=this._def.effect||null,oe={addIssue:Ce=>{(0,s.addIssueToContext)(H,Ce),Ce.fatal?F.abort():F.dirty()},get path(){return H.path}};if(oe.addIssue=oe.addIssue.bind(oe),ae.type==="preprocess"){const Ce=ae.transform(H.data,oe);if(H.common.async)return Promise.resolve(Ce).then(async Se=>{if(F.value==="aborted")return s.INVALID;const Ve=await this._def.schema._parseAsync({data:Se,path:H.path,parent:H});return Ve.status==="aborted"?s.INVALID:Ve.status==="dirty"||F.value==="dirty"?(0,s.DIRTY)(Ve.value):Ve});{if(F.value==="aborted")return s.INVALID;const Se=this._def.schema._parseSync({data:Ce,path:H.path,parent:H});return Se.status==="aborted"?s.INVALID:Se.status==="dirty"||F.value==="dirty"?(0,s.DIRTY)(Se.value):Se}}if(ae.type==="refinement"){const Ce=Se=>{const Ve=ae.refinement(Se,oe);if(H.common.async)return Promise.resolve(Ve);if(Ve instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Se};if(H.common.async===!1){const Se=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});return Se.status==="aborted"?s.INVALID:(Se.status==="dirty"&&F.dirty(),Ce(Se.value),{status:F.value,value:Se.value})}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then(Se=>Se.status==="aborted"?s.INVALID:(Se.status==="dirty"&&F.dirty(),Ce(Se.value).then(()=>({status:F.value,value:Se.value}))))}if(ae.type==="transform")if(H.common.async===!1){const Ce=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});if(!(0,s.isValid)(Ce))return Ce;const Se=ae.transform(Ce.value,oe);if(Se instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Se}}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then(Ce=>(0,s.isValid)(Ce)?Promise.resolve(ae.transform(Ce.value,oe)).then(Se=>({status:F.value,value:Se})):Ce);l.util.assertNever(ae)}}e.ZodEffects=ge,e.ZodTransformer=ge,ge.create=(fe,R,F)=>new ge({schema:fe,typeName:De.ZodEffects,effect:R,...d(F)}),ge.createWithPreprocess=(fe,R,F)=>new ge({schema:R,effect:{type:"preprocess",transform:fe},typeName:De.ZodEffects,...d(F)});class be extends p{_parse(R){return this._getType(R)===l.ZodParsedType.undefined?(0,s.OK)(void 0):this._def.innerType._parse(R)}unwrap(){return this._def.innerType}}e.ZodOptional=be,be.create=(fe,R)=>new be({innerType:fe,typeName:De.ZodOptional,...d(R)});class ce extends p{_parse(R){return this._getType(R)===l.ZodParsedType.null?(0,s.OK)(null):this._def.innerType._parse(R)}unwrap(){return this._def.innerType}}e.ZodNullable=ce,ce.create=(fe,R)=>new ce({innerType:fe,typeName:De.ZodNullable,...d(R)});class Ie extends p{_parse(R){const{ctx:F}=this._processInputParams(R);let H=F.data;return F.parsedType===l.ZodParsedType.undefined&&(H=this._def.defaultValue()),this._def.innerType._parse({data:H,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}e.ZodDefault=Ie,Ie.create=(fe,R)=>new Ie({innerType:fe,typeName:De.ZodDefault,defaultValue:typeof R.default=="function"?R.default:()=>R.default,...d(R)});class ke extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H={...F,common:{...F.common,issues:[]}},ae=this._def.innerType._parse({data:H.data,path:H.path,parent:{...H}});return(0,s.isAsync)(ae)?ae.then(oe=>({status:"valid",value:oe.status==="valid"?oe.value:this._def.catchValue({get error(){return new u.ZodError(H.common.issues)},input:H.data})})):{status:"valid",value:ae.status==="valid"?ae.value:this._def.catchValue({get error(){return new u.ZodError(H.common.issues)},input:H.data})}}removeCatch(){return this._def.innerType}}e.ZodCatch=ke,ke.create=(fe,R)=>new ke({innerType:fe,typeName:De.ZodCatch,catchValue:typeof R.catch=="function"?R.catch:()=>R.catch,...d(R)});class Te extends p{_parse(R){if(this._getType(R)!==l.ZodParsedType.nan){const H=this._getOrReturnCtx(R);return(0,s.addIssueToContext)(H,{code:u.ZodIssueCode.invalid_type,expected:l.ZodParsedType.nan,received:H.parsedType}),s.INVALID}return{status:"valid",value:R.data}}}e.ZodNaN=Te,Te.create=fe=>new Te({typeName:De.ZodNaN,...d(fe)}),e.BRAND=Symbol("zod_brand");class ze extends p{_parse(R){const{ctx:F}=this._processInputParams(R),H=F.data;return this._def.type._parse({data:H,path:F.path,parent:F})}unwrap(){return this._def.type}}e.ZodBranded=ze;class We extends p{_parse(R){const{status:F,ctx:H}=this._processInputParams(R);if(H.common.async)return(async()=>{const oe=await this._def.in._parseAsync({data:H.data,path:H.path,parent:H});return oe.status==="aborted"?s.INVALID:oe.status==="dirty"?(F.dirty(),(0,s.DIRTY)(oe.value)):this._def.out._parseAsync({data:oe.value,path:H.path,parent:H})})();{const ae=this._def.in._parseSync({data:H.data,path:H.path,parent:H});return ae.status==="aborted"?s.INVALID:ae.status==="dirty"?(F.dirty(),{status:"dirty",value:ae.value}):this._def.out._parseSync({data:ae.value,path:H.path,parent:H})}}static create(R,F){return new We({in:R,out:F,typeName:De.ZodPipeline})}}e.ZodPipeline=We;class Ne extends p{_parse(R){const F=this._def.innerType._parse(R),H=ae=>((0,s.isValid)(ae)&&(ae.value=Object.freeze(ae.value)),ae);return(0,s.isAsync)(F)?F.then(ae=>H(ae)):H(F)}unwrap(){return this._def.innerType}}e.ZodReadonly=Ne,Ne.create=(fe,R)=>new Ne({innerType:fe,typeName:De.ZodReadonly,...d(R)});function Ze(fe,R={},F){return fe?de.create().superRefine((H,ae)=>{var oe,Ce;if(!fe(H)){const Se=typeof R=="function"?R(H):typeof R=="string"?{message:R}:R,Ve=(Ce=(oe=Se.fatal)!==null&&oe!==void 0?oe:F)!==null&&Ce!==void 0?Ce:!0,Ge=typeof Se=="string"?{message:Se}:Se;ae.addIssue({code:"custom",...Ge,fatal:Ve})}}):de.create()}e.custom=Ze,e.late={object:W.lazycreate};var De;(function(fe){fe.ZodString="ZodString",fe.ZodNumber="ZodNumber",fe.ZodNaN="ZodNaN",fe.ZodBigInt="ZodBigInt",fe.ZodBoolean="ZodBoolean",fe.ZodDate="ZodDate",fe.ZodSymbol="ZodSymbol",fe.ZodUndefined="ZodUndefined",fe.ZodNull="ZodNull",fe.ZodAny="ZodAny",fe.ZodUnknown="ZodUnknown",fe.ZodNever="ZodNever",fe.ZodVoid="ZodVoid",fe.ZodArray="ZodArray",fe.ZodObject="ZodObject",fe.ZodUnion="ZodUnion",fe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",fe.ZodIntersection="ZodIntersection",fe.ZodTuple="ZodTuple",fe.ZodRecord="ZodRecord",fe.ZodMap="ZodMap",fe.ZodSet="ZodSet",fe.ZodFunction="ZodFunction",fe.ZodLazy="ZodLazy",fe.ZodLiteral="ZodLiteral",fe.ZodEnum="ZodEnum",fe.ZodEffects="ZodEffects",fe.ZodNativeEnum="ZodNativeEnum",fe.ZodOptional="ZodOptional",fe.ZodNullable="ZodNullable",fe.ZodDefault="ZodDefault",fe.ZodCatch="ZodCatch",fe.ZodPromise="ZodPromise",fe.ZodBranded="ZodBranded",fe.ZodPipeline="ZodPipeline",fe.ZodReadonly="ZodReadonly"})(De=e.ZodFirstPartyTypeKind||(e.ZodFirstPartyTypeKind={}));const Le=(fe,R={message:`Input not instance of ${fe.name}`})=>Ze(F=>F instanceof fe,R);e.instanceof=Le;const gt=w.create;e.string=gt;const rt=T.create;e.number=rt;const Ye=Te.create;e.nan=Ye;const kt=E.create;e.bigint=kt;const ht=C.create;e.boolean=ht;const tt=I.create;e.date=tt;const Nt=m.create;e.symbol=Nt;const It=B.create;e.undefined=It;const ut=ne.create;e.null=ut;const Yt=de.create;e.any=Yt;const Tt=$.create;e.unknown=Tt;const at=he.create;e.never=at;const lr=X.create;e.void=lr;const z=se.create;e.array=z;const J=W.create;e.object=J;const ee=W.strictCreate;e.strictObject=ee;const O=q.create;e.union=O;const te=xe.create;e.discriminatedUnion=te;const Ae=Q.create;e.intersection=Ae;const Ee=N.create;e.tuple=Ee;const Be=D.create;e.record=Be;const qe=G.create;e.map=qe;const He=me.create;e.set=He;const $e=_e.create;e.function=$e;const Lt=Pe.create;e.lazy=Lt;const ot=Fe.create;e.literal=ot;const vt=le.create;e.enum=vt;const yt=Y.create;e.nativeEnum=yt;const Ct=re.create;e.promise=Ct;const St=ge.create;e.effect=St,e.transformer=St;const bt=be.create;e.optional=bt;const xt=ce.create;e.nullable=xt;const wt=ge.createWithPreprocess;e.preprocess=wt;const st=We.create;e.pipeline=st;const ct=()=>gt().optional();e.ostring=ct;const nt=()=>rt().optional();e.onumber=nt;const lt=()=>ht().optional();e.oboolean=lt,e.coerce={string:fe=>w.create({...fe,coerce:!0}),number:fe=>T.create({...fe,coerce:!0}),boolean:fe=>C.create({...fe,coerce:!0}),bigint:fe=>E.create({...fe,coerce:!0}),date:fe=>I.create({...fe,coerce:!0})},e.NEVER=s.INVALID})(FR);(function(e){var t=Ke&&Ke.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i),Object.defineProperty(n,a,{enumerable:!0,get:function(){return o[i]}})}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ke&&Ke.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(xo,e),r(p6,e),r(jR,e),r(vh,e),r(FR,e),r(So,e)})(e3);(function(e){var t=Ke&&Ke.__createBinding||(Object.create?function(a,s,l,u){u===void 0&&(u=l),Object.defineProperty(a,u,{enumerable:!0,get:function(){return s[l]}})}:function(a,s,l,u){u===void 0&&(u=l),a[u]=s[l]}),r=Ke&&Ke.__setModuleDefault||(Object.create?function(a,s){Object.defineProperty(a,"default",{enumerable:!0,value:s})}:function(a,s){a.default=s}),n=Ke&&Ke.__importStar||function(a){if(a&&a.__esModule)return a;var s={};if(a!=null)for(var l in a)l!=="default"&&Object.prototype.hasOwnProperty.call(a,l)&&t(s,a,l);return r(s,a),s},o=Ke&&Ke.__exportStar||function(a,s){for(var l in a)l!=="default"&&!Object.prototype.hasOwnProperty.call(s,l)&&t(s,a,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;const i=n(e3);e.z=i,o(e3,e),e.default=i})(h6);const doe="@ton/ton",hoe="14.0.0",poe="https://github.com/ton-org/ton.git",goe="Whales Corp. ",moe="MIT",voe="dist/index.js",yoe=["dist"],boe={docs:"rm -fr docs && typedoc src/index.ts",build:"rm -fr dist && tsc --declaration",test:"jest --verbose --runInBand",release:"yarn build && yarn release-it --npm.yarn1"},woe={"@release-it/keep-a-changelog":"^5.0.0","@ton/core":"^0.56.0","@ton/crypto":"3.2.0","@ton/emulator":"^2.1.1","@types/jest":"^27.0.1","@types/node":"^16.7.10",buffer:"^6.0.3",expect:"^27.1.0",jest:"^27.1.0","jest-mock":"^27.1.0",karma:"^6.3.4","karma-chrome-launcher":"^3.1.0","karma-jasmine":"^4.0.1","karma-typescript":"^5.5.2","karma-webpack":"^5.0.0",prando:"^6.0.1","release-it":"^17.1.1","ts-jest":"^27.0.5","ts-loader":"^9.2.5","ts-node":"^10.7.0",typedoc:"^0.23.24",typescript:"^4.4.2",webpack:"^5.51.2"},_oe={axios:"^1.6.7",dataloader:"^2.0.0","symbol.inspect":"1.0.1",teslabot:"^1.3.0",zod:"^3.21.4"},xoe={"@ton/core":">=0.56.0","@ton/crypto":">=3.2.0"},Soe={access:"public",registry:"https://registry.npmjs.org/"},Coe="yarn@3.4.1",Eoe={name:doe,version:hoe,repository:poe,author:goe,license:moe,main:voe,files:yoe,scripts:boe,devDependencies:woe,dependencies:_oe,peerDependencies:xoe,publishConfig:Soe,"release-it":{github:{release:!0},plugins:{"@release-it/keep-a-changelog":{filename:"CHANGELOG.md"}}},packageManager:Coe};var $R=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mh,"__esModule",{value:!0});mh.HttpApi=void 0;const koe=Wg,qC=$R(aoe),Aoe=$R(ig),et=h6,Moe=Eoe.version,Qu=et.z.object({"@type":et.z.literal("ton.blockIdExt"),workchain:et.z.number(),shard:et.z.string(),seqno:et.z.number(),root_hash:et.z.string(),file_hash:et.z.string()}),Ioe=et.z.object({balance:et.z.union([et.z.number(),et.z.string()]),state:et.z.union([et.z.literal("active"),et.z.literal("uninitialized"),et.z.literal("frozen")]),data:et.z.string(),code:et.z.string(),last_transaction_id:et.z.object({"@type":et.z.literal("internal.transactionId"),lt:et.z.string(),hash:et.z.string()}),block_id:Qu,sync_utime:et.z.number()}),Toe=et.z.object({"@type":et.z.literal("ok")}),Boe=et.z.object({"@type":et.z.literal("query.fees"),source_fees:et.z.object({"@type":et.z.literal("fees"),in_fwd_fee:et.z.number(),storage_fee:et.z.number(),gas_fee:et.z.number(),fwd_fee:et.z.number()})}),Poe=et.z.object({gas_used:et.z.number(),exit_code:et.z.number(),stack:et.z.array(et.z.unknown())}),Roe=et.z.union([et.z.object({"@type":et.z.literal("msg.dataRaw"),body:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataText"),text:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataDecryptedText"),text:et.z.string()}),et.z.object({"@type":et.z.literal("msg.dataEncryptedText"),text:et.z.string()})]),WC=et.z.object({source:et.z.string(),destination:et.z.string(),value:et.z.string(),fwd_fee:et.z.string(),ihr_fee:et.z.string(),created_lt:et.z.string(),body_hash:et.z.string(),msg_data:Roe,message:et.z.string().optional()}),t3=et.z.object({data:et.z.string(),utime:et.z.number(),transaction_id:et.z.object({lt:et.z.string(),hash:et.z.string()}),fee:et.z.string(),storage_fee:et.z.string(),other_fee:et.z.string(),in_msg:et.z.union([et.z.undefined(),WC]),out_msgs:et.z.array(WC)}),VC=et.z.array(t3),Ooe=et.z.object({state_root_hash:et.z.string(),last:Qu,init:Qu}),Noe=et.z.object({shards:et.z.array(Qu)}),Loe=et.z.object({"@type":et.z.literal("blocks.shortTxId"),mode:et.z.number(),account:et.z.string(),lt:et.z.string(),hash:et.z.string()}),HC=et.z.object({id:Qu,req_count:et.z.number(),incomplete:et.z.boolean(),transactions:et.z.array(Loe)});class KC{constructor(t,r,n,o){this.namespace=t,this.cache=r,this.codec=n,this.keyEncoder=o}async get(t){let r=await this.cache.get(this.namespace,this.keyEncoder(t));if(r){let n=this.codec.safeParse(JSON.parse(r));if(n.success)return n.data}return null}async set(t,r){r!==null?await this.cache.set(this.namespace,this.keyEncoder(t),JSON.stringify(r)):await this.cache.set(this.namespace,this.keyEncoder(t),null)}}class Doe{constructor(t,r){this.endpoint=t,this.cache=new koe.InMemoryCache,this.parameters={timeout:(r==null?void 0:r.timeout)||3e4,apiKey:r==null?void 0:r.apiKey,adapter:r==null?void 0:r.adapter},this.shardCache=new KC("ton-shard",this.cache,et.z.array(Qu),n=>n+""),this.shardLoader=new qC.default(async n=>await Promise.all(n.map(async o=>{const i=await this.shardCache.get(o);if(i)return i;let a=(await this.doCall("shards",{seqno:o},Noe)).shards;return await this.shardCache.set(o,a),a}))),this.shardTransactionsCache=new KC("ton-shard-tx",this.cache,HC,n=>n.workchain+":"+n.shard+":"+n.seqno),this.shardTransactionsLoader=new qC.default(async n=>await Promise.all(n.map(async o=>{const i=await this.shardTransactionsCache.get(o);if(i)return i;let a=await this.doCall("getBlockTransactions",{workchain:o.workchain,seqno:o.seqno,shard:o.shard},HC);return await this.shardTransactionsCache.set(o,a),a})),{cacheKeyFn:n=>n.workchain+":"+n.shard+":"+n.seqno})}getAddressInformation(t){return this.doCall("getAddressInformation",{address:t.toString()},Ioe)}async getTransactions(t,r){const n=r.inclusive;delete r.inclusive;let o;r.hash&&(o=Oe.Buffer.from(r.hash,"base64").toString("hex"));let i=r.limit;r.hash&&r.lt&&n!==!0&&i++;let a=await this.doCall("getTransactions",{address:t.toString(),...r,limit:i,hash:o},VC);return a.length>i&&(a=a.slice(0,i)),r.hash&&r.lt&&n!==!0&&a.shift(),a}async getMasterchainInfo(){return await this.doCall("getMasterchainInfo",{},Ooe)}async getShards(t){return await this.shardLoader.load(t)}async getBlockTransactions(t,r,n){return await this.shardTransactionsLoader.load({workchain:t,seqno:r,shard:n})}async getTransaction(t,r,n){let o=Oe.Buffer.from(n,"base64").toString("hex"),a=(await this.doCall("getTransactions",{address:t.toString(),lt:r,hash:o,limit:1},VC)).find(s=>s.transaction_id.lt===r&&s.transaction_id.hash===n);return a||null}async callGetMethod(t,r,n){return await this.doCall("runGetMethod",{address:t.toString(),method:r,stack:Uoe(n)},Poe)}async sendBoc(t){await this.doCall("sendBoc",{boc:t.toString("base64")},Toe)}async estimateFee(t,r){return await this.doCall("estimateFee",{address:t.toString(),body:r.body.toBoc().toString("base64"),init_data:r.initData?r.initData.toBoc().toString("base64"):"",init_code:r.initCode?r.initCode.toBoc().toString("base64"):"",ignore_chksig:r.ignoreSignature},Boe)}async tryLocateResultTx(t,r,n){return await this.doCall("tryLocateResultTx",{source:t.toString(),destination:r.toString(),created_lt:n},t3)}async tryLocateSourceTx(t,r,n){return await this.doCall("tryLocateSourceTx",{source:t.toString(),destination:r.toString(),created_lt:n},t3)}async doCall(t,r,n){let o={"Content-Type":"application/json","X-Ton-Client-Version":Moe};this.parameters.apiKey&&(o["X-API-Key"]=this.parameters.apiKey);let i=await Aoe.default.post(this.endpoint,JSON.stringify({id:"1",jsonrpc:"2.0",method:t,params:r}),{headers:o,timeout:this.parameters.timeout,adapter:this.parameters.adapter});if(i.status!==200||!i.data.ok)throw Error("Received error: "+JSON.stringify(i.data));let a=n.safeParse(i.data.result);if(a.success)return a.data;throw Error("Malformed response: "+a.error.format()._errors.join(", "))}}mh.HttpApi=Doe;function Uoe(e){let t=[];for(let r of e)if(r.type==="int")t.push(["num",r.value.toString()]);else if(r.type==="cell")t.push(["tvm.Cell",r.cell.toBoc().toString("base64")]);else if(r.type==="slice")t.push(["tvm.Slice",r.cell.toBoc().toString("base64")]);else if(r.type==="builder")t.push(["tvm.Builder",r.cell.toBoc().toString("base64")]);else throw Error("Unsupported stack item type: "+r.type);return t}var Hg={};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.TonClient=void 0;const joe=mh,vr=qt;class Foe{constructor(t){this.parameters={endpoint:t.endpoint},this.api=new joe.HttpApi(this.parameters.endpoint,{timeout:t.timeout,apiKey:t.apiKey,adapter:t.httpAdapter})}async getBalance(t){return(await this.getContractState(t)).balance}async runMethod(t,r,n=[]){let o=await this.api.callGetMethod(t,r,n);if(o.exit_code!==0)throw Error("Unable to execute get method. Got exit_code: "+o.exit_code);return{gas_used:o.gas_used,stack:ZC(o.stack)}}async callGetMethod(t,r,n=[]){return this.runMethod(t,r,n)}async runMethodWithError(t,r,n=[]){let o=await this.api.callGetMethod(t,r,n);return{gas_used:o.gas_used,stack:ZC(o.stack),exit_code:o.exit_code}}async callGetMethodWithError(t,r,n=[]){return this.runMethodWithError(t,r,n)}async getTransactions(t,r){let n=await this.api.getTransactions(t,r),o=[];for(let i of n)o.push((0,vr.loadTransaction)(vr.Cell.fromBoc(Oe.Buffer.from(i.data,"base64"))[0].beginParse()));return o}async getTransaction(t,r,n){let o=await this.api.getTransaction(t,r,n);return o?(0,vr.loadTransaction)(vr.Cell.fromBoc(Oe.Buffer.from(o.data,"base64"))[0].beginParse()):null}async tryLocateResultTx(t,r,n){let o=await this.api.tryLocateResultTx(t,r,n);return(0,vr.loadTransaction)(vr.Cell.fromBase64(o.data).beginParse())}async tryLocateSourceTx(t,r,n){let o=await this.api.tryLocateSourceTx(t,r,n);return(0,vr.loadTransaction)(vr.Cell.fromBase64(o.data).beginParse())}async getMasterchainInfo(){let t=await this.api.getMasterchainInfo();return{workchain:t.init.workchain,shard:t.last.shard,initSeqno:t.init.seqno,latestSeqno:t.last.seqno}}async getWorkchainShards(t){return(await this.api.getShards(t)).map(n=>({workchain:n.workchain,shard:n.shard,seqno:n.seqno}))}async getShardTransactions(t,r,n){let o=await this.api.getBlockTransactions(t,r,n);if(o.incomplete)throw Error("Unsupported");return o.transactions.map(i=>({account:vr.Address.parseRaw(i.account),lt:i.lt,hash:i.hash}))}async sendMessage(t){const r=(0,vr.beginCell)().store((0,vr.storeMessage)(t)).endCell().toBoc();await this.api.sendBoc(r)}async sendFile(t){await this.api.sendBoc(t)}async estimateExternalMessageFee(t,r){return await this.api.estimateFee(t,{body:r.body,initCode:r.initCode,initData:r.initData,ignoreSignature:r.ignoreSignature})}async sendExternalMessage(t,r){if(await this.isContractDeployed(t.address)||!t.init){const n=(0,vr.external)({to:t.address,body:r});await this.sendMessage(n)}else{const n=(0,vr.external)({to:t.address,init:t.init,body:r});await this.sendMessage(n)}}async isContractDeployed(t){return(await this.getContractState(t)).state==="active"}async getContractState(t){let r=await this.api.getAddressInformation(t),n=BigInt(r.balance),o=r.state;return{balance:n,state:o,code:r.code!==""?Oe.Buffer.from(r.code,"base64"):null,data:r.data!==""?Oe.Buffer.from(r.data,"base64"):null,lastTransaction:r.last_transaction_id.lt!=="0"?{lt:r.last_transaction_id.lt,hash:r.last_transaction_id.hash}:null,blockId:{workchain:r.block_id.workchain,shard:r.block_id.shard,seqno:r.block_id.seqno},timestampt:r.sync_utime}}open(t){return(0,vr.openContract)(t,r=>r3(this,r.address,r.init))}provider(t,r){return r3(this,t,r??null)}}Hg.TonClient=Foe;function Ts(e){const t=e["@type"];switch(t){case"tvm.list":case"tvm.tuple":return e.elements.map(Ts);case"tvm.cell":return vr.Cell.fromBoc(Oe.Buffer.from(e.bytes,"base64"))[0];case"tvm.slice":return vr.Cell.fromBoc(Oe.Buffer.from(e.bytes,"base64"))[0];case"tvm.stackEntryCell":return Ts(e.cell);case"tvm.stackEntrySlice":return Ts(e.slice);case"tvm.stackEntryTuple":return Ts(e.tuple);case"tvm.stackEntryList":return Ts(e.list);case"tvm.stackEntryNumber":return Ts(e.number);case"tvm.numberDecimal":return BigInt(e.number);default:throw Error("Unsupported item type: "+t)}}function zoe(e){if(e[0]==="num"){let t=e[1];return t.startsWith("-")?{type:"int",value:-BigInt(t.slice(1))}:{type:"int",value:BigInt(t)}}else{if(e[0]==="null")return{type:"null"};if(e[0]==="cell")return{type:"cell",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="slice")return{type:"slice",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="builder")return{type:"builder",cell:vr.Cell.fromBoc(Oe.Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="tuple"||e[0]==="list")return e[1].elements.length===0?{type:"null"}:{type:"tuple",items:e[1].elements.map(Ts)};throw Error("Unsupported stack item type: "+e[0])}}function ZC(e){let t=[];for(let r of e)t.push(zoe(r));return new vr.TupleReader(t)}function r3(e,t,r){return{async getState(){let n=await e.getContractState(t),o=n.balance,i=n.lastTransaction?{lt:BigInt(n.lastTransaction.lt),hash:Oe.Buffer.from(n.lastTransaction.hash,"base64")}:null,a;if(n.state==="active")a={type:"active",code:n.code?n.code:null,data:n.data?n.data:null};else if(n.state==="uninitialized")a={type:"uninit"};else if(n.state==="frozen")a={type:"frozen",stateHash:Oe.Buffer.alloc(0)};else throw Error("Unsupported state");return{balance:o,last:i,state:a}},async get(n,o){return{stack:(await e.callGetMethod(t,n,o)).stack}},async external(n){let o=null;r&&!await e.isContractDeployed(t)&&(o=r);const i=(0,vr.external)({to:t,init:o,body:n});let a=(0,vr.beginCell)().store((0,vr.storeMessage)(i)).endCell().toBoc();await e.sendFile(a)},async internal(n,o){let i=null;r&&!await e.isContractDeployed(t)&&(i=r);let a=!0;o.bounce!==null&&o.bounce!==void 0&&(a=o.bounce);let s;typeof o.value=="string"?s=(0,vr.toNano)(o.value):s=o.value;let l=null;typeof o.body=="string"?l=(0,vr.comment)(o.body):o.body&&(l=o.body),await n.send({to:t,value:s,bounce:a,sendMode:o.sendMode,init:i,body:l})},open(n){return(0,vr.openContract)(n,o=>r3(e,o.address,o.init??null))},getTransactions(n,o,i,a){return e.getTransactions(n,{limit:a??100,lt:o.toString(),hash:i.toString("base64"),inclusive:!0})}}}var Kg={},Zg={};Object.defineProperty(Zg,"__esModule",{value:!0});Zg.toUrlSafe=void 0;function $oe(e){for(;e.indexOf("/")>=0;)e=e.replace("/","_");for(;e.indexOf("+")>=0;)e=e.replace("+","-");for(;e.indexOf("=")>=0;)e=e.replace("=","");return e}Zg.toUrlSafe=$oe;var t0=Ke&&Ke.__classPrivateFieldSet||function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},Ut=Ke&&Ke.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},qoe=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Vn,Hn,Kn,Pn;Object.defineProperty(Kg,"__esModule",{value:!0});Kg.TonClient4=void 0;const Woe=qoe(ig),Nn=qt,H2=Zg,ve=h6;class Voe{constructor(t){Vn.set(this,void 0),Hn.set(this,void 0),Kn.set(this,void 0),Pn.set(this,void 0),t0(this,Pn,Woe.default.create(),"f"),t0(this,Vn,t.endpoint,"f"),t0(this,Hn,t.timeout||5e3,"f"),t0(this,Kn,t.httpAdapter,"f"),t.requestInterceptor&&Ut(this,Pn,"f").interceptors.request.use(t.requestInterceptor)}async getLastBlock(){let t=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/latest",{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),r=Hoe.safeParse(t.data);if(!r.success)throw Error("Mailformed response: "+r.error.format()._errors.join(", "));return r.data}async getBlock(t){let r=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),n=GC.safeParse(r.data);if(!n.success)throw Error("Mailformed response");if(!n.data.exist)throw Error("Block is out of scope");return n.data.block}async getBlockByUtime(t){let r=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/utime/"+t,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),n=GC.safeParse(r.data);if(!n.success)throw Error("Mailformed response");if(!n.data.exist)throw Error("Block is out of scope");return n.data.block}async getAccount(t,r){let n=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0}),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),o=Koe.safeParse(n.data);if(!o.success)throw Error("Mailformed response");return o.data}async getAccountLite(t,r){let n=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/lite",{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),o=Zoe.safeParse(n.data);if(!o.success)throw Error("Mailformed response");return o.data}async isContractDeployed(t,r){return(await this.getAccountLite(t,r)).account.state.type==="active"}async isAccountChanged(t,r,n){let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/changed/"+n.toString(10),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=Goe.safeParse(o.data);if(!i.success)throw Error("Mailformed response");return i.data}async getAccountTransactions(t,r,n){let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/account/"+t.toString({urlSafe:!0})+"/tx/"+r.toString(10)+"/"+(0,H2.toUrlSafe)(n.toString("base64")),{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=Joe.safeParse(o.data);if(!i.success)throw Error("Mailformed response");let a=i.data,s=[],l=Nn.Cell.fromBoc(Oe.Buffer.from(a.boc,"base64"));for(let u=0;u0&&(n="/"+[...r].sort().join(","));let o=await Ut(this,Pn,"f").get(Ut(this,Vn,"f")+"/block/"+t+"/config"+n,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),i=Qoe.safeParse(o.data);if(!i.success)throw Error("Mailformed response");return i.data}async runMethod(t,r,n,o){let i=o&&o.length>0?"/"+(0,H2.toUrlSafe)((0,Nn.serializeTuple)(o).toBoc({idx:!1,crc32:!1}).toString("base64")):"",a=Ut(this,Vn,"f")+"/block/"+t+"/"+r.toString({urlSafe:!0})+"/run/"+encodeURIComponent(n)+i,s=await Ut(this,Pn,"f").get(a,{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")}),l=Yoe.safeParse(s.data);if(!l.success)throw Error("Mailformed response");let u=l.data.resultRaw?(0,Nn.parseTuple)(Nn.Cell.fromBoc(Oe.Buffer.from(l.data.resultRaw,"base64"))[0]):[];return{exitCode:l.data.exitCode,result:u,resultRaw:l.data.resultRaw,block:l.data.block,shardBlock:l.data.shardBlock,reader:new Nn.TupleReader(u)}}async sendMessage(t){let r=await Ut(this,Pn,"f").post(Ut(this,Vn,"f")+"/send",{boc:t.toString("base64")},{adapter:Ut(this,Kn,"f"),timeout:Ut(this,Hn,"f")});if(!Xoe.safeParse(r.data).success)throw Error("Mailformed response");return{status:r.data.status}}open(t){return(0,Nn.openContract)(t,r=>mf(this,null,r.address,r.init))}openAt(t,r){return(0,Nn.openContract)(r,n=>mf(this,t,n.address,n.init))}provider(t,r){return mf(this,null,t,r??null)}providerAt(t,r,n){return mf(this,t,r,n??null)}}Kg.TonClient4=Voe;Vn=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,Pn=new WeakMap;function mf(e,t,r,n){return{async getState(){let o=t;o===null&&(o=(await e.getLastBlock()).last.seqno);let i=await e.getAccount(o,r),a=i.account.last?{lt:BigInt(i.account.last.lt),hash:Oe.Buffer.from(i.account.last.hash,"base64")}:null,s;if(i.account.state.type==="active")s={type:"active",code:i.account.state.code?Oe.Buffer.from(i.account.state.code,"base64"):null,data:i.account.state.data?Oe.Buffer.from(i.account.state.data,"base64"):null};else if(i.account.state.type==="uninit")s={type:"uninit"};else if(i.account.state.type==="frozen")s={type:"frozen",stateHash:Oe.Buffer.from(i.account.state.stateHash,"base64")};else throw Error("Unsupported state");return{balance:BigInt(i.account.balance.coins),last:a,state:s}},async get(o,i){let a=t;a===null&&(a=(await e.getLastBlock()).last.seqno);let s=await e.runMethod(a,r,o,i);if(s.exitCode!==0&&s.exitCode!==1)throw Error("Exit code: "+s.exitCode);return{stack:new Nn.TupleReader(s.result)}},async external(o){let i=await e.getLastBlock(),a=null;n&&(await e.getAccountLite(i.last.seqno,r)).account.state.type!=="active"&&(a=n);const s=(0,Nn.external)({to:r,init:a,body:o});let l=(0,Nn.beginCell)().store((0,Nn.storeMessage)(s)).endCell().toBoc();await e.sendMessage(l)},async internal(o,i){let a=await e.getLastBlock(),s=null;n&&(await e.getAccountLite(a.last.seqno,r)).account.state.type!=="active"&&(s=n);let l=!0;i.bounce!==null&&i.bounce!==void 0&&(l=i.bounce);let u;typeof i.value=="string"?u=(0,Nn.toNano)(i.value):u=i.value;let c=null;typeof i.body=="string"?c=(0,Nn.comment)(i.body):i.body&&(c=i.body),await o.send({to:r,value:u,bounce:l,sendMode:i.sendMode,init:s,body:c})},open(o){return(0,Nn.openContract)(o,i=>mf(e,t,i.address,i.init??null))},async getTransactions(o,i,a,s){const l=typeof s=="number";if(l&&s<=0)return[];let u=[];do{const c=await e.getAccountTransactions(o,i,a),h=c[0].tx,[d,p]=[h.lt,h.hash()];if(u.length>0&&d===i&&p.equals(a)&&c.shift(),c.length===0)break;const b=c[c.length-1].tx,[S,x]=[b.lt,b.hash()];if(S===i&&x.equals(a))break;u.push(...c.map(k=>k.tx)),i=S,a=x}while(l&&u.lengthu===o))==null?void 0:s[0];if(a===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${o}`);return{networkGlobalId:r,workChain:n,walletVersion:a,subwalletNumber:i}}Bl.loadWalletIdV5Beta=uae;function cae(e){return t=>{t.storeInt(e.networkGlobalId,32),t.storeInt(e.workChain,8),t.storeUint(VR[e.walletVersion],8),t.storeUint(e.subwalletNumber,32)}}Bl.storeWalletIdV5Beta=cae;var JC;function HR(){if(JC)return Kc;JC=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.WalletContractV5Beta=void 0;const e=qt,t=Ro(),r=Bl;class n{static create(i){var s,l,u,c;const a={networkGlobalId:((s=i.walletId)==null?void 0:s.networkGlobalId)??-239,workChain:((l=i==null?void 0:i.walletId)==null?void 0:l.workChain)??0,subwalletNumber:((u=i==null?void 0:i.walletId)==null?void 0:u.subwalletNumber)??0,walletVersion:((c=i==null?void 0:i.walletId)==null?void 0:c.walletVersion)??"v5"};return new n(a,i.publicKey)}constructor(i,a){this.walletId=i,this.publicKey=a,this.walletId=i;let s=e.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAIwAIQgLkzzsvTG1qYeoPK1RH0mZ4WyavNjfbLe7mvNGqgm80Eg3NjhE=","base64"))[0],l=(0,e.beginCell)().storeInt(0,33).store((0,r.storeWalletIdV5Beta)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:s,data:l},this.address=(0,e.contractAddress)(this.walletId.workChain,{code:s,data:l})}async getBalance(i){return(await i.getState()).balance}async getSeqno(i){return(await i.getState()).state.type==="active"?(await i.get("seqno",[])).stack.readNumber():0}async getExtensions(i){return(await i.getState()).state.type==="active"?(await i.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(i){const a=await this.getExtensions(i);if(!a)return[];const s=e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(8),a);return s.keys().map(l=>{const u=s.get(l),c=l^u+1n;return e.Address.parseRaw(`${u}:${c.toString(16).padStart(64,"0")}`)})}async getIsSecretKeyAuthEnabled(i){return(await i.get("get_is_signature_auth_allowed",[])).stack.readNumber()!==0}async send(i,a){await i.external(a)}async sendTransfer(i,a){const s=await this.createTransfer(a);await this.send(i,s)}async sendAddExtension(i,a){const s=await this.createAddExtension(a);await this.send(i,s)}async sendRemoveExtension(i,a){const s=await this.createRemoveExtension(a);await this.send(i,s)}async sendActionsBatch(i,a){const s=await this.createRequest(a);await this.send(i,s)}createActions(i){return i.messages.map(s=>({type:"sendMsg",mode:i.sendMode,outMsg:s}))}createTransfer(i){return this.createRequest({...i,actions:this.createActions({messages:i.messages,sendMode:i.sendMode})})}createAddExtension(i){return this.createRequest({...i,actions:[{type:"addExtension",address:i.extensionAddress}]})}createRemoveExtension(i){return this.createRequest({...i,actions:[{type:"removeExtension",address:i.extensionAddress}]})}createRequest(i){return i.authType==="extension"?(0,t.createWalletTransferV5Beta)(i):(0,t.createWalletTransferV5Beta)({...i,walletId:(0,r.storeWalletIdV5Beta)(this.walletId)})}sender(i,a){return{send:async s=>{let l=await this.getSeqno(i),u=this.createTransfer({seqno:l,secretKey:a,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(i,u)}}}}return Kc.WalletContractV5Beta=n,n.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},Kc}var Ki={},Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.isOutActionBasic=Pl.isOutActionExtended=void 0;function KR(e){return e.type==="setIsPublicKeyEnabled"||e.type==="addExtension"||e.type==="removeExtension"}Pl.isOutActionExtended=KR;function fae(e){return!KR(e)}Pl.isOutActionBasic=fae;Object.defineProperty(Ki,"__esModule",{value:!0});Ki.loadOutListExtendedV5Beta=Ki.storeOutListExtendedV5Beta=Ki.loadOutActionV5BetaExtended=Ki.storeOutActionExtendedV5Beta=void 0;const E0=qt,eE=Pl,ZR=550222170;function dae(e){return t=>{t.storeUint(ZR,32).storeUint(e.isEnabled?1:0,1)}}const GR=474012575;function hae(e){return t=>{t.storeUint(GR,32).storeAddress(e.address)}}const YR=1588524196;function pae(e){return t=>{t.storeUint(YR,32).storeAddress(e.address)}}function QR(e){switch(e.type){case"setIsPublicKeyEnabled":return dae(e);case"addExtension":return hae(e);case"removeExtension":return pae(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Ki.storeOutActionExtendedV5Beta=QR;function XR(e){const t=e.loadUint(32);switch(t){case ZR:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case GR:return{type:"addExtension",address:e.loadAddress()};case YR:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Ki.loadOutActionV5BetaExtended=XR;function JR(e){const[t,...r]=e;if(!t||!(0,eE.isOutActionExtended)(t)){if(e.some(eE.isOutActionExtended))throw new Error("Can't serialize actions list: all extended actions must be placed before out actions");return n=>{n.storeUint(0,1).storeRef((0,E0.beginCell)().store((0,E0.storeOutList)(e)).endCell())}}return n=>{n.storeUint(1,1).store(QR(t)).storeRef((0,E0.beginCell)().store(JR(r)).endCell())}}Ki.storeOutListExtendedV5Beta=JR;function gae(e){const t=[];for(;e.loadUint(1);){const n=XR(e);t.push(n),e=e.loadRef().beginParse()}const r=(0,E0.loadOutList)(e.loadRef().beginParse());if(r.some(n=>n.type==="setCode"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5");return t.concat(r)}Ki.loadOutListExtendedV5Beta=gae;var Yg={};Object.defineProperty(Yg,"__esModule",{value:!0});Yg.signPayload=void 0;const mae=Fl();function vae(e,t,r){return"secretKey"in e?r((0,mae.sign)(t.endCell().hash(),e.secretKey),t):e.signer(t.endCell()).then(n=>r(n,t))}Yg.signPayload=vae;var Zc={},ea={};Object.defineProperty(ea,"__esModule",{value:!0});ea.storeWalletIdV5R1=ea.loadWalletIdV5R1=ea.isWalletIdV5R1ClientContext=void 0;const gu=qt;function eO(e){return typeof e!="number"}ea.isWalletIdV5R1ClientContext=eO;const tO={v5r1:0};function yae(e,t){var a;const r=new gu.BitReader(new gu.BitString(typeof e=="bigint"?Oe.Buffer.from(e.toString(16),"hex"):e instanceof gu.Slice?e.loadBuffer(4):e,0,32)).loadInt(32),n=BigInt(r)^BigInt(t),o=(0,gu.beginCell)().storeInt(n,32).endCell().beginParse();if(o.loadUint(1)){const s=o.loadInt(8),l=o.loadUint(8),u=o.loadUint(15),c=(a=Object.entries(tO).find(([h,d])=>d===l))==null?void 0:a[0];if(c===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${l}`);return{networkGlobalId:t,context:{walletVersion:c,workChain:s,subwalletNumber:u}}}else{const s=o.loadUint(31);return{networkGlobalId:t,context:s}}}ea.loadWalletIdV5R1=yae;function bae(e){return t=>{let r;return eO(e.context)?r=(0,gu.beginCell)().storeUint(1,1).storeInt(e.context.workChain,8).storeUint(tO[e.context.walletVersion],8).storeUint(e.context.subwalletNumber,15).endCell().beginParse().loadInt(32):r=(0,gu.beginCell)().storeUint(0,1).storeUint(e.context,31).endCell().beginParse().loadInt(32),t.storeInt(BigInt(e.networkGlobalId)^BigInt(r),32)}}ea.storeWalletIdV5R1=bae;var tE;function rO(){if(tE)return Zc;tE=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.WalletContractV5R1=void 0;const e=qt,t=Ro(),r=ea;class n{static create(i){var s,l,u;let a=0;return"workChain"in i&&i.workChain!=null&&(a=i.workChain),(s=i.walletId)!=null&&s.context&&(0,r.isWalletIdV5R1ClientContext)(i.walletId.context)&&i.walletId.context.workChain!=null&&(a=i.walletId.context.workChain),new n(a,i.publicKey,{networkGlobalId:((l=i.walletId)==null?void 0:l.networkGlobalId)??-239,context:((u=i.walletId)==null?void 0:u.context)??{workChain:0,walletVersion:"v5r1",subwalletNumber:0}})}constructor(i,a,s){this.publicKey=a,this.walletId=s,this.walletId=s;let l=e.Cell.fromBoc(Oe.Buffer.from("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e","hex"))[0],u=(0,e.beginCell)().storeUint(1,1).storeUint(0,32).store((0,r.storeWalletIdV5R1)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:l,data:u},this.address=(0,e.contractAddress)(i,{code:l,data:u})}async getBalance(i){return(await i.getState()).balance}async getSeqno(i){return(await i.getState()).state.type==="active"?(await i.get("seqno",[])).stack.readNumber():0}async getExtensions(i){return(await i.getState()).state.type==="active"?(await i.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(i){const a=await this.getExtensions(i);return a?e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(1),a).keys().map(l=>{const u=this.address.workChain;return e.Address.parseRaw(`${u}:${l.toString(16).padStart(64,"0")}`)}):[]}async getIsSecretKeyAuthEnabled(i){return(await i.get("is_signature_allowed",[])).stack.readBoolean()}async send(i,a){await i.external(a)}async sendTransfer(i,a){const s=await this.createTransfer(a);await this.send(i,s)}async sendAddExtension(i,a){const s=await this.createAddExtension(a);await this.send(i,s)}async sendRemoveExtension(i,a){const s=await this.createRemoveExtension(a);await this.send(i,s)}createActions(i){return i.messages.map(s=>({type:"sendMsg",mode:i.sendMode,outMsg:s}))}createTransfer(i){return this.createRequest({actions:this.createActions({messages:i.messages,sendMode:i.sendMode}),...i})}createAddExtension(i){return this.createRequest({actions:[{type:"addExtension",address:i.extensionAddress}],...i})}createRemoveExtension(i){return this.createRequest({actions:[{type:"removeExtension",address:i.extensionAddress}],...i})}createRequest(i){return i.authType==="extension"?(0,t.createWalletTransferV5R1)(i):(0,t.createWalletTransferV5R1)({...i,walletId:(0,r.storeWalletIdV5R1)(this.walletId)})}sender(i,a){return{send:async s=>{let l=await this.getSeqno(i),u=this.createTransfer({seqno:l,secretKey:a,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(i,u)}}}}return Zc.WalletContractV5R1=n,n.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},Zc}var Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.patchV5R1ActionsSendMode=Un.toSafeV5R1SendMode=Un.loadOutListExtendedV5R1=Un.storeOutListExtendedV5R1=Un.loadOutActionExtendedV5R1=Un.storeOutActionExtendedV5R1=void 0;const Nd=qt,rE=Pl,nO=4;function wae(e){return t=>{t.storeUint(nO,8).storeUint(e.isEnabled?1:0,1)}}const iO=2;function _ae(e){return t=>{t.storeUint(iO,8).storeAddress(e.address)}}const oO=3;function xae(e){return t=>{t.storeUint(oO,8).storeAddress(e.address)}}function g6(e){switch(e.type){case"setIsPublicKeyEnabled":return wae(e);case"addExtension":return _ae(e);case"removeExtension":return xae(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Un.storeOutActionExtendedV5R1=g6;function n3(e){const t=e.loadUint(8);switch(t){case nO:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case iO:return{type:"addExtension",address:e.loadAddress()};case oO:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Un.loadOutActionExtendedV5R1=n3;function Sae(e){const t=e.filter(rE.isOutActionExtended),r=e.filter(rE.isOutActionBasic);return n=>{const o=r.length?(0,Nd.beginCell)().store((0,Nd.storeOutList)(r.slice().reverse())):null;if(n.storeMaybeRef(o),t.length===0)n.storeUint(0,1);else{const[i,...a]=t;n.storeUint(1,1).store(g6(i)),a.length>0&&n.storeRef(aO(a))}}}Un.storeOutListExtendedV5R1=Sae;function aO(e){const[t,...r]=e;let n=(0,Nd.beginCell)().store(g6(t));return r.length>0&&(n=n.storeRef(aO(r))),n.endCell()}function Cae(e){const t=[],r=e.loadMaybeRef();if(r){const n=(0,Nd.loadOutList)(r.beginParse());if(n.some(o=>o.type!=="sendMsg"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5r1");t.push(...n)}if(e.loadBoolean()){const n=n3(e);t.push(n)}for(;e.remainingRefs>0;){e=e.loadRef().beginParse();const n=n3(e);t.push(n)}return t}Un.loadOutListExtendedV5R1=Cae;function sO(e,t){return t==="internal"||t==="extension"?e:e|Nd.SendMode.IGNORE_ERRORS}Un.toSafeV5R1SendMode=sO;function Eae(e,t){return e.map(r=>r.type==="sendMsg"?{...r,mode:sO(r.mode,t)}:r)}Un.patchV5R1ActionsSendMode=Eae;var nE;function Ro(){if(nE)return Bn;nE=1,Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.createWalletTransferV5R1=Bn.createWalletTransferV5Beta=Bn.createWalletTransferV4=Bn.createWalletTransferV3=Bn.createWalletTransferV2=Bn.createWalletTransferV1=void 0;const e=qt,t=Fl(),r=HR(),n=Ki,o=Yg,i=rO(),a=Un;function s(b,S){return(0,e.beginCell)().storeBuffer(b).storeBuilder(S).endCell()}function l(b,S){return(0,e.beginCell)().storeBuilder(S).storeBuffer(b).endCell()}function u(b){let S=(0,e.beginCell)().storeUint(b.seqno,32);b.message&&(S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(b.message))));let x=(0,t.sign)(S.endCell().hash(),b.secretKey);return(0,e.beginCell)().storeBuffer(x).storeBuilder(S).endCell()}Bn.createWalletTransferV1=u;function c(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.seqno,32);if(b.seqno===0)for(let M=0;M<32;M++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);for(let M of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(M)));let x=(0,t.sign)(S.endCell().hash(),b.secretKey);return(0,e.beginCell)().storeBuffer(x).storeBuilder(S).endCell()}Bn.createWalletTransferV2=c;function h(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.walletId,32);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);S.storeUint(b.seqno,32);for(let x of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(x)));return(0,o.signPayload)(b,S,s)}Bn.createWalletTransferV3=h;function d(b){if(b.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let S=(0,e.beginCell)().storeUint(b.walletId,32);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);S.storeUint(b.seqno,32),S.storeUint(0,8);for(let x of b.messages)S.storeUint(b.sendMode,8),S.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(x)));return(0,o.signPayload)(b,S,s)}Bn.createWalletTransferV4=d;function p(b){if(b.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(b.authType==="extension")return(0,e.beginCell)().storeUint(r.WalletContractV5Beta.OpCodes.auth_extension,32).store((0,n.storeOutListExtendedV5Beta)(b.actions)).endCell();const S=(0,e.beginCell)().storeUint(b.authType==="internal"?r.WalletContractV5Beta.OpCodes.auth_signed_internal:r.WalletContractV5Beta.OpCodes.auth_signed_external,32).store(b.walletId);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);return S.storeUint(b.seqno,32).store((0,n.storeOutListExtendedV5Beta)(b.actions)),(0,o.signPayload)(b,S,l)}Bn.createWalletTransferV5Beta=p;function v(b){if(b.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(b={...b},b.authType==="extension")return(0,e.beginCell)().storeUint(i.WalletContractV5R1.OpCodes.auth_extension,32).storeUint(b.queryId??0,64).store((0,a.storeOutListExtendedV5R1)(b.actions)).endCell();b.actions=(0,a.patchV5R1ActionsSendMode)(b.actions,b.authType);const S=(0,e.beginCell)().storeUint(b.authType==="internal"?i.WalletContractV5R1.OpCodes.auth_signed_internal:i.WalletContractV5R1.OpCodes.auth_signed_external,32).store(b.walletId);if(b.seqno===0)for(let x=0;x<32;x++)S.storeBit(1);else S.storeUint(b.timeout||Math.floor(Date.now()/1e3)+60,32);return S.storeUint(b.seqno,32).store((0,a.storeOutListExtendedV5R1)(b.actions)),(0,o.signPayload)(b,S,l)}return Bn.createWalletTransferV5R1=v,Bn}Object.defineProperty(Gg,"__esModule",{value:!0});Gg.WalletContractV1R1=void 0;const Kl=qt,kae=Ro();class m6{static create(t){return new m6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Kl.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEARAAAhP8AIN2k8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVEH98Ik=","base64"))[0],o=(0,Kl.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Kl.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){let r=await t.getState();return r.state.type==="active"?Kl.Cell.fromBoc(r.state.data)[0].beginParse().loadUint(32):0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Kl.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,kae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Kl.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Gg.WalletContractV1R1=m6;var Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});Qg.WalletContractV1R2=void 0;const Gc=qt,Aae=Ro();class v6{static create(t){return new v6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Gc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAUwAAov8AIN0gggFMl7qXMO1E0NcLH+Ck8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVNDieG8=","base64"))[0],o=(0,Gc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Gc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Gc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Aae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Gc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Qg.WalletContractV1R2=v6;var Xg={};Object.defineProperty(Xg,"__esModule",{value:!0});Xg.WalletContractV1R3=void 0;const Yc=qt,Mae=Ro();class y6{static create(t){return new y6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Yc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAXwAAuv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVLW4bkI=","base64"))[0],o=(0,Yc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Yc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Yc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Mae.createWalletTransferV1)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,message:t.message})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,message:(0,Yc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})});await this.send(t,i)}}}}Xg.WalletContractV1R3=y6;var Jg={};Object.defineProperty(Jg,"__esModule",{value:!0});Jg.WalletContractV2R1=void 0;const Qc=qt,Iae=Ro();class b6{static create(t){return new b6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Qc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAVwAAqv8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VShNwu2","base64"))[0],o=(0,Qc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Qc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Qc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Iae.createWalletTransferV2)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Qc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}Jg.WalletContractV2R1=b6;var em={};Object.defineProperty(em,"__esModule",{value:!0});em.WalletContractV2R2=void 0;const Xc=qt,Tae=Ro();class w6{static create(t){return new w6(t.workchain,t.publicKey)}constructor(t,r){this.workchain=t,this.publicKey=r;let n=Xc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAYwAAwv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VQETNeh","base64"))[0],o=(0,Xc.beginCell)().storeUint(0,32).storeBuffer(r).endCell();this.init={code:n,data:o},this.address=(0,Xc.contractAddress)(t,{code:n,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){let r=Xc.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(r=t.sendMode),(0,Tae.createWalletTransferV2)({seqno:t.seqno,sendMode:r,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Xc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}em.WalletContractV2R2=w6;var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.WalletContractV3R1=void 0;const Jc=qt,Bae=Ro();class _6{static create(t){return new _6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=Jc.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=","base64"))[0],i=(0,Jc.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(r).endCell();this.init={code:o,data:i},this.address=(0,Jc.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Bae.createWalletTransferV3)({...t,sendMode:t.sendMode??Jc.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,Jc.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}tm.WalletContractV3R1=_6;var rm={};Object.defineProperty(rm,"__esModule",{value:!0});rm.WalletContractV3R2=void 0;const ef=qt,Pae=Ro();class x6{static create(t){return new x6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=ef.Cell.fromBoc(Oe.Buffer.from("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=","base64"))[0],i=(0,ef.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(r).endCell();this.init={code:o,data:i},this.address=(0,ef.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Pae.createWalletTransferV3)({...t,sendMode:t.sendMode??ef.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,ef.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}rm.WalletContractV3R2=x6;var nm={};Object.defineProperty(nm,"__esModule",{value:!0});nm.WalletContractV4=void 0;const tf=qt,Rae=Ro();class S6{static create(t){return new S6(t.workchain,t.publicKey,t.walletId)}constructor(t,r,n){this.workchain=t,this.publicKey=r,n!=null?this.walletId=n:this.walletId=698983191+t;let o=tf.Cell.fromBoc(Oe.Buffer.from("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==","base64"))[0],i=(0,tf.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(this.publicKey).storeBit(0).endCell();this.init={code:o,data:i},this.address=(0,tf.contractAddress)(t,{code:o,data:i})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,r){await t.external(r)}async sendTransfer(t,r){let n=this.createTransfer(r);await this.send(t,n)}createTransfer(t){return(0,Rae.createWalletTransferV4)({...t,sendMode:t.sendMode??tf.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,r){return{send:async n=>{let o=await this.getSeqno(t),i=this.createTransfer({seqno:o,secretKey:r,sendMode:n.sendMode,messages:[(0,tf.internal)({to:n.to,value:n.value,init:n.init,body:n.body,bounce:n.bounce})]});await this.send(t,i)}}}}nm.WalletContractV4=S6;var lO={};(function(e){var t=Ke&&Ke.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(o,i);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,s)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ke&&Ke.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(HR(),e),r(Ki,e),r(Bl,e)})(lO);var uO={};(function(e){var t=Ke&&Ke.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(o,i);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,s)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=Ke&&Ke.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(rO(),e),r(Un,e),r(ea,e)})(uO);var im={};Object.defineProperty(im,"__esModule",{value:!0});im.JettonMaster=void 0;const Oae=qt;class C6{static create(t){return new C6(t)}constructor(t){this.address=t}async getWalletAddress(t,r){return(await t.get("get_wallet_address",[{type:"slice",cell:(0,Oae.beginCell)().storeAddress(r).endCell()}])).stack.readAddress()}async getJettonData(t){let r=await t.get("get_jetton_data",[]),n=r.stack.readBigNumber(),o=r.stack.readBoolean(),i=r.stack.readAddress(),a=r.stack.readCell(),s=r.stack.readCell();return{totalSupply:n,mintable:o,adminAddress:i,content:a,walletCode:s}}}im.JettonMaster=C6;var om={};Object.defineProperty(om,"__esModule",{value:!0});om.JettonWallet=void 0;class E6{static create(t){return new E6(t)}constructor(t){this.address=t}async getBalance(t){return(await t.getState()).state.type!=="active"?0n:(await t.get("get_wallet_data",[])).stack.readBigNumber()}}om.JettonWallet=E6;var yh={};Object.defineProperty(yh,"__esModule",{value:!0});yh.MultisigOrder=void 0;const iE=Fl(),r0=qt;class e1{constructor(t){this.signatures={},this.payload=t}static fromCell(t){var a;let r=t.beginParse(),n=(a=r.loadMaybeRef())==null?void 0:a.beginParse();const o=r.asCell();let i=new e1(o);if(n){for(;n.remainingBits>0;){const s=n.loadBuffer(64),l=n.loadUint(8);i.signatures[l]=s,n.remainingRefs>0?n=n.loadRef().asSlice():n.skip(1)}n.endParse()}return i}static fromPayload(t){return new e1(t)}addSignature(t,r,n){const o=this.payload.hash();if(!(0,iE.signVerify)(o,r,n.owners.get(t).slice(0,-1)))throw Error("invalid signature");this.signatures[t]=r}sign(t,r){const n=this.payload.hash();return this.signatures[t]=(0,iE.sign)(n,r),n}unionSignatures(t){this.signatures=Object.assign({},this.signatures,t.signatures)}clearSignatures(){this.signatures={}}toCell(t){let r=(0,r0.beginCell)().storeBit(0);for(const n in this.signatures){const o=this.signatures[n];r=(0,r0.beginCell)().storeBit(1).storeRef((0,r0.beginCell)().storeBuffer(o).storeUint(parseInt(n),8).storeBuilder(r).endCell())}return(0,r0.beginCell)().storeUint(t,8).storeBuilder(r).storeBuilder(this.payload.asBuilder()).endCell()}}yh.MultisigOrder=e1;var am={};Object.defineProperty(am,"__esModule",{value:!0});am.MultisigOrderBuilder=void 0;const rf=qt,Nae=yh;class Lae{constructor(t,r){this.messages=(0,rf.beginCell)(),this.queryId=0n,this.walletId=t,this.queryOffset=r||7200}addMessage(t,r){if(this.messages.refs>=4)throw Error("only 4 refs are allowed");this.updateQueryId(),this.messages.storeUint(r,8),this.messages.storeRef((0,rf.beginCell)().store((0,rf.storeMessageRelaxed)(t)).endCell())}clearMessages(){this.messages=(0,rf.beginCell)()}build(){return Nae.MultisigOrder.fromPayload((0,rf.beginCell)().storeUint(this.walletId,32).storeUint(this.queryId,64).storeBuilder(this.messages).endCell())}updateQueryId(){const t=BigInt(Math.floor(Date.now()/1e3+this.queryOffset));this.queryId=t<<32n}}am.MultisigOrderBuilder=Lae;var sm={};Object.defineProperty(sm,"__esModule",{value:!0});sm.MultisigWallet=void 0;const oE=Fl(),Rn=qt,Dae=Rn.Cell.fromBase64("te6ccgECKwEABBgAART/APSkE/S88sgLAQIBIAIDAgFIBAUE2vIgxwCOgzDbPOCDCNcYIPkBAdMH2zwiwAAToVNxePQOb6Hyn9s8VBq6+RDyoAb0BCD5AQHTH1EYuvKq0z9wUwHwCgHCCAGDCryx8mhTFYBA9A5voSCYDqQgwgryZw7f+COqH1NAufJhVCOjU04gIyEiAgLMBgcCASAMDQIBIAgJAgFmCgsAA9GEAiPymAvHoHN9CYbZ5S7Z4BPHohwhJQAtAKkItdJEqCTItdKlwLUAdAT8ArobBKAATwhbpEx4CBukTDgAdAg10rDAJrUAvALyFjPFszJ4HHXI8gBzxb0AMmACASAODwIBIBQVARW77ZbVA0cFUg2zyCoCAUgQEQIBIBITAXOxHXQgwjXGCD5AQHTB4IB1MTtQ9hTIHj0Dm+h8p/XC/9eMfkQ8qCuAfQEIW6TW3Ey4PkBWNs8AaQBgJwA9rtqA6ADoAPoCAXoCEfyAgPyA3XlP+AXkegAA54tkwAAXrhlXP8EA1WZ2oexAAgEgFhcCASAYGQFRtyVbZ4YmRmpGEAgegc30McJNhFpAADMaYeYuAFrgJhwLb+4cC3d0bhAjAYm1WZtnhqvgb+2xxsoicAgej430pBHEoFpAADHDhBACGuQkuuBk9kUWE5kAOeLKhACQCB6IYFImHFImHFImXEA2YlzNijAjAgEgGhsAF7UGtc4QQDVZnah7EAIBIBwdAgOZOB4fARGsGm2eL4G2CUAjABWt+UEAzJV2oewYQAENqTbPBVfBYCMAFa3f3CCAarM7UPYgAiDbPALyZfgAUENxQxPbPO1UIyoACtP/0wcwBKDbPC+uUyCw8mISsQKkJbNTHLmwJYEA4aojoCi8sPJpggGGoPgBBZcCERACPj4wjo0REB/bPEDXePRDEL0F4lQWW1Rz51YQU9zbPFRxClR6vCQlKCYAIO1E0NMf0wfTB9M/9AT0BNEAXgGOGjDSAAHyo9MH0wdQA9cBIPkBBfkBFbrypFAD4GwhIddKqgIi10m68qtwVCATAAwByMv/ywcE1ts87VT4D3AlblOJvrGYEG4QLVDHXwePGzBUJANQTds8UFWgRlAQSRA6SwlTuds8UFQWf+L4AAeDJaGOLCaAQPSWb6UglDBTA7neII4WODk5CNIAAZfTBzAW8AcFkTDifwgHBZJsMeKz5jAGKicoKQBgcI4pA9CDCNcY0wf0BDBTFnj0Dm+h8qXXC/9URUT5EPKmrlIgsVIDvRShI27mbCIyAH5SML6OIF8D+ACTItdKmALTB9QC+wAC6DJwyMoAQBSAQPRDAvAHjhdxyMsAFMsHEssHWM8BWM8WQBOAQPRDAeIBII6KEEUQNEMA2zztVJJfBuIqABzIyx/LB8sHyz/0APQAyQ==");class k6{constructor(t,r,n,o,i){this.provider=null,this.owners=Rn.Dictionary.empty(),this.workchain=r,this.walletId=n,this.k=o;for(let a=0;a0;){const i=n.readTuple(),a=i.readNumber(),s=i.readNumber();i.pop();const l=i.readNumber();o.push({id:a,unfreezeAt:s,stakeHeld:l})}return o}async getPastElections(t){const r=await t.get("past_elections",[]),n=new xi.TupleReader(r.stack.readLispList()),o=[];for(;n.remaining>0;){const i=n.readTuple(),a=i.readNumber(),s=i.readNumber(),l=i.readNumber();i.pop();const u=i.readCell(),c=i.readBigNumber(),h=i.readBigNumber();let d=new Map;const p=u.beginParse().loadDictDirect(xi.Dictionary.Keys.Buffer(32),Uae);for(const[v,b]of p)d.set(BigInt("0x"+v.toString("hex")).toString(10),{address:b.address,weight:b.weight,stake:b.stake});o.push({id:a,unfreezeAt:s,stakeHeld:l,totalStake:c,bonuses:h,frozen:d})}return o}async getElectionEntities(t){const r=await t.getState();if(r.state.type!=="active")throw Error("Unexpected error");const o=xi.Cell.fromBoc(r.state.data)[0].beginParse();if(!o.loadBit())return null;const i=o.loadRef().beginParse(),a=i.loadUint(32),s=i.loadUint(32),l=i.loadCoins(),u=i.loadCoins(),c=i.loadDict(xi.Dictionary.Keys.Buffer(32),jae);let h=[];if(c)for(const[d,p]of c)h.push({pubkey:d,stake:p.stake,address:p.address,adnl:p.adnl});return{minStake:l,allStakes:u,endElectionsTime:s,startWorkTime:a,entities:h}}async getActiveElectionId(t){const n=(await t.get("active_election_id",[])).stack.readNumber();return n>0?n:null}async getComplaints(t,r){const n=new xi.TupleBuilder;n.writeNumber(r);const o=await t.get("list_complaints",n.build());if(o.stack.peek().type==="null")return[];const i=new xi.TupleReader(o.stack.readLispList()),a=[];for(;i.remaining>0;){const s=i.readTuple(),l=s.readBigNumber(),u=s.readTuple(),c=u.readTuple(),h=Oe.Buffer.from(c.readBigNumber().toString(16),"hex");c.readCell();const d=c.readNumber(),p=c.readNumber(),v=new xi.Address(-1,Oe.Buffer.from(c.readBigNumber().toString(16),"hex")),b=c.readBigNumber(),S=c.readBigNumber(),x=c.readBigNumber(),k=[],M=new xi.TupleReader(u.readLispList());for(;M.remaining>0;)k.push(M.readNumber());const P=u.readBigNumber(),L=u.readBigNumber();a.push({id:l,publicKey:h,createdAt:d,severity:p,paid:b,suggestedFine:S,suggestedFinePart:x,rewardAddress:v,votes:k,remainingWeight:L,vsetId:P})}return a}}lm.ElectorContract=A6;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.parseFullConfig=Pt.loadConfigParamsAsSlice=Pt.loadConfigParamById=Pt.parseVotingSetup=Pt.parseProposalSetup=Pt.configParse29=Pt.configParse28=Pt.configParseMsgPrices=Pt.configParseGasLimitsPrices=Pt.configParseBridge=Pt.configParseValidatorSet=Pt.configParse12=Pt.configParseWorkchainDescriptor=Pt.configParse40=Pt.configParse8=Pt.configParse18=Pt.configParse17=Pt.configParse16=Pt.configParse15=Pt.configParse13=Pt.configParse5=Pt.configParseMasterAddressRequired=Pt.parseBridge=Pt.parseValidatorSet=Pt.configParseMasterAddress=void 0;const Qn=qt;function qf(e){return e?new Qn.Address(-1,e.loadBuffer(32)):null}Pt.configParseMasterAddress=qf;function aE(e){if(e.loadUint(32)!==2390828938)throw Error("Invalid config");return e.loadBuffer(32)}const sE={serialize(e,t){throw Error("not implemented")},parse(e){const t=e.loadUint(8);if(t===83)return{publicKey:aE(e),weight:e.loadUintBig(64),adnlAddress:null};if(t===115)return{publicKey:aE(e),weight:e.loadUintBig(64),adnlAddress:e.loadBuffer(32)};throw Error("Invalid config")}};function cO(e){const t=e.loadUint(8);if(t===17){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(16),i=e.loadUint(16),a=e.loadDictDirect(Qn.Dictionary.Keys.Uint(16),sE);return{timeSince:r,timeUntil:n,total:o,main:i,totalWeight:null,list:a}}else if(t===18){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(16),i=e.loadUint(16),a=e.loadUintBig(64),s=e.loadDict(Qn.Dictionary.Keys.Uint(16),sE);return{timeSince:r,timeUntil:n,total:o,main:i,totalWeight:a,list:s}}}Pt.parseValidatorSet=cO;function fO(e){const t=new Qn.Address(-1,e.loadBuffer(32)),r=new Qn.Address(-1,e.loadBuffer(32)),n=e.loadDict(Qn.Dictionary.Keys.Buffer(32),Qn.Dictionary.Values.Buffer(32)),o=new Map;for(const[a,s]of n)o.set(new Qn.Address(-1,a).toString(),s);const i=e.loadBuffer(32);return{bridgeAddress:t,oracleMultisigAddress:r,oracles:o,externalChainAddress:i}}Pt.parseBridge=fO;function i3(e){if(!e)throw Error("Invalid config");return qf(e)}Pt.configParseMasterAddressRequired=i3;function dO(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===1){const r=e.loadBit()?new Qn.Address(-1,e.loadBuffer(32)):null,n=e.loadUint(32),o=e.loadUint(32);return{blackholeAddr:r,feeBurnNominator:n,feeBurnDenominator:o}}throw new Error("Invalid config")}Pt.configParse5=dO;function Fae(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===26){const r=e.loadCoins(),n=e.loadCoins(),o=e.loadCoins();return{deposit:r,bitPrice:n,cellPrice:o}}throw new Error("Invalid config")}Pt.configParse13=Fae;function hO(e){if(!e)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32);return{validatorsElectedFor:t,electorsStartBefore:r,electorsEndBefore:n,stakeHeldFor:o}}Pt.configParse15=hO;function pO(e){if(!e)throw Error("Invalid config");const t=e.loadUint(16),r=e.loadUint(16),n=e.loadUint(16);return{maxValidators:t,maxMainValidators:r,minValidators:n}}Pt.configParse16=pO;function gO(e){if(!e)throw Error("Invalid config");const t=e.loadCoins(),r=e.loadCoins(),n=e.loadCoins(),o=e.loadUint(32);return{minStake:t,maxStake:r,minTotalStake:n,maxStakeFactor:o}}Pt.configParse17=gO;const zae={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==204)throw Error("Invalid config");const r=e.loadUint(32),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64);return{utime_since:r,bit_price_ps:n,cell_price_ps:o,mc_bit_price_ps:i,mc_cell_price_ps:a}}};function mO(e){if(!e)throw Error("Invalid config");return e.loadDictDirect(Qn.Dictionary.Keys.Buffer(4),zae).values()}Pt.configParse18=mO;function vO(e){if(!e)return{version:0,capabilities:0n};const t=e.loadUint(32),r=e.loadUintBig(64);return{version:t,capabilities:r}}Pt.configParse8=vO;function yO(e){if(!e)return null;if(e.loadUint(8)!==1)throw Error("Invalid config");const r=e.loadCoins(),n=e.loadCoins(),o=e.loadUint(16),i=e.loadUint(16),a=e.loadUint(16),s=e.loadUint(16),l=e.loadUint(16),u=e.loadUint(16),c=e.loadUint(16),h=e.loadUint(16),d=e.loadUint(16);return{defaultFlatFine:r,defaultProportionaFine:n,severityFlatMult:o,severityProportionalMult:i,unfunishableInterval:a,longInterval:s,longFlatMult:l,longProportionalMult:u,mediumInterval:c,mediumFlatMult:h,mediumProportionalMult:d}}Pt.configParse40=yO;function $ae(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadBit(),a=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),h=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const d=e.loadUint(32),p=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:r,min_split:n,max_split:o,basic:i,active:a,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:h,format:{vmVersion:d,vmMode:p}}}Pt.configParseWorkchainDescriptor=$ae;const qae={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadBit(),a=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),h=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const d=e.loadUint(32),p=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:r,min_split:n,max_split:o,basic:i,active:a,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:h,format:{vmVersion:d,vmMode:p}}}};function bO(e){if(!e)throw Error("Invalid config");const t=e.loadDict(Qn.Dictionary.Keys.Uint(32),qae);if(t)return t;throw Error("No workchains exist")}Pt.configParse12=bO;function Bs(e){return e?cO(e):null}Pt.configParseValidatorSet=Bs;function k0(e){return e?fO(e):null}Pt.configParseBridge=k0;function Wae(e){const t=e.loadUint(8);if(t===222){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64),s=e.loadUintBig(64),l=e.loadUintBig(64);return{gasPrice:r,gasLimit:n,specialGasLimit:o,gasCredit:i,blockGasLimit:a,freezeDueLimit:s,deleteDueLimit:l}}else if(t===221){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),a=e.loadUintBig(64),s=e.loadUintBig(64);return{gasPrice:r,gasLimit:n,gasCredit:o,blockGasLimit:i,freezeDueLimit:a,deleteDueLimit:s}}else throw Error("Invalid config")}function o3(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===209){const r=e.loadUintBig(64),n=e.loadUintBig(64),o=Wae(e);return{flatLimit:r,flatGasPrice:n,other:o}}else throw Error("Invalid config")}Pt.configParseGasLimitsPrices=o3;function a3(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==234)throw new Error("Invalid msg prices param");return{lumpPrice:e.loadUintBig(64),bitPrice:e.loadUintBig(64),cellPrice:e.loadUintBig(64),ihrPriceFactor:e.loadUint(32),firstFrac:e.loadUint(16),nextFrac:e.loadUint(16)}}Pt.configParseMsgPrices=a3;function wO(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===193){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32);return{masterCatchainLifetime:r,shardCatchainLifetime:n,shardValidatorsLifetime:o,shardValidatorsCount:i}}if(t===194){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(32),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32);return{flags:r,suffleMasterValidators:n,masterCatchainLifetime:o,shardCatchainLifetime:i,shardValidatorsLifetime:a,shardValidatorsCount:s}}throw new Error("Invalid config")}Pt.configParse28=wO;function _O(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===214){const r=e.loadUint(32),n=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{roundCandidates:r,nextCandidateDelay:n,consensusTimeout:o,fastAttempts:i,attemptDuration:a,catchainMaxDeps:s,maxBlockBytes:l,maxColaltedBytes:u}}else if(t===215){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h}}else if(t===216){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32),d=e.loadUint(16);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h,protoVersion:d}}else if(t===217){const r=e.loadUint(7),n=e.loadBit(),o=e.loadUint(8),i=e.loadUint(32),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),h=e.loadUint(32),d=e.loadUint(16),p=e.loadUint(32);return{flags:r,newCatchainIds:n,roundCandidates:o,nextCandidateDelay:i,consensusTimeout:a,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:h,protoVersion:d,catchainMaxBlocksCoeff:p}}throw new Error("Invalid config")}Pt.configParse29=_O;function s3(e){if(e.loadUint(8)!==54)throw new Error("Invalid config");const r=e.loadUint(8),n=e.loadUint(8),o=e.loadUint(8),i=e.loadUint(8),a=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{minTotalRounds:r,maxTotalRounds:n,minWins:o,maxLoses:i,minStoreSec:a,maxStoreSec:s,bitPrice:l,cellPrice:u}}Pt.parseProposalSetup=s3;function xO(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==145)throw new Error("Invalid config");const r=s3(e.loadRef().beginParse()),n=s3(e.loadRef().beginParse());return{normalParams:r,criticalParams:n}}Pt.parseVotingSetup=xO;function SO(e){return Qn.Cell.fromBase64(e).beginParse().loadDictDirect(Qn.Dictionary.Keys.Int(32),Qn.Dictionary.Values.Cell())}function Vae(e,t){return SO(e).get(t)}Pt.loadConfigParamById=Vae;function Hae(e){const t=SO(e),r=new Map;for(const[n,o]of t)r.set(n,o.beginParse());return r}Pt.loadConfigParamsAsSlice=Hae;function Kae(e){return{configAddress:i3(e.get(0)),electorAddress:i3(e.get(1)),minterAddress:qf(e.get(2)),feeCollectorAddress:qf(e.get(3)),dnsRootAddress:qf(e.get(4)),burningConfig:dO(e.get(5)),globalVersion:vO(e.get(8)),workchains:bO(e.get(12)),voting:xO(e.get(11)),validators:{...hO(e.get(15)),...pO(e.get(16)),...gO(e.get(17))},storagePrices:mO(e.get(18)),gasPrices:{masterchain:o3(e.get(20)),workchain:o3(e.get(21))},msgPrices:{masterchain:a3(e.get(24)),workchain:a3(e.get(25))},validatorSets:{prevValidators:Bs(e.get(32)),prevTempValidators:Bs(e.get(33)),currentValidators:Bs(e.get(34)),currentTempValidators:Bs(e.get(35)),nextValidators:Bs(e.get(36)),nextTempValidators:Bs(e.get(37))},validatorsPunish:yO(e.get(40)),bridges:{ethereum:k0(e.get(71)),binance:k0(e.get(72)),polygon:k0(e.get(73))},catchain:wO(e.get(28)),consensus:_O(e.get(29))}}Pt.parseFullConfig=Kae;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});ki.computeMessageForwardFees=ki.computeExternalMessageFees=ki.computeGasPrices=ki.computeFwdFees=ki.computeStorageFees=void 0;const Z2=qt;function Zae(e){const{lastPaid:t,now:r,storagePrices:n,storageStat:o,special:i,masterchain:a}=e;if(r<=t||n.length===0||r>16n)}ki.computeGasPrices=Gae;function Yae(e,t){let r=t1(t);return r.bits-=t.bits.length,r.cells-=1,M6(e,BigInt(r.cells),BigInt(r.bits))}ki.computeExternalMessageFees=Yae;function Qae(e,t){let r=(0,Z2.loadMessageRelaxed)(t.beginParse()),n={bits:0,cells:0};if(r.init){const l=new Z2.Cell().asBuilder();(0,Z2.storeStateInit)(r.init)(l);const u=l.endCell();let c=t1(u);c.bits-=u.bits.length,c.cells-=1,n.bits+=c.bits,n.cells+=c.cells}let o=t1(r.body);o.bits-=r.body.bits.length,o.cells-=1,n.bits+=o.bits,n.cells+=o.cells;let i=M6(e,BigInt(n.cells),BigInt(n.bits)),a=i*BigInt(e.firstFrac)>>16n,s=i-a;return{fees:a,remaining:s}}ki.computeMessageForwardFees=Qae;function t1(e){let t=e.bits.length,r=1;for(let n of e.refs){let o=t1(n);r+=o.cells,t+=o.bits}return{bits:t,cells:r}}function CO(e){let t=e%65536n,r=e>>16n;return t!==0n&&(r+=1n),r}(function(e){var t=Ke&&Ke.__createBinding||(Object.create?function(K,Z,ue,U){U===void 0&&(U=ue);var _=Object.getOwnPropertyDescriptor(Z,ue);(!_||("get"in _?!Z.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return Z[ue]}}),Object.defineProperty(K,U,_)}:function(K,Z,ue,U){U===void 0&&(U=ue),K[U]=Z[ue]}),r=Ke&&Ke.__exportStar||function(K,Z){for(var ue in K)ue!=="default"&&!Object.prototype.hasOwnProperty.call(Z,ue)&&t(Z,K,ue)};Object.defineProperty(e,"__esModule",{value:!0}),e.computeStorageFees=e.computeMessageForwardFees=e.computeGasPrices=e.computeFwdFees=e.computeExternalMessageFees=e.loadConfigParamsAsSlice=e.loadConfigParamById=e.parseFullConfig=e.parseVotingSetup=e.parseValidatorSet=e.parseProposalSetup=e.parseBridge=e.configParseWorkchainDescriptor=e.configParseValidatorSet=e.configParseMsgPrices=e.configParseMasterAddressRequired=e.configParseMasterAddress=e.configParseGasLimitsPrices=e.configParseBridge=e.configParse40=e.configParse29=e.configParse28=e.configParse18=e.configParse17=e.configParse16=e.configParse15=e.configParse13=e.configParse12=e.configParse8=e.configParse5=e.ElectorContract=e.MultisigWallet=e.MultisigOrderBuilder=e.MultisigOrder=e.JettonWallet=e.JettonMaster=e.WalletContractV5R1=e.WalletContractV5Beta=e.WalletContractV4=e.WalletContractV3R2=e.WalletContractV3R1=e.WalletContractV2R2=e.WalletContractV2R1=e.WalletContractV1R3=e.WalletContractV1R2=e.WalletContractV1R1=e.TonClient4=e.TonClient=e.HttpApi=void 0,r(qt,e);var n=mh;Object.defineProperty(e,"HttpApi",{enumerable:!0,get:function(){return n.HttpApi}});var o=Hg;Object.defineProperty(e,"TonClient",{enumerable:!0,get:function(){return o.TonClient}});var i=Kg;Object.defineProperty(e,"TonClient4",{enumerable:!0,get:function(){return i.TonClient4}});var a=Gg;Object.defineProperty(e,"WalletContractV1R1",{enumerable:!0,get:function(){return a.WalletContractV1R1}});var s=Qg;Object.defineProperty(e,"WalletContractV1R2",{enumerable:!0,get:function(){return s.WalletContractV1R2}});var l=Xg;Object.defineProperty(e,"WalletContractV1R3",{enumerable:!0,get:function(){return l.WalletContractV1R3}});var u=Jg;Object.defineProperty(e,"WalletContractV2R1",{enumerable:!0,get:function(){return u.WalletContractV2R1}});var c=em;Object.defineProperty(e,"WalletContractV2R2",{enumerable:!0,get:function(){return c.WalletContractV2R2}});var h=tm;Object.defineProperty(e,"WalletContractV3R1",{enumerable:!0,get:function(){return h.WalletContractV3R1}});var d=rm;Object.defineProperty(e,"WalletContractV3R2",{enumerable:!0,get:function(){return d.WalletContractV3R2}});var p=nm;Object.defineProperty(e,"WalletContractV4",{enumerable:!0,get:function(){return p.WalletContractV4}});var v=lO;Object.defineProperty(e,"WalletContractV5Beta",{enumerable:!0,get:function(){return v.WalletContractV5Beta}});var b=uO;Object.defineProperty(e,"WalletContractV5R1",{enumerable:!0,get:function(){return b.WalletContractV5R1}});var S=im;Object.defineProperty(e,"JettonMaster",{enumerable:!0,get:function(){return S.JettonMaster}});var x=om;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return x.JettonWallet}});var k=yh;Object.defineProperty(e,"MultisigOrder",{enumerable:!0,get:function(){return k.MultisigOrder}});var M=am;Object.defineProperty(e,"MultisigOrderBuilder",{enumerable:!0,get:function(){return M.MultisigOrderBuilder}});var P=sm;Object.defineProperty(e,"MultisigWallet",{enumerable:!0,get:function(){return P.MultisigWallet}});var L=lm;Object.defineProperty(e,"ElectorContract",{enumerable:!0,get:function(){return L.ElectorContract}});var j=Pt;Object.defineProperty(e,"configParse5",{enumerable:!0,get:function(){return j.configParse5}}),Object.defineProperty(e,"configParse8",{enumerable:!0,get:function(){return j.configParse8}}),Object.defineProperty(e,"configParse12",{enumerable:!0,get:function(){return j.configParse12}}),Object.defineProperty(e,"configParse13",{enumerable:!0,get:function(){return j.configParse13}}),Object.defineProperty(e,"configParse15",{enumerable:!0,get:function(){return j.configParse15}}),Object.defineProperty(e,"configParse16",{enumerable:!0,get:function(){return j.configParse16}}),Object.defineProperty(e,"configParse17",{enumerable:!0,get:function(){return j.configParse17}}),Object.defineProperty(e,"configParse18",{enumerable:!0,get:function(){return j.configParse18}}),Object.defineProperty(e,"configParse28",{enumerable:!0,get:function(){return j.configParse28}}),Object.defineProperty(e,"configParse29",{enumerable:!0,get:function(){return j.configParse29}}),Object.defineProperty(e,"configParse40",{enumerable:!0,get:function(){return j.configParse40}}),Object.defineProperty(e,"configParseBridge",{enumerable:!0,get:function(){return j.configParseBridge}}),Object.defineProperty(e,"configParseGasLimitsPrices",{enumerable:!0,get:function(){return j.configParseGasLimitsPrices}}),Object.defineProperty(e,"configParseMasterAddress",{enumerable:!0,get:function(){return j.configParseMasterAddress}}),Object.defineProperty(e,"configParseMasterAddressRequired",{enumerable:!0,get:function(){return j.configParseMasterAddressRequired}}),Object.defineProperty(e,"configParseMsgPrices",{enumerable:!0,get:function(){return j.configParseMsgPrices}}),Object.defineProperty(e,"configParseValidatorSet",{enumerable:!0,get:function(){return j.configParseValidatorSet}}),Object.defineProperty(e,"configParseWorkchainDescriptor",{enumerable:!0,get:function(){return j.configParseWorkchainDescriptor}}),Object.defineProperty(e,"parseBridge",{enumerable:!0,get:function(){return j.parseBridge}}),Object.defineProperty(e,"parseProposalSetup",{enumerable:!0,get:function(){return j.parseProposalSetup}}),Object.defineProperty(e,"parseValidatorSet",{enumerable:!0,get:function(){return j.parseValidatorSet}}),Object.defineProperty(e,"parseVotingSetup",{enumerable:!0,get:function(){return j.parseVotingSetup}}),Object.defineProperty(e,"parseFullConfig",{enumerable:!0,get:function(){return j.parseFullConfig}}),Object.defineProperty(e,"loadConfigParamById",{enumerable:!0,get:function(){return j.loadConfigParamById}}),Object.defineProperty(e,"loadConfigParamsAsSlice",{enumerable:!0,get:function(){return j.loadConfigParamsAsSlice}});var V=ki;Object.defineProperty(e,"computeExternalMessageFees",{enumerable:!0,get:function(){return V.computeExternalMessageFees}}),Object.defineProperty(e,"computeFwdFees",{enumerable:!0,get:function(){return V.computeFwdFees}}),Object.defineProperty(e,"computeGasPrices",{enumerable:!0,get:function(){return V.computeGasPrices}}),Object.defineProperty(e,"computeMessageForwardFees",{enumerable:!0,get:function(){return V.computeMessageForwardFees}}),Object.defineProperty(e,"computeStorageFees",{enumerable:!0,get:function(){return V.computeStorageFees}})})(ka);const G2={recordTime:40915,distributePrize:63655,withdrawFees:3243};class Mu{constructor(t,r){this.address=t,this.init=r}static createFromAddress(t){return new Mu(t)}static createFromConfig(t,r,n=0){const o=Mu.createDataCell(t),i={code:r,data:o};return new Mu(qt.contractAddress(n,i),i)}static createDataCell(t){return qt.beginCell().storeAddress(t).storeUint(0,64).storeUint(0,120).storeUint(0,32).storeUint(0,64).storeAddress(qt.Address.parse("0:0000000000000000000000000000000000000000000000000000000000000000")).storeDict(null).endCell()}async sendDeploy(t,r,n){await t.internal(r,{value:n,sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(68,32).endCell()})}async sendRecordTime(t,r,n){await t.internal(r,{value:n.value??qt.toNano("1.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.recordTime,32).storeUint(n.time,64).endCell()})}async sendDistributePrize(t,r,n){await t.internal(r,{value:n.value??qt.toNano("0.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.distributePrize,32).storeUint(n.tournamentNumber,32).endCell()})}async sendWithdrawFees(t,r,n){await t.internal(r,{value:n.value??qt.toNano("0.1"),sendMode:qt.SendMode.PAY_GAS_SEPARATELY,body:qt.beginCell().storeUint(G2.withdrawFees,32).endCell()})}async getInfo(t){const r=await t.get("get_info",[]);return{bestTime:r.stack.readNumber(),totalFees:r.stack.readBigNumber(),currentTournamentNumber:r.stack.readNumber(),bestPlayer:r.stack.readAddress()}}async getPlayerEntry(t,r){const n=await t.get("get_player_entry",[{type:"slice",cell:qt.beginCell().storeAddress(r).endCell()}]),o=n.stack.readNumber(),i=n.stack.readNumber(),a=n.stack.readNumber();return o===0&&i===0&&a===0?null:{time:o,timestamp:i,tournamentNumber:a}}}async function Xae(e,t,r){var n,o;try{console.log("Starting interaction with Race contract...");const i=await e6({network:"testnet"}),a=new ka.TonClient({endpoint:i}),s=r.wallet;if(!s)throw new Error("No wallet connected");const l=(n=s.account)==null?void 0:n.publicKey;if(!l)throw new Error("No public key found");const u=Oe.Buffer.from(l,"hex"),c=ka.WalletContractV4.create({publicKey:u,workchain:0}),h=a.open(c),d={send:async P=>{var j;const L={validUntil:Math.floor(Date.now()/1e3)+60,messages:[{address:P.to.toString(),amount:P.value.toString(),payload:(j=P.body)==null?void 0:j.toBoc().toString("base64")}]};await r.sendTransaction(L)}},p=await h.getSeqno();console.log("Seqno: ",p);const v=ka.Address.parse("kQC_8HjVICJndonC88WPdsekT072YY0vvcj3I2oXgmEcDWT1"),b=Mu.createFromAddress(v);console.log(`Race contract address: ${v.toString()}`);const S=a.provider(v),x=ka.Address.parse(e);await b.sendRecordTime(S,d,{time:Math.floor(t*1e3),value:ka.toNano("1.1")});let k=p;for(;k===p;)console.log("Waiting for transaction to confirm..."),await Jae(1500),k=await h.getSeqno();console.log("Transaction confirmed!");const M=await b.getInfo(S);console.log("Best Time:",M.bestTime),console.log("Total Fees:",M.totalFees.toString()),console.log("Current Tournament Number:",M.currentTournamentNumber),console.log("Best Player Address:",M.bestPlayer.toString())}catch(i){ig.isAxiosError(i)?(console.error("Axios error:",i.message),console.error("Response data:",(o=i.response)==null?void 0:o.data)):console.error("Unexpected error:",i)}}function Jae(e){return new Promise(t=>setTimeout(t,e))}async function ese(e,t){var r;try{const n=Mu.createFromAddress(t),o=t.toString();console.log(`Race contract address: ${o}`);const i=e.provider(t),a=await n.getInfo(i),s=a.bestTime/1e3,l=` + Total Fees: ${a.totalFees.toString()} nanoTON Current Tournament Number: ${a.currentTournamentNumber} Best Player Address: ${a.bestPlayer.toString()} @@ -2788,7 +2788,7 @@ Values: Race contract address: ${o} ${l.trim()} `.trim())}catch(n){if(ig.isAxiosError(n)){const o=`Axios error: ${n.message}`,i=`Response data: ${(r=n.response)==null?void 0:r.data}`;console.error(o),console.error(i),alert(`${o} -${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const wse=dn.div` +${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const tse=dn.div` font-size: 10px; position: absolute; top: 0; @@ -2800,7 +2800,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w display: flex; justify-content: center; align-items: center; -`,_se=dn.div` +`,rse=dn.div` border: 1px solid #ddd; color: white; background-color: black; @@ -2809,7 +2809,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w width: 95%; max-width: 600px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); -`,xse=dn.p` +`,nse=dn.p` text-align: center; margin-bottom: 10px; font-size: 1.5em; @@ -2819,13 +2819,13 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w align-items: center; margin-top: 5px; background-color: black; -`,Sse=dn.ul` +`,ise=dn.ul` list-style-type: none; padding: 0; max-height: 300px; overflow-y: auto; background-color: black; -`,Cse=dn.li` +`,ose=dn.li` font-size: 13px; color: white; margin: 5px 0; @@ -2845,7 +2845,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w font-size: 10px; margin-top: 10px; cursor: pointer; -`,Ese=dn.div` +`,ase=dn.div` position: absolute; top: 0; left: 0; @@ -2856,7 +2856,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w display: flex; justify-content: center; align-items: center; -`,kse=dn.div` +`,sse=dn.div` color: white; background-color: black; padding: 30px; @@ -2865,7 +2865,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w max-width: 400px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); text-align: center; -`,kO=({elapsedTime:e,onClose:t,userId:r,firstName:n,userName:o,lastName:i})=>{const a=GI(!0),[s,l]=dt.useState([]),[u,c]=dt.useState(0),[h,d]=dt.useState(!1),p=3,[v,b]=a5();dt.useEffect(()=>{(async()=>{const _=await vte();l(_)})()},[]);const S=()=>{d(!0)},x=async()=>{try{if(!r&&!a){alert("Please connect your wallet.");return}const U={address:a||"",time:e,playerId:r||a||"",userName:o||""},_=s.find(y=>y.address===a||y.playerId===(r||a));if(_)if(e<_.time){const y=s.map(f=>f.address===a||f.playerId===(r||a)?U:f);l(y),await fC(y),console.log(`Wallet Address: ${a}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`User First Name: ${n}`)}else{const y=(e-_.time).toFixed(3);alert(`You were slower by ${y} seconds than your best.`)}else{const y=[...s,U];l(y),await fC(y),console.log(`Wallet Address: ${a}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`User First Name: ${n}`)}d(!1)}catch(U){console.error("Error saving score:",U)}},k=U=>{const _=U.reduce((f,g)=>((!f[g.address||g.playerId]||f[g.address||g.playerId].time>g.time)&&(f[g.address||g.playerId]=g),f),{});return Object.values(_).sort((f,g)=>f.time-g.time)},M=(U,_)=>_||(U.length<=9?U:`${U.slice(0,5)}...${U.slice(-4)}`),P=()=>{c(U=>U+1)},L=()=>{c(U=>Math.max(U-1,0))},j=()=>{d(!1)},V=k(s),K=V.slice(u*p,(u+1)*p),Z=async()=>{try{if(!a){alert("Please connect your wallet.");return}console.log("OnChain Race clicked"),console.log(`Wallet Address: ${a}`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),await vse(a,e,v)}catch(U){console.error("Error during OnChain Race:",U)}},ue=async()=>{try{if(!a){alert("Please connect your wallet.");return}const U=await e6({network:"testnet"}),_=new ka.TonClient({endpoint:U}),y=ka.Address.parse("kQC_8HjVICJndonC88WPdsekT072YY0vvcj3I2oXgmEcDWT1");await bse(_,y)}catch(U){console.error("Error during OnChain Race Data retrieval:",U)}};return Dr(wse,{children:[Dr(_se,{children:[e>0&&Dr(A0,{children:[Dr(xse,{style:{marginBottom:"20px"},children:["Your current time:",Xe("br",{}),e.toFixed(3)," seconds"]}),Xe(n0,{children:Xe(Wi,{onClick:S,style:{marginBottom:"10px"},children:"Save Score"})})]}),Xe("h1",{style:{color:"white"},children:"Top"}),Xe(n0,{children:u>0&&Xe(i0,{onClick:L,children:"Previous"})}),Xe(Sse,{children:K.map((U,_)=>Dr(Cse,{children:[u*p+_+1,". ",M(U.address,U.userName)," - ",U.time.toFixed(3)," seconds"]},_))}),Xe(n0,{children:(u+1)*p{const[t,r]=dt.useState(!1),[n,o]=dt.useState(!1),[i,a]=dt.useState(0),[s,l]=dt.useState(!1),u=()=>{r(!0),o(!1)},c=()=>{o(!0),r(!1)},h=()=>{r(!1),o(!1)};return dt.useEffect(()=>{let d,p;const v=()=>{d=setInterval(()=>{a(b=>b===8?(l(!0),clearInterval(d),p=setTimeout(()=>{l(!1),a(0),v()},800),b):b+1)},300)};return t&&v(),()=>{clearInterval(d),clearTimeout(p)}},[t]),Dr("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999,fontSize:"0.8rem"},children:[Dr("div",{style:{backgroundColor:"black",padding:"20px",borderRadius:"10px",maxWidth:"80%",textAlign:"center",fontSize:"0.7rem"},children:[Dr("h1",{style:{textShadow:"5px 5px rgba(255, 255, 255, 0.5)",fontSize:"1.2rem",padding:"15px"},children:["Tap",Xe("br",{}),"Race",Xe("br",{}),"Sprint"]}),Xe("br",{}),Dr("div",{style:{display:"flex",flexDirection:"column",gap:"10px",alignItems:"center"},children:[Xe(Wi,{onClick:u,children:"Instructions"}),Xe("br",{}),Xe(Wi,{onClick:c,children:"Leaderboard"}),Xe("br",{}),Xe(Wi,{onClick:e,children:"Start Game"}),Xe("br",{})]}),t&&Xe("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:Dr("div",{style:{backgroundColor:"black",padding:"20px",borderRadius:"10px",maxWidth:"80%",textAlign:"center",fontSize:"0.7rem"},children:[Xe("h2",{style:{fontSize:"1.0rem"},children:"How to play:"}),Dr("ol",{style:{fontSize:"0.6rem"},children:[Xe("li",{children:"Click on the car image to move forward."}),Xe("br",{}),Xe("li",{children:"Every 10 clicks will reveal the gear that disables clicking on the car."}),Xe("br",{}),Xe("li",{children:"Click on the gear image to activate further car clicks."}),Xe("br",{}),Xe("li",{children:"Your goal is to reach 69 clicks as fast as possible!"}),Xe("br",{})]}),Dr("div",{className:"animated-images",style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[Xe("div",{style:{height:"100px",position:"relative"},children:s&&Xe("img",{src:MO,className:"gear-animation",alt:"gear",style:{height:"55px",position:"absolute",top:0,left:-25,right:100,bottom:0,margin:"auto",animation:"appear-disappear 0.8s"}})}),Xe("img",{src:AO,className:"bryka-animation",alt:"bryka",style:{height:"100px",animation:s?"none":"clicking 0.3s infinite"}})]}),Xe(Wi,{onClick:h,children:"Close"})]})}),n&&Xe(kO,{elapsedTime:0,onClose:h,userId:null,firstName:"",userName:"",lastName:""})]}),Xe("style",{children:` +`,EO=({elapsedTime:e,onClose:t,userId:r,firstName:n,userName:o,lastName:i})=>{const a=YI(!0),[s,l]=dt.useState([]),[u,c]=dt.useState(0),[h,d]=dt.useState(!1),p=3,[v,b]=o5();dt.useEffect(()=>{(async()=>{const _=await Xee();l(_)})()},[]);const S=()=>{d(!0)},x=async()=>{try{if(!r&&!a){alert("Please connect your wallet.");return}const U={address:a||"",time:e,playerId:r||a||"",userName:o||""},_=s.find(y=>y.address===a||y.playerId===(r||a));if(_)if(e<_.time){const y=s.map(f=>f.address===a||f.playerId===(r||a)?U:f);l(y),await dC(y),console.log(`Wallet Address: ${a}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`User First Name: ${n}`)}else{const y=(e-_.time).toFixed(3);alert(`You were slower by ${y} seconds than your best.`)}else{const y=[...s,U];l(y),await dC(y),console.log(`Wallet Address: ${a}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`User First Name: ${n}`)}d(!1)}catch(U){console.error("Error saving score:",U)}},k=U=>{const _=U.reduce((f,g)=>((!f[g.address||g.playerId]||f[g.address||g.playerId].time>g.time)&&(f[g.address||g.playerId]=g),f),{});return Object.values(_).sort((f,g)=>f.time-g.time)},M=(U,_)=>_||(U.length<=9?U:`${U.slice(0,5)}...${U.slice(-4)}`),P=()=>{c(U=>U+1)},L=()=>{c(U=>Math.max(U-1,0))},j=()=>{d(!1)},V=k(s),K=V.slice(u*p,(u+1)*p),Z=async()=>{try{if(!a){alert("Please connect your wallet.");return}console.log("OnChain Race clicked"),console.log(`Wallet Address: ${a}`),console.log(`User ID: ${r}`),console.log(`User Name: ${o}`),console.log(`Elapsed Time: ${e.toFixed(3)} seconds`),await Xae(a,e,v)}catch(U){console.error("Error during OnChain Race:",U)}},ue=async()=>{try{if(!a){alert("Please connect your wallet.");return}const U=await e6({network:"testnet"}),_=new ka.TonClient({endpoint:U}),y=ka.Address.parse("kQC_8HjVICJndonC88WPdsekT072YY0vvcj3I2oXgmEcDWT1");await ese(_,y)}catch(U){console.error("Error during OnChain Race Data retrieval:",U)}};return Dr(tse,{children:[Dr(rse,{children:[e>0&&Dr(A0,{children:[Dr(nse,{style:{marginBottom:"20px"},children:["Your current time:",Xe("br",{}),e.toFixed(3)," seconds"]}),Xe(n0,{children:Xe(Wi,{onClick:S,style:{marginBottom:"10px"},children:"Save Score"})})]}),Xe("h1",{style:{color:"white"},children:"Top"}),Xe(n0,{children:u>0&&Xe(i0,{onClick:L,children:"Previous"})}),Xe(ise,{children:K.map((U,_)=>Dr(ose,{children:[u*p+_+1,". ",M(U.address,U.userName)," - ",U.time.toFixed(3)," seconds"]},_))}),Xe(n0,{children:(u+1)*p{const[t,r]=dt.useState(!1),[n,o]=dt.useState(!1),[i,a]=dt.useState(0),[s,l]=dt.useState(!1),u=()=>{r(!0),o(!1)},c=()=>{o(!0),r(!1)},h=()=>{r(!1),o(!1)};return dt.useEffect(()=>{let d,p;const v=()=>{d=setInterval(()=>{a(b=>b===8?(l(!0),clearInterval(d),p=setTimeout(()=>{l(!1),a(0),v()},800),b):b+1)},300)};return t&&v(),()=>{clearInterval(d),clearTimeout(p)}},[t]),Dr("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999,fontSize:"0.8rem"},children:[Dr("div",{style:{backgroundColor:"black",padding:"20px",borderRadius:"10px",maxWidth:"80%",textAlign:"center",fontSize:"0.7rem"},children:[Dr("h1",{style:{textShadow:"5px 5px rgba(255, 255, 255, 0.5)",fontSize:"1.2rem",padding:"15px"},children:["Tap",Xe("br",{}),"Race",Xe("br",{}),"Sprint"]}),Xe("br",{}),Dr("div",{style:{display:"flex",flexDirection:"column",gap:"10px",alignItems:"center"},children:[Xe(Wi,{onClick:u,children:"Instructions"}),Xe("br",{}),Xe(Wi,{onClick:c,children:"Leaderboard"}),Xe("br",{}),Xe(Wi,{onClick:e,children:"Start Game"}),Xe("br",{})]}),t&&Xe("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:Dr("div",{style:{backgroundColor:"black",padding:"20px",borderRadius:"10px",maxWidth:"80%",textAlign:"center",fontSize:"0.7rem"},children:[Xe("h2",{style:{fontSize:"1.0rem"},children:"How to play:"}),Dr("ol",{style:{fontSize:"0.6rem"},children:[Xe("li",{children:"Click on the car image to move forward."}),Xe("br",{}),Xe("li",{children:"Every 10 clicks will reveal the gear that disables clicking on the car."}),Xe("br",{}),Xe("li",{children:"Click on the gear image to activate further car clicks."}),Xe("br",{}),Xe("li",{children:"Your goal is to reach 69 clicks as fast as possible!"}),Xe("br",{})]}),Dr("div",{className:"animated-images",style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[Xe("div",{style:{height:"100px",position:"relative"},children:s&&Xe("img",{src:AO,className:"gear-animation",alt:"gear",style:{height:"55px",position:"absolute",top:0,left:-25,right:100,bottom:0,margin:"auto",animation:"appear-disappear 0.8s"}})}),Xe("img",{src:kO,className:"bryka-animation",alt:"bryka",style:{height:"100px",animation:s?"none":"clicking 0.3s infinite"}})]}),Xe(Wi,{onClick:h,children:"Close"})]})}),n&&Xe(EO,{elapsedTime:0,onClose:h,userId:null,firstName:"",userName:"",lastName:""})]}),Xe("style",{children:` @keyframes clicking { 0%, 100% { transform: scale(1); @@ -2893,10 +2893,10 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w transform: scale(0.95); } } - `})]})},Mse="/twa/assets/brykaO-d572d92c.png",Ise=({clickEnabled:e,onClick:t,carAnimation:r,showBrykaO:n,powerLevel:o,opacity:i})=>{const[a,s]=dt.useState(0),[l,u]=dt.useState(0);return dt.useEffect(()=>{o>=8?(s(-5),u(2)):o>=7?(s(5),u(-2)):o>=4?(s(3),u(2)):o>=2?(s(-3),u(0)):o>=1?(s(2),u(0)):(s(-1),u(0))},[o]),dt.useEffect(()=>{n&&s(c=>c-11)},[n]),Xe("div",{className:r,style:{position:"absolute",bottom:"10%",left:"50%",transform:`translateX(calc(-50% + ${l}px)) translateY(${a}px)`,zIndex:1,cursor:e?"pointer":"default",transition:"transform 0.2s ease-out, opacity 1s",animation:r==="car-move-up"?"moveUp 2s forwards":"none",opacity:i},onClick:t,children:Xe("img",{src:n?Mse:AO,alt:"bryka",style:{width:"125px",height:"auto",userSelect:"none"}})})},sE="/twa/assets/ulica-4944c7c2.png",Tse=({position1:e,position2:t,verticalBlurLevel:r})=>Dr(A0,{children:[Xe("svg",{width:"0",height:"0",children:Xe("filter",{id:"vertical-blur",children:Xe("feGaussianBlur",{in:"SourceGraphic",stdDeviation:`0 ${r}`})})}),Xe("div",{style:{position:"absolute",top:`${e}px`,left:"50%",transform:"translateX(-50%)",zIndex:0},children:Xe("img",{src:sE,alt:"ulica",style:{width:"300px",height:"auto",filter:"url(#vertical-blur)"}})}),Xe("div",{style:{position:"absolute",top:`${t}px`,left:"50%",transform:"translateX(-50%)",zIndex:0},children:Xe("img",{src:sE,alt:"ulica",style:{width:"300px",height:"auto",filter:"url(#vertical-blur)"}})})]}),Bse=({showGear:e,onClick:t})=>e?Xe("div",{style:{position:"absolute",top:"10%",left:"50%",transform:"translateX(-50%)",zIndex:2,cursor:"pointer"},onClick:t,children:Xe("img",{src:MO,alt:"gear",style:{width:"125px",height:"auto"}})}):null,lE=60,IO=-600,Pse=e=>{let r=lE*.01449*e;return Math.min(r,lE)},uE=(e,t,r)=>e>=r?IO:e+t,Rse=.01,Ose=hZ` + `})]})},use="/twa/assets/brykaO-d572d92c.png",cse=({clickEnabled:e,onClick:t,carAnimation:r,showBrykaO:n,powerLevel:o,opacity:i})=>{const[a,s]=dt.useState(0),[l,u]=dt.useState(0);return dt.useEffect(()=>{o>=8?(s(-5),u(2)):o>=7?(s(5),u(-2)):o>=4?(s(3),u(2)):o>=2?(s(-3),u(0)):o>=1?(s(2),u(0)):(s(-1),u(0))},[o]),dt.useEffect(()=>{n&&s(c=>c-11)},[n]),Xe("div",{className:r,style:{position:"absolute",bottom:"10%",left:"50%",transform:`translateX(calc(-50% + ${l}px)) translateY(${a}px)`,zIndex:1,cursor:e?"pointer":"default",transition:"transform 0.2s ease-out, opacity 1s",animation:r==="car-move-up"?"moveUp 2s forwards":"none",opacity:i},onClick:t,children:Xe("img",{src:n?use:kO,alt:"bryka",style:{width:"125px",height:"auto",userSelect:"none"}})})},lE="/twa/assets/ulica-4944c7c2.png",fse=({position1:e,position2:t,verticalBlurLevel:r})=>Dr(A0,{children:[Xe("svg",{width:"0",height:"0",children:Xe("filter",{id:"vertical-blur",children:Xe("feGaussianBlur",{in:"SourceGraphic",stdDeviation:`0 ${r}`})})}),Xe("div",{style:{position:"absolute",top:`${e}px`,left:"50%",transform:"translateX(-50%)",zIndex:0},children:Xe("img",{src:lE,alt:"ulica",style:{width:"300px",height:"auto",filter:"url(#vertical-blur)"}})}),Xe("div",{style:{position:"absolute",top:`${t}px`,left:"50%",transform:"translateX(-50%)",zIndex:0},children:Xe("img",{src:lE,alt:"ulica",style:{width:"300px",height:"auto",filter:"url(#vertical-blur)"}})})]}),dse=({showGear:e,onClick:t})=>e?Xe("div",{style:{position:"absolute",top:"10%",left:"50%",transform:"translateX(-50%)",zIndex:2,cursor:"pointer"},onClick:t,children:Xe("img",{src:AO,alt:"gear",style:{width:"125px",height:"auto"}})}):null,uE=60,MO=-600,hse=e=>{let r=uE*.01449*e;return Math.min(r,uE)},cE=(e,t,r)=>e>=r?MO:e+t,pse=.01,gse=fZ` 0% { background-color: rgba(255, 255, 255, 0.0); } 100% { background-color: rgba(255, 255, 255, 1); } -`,Nse=dn.div` +`,mse=dn.div` font-size: 150px; font-family: 'PublicPixel'; // Replace with your actual font color: black; @@ -2908,8 +2908,8 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w text-shadow: 22px 22px 10px white; background-color: rgba(255, 255, 255, 0.5); // Black background with 50% opacity padding: 1500px 1600px; - animation: ${Ose} 1s infinite; // Add the animation -`,Lse=()=>{const[e,t]=dt.useState(0),[r,n]=dt.useState(IO),[o,i]=dt.useState(0),[a,s]=dt.useState(Rse),[l,u]=dt.useState(!1),[c,h]=dt.useState(""),[d,p]=dt.useState(!1),[v,b]=dt.useState(0),[S,x]=dt.useState(0),[k,M]=dt.useState(0),[P,L]=dt.useState(!0),[j,V]=dt.useState(!1),[K,Z]=dt.useState(""),[ue,U]=dt.useState(!1),[_,y]=dt.useState(0),[f,g]=dt.useState(0),[w,A]=dt.useState(1),[T,E]=dt.useState(0),[C,I]=dt.useState(""),[m,B]=dt.useState(!1),[ne,de]=dt.useState(null),[$,he]=dt.useState(!1),[X,se]=dt.useState(""),[pe,W]=dt.useState(""),q=GI(!0);dt.useEffect(()=>{var D;const N=(D=window.Telegram)==null?void 0:D.WebApp;if(N){N.ready(),N.disableVerticalSwipes(),N.expand(),document.documentElement.addEventListener("touchmove",function(_e){_e.preventDefault()},{passive:!1});const me=new URLSearchParams(N.initData).get("user");if(me){const _e=JSON.parse(me);B(!0),de(_e.id),I(_e.first_name||null),W(_e.last_name||null),se(_e.username||null);const Pe=N.MainButton;Pe.setText("Official Game Chat"),Pe.show(),Pe.onClick(()=>{window.location.href="https://t.me/+ANrGz3PBoA5hYzhk"})}else B(!1),de(null),I(""),se(""),W("")}else B(!1),de(null),I(""),se(""),W("")},[]),dt.useEffect(()=>{m&&ne?(console.log(`User ID: ${ne}`),console.log(`First Name: ${C}`),console.log(`User Name: ${X}`),console.log(`Last Name: ${pe}`),console.log(`Wallet Address: ${q}`)):console.log("Error: user data unavailable!")},[m,ne]),dt.useEffect(()=>{j&&setTimeout(()=>{h("3"),setTimeout(()=>{h("2"),setTimeout(()=>{h("1"),setTimeout(()=>{h(""),p(!0),b(performance.now())},1e3)},1e3)},1e3)},100)},[j]);const ye=()=>{A(0),setTimeout(()=>{var D;L(!1),V(!0);const N=(D=window.Telegram)==null?void 0:D.WebApp;N&&N.MainButton.hide(),setTimeout(()=>{g(1)},1500),setTimeout(()=>{y(1)},500)},750)},xe=()=>{if(!d)return;i(D=>D+1);const N=Pse(o+1);s(N),(o+1)%10===0&&(u(!0),p(!1),M(D=>{const G=D+1;return G<=6?G:D})),o+1===69&&(x(performance.now()),p(!1),Z("car-move-up")),E(D=>(D+1)%7)},Me=()=>{u(!1),p(!0),i(N=>N+1),U(!0),setTimeout(()=>{U(!1)},300)};return dt.useEffect(()=>{const N=setInterval(()=>{t(D=>uE(D,a,window.innerHeight)),n(D=>uE(D,a,window.innerHeight))},11);return()=>clearInterval(N)},[a]),dt.useEffect(()=>{const N=document.createElement("style");return N.textContent=` + animation: ${gse} 1s infinite; // Add the animation +`,vse=()=>{const[e,t]=dt.useState(0),[r,n]=dt.useState(MO),[o,i]=dt.useState(0),[a,s]=dt.useState(pse),[l,u]=dt.useState(!1),[c,h]=dt.useState(""),[d,p]=dt.useState(!1),[v,b]=dt.useState(0),[S,x]=dt.useState(0),[k,M]=dt.useState(0),[P,L]=dt.useState(!0),[j,V]=dt.useState(!1),[K,Z]=dt.useState(""),[ue,U]=dt.useState(!1),[_,y]=dt.useState(0),[f,g]=dt.useState(0),[w,A]=dt.useState(1),[T,E]=dt.useState(0),[C,I]=dt.useState(""),[m,B]=dt.useState(!1),[ne,de]=dt.useState(null),[$,he]=dt.useState(!1),[X,se]=dt.useState(""),[pe,W]=dt.useState(""),q=YI(!0);dt.useEffect(()=>{var D;const N=(D=window.Telegram)==null?void 0:D.WebApp;if(N){N.ready(),N.disableVerticalSwipes(),N.expand(),document.documentElement.addEventListener("touchmove",function(_e){_e.preventDefault()},{passive:!1});const me=new URLSearchParams(N.initData).get("user");if(me){const _e=JSON.parse(me);B(!0),de(_e.id),I(_e.first_name||null),W(_e.last_name||null),se(_e.username||null);const Pe=N.MainButton;Pe.setText("Official Game Chat"),Pe.show(),Pe.onClick(()=>{window.location.href="https://t.me/+ANrGz3PBoA5hYzhk"})}else B(!1),de(null),I(""),se(""),W("")}else B(!1),de(null),I(""),se(""),W("")},[]),dt.useEffect(()=>{m&&ne?(console.log(`User ID: ${ne}`),console.log(`First Name: ${C}`),console.log(`User Name: ${X}`),console.log(`Last Name: ${pe}`),console.log(`Wallet Address: ${q}`)):console.log("Error: user data unavailable!")},[m,ne]),dt.useEffect(()=>{j&&setTimeout(()=>{h("3"),setTimeout(()=>{h("2"),setTimeout(()=>{h("1"),setTimeout(()=>{h(""),p(!0),b(performance.now())},1e3)},1e3)},1e3)},100)},[j]);const ye=()=>{A(0),setTimeout(()=>{var D;L(!1),V(!0);const N=(D=window.Telegram)==null?void 0:D.WebApp;N&&N.MainButton.hide(),setTimeout(()=>{g(1)},1500),setTimeout(()=>{y(1)},500)},750)},xe=()=>{if(!d)return;i(D=>D+1);const N=hse(o+1);s(N),(o+1)%10===0&&(u(!0),p(!1),M(D=>{const G=D+1;return G<=6?G:D})),o+1===69&&(x(performance.now()),p(!1),Z("car-move-up")),E(D=>(D+1)%7)},Me=()=>{u(!1),p(!0),i(N=>N+1),U(!0),setTimeout(()=>{U(!1)},300)};return dt.useEffect(()=>{const N=setInterval(()=>{t(D=>cE(D,a,window.innerHeight)),n(D=>cE(D,a,window.innerHeight))},11);return()=>clearInterval(N)},[a]),dt.useEffect(()=>{const N=document.createElement("style");return N.textContent=` @keyframes moveUp { 0% { transform: translateX(-50%) translateY(0); @@ -2932,7 +2932,7 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w opacity: 1; } } - `,document.head.append(N),()=>{document.head.removeChild(N)}},[]),dt.useEffect(()=>{if(S!==0){const N=setTimeout(()=>{y(0)},1500);return console.log(`User ID: ${ne}`),console.log(`User Name: ${X}`),console.log(`User First Name: ${C}`),console.log(`Elapsed Time: ${((S-v)/1e3).toFixed(3)} seconds`),console.log(`Wallet Address: ${q}`),()=>clearTimeout(N)}},[S,v,ne]),Dr("div",{style:{textAlign:"center",position:"relative",overflow:"hidden",height:"100vh",userSelect:"none"},children:[P&&Xe("div",{style:{opacity:w,transition:"opacity 1s"},children:Xe(Ase,{onStartGame:ye})}),!P&&Dr(A0,{children:[Xe("div",{style:{opacity:_,transition:"opacity 1s"},children:Xe(Tse,{position1:e,position2:r,verticalBlurLevel:k})}),c&&Xe(Nse,{children:c}),Dr("div",{style:{opacity:f,transition:"opacity 1s",userSelect:"none"},children:[Xe(Ise,{clickEnabled:d,onClick:xe,carAnimation:K,showBrykaO:ue,powerLevel:T,opacity:f}),Xe(Bse,{showGear:l,onClick:Me}),j&&S===0&&Dr(A0,{children:[Xe(kZ,{clickCount:o}),Xe(IZ,{clickCount:o}),Xe(BZ,{startTime:v,gameStarted:j,endTime:S})]})]})]}),(()=>{if(S===0||v===0)return null;const N=(S-v)/1e3;return Dr("div",{style:{border:"2px solid white",backgroundColor:"black",color:"white",padding:"20px",borderRadius:"10px",zIndex:4,position:"absolute",top:"5%",left:"50%",transform:"translateX(-50%)",opacity:0,animation:"slideDown 2s forwards",animationDelay:"1s",fontSize:"1rem"},children:[Xe(Wi,{onClick:()=>window.location.reload(),style:{margin:"10px",cursor:"pointer"},children:"Back"}),Xe("br",{}),Xe("br",{}),"Your Time:",Xe("br",{}),Xe("span",{style:{fontSize:"1.3rem",fontWeight:"bold"},children:N.toFixed(3)})," seconds",Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe(Wi,{onClick:()=>he(!0),style:{margin:"10px",cursor:"pointer"},children:"Leaderboard"})]})})(),$&&Xe(kO,{elapsedTime:(S-v)/1e3,onClose:()=>he(!1),userId:ne,firstName:C,userName:X,lastName:pe})]})},Dse=dn.div` + `,document.head.append(N),()=>{document.head.removeChild(N)}},[]),dt.useEffect(()=>{if(S!==0){const N=setTimeout(()=>{y(0)},1500);return console.log(`User ID: ${ne}`),console.log(`User Name: ${X}`),console.log(`User First Name: ${C}`),console.log(`Elapsed Time: ${((S-v)/1e3).toFixed(3)} seconds`),console.log(`Wallet Address: ${q}`),()=>clearTimeout(N)}},[S,v,ne]),Dr("div",{style:{textAlign:"center",position:"relative",overflow:"hidden",height:"100vh",userSelect:"none"},children:[P&&Xe("div",{style:{opacity:w,transition:"opacity 1s"},children:Xe(lse,{onStartGame:ye})}),!P&&Dr(A0,{children:[Xe("div",{style:{opacity:_,transition:"opacity 1s"},children:Xe(fse,{position1:e,position2:r,verticalBlurLevel:k})}),c&&Xe(mse,{children:c}),Dr("div",{style:{opacity:f,transition:"opacity 1s",userSelect:"none"},children:[Xe(cse,{clickEnabled:d,onClick:xe,carAnimation:K,showBrykaO:ue,powerLevel:T,opacity:f}),Xe(dse,{showGear:l,onClick:Me}),j&&S===0&&Dr(A0,{children:[Xe(CZ,{clickCount:o}),Xe(AZ,{clickCount:o}),Xe(IZ,{startTime:v,gameStarted:j,endTime:S})]})]})]}),(()=>{if(S===0||v===0)return null;const N=(S-v)/1e3;return Dr("div",{style:{border:"2px solid white",backgroundColor:"black",color:"white",padding:"20px",borderRadius:"10px",zIndex:4,position:"absolute",top:"5%",left:"50%",transform:"translateX(-50%)",opacity:0,animation:"slideDown 2s forwards",animationDelay:"1s",fontSize:"1rem"},children:[Xe(Wi,{onClick:()=>window.location.reload(),style:{margin:"10px",cursor:"pointer"},children:"Back"}),Xe("br",{}),Xe("br",{}),"Your Time:",Xe("br",{}),Xe("span",{style:{fontSize:"1.3rem",fontWeight:"bold"},children:N.toFixed(3)})," seconds",Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe("br",{}),Xe(Wi,{onClick:()=>he(!0),style:{margin:"10px",cursor:"pointer"},children:"Leaderboard"})]})})(),$&&Xe(EO,{elapsedTime:(S-v)/1e3,onClose:()=>he(!1),userId:ne,firstName:C,userName:X,lastName:pe})]})},yse=dn.div` background: white; color: black; font-family: 'PublicPixel', sans-serif; @@ -2942,8 +2942,8 @@ ${i}`)}else{const o=`Unexpected error: ${n}`;console.error(o),alert(o)}}}const w color: white; } min-height: 100vh; -`,Use=dn.div` +`,bse=dn.div` font-family: 'PublicPixel', sans-serif; max-width: 900px; margin: 0 auto; -`,jse=()=>Xe(Dse,{children:Xe(Use,{children:Xe(Lse,{})})});const Fse="https://raw.githubusercontent.com/0xjaqbek/twa/main/manifest.json",zse=new yN({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});h4.createRoot(document.getElementById("root")).render(Xe(dK,{manifestUrl:Fse,children:Xe(ED,{client:zse,children:Xe(jse,{})})})); +`,wse=()=>Xe(yse,{children:Xe(bse,{children:Xe(vse,{})})});const _se="https://raw.githubusercontent.com/0xjaqbek/twa/main/manifest.json",xse=new mN({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});d4.createRoot(document.getElementById("root")).render(Xe(cK,{manifestUrl:_se,children:Xe(SD,{client:xse,children:Xe(wse,{})})})); diff --git a/index.html b/index.html index ce11c33..0934b4c 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ TapRaceSprint by jaqbek - +