From 1143fdfeea1ca55408b75edb6880788c7317f90c Mon Sep 17 00:00:00 2001 From: El-hacen21 Date: Thu, 23 May 2024 07:53:50 +0000 Subject: [PATCH] Updates --- assets/{index-D8o_AI4W.js => index-DMu_LV42.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-D8o_AI4W.js => index-DMu_LV42.js} (98%) diff --git a/assets/index-D8o_AI4W.js b/assets/index-DMu_LV42.js similarity index 98% rename from assets/index-D8o_AI4W.js rename to assets/index-DMu_LV42.js index f8f0f35..51530ee 100644 --- a/assets/index-D8o_AI4W.js +++ b/assets/index-DMu_LV42.js @@ -87,7 +87,7 @@ ${o.stack}`:s}let WASM_VECTOR_LEN=0;const cachedTextEncoder=typeof TextEncoder<" `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...a){const s=new this(e);return a.forEach(AA=>s.set(AA)),s}static accessor(e){const s=(this[$internals]=this[$internals]={accessors:{}}).accessors,AA=this.prototype;function eA(BA){const oA=normalizeHeader(BA);s[oA]||(buildAccessors(AA,BA),s[oA]=!0)}return utils$1.isArray(e)?e.forEach(eA):eA(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:o},e)=>{let a=e[0].toUpperCase()+e.slice(1);return{get:()=>o,set(s){this[a]=s}}});utils$1.freezeMethods(AxiosHeaders);function transformData(o,e){const a=this||defaults$1,s=e||a,AA=AxiosHeaders.from(s.headers);let eA=s.data;return utils$1.forEach(o,function(oA){eA=oA.call(a,eA,AA.normalize(),e?e.status:void 0)}),AA.normalize(),eA}function isCancel(o){return!!(o&&o.__CANCEL__)}function CanceledError(o,e,a){AxiosError.call(this,o??"canceled",AxiosError.ERR_CANCELED,e,a),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(o,e,a){const s=a.config.validateStatus;!a.status||!s||s(a.status)?o(a):e(new AxiosError("Request failed with status code "+a.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function parseProtocol(o){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return e&&e[1]||""}function speedometer(o,e){o=o||10;const a=new Array(o),s=new Array(o);let AA=0,eA=0,BA;return e=e!==void 0?e:1e3,function(nA){const hA=Date.now(),uA=s[eA];BA||(BA=hA),a[AA]=nA,s[AA]=hA;let FA=eA,pA=0;for(;FA!==AA;)pA+=a[FA++],FA=FA%o;if(AA=(AA+1)%o,AA===eA&&(eA=(eA+1)%o),hA-BAs)return AA&&(clearTimeout(AA),AA=null),a=oA,o.apply(null,arguments);AA||(AA=setTimeout(()=>(AA=null,a=Date.now(),o.apply(null,arguments)),s-(oA-a)))}}const progressEventReducer=(o,e,a=3)=>{let s=0;const AA=speedometer(50,250);return throttle(eA=>{const BA=eA.loaded,oA=eA.lengthComputable?eA.total:void 0,nA=BA-s,hA=AA(nA),uA=BA<=oA;s=BA;const FA={loaded:BA,total:oA,progress:oA?BA/oA:void 0,bytes:nA,rate:hA||void 0,estimated:hA&&oA&&uA?(oA-BA)/hA:void 0,event:eA,lengthComputable:oA!=null};FA[e?"download":"upload"]=!0,o(FA)},a)},isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),a=document.createElement("a");let s;function AA(eA){let BA=eA;return e&&(a.setAttribute("href",BA),BA=a.href),a.setAttribute("href",BA),{href:a.href,protocol:a.protocol?a.protocol.replace(/:$/,""):"",host:a.host,search:a.search?a.search.replace(/^\?/,""):"",hash:a.hash?a.hash.replace(/^#/,""):"",hostname:a.hostname,port:a.port,pathname:a.pathname.charAt(0)==="/"?a.pathname:"/"+a.pathname}}return s=AA(window.location.href),function(BA){const oA=utils$1.isString(BA)?AA(BA):BA;return oA.protocol===s.protocol&&oA.host===s.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(o,e,a,s,AA,eA){const BA=[o+"="+encodeURIComponent(e)];utils$1.isNumber(a)&&BA.push("expires="+new Date(a).toGMTString()),utils$1.isString(s)&&BA.push("path="+s),utils$1.isString(AA)&&BA.push("domain="+AA),eA===!0&&BA.push("secure"),document.cookie=BA.join("; ")},read(o){const e=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(o){this.write(o,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function combineURLs(o,e){return e?o.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):o}function buildFullPath(o,e){return o&&!isAbsoluteURL(e)?combineURLs(o,e):e}const headersToObject=o=>o instanceof AxiosHeaders?{...o}:o;function mergeConfig(o,e){e=e||{};const a={};function s(hA,uA,FA){return utils$1.isPlainObject(hA)&&utils$1.isPlainObject(uA)?utils$1.merge.call({caseless:FA},hA,uA):utils$1.isPlainObject(uA)?utils$1.merge({},uA):utils$1.isArray(uA)?uA.slice():uA}function AA(hA,uA,FA){if(utils$1.isUndefined(uA)){if(!utils$1.isUndefined(hA))return s(void 0,hA,FA)}else return s(hA,uA,FA)}function eA(hA,uA){if(!utils$1.isUndefined(uA))return s(void 0,uA)}function BA(hA,uA){if(utils$1.isUndefined(uA)){if(!utils$1.isUndefined(hA))return s(void 0,hA)}else return s(void 0,uA)}function oA(hA,uA,FA){if(FA in e)return s(hA,uA);if(FA in o)return s(void 0,hA)}const nA={url:eA,method:eA,data:eA,baseURL:BA,transformRequest:BA,transformResponse:BA,paramsSerializer:BA,timeout:BA,timeoutMessage:BA,withCredentials:BA,withXSRFToken:BA,adapter:BA,responseType:BA,xsrfCookieName:BA,xsrfHeaderName:BA,onUploadProgress:BA,onDownloadProgress:BA,decompress:BA,maxContentLength:BA,maxBodyLength:BA,beforeRedirect:BA,transport:BA,httpAgent:BA,httpsAgent:BA,cancelToken:BA,socketPath:BA,responseEncoding:BA,validateStatus:oA,headers:(hA,uA)=>AA(headersToObject(hA),headersToObject(uA),!0)};return utils$1.forEach(Object.keys(Object.assign({},o,e)),function(uA){const FA=nA[uA]||AA,pA=FA(o[uA],e[uA],uA);utils$1.isUndefined(pA)&&FA!==oA||(a[uA]=pA)}),a}const resolveConfig=o=>{const e=mergeConfig({},o);let{data:a,withXSRFToken:s,xsrfHeaderName:AA,xsrfCookieName:eA,headers:BA,auth:oA}=e;e.headers=BA=AxiosHeaders.from(BA),e.url=buildURL(buildFullPath(e.baseURL,e.url),o.params,o.paramsSerializer),oA&&BA.set("Authorization","Basic "+btoa((oA.username||"")+":"+(oA.password?unescape(encodeURIComponent(oA.password)):"")));let nA;if(utils$1.isFormData(a)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)BA.setContentType(void 0);else if((nA=BA.getContentType())!==!1){const[hA,...uA]=nA?nA.split(";").map(FA=>FA.trim()).filter(Boolean):[];BA.setContentType([hA||"multipart/form-data",...uA].join("; "))}}if(platform.hasStandardBrowserEnv&&(s&&utils$1.isFunction(s)&&(s=s(e)),s||s!==!1&&isURLSameOrigin(e.url))){const hA=AA&&eA&&cookies.read(eA);hA&&BA.set(AA,hA)}return e},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(o){return new Promise(function(a,s){const AA=resolveConfig(o);let eA=AA.data;const BA=AxiosHeaders.from(AA.headers).normalize();let{responseType:oA}=AA,nA;function hA(){AA.cancelToken&&AA.cancelToken.unsubscribe(nA),AA.signal&&AA.signal.removeEventListener("abort",nA)}let uA=new XMLHttpRequest;uA.open(AA.method.toUpperCase(),AA.url,!0),uA.timeout=AA.timeout;function FA(){if(!uA)return;const zA=AxiosHeaders.from("getAllResponseHeaders"in uA&&uA.getAllResponseHeaders()),YA={data:!oA||oA==="text"||oA==="json"?uA.responseText:uA.response,status:uA.status,statusText:uA.statusText,headers:zA,config:o,request:uA};settle(function(_A){a(_A),hA()},function(_A){s(_A),hA()},YA),uA=null}"onloadend"in uA?uA.onloadend=FA:uA.onreadystatechange=function(){!uA||uA.readyState!==4||uA.status===0&&!(uA.responseURL&&uA.responseURL.indexOf("file:")===0)||setTimeout(FA)},uA.onabort=function(){uA&&(s(new AxiosError("Request aborted",AxiosError.ECONNABORTED,AA,uA)),uA=null)},uA.onerror=function(){s(new AxiosError("Network Error",AxiosError.ERR_NETWORK,AA,uA)),uA=null},uA.ontimeout=function(){let LA=AA.timeout?"timeout of "+AA.timeout+"ms exceeded":"timeout exceeded";const YA=AA.transitional||transitionalDefaults;AA.timeoutErrorMessage&&(LA=AA.timeoutErrorMessage),s(new AxiosError(LA,YA.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,AA,uA)),uA=null},eA===void 0&&BA.setContentType(null),"setRequestHeader"in uA&&utils$1.forEach(BA.toJSON(),function(LA,YA){uA.setRequestHeader(YA,LA)}),utils$1.isUndefined(AA.withCredentials)||(uA.withCredentials=!!AA.withCredentials),oA&&oA!=="json"&&(uA.responseType=AA.responseType),typeof AA.onDownloadProgress=="function"&&uA.addEventListener("progress",progressEventReducer(AA.onDownloadProgress,!0)),typeof AA.onUploadProgress=="function"&&uA.upload&&uA.upload.addEventListener("progress",progressEventReducer(AA.onUploadProgress)),(AA.cancelToken||AA.signal)&&(nA=zA=>{uA&&(s(!zA||zA.type?new CanceledError(null,o,uA):zA),uA.abort(),uA=null)},AA.cancelToken&&AA.cancelToken.subscribe(nA),AA.signal&&(AA.signal.aborted?nA():AA.signal.addEventListener("abort",nA)));const pA=parseProtocol(AA.url);if(pA&&platform.protocols.indexOf(pA)===-1){s(new AxiosError("Unsupported protocol "+pA+":",AxiosError.ERR_BAD_REQUEST,o));return}uA.send(eA||null)})},composeSignals=(o,e)=>{let a=new AbortController,s;const AA=function(nA){if(!s){s=!0,BA();const hA=nA instanceof Error?nA:this.reason;a.abort(hA instanceof AxiosError?hA:new CanceledError(hA instanceof Error?hA.message:hA))}};let eA=e&&setTimeout(()=>{AA(new AxiosError(`timeout ${e} of ms exceeded`,AxiosError.ETIMEDOUT))},e);const BA=()=>{o&&(eA&&clearTimeout(eA),eA=null,o.forEach(nA=>{nA&&(nA.removeEventListener?nA.removeEventListener("abort",AA):nA.unsubscribe(AA))}),o=null)};o.forEach(nA=>nA&&nA.addEventListener&&nA.addEventListener("abort",AA));const{signal:oA}=a;return oA.unsubscribe=BA,[oA,()=>{eA&&clearTimeout(eA),eA=null}]},streamChunk=function*(o,e){let a=o.byteLength;if(!e||a{const eA=readBytes(o,e,AA);let BA=0;return new ReadableStream({type:"bytes",async pull(oA){const{done:nA,value:hA}=await eA.next();if(nA){oA.close(),s();return}let uA=hA.byteLength;a&&a(BA+=uA),oA.enqueue(new Uint8Array(hA))},cancel(oA){return s(oA),eA.return()}},{highWaterMark:2})},fetchProgressDecorator=(o,e)=>{const a=o!=null;return s=>setTimeout(()=>e({lengthComputable:a,total:o,loaded:s}))},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(o=>e=>o.encode(e))(new TextEncoder):async o=>new Uint8Array(await new Response(o).arrayBuffer())),supportsRequestStream=isReadableStreamSupported&&(()=>{let o=!1;const e=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return o=!0,"half"}}).headers.has("Content-Type");return o&&!e})(),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&!!(()=>{try{return utils$1.isReadableStream(new Response("").body)}catch{}})(),resolvers={stream:supportsResponseStream&&(o=>o.body)};isFetchSupported&&(o=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!resolvers[e]&&(resolvers[e]=utils$1.isFunction(o[e])?a=>a[e]():(a,s)=>{throw new AxiosError(`Response type '${e}' is not supported`,AxiosError.ERR_NOT_SUPPORT,s)})})})(new Response);const getBodyLength=async o=>{if(o==null)return 0;if(utils$1.isBlob(o))return o.size;if(utils$1.isSpecCompliantForm(o))return(await new Request(o).arrayBuffer()).byteLength;if(utils$1.isArrayBufferView(o))return o.byteLength;if(utils$1.isURLSearchParams(o)&&(o=o+""),utils$1.isString(o))return(await encodeText(o)).byteLength},resolveBodyLength=async(o,e)=>{const a=utils$1.toFiniteNumber(o.getContentLength());return a??getBodyLength(e)},fetchAdapter=isFetchSupported&&(async o=>{let{url:e,method:a,data:s,signal:AA,cancelToken:eA,timeout:BA,onDownloadProgress:oA,onUploadProgress:nA,responseType:hA,headers:uA,withCredentials:FA="same-origin",fetchOptions:pA}=resolveConfig(o);hA=hA?(hA+"").toLowerCase():"text";let[zA,LA]=AA||eA||BA?composeSignals([AA,eA],BA):[],YA,QI;const _A=()=>{!YA&&setTimeout(()=>{zA&&zA.unsubscribe()}),YA=!0};let JA;try{if(nA&&supportsRequestStream&&a!=="get"&&a!=="head"&&(JA=await resolveBodyLength(uA,s))!==0){let BI=new Request(e,{method:"POST",body:s,duplex:"half"}),jA;utils$1.isFormData(s)&&(jA=BI.headers.get("content-type"))&&uA.setContentType(jA),BI.body&&(s=trackStream(BI.body,DEFAULT_CHUNK_SIZE,fetchProgressDecorator(JA,progressEventReducer(nA)),null,encodeText))}utils$1.isString(FA)||(FA=FA?"cors":"omit"),QI=new Request(e,{...pA,signal:zA,method:a.toUpperCase(),headers:uA.normalize().toJSON(),body:s,duplex:"half",withCredentials:FA});let MA=await fetch(QI);const iI=supportsResponseStream&&(hA==="stream"||hA==="response");if(supportsResponseStream&&(oA||iI)){const BI={};["status","statusText","headers"].forEach(CI=>{BI[CI]=MA[CI]});const jA=utils$1.toFiniteNumber(MA.headers.get("content-length"));MA=new Response(trackStream(MA.body,DEFAULT_CHUNK_SIZE,oA&&fetchProgressDecorator(jA,progressEventReducer(oA,!0)),iI&&_A,encodeText),BI)}hA=hA||"text";let _g=await resolvers[utils$1.findKey(resolvers,hA)||"text"](MA,o);return!iI&&_A(),LA&&LA(),await new Promise((BI,jA)=>{settle(BI,jA,{data:_g,headers:AxiosHeaders.from(MA.headers),status:MA.status,statusText:MA.statusText,config:o,request:QI})})}catch(MA){throw _A(),MA&&MA.name==="TypeError"&&/fetch/i.test(MA.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,o,QI),{cause:MA.cause||MA}):AxiosError.from(MA,MA&&MA.code,o,QI)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$1.forEach(knownAdapters,(o,e)=>{if(o){try{Object.defineProperty(o,"name",{value:e})}catch{}Object.defineProperty(o,"adapterName",{value:e})}});const renderReason=o=>`- ${o}`,isResolvedHandle=o=>utils$1.isFunction(o)||o===null||o===!1,adapters={getAdapter:o=>{o=utils$1.isArray(o)?o:[o];const{length:e}=o;let a,s;const AA={};for(let eA=0;eA`adapter ${oA} `+(nA===!1?"is not supported by the environment":"is not available in the build"));let BA=e?eA.length>1?`since : `+eA.map(renderReason).join(` `):" "+renderReason(eA[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+BA,"ERR_NOT_SUPPORT")}return s},adapters:knownAdapters};function throwIfCancellationRequested(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new CanceledError(null,o)}function dispatchRequest(o){return throwIfCancellationRequested(o),o.headers=AxiosHeaders.from(o.headers),o.data=transformData.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(o.adapter||defaults$1.adapter)(o).then(function(s){return throwIfCancellationRequested(o),s.data=transformData.call(o,o.transformResponse,s),s.headers=AxiosHeaders.from(s.headers),s},function(s){return isCancel(s)||(throwIfCancellationRequested(o),s&&s.response&&(s.response.data=transformData.call(o,o.transformResponse,s.response),s.response.headers=AxiosHeaders.from(s.response.headers))),Promise.reject(s)})}const VERSION="1.7.2",validators$1={};["object","boolean","number","function","string","symbol"].forEach((o,e)=>{validators$1[o]=function(s){return typeof s===o||"a"+(e<1?"n ":" ")+o}});const deprecatedWarnings={};validators$1.transitional=function(e,a,s){function AA(eA,BA){return"[Axios v"+VERSION+"] Transitional option '"+eA+"'"+BA+(s?". "+s:"")}return(eA,BA,oA)=>{if(e===!1)throw new AxiosError(AA(BA," has been removed"+(a?" in "+a:"")),AxiosError.ERR_DEPRECATED);return a&&!deprecatedWarnings[BA]&&(deprecatedWarnings[BA]=!0,console.warn(AA(BA," has been deprecated since v"+a+" and will be removed in the near future"))),e?e(eA,BA,oA):!0}};function assertOptions(o,e,a){if(typeof o!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const s=Object.keys(o);let AA=s.length;for(;AA-- >0;){const eA=s[AA],BA=e[eA];if(BA){const oA=o[eA],nA=oA===void 0||BA(oA,eA,o);if(nA!==!0)throw new AxiosError("option "+eA+" must be "+nA,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new AxiosError("Unknown option "+eA,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(e,a){try{return await this._request(e,a)}catch(s){if(s instanceof Error){let AA;Error.captureStackTrace?Error.captureStackTrace(AA={}):AA=new Error;const eA=AA.stack?AA.stack.replace(/^.+\n/,""):"";try{s.stack?eA&&!String(s.stack).endsWith(eA.replace(/^.+\n.+\n/,""))&&(s.stack+=` -`+eA):s.stack=eA}catch{}}throw s}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=mergeConfig(this.defaults,a);const{transitional:s,paramsSerializer:AA,headers:eA}=a;s!==void 0&&validator.assertOptions(s,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),AA!=null&&(utils$1.isFunction(AA)?a.paramsSerializer={serialize:AA}:validator.assertOptions(AA,{encode:validators.function,serialize:validators.function},!0)),a.method=(a.method||this.defaults.method||"get").toLowerCase();let BA=eA&&utils$1.merge(eA.common,eA[a.method]);eA&&utils$1.forEach(["delete","get","head","post","put","patch","common"],LA=>{delete eA[LA]}),a.headers=AxiosHeaders.concat(BA,eA);const oA=[];let nA=!0;this.interceptors.request.forEach(function(YA){typeof YA.runWhen=="function"&&YA.runWhen(a)===!1||(nA=nA&&YA.synchronous,oA.unshift(YA.fulfilled,YA.rejected))});const hA=[];this.interceptors.response.forEach(function(YA){hA.push(YA.fulfilled,YA.rejected)});let uA,FA=0,pA;if(!nA){const LA=[dispatchRequest.bind(this),void 0];for(LA.unshift.apply(LA,oA),LA.push.apply(LA,hA),pA=LA.length,uA=Promise.resolve(a);FA{if(!s._listeners)return;let eA=s._listeners.length;for(;eA-- >0;)s._listeners[eA](AA);s._listeners=null}),this.promise.then=AA=>{let eA;const BA=new Promise(oA=>{s.subscribe(oA),eA=oA}).then(AA);return BA.cancel=function(){s.unsubscribe(eA)},BA},e(function(eA,BA,oA){s.reason||(s.reason=new CanceledError(eA,BA,oA),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}static source(){let e;return{token:new CancelToken(function(AA){e=AA}),cancel:e}}}function spread(o){return function(a){return o.apply(null,a)}}function isAxiosError(o){return utils$1.isObject(o)&&o.isAxiosError===!0}const HttpStatusCode={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(HttpStatusCode).forEach(([o,e])=>{HttpStatusCode[e]=o});function createInstance(o){const e=new Axios(o),a=bind(Axios.prototype.request,e);return utils$1.extend(a,Axios.prototype,e,{allOwnKeys:!0}),utils$1.extend(a,e,null,{allOwnKeys:!0}),a.create=function(AA){return createInstance(mergeConfig(o,AA))},a}const axios=createInstance(defaults$1);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function(e){return Promise.all(e)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=o=>formDataToJSON(utils$1.isHTMLForm(o)?new FormData(o):o);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;function coerce$5(o){if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")}function base$5(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$6=base$5,_brrp__multiformats_scope_baseX$5=src$6;let Encoder$5=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$5=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$5(this,e)}},ComposedDecoder$5=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$5(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$5(o,e){return new ComposedDecoder$5({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$5=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$5(e,a,s),this.decoder=new Decoder$5(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$5({name:o,prefix:e,encode:a,decode:s}){return new Codec$5(o,e,a,s)}function baseX$5({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$5(a,o);return from$5({prefix:e,name:o,encode:s,decode:eA=>coerce$5(AA(eA))})}function decode$b(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$9(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<e.major?1:0}}Type.uint=new Type(0,"uint",!0);Type.negint=new Type(1,"negint",!0);Type.bytes=new Type(2,"bytes",!0);Type.string=new Type(3,"string",!0);Type.array=new Type(4,"array",!1);Type.map=new Type(5,"map",!1);Type.tag=new Type(6,"tag",!1);Type.float=new Type(7,"float",!0);Type.false=new Type(7,"false",!0);Type.true=new Type(7,"true",!0);Type.null=new Type(7,"null",!0);Type.undefined=new Type(7,"undefined",!0);Type.break=new Type(7,"break",!0);class Token{constructor(e,a,s){this.type=e,this.value=a,this.encodedLength=s,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const useBuffer=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function";new TextDecoder;const textEncoder=new TextEncoder;function isBuffer(o){return useBuffer&&globalThis.Buffer.isBuffer(o)}function asU8A(o){return o instanceof Uint8Array?isBuffer(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):o:Uint8Array.from(o)}const fromString$3=useBuffer?o=>o.length>64?globalThis.Buffer.from(o):utf8ToBytes(o):o=>o.length>64?textEncoder.encode(o):utf8ToBytes(o);function compare(o,e){if(isBuffer(o)&&isBuffer(e))return o.compare(e);for(let a=0;a>6|192,e[a++]=AA&63|128):(AA&64512)===55296&&s+1>18|240,e[a++]=AA>>12&63|128,e[a++]=AA>>6&63|128,e[a++]=AA&63|128):(e[a++]=AA>>12|224,e[a++]=AA>>6&63|128,e[a++]=AA&63|128)}return e}const decodeErrPrefix="CBOR decode error:",encodeErrPrefix="CBOR encode error:",uintBoundaries=[24,256,65536,4294967296,BigInt("18446744073709551616")];function encodeUint(o,e){return encodeUintValue(o,0,e.value)}function encodeUintValue(o,e,a){if(a>>8,s&255])}else if(a>>24&255,s>>>16&255,s>>>8&255,s&255])}else{const s=BigInt(a);if(s>BigInt(32)&BigInt(4294967295));AA[8]=eA&255,eA=eA>>8,AA[7]=eA&255,eA=eA>>8,AA[6]=eA&255,eA=eA>>8,AA[5]=eA&255,AA[4]=BA&255,BA=BA>>8,AA[3]=BA&255,BA=BA>>8,AA[2]=BA&255,BA=BA>>8,AA[1]=BA&255,o.push(AA)}else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`)}}encodeUint.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};encodeUintValue.encodedSize=function(e){return ea.value?1:0};const neg1b=BigInt(-1),pos1b=BigInt(1);function encodeNegint(o,e){const a=e.value,s=typeof a=="bigint"?a*neg1b-pos1b:a*-1-1;encodeUintValue(o,e.type.majorEncoded,s)}encodeNegint.encodedSize=function(e){const a=e.value,s=typeof a=="bigint"?a*neg1b-pos1b:a*-1-1;return sa.value?-1:0};function tokenBytes(o){return o.encodedBytes===void 0&&(o.encodedBytes=o.type===Type.string?fromString$3(o.value):o.value),o.encodedBytes}function encodeBytes(o,e){const a=tokenBytes(e);encodeUintValue(o,e.type.majorEncoded,a.length),o.push(a)}encodeBytes.encodedSize=function(e){const a=tokenBytes(e);return encodeUintValue.encodedSize(a.length)+a.length};encodeBytes.compareTokens=function(e,a){return compareBytes(tokenBytes(e),tokenBytes(a))};function compareBytes(o,e){return o.lengthe.length?1:compare(o,e)}const encodeString=encodeBytes;function encodeArray(o,e){encodeUintValue(o,Type.array.majorEncoded,e.value)}encodeArray.compareTokens=encodeUint.compareTokens;encodeArray.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};function encodeMap(o,e){encodeUintValue(o,Type.map.majorEncoded,e.value)}encodeMap.compareTokens=encodeUint.compareTokens;encodeMap.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};function encodeTag(o,e){encodeUintValue(o,Type.tag.majorEncoded,e.value)}encodeTag.compareTokens=encodeUint.compareTokens;encodeTag.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};const MINOR_FALSE=20,MINOR_TRUE=21,MINOR_NULL=22,MINOR_UNDEFINED=23;function encodeFloat(o,e,a){const s=e.value;if(s===!1)o.push([Type.float.majorEncoded|MINOR_FALSE]);else if(s===!0)o.push([Type.float.majorEncoded|MINOR_TRUE]);else if(s===null)o.push([Type.float.majorEncoded|MINOR_NULL]);else if(s===void 0)o.push([Type.float.majorEncoded|MINOR_UNDEFINED]);else{let AA,eA=!1;(!a||a.float64!==!0)&&(encodeFloat16(s),AA=readFloat16(ui8a,1),s===AA||Number.isNaN(s)?(ui8a[0]=249,o.push(ui8a.slice(0,3)),eA=!0):(encodeFloat32(s),AA=readFloat32(ui8a,1),s===AA&&(ui8a[0]=250,o.push(ui8a.slice(0,5)),eA=!0))),eA||(encodeFloat64(s),AA=readFloat64(ui8a,1),ui8a[0]=251,o.push(ui8a.slice(0,9)))}}encodeFloat.encodedSize=function(e,a){const s=e.value;if(s===!1||s===!0||s===null||s===void 0)return 1;if(!a||a.float64!==!0){encodeFloat16(s);let AA=readFloat16(ui8a,1);if(s===AA||Number.isNaN(s))return 3;if(encodeFloat32(s),AA=readFloat32(ui8a,1),s===AA)return 5}return 9};const buffer$1=new ArrayBuffer(9),dataView=new DataView(buffer$1,1),ui8a=new Uint8Array(buffer$1,0);function encodeFloat16(o){if(o===1/0)dataView.setUint16(0,31744,!1);else if(o===-1/0)dataView.setUint16(0,64512,!1);else if(Number.isNaN(o))dataView.setUint16(0,32256,!1);else{dataView.setFloat32(0,o);const e=dataView.getUint32(0),a=(e&2139095040)>>23,s=e&8388607;if(a===255)dataView.setUint16(0,31744,!1);else if(a===0)dataView.setUint16(0,(o&2147483648)>>16|s>>13,!1);else{const AA=a-127;AA<-24?dataView.setUint16(0,0):AA<-14?dataView.setUint16(0,(e&2147483648)>>16|1<<24+AA,!1):dataView.setUint16(0,(e&2147483648)>>16|AA+15<<10|s>>13,!1)}}}function readFloat16(o,e){if(o.length-e<2)throw new Error(`${decodeErrPrefix} not enough data for float16`);const a=(o[e]<<8)+o[e+1];if(a===31744)return 1/0;if(a===64512)return-1/0;if(a===32256)return NaN;const s=a>>10&31,AA=a&1023;let eA;return s===0?eA=AA*2**-24:s!==31?eA=(AA+1024)*2**(s-25):eA=AA===0?1/0:NaN,a&32768?-eA:eA}function encodeFloat32(o){dataView.setFloat32(0,o,!1)}function readFloat32(o,e){if(o.length-e<4)throw new Error(`${decodeErrPrefix} not enough data for float32`);const a=(o.byteOffset||0)+e;return new DataView(o.buffer,a,4).getFloat32(0,!1)}function encodeFloat64(o){dataView.setFloat64(0,o,!1)}function readFloat64(o,e){if(o.length-e<8)throw new Error(`${decodeErrPrefix} not enough data for float64`);const a=(o.byteOffset||0)+e;return new DataView(o.buffer,a,8).getFloat64(0,!1)}encodeFloat.compareTokens=encodeUint.compareTokens;function makeCborEncoders(){const o=[];return o[Type.uint.major]=encodeUint,o[Type.negint.major]=encodeNegint,o[Type.bytes.major]=encodeBytes,o[Type.string.major]=encodeString,o[Type.array.major]=encodeArray,o[Type.map.major]=encodeMap,o[Type.tag.major]=encodeTag,o[Type.float.major]=encodeFloat,o}makeCborEncoders();class Ref{constructor(e,a){this.obj=e,this.parent=a}includes(e){let a=this;do if(a.obj===e)return!0;while(a=a.parent);return!1}static createCheck(e,a){if(e&&e.includes(a))throw new Error(`${encodeErrPrefix} object contains circular references`);return new Ref(a,e)}}const simpleTokens={null:new Token(Type.null,null),undefined:new Token(Type.undefined,void 0),true:new Token(Type.true,!0),false:new Token(Type.false,!1),emptyArray:new Token(Type.array,0),emptyMap:new Token(Type.map,0)},typeEncoders={number(o,e,a,s){return!Number.isInteger(o)||!Number.isSafeInteger(o)?new Token(Type.float,o):o>=0?new Token(Type.uint,o):new Token(Type.negint,o)},bigint(o,e,a,s){return o>=BigInt(0)?new Token(Type.uint,o):new Token(Type.negint,o)},Uint8Array(o,e,a,s){return new Token(Type.bytes,o)},string(o,e,a,s){return new Token(Type.string,o)},boolean(o,e,a,s){return o?simpleTokens.true:simpleTokens.false},null(o,e,a,s){return simpleTokens.null},undefined(o,e,a,s){return simpleTokens.undefined},ArrayBuffer(o,e,a,s){return new Token(Type.bytes,new Uint8Array(o))},DataView(o,e,a,s){return new Token(Type.bytes,new Uint8Array(o.buffer,o.byteOffset,o.byteLength))},Array(o,e,a,s){if(!o.length)return a.addBreakTokens===!0?[simpleTokens.emptyArray,new Token(Type.break)]:simpleTokens.emptyArray;s=Ref.createCheck(s,o);const AA=[];let eA=0;for(const BA of o)AA[eA++]=objectToTokens(BA,a,s);return a.addBreakTokens?[new Token(Type.array,o.length),AA,new Token(Type.break)]:[new Token(Type.array,o.length),AA]},Object(o,e,a,s){const AA=e!=="Object",eA=AA?o.keys():Object.keys(o),BA=AA?o.size:eA.length;if(!BA)return a.addBreakTokens===!0?[simpleTokens.emptyMap,new Token(Type.break)]:simpleTokens.emptyMap;s=Ref.createCheck(s,o);const oA=[];let nA=0;for(const hA of eA)oA[nA++]=[objectToTokens(hA,a,s),objectToTokens(AA?o.get(hA):o[hA],a,s)];return sortMapEntries(oA,a),a.addBreakTokens?[new Token(Type.map,BA),oA,new Token(Type.break)]:[new Token(Type.map,BA),oA]}};typeEncoders.Map=typeEncoders.Object;typeEncoders.Buffer=typeEncoders.Uint8Array;for(const o of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))typeEncoders[`${o}Array`]=typeEncoders.DataView;function objectToTokens(o,e={},a){const s=is(o),AA=e&&e.typeEncoders&&e.typeEncoders[s]||typeEncoders[s];if(typeof AA=="function"){const BA=AA(o,s,e,a);if(BA!=null)return BA}const eA=typeEncoders[s];if(!eA)throw new Error(`${encodeErrPrefix} unsupported type: ${s}`);return eA(o,s,e,a)}function sortMapEntries(o,e){e.mapSorter&&o.sort(e.mapSorter)}function equals$1(o,e){if(o===e)return!0;if(o.byteLength!==e.byteLength)return!1;for(let a=0;a=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$5=base$4,_brrp__multiformats_scope_baseX$4=src$5;let Encoder$4=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$4=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$4(this,e)}},ComposedDecoder$4=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$4(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$4(o,e){return new ComposedDecoder$4({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$4=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$4(e,a,s),this.decoder=new Decoder$4(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$4({name:o,prefix:e,encode:a,decode:s}){return new Codec$4(o,e,a,s)}function baseX$4({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$4(a,o);return from$4({prefix:e,name:o,encode:s,decode:eA=>coerce$4(AA(eA))})}function decode$a(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$8(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<=INT;)e[a++]=o&255|MSB,o/=128;for(;o&MSBALL;)e[a++]=o&255|MSB,o>>>=7;return e[a]=o|0,encode$7.bytes=a-s+1,e}var decode$9=read,MSB$1=128,REST$1=127;function read(o,s){var a=0,s=s||0,AA=0,eA=s,BA,oA=o.length;do{if(eA>=oA)throw read.bytes=0,new RangeError("Could not decode varint");BA=o[eA++],a+=AA<28?(BA&REST$1)<=MSB$1);return read.bytes=eA-s,a}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return o{const[FA,pA]=decode$8(e.subarray(a));return a+=pA,FA};let AA=s(),eA=DAG_PB_CODE;if(AA===18?(AA=0,a=0):eA=s(),AA!==0&&AA!==1)throw new RangeError(`Invalid CID version ${AA}`);const BA=a,oA=s(),nA=s(),hA=a+nA,uA=hA-BA;return{version:AA,codec:eA,multihashCode:oA,digestSize:nA,multihashSize:uA,size:hA}}static parse(e,a){const[s,AA]=parseCIDtoBytes(e,a),eA=CID.decode(AA);if(eA.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(eA).set(s,e),eA}}function parseCIDtoBytes(o,e){switch(o[0]){case"Q":{const a=e??base58btc$2;return[base58btc$2.prefix,a.decode(`${base58btc$2.prefix}${o}`)]}case base58btc$2.prefix:{const a=e??base58btc$2;return[base58btc$2.prefix,a.decode(o)]}case base32$4.prefix:{const a=e??base32$4;return[base32$4.prefix,a.decode(o)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[o[0],e.decode(o)]}}}function toStringV0(o,e,a){const{prefix:s}=a;if(s!==base58btc$2.prefix)throw Error(`Cannot string encode V0 in ${a.name} encoding`);const AA=e.get(s);if(AA==null){const eA=a.encode(o).slice(1);return e.set(s,eA),eA}else return AA}function toStringV1(o,e,a){const{prefix:s}=a,AA=e.get(s);if(AA==null){const eA=a.encode(o);return e.set(s,eA),eA}else return AA}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,e,a){const s=encodingLength(o),AA=s+encodingLength(e),eA=new Uint8Array(AA+a.byteLength);return encodeTo(o,eA,0),encodeTo(e,eA,s),eA.set(a,AA),eA}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),CID_CBOR_TAG=42;function cidEncoder(o){if(o.asCID!==o&&o["/"]!==o.bytes)return null;const e=CID.asCID(o);if(!e)return null;const a=new Uint8Array(e.bytes.byteLength+1);return a.set(e.bytes,1),[new Token(Type.tag,CID_CBOR_TAG),new Token(Type.bytes,a)]}function undefinedEncoder(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function numberEncoder(o){if(Number.isNaN(o))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(o===1/0||o===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}const _encodeOptions={float64:!0,typeEncoders:{Object:cidEncoder,undefined:undefinedEncoder,number:numberEncoder}};({..._encodeOptions,typeEncoders:{..._encodeOptions.typeEncoders}});function cidDecoder(o){if(o[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return CID.decode(o.subarray(1))}const _decodeOptions={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};_decodeOptions.tags[CID_CBOR_TAG]=cidDecoder;({..._decodeOptions,tags:_decodeOptions.tags.slice()});class JSONEncoder extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){const a=this.inRecursive[this.inRecursive.length-1];a&&(a.type===Type.array&&(a.elements++,a.elements!==1&&e.push([44])),a.type===Type.map&&(a.elements++,a.elements!==1&&(a.elements%2===1?e.push([44]):e.push([58]))))}[Type.uint.major](e,a){this.prefix(e);const s=String(a.value),AA=[];for(let eA=0;eA32?asU8A(s):s)}[Type.array.major](e,a){this.prefix(e),this.inRecursive.push({type:Type.array,elements:0}),e.push([91])}[Type.map.major](e,a){this.prefix(e),this.inRecursive.push({type:Type.map,elements:0}),e.push([123])}[Type.tag.major](e,a){}[Type.float.major](e,a){if(a.type.name==="break"){const BA=this.inRecursive.pop();if(BA){if(BA.type===Type.array)e.push([93]);else if(BA.type===Type.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(a.value===void 0)throw new Error(`${encodeErrPrefix} unsupported type: undefined`);if(this.prefix(e),a.type.name==="true"){e.push([116,114,117,101]);return}else if(a.type.name==="false"){e.push([102,97,108,115,101]);return}else if(a.type.name==="null"){e.push([110,117,108,108]);return}const s=String(a.value),AA=[];let eA=!1;for(let BA=0;BA=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$4=base$3,_brrp__multiformats_scope_baseX$3=src$4;let Encoder$3=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$3=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$3(this,e)}},ComposedDecoder$3=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$3(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$3(o,e){return new ComposedDecoder$3({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$3=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$3(e,a,s),this.decoder=new Decoder$3(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$3({name:o,prefix:e,encode:a,decode:s}){return new Codec$3(o,e,a,s)}function baseX$3({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$3(a,o);return from$3({prefix:e,name:o,encode:s,decode:eA=>coerce$3(AA(eA))})}function decode$6(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$6(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$3=base$2,_brrp__multiformats_scope_baseX$2=src$3;const coerce$2=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},fromString$2=o=>new TextEncoder().encode(o),toString$3=o=>new TextDecoder().decode(o);let Encoder$2=class{constructor(e,a,s){this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(e,a,s){if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$2(this,e)}},ComposedDecoder$2=class{constructor(e){this.decoders=e}or(e){return or$2(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const or$2=(o,e)=>new ComposedDecoder$2({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let Codec$2=class{constructor(e,a,s,AA){this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$2(e,a,s),this.decoder=new Decoder$2(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const from$2=({name:o,prefix:e,encode:a,decode:s})=>new Codec$2(o,e,a,s),baseX$2=({prefix:o,name:e,alphabet:a})=>{const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$2(a,e);return from$2({prefix:o,name:e,encode:s,decode:eA=>coerce$2(AA(eA))})},decode$5=(o,e,a,s)=>{const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA},encode$5=(o,e,a)=>{const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA&&(eA+=e[AA&oA<from$2({prefix:e,name:o,encode(AA){return encode$5(AA,s,a)},decode(AA){return decode$5(AA,s,a,o)}}),base64$4=rfc4648$2({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$1=rfc4648$2({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$1=rfc4648$2({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$1=rfc4648$2({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$5=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$4,base64pad:base64pad$1,base64url:base64url$1,base64urlpad:base64urlpad$1},Symbol.toStringTag,{value:"Module"})),base58btc$1=baseX$2({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$1=baseX$2({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$1=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$1,base58flickr:base58flickr$1},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648$2({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$1=rfc4648$2({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$1=rfc4648$2({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$1=rfc4648$2({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$1=rfc4648$2({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$1=rfc4648$2({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$1=rfc4648$2({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$1=rfc4648$2({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$1=rfc4648$2({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex:base32hex$1,base32hexpad:base32hexpad$1,base32hexpadupper:base32hexpadupper$1,base32hexupper:base32hexupper$1,base32pad:base32pad$1,base32padupper:base32padupper$1,base32upper:base32upper$1,base32z:base32z$1},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$3(o),decode:o=>fromString$2(o)}),identityBase$1=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"})),base2$2=rfc4648$2({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$3=Object.freeze(Object.defineProperty({__proto__:null,base2:base2$2},Symbol.toStringTag,{value:"Module"})),base8$2=rfc4648$2({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$3=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$2},Symbol.toStringTag,{value:"Module"})),base10$2=baseX$2({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$3=Object.freeze(Object.defineProperty({__proto__:null,base10:base10$2},Symbol.toStringTag,{value:"Module"})),base16$2=rfc4648$2({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper$1=rfc4648$2({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$3=Object.freeze(Object.defineProperty({__proto__:null,base16:base16$2,base16upper:base16upper$1},Symbol.toStringTag,{value:"Module"})),base36$2=baseX$2({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$1=baseX$2({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$3=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$2,base36upper:base36upper$1},Symbol.toStringTag,{value:"Module"})),alphabet$2=Array.from("šŸš€šŸŖā˜„šŸ›°šŸŒŒšŸŒ‘šŸŒ’šŸŒ“šŸŒ”šŸŒ•šŸŒ–šŸŒ—šŸŒ˜šŸŒšŸŒšŸŒŽšŸ‰ā˜€šŸ’»šŸ–„šŸ’¾šŸ’暟˜‚ā¤šŸ˜šŸ¤£šŸ˜ŠšŸ™šŸ’•šŸ˜­šŸ˜˜šŸ‘šŸ˜…šŸ‘šŸ˜šŸ”„šŸ„°šŸ’”šŸ’–šŸ’™šŸ˜¢šŸ¤”šŸ˜†šŸ™„šŸ’ŖšŸ˜‰ā˜ŗšŸ‘ŒšŸ¤—šŸ’œšŸ˜”šŸ˜ŽšŸ˜‡šŸŒ¹šŸ¤¦šŸŽ‰šŸ’žāœŒāœØšŸ¤·šŸ˜±šŸ˜ŒšŸŒøšŸ™ŒšŸ˜‹šŸ’—šŸ’ššŸ˜šŸ’›šŸ™‚šŸ’“šŸ¤©šŸ˜„šŸ˜€šŸ–¤šŸ˜ƒšŸ’ÆšŸ™ˆšŸ‘‡šŸŽ¶šŸ˜’šŸ¤­ā£šŸ˜œšŸ’‹šŸ‘€šŸ˜ŖšŸ˜‘šŸ’„šŸ™‹šŸ˜žšŸ˜©šŸ˜”šŸ¤ŖšŸ‘ŠšŸ„³šŸ˜„šŸ¤¤šŸ‘‰šŸ’ƒšŸ˜³āœ‹šŸ˜ššŸ˜šŸ˜“šŸŒŸšŸ˜¬šŸ™ƒšŸ€šŸŒ·šŸ˜»šŸ˜“ā­āœ…šŸ„ŗšŸŒˆšŸ˜ˆšŸ¤˜šŸ’¦āœ”šŸ˜£šŸƒšŸ’ā˜¹šŸŽŠšŸ’˜šŸ˜ ā˜šŸ˜•šŸŒŗšŸŽ‚šŸŒ»šŸ˜šŸ–•šŸ’šŸ™ŠšŸ˜¹šŸ—£šŸ’«šŸ’€šŸ‘‘šŸŽµšŸ¤žšŸ˜›šŸ”“šŸ˜¤šŸŒ¼šŸ˜«āš½šŸ¤™ā˜•šŸ†šŸ¤«šŸ‘ˆšŸ˜®šŸ™†šŸ»šŸƒšŸ¶šŸ’šŸ˜²šŸŒæšŸ§”šŸŽāš”šŸŒžšŸŽˆāŒāœŠšŸ‘‹šŸ˜°šŸ¤ØšŸ˜¶šŸ¤šŸš¶šŸ’°šŸ“šŸ’¢šŸ¤ŸšŸ™šŸšØšŸ’ØšŸ¤¬āœˆšŸŽ€šŸŗšŸ¤“šŸ˜™šŸ’ŸšŸŒ±šŸ˜–šŸ‘¶šŸ„“ā–¶āž”ā“šŸ’ŽšŸ’øā¬‡šŸ˜ØšŸŒššŸ¦‹šŸ˜·šŸ•ŗāš šŸ™…šŸ˜ŸšŸ˜µšŸ‘ŽšŸ¤²šŸ¤ šŸ¤§šŸ“ŒšŸ”µšŸ’…šŸ§šŸ¾šŸ’šŸ˜—šŸ¤‘šŸŒŠšŸ¤ÆšŸ·ā˜ŽšŸ’§šŸ˜ÆšŸ’†šŸ‘†šŸŽ¤šŸ™‡šŸ‘ā„šŸŒ“šŸ’£šŸøšŸ’ŒšŸ“šŸ„€šŸ¤¢šŸ‘…šŸ’”šŸ’©šŸ‘šŸ“øšŸ‘»šŸ¤šŸ¤®šŸŽ¼šŸ„µšŸš©šŸŽšŸŠšŸ‘¼šŸ’šŸ“£šŸ„‚"),alphabetBytesToChars$2=alphabet$2.reduce((o,e,a)=>(o[a]=e,o),[]),alphabetCharsToBytes$2=alphabet$2.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode$4(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars$2[a],e),"")}function decode$4(o){const e=[];for(const a of o){const s=alphabetCharsToBytes$2[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}const base256emoji$2=from$2({prefix:"šŸš€",name:"base256emoji",encode:encode$4,decode:decode$4}),base256emoji$3=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$2},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$1={...identityBase$1,...base2$3,...base8$3,...base10$3,...base16$3,...base32$3,...base36$3,...base58$1,...base64$5,...base256emoji$3};function base$1(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$2=base$1,_brrp__multiformats_scope_baseX$1=src$2;const coerce$1=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=o=>new TextEncoder().encode(o),toString$2=o=>new TextDecoder().decode(o);let Encoder$1=class{constructor(e,a,s){this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$1=class{constructor(e,a,s){if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$1(this,e)}},ComposedDecoder$1=class{constructor(e){this.decoders=e}or(e){return or$1(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const or$1=(o,e)=>new ComposedDecoder$1({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let Codec$1=class{constructor(e,a,s,AA){this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$1(e,a,s),this.decoder=new Decoder$1(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const from$1=({name:o,prefix:e,encode:a,decode:s})=>new Codec$1(o,e,a,s),baseX$1=({prefix:o,name:e,alphabet:a})=>{const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$1(a,e);return from$1({prefix:o,name:e,encode:s,decode:eA=>coerce$1(AA(eA))})},decode$3=(o,e,a,s)=>{const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA},encode$3=(o,e,a)=>{const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA&&(eA+=e[AA&oA<from$1({prefix:e,name:o,encode(AA){return encode$3(AA,s,a)},decode(AA){return decode$3(AA,s,a,o)}});baseX$1({prefix:"9",name:"base10",alphabet:"0123456789"});rfc4648$1({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4});rfc4648$1({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});rfc4648$1({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});const alphabet$1=Array.from("šŸš€šŸŖā˜„šŸ›°šŸŒŒšŸŒ‘šŸŒ’šŸŒ“šŸŒ”šŸŒ•šŸŒ–šŸŒ—šŸŒ˜šŸŒšŸŒšŸŒŽšŸ‰ā˜€šŸ’»šŸ–„šŸ’¾šŸ’暟˜‚ā¤šŸ˜šŸ¤£šŸ˜ŠšŸ™šŸ’•šŸ˜­šŸ˜˜šŸ‘šŸ˜…šŸ‘šŸ˜šŸ”„šŸ„°šŸ’”šŸ’–šŸ’™šŸ˜¢šŸ¤”šŸ˜†šŸ™„šŸ’ŖšŸ˜‰ā˜ŗšŸ‘ŒšŸ¤—šŸ’œšŸ˜”šŸ˜ŽšŸ˜‡šŸŒ¹šŸ¤¦šŸŽ‰šŸ’žāœŒāœØšŸ¤·šŸ˜±šŸ˜ŒšŸŒøšŸ™ŒšŸ˜‹šŸ’—šŸ’ššŸ˜šŸ’›šŸ™‚šŸ’“šŸ¤©šŸ˜„šŸ˜€šŸ–¤šŸ˜ƒšŸ’ÆšŸ™ˆšŸ‘‡šŸŽ¶šŸ˜’šŸ¤­ā£šŸ˜œšŸ’‹šŸ‘€šŸ˜ŖšŸ˜‘šŸ’„šŸ™‹šŸ˜žšŸ˜©šŸ˜”šŸ¤ŖšŸ‘ŠšŸ„³šŸ˜„šŸ¤¤šŸ‘‰šŸ’ƒšŸ˜³āœ‹šŸ˜ššŸ˜šŸ˜“šŸŒŸšŸ˜¬šŸ™ƒšŸ€šŸŒ·šŸ˜»šŸ˜“ā­āœ…šŸ„ŗšŸŒˆšŸ˜ˆšŸ¤˜šŸ’¦āœ”šŸ˜£šŸƒšŸ’ā˜¹šŸŽŠšŸ’˜šŸ˜ ā˜šŸ˜•šŸŒŗšŸŽ‚šŸŒ»šŸ˜šŸ–•šŸ’šŸ™ŠšŸ˜¹šŸ—£šŸ’«šŸ’€šŸ‘‘šŸŽµšŸ¤žšŸ˜›šŸ”“šŸ˜¤šŸŒ¼šŸ˜«āš½šŸ¤™ā˜•šŸ†šŸ¤«šŸ‘ˆšŸ˜®šŸ™†šŸ»šŸƒšŸ¶šŸ’šŸ˜²šŸŒæšŸ§”šŸŽāš”šŸŒžšŸŽˆāŒāœŠšŸ‘‹šŸ˜°šŸ¤ØšŸ˜¶šŸ¤šŸš¶šŸ’°šŸ“šŸ’¢šŸ¤ŸšŸ™šŸšØšŸ’ØšŸ¤¬āœˆšŸŽ€šŸŗšŸ¤“šŸ˜™šŸ’ŸšŸŒ±šŸ˜–šŸ‘¶šŸ„“ā–¶āž”ā“šŸ’ŽšŸ’øā¬‡šŸ˜ØšŸŒššŸ¦‹šŸ˜·šŸ•ŗāš šŸ™…šŸ˜ŸšŸ˜µšŸ‘ŽšŸ¤²šŸ¤ šŸ¤§šŸ“ŒšŸ”µšŸ’…šŸ§šŸ¾šŸ’šŸ˜—šŸ¤‘šŸŒŠšŸ¤ÆšŸ·ā˜ŽšŸ’§šŸ˜ÆšŸ’†šŸ‘†šŸŽ¤šŸ™‡šŸ‘ā„šŸŒ“šŸ’£šŸøšŸ’ŒšŸ“šŸ„€šŸ¤¢šŸ‘…šŸ’”šŸ’©šŸ‘šŸ“øšŸ‘»šŸ¤šŸ¤®šŸŽ¼šŸ„µšŸš©šŸŽšŸŠšŸ‘¼šŸ’šŸ“£šŸ„‚"),alphabetBytesToChars$1=alphabet$1.reduce((o,e,a)=>(o[a]=e,o),[]),alphabetCharsToBytes$1=alphabet$1.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode$2(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars$1[a],e),"")}function decode$2(o){const e=[];for(const a of o){const s=alphabetCharsToBytes$1[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}from$1({prefix:"šŸš€",name:"base256emoji",encode:encode$2,decode:decode$2});rfc4648$1({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc4648$1({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5});rfc4648$1({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5});rfc4648$1({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5});rfc4648$1({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5});rfc4648$1({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});rfc4648$1({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5});rfc4648$1({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5});rfc4648$1({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});baseX$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"});baseX$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});baseX$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});rfc4648$1({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});rfc4648$1({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6});rfc4648$1({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6});rfc4648$1({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});rfc4648$1({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});from$1({prefix:"\0",name:"identity",encode:o=>toString$2(o),decode:o=>fromString$1(o)});new TextEncoder;new TextDecoder;const V$1=-1,names$1={},codes$1={},table$1=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V$1,"ip6zone"],[43,8,"ipcidr"],[53,V$1,"dns",!0],[54,V$1,"dns4",!0],[55,V$1,"dns6",!0],[56,V$1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[281,0,"webrtc-w3c"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V$1,"unix",!1,!0],[421,V$1,"ipfs"],[421,V$1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V$1,"garlic64"],[448,0,"tls"],[449,V$1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V$1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V$1,"memory"]];table$1.forEach(o=>{const e=createProtocol$1(...o);codes$1[e.code]=e,names$1[e.name]=e});function createProtocol$1(o,e,a,s,AA){return{code:o,size:e,name:a,resolvable:!!s,path:!!AA}}function getProtocol$1(o){if(typeof o=="number"){if(codes$1[o]!=null)return codes$1[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names$1[o]!=null)return names$1[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}const decoders$1=Object.values(bases$1).map(o=>o.decoder);(function(){let o=decoders$1[0].or(decoders$1[1]);return decoders$1.slice(2).forEach(e=>o=o.or(e)),o})();getProtocol$1("dns").code,getProtocol$1("dns4").code,getProtocol$1("dns6").code,getProtocol$1("dnsaddr").code;function commonjsRequire(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1,define_process_env_default={};const isElectron=isElectron_1,IS_ENV_WITH_DOM=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,IS_ELECTRON=isElectron(),IS_BROWSER=IS_ENV_WITH_DOM&&!IS_ELECTRON,IS_ELECTRON_MAIN=IS_ELECTRON&&!IS_ENV_WITH_DOM,IS_ELECTRON_RENDERER=IS_ELECTRON&&IS_ENV_WITH_DOM,IS_NODE=typeof commonjsRequire=="function"&&typeof process<"u"&&typeof process.release<"u"&&process.release.name==="node"&&!IS_ELECTRON,IS_WEBWORKER=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,IS_TEST=typeof process<"u"&&typeof define_process_env_default<"u"&&!1,IS_REACT_NATIVE=typeof navigator<"u"&&navigator.product==="ReactNative";var env={isTest:IS_TEST,isElectron:IS_ELECTRON,isElectronMain:IS_ELECTRON_MAIN,isElectronRenderer:IS_ELECTRON_RENDERER,isNode:IS_NODE,isBrowser:IS_BROWSER,isWebWorker:IS_WEBWORKER,isEnvWithDom:IS_ENV_WITH_DOM,isReactNative:IS_REACT_NATIVE},browser$1={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var o=1e3,e=o*60,a=e*60,s=a*24,AA=s*7,eA=s*365.25;ms=function(uA,FA){FA=FA||{};var pA=typeof uA;if(pA==="string"&&uA.length>0)return BA(uA);if(pA==="number"&&isFinite(uA))return FA.long?nA(uA):oA(uA);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(uA))};function BA(uA){if(uA=String(uA),!(uA.length>100)){var FA=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(uA);if(FA){var pA=parseFloat(FA[1]),zA=(FA[2]||"ms").toLowerCase();switch(zA){case"years":case"year":case"yrs":case"yr":case"y":return pA*eA;case"weeks":case"week":case"w":return pA*AA;case"days":case"day":case"d":return pA*s;case"hours":case"hour":case"hrs":case"hr":case"h":return pA*a;case"minutes":case"minute":case"mins":case"min":case"m":return pA*e;case"seconds":case"second":case"secs":case"sec":case"s":return pA*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return pA;default:return}}}}function oA(uA){var FA=Math.abs(uA);return FA>=s?Math.round(uA/s)+"d":FA>=a?Math.round(uA/a)+"h":FA>=e?Math.round(uA/e)+"m":FA>=o?Math.round(uA/o)+"s":uA+"ms"}function nA(uA){var FA=Math.abs(uA);return FA>=s?hA(uA,FA,s,"day"):FA>=a?hA(uA,FA,a,"hour"):FA>=e?hA(uA,FA,e,"minute"):FA>=o?hA(uA,FA,o,"second"):uA+" ms"}function hA(uA,FA,pA,zA){var LA=FA>=pA*1.5;return Math.round(uA/pA)+" "+zA+(LA?"s":"")}return ms}function setup(o){a.debug=a,a.default=a,a.coerce=nA,a.disable=eA,a.enable=AA,a.enabled=BA,a.humanize=requireMs(),a.destroy=hA,Object.keys(o).forEach(uA=>{a[uA]=o[uA]}),a.names=[],a.skips=[],a.formatters={};function e(uA){let FA=0;for(let pA=0;pA{if(BI==="%%")return"%";iI++;const CI=a.formatters[jA];if(typeof CI=="function"){const VA=QI[iI];BI=CI.call(_A,VA),QI.splice(iI,1),iI--}return BI}),a.formatArgs.call(_A,QI),(_A.log||a.log).apply(_A,QI)}return YA.namespace=uA,YA.useColors=a.useColors(),YA.color=a.selectColor(uA),YA.extend=s,YA.destroy=a.destroy,Object.defineProperty(YA,"enabled",{enumerable:!0,configurable:!1,get:()=>pA!==null?pA:(zA!==a.namespaces&&(zA=a.namespaces,LA=a.enabled(uA)),LA),set:QI=>{pA=QI}}),typeof a.init=="function"&&a.init(YA),YA}function s(uA,FA){const pA=a(this.namespace+(typeof FA>"u"?":":FA)+uA);return pA.log=this.log,pA}function AA(uA){a.save(uA),a.namespaces=uA,a.names=[],a.skips=[];let FA;const pA=(typeof uA=="string"?uA:"").split(/[\s,]+/),zA=pA.length;for(FA=0;FA"-"+FA)].join(",");return a.enable(""),uA}function BA(uA){if(uA[uA.length-1]==="*")return!0;let FA,pA;for(FA=0,pA=a.skips.length;FA{let hA=!1;return()=>{hA||(hA=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function s(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function AA(hA){if(hA[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+hA[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const uA="color: "+this.color;hA.splice(1,0,uA,"color: inherit");let FA=0,pA=0;hA[0].replace(/%[a-zA-Z%]/g,zA=>{zA!=="%%"&&(FA++,zA==="%c"&&(pA=FA))}),hA.splice(pA,0,uA)}e.log=console.debug||console.log||(()=>{});function eA(hA){try{hA?e.storage.setItem("debug",hA):e.storage.removeItem("debug")}catch{}}function BA(){let hA;try{hA=e.storage.getItem("debug")}catch{}return!hA&&typeof process<"u"&&"env"in process&&(hA=a.DEBUG),hA}function oA(){try{return localStorage}catch{}}o.exports=common(e);const{formatters:nA}=o.exports;nA.j=function(hA){try{return JSON.stringify(hA)}catch(uA){return"[UnexpectedJSONParseError]: "+uA.message}}})(browser$1,browser$1.exports);var browserExports=browser$1.exports;const debug=getDefaultExportFromCjs(browserExports);debug.formatters.b=o=>o==null?"undefined":base58btc$1.baseEncode(o);debug.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);debug.formatters.m=o=>o==null?"undefined":base64$4.baseEncode(o);debug.formatters.p=o=>o==null?"undefined":o.toString();debug.formatters.c=o=>o==null?"undefined":o.toString();debug.formatters.k=o=>o==null?"undefined":o.toString();debug.formatters.a=o=>o==null?"undefined":o.toString();function createDisabledLogger(o){const e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=o,e.destroy=()=>!0,e.extend=()=>e,e}function logger(o){let e=createDisabledLogger(`${o}:trace`);return debug.enabled(`${o}:trace`)&&debug.names.map(a=>a.toString()).find(a=>a.includes(":trace"))!=null&&(e=debug(`${o}:trace`)),Object.assign(debug(o),{error:debug(`${o}:error`),trace:e})}var error={};let TimeoutError$2=class extends Error{constructor(e="Request timed out"){super(e),this.name="TimeoutError"}};error.TimeoutError=TimeoutError$2;let AbortError$1=class extends Error{constructor(e="The operation was aborted."){super(e),this.name="AbortError"}};error.AbortError=AbortError$1;let HTTPError$1=class extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}};error.HTTPError=HTTPError$1;var src$1={exports:{}},browser={exports:{}},hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,function(o,e){var a=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof commonjsGlobal<"u")return commonjsGlobal;throw new Error("unable to locate global object")},s=a();o.exports=e=s.fetch,s.fetch&&(e.default=s.fetch.bind(s)),e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response}(browser,browser.exports)),browser.exports}globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?src$1.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:src$1.exports={default:requireBrowser().default,Headers:requireBrowser().Headers,Request:requireBrowser().Request,Response:requireBrowser().Response};var srcExports=src$1.exports,fetch_browser$1=srcExports;const{TimeoutError:TimeoutError$1,AbortError}=error,{Response:Response$1,Request:Request$2,Headers:Headers$2,default:fetch$2}=fetch_browser$1,fetchWithProgress=(o,e={})=>{const a=new XMLHttpRequest;a.open(e.method||"GET",o.toString(),!0);const{timeout:s,headers:AA}=e;if(s&&s>0&&s<1/0&&(a.timeout=s),e.overrideMimeType!=null&&a.overrideMimeType(e.overrideMimeType),AA)for(const[eA,BA]of new Headers$2(AA))a.setRequestHeader(eA,BA);return e.signal&&(e.signal.onabort=()=>a.abort()),e.onUploadProgress&&(a.upload.onprogress=e.onUploadProgress),a.responseType="arraybuffer",new Promise((eA,BA)=>{const oA=nA=>{switch(nA.type){case"error":{eA(Response$1.error());break}case"load":{eA(new ResponseWithURL(a.responseURL,a.response,{status:a.status,statusText:a.statusText,headers:parseHeaders(a.getAllResponseHeaders())}));break}case"timeout":{BA(new TimeoutError$1);break}case"abort":{BA(new AbortError);break}}};a.onerror=oA,a.onload=oA,a.ontimeout=oA,a.onabort=oA,a.send(e.body)})},fetchWithStreaming=fetch$2,fetchWith=(o,e={})=>e.onUploadProgress!=null?fetchWithProgress(o,e):fetchWithStreaming(o,e),parseHeaders=o=>{const e=new Headers$2;for(const a of o.trim().split(/[\r\n]+/)){const s=a.indexOf(": ");s>0&&e.set(a.slice(0,s),a.slice(s+1))}return e};class ResponseWithURL extends Response$1{constructor(e,a,s){super(a,s),Object.defineProperty(this,"url",{value:e})}}var fetch_browser={fetch:fetchWith,Request:Request$2,Headers:Headers$2},isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const e=Object.getPrototypeOf(o);return e===null||e===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty=(o,e,a)=>Object.defineProperty(o,e,{value:a,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const e=[];for(const a in o)hasOwnProperty.call(o,a)&&e.push(a);if(Object.getOwnPropertySymbols){const a=Object.getOwnPropertySymbols(o);for(const s of a)propertyIsEnumerable.call(o,s)&&e.push(s)}return e};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const e=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(a=>{defineProperty(e,a,clone(o[a]))}),e}function cloneOptionObject(o){const e=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(a=>{defineProperty(e,a,clone(o[a]))}),e}const mergeKeys=(o,e,a,s)=>(a.forEach(AA=>{typeof e[AA]>"u"&&s.ignoreUndefined||(AA in o&&o[AA]!==Object.getPrototypeOf(o)?defineProperty(o,AA,merge$1(o[AA],e[AA],s)):defineProperty(o,AA,clone(e[AA])))}),o),concatArrays=(o,e,a)=>{let s=o.slice(0,0),AA=0;return[o,e].forEach(eA=>{const BA=[];for(let oA=0;oA!BA.includes(oA)),a)}),s};function merge$1(o,e,a){return a.concatArrays&&Array.isArray(o)&&Array.isArray(e)?concatArrays(o,e,a):!isOptionObject(e)||!isOptionObject(o)?clone(e):mergeKeys(o,e,getEnumerableOwnPropertyKeys(e),a)}var mergeOptions=function(...o){const e=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let a={_:{}};for(const s of o)if(s!==void 0){if(!isOptionObject(s))throw new TypeError("`"+s+"` is not an Option Object");a=merge$1(a,{_:s},e)}return a._};const mergeOpts=getDefaultExportFromCjs(mergeOptions),isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative";function getDefaultBase(){return isReactNative?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}const URL$2=self.URL,defaultBase$1=getDefaultBase();let URLWithLegacySupport$2=class{constructor(e="",a=defaultBase$1){this.super=new URL$2(e,a),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return URL$2.createObjectURL(e)}static revokeObjectURL(e){URL$2.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function format$2(o){if(typeof o=="string")return new URL$2(o).toString();if(!(o instanceof URL$2)){const e=o.username&&o.password?`${o.username}:${o.password}@`:"",a=o.auth?o.auth+"@":"",s=o.port?":"+o.port:"",AA=o.protocol?o.protocol+"//":"",eA=o.host||"",BA=o.hostname||"",oA=o.search||(o.query?"?"+o.query:""),nA=o.hash||"",hA=o.pathname||"",uA=o.path||hA+oA;return`${AA}${e||a}${eA||BA+s}${uA}${nA}`}}var urlBrowser={URLWithLegacySupport:URLWithLegacySupport$2,URLSearchParams:self.URLSearchParams,defaultBase:defaultBase$1,format:format$2};const{URLWithLegacySupport:URLWithLegacySupport$1,format:format$1}=urlBrowser;var relative$1=(o,e={},a={},s)=>{let AA=e.protocol?e.protocol.replace(":",""):"http";AA=(a[AA]||s||AA)+":";let eA;try{eA=new URLWithLegacySupport$1(o)}catch{eA={}}const BA=Object.assign({},e,{protocol:AA||eA.protocol,host:e.host||eA.host});return new URLWithLegacySupport$1(o,format$1(BA)).toString()};const{URLWithLegacySupport,format,URLSearchParams:URLSearchParams$2,defaultBase}=urlBrowser,relative=relative$1;var isoUrl={URL:URLWithLegacySupport,URLSearchParams:URLSearchParams$2,format,relative,defaultBase},anySignal$2={exports:{}};function anySignal$1(o){const e=new globalThis.AbortController;function a(){e.abort();for(const s of o)!s||!s.removeEventListener||s.removeEventListener("abort",a)}for(const s of o)if(!(!s||!s.addEventListener)){if(s.aborted){a();break}s.addEventListener("abort",a)}return e.signal}anySignal$2.exports=anySignal$1;anySignal$2.exports.anySignal=anySignal$1;var anySignalExports=anySignal$2.exports;async function*browserReadableStreamToIt(o,e={}){const a=o.getReader();try{for(;;){const s=await a.read();if(s.done)return;yield s.value}}finally{e.preventCancel!==!0&&a.cancel(),a.releaseLock()}}var browserReadablestreamToIt=browserReadableStreamToIt;const all$1=async o=>{const e=[];for await(const a of o)e.push(a);return e};var itAll=all$1;const{fetch:fetch$1,Request:Request$1,Headers:Headers$1}=fetch_browser,{TimeoutError,HTTPError}=error,merge=mergeOptions.bind({ignoreUndefined:!0}),{URL:URL$1,URLSearchParams:URLSearchParams$1}=isoUrl,anySignal=anySignalExports,browserReableStreamToIt=browserReadablestreamToIt,{isBrowser,isWebWorker}=env,all=itAll,timeout=(o,e,a)=>{if(e===void 0)return o;const s=Date.now(),AA=()=>Date.now()-s>=e;return new Promise((eA,BA)=>{const oA=setTimeout(()=>{AA()&&(BA(new TimeoutError),a.abort())},e),nA=hA=>FA=>{if(clearTimeout(oA),AA()){BA(new TimeoutError);return}hA(FA)};o.then(nA(eA),nA(BA))})},defaults={throwHttpErrors:!0,credentials:"same-origin"};class HTTP{constructor(e={}){this.opts=merge(defaults,e)}async fetch(e,a={}){const s=merge(this.opts,a),AA=new Headers$1(s.headers);if(typeof e!="string"&&!(e instanceof URL$1||e instanceof Request$1))throw new TypeError("`resource` must be a string, URL, or Request");const eA=new URL$1(e.toString(),s.base),{searchParams:BA,transformSearchParams:oA,json:nA}=s;BA&&(typeof oA=="function"?eA.search=oA(new URLSearchParams$1(s.searchParams)):eA.search=new URLSearchParams$1(s.searchParams)),nA&&(s.body=JSON.stringify(s.json),AA.set("content-type","application/json"));const hA=new AbortController,uA=anySignal([hA.signal,s.signal]);globalThis.ReadableStream!=null&&s.body instanceof globalThis.ReadableStream&&(isBrowser||isWebWorker)&&(s.body=new Blob(await all(browserReableStreamToIt(s.body))));const FA=await timeout(fetch$1(eA.toString(),{...s,signal:uA,timeout:void 0,headers:AA,duplex:"half"}),s.timeout,hA);if(!FA.ok&&s.throwHttpErrors)throw s.handleError&&await s.handleError(FA),new HTTPError(FA);return FA.iterator=async function*(){yield*fromStream(FA.body)},FA.ndjson=async function*(){for await(const pA of ndjson(FA.iterator()))a.transform?yield a.transform(pA):yield pA},FA}post(e,a={}){return this.fetch(e,{...a,method:"POST"})}get(e,a={}){return this.fetch(e,{...a,method:"GET"})}put(e,a={}){return this.fetch(e,{...a,method:"PUT"})}delete(e,a={}){return this.fetch(e,{...a,method:"DELETE"})}options(e,a={}){return this.fetch(e,{...a,method:"OPTIONS"})}}const ndjson=async function*(o){const e=new TextDecoder;let a="";for await(const s of o){a+=e.decode(s,{stream:!0});const AA=a.split(/\r?\n/);for(let eA=0;eA0&&(yield JSON.parse(BA))}a=AA[AA.length-1]}a+=e.decode(),a=a.trim(),a.length!==0&&(yield JSON.parse(a))},fromStream=o=>{if(isAsyncIterable(o))return o;if(isNodeReadableStream(o)){const e=o[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:e.next.bind(e),return(a){return o.destroy(),typeof e.return=="function"?e.return():Promise.resolve({done:!0,value:a})}}}}}if(isWebReadableStream(o)){const e=o.getReader();return async function*(){try{for(;;){const{done:a,value:s}=await e.read();if(a)return;s&&(yield s)}}finally{e.releaseLock()}}()}throw new TypeError("Body can't be converted to AsyncIterable")},isAsyncIterable=o=>typeof o=="object"&&o!==null&&typeof o[Symbol.asyncIterator]=="function",isWebReadableStream=o=>o&&typeof o.getReader=="function",isNodeReadableStream=o=>Object.prototype.hasOwnProperty.call(o,"readable")&&Object.prototype.hasOwnProperty.call(o,"writable");HTTP.HTTPError=HTTPError;HTTP.TimeoutError=TimeoutError;HTTP.streamToAsyncIterator=fromStream;HTTP.post=(o,e)=>new HTTP(e).post(o,e);HTTP.get=(o,e)=>new HTTP(e).get(o,e);HTTP.put=(o,e)=>new HTTP(e).put(o,e);HTTP.delete=(o,e)=>new HTTP(e).delete(o,e);HTTP.options=(o,e)=>new HTTP(e).options(o,e);var http=HTTP;const HTTP$1=getDefaultExportFromCjs(http);function coerce(o){if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")}function fromString(o){return new TextEncoder().encode(o)}function toString$1(o){return new TextDecoder().decode(o)}function base(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src=base,_brrp__multiformats_scope_baseX=src;class Encoder{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or(this,e)}}class ComposedDecoder{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or(o,e){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}class Codec{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder(e,a,s),this.decoder=new Decoder(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function from({name:o,prefix:e,encode:a,decode:s}){return new Codec(o,e,a,s)}function baseX({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX(a,o);return from({prefix:e,name:o,encode:s,decode:eA=>coerce(AA(eA))})}function decode$1(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$1(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<(o[a]=e,o),[]),alphabetCharsToBytes=alphabet.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars[a],e),"")}function decode(o){const e=[];for(const a of o){const s=alphabetCharsToBytes[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}const base256emoji=from({prefix:"šŸš€",name:"base256emoji",encode,decode}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity=from({prefix:"\0",name:"identity",encode:o=>toString$1(o),decode:o=>fromString(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$3,...base256emoji$1},V=-1,names={},codes={},table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V,"ip6zone"],[43,8,"ipcidr"],[53,V,"dns",!0],[54,V,"dns4",!0],[55,V,"dns6",!0],[56,V,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V,"unix",!1,!0],[421,V,"ipfs"],[421,V,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V,"garlic64"],[448,0,"tls"],[449,V,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V,"memory"]];table.forEach(o=>{const e=createProtocol(...o);codes[e.code]=e,names[e.name]=e});function createProtocol(o,e,a,s,AA){return{code:o,size:e,name:a,resolvable:!!s,path:!!AA}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");const decoders=Object.values(bases).map(o=>o.decoder);(function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(e=>o=o.or(e)),o})();getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code;logger("ipfs-http-client:lib:error-handler");mergeOpts.bind({ignoreUndefined:!0});HTTP$1.HTTPError;Object.values(bases$1).map(o=>o.decoder).reduce((o,e)=>o.or(e),bases$1.identity.decoder);var indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(o,e){for(var a=new Array(arguments.length-1),s=0,AA=2,eA=!0;AA1&&oA.charAt(nA)==="=";)++hA;return Math.ceil(oA.length*3)/4-hA};for(var a=new Array(64),s=new Array(123),AA=0;AA<64;)s[a[AA]=AA<26?AA+65:AA<52?AA+71:AA<62?AA-4:AA-59|43]=AA++;e.encode=function(oA,nA,hA){for(var uA=null,FA=[],pA=0,zA=0,LA;nA>2],LA=(YA&3)<<4,zA=1;break;case 1:FA[pA++]=a[LA|YA>>4],LA=(YA&15)<<2,zA=2;break;case 2:FA[pA++]=a[LA|YA>>6],FA[pA++]=a[YA&63],zA=0;break}pA>8191&&((uA||(uA=[])).push(String.fromCharCode.apply(String,FA)),pA=0)}return zA&&(FA[pA++]=a[LA],FA[pA++]=61,zA===1&&(FA[pA++]=61)),uA?(pA&&uA.push(String.fromCharCode.apply(String,FA.slice(0,pA))),uA.join("")):String.fromCharCode.apply(String,FA.slice(0,pA))};var eA="invalid encoding";e.decode=function(oA,nA,hA){for(var uA=hA,FA=0,pA,zA=0;zA1)break;if((LA=s[LA])===void 0)throw Error(eA);switch(FA){case 0:pA=LA,FA=1;break;case 1:nA[hA++]=pA<<2|(LA&48)>>4,pA=LA,FA=2;break;case 2:nA[hA++]=(pA&15)<<4|(LA&60)>>2,pA=LA,FA=3;break;case 3:nA[hA++]=(pA&3)<<6|LA,FA=0;break}}if(FA===1)throw Error(eA);return hA-uA},e.test=function(oA){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(oA)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,a,s){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:a,ctx:s||this}),this};EventEmitter.prototype.off=function(e,a){if(e===void 0)this._listeners={};else if(a===void 0)this._listeners[e]=[];else for(var s=this._listeners[e],AA=0;AA0?0:2147483648,eA,BA);else if(isNaN(AA))s(2143289344,eA,BA);else if(AA>34028234663852886e22)s((oA<<31|2139095040)>>>0,eA,BA);else if(AA<11754943508222875e-54)s((oA<<31|Math.round(AA/1401298464324817e-60))>>>0,eA,BA);else{var nA=Math.floor(Math.log(AA)/Math.LN2),hA=Math.round(AA*Math.pow(2,-nA)*8388608)&8388607;s((oA<<31|nA+127<<23|hA)>>>0,eA,BA)}}o.writeFloatLE=e.bind(null,writeUintLE),o.writeFloatBE=e.bind(null,writeUintBE);function a(s,AA,eA){var BA=s(AA,eA),oA=(BA>>31)*2+1,nA=BA>>>23&255,hA=BA&8388607;return nA===255?hA?NaN:oA*(1/0):nA===0?oA*1401298464324817e-60*hA:oA*Math.pow(2,nA-150)*(hA+8388608)}o.readFloatLE=a.bind(null,readUintLE),o.readFloatBE=a.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),a=new Uint8Array(e.buffer),s=a[7]===128;function AA(nA,hA,uA){e[0]=nA,hA[uA]=a[0],hA[uA+1]=a[1],hA[uA+2]=a[2],hA[uA+3]=a[3],hA[uA+4]=a[4],hA[uA+5]=a[5],hA[uA+6]=a[6],hA[uA+7]=a[7]}function eA(nA,hA,uA){e[0]=nA,hA[uA]=a[7],hA[uA+1]=a[6],hA[uA+2]=a[5],hA[uA+3]=a[4],hA[uA+4]=a[3],hA[uA+5]=a[2],hA[uA+6]=a[1],hA[uA+7]=a[0]}o.writeDoubleLE=s?AA:eA,o.writeDoubleBE=s?eA:AA;function BA(nA,hA){return a[0]=nA[hA],a[1]=nA[hA+1],a[2]=nA[hA+2],a[3]=nA[hA+3],a[4]=nA[hA+4],a[5]=nA[hA+5],a[6]=nA[hA+6],a[7]=nA[hA+7],e[0]}function oA(nA,hA){return a[7]=nA[hA],a[6]=nA[hA+1],a[5]=nA[hA+2],a[4]=nA[hA+3],a[3]=nA[hA+4],a[2]=nA[hA+5],a[1]=nA[hA+6],a[0]=nA[hA+7],e[0]}o.readDoubleLE=s?BA:oA,o.readDoubleBE=s?oA:BA}():function(){function e(s,AA,eA,BA,oA,nA){var hA=BA<0?1:0;if(hA&&(BA=-BA),BA===0)s(0,oA,nA+AA),s(1/BA>0?0:2147483648,oA,nA+eA);else if(isNaN(BA))s(0,oA,nA+AA),s(2146959360,oA,nA+eA);else if(BA>17976931348623157e292)s(0,oA,nA+AA),s((hA<<31|2146435072)>>>0,oA,nA+eA);else{var uA;if(BA<22250738585072014e-324)uA=BA/5e-324,s(uA>>>0,oA,nA+AA),s((hA<<31|uA/4294967296)>>>0,oA,nA+eA);else{var FA=Math.floor(Math.log(BA)/Math.LN2);FA===1024&&(FA=1023),uA=BA*Math.pow(2,-FA),s(uA*4503599627370496>>>0,oA,nA+AA),s((hA<<31|FA+1023<<20|uA*1048576&1048575)>>>0,oA,nA+eA)}}}o.writeDoubleLE=e.bind(null,writeUintLE,0,4),o.writeDoubleBE=e.bind(null,writeUintBE,4,0);function a(s,AA,eA,BA,oA){var nA=s(BA,oA+AA),hA=s(BA,oA+eA),uA=(hA>>31)*2+1,FA=hA>>>20&2047,pA=4294967296*(hA&1048575)+nA;return FA===2047?pA?NaN:uA*(1/0):FA===0?uA*5e-324*pA:uA*Math.pow(2,FA-1075)*(pA+4503599627370496)}o.readDoubleLE=a.bind(null,readUintLE,0,4),o.readDoubleBE=a.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,e,a){e[a]=o&255,e[a+1]=o>>>8&255,e[a+2]=o>>>16&255,e[a+3]=o>>>24}function writeUintBE(o,e,a){e[a]=o>>>24,e[a+1]=o>>>16&255,e[a+2]=o>>>8&255,e[a+3]=o&255}function readUintLE(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0}function readUintBE(o,e){return(o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(o){}return null}var utf8$2={};(function(o){var e=o;e.length=function(s){for(var AA=0,eA=0,BA=0;BA191&&uA<224?nA[hA++]=(uA&31)<<6|s[AA++]&63:uA>239&&uA<365?(uA=((uA&7)<<18|(s[AA++]&63)<<12|(s[AA++]&63)<<6|s[AA++]&63)-65536,nA[hA++]=55296+(uA>>10),nA[hA++]=56320+(uA&1023)):nA[hA++]=(uA&15)<<12|(s[AA++]&63)<<6|s[AA++]&63,hA>8191&&((oA||(oA=[])).push(String.fromCharCode.apply(String,nA)),hA=0);return oA?(hA&&oA.push(String.fromCharCode.apply(String,nA.slice(0,hA))),oA.join("")):String.fromCharCode.apply(String,nA.slice(0,hA))},e.write=function(s,AA,eA){for(var BA=eA,oA,nA,hA=0;hA>6|192,AA[eA++]=oA&63|128):(oA&64512)===55296&&((nA=s.charCodeAt(hA+1))&64512)===56320?(oA=65536+((oA&1023)<<10)+(nA&1023),++hA,AA[eA++]=oA>>18|240,AA[eA++]=oA>>12&63|128,AA[eA++]=oA>>6&63|128,AA[eA++]=oA&63|128):(AA[eA++]=oA>>12|224,AA[eA++]=oA>>6&63|128,AA[eA++]=oA&63|128);return eA-BA}})(utf8$2);var pool_1=pool;function pool(o,e,a){var s=a||8192,AA=s>>>1,eA=null,BA=s;return function(nA){if(nA<1||nA>AA)return o(nA);BA+nA>s&&(eA=o(s),BA=0);var hA=e.call(eA,BA,BA+=nA);return BA&7&&(BA=(BA|7)+1),hA}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=e;var o=requireMinimal();function e(eA,BA){this.lo=eA>>>0,this.hi=BA>>>0}var a=e.zero=new e(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var s=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(BA){if(BA===0)return a;var oA=BA<0;oA&&(BA=-BA);var nA=BA>>>0,hA=(BA-nA)/4294967296>>>0;return oA&&(hA=~hA>>>0,nA=~nA>>>0,++nA>4294967295&&(nA=0,++hA>4294967295&&(hA=0))),new e(nA,hA)},e.from=function(BA){if(typeof BA=="number")return e.fromNumber(BA);if(o.isString(BA))if(o.Long)BA=o.Long.fromString(BA);else return e.fromNumber(parseInt(BA,10));return BA.low||BA.high?new e(BA.low>>>0,BA.high>>>0):a},e.prototype.toNumber=function(BA){if(!BA&&this.hi>>>31){var oA=~this.lo+1>>>0,nA=~this.hi>>>0;return oA||(nA=nA+1>>>0),-(oA+nA*4294967296)}return this.lo+this.hi*4294967296},e.prototype.toLong=function(BA){return o.Long?new o.Long(this.lo|0,this.hi|0,!!BA):{low:this.lo|0,high:this.hi|0,unsigned:!!BA}};var AA=String.prototype.charCodeAt;return e.fromHash=function(BA){return BA===s?a:new e((AA.call(BA,0)|AA.call(BA,1)<<8|AA.call(BA,2)<<16|AA.call(BA,3)<<24)>>>0,(AA.call(BA,4)|AA.call(BA,5)<<8|AA.call(BA,6)<<16|AA.call(BA,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var BA=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^BA)>>>0,this.lo=(this.lo<<1^BA)>>>0,this},e.prototype.zzDecode=function(){var BA=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^BA)>>>0,this.hi=(this.hi>>>1^BA)>>>0,this},e.prototype.length=function(){var BA=this.lo,oA=(this.lo>>>28|this.hi<<4)>>>0,nA=this.hi>>>24;return nA===0?oA===0?BA<16384?BA<128?1:2:BA<2097152?3:4:oA<16384?oA<128?5:6:oA<2097152?7:8:nA<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(o){var e=o;e.asPromise=aspromise,e.base64=base64$1,e.EventEmitter=eventemitter,e.float=float,e.inquire=inquire_1,e.utf8=utf8$2,e.pool=pool_1,e.LongBits=requireLongbits(),e.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),e.global=e.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(eA){return typeof eA=="number"&&isFinite(eA)&&Math.floor(eA)===eA},e.isString=function(eA){return typeof eA=="string"||eA instanceof String},e.isObject=function(eA){return eA&&typeof eA=="object"},e.isset=e.isSet=function(eA,BA){var oA=eA[BA];return oA!=null&&eA.hasOwnProperty(BA)?typeof oA!="object"||(Array.isArray(oA)?oA.length:Object.keys(oA).length)>0:!1},e.Buffer=function(){try{var AA=e.inquire("buffer").Buffer;return AA.prototype.utf8Write?AA:null}catch{return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(eA){return typeof eA=="number"?e.Buffer?e._Buffer_allocUnsafe(eA):new e.Array(eA):e.Buffer?e._Buffer_from(eA):typeof Uint8Array>"u"?eA:new Uint8Array(eA)},e.Array=typeof Uint8Array<"u"?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(eA){return eA?e.LongBits.from(eA).toHash():e.LongBits.zeroHash},e.longFromHash=function(eA,BA){var oA=e.LongBits.fromHash(eA);return e.Long?e.Long.fromBits(oA.lo,oA.hi,BA):oA.toNumber(!!BA)};function a(AA,eA,BA){for(var oA=Object.keys(eA),nA=0;nA-1;--hA)if(BA[nA[hA]]===1&&this[nA[hA]]!==void 0&&this[nA[hA]]!==null)return nA[hA]}},e.oneOfSetter=function(eA){return function(BA){for(var oA=0;oA127;)e[a++]=o&127|128,o>>>=7;e[a]=o}function VarintOp(o,e){this.len=o,this.next=void 0,this.val=e}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Writer$1.prototype.int32=function o(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)};Writer$1.prototype.sint32=function o(e){return this.uint32((e<<1^e>>31)>>>0)};function writeVarint64(o,e,a){for(;o.hi;)e[a++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)e[a++]=o.lo&127|128,o.lo=o.lo>>>7;e[a++]=o.lo}Writer$1.prototype.uint64=function o(e){var a=LongBits$1.from(e);return this._push(writeVarint64,a.length(),a)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(e){var a=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,a.length(),a)};Writer$1.prototype.bool=function o(e){return this._push(writeByte,1,e?1:0)};function writeFixed32(o,e,a){e[a]=o&255,e[a+1]=o>>>8&255,e[a+2]=o>>>16&255,e[a+3]=o>>>24}Writer$1.prototype.fixed32=function o(e){return this._push(writeFixed32,4,e>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(e){var a=LongBits$1.from(e);return this._push(writeFixed32,4,a.lo)._push(writeFixed32,4,a.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function o(e){return this._push(util$4.float.writeFloatLE,4,e)};Writer$1.prototype.double=function o(e){return this._push(util$4.float.writeDoubleLE,8,e)};var writeBytes=util$4.Array.prototype.set?function o(e,a,s){a.set(e,s)}:function o(e,a,s){for(var AA=0;AA>>0;if(!a)return this._push(writeByte,1,0);if(util$4.isString(e)){var s=Writer$1.alloc(a=base64.length(e));base64.decode(e,s,0),e=s}return this.uint32(a)._push(writeBytes,a,e)};Writer$1.prototype.string=function o(e){var a=utf8$1.length(e);return a?this.uint32(a)._push(utf8$1.write,a,e):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function o(){var e=this.head,a=this.tail,s=this.len;return this.reset().uint32(s),s&&(this.tail.next=e.next,this.tail=a,this.len+=s),this};Writer$1.prototype.finish=function o(){for(var e=this.head.next,a=this.constructor.alloc(this.len),s=0;e;)e.fn(e.val,a,s),s+=e.len,e=e.next;return a};Writer$1._configure=function(o){BufferWriter$1=o,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(e,a,s){a.set(e,s)}:function(e,a,s){if(e.copy)e.copy(a,s,0,e.length);else for(var AA=0;AA>>0;return this.uint32(a),a&&this._push(BufferWriter.writeBytesBuffer,a,e),this};function writeStringBuffer(o,e,a){o.length<40?util$3.utf8.write(o,e,a):e.utf8Write?e.utf8Write(o,a):e.write(o,a)}BufferWriter.prototype.string=function o(e){var a=util$3.Buffer.byteLength(e);return this.uint32(a),a&&this._push(writeStringBuffer,a,e),this};BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(o,e){return RangeError("index out of range: "+o.pos+" + "+(e||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")}:function o(e){if(Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")},create=function o(){return util$2.Buffer?function(a){return(Reader$1.create=function(AA){return util$2.Buffer.isBuffer(AA)?new BufferReader$1(AA):create_array(AA)})(a)}:create_array};Reader$1.create=create();Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice;Reader$1.prototype.uint32=function o(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return e}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var e=this.uint32();return e>>>1^-(e&1)|0};function readLongVarint(){var o=new LongBits(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;e<5;++e)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;e<5;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,e){return(o[e-4]|o[e-3]<<8|o[e-2]<<16|o[e-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Reader$1.prototype.bytes=function o(){var e=this.uint32(),a=this.pos,s=this.pos+e;if(s>this.len)throw indexOutOfRange(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(a,s);if(a===s){var AA=util$2.Buffer;return AA?AA.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,a,s)};Reader$1.prototype.string=function o(){var e=this.bytes();return utf8.read(e,0,e.length)};Reader$1.prototype.skip=function o(e){if(typeof e=="number"){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create(),BufferReader$1._configure();var e=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[e](!1)},uint64:function(){return readLongVarint.call(this)[e](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[e](!1)},fixed64:function(){return readFixed64.call(this)[e](!0)},sfixed64:function(){return readFixed64.call(this)[e](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(o,e,a){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!e,this.responseDelimited=!!a}Service.prototype.rpcCall=function o(e,a,s,AA,eA){if(!AA)throw TypeError("request must be specified");var BA=this;if(!eA)return util.asPromise(o,BA,e,a,s,AA);if(!BA.rpcImpl){setTimeout(function(){eA(Error("already ended"))},0);return}try{return BA.rpcImpl(e,a[BA.requestDelimited?"encodeDelimited":"encode"](AA).finish(),function(nA,hA){if(nA)return BA.emit("error",nA,e),eA(nA);if(hA===null){BA.end(!0);return}if(!(hA instanceof s))try{hA=s[BA.responseDelimited?"decodeDelimited":"decode"](hA)}catch(uA){return BA.emit("error",uA,e),eA(uA)}return BA.emit("data",hA,e),eA(null,hA)})}catch(oA){BA.emit("error",oA,e),setTimeout(function(){eA(oA)},0);return}};Service.prototype.end=function o(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var e=o;e.Service=service})(rpc);var roots={};(function(o){var e=o;e.build="minimal",e.Writer=writer,e.BufferWriter=writer_buffer,e.Reader=reader,e.BufferReader=reader_buffer,e.util=requireMinimal(),e.rpc=rpc,e.roots=roots,e.configure=a;function a(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}a()})(indexMinimal);var minimal=indexMinimal;const $protobuf=getDefaultExportFromCjs(minimal),$Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots["ipfs-unixfs"]||($protobuf.roots["ipfs-unixfs"]={});$root.Data=(()=>{function o(e){if(this.blocksizes=[],e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.Type=a.int32();break;case 2:eA.Data=a.bytes();break;case 3:eA.filesize=a.uint64();break;case 4:if(eA.blocksizes&&eA.blocksizes.length||(eA.blocksizes=[]),(BA&7)===2)for(var oA=a.uint32()+a.pos;a.pos>>0,a.filesize.high>>>0).toNumber(!0))),a.blocksizes){if(!Array.isArray(a.blocksizes))throw TypeError(".Data.blocksizes: array expected");s.blocksizes=[];for(var AA=0;AA>>0,a.blocksizes[AA].high>>>0).toNumber(!0))}if(a.hashType!=null&&($util.Long?(s.hashType=$util.Long.fromValue(a.hashType)).unsigned=!0:typeof a.hashType=="string"?s.hashType=parseInt(a.hashType,10):typeof a.hashType=="number"?s.hashType=a.hashType:typeof a.hashType=="object"&&(s.hashType=new $util.LongBits(a.hashType.low>>>0,a.hashType.high>>>0).toNumber(!0))),a.fanout!=null&&($util.Long?(s.fanout=$util.Long.fromValue(a.fanout)).unsigned=!0:typeof a.fanout=="string"?s.fanout=parseInt(a.fanout,10):typeof a.fanout=="number"?s.fanout=a.fanout:typeof a.fanout=="object"&&(s.fanout=new $util.LongBits(a.fanout.low>>>0,a.fanout.high>>>0).toNumber(!0))),a.mode!=null&&(s.mode=a.mode>>>0),a.mtime!=null){if(typeof a.mtime!="object")throw TypeError(".Data.mtime: object expected");s.mtime=$root.UnixTime.fromObject(a.mtime)}return s},o.toObject=function(a,s){s||(s={});var AA={};if((s.arrays||s.defaults)&&(AA.blocksizes=[]),s.defaults){if(AA.Type=s.enums===String?"Raw":0,s.bytes===String?AA.Data="":(AA.Data=[],s.bytes!==Array&&(AA.Data=$util.newBuffer(AA.Data))),$util.Long){var eA=new $util.Long(0,0,!0);AA.filesize=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.filesize=s.longs===String?"0":0;if($util.Long){var eA=new $util.Long(0,0,!0);AA.hashType=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.hashType=s.longs===String?"0":0;if($util.Long){var eA=new $util.Long(0,0,!0);AA.fanout=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.fanout=s.longs===String?"0":0;AA.mode=0,AA.mtime=null}if(a.Type!=null&&a.hasOwnProperty("Type")&&(AA.Type=s.enums===String?$root.Data.DataType[a.Type]:a.Type),a.Data!=null&&a.hasOwnProperty("Data")&&(AA.Data=s.bytes===String?$util.base64.encode(a.Data,0,a.Data.length):s.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.filesize!=null&&a.hasOwnProperty("filesize")&&(typeof a.filesize=="number"?AA.filesize=s.longs===String?String(a.filesize):a.filesize:AA.filesize=s.longs===String?$util.Long.prototype.toString.call(a.filesize):s.longs===Number?new $util.LongBits(a.filesize.low>>>0,a.filesize.high>>>0).toNumber(!0):a.filesize),a.blocksizes&&a.blocksizes.length){AA.blocksizes=[];for(var BA=0;BA>>0,a.blocksizes[BA].high>>>0).toNumber(!0):a.blocksizes[BA]}return a.hashType!=null&&a.hasOwnProperty("hashType")&&(typeof a.hashType=="number"?AA.hashType=s.longs===String?String(a.hashType):a.hashType:AA.hashType=s.longs===String?$util.Long.prototype.toString.call(a.hashType):s.longs===Number?new $util.LongBits(a.hashType.low>>>0,a.hashType.high>>>0).toNumber(!0):a.hashType),a.fanout!=null&&a.hasOwnProperty("fanout")&&(typeof a.fanout=="number"?AA.fanout=s.longs===String?String(a.fanout):a.fanout:AA.fanout=s.longs===String?$util.Long.prototype.toString.call(a.fanout):s.longs===Number?new $util.LongBits(a.fanout.low>>>0,a.fanout.high>>>0).toNumber(!0):a.fanout),a.mode!=null&&a.hasOwnProperty("mode")&&(AA.mode=a.mode),a.mtime!=null&&a.hasOwnProperty("mtime")&&(AA.mtime=$root.UnixTime.toObject(a.mtime,s)),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o.DataType=function(){const e={},a=Object.create(e);return a[e[0]="Raw"]=0,a[e[1]="Directory"]=1,a[e[2]="File"]=2,a[e[3]="Metadata"]=3,a[e[4]="Symlink"]=4,a[e[5]="HAMTShard"]=5,a}(),o})();$root.UnixTime=(()=>{function o(e){if(e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.Seconds=a.int64();break;case 2:eA.FractionalNanoseconds=a.fixed32();break;default:a.skipType(BA&7);break}}if(!eA.hasOwnProperty("Seconds"))throw $util.ProtocolError("missing required 'Seconds'",{instance:eA});return eA},o.fromObject=function(a){if(a instanceof $root.UnixTime)return a;var s=new $root.UnixTime;return a.Seconds!=null&&($util.Long?(s.Seconds=$util.Long.fromValue(a.Seconds)).unsigned=!1:typeof a.Seconds=="string"?s.Seconds=parseInt(a.Seconds,10):typeof a.Seconds=="number"?s.Seconds=a.Seconds:typeof a.Seconds=="object"&&(s.Seconds=new $util.LongBits(a.Seconds.low>>>0,a.Seconds.high>>>0).toNumber())),a.FractionalNanoseconds!=null&&(s.FractionalNanoseconds=a.FractionalNanoseconds>>>0),s},o.toObject=function(a,s){s||(s={});var AA={};if(s.defaults){if($util.Long){var eA=new $util.Long(0,0,!1);AA.Seconds=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.Seconds=s.longs===String?"0":0;AA.FractionalNanoseconds=0}return a.Seconds!=null&&a.hasOwnProperty("Seconds")&&(typeof a.Seconds=="number"?AA.Seconds=s.longs===String?String(a.Seconds):a.Seconds:AA.Seconds=s.longs===String?$util.Long.prototype.toString.call(a.Seconds):s.longs===Number?new $util.LongBits(a.Seconds.low>>>0,a.Seconds.high>>>0).toNumber():a.Seconds),a.FractionalNanoseconds!=null&&a.hasOwnProperty("FractionalNanoseconds")&&(AA.FractionalNanoseconds=a.FractionalNanoseconds),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o})();$root.Metadata=(()=>{function o(e){if(e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.MimeType=a.string();break;default:a.skipType(BA&7);break}}return eA},o.fromObject=function(a){if(a instanceof $root.Metadata)return a;var s=new $root.Metadata;return a.MimeType!=null&&(s.MimeType=String(a.MimeType)),s},o.toObject=function(a,s){s||(s={});var AA={};return s.defaults&&(AA.MimeType=""),a.MimeType!=null&&a.hasOwnProperty("MimeType")&&(AA.MimeType=a.MimeType),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o})();logger("ipfs-http-client:pubsub:subscribe");async function encryptFile(o,e){const a={name:o.name,type:o.type},s=JSON.stringify(a),eA=new TextEncoder().encode(s),BA=await readFileAsArrayBuffer(o);try{const oA=await window.crypto.subtle.encrypt(encryptionAlgorithm,e,BA),nA=await window.crypto.subtle.encrypt(encryptionAlgorithm,e,eA);return{encryptedFileData:bufferToBase64(oA),encryptedMetadata:bufferToBase64(nA),encryptionAlgorithm:{name:encryptionAlgorithm.name,length:encryptionAlgorithm.length,counter:encryptionAlgorithm.counter}}}catch(oA){throw console.error("Encryption failed:",oA),oA}}async function decryptFile(o,e){try{const a=convertCounterObjectToUint8Array(o.encryptionAlgorithm.counter),s=await window.crypto.subtle.decrypt({name:o.encryptionAlgorithm.name,counter:a,length:o.encryptionAlgorithm.length},e,base64ToArrayBuffer(o.encryptedFileData)),AA=await window.crypto.subtle.decrypt({name:o.encryptionAlgorithm.name,counter:a,length:o.encryptionAlgorithm.length},e,base64ToArrayBuffer(o.encryptedMetadata)),eA=new TextDecoder().decode(AA),BA=JSON.parse(eA);return{file:arrayBufferToFile(s,BA.name,BA.type)}}catch(a){throw console.error("Decryption failed:",a),a}}const uploadFileToIPFS=async o=>{const e="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI0ZDcyYWY4MS0xMmVjLTRlYzgtOTgzNi1hYzgxZDJmNWM3MmEiLCJlbWFpbCI6ImRpYWxsb3NlZ3VlQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaW5fcG9saWN5Ijp7InJlZ2lvbnMiOlt7ImlkIjoiRlJBMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfSx7ImlkIjoiTllDMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfV0sInZlcnNpb24iOjF9LCJtZmFfZW5hYmxlZCI6ZmFsc2UsInN0YXR1cyI6IkFDVElWRSJ9LCJhdXRoZW50aWNhdGlvblR5cGUiOiJzY29wZWRLZXkiLCJzY29wZWRLZXlLZXkiOiIyNjgwNGJkZGIxZWI5NGUwZGQ5ZSIsInNjb3BlZEtleVNlY3JldCI6ImY2YjhkMjk0MGU1MDE4ZWJmN2FjOGIwNWI3MThkZDE5MTliNTAxYTgxNjllMGU2ZDBjODNkOGE4ZDU3YTA1YjMiLCJpYXQiOjE3MTY0NDgzMzh9.3GeUk4N45fKAaMrtGoNI74pK1lnqEWO2YQayqmGc_cYd",a="https://api.pinata.cloud/pinning/pinFileToIPFS",s="https://blush-big-koala-295.mypinata.cloud",AA=JSON.stringify(o),BA=new TextEncoder().encode(AA),oA=new FormData;oA.append("file",new Blob([BA],{type:"application/json"}));{const nA=JSON.stringify({cidVersion:0});oA.append("pinataOptions",nA);try{const hA=await axios.post(a,oA,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"multipart/form-data"}});if(hA.status!==200)throw new Error(`IPFS upload failed: ${hA.statusText}`);return`${s}/ipfs/${hA.data.IpfsHash}`}catch(hA){throw console.error("Error uploading to IPFS via Pinata:",hA),hA}}};async function getEncryptedFileCidHash(o){try{const e=await fetch(o,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`Network response was not ok: ${e.statusText}`);return await e.json()}catch(e){throw console.error("Error fetching data:",e),e}}function r(o){var e,a,s="";if(typeof o=="string"||typeof o=="number")s+=o;else if(typeof o=="object")if(Array.isArray(o)){var AA=o.length;for(e=0;etypeof o=="number"&&!isNaN(o),d=o=>typeof o=="string",u=o=>typeof o=="function",p=o=>d(o)||u(o)?o:null,m=o=>reactExports.isValidElement(o)||d(o)||u(o)||c(o);function f(o,e,a){a===void 0&&(a=300);const{scrollHeight:s,style:AA}=o;requestAnimationFrame(()=>{AA.minHeight="initial",AA.height=s+"px",AA.transition=`all ${a}ms`,requestAnimationFrame(()=>{AA.height="0",AA.padding="0",AA.margin="0",setTimeout(e,a)})})}function g(o){let{enter:e,exit:a,appendPosition:s=!1,collapse:AA=!0,collapseDuration:eA=300}=o;return function(BA){let{children:oA,position:nA,preventExitTransition:hA,done:uA,nodeRef:FA,isIn:pA,playToast:zA}=BA;const LA=s?`${e}--${nA}`:e,YA=s?`${a}--${nA}`:a,QI=reactExports.useRef(0);return reactExports.useLayoutEffect(()=>{const _A=FA.current,JA=LA.split(" "),MA=iI=>{iI.target===FA.current&&(zA(),_A.removeEventListener("animationend",MA),_A.removeEventListener("animationcancel",MA),QI.current===0&&iI.type!=="animationcancel"&&_A.classList.remove(...JA))};_A.classList.add(...JA),_A.addEventListener("animationend",MA),_A.addEventListener("animationcancel",MA)},[]),reactExports.useEffect(()=>{const _A=FA.current,JA=()=>{_A.removeEventListener("animationend",JA),AA?f(_A,uA,eA):uA()};pA||(hA?JA():(QI.current=1,_A.className+=` ${YA}`,_A.addEventListener("animationend",JA)))},[pA]),React.createElement(React.Fragment,null,oA)}}function y(o,e){return o!=null?{content:o.content,containerId:o.props.containerId,id:o.props.toastId,theme:o.props.theme,type:o.props.type,data:o.props.data||{},isLoading:o.props.isLoading,icon:o.props.icon,status:e}:{}}const v=new Map;let h=[];const T=new Set,E=o=>T.forEach(e=>e(o)),b=()=>v.size>0;function I(o,e){var a;if(e)return!((a=v.get(e))==null||!a.isToastActive(o));let s=!1;return v.forEach(AA=>{AA.isToastActive(o)&&(s=!0)}),s}function _(o,e){m(o)&&(b()||h.push({content:o,options:e}),v.forEach(a=>{a.buildToast(o,e)}))}function C(o,e){v.forEach(a=>{e!=null&&e!=null&&e.containerId?(e==null?void 0:e.containerId)===a.id&&a.toggle(o,e==null?void 0:e.id):a.toggle(o,e==null?void 0:e.id)})}function L(o){const{subscribe:e,getSnapshot:a,setProps:s}=reactExports.useRef(function(eA){const BA=eA.containerId||1;return{subscribe(oA){const nA=function(uA,FA,pA){let zA=1,LA=0,YA=[],QI=[],_A=[],JA=FA;const MA=new Map,iI=new Set,_g=()=>{_A=Array.from(MA.values()),iI.forEach(CI=>CI())},BI=CI=>{QI=CI==null?[]:QI.filter(VA=>VA!==CI),_g()},jA=CI=>{const{toastId:VA,onOpen:XI,updateId:aB,children:MB}=CI.props,RB=aB==null;CI.staleId&&MA.delete(CI.staleId),MA.set(VA,CI),QI=[...QI,CI.props.toastId].filter(PB=>PB!==CI.staleId),_g(),pA(y(CI,RB?"added":"updated")),RB&&u(XI)&&XI(reactExports.isValidElement(MB)&&MB.props)};return{id:uA,props:JA,observe:CI=>(iI.add(CI),()=>iI.delete(CI)),toggle:(CI,VA)=>{MA.forEach(XI=>{VA!=null&&VA!==XI.props.toastId||u(XI.toggle)&&XI.toggle(CI)})},removeToast:BI,toasts:MA,clearQueue:()=>{LA-=YA.length,YA=[]},buildToast:(CI,VA)=>{if((xB=>{let{containerId:iQ,toastId:CQ,updateId:tQ}=xB;const sQ=iQ?iQ!==uA:uA!==1,pQ=MA.has(CQ)&&tQ==null;return sQ||pQ})(VA))return;const{toastId:XI,updateId:aB,data:MB,staleId:RB,delay:PB}=VA,iB=()=>{BI(XI)},dB=aB==null;dB&&LA++;const HB={...JA,style:JA.toastStyle,key:zA++,...Object.fromEntries(Object.entries(VA).filter(xB=>{let[iQ,CQ]=xB;return CQ!=null})),toastId:XI,updateId:aB,data:MB,closeToast:iB,isIn:!1,className:p(VA.className||JA.toastClassName),bodyClassName:p(VA.bodyClassName||JA.bodyClassName),progressClassName:p(VA.progressClassName||JA.progressClassName),autoClose:!VA.isLoading&&(QB=VA.autoClose,yB=JA.autoClose,QB===!1||c(QB)&&QB>0?QB:yB),deleteToast(){const xB=MA.get(XI),{onClose:iQ,children:CQ}=xB.props;u(iQ)&&iQ(reactExports.isValidElement(CQ)&&CQ.props),pA(y(xB,"removed")),MA.delete(XI),LA--,LA<0&&(LA=0),YA.length>0?jA(YA.shift()):_g()}};var QB,yB;HB.closeButton=JA.closeButton,VA.closeButton===!1||m(VA.closeButton)?HB.closeButton=VA.closeButton:VA.closeButton===!0&&(HB.closeButton=!m(JA.closeButton)||JA.closeButton);let kB=CI;reactExports.isValidElement(CI)&&!d(CI.type)?kB=reactExports.cloneElement(CI,{closeToast:iB,toastProps:HB,data:MB}):u(CI)&&(kB=CI({closeToast:iB,toastProps:HB,data:MB}));const mB={content:kB,props:HB,staleId:RB};JA.limit&&JA.limit>0&&LA>JA.limit&&dB?YA.push(mB):c(PB)?setTimeout(()=>{jA(mB)},PB):jA(mB)},setProps(CI){JA=CI},setToggle:(CI,VA)=>{MA.get(CI).toggle=VA},isToastActive:CI=>QI.some(VA=>VA===CI),getSnapshot:()=>JA.newestOnTop?_A.reverse():_A}}(BA,eA,E);v.set(BA,nA);const hA=nA.observe(oA);return h.forEach(uA=>_(uA.content,uA.options)),h=[],()=>{hA(),v.delete(BA)}},setProps(oA){var nA;(nA=v.get(BA))==null||nA.setProps(oA)},getSnapshot(){var oA;return(oA=v.get(BA))==null?void 0:oA.getSnapshot()}}}(o)).current;s(o);const AA=reactExports.useSyncExternalStore(e,a,a);return{getToastToRender:function(eA){if(!AA)return[];const BA=new Map;return AA.forEach(oA=>{const{position:nA}=oA.props;BA.has(nA)||BA.set(nA,[]),BA.get(nA).push(oA)}),Array.from(BA,oA=>eA(oA[0],oA[1]))},isToastActive:I,count:AA==null?void 0:AA.length}}function N(o){const[e,a]=reactExports.useState(!1),[s,AA]=reactExports.useState(!1),eA=reactExports.useRef(null),BA=reactExports.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:oA,pauseOnHover:nA,closeToast:hA,onClick:uA,closeOnClick:FA}=o;var pA,zA;function LA(){a(!0)}function YA(){a(!1)}function QI(MA){const iI=eA.current;BA.canDrag&&iI&&(BA.didMove=!0,e&&YA(),BA.delta=o.draggableDirection==="x"?MA.clientX-BA.start:MA.clientY-BA.start,BA.start!==MA.clientX&&(BA.canCloseOnClick=!1),iI.style.transform=`translate3d(${o.draggableDirection==="x"?`${BA.delta}px, var(--y)`:`0, calc(${BA.delta}px + var(--y))`},0)`,iI.style.opacity=""+(1-Math.abs(BA.delta/BA.removalDistance)))}function _A(){document.removeEventListener("pointermove",QI),document.removeEventListener("pointerup",_A);const MA=eA.current;if(BA.canDrag&&BA.didMove&&MA){if(BA.canDrag=!1,Math.abs(BA.delta)>BA.removalDistance)return AA(!0),o.closeToast(),void o.collapseAll();MA.style.transition="transform 0.2s, opacity 0.2s",MA.style.removeProperty("transform"),MA.style.removeProperty("opacity")}}(zA=v.get((pA={id:o.toastId,containerId:o.containerId,fn:a}).containerId||1))==null||zA.setToggle(pA.id,pA.fn),reactExports.useEffect(()=>{if(o.pauseOnFocusLoss)return document.hasFocus()||YA(),window.addEventListener("focus",LA),window.addEventListener("blur",YA),()=>{window.removeEventListener("focus",LA),window.removeEventListener("blur",YA)}},[o.pauseOnFocusLoss]);const JA={onPointerDown:function(MA){if(o.draggable===!0||o.draggable===MA.pointerType){BA.didMove=!1,document.addEventListener("pointermove",QI),document.addEventListener("pointerup",_A);const iI=eA.current;BA.canCloseOnClick=!0,BA.canDrag=!0,iI.style.transition="none",o.draggableDirection==="x"?(BA.start=MA.clientX,BA.removalDistance=iI.offsetWidth*(o.draggablePercent/100)):(BA.start=MA.clientY,BA.removalDistance=iI.offsetHeight*(o.draggablePercent===80?1.5*o.draggablePercent:o.draggablePercent)/100)}},onPointerUp:function(MA){const{top:iI,bottom:_g,left:BI,right:jA}=eA.current.getBoundingClientRect();MA.nativeEvent.type!=="touchend"&&o.pauseOnHover&&MA.clientX>=BI&&MA.clientX<=jA&&MA.clientY>=iI&&MA.clientY<=_g?YA():LA()}};return oA&&nA&&(JA.onMouseEnter=YA,o.stacked||(JA.onMouseLeave=LA)),FA&&(JA.onClick=MA=>{uA&&uA(MA),BA.canCloseOnClick&&hA()}),{playToast:LA,pauseToast:YA,isRunning:e,preventExitTransition:s,toastRef:eA,eventHandlers:JA}}function $(o){let{delay:e,isRunning:a,closeToast:s,type:AA="default",hide:eA,className:BA,style:oA,controlledProgress:nA,progress:hA,rtl:uA,isIn:FA,theme:pA}=o;const zA=eA||nA&&hA===0,LA={...oA,animationDuration:`${e}ms`,animationPlayState:a?"running":"paused"};nA&&(LA.transform=`scaleX(${hA})`);const YA=clsx("Toastify__progress-bar",nA?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${pA}`,`Toastify__progress-bar--${AA}`,{"Toastify__progress-bar--rtl":uA}),QI=u(BA)?BA({rtl:uA,type:AA,defaultClassName:YA}):clsx(YA,BA),_A={[nA&&hA>=1?"onTransitionEnd":"onAnimationEnd"]:nA&&hA<1?null:()=>{FA&&s()}};return React.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":zA},React.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${pA} Toastify__progress-bar--${AA}`}),React.createElement("div",{role:"progressbar","aria-hidden":zA?"true":"false","aria-label":"notification timer",className:QI,style:LA,..._A}))}let w=1;const k=()=>""+w++;function P(o){return o&&(d(o.toastId)||c(o.toastId))?o.toastId:k()}function M(o,e){return _(o,e),e.toastId}function x(o,e){return{...e,type:e&&e.type||o,toastId:P(e)}}function A(o){return(e,a)=>M(e,x(o,a))}function B(o,e){return M(o,x("default",e))}B.loading=(o,e)=>M(o,x("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),B.promise=function(o,e,a){let s,{pending:AA,error:eA,success:BA}=e;AA&&(s=d(AA)?B.loading(AA,a):B.loading(AA.render,{...a,...AA}));const oA={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},nA=(uA,FA,pA)=>{if(FA==null)return void B.dismiss(s);const zA={type:uA,...oA,...a,data:pA},LA=d(FA)?{render:FA}:FA;return s?B.update(s,{...zA,...LA}):B(LA.render,{...zA,...LA}),pA},hA=u(o)?o():o;return hA.then(uA=>nA("success",BA,uA)).catch(uA=>nA("error",eA,uA)),hA},B.success=A("success"),B.info=A("info"),B.error=A("error"),B.warning=A("warning"),B.warn=B.warning,B.dark=(o,e)=>M(o,x("default",{theme:"dark",...e})),B.dismiss=function(o){(function(e){var a;if(b()){if(e==null||d(a=e)||c(a))v.forEach(s=>{s.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const s=v.get(e.containerId);s?s.removeToast(e.id):v.forEach(AA=>{AA.removeToast(e.id)})}}else h=h.filter(s=>e!=null&&s.options.toastId!==e)})(o)},B.clearWaitingQueue=function(o){o===void 0&&(o={}),v.forEach(e=>{!e.props.limit||o.containerId&&e.id!==o.containerId||e.clearQueue()})},B.isActive=I,B.update=function(o,e){e===void 0&&(e={});const a=((s,AA)=>{var eA;let{containerId:BA}=AA;return(eA=v.get(BA||1))==null?void 0:eA.toasts.get(s)})(o,e);if(a){const{props:s,content:AA}=a,eA={delay:100,...s,...e,toastId:e.toastId||o,updateId:k()};eA.toastId!==o&&(eA.staleId=o);const BA=eA.render||AA;delete eA.render,M(BA,eA)}},B.done=o=>{B.update(o,{progress:1})},B.onChange=function(o){return T.add(o),()=>{T.delete(o)}},B.play=o=>C(!0,o),B.pause=o=>C(!1,o);const O=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,D=o=>{let{theme:e,type:a,isLoading:s,...AA}=o;return React.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${a})`,...AA})},z={info:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return React.createElement("div",{className:"Toastify__spinner"})}},R=o=>{const{isRunning:e,preventExitTransition:a,toastRef:s,eventHandlers:AA,playToast:eA}=N(o),{closeButton:BA,children:oA,autoClose:nA,onClick:hA,type:uA,hideProgressBar:FA,closeToast:pA,transition:zA,position:LA,className:YA,style:QI,bodyClassName:_A,bodyStyle:JA,progressClassName:MA,progressStyle:iI,updateId:_g,role:BI,progress:jA,rtl:CI,toastId:VA,deleteToast:XI,isIn:aB,isLoading:MB,closeOnClick:RB,theme:PB}=o,iB=clsx("Toastify__toast",`Toastify__toast-theme--${PB}`,`Toastify__toast--${uA}`,{"Toastify__toast--rtl":CI},{"Toastify__toast--close-on-click":RB}),dB=u(YA)?YA({rtl:CI,position:LA,type:uA,defaultClassName:iB}):clsx(iB,YA),HB=function(mB){let{theme:xB,type:iQ,isLoading:CQ,icon:tQ}=mB,sQ=null;const pQ={theme:xB,type:iQ};return tQ===!1||(u(tQ)?sQ=tQ({...pQ,isLoading:CQ}):reactExports.isValidElement(tQ)?sQ=reactExports.cloneElement(tQ,pQ):CQ?sQ=z.spinner():(kQ=>kQ in z)(iQ)&&(sQ=z[iQ](pQ))),sQ}(o),QB=!!jA||!nA,yB={closeToast:pA,type:uA,theme:PB};let kB=null;return BA===!1||(kB=u(BA)?BA(yB):reactExports.isValidElement(BA)?reactExports.cloneElement(BA,yB):function(mB){let{closeToast:xB,theme:iQ,ariaLabel:CQ="close"}=mB;return React.createElement("button",{className:`Toastify__close-button Toastify__close-button--${iQ}`,type:"button",onClick:tQ=>{tQ.stopPropagation(),xB(tQ)},"aria-label":CQ},React.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},React.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(yB)),React.createElement(zA,{isIn:aB,done:XI,position:LA,preventExitTransition:a,nodeRef:s,playToast:eA},React.createElement("div",{id:VA,onClick:hA,"data-in":aB,className:dB,...AA,style:QI,ref:s},React.createElement("div",{...aB&&{role:BI},className:u(_A)?_A({type:uA}):clsx("Toastify__toast-body",_A),style:JA},HB!=null&&React.createElement("div",{className:clsx("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!MB})},HB),React.createElement("div",null,oA)),kB,React.createElement($,{..._g&&!QB?{key:`pb-${_g}`}:{},rtl:CI,theme:PB,delay:nA,isRunning:e,isIn:aB,closeToast:pA,hide:FA,type:uA,style:iI,className:MA,controlledProgress:QB,progress:jA||0})))},S=function(o,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${o}-enter`,exit:`Toastify--animate Toastify__${o}-exit`,appendPosition:e}},H=g(S("bounce",!0));g(S("slide",!0));g(S("zoom"));g(S("flip"));const q={position:"top-right",transition:H,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function Q(o){let e={...q,...o};const a=o.stacked,[s,AA]=reactExports.useState(!0),eA=reactExports.useRef(null),{getToastToRender:BA,isToastActive:oA,count:nA}=L(e),{className:hA,style:uA,rtl:FA,containerId:pA}=e;function zA(YA){const QI=clsx("Toastify__toast-container",`Toastify__toast-container--${YA}`,{"Toastify__toast-container--rtl":FA});return u(hA)?hA({position:YA,rtl:FA,defaultClassName:QI}):clsx(QI,p(hA))}function LA(){a&&(AA(!0),B.play())}return O(()=>{if(a){var YA;const QI=eA.current.querySelectorAll('[data-in="true"]'),_A=12,JA=(YA=e.position)==null?void 0:YA.includes("top");let MA=0,iI=0;Array.from(QI).reverse().forEach((_g,BI)=>{const jA=_g;jA.classList.add("Toastify__toast--stacked"),BI>0&&(jA.dataset.collapsed=`${s}`),jA.dataset.pos||(jA.dataset.pos=JA?"top":"bot");const CI=MA*(s?.2:1)+(s?0:_A*BI);jA.style.setProperty("--y",`${JA?CI:-1*CI}px`),jA.style.setProperty("--g",`${_A}`),jA.style.setProperty("--s",""+(1-(s?iI:0))),MA+=jA.offsetHeight,iI+=.025})}},[s,nA,a]),React.createElement("div",{ref:eA,className:"Toastify",id:pA,onMouseEnter:()=>{a&&(AA(!1),B.pause())},onMouseLeave:LA},BA((YA,QI)=>{const _A=QI.length?{...uA}:{...uA,pointerEvents:"none"};return React.createElement("div",{className:zA(YA),style:_A,key:`container-${YA}`},QI.map(JA=>{let{content:MA,props:iI}=JA;return React.createElement(R,{...iI,stacked:a,collapseAll:LA,isIn:oA(iI.toastId,iI.containerId),style:iI.style,key:`toast-${iI.key}`},MA)}))}))}const Mint=()=>{const[o]=reactExports.useState({name:"",status:""}),{instance:e,createInstance:a}=useFhevm(),{addNFT:s}=useNFTs(),AA=()=>{const oA=jsxRuntimeExports.jsxs("div",{children:["Minting the file as an NFT failed. Ensure you are connected and have enough Zama: you acquire Zama fromĀ ",jsxRuntimeExports.jsx("a",{href:"https://faucet.zama.ai/",target:"_blank",rel:"noopener noreferrer",children:"https://faucet.zama.ai/"}),"."]});B.error(oA,{autoClose:1e4})},eA=async oA=>{if(!oA.target.files||oA.target.files.length===0)return;const nA=oA.target.files[0];try{const hA=await generateKey();if(!await getAccount())throw new Error("Account retrieval failed.");if(!e)throw new Error("Intance retrieval failed.");const FA=await encryptFile(nA,hA),pA=await BA(hA),zA={...FA,encryptedFileKey:pA},LA=await uploadFileToIPFS(zA);B.info("Your file is currently being minted as an NFT. This may take a few moments.");const YA=await mintToken(LA,pA);if(YA){const QI={id:Number(YA.tokenId),file:nA};s(QI),B.success("The File has been minted as an NFT and will soon appear in your gallery!")}}catch(hA){console.log("Failed to mint:",hA),AA()}},BA=async oA=>{if(!e)throw new Error("Intance retrieval failed.");const nA=[],hA=await exportCryptoKey(oA);for(const uA of hA){const FA=e.encrypt64(uA);console.log("ecrypted64 : ",FA),nA.push(FA)}return nA};return reactExports.useEffect(()=>{e||a().catch(console.error)},[e,a]),jsxRuntimeExports.jsx("section",{className:"mint",id:"mint",children:jsxRuntimeExports.jsx("div",{className:"container",children:jsxRuntimeExports.jsx("div",{className:"row",children:jsxRuntimeExports.jsx("div",{className:"col-12",children:jsxRuntimeExports.jsxs("div",{className:"mint-bx wow zoomIn",children:[jsxRuntimeExports.jsx("h2",{children:"Convert Files to NFTs"}),jsxRuntimeExports.jsxs("div",{className:"file-upload-container",children:[jsxRuntimeExports.jsxs("label",{htmlFor:"file-upload-input",className:"file-upload-label",children:[jsxRuntimeExports.jsx("input",{id:"file-upload-input",type:"file",style:{display:"none"},onChange:eA,accept:".jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .mp4"}),jsxRuntimeExports.jsxs("div",{className:"upload-area",children:[jsxRuntimeExports.jsx("img",{src:uploadIcon,alt:"Upload",className:"upload-icon"}),jsxRuntimeExports.jsx("span",{children:"Upload Files"})]}),jsxRuntimeExports.jsx("div",{className:"file-types-explanation",children:".jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .mp4"})]}),jsxRuntimeExports.jsx("p",{className:"upload-explanation",children:"The uploaded files are securely and confidentially saved on IPFS and accessible only by you or the people you have shared it with using Zama's fhEVM."}),o.status&&jsxRuntimeExports.jsx("p",{className:"file-upload-status",children:o.status}),o.name&&jsxRuntimeExports.jsxs("p",{className:"uploaded-file-info",children:["Name: ",o.name]})]})]})})})})})},SharedWith=({tokenId:o,open:e,onClose:a})=>{const[s,AA]=reactExports.useState([]),eA=async()=>{const nA=await getSharedWithAddresses(o);AA(nA)};reactExports.useEffect(()=>{e&&eA()},[e,o]);const BA=async nA=>{await revokeTokenAccess(o,nA)&&(B.success(`Revoke access for ${formatAddress(nA)} on NFT#${o} has succeeded!`),AA(uA=>uA.filter(FA=>FA!==nA)))},oA=async()=>{if(s.length==0)B.error(`No shared access for NFT#${o} !`);else{const nA=await getMaxUsersToRemove();await revokeAllSharedAccess(o,nA)&&(B.success(`Revoke all access for token NFT#${o} has succeeded!`),AA([]))}};return jsxRuntimeExports.jsxs(Modal$1,{show:e,onHide:a,centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsxs(Modal$1.Title,{children:["Shared With for NFT#",o]})}),jsxRuntimeExports.jsx(Modal$1.Body,{children:jsxRuntimeExports.jsx(ListGroup$1,{children:s.map(nA=>jsxRuntimeExports.jsxs(ListGroup$1.Item,{className:"d-flex justify-content-between align-items-center",children:[formatAddress(nA),jsxRuntimeExports.jsx(Button,{variant:"danger",onClick:()=>BA(nA),children:"Revoke"})]},nA))})}),jsxRuntimeExports.jsxs(Modal$1.Footer,{children:[jsxRuntimeExports.jsx(Button,{variant:"danger",onClick:oA,children:"Revoke All"}),jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:a,children:"Close"})]})]})};function getFileIcon(o){switch(o){case"application/pdf":return jsxRuntimeExports.jsx(FileEarmarkPdf,{});case"image/png":case"image/jpeg":case"image/gif":return jsxRuntimeExports.jsx(FileEarmarkImage,{});case"video/mp4":return jsxRuntimeExports.jsx(FileEarmarkPlay,{});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return jsxRuntimeExports.jsx(FileEarmarkWord,{});default:return jsxRuntimeExports.jsx(FileEarmark,{})}}function formatAddress(o,e=6){if(o.length<2*e+2)return o;const a=o.substring(0,e),s=o.substring(o.length-e);return`${a}...${s}`}function downloadFile(o){const e=document.createElement("a");e.href=window.URL.createObjectURL(o),e.download=o.name,document.body.appendChild(e),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)}function formatFileSize(o,e=2){if(o===0)return"0 Bytes";const a=1024,s=e<0?0:e,AA=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],eA=Math.floor(Math.log(o)/Math.log(a));return parseFloat((o/Math.pow(a,eA)).toFixed(s))+" "+AA[eA]}const ActionButtonHelper=({onDownload:o,onShare:e,onTransfer:a,onDelete:s,tokenId:AA=0})=>{const[eA,BA]=reactExports.useState(!1),[oA,nA]=reactExports.useState(!1),[hA,uA]=reactExports.useState(""),[FA,pA]=reactExports.useState(""),zA=JA=>{uA(JA),BA(!0)},LA=()=>{BA(!1),hA==="Share"?e(FA):hA==="Transfer"?a(FA):hA==="Delete"&&s()},YA=()=>{nA(!0)},QI=(JA,MA)=>jsxRuntimeExports.jsx(Tooltip$1,{...JA,children:MA}),_A=React.forwardRef(({onClick:JA},MA)=>jsxRuntimeExports.jsx("div",{ref:MA,onClick:iI=>{iI.preventDefault(),JA(iI)},className:"custom-toggle",title:"Actions",children:jsxRuntimeExports.jsx(ThreeDotsVertical,{})}));return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Dropdown$1,{children:[jsxRuntimeExports.jsx(Dropdown$1.Toggle,{as:_A}),jsxRuntimeExports.jsxs(Dropdown$1.Menu,{children:[jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Download"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:o,children:"Download"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Share"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Share"),children:"Share"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Shared With"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>YA(),children:"Shared With"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Transfer"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Transfer"),children:"Transfer"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Delete"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Delete"),children:"Delete"})})]})]}),jsxRuntimeExports.jsx(SharedWith,{tokenId:AA,open:oA,onClose:()=>nA(!1)}),jsxRuntimeExports.jsxs(Modal$1,{show:eA,onHide:()=>BA(!1),centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsxs(Modal$1.Title,{children:["Confirm ",hA]})}),jsxRuntimeExports.jsxs(Modal$1.Body,{children:[AA!==null?jsxRuntimeExports.jsxs("p",{children:["Are you sure you want to ",hA.toLowerCase()," NFT #",AA,"?"]}):jsxRuntimeExports.jsxs("p",{children:["Are you sure you want to ",hA.toLowerCase()," this item?"]}),(hA==="Share"||hA==="Transfer")&&jsxRuntimeExports.jsxs(Form$1.Group,{children:[jsxRuntimeExports.jsx(Form$1.Label,{children:"Recipient Address"}),jsxRuntimeExports.jsx(Form$1.Control,{type:"text",placeholder:"0x123...",value:FA,onChange:JA=>pA(JA.target.value)})]})]}),jsxRuntimeExports.jsxs(Modal$1.Footer,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>BA(!1),children:"Cancel"}),jsxRuntimeExports.jsx(Button,{variant:"primary",onClick:LA,children:"Confirm"})]})]})]})},Gallery=()=>{const[o,e]=reactExports.useState(0),{instance:a,createInstance:s}=useFhevm(),[AA,eA]=reactExports.useState(0),[BA,oA]=reactExports.useState(0),nA=5,[hA,uA]=reactExports.useState(!1),{nfts:FA,removeNFT:pA,updateNFTs:zA,removeAllNFTs:LA}=useNFTs(),[YA,QI]=reactExports.useState([]),_A=async(CI,VA)=>{await shareToken(VA,CI)?B.success(`The NFT#${CI} has been share with : ${formatAddress(VA)}`):B.error(`Could not share NFT #${CI}! Please check if it is already shared with ${formatAddress(VA)}.`)},JA=async(CI,VA)=>{await transferToken(VA,CI)?(B.success(`The NFT#${CI} has been transfered and will be no more accessible!`),pA(CI)):B.error(`Could not transfer the NFT#${CI}!`)},MA=async CI=>{const VA=await getMaxUsersToRemove();await burnToken(CI,VA)?(B.success(`The NFT#${CI} has been deleted and will be no more accessible!`),pA(CI)):B.error(`Could not delete the NFT#${CI}!`)};reactExports.useEffect(()=>{a||s().catch(console.error)},[a,s,o]);const iI=async()=>{uA(!0);try{_g()}catch(CI){throw B.error("Error during NFTs fetch. This could be due to browser extensions, firewall settings, or security policies blocking these requests."),CI}try{BI()}catch(CI){throw B.error("Error during shared with NFTs fetch. This could be due to browser extensions, firewall settings, or security policies blocking these requests."),CI}},_g=async()=>{if(!FA){B.info("You have no NFTs to display!");return}try{if(!a)throw new Error("Intance retrieval failed.");const CI=await getSupply();if(eA(CI),CI<=0){B.info("You have no NFTs to display!"),LA();return}const VA=await getTokensInRange(0,5),XI=await getAccount();if(!XI)throw new Error("Account retrieval failed.");const aB=await getSignature(contractAddress,XI),MB=await Promise.all(VA.map(async RB=>{const PB=await jA(RB.cidHash,aB.publicKey,aB.signature,RB.tokenId);return{id:Number(RB.tokenId),file:PB.file}}));zA(MB),B.success("Gallery updated successfully!")}catch(CI){throw B.error("Error displaying Gallery!"),CI}},BI=async()=>{try{const CI=await getSharedWithSupply();if(oA(CI),CI<=0){B.info("You have no NFTs shared with you to display!"),QI([]);return}const VA=await getSharedTokensInRange(0,CI),XI=await getAccount();if(!XI)throw new Error("Account retrieval failed.");const aB=await getSignature(contractAddress,XI),MB=await Promise.all(VA.map(async RB=>{const PB=await jA(RB.cidHash,aB.publicKey,aB.signature,RB.tokenId);return{id:Number(RB.tokenId),file:PB.file}}));QI(MB),B.success("Shared NFTs updated successfully!")}catch(CI){throw CI}},jA=async(CI,VA,XI,aB)=>{try{if(!a)throw new Error("Intance retrieval failed.");const MB=await getEncryptedFileCidHash(CI);if(!MB)throw new Error("Dencrypting data failed.");console.log("cid: ",CI),console.log("Encrypted FIle: ",MB);const RB=await reencrypt(aB,VA,XI);let PB=[];RB.forEach(HB=>{if(HB){const QB=a.decrypt(contractAddress,HB);PB.push(QB)}});const iB=await importCryptoKey(PB);return await decryptFile(MB,iB)}catch(MB){throw B.error(`Error Wile trying to access the NFT# ${aB}. could not fetch ${CI}`),MB}};return jsxRuntimeExports.jsxs(Container,{className:"mt-4 gallery-container",id:"gallery",children:[jsxRuntimeExports.jsx(Row,{className:"mb-4",children:jsxRuntimeExports.jsxs(Col,{children:[jsxRuntimeExports.jsx("hr",{className:"header-divider"}),jsxRuntimeExports.jsx("h1",{className:"gallery-header",children:"My NFTs Gallery"}),jsxRuntimeExports.jsx("hr",{className:"header-divider"})]})}),!hA&&jsxRuntimeExports.jsx(Row,{children:jsxRuntimeExports.jsx(Col,{className:"d-flex justify-content-center",children:jsxRuntimeExports.jsx(Button,{className:"modern-button",onClick:()=>iI(),children:"Show Private Content"})})}),hA&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs(Table,{striped:!0,hover:!0,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{className:"nft-num",children:"NFT #"}),jsxRuntimeExports.jsx("th",{className:"name",children:"Name"}),jsxRuntimeExports.jsx("th",{className:"size",children:"Size"}),jsxRuntimeExports.jsx("th",{className:"actions",children:jsxRuntimeExports.jsx("button",{onClick:()=>_g(),title:"Refresh Gallery",className:"icon-button",children:jsxRuntimeExports.jsx(ArrowClockwise,{})})})]})}),jsxRuntimeExports.jsx("tbody",{children:FA.map(CI=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:CI.id}),jsxRuntimeExports.jsxs("td",{children:[getFileIcon(CI.file.type)," ",CI.file.name]}),jsxRuntimeExports.jsx("td",{children:formatFileSize(CI.file.size)}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(ActionButtonHelper,{onDownload:()=>downloadFile(CI.file),onShare:VA=>_A(CI.id,VA),onTransfer:VA=>JA(CI.id,VA),onDelete:()=>MA(CI.id),tokenId:CI.id})})]},CI.id))})]}),jsxRuntimeExports.jsx(Pagination$1,{className:"justify-content-center mt-4",children:[...Array(Math.ceil(AA/nA)).keys()].map(CI=>jsxRuntimeExports.jsx(Pagination$1.Item,{active:CI+1===o,onClick:()=>e(CI+1),children:CI+1},CI))}),jsxRuntimeExports.jsx("h3",{className:"shared-separator",children:"NFTs Shared With Me"}),jsxRuntimeExports.jsxs(Table,{striped:!0,hover:!0,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{className:"nft-num"}),jsxRuntimeExports.jsx("th",{className:"name"}),jsxRuntimeExports.jsx("th",{className:"size"}),jsxRuntimeExports.jsx("th",{className:"actions",children:jsxRuntimeExports.jsx("button",{onClick:()=>BI(),title:"Refresh Gallery",className:"icon-button",children:jsxRuntimeExports.jsx(ArrowClockwise,{})})})]})}),jsxRuntimeExports.jsx("tbody",{children:YA.map(CI=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:CI.id}),jsxRuntimeExports.jsxs("td",{children:[getFileIcon(CI.file.type)," ",CI.file.name]}),jsxRuntimeExports.jsx("td",{children:formatFileSize(CI.file.size)}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(Download,{onClick:()=>downloadFile(CI.file)})})]},CI.id))})]}),jsxRuntimeExports.jsx(Pagination$1,{className:"justify-content-center mt-4",children:[...Array(Math.ceil(BA/nA)).keys()].map(CI=>jsxRuntimeExports.jsx(Pagination$1.Item,{active:CI+1===o,onClick:()=>e(CI+1),children:CI+1},CI))})]})]})},Footer=({githubUrl:o})=>jsxRuntimeExports.jsx("footer",{className:"footer",children:jsxRuntimeExports.jsxs("div",{className:"footer-container",children:[jsxRuntimeExports.jsxs("span",{children:[" ",new Date().getFullYear()," DRM system using Zama's fhEVM"]}),jsxRuntimeExports.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"footer-link",children:"GitHub"})]})}),MetaMaskAlertModal=()=>{const[o,e]=reactExports.useState(!0),a=()=>e(!1);return jsxRuntimeExports.jsxs(Modal$1,{show:o,onHide:a,centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsx(Modal$1.Title,{children:"MetaMask Required"})}),jsxRuntimeExports.jsxs(Modal$1.Body,{children:[jsxRuntimeExports.jsx("p",{children:"This application requires MetaMask to work correctly. Please install or enable MetaMask to proceed."}),jsxRuntimeExports.jsx("a",{href:"https://metamask.io/download.html",target:"_blank",rel:"noopener noreferrer",children:"Download MetaMask"})]}),jsxRuntimeExports.jsx(Modal$1.Footer,{children:jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:a,children:"Close"})})]})};function App(){const[,o]=reactExports.useState(!1),[e,a]=reactExports.useState(!0),[s,AA]=reactExports.useState(""),[eA,BA]=reactExports.useState(!1);return reactExports.useEffect(()=>{typeof window.ethereum>"u"&&BA(!0)},[]),reactExports.useEffect(()=>{init().then(()=>{o(!0),a(!1)}).catch(oA=>{AA("Failed to initialize the application."),a(!1),console.error(oA)})},[]),e?jsxRuntimeExports.jsx("div",{children:"Loading..."}):s?jsxRuntimeExports.jsxs("div",{children:["Error: ",s]}):eA?jsxRuntimeExports.jsx(MetaMaskAlertModal,{}):jsxRuntimeExports.jsx(BrowserRouter,{children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Q,{position:"top-right",autoClose:7e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,style:{zIndex:9999}}),jsxRuntimeExports.jsx(NavBar,{}),jsxRuntimeExports.jsx(Banner,{}),jsxRuntimeExports.jsx(Mint,{}),jsxRuntimeExports.jsx(Gallery,{}),jsxRuntimeExports.jsx(Footer,{githubUrl:"https://github.com/El-hacen21/zama_bounty/"})]})})}var buffer={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var a=o.indexOf("=");a===-1&&(a=e);var s=a===e?0:4-a%4;return[a,s]}function byteLength(o){var e=getLens(o),a=e[0],s=e[1];return(a+s)*3/4-s}function _byteLength(o,e,a){return(e+a)*3/4-a}function toByteArray(o){var e,a=getLens(o),s=a[0],AA=a[1],eA=new Arr(_byteLength(o,s,AA)),BA=0,oA=AA>0?s-4:s,nA;for(nA=0;nA>16&255,eA[BA++]=e>>8&255,eA[BA++]=e&255;return AA===2&&(e=revLookup[o.charCodeAt(nA)]<<2|revLookup[o.charCodeAt(nA+1)]>>4,eA[BA++]=e&255),AA===1&&(e=revLookup[o.charCodeAt(nA)]<<10|revLookup[o.charCodeAt(nA+1)]<<4|revLookup[o.charCodeAt(nA+2)]>>2,eA[BA++]=e>>8&255,eA[BA++]=e&255),eA}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[o&63]}function encodeChunk(o,e,a){for(var s,AA=[],eA=e;eAoA?oA:BA+eA));return s===1?(e=o[a-1],AA.push(lookup[e>>2]+lookup[e<<4&63]+"==")):s===2&&(e=(o[a-2]<<8)+o[a-1],AA.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),AA.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(o,e,a,s,AA){var eA,BA,oA=AA*8-s-1,nA=(1<>1,uA=-7,FA=a?AA-1:0,pA=a?-1:1,zA=o[e+FA];for(FA+=pA,eA=zA&(1<<-uA)-1,zA>>=-uA,uA+=oA;uA>0;eA=eA*256+o[e+FA],FA+=pA,uA-=8);for(BA=eA&(1<<-uA)-1,eA>>=-uA,uA+=s;uA>0;BA=BA*256+o[e+FA],FA+=pA,uA-=8);if(eA===0)eA=1-hA;else{if(eA===nA)return BA?NaN:(zA?-1:1)*(1/0);BA=BA+Math.pow(2,s),eA=eA-hA}return(zA?-1:1)*BA*Math.pow(2,eA-s)};ieee754.write=function(o,e,a,s,AA,eA){var BA,oA,nA,hA=eA*8-AA-1,uA=(1<>1,pA=AA===23?Math.pow(2,-24)-Math.pow(2,-77):0,zA=s?0:eA-1,LA=s?1:-1,YA=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(oA=isNaN(e)?1:0,BA=uA):(BA=Math.floor(Math.log(e)/Math.LN2),e*(nA=Math.pow(2,-BA))<1&&(BA--,nA*=2),BA+FA>=1?e+=pA/nA:e+=pA*Math.pow(2,1-FA),e*nA>=2&&(BA++,nA/=2),BA+FA>=uA?(oA=0,BA=uA):BA+FA>=1?(oA=(e*nA-1)*Math.pow(2,AA),BA=BA+FA):(oA=e*Math.pow(2,FA-1)*Math.pow(2,AA),BA=0));AA>=8;o[a+zA]=oA&255,zA+=LA,oA/=256,AA-=8);for(BA=BA<0;o[a+zA]=BA&255,zA+=LA,BA/=256,hA-=8);o[a+zA-LA]|=YA*128};/*! +`+eA):s.stack=eA}catch{}}throw s}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=mergeConfig(this.defaults,a);const{transitional:s,paramsSerializer:AA,headers:eA}=a;s!==void 0&&validator.assertOptions(s,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),AA!=null&&(utils$1.isFunction(AA)?a.paramsSerializer={serialize:AA}:validator.assertOptions(AA,{encode:validators.function,serialize:validators.function},!0)),a.method=(a.method||this.defaults.method||"get").toLowerCase();let BA=eA&&utils$1.merge(eA.common,eA[a.method]);eA&&utils$1.forEach(["delete","get","head","post","put","patch","common"],LA=>{delete eA[LA]}),a.headers=AxiosHeaders.concat(BA,eA);const oA=[];let nA=!0;this.interceptors.request.forEach(function(YA){typeof YA.runWhen=="function"&&YA.runWhen(a)===!1||(nA=nA&&YA.synchronous,oA.unshift(YA.fulfilled,YA.rejected))});const hA=[];this.interceptors.response.forEach(function(YA){hA.push(YA.fulfilled,YA.rejected)});let uA,FA=0,pA;if(!nA){const LA=[dispatchRequest.bind(this),void 0];for(LA.unshift.apply(LA,oA),LA.push.apply(LA,hA),pA=LA.length,uA=Promise.resolve(a);FA{if(!s._listeners)return;let eA=s._listeners.length;for(;eA-- >0;)s._listeners[eA](AA);s._listeners=null}),this.promise.then=AA=>{let eA;const BA=new Promise(oA=>{s.subscribe(oA),eA=oA}).then(AA);return BA.cancel=function(){s.unsubscribe(eA)},BA},e(function(eA,BA,oA){s.reason||(s.reason=new CanceledError(eA,BA,oA),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}static source(){let e;return{token:new CancelToken(function(AA){e=AA}),cancel:e}}}function spread(o){return function(a){return o.apply(null,a)}}function isAxiosError(o){return utils$1.isObject(o)&&o.isAxiosError===!0}const HttpStatusCode={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(HttpStatusCode).forEach(([o,e])=>{HttpStatusCode[e]=o});function createInstance(o){const e=new Axios(o),a=bind(Axios.prototype.request,e);return utils$1.extend(a,Axios.prototype,e,{allOwnKeys:!0}),utils$1.extend(a,e,null,{allOwnKeys:!0}),a.create=function(AA){return createInstance(mergeConfig(o,AA))},a}const axios=createInstance(defaults$1);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function(e){return Promise.all(e)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=o=>formDataToJSON(utils$1.isHTMLForm(o)?new FormData(o):o);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;function coerce$5(o){if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")}function base$5(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$6=base$5,_brrp__multiformats_scope_baseX$5=src$6;let Encoder$5=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$5=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$5(this,e)}},ComposedDecoder$5=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$5(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$5(o,e){return new ComposedDecoder$5({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$5=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$5(e,a,s),this.decoder=new Decoder$5(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$5({name:o,prefix:e,encode:a,decode:s}){return new Codec$5(o,e,a,s)}function baseX$5({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$5(a,o);return from$5({prefix:e,name:o,encode:s,decode:eA=>coerce$5(AA(eA))})}function decode$b(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$9(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<e.major?1:0}}Type.uint=new Type(0,"uint",!0);Type.negint=new Type(1,"negint",!0);Type.bytes=new Type(2,"bytes",!0);Type.string=new Type(3,"string",!0);Type.array=new Type(4,"array",!1);Type.map=new Type(5,"map",!1);Type.tag=new Type(6,"tag",!1);Type.float=new Type(7,"float",!0);Type.false=new Type(7,"false",!0);Type.true=new Type(7,"true",!0);Type.null=new Type(7,"null",!0);Type.undefined=new Type(7,"undefined",!0);Type.break=new Type(7,"break",!0);class Token{constructor(e,a,s){this.type=e,this.value=a,this.encodedLength=s,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const useBuffer=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function";new TextDecoder;const textEncoder=new TextEncoder;function isBuffer(o){return useBuffer&&globalThis.Buffer.isBuffer(o)}function asU8A(o){return o instanceof Uint8Array?isBuffer(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):o:Uint8Array.from(o)}const fromString$3=useBuffer?o=>o.length>64?globalThis.Buffer.from(o):utf8ToBytes(o):o=>o.length>64?textEncoder.encode(o):utf8ToBytes(o);function compare(o,e){if(isBuffer(o)&&isBuffer(e))return o.compare(e);for(let a=0;a>6|192,e[a++]=AA&63|128):(AA&64512)===55296&&s+1>18|240,e[a++]=AA>>12&63|128,e[a++]=AA>>6&63|128,e[a++]=AA&63|128):(e[a++]=AA>>12|224,e[a++]=AA>>6&63|128,e[a++]=AA&63|128)}return e}const decodeErrPrefix="CBOR decode error:",encodeErrPrefix="CBOR encode error:",uintBoundaries=[24,256,65536,4294967296,BigInt("18446744073709551616")];function encodeUint(o,e){return encodeUintValue(o,0,e.value)}function encodeUintValue(o,e,a){if(a>>8,s&255])}else if(a>>24&255,s>>>16&255,s>>>8&255,s&255])}else{const s=BigInt(a);if(s>BigInt(32)&BigInt(4294967295));AA[8]=eA&255,eA=eA>>8,AA[7]=eA&255,eA=eA>>8,AA[6]=eA&255,eA=eA>>8,AA[5]=eA&255,AA[4]=BA&255,BA=BA>>8,AA[3]=BA&255,BA=BA>>8,AA[2]=BA&255,BA=BA>>8,AA[1]=BA&255,o.push(AA)}else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`)}}encodeUint.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};encodeUintValue.encodedSize=function(e){return ea.value?1:0};const neg1b=BigInt(-1),pos1b=BigInt(1);function encodeNegint(o,e){const a=e.value,s=typeof a=="bigint"?a*neg1b-pos1b:a*-1-1;encodeUintValue(o,e.type.majorEncoded,s)}encodeNegint.encodedSize=function(e){const a=e.value,s=typeof a=="bigint"?a*neg1b-pos1b:a*-1-1;return sa.value?-1:0};function tokenBytes(o){return o.encodedBytes===void 0&&(o.encodedBytes=o.type===Type.string?fromString$3(o.value):o.value),o.encodedBytes}function encodeBytes(o,e){const a=tokenBytes(e);encodeUintValue(o,e.type.majorEncoded,a.length),o.push(a)}encodeBytes.encodedSize=function(e){const a=tokenBytes(e);return encodeUintValue.encodedSize(a.length)+a.length};encodeBytes.compareTokens=function(e,a){return compareBytes(tokenBytes(e),tokenBytes(a))};function compareBytes(o,e){return o.lengthe.length?1:compare(o,e)}const encodeString=encodeBytes;function encodeArray(o,e){encodeUintValue(o,Type.array.majorEncoded,e.value)}encodeArray.compareTokens=encodeUint.compareTokens;encodeArray.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};function encodeMap(o,e){encodeUintValue(o,Type.map.majorEncoded,e.value)}encodeMap.compareTokens=encodeUint.compareTokens;encodeMap.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};function encodeTag(o,e){encodeUintValue(o,Type.tag.majorEncoded,e.value)}encodeTag.compareTokens=encodeUint.compareTokens;encodeTag.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};const MINOR_FALSE=20,MINOR_TRUE=21,MINOR_NULL=22,MINOR_UNDEFINED=23;function encodeFloat(o,e,a){const s=e.value;if(s===!1)o.push([Type.float.majorEncoded|MINOR_FALSE]);else if(s===!0)o.push([Type.float.majorEncoded|MINOR_TRUE]);else if(s===null)o.push([Type.float.majorEncoded|MINOR_NULL]);else if(s===void 0)o.push([Type.float.majorEncoded|MINOR_UNDEFINED]);else{let AA,eA=!1;(!a||a.float64!==!0)&&(encodeFloat16(s),AA=readFloat16(ui8a,1),s===AA||Number.isNaN(s)?(ui8a[0]=249,o.push(ui8a.slice(0,3)),eA=!0):(encodeFloat32(s),AA=readFloat32(ui8a,1),s===AA&&(ui8a[0]=250,o.push(ui8a.slice(0,5)),eA=!0))),eA||(encodeFloat64(s),AA=readFloat64(ui8a,1),ui8a[0]=251,o.push(ui8a.slice(0,9)))}}encodeFloat.encodedSize=function(e,a){const s=e.value;if(s===!1||s===!0||s===null||s===void 0)return 1;if(!a||a.float64!==!0){encodeFloat16(s);let AA=readFloat16(ui8a,1);if(s===AA||Number.isNaN(s))return 3;if(encodeFloat32(s),AA=readFloat32(ui8a,1),s===AA)return 5}return 9};const buffer$1=new ArrayBuffer(9),dataView=new DataView(buffer$1,1),ui8a=new Uint8Array(buffer$1,0);function encodeFloat16(o){if(o===1/0)dataView.setUint16(0,31744,!1);else if(o===-1/0)dataView.setUint16(0,64512,!1);else if(Number.isNaN(o))dataView.setUint16(0,32256,!1);else{dataView.setFloat32(0,o);const e=dataView.getUint32(0),a=(e&2139095040)>>23,s=e&8388607;if(a===255)dataView.setUint16(0,31744,!1);else if(a===0)dataView.setUint16(0,(o&2147483648)>>16|s>>13,!1);else{const AA=a-127;AA<-24?dataView.setUint16(0,0):AA<-14?dataView.setUint16(0,(e&2147483648)>>16|1<<24+AA,!1):dataView.setUint16(0,(e&2147483648)>>16|AA+15<<10|s>>13,!1)}}}function readFloat16(o,e){if(o.length-e<2)throw new Error(`${decodeErrPrefix} not enough data for float16`);const a=(o[e]<<8)+o[e+1];if(a===31744)return 1/0;if(a===64512)return-1/0;if(a===32256)return NaN;const s=a>>10&31,AA=a&1023;let eA;return s===0?eA=AA*2**-24:s!==31?eA=(AA+1024)*2**(s-25):eA=AA===0?1/0:NaN,a&32768?-eA:eA}function encodeFloat32(o){dataView.setFloat32(0,o,!1)}function readFloat32(o,e){if(o.length-e<4)throw new Error(`${decodeErrPrefix} not enough data for float32`);const a=(o.byteOffset||0)+e;return new DataView(o.buffer,a,4).getFloat32(0,!1)}function encodeFloat64(o){dataView.setFloat64(0,o,!1)}function readFloat64(o,e){if(o.length-e<8)throw new Error(`${decodeErrPrefix} not enough data for float64`);const a=(o.byteOffset||0)+e;return new DataView(o.buffer,a,8).getFloat64(0,!1)}encodeFloat.compareTokens=encodeUint.compareTokens;function makeCborEncoders(){const o=[];return o[Type.uint.major]=encodeUint,o[Type.negint.major]=encodeNegint,o[Type.bytes.major]=encodeBytes,o[Type.string.major]=encodeString,o[Type.array.major]=encodeArray,o[Type.map.major]=encodeMap,o[Type.tag.major]=encodeTag,o[Type.float.major]=encodeFloat,o}makeCborEncoders();class Ref{constructor(e,a){this.obj=e,this.parent=a}includes(e){let a=this;do if(a.obj===e)return!0;while(a=a.parent);return!1}static createCheck(e,a){if(e&&e.includes(a))throw new Error(`${encodeErrPrefix} object contains circular references`);return new Ref(a,e)}}const simpleTokens={null:new Token(Type.null,null),undefined:new Token(Type.undefined,void 0),true:new Token(Type.true,!0),false:new Token(Type.false,!1),emptyArray:new Token(Type.array,0),emptyMap:new Token(Type.map,0)},typeEncoders={number(o,e,a,s){return!Number.isInteger(o)||!Number.isSafeInteger(o)?new Token(Type.float,o):o>=0?new Token(Type.uint,o):new Token(Type.negint,o)},bigint(o,e,a,s){return o>=BigInt(0)?new Token(Type.uint,o):new Token(Type.negint,o)},Uint8Array(o,e,a,s){return new Token(Type.bytes,o)},string(o,e,a,s){return new Token(Type.string,o)},boolean(o,e,a,s){return o?simpleTokens.true:simpleTokens.false},null(o,e,a,s){return simpleTokens.null},undefined(o,e,a,s){return simpleTokens.undefined},ArrayBuffer(o,e,a,s){return new Token(Type.bytes,new Uint8Array(o))},DataView(o,e,a,s){return new Token(Type.bytes,new Uint8Array(o.buffer,o.byteOffset,o.byteLength))},Array(o,e,a,s){if(!o.length)return a.addBreakTokens===!0?[simpleTokens.emptyArray,new Token(Type.break)]:simpleTokens.emptyArray;s=Ref.createCheck(s,o);const AA=[];let eA=0;for(const BA of o)AA[eA++]=objectToTokens(BA,a,s);return a.addBreakTokens?[new Token(Type.array,o.length),AA,new Token(Type.break)]:[new Token(Type.array,o.length),AA]},Object(o,e,a,s){const AA=e!=="Object",eA=AA?o.keys():Object.keys(o),BA=AA?o.size:eA.length;if(!BA)return a.addBreakTokens===!0?[simpleTokens.emptyMap,new Token(Type.break)]:simpleTokens.emptyMap;s=Ref.createCheck(s,o);const oA=[];let nA=0;for(const hA of eA)oA[nA++]=[objectToTokens(hA,a,s),objectToTokens(AA?o.get(hA):o[hA],a,s)];return sortMapEntries(oA,a),a.addBreakTokens?[new Token(Type.map,BA),oA,new Token(Type.break)]:[new Token(Type.map,BA),oA]}};typeEncoders.Map=typeEncoders.Object;typeEncoders.Buffer=typeEncoders.Uint8Array;for(const o of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))typeEncoders[`${o}Array`]=typeEncoders.DataView;function objectToTokens(o,e={},a){const s=is(o),AA=e&&e.typeEncoders&&e.typeEncoders[s]||typeEncoders[s];if(typeof AA=="function"){const BA=AA(o,s,e,a);if(BA!=null)return BA}const eA=typeEncoders[s];if(!eA)throw new Error(`${encodeErrPrefix} unsupported type: ${s}`);return eA(o,s,e,a)}function sortMapEntries(o,e){e.mapSorter&&o.sort(e.mapSorter)}function equals$1(o,e){if(o===e)return!0;if(o.byteLength!==e.byteLength)return!1;for(let a=0;a=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$5=base$4,_brrp__multiformats_scope_baseX$4=src$5;let Encoder$4=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$4=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$4(this,e)}},ComposedDecoder$4=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$4(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$4(o,e){return new ComposedDecoder$4({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$4=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$4(e,a,s),this.decoder=new Decoder$4(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$4({name:o,prefix:e,encode:a,decode:s}){return new Codec$4(o,e,a,s)}function baseX$4({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$4(a,o);return from$4({prefix:e,name:o,encode:s,decode:eA=>coerce$4(AA(eA))})}function decode$a(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$8(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<=INT;)e[a++]=o&255|MSB,o/=128;for(;o&MSBALL;)e[a++]=o&255|MSB,o>>>=7;return e[a]=o|0,encode$7.bytes=a-s+1,e}var decode$9=read,MSB$1=128,REST$1=127;function read(o,s){var a=0,s=s||0,AA=0,eA=s,BA,oA=o.length;do{if(eA>=oA)throw read.bytes=0,new RangeError("Could not decode varint");BA=o[eA++],a+=AA<28?(BA&REST$1)<=MSB$1);return read.bytes=eA-s,a}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return o{const[FA,pA]=decode$8(e.subarray(a));return a+=pA,FA};let AA=s(),eA=DAG_PB_CODE;if(AA===18?(AA=0,a=0):eA=s(),AA!==0&&AA!==1)throw new RangeError(`Invalid CID version ${AA}`);const BA=a,oA=s(),nA=s(),hA=a+nA,uA=hA-BA;return{version:AA,codec:eA,multihashCode:oA,digestSize:nA,multihashSize:uA,size:hA}}static parse(e,a){const[s,AA]=parseCIDtoBytes(e,a),eA=CID.decode(AA);if(eA.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(eA).set(s,e),eA}}function parseCIDtoBytes(o,e){switch(o[0]){case"Q":{const a=e??base58btc$2;return[base58btc$2.prefix,a.decode(`${base58btc$2.prefix}${o}`)]}case base58btc$2.prefix:{const a=e??base58btc$2;return[base58btc$2.prefix,a.decode(o)]}case base32$4.prefix:{const a=e??base32$4;return[base32$4.prefix,a.decode(o)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[o[0],e.decode(o)]}}}function toStringV0(o,e,a){const{prefix:s}=a;if(s!==base58btc$2.prefix)throw Error(`Cannot string encode V0 in ${a.name} encoding`);const AA=e.get(s);if(AA==null){const eA=a.encode(o).slice(1);return e.set(s,eA),eA}else return AA}function toStringV1(o,e,a){const{prefix:s}=a,AA=e.get(s);if(AA==null){const eA=a.encode(o);return e.set(s,eA),eA}else return AA}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,e,a){const s=encodingLength(o),AA=s+encodingLength(e),eA=new Uint8Array(AA+a.byteLength);return encodeTo(o,eA,0),encodeTo(e,eA,s),eA.set(a,AA),eA}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),CID_CBOR_TAG=42;function cidEncoder(o){if(o.asCID!==o&&o["/"]!==o.bytes)return null;const e=CID.asCID(o);if(!e)return null;const a=new Uint8Array(e.bytes.byteLength+1);return a.set(e.bytes,1),[new Token(Type.tag,CID_CBOR_TAG),new Token(Type.bytes,a)]}function undefinedEncoder(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function numberEncoder(o){if(Number.isNaN(o))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(o===1/0||o===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}const _encodeOptions={float64:!0,typeEncoders:{Object:cidEncoder,undefined:undefinedEncoder,number:numberEncoder}};({..._encodeOptions,typeEncoders:{..._encodeOptions.typeEncoders}});function cidDecoder(o){if(o[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return CID.decode(o.subarray(1))}const _decodeOptions={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};_decodeOptions.tags[CID_CBOR_TAG]=cidDecoder;({..._decodeOptions,tags:_decodeOptions.tags.slice()});class JSONEncoder extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){const a=this.inRecursive[this.inRecursive.length-1];a&&(a.type===Type.array&&(a.elements++,a.elements!==1&&e.push([44])),a.type===Type.map&&(a.elements++,a.elements!==1&&(a.elements%2===1?e.push([44]):e.push([58]))))}[Type.uint.major](e,a){this.prefix(e);const s=String(a.value),AA=[];for(let eA=0;eA32?asU8A(s):s)}[Type.array.major](e,a){this.prefix(e),this.inRecursive.push({type:Type.array,elements:0}),e.push([91])}[Type.map.major](e,a){this.prefix(e),this.inRecursive.push({type:Type.map,elements:0}),e.push([123])}[Type.tag.major](e,a){}[Type.float.major](e,a){if(a.type.name==="break"){const BA=this.inRecursive.pop();if(BA){if(BA.type===Type.array)e.push([93]);else if(BA.type===Type.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(a.value===void 0)throw new Error(`${encodeErrPrefix} unsupported type: undefined`);if(this.prefix(e),a.type.name==="true"){e.push([116,114,117,101]);return}else if(a.type.name==="false"){e.push([102,97,108,115,101]);return}else if(a.type.name==="null"){e.push([110,117,108,108]);return}const s=String(a.value),AA=[];let eA=!1;for(let BA=0;BA=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$4=base$3,_brrp__multiformats_scope_baseX$3=src$4;let Encoder$3=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$3=class{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$3(this,e)}},ComposedDecoder$3=class{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or$3(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$3(o,e){return new ComposedDecoder$3({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}let Codec$3=class{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$3(e,a,s),this.decoder=new Decoder$3(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function from$3({name:o,prefix:e,encode:a,decode:s}){return new Codec$3(o,e,a,s)}function baseX$3({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$3(a,o);return from$3({prefix:e,name:o,encode:s,decode:eA=>coerce$3(AA(eA))})}function decode$6(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$6(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$3=base$2,_brrp__multiformats_scope_baseX$2=src$3;const coerce$2=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},fromString$2=o=>new TextEncoder().encode(o),toString$3=o=>new TextDecoder().decode(o);let Encoder$2=class{constructor(e,a,s){this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(e,a,s){if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$2(this,e)}},ComposedDecoder$2=class{constructor(e){this.decoders=e}or(e){return or$2(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const or$2=(o,e)=>new ComposedDecoder$2({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let Codec$2=class{constructor(e,a,s,AA){this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$2(e,a,s),this.decoder=new Decoder$2(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const from$2=({name:o,prefix:e,encode:a,decode:s})=>new Codec$2(o,e,a,s),baseX$2=({prefix:o,name:e,alphabet:a})=>{const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$2(a,e);return from$2({prefix:o,name:e,encode:s,decode:eA=>coerce$2(AA(eA))})},decode$5=(o,e,a,s)=>{const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA},encode$5=(o,e,a)=>{const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA&&(eA+=e[AA&oA<from$2({prefix:e,name:o,encode(AA){return encode$5(AA,s,a)},decode(AA){return decode$5(AA,s,a,o)}}),base64$4=rfc4648$2({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$1=rfc4648$2({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$1=rfc4648$2({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$1=rfc4648$2({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$5=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$4,base64pad:base64pad$1,base64url:base64url$1,base64urlpad:base64urlpad$1},Symbol.toStringTag,{value:"Module"})),base58btc$1=baseX$2({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$1=baseX$2({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$1=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$1,base58flickr:base58flickr$1},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648$2({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$1=rfc4648$2({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$1=rfc4648$2({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$1=rfc4648$2({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$1=rfc4648$2({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$1=rfc4648$2({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$1=rfc4648$2({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$1=rfc4648$2({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$1=rfc4648$2({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex:base32hex$1,base32hexpad:base32hexpad$1,base32hexpadupper:base32hexpadupper$1,base32hexupper:base32hexupper$1,base32pad:base32pad$1,base32padupper:base32padupper$1,base32upper:base32upper$1,base32z:base32z$1},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$3(o),decode:o=>fromString$2(o)}),identityBase$1=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"})),base2$2=rfc4648$2({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$3=Object.freeze(Object.defineProperty({__proto__:null,base2:base2$2},Symbol.toStringTag,{value:"Module"})),base8$2=rfc4648$2({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$3=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$2},Symbol.toStringTag,{value:"Module"})),base10$2=baseX$2({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$3=Object.freeze(Object.defineProperty({__proto__:null,base10:base10$2},Symbol.toStringTag,{value:"Module"})),base16$2=rfc4648$2({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper$1=rfc4648$2({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$3=Object.freeze(Object.defineProperty({__proto__:null,base16:base16$2,base16upper:base16upper$1},Symbol.toStringTag,{value:"Module"})),base36$2=baseX$2({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$1=baseX$2({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$3=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$2,base36upper:base36upper$1},Symbol.toStringTag,{value:"Module"})),alphabet$2=Array.from("šŸš€šŸŖā˜„šŸ›°šŸŒŒšŸŒ‘šŸŒ’šŸŒ“šŸŒ”šŸŒ•šŸŒ–šŸŒ—šŸŒ˜šŸŒšŸŒšŸŒŽšŸ‰ā˜€šŸ’»šŸ–„šŸ’¾šŸ’暟˜‚ā¤šŸ˜šŸ¤£šŸ˜ŠšŸ™šŸ’•šŸ˜­šŸ˜˜šŸ‘šŸ˜…šŸ‘šŸ˜šŸ”„šŸ„°šŸ’”šŸ’–šŸ’™šŸ˜¢šŸ¤”šŸ˜†šŸ™„šŸ’ŖšŸ˜‰ā˜ŗšŸ‘ŒšŸ¤—šŸ’œšŸ˜”šŸ˜ŽšŸ˜‡šŸŒ¹šŸ¤¦šŸŽ‰šŸ’žāœŒāœØšŸ¤·šŸ˜±šŸ˜ŒšŸŒøšŸ™ŒšŸ˜‹šŸ’—šŸ’ššŸ˜šŸ’›šŸ™‚šŸ’“šŸ¤©šŸ˜„šŸ˜€šŸ–¤šŸ˜ƒšŸ’ÆšŸ™ˆšŸ‘‡šŸŽ¶šŸ˜’šŸ¤­ā£šŸ˜œšŸ’‹šŸ‘€šŸ˜ŖšŸ˜‘šŸ’„šŸ™‹šŸ˜žšŸ˜©šŸ˜”šŸ¤ŖšŸ‘ŠšŸ„³šŸ˜„šŸ¤¤šŸ‘‰šŸ’ƒšŸ˜³āœ‹šŸ˜ššŸ˜šŸ˜“šŸŒŸšŸ˜¬šŸ™ƒšŸ€šŸŒ·šŸ˜»šŸ˜“ā­āœ…šŸ„ŗšŸŒˆšŸ˜ˆšŸ¤˜šŸ’¦āœ”šŸ˜£šŸƒšŸ’ā˜¹šŸŽŠšŸ’˜šŸ˜ ā˜šŸ˜•šŸŒŗšŸŽ‚šŸŒ»šŸ˜šŸ–•šŸ’šŸ™ŠšŸ˜¹šŸ—£šŸ’«šŸ’€šŸ‘‘šŸŽµšŸ¤žšŸ˜›šŸ”“šŸ˜¤šŸŒ¼šŸ˜«āš½šŸ¤™ā˜•šŸ†šŸ¤«šŸ‘ˆšŸ˜®šŸ™†šŸ»šŸƒšŸ¶šŸ’šŸ˜²šŸŒæšŸ§”šŸŽāš”šŸŒžšŸŽˆāŒāœŠšŸ‘‹šŸ˜°šŸ¤ØšŸ˜¶šŸ¤šŸš¶šŸ’°šŸ“šŸ’¢šŸ¤ŸšŸ™šŸšØšŸ’ØšŸ¤¬āœˆšŸŽ€šŸŗšŸ¤“šŸ˜™šŸ’ŸšŸŒ±šŸ˜–šŸ‘¶šŸ„“ā–¶āž”ā“šŸ’ŽšŸ’øā¬‡šŸ˜ØšŸŒššŸ¦‹šŸ˜·šŸ•ŗāš šŸ™…šŸ˜ŸšŸ˜µšŸ‘ŽšŸ¤²šŸ¤ šŸ¤§šŸ“ŒšŸ”µšŸ’…šŸ§šŸ¾šŸ’šŸ˜—šŸ¤‘šŸŒŠšŸ¤ÆšŸ·ā˜ŽšŸ’§šŸ˜ÆšŸ’†šŸ‘†šŸŽ¤šŸ™‡šŸ‘ā„šŸŒ“šŸ’£šŸøšŸ’ŒšŸ“šŸ„€šŸ¤¢šŸ‘…šŸ’”šŸ’©šŸ‘šŸ“øšŸ‘»šŸ¤šŸ¤®šŸŽ¼šŸ„µšŸš©šŸŽšŸŠšŸ‘¼šŸ’šŸ“£šŸ„‚"),alphabetBytesToChars$2=alphabet$2.reduce((o,e,a)=>(o[a]=e,o),[]),alphabetCharsToBytes$2=alphabet$2.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode$4(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars$2[a],e),"")}function decode$4(o){const e=[];for(const a of o){const s=alphabetCharsToBytes$2[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}const base256emoji$2=from$2({prefix:"šŸš€",name:"base256emoji",encode:encode$4,decode:decode$4}),base256emoji$3=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$2},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$1={...identityBase$1,...base2$3,...base8$3,...base10$3,...base16$3,...base32$3,...base36$3,...base58$1,...base64$5,...base256emoji$3};function base$1(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src$2=base$1,_brrp__multiformats_scope_baseX$1=src$2;const coerce$1=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=o=>new TextEncoder().encode(o),toString$2=o=>new TextDecoder().decode(o);let Encoder$1=class{constructor(e,a,s){this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder$1=class{constructor(e,a,s){if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or$1(this,e)}},ComposedDecoder$1=class{constructor(e){this.decoders=e}or(e){return or$1(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const or$1=(o,e)=>new ComposedDecoder$1({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let Codec$1=class{constructor(e,a,s,AA){this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder$1(e,a,s),this.decoder=new Decoder$1(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const from$1=({name:o,prefix:e,encode:a,decode:s})=>new Codec$1(o,e,a,s),baseX$1=({prefix:o,name:e,alphabet:a})=>{const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX$1(a,e);return from$1({prefix:o,name:e,encode:s,decode:eA=>coerce$1(AA(eA))})},decode$3=(o,e,a,s)=>{const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA},encode$3=(o,e,a)=>{const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA&&(eA+=e[AA&oA<from$1({prefix:e,name:o,encode(AA){return encode$3(AA,s,a)},decode(AA){return decode$3(AA,s,a,o)}});baseX$1({prefix:"9",name:"base10",alphabet:"0123456789"});rfc4648$1({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4});rfc4648$1({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});rfc4648$1({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});const alphabet$1=Array.from("šŸš€šŸŖā˜„šŸ›°šŸŒŒšŸŒ‘šŸŒ’šŸŒ“šŸŒ”šŸŒ•šŸŒ–šŸŒ—šŸŒ˜šŸŒšŸŒšŸŒŽšŸ‰ā˜€šŸ’»šŸ–„šŸ’¾šŸ’暟˜‚ā¤šŸ˜šŸ¤£šŸ˜ŠšŸ™šŸ’•šŸ˜­šŸ˜˜šŸ‘šŸ˜…šŸ‘šŸ˜šŸ”„šŸ„°šŸ’”šŸ’–šŸ’™šŸ˜¢šŸ¤”šŸ˜†šŸ™„šŸ’ŖšŸ˜‰ā˜ŗšŸ‘ŒšŸ¤—šŸ’œšŸ˜”šŸ˜ŽšŸ˜‡šŸŒ¹šŸ¤¦šŸŽ‰šŸ’žāœŒāœØšŸ¤·šŸ˜±šŸ˜ŒšŸŒøšŸ™ŒšŸ˜‹šŸ’—šŸ’ššŸ˜šŸ’›šŸ™‚šŸ’“šŸ¤©šŸ˜„šŸ˜€šŸ–¤šŸ˜ƒšŸ’ÆšŸ™ˆšŸ‘‡šŸŽ¶šŸ˜’šŸ¤­ā£šŸ˜œšŸ’‹šŸ‘€šŸ˜ŖšŸ˜‘šŸ’„šŸ™‹šŸ˜žšŸ˜©šŸ˜”šŸ¤ŖšŸ‘ŠšŸ„³šŸ˜„šŸ¤¤šŸ‘‰šŸ’ƒšŸ˜³āœ‹šŸ˜ššŸ˜šŸ˜“šŸŒŸšŸ˜¬šŸ™ƒšŸ€šŸŒ·šŸ˜»šŸ˜“ā­āœ…šŸ„ŗšŸŒˆšŸ˜ˆšŸ¤˜šŸ’¦āœ”šŸ˜£šŸƒšŸ’ā˜¹šŸŽŠšŸ’˜šŸ˜ ā˜šŸ˜•šŸŒŗšŸŽ‚šŸŒ»šŸ˜šŸ–•šŸ’šŸ™ŠšŸ˜¹šŸ—£šŸ’«šŸ’€šŸ‘‘šŸŽµšŸ¤žšŸ˜›šŸ”“šŸ˜¤šŸŒ¼šŸ˜«āš½šŸ¤™ā˜•šŸ†šŸ¤«šŸ‘ˆšŸ˜®šŸ™†šŸ»šŸƒšŸ¶šŸ’šŸ˜²šŸŒæšŸ§”šŸŽāš”šŸŒžšŸŽˆāŒāœŠšŸ‘‹šŸ˜°šŸ¤ØšŸ˜¶šŸ¤šŸš¶šŸ’°šŸ“šŸ’¢šŸ¤ŸšŸ™šŸšØšŸ’ØšŸ¤¬āœˆšŸŽ€šŸŗšŸ¤“šŸ˜™šŸ’ŸšŸŒ±šŸ˜–šŸ‘¶šŸ„“ā–¶āž”ā“šŸ’ŽšŸ’øā¬‡šŸ˜ØšŸŒššŸ¦‹šŸ˜·šŸ•ŗāš šŸ™…šŸ˜ŸšŸ˜µšŸ‘ŽšŸ¤²šŸ¤ šŸ¤§šŸ“ŒšŸ”µšŸ’…šŸ§šŸ¾šŸ’šŸ˜—šŸ¤‘šŸŒŠšŸ¤ÆšŸ·ā˜ŽšŸ’§šŸ˜ÆšŸ’†šŸ‘†šŸŽ¤šŸ™‡šŸ‘ā„šŸŒ“šŸ’£šŸøšŸ’ŒšŸ“šŸ„€šŸ¤¢šŸ‘…šŸ’”šŸ’©šŸ‘šŸ“øšŸ‘»šŸ¤šŸ¤®šŸŽ¼šŸ„µšŸš©šŸŽšŸŠšŸ‘¼šŸ’šŸ“£šŸ„‚"),alphabetBytesToChars$1=alphabet$1.reduce((o,e,a)=>(o[a]=e,o),[]),alphabetCharsToBytes$1=alphabet$1.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode$2(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars$1[a],e),"")}function decode$2(o){const e=[];for(const a of o){const s=alphabetCharsToBytes$1[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}from$1({prefix:"šŸš€",name:"base256emoji",encode:encode$2,decode:decode$2});rfc4648$1({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc4648$1({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5});rfc4648$1({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5});rfc4648$1({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5});rfc4648$1({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5});rfc4648$1({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});rfc4648$1({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5});rfc4648$1({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5});rfc4648$1({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});baseX$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"});baseX$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});baseX$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});rfc4648$1({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});rfc4648$1({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6});rfc4648$1({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6});rfc4648$1({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});rfc4648$1({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});from$1({prefix:"\0",name:"identity",encode:o=>toString$2(o),decode:o=>fromString$1(o)});new TextEncoder;new TextDecoder;const V$1=-1,names$1={},codes$1={},table$1=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V$1,"ip6zone"],[43,8,"ipcidr"],[53,V$1,"dns",!0],[54,V$1,"dns4",!0],[55,V$1,"dns6",!0],[56,V$1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[281,0,"webrtc-w3c"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V$1,"unix",!1,!0],[421,V$1,"ipfs"],[421,V$1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V$1,"garlic64"],[448,0,"tls"],[449,V$1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V$1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V$1,"memory"]];table$1.forEach(o=>{const e=createProtocol$1(...o);codes$1[e.code]=e,names$1[e.name]=e});function createProtocol$1(o,e,a,s,AA){return{code:o,size:e,name:a,resolvable:!!s,path:!!AA}}function getProtocol$1(o){if(typeof o=="number"){if(codes$1[o]!=null)return codes$1[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names$1[o]!=null)return names$1[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}const decoders$1=Object.values(bases$1).map(o=>o.decoder);(function(){let o=decoders$1[0].or(decoders$1[1]);return decoders$1.slice(2).forEach(e=>o=o.or(e)),o})();getProtocol$1("dns").code,getProtocol$1("dns4").code,getProtocol$1("dns6").code,getProtocol$1("dnsaddr").code;function commonjsRequire(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1,define_process_env_default={};const isElectron=isElectron_1,IS_ENV_WITH_DOM=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,IS_ELECTRON=isElectron(),IS_BROWSER=IS_ENV_WITH_DOM&&!IS_ELECTRON,IS_ELECTRON_MAIN=IS_ELECTRON&&!IS_ENV_WITH_DOM,IS_ELECTRON_RENDERER=IS_ELECTRON&&IS_ENV_WITH_DOM,IS_NODE=typeof commonjsRequire=="function"&&typeof process<"u"&&typeof process.release<"u"&&process.release.name==="node"&&!IS_ELECTRON,IS_WEBWORKER=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,IS_TEST=typeof process<"u"&&typeof define_process_env_default<"u"&&!1,IS_REACT_NATIVE=typeof navigator<"u"&&navigator.product==="ReactNative";var env={isTest:IS_TEST,isElectron:IS_ELECTRON,isElectronMain:IS_ELECTRON_MAIN,isElectronRenderer:IS_ELECTRON_RENDERER,isNode:IS_NODE,isBrowser:IS_BROWSER,isWebWorker:IS_WEBWORKER,isEnvWithDom:IS_ENV_WITH_DOM,isReactNative:IS_REACT_NATIVE},browser$1={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var o=1e3,e=o*60,a=e*60,s=a*24,AA=s*7,eA=s*365.25;ms=function(uA,FA){FA=FA||{};var pA=typeof uA;if(pA==="string"&&uA.length>0)return BA(uA);if(pA==="number"&&isFinite(uA))return FA.long?nA(uA):oA(uA);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(uA))};function BA(uA){if(uA=String(uA),!(uA.length>100)){var FA=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(uA);if(FA){var pA=parseFloat(FA[1]),zA=(FA[2]||"ms").toLowerCase();switch(zA){case"years":case"year":case"yrs":case"yr":case"y":return pA*eA;case"weeks":case"week":case"w":return pA*AA;case"days":case"day":case"d":return pA*s;case"hours":case"hour":case"hrs":case"hr":case"h":return pA*a;case"minutes":case"minute":case"mins":case"min":case"m":return pA*e;case"seconds":case"second":case"secs":case"sec":case"s":return pA*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return pA;default:return}}}}function oA(uA){var FA=Math.abs(uA);return FA>=s?Math.round(uA/s)+"d":FA>=a?Math.round(uA/a)+"h":FA>=e?Math.round(uA/e)+"m":FA>=o?Math.round(uA/o)+"s":uA+"ms"}function nA(uA){var FA=Math.abs(uA);return FA>=s?hA(uA,FA,s,"day"):FA>=a?hA(uA,FA,a,"hour"):FA>=e?hA(uA,FA,e,"minute"):FA>=o?hA(uA,FA,o,"second"):uA+" ms"}function hA(uA,FA,pA,zA){var LA=FA>=pA*1.5;return Math.round(uA/pA)+" "+zA+(LA?"s":"")}return ms}function setup(o){a.debug=a,a.default=a,a.coerce=nA,a.disable=eA,a.enable=AA,a.enabled=BA,a.humanize=requireMs(),a.destroy=hA,Object.keys(o).forEach(uA=>{a[uA]=o[uA]}),a.names=[],a.skips=[],a.formatters={};function e(uA){let FA=0;for(let pA=0;pA{if(BI==="%%")return"%";iI++;const CI=a.formatters[jA];if(typeof CI=="function"){const VA=QI[iI];BI=CI.call(_A,VA),QI.splice(iI,1),iI--}return BI}),a.formatArgs.call(_A,QI),(_A.log||a.log).apply(_A,QI)}return YA.namespace=uA,YA.useColors=a.useColors(),YA.color=a.selectColor(uA),YA.extend=s,YA.destroy=a.destroy,Object.defineProperty(YA,"enabled",{enumerable:!0,configurable:!1,get:()=>pA!==null?pA:(zA!==a.namespaces&&(zA=a.namespaces,LA=a.enabled(uA)),LA),set:QI=>{pA=QI}}),typeof a.init=="function"&&a.init(YA),YA}function s(uA,FA){const pA=a(this.namespace+(typeof FA>"u"?":":FA)+uA);return pA.log=this.log,pA}function AA(uA){a.save(uA),a.namespaces=uA,a.names=[],a.skips=[];let FA;const pA=(typeof uA=="string"?uA:"").split(/[\s,]+/),zA=pA.length;for(FA=0;FA"-"+FA)].join(",");return a.enable(""),uA}function BA(uA){if(uA[uA.length-1]==="*")return!0;let FA,pA;for(FA=0,pA=a.skips.length;FA{let hA=!1;return()=>{hA||(hA=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function s(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function AA(hA){if(hA[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+hA[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const uA="color: "+this.color;hA.splice(1,0,uA,"color: inherit");let FA=0,pA=0;hA[0].replace(/%[a-zA-Z%]/g,zA=>{zA!=="%%"&&(FA++,zA==="%c"&&(pA=FA))}),hA.splice(pA,0,uA)}e.log=console.debug||console.log||(()=>{});function eA(hA){try{hA?e.storage.setItem("debug",hA):e.storage.removeItem("debug")}catch{}}function BA(){let hA;try{hA=e.storage.getItem("debug")}catch{}return!hA&&typeof process<"u"&&"env"in process&&(hA=a.DEBUG),hA}function oA(){try{return localStorage}catch{}}o.exports=common(e);const{formatters:nA}=o.exports;nA.j=function(hA){try{return JSON.stringify(hA)}catch(uA){return"[UnexpectedJSONParseError]: "+uA.message}}})(browser$1,browser$1.exports);var browserExports=browser$1.exports;const debug=getDefaultExportFromCjs(browserExports);debug.formatters.b=o=>o==null?"undefined":base58btc$1.baseEncode(o);debug.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);debug.formatters.m=o=>o==null?"undefined":base64$4.baseEncode(o);debug.formatters.p=o=>o==null?"undefined":o.toString();debug.formatters.c=o=>o==null?"undefined":o.toString();debug.formatters.k=o=>o==null?"undefined":o.toString();debug.formatters.a=o=>o==null?"undefined":o.toString();function createDisabledLogger(o){const e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=o,e.destroy=()=>!0,e.extend=()=>e,e}function logger(o){let e=createDisabledLogger(`${o}:trace`);return debug.enabled(`${o}:trace`)&&debug.names.map(a=>a.toString()).find(a=>a.includes(":trace"))!=null&&(e=debug(`${o}:trace`)),Object.assign(debug(o),{error:debug(`${o}:error`),trace:e})}var error={};let TimeoutError$2=class extends Error{constructor(e="Request timed out"){super(e),this.name="TimeoutError"}};error.TimeoutError=TimeoutError$2;let AbortError$1=class extends Error{constructor(e="The operation was aborted."){super(e),this.name="AbortError"}};error.AbortError=AbortError$1;let HTTPError$1=class extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}};error.HTTPError=HTTPError$1;var src$1={exports:{}},browser={exports:{}},hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,function(o,e){var a=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof commonjsGlobal<"u")return commonjsGlobal;throw new Error("unable to locate global object")},s=a();o.exports=e=s.fetch,s.fetch&&(e.default=s.fetch.bind(s)),e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response}(browser,browser.exports)),browser.exports}globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?src$1.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:src$1.exports={default:requireBrowser().default,Headers:requireBrowser().Headers,Request:requireBrowser().Request,Response:requireBrowser().Response};var srcExports=src$1.exports,fetch_browser$1=srcExports;const{TimeoutError:TimeoutError$1,AbortError}=error,{Response:Response$1,Request:Request$2,Headers:Headers$2,default:fetch$2}=fetch_browser$1,fetchWithProgress=(o,e={})=>{const a=new XMLHttpRequest;a.open(e.method||"GET",o.toString(),!0);const{timeout:s,headers:AA}=e;if(s&&s>0&&s<1/0&&(a.timeout=s),e.overrideMimeType!=null&&a.overrideMimeType(e.overrideMimeType),AA)for(const[eA,BA]of new Headers$2(AA))a.setRequestHeader(eA,BA);return e.signal&&(e.signal.onabort=()=>a.abort()),e.onUploadProgress&&(a.upload.onprogress=e.onUploadProgress),a.responseType="arraybuffer",new Promise((eA,BA)=>{const oA=nA=>{switch(nA.type){case"error":{eA(Response$1.error());break}case"load":{eA(new ResponseWithURL(a.responseURL,a.response,{status:a.status,statusText:a.statusText,headers:parseHeaders(a.getAllResponseHeaders())}));break}case"timeout":{BA(new TimeoutError$1);break}case"abort":{BA(new AbortError);break}}};a.onerror=oA,a.onload=oA,a.ontimeout=oA,a.onabort=oA,a.send(e.body)})},fetchWithStreaming=fetch$2,fetchWith=(o,e={})=>e.onUploadProgress!=null?fetchWithProgress(o,e):fetchWithStreaming(o,e),parseHeaders=o=>{const e=new Headers$2;for(const a of o.trim().split(/[\r\n]+/)){const s=a.indexOf(": ");s>0&&e.set(a.slice(0,s),a.slice(s+1))}return e};class ResponseWithURL extends Response$1{constructor(e,a,s){super(a,s),Object.defineProperty(this,"url",{value:e})}}var fetch_browser={fetch:fetchWith,Request:Request$2,Headers:Headers$2},isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const e=Object.getPrototypeOf(o);return e===null||e===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty=(o,e,a)=>Object.defineProperty(o,e,{value:a,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const e=[];for(const a in o)hasOwnProperty.call(o,a)&&e.push(a);if(Object.getOwnPropertySymbols){const a=Object.getOwnPropertySymbols(o);for(const s of a)propertyIsEnumerable.call(o,s)&&e.push(s)}return e};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const e=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(a=>{defineProperty(e,a,clone(o[a]))}),e}function cloneOptionObject(o){const e=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(a=>{defineProperty(e,a,clone(o[a]))}),e}const mergeKeys=(o,e,a,s)=>(a.forEach(AA=>{typeof e[AA]>"u"&&s.ignoreUndefined||(AA in o&&o[AA]!==Object.getPrototypeOf(o)?defineProperty(o,AA,merge$1(o[AA],e[AA],s)):defineProperty(o,AA,clone(e[AA])))}),o),concatArrays=(o,e,a)=>{let s=o.slice(0,0),AA=0;return[o,e].forEach(eA=>{const BA=[];for(let oA=0;oA!BA.includes(oA)),a)}),s};function merge$1(o,e,a){return a.concatArrays&&Array.isArray(o)&&Array.isArray(e)?concatArrays(o,e,a):!isOptionObject(e)||!isOptionObject(o)?clone(e):mergeKeys(o,e,getEnumerableOwnPropertyKeys(e),a)}var mergeOptions=function(...o){const e=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let a={_:{}};for(const s of o)if(s!==void 0){if(!isOptionObject(s))throw new TypeError("`"+s+"` is not an Option Object");a=merge$1(a,{_:s},e)}return a._};const mergeOpts=getDefaultExportFromCjs(mergeOptions),isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative";function getDefaultBase(){return isReactNative?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}const URL$2=self.URL,defaultBase$1=getDefaultBase();let URLWithLegacySupport$2=class{constructor(e="",a=defaultBase$1){this.super=new URL$2(e,a),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return URL$2.createObjectURL(e)}static revokeObjectURL(e){URL$2.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function format$2(o){if(typeof o=="string")return new URL$2(o).toString();if(!(o instanceof URL$2)){const e=o.username&&o.password?`${o.username}:${o.password}@`:"",a=o.auth?o.auth+"@":"",s=o.port?":"+o.port:"",AA=o.protocol?o.protocol+"//":"",eA=o.host||"",BA=o.hostname||"",oA=o.search||(o.query?"?"+o.query:""),nA=o.hash||"",hA=o.pathname||"",uA=o.path||hA+oA;return`${AA}${e||a}${eA||BA+s}${uA}${nA}`}}var urlBrowser={URLWithLegacySupport:URLWithLegacySupport$2,URLSearchParams:self.URLSearchParams,defaultBase:defaultBase$1,format:format$2};const{URLWithLegacySupport:URLWithLegacySupport$1,format:format$1}=urlBrowser;var relative$1=(o,e={},a={},s)=>{let AA=e.protocol?e.protocol.replace(":",""):"http";AA=(a[AA]||s||AA)+":";let eA;try{eA=new URLWithLegacySupport$1(o)}catch{eA={}}const BA=Object.assign({},e,{protocol:AA||eA.protocol,host:e.host||eA.host});return new URLWithLegacySupport$1(o,format$1(BA)).toString()};const{URLWithLegacySupport,format,URLSearchParams:URLSearchParams$2,defaultBase}=urlBrowser,relative=relative$1;var isoUrl={URL:URLWithLegacySupport,URLSearchParams:URLSearchParams$2,format,relative,defaultBase},anySignal$2={exports:{}};function anySignal$1(o){const e=new globalThis.AbortController;function a(){e.abort();for(const s of o)!s||!s.removeEventListener||s.removeEventListener("abort",a)}for(const s of o)if(!(!s||!s.addEventListener)){if(s.aborted){a();break}s.addEventListener("abort",a)}return e.signal}anySignal$2.exports=anySignal$1;anySignal$2.exports.anySignal=anySignal$1;var anySignalExports=anySignal$2.exports;async function*browserReadableStreamToIt(o,e={}){const a=o.getReader();try{for(;;){const s=await a.read();if(s.done)return;yield s.value}}finally{e.preventCancel!==!0&&a.cancel(),a.releaseLock()}}var browserReadablestreamToIt=browserReadableStreamToIt;const all$1=async o=>{const e=[];for await(const a of o)e.push(a);return e};var itAll=all$1;const{fetch:fetch$1,Request:Request$1,Headers:Headers$1}=fetch_browser,{TimeoutError,HTTPError}=error,merge=mergeOptions.bind({ignoreUndefined:!0}),{URL:URL$1,URLSearchParams:URLSearchParams$1}=isoUrl,anySignal=anySignalExports,browserReableStreamToIt=browserReadablestreamToIt,{isBrowser,isWebWorker}=env,all=itAll,timeout=(o,e,a)=>{if(e===void 0)return o;const s=Date.now(),AA=()=>Date.now()-s>=e;return new Promise((eA,BA)=>{const oA=setTimeout(()=>{AA()&&(BA(new TimeoutError),a.abort())},e),nA=hA=>FA=>{if(clearTimeout(oA),AA()){BA(new TimeoutError);return}hA(FA)};o.then(nA(eA),nA(BA))})},defaults={throwHttpErrors:!0,credentials:"same-origin"};class HTTP{constructor(e={}){this.opts=merge(defaults,e)}async fetch(e,a={}){const s=merge(this.opts,a),AA=new Headers$1(s.headers);if(typeof e!="string"&&!(e instanceof URL$1||e instanceof Request$1))throw new TypeError("`resource` must be a string, URL, or Request");const eA=new URL$1(e.toString(),s.base),{searchParams:BA,transformSearchParams:oA,json:nA}=s;BA&&(typeof oA=="function"?eA.search=oA(new URLSearchParams$1(s.searchParams)):eA.search=new URLSearchParams$1(s.searchParams)),nA&&(s.body=JSON.stringify(s.json),AA.set("content-type","application/json"));const hA=new AbortController,uA=anySignal([hA.signal,s.signal]);globalThis.ReadableStream!=null&&s.body instanceof globalThis.ReadableStream&&(isBrowser||isWebWorker)&&(s.body=new Blob(await all(browserReableStreamToIt(s.body))));const FA=await timeout(fetch$1(eA.toString(),{...s,signal:uA,timeout:void 0,headers:AA,duplex:"half"}),s.timeout,hA);if(!FA.ok&&s.throwHttpErrors)throw s.handleError&&await s.handleError(FA),new HTTPError(FA);return FA.iterator=async function*(){yield*fromStream(FA.body)},FA.ndjson=async function*(){for await(const pA of ndjson(FA.iterator()))a.transform?yield a.transform(pA):yield pA},FA}post(e,a={}){return this.fetch(e,{...a,method:"POST"})}get(e,a={}){return this.fetch(e,{...a,method:"GET"})}put(e,a={}){return this.fetch(e,{...a,method:"PUT"})}delete(e,a={}){return this.fetch(e,{...a,method:"DELETE"})}options(e,a={}){return this.fetch(e,{...a,method:"OPTIONS"})}}const ndjson=async function*(o){const e=new TextDecoder;let a="";for await(const s of o){a+=e.decode(s,{stream:!0});const AA=a.split(/\r?\n/);for(let eA=0;eA0&&(yield JSON.parse(BA))}a=AA[AA.length-1]}a+=e.decode(),a=a.trim(),a.length!==0&&(yield JSON.parse(a))},fromStream=o=>{if(isAsyncIterable(o))return o;if(isNodeReadableStream(o)){const e=o[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:e.next.bind(e),return(a){return o.destroy(),typeof e.return=="function"?e.return():Promise.resolve({done:!0,value:a})}}}}}if(isWebReadableStream(o)){const e=o.getReader();return async function*(){try{for(;;){const{done:a,value:s}=await e.read();if(a)return;s&&(yield s)}}finally{e.releaseLock()}}()}throw new TypeError("Body can't be converted to AsyncIterable")},isAsyncIterable=o=>typeof o=="object"&&o!==null&&typeof o[Symbol.asyncIterator]=="function",isWebReadableStream=o=>o&&typeof o.getReader=="function",isNodeReadableStream=o=>Object.prototype.hasOwnProperty.call(o,"readable")&&Object.prototype.hasOwnProperty.call(o,"writable");HTTP.HTTPError=HTTPError;HTTP.TimeoutError=TimeoutError;HTTP.streamToAsyncIterator=fromStream;HTTP.post=(o,e)=>new HTTP(e).post(o,e);HTTP.get=(o,e)=>new HTTP(e).get(o,e);HTTP.put=(o,e)=>new HTTP(e).put(o,e);HTTP.delete=(o,e)=>new HTTP(e).delete(o,e);HTTP.options=(o,e)=>new HTTP(e).options(o,e);var http=HTTP;const HTTP$1=getDefaultExportFromCjs(http);function coerce(o){if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")}function fromString(o){return new TextEncoder().encode(o)}function toString$1(o){return new TextDecoder().decode(o)}function base(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),s=0;s>>0,iI=new Uint8Array(MA);_A!==JA;){for(var _g=LA[_A],BI=0,jA=MA-1;(_g!==0||BI>>0,iI[jA]=_g%oA>>>0,_g=_g/oA>>>0;if(_g!==0)throw new Error("Non-zero carry");QI=BI,_A++}for(var CI=MA-QI;CI!==MA&&iI[CI]===0;)CI++;for(var VA=nA.repeat(YA);CI>>0,MA=new Uint8Array(JA);LA[YA];){var iI=a[LA.charCodeAt(YA)];if(iI===255)return;for(var _g=0,BI=JA-1;(iI!==0||_g<_A)&&BI!==-1;BI--,_g++)iI+=oA*MA[BI]>>>0,MA[BI]=iI%256>>>0,iI=iI/256>>>0;if(iI!==0)throw new Error("Non-zero carry");_A=_g,YA++}if(LA[YA]!==" "){for(var jA=JA-_A;jA!==JA&&MA[jA]===0;)jA++;for(var CI=new Uint8Array(QI+(JA-jA)),VA=QI;jA!==JA;)CI[VA++]=MA[jA++];return CI}}}function zA(LA){var YA=pA(LA);if(YA)return YA;throw new Error(`Non-${e} character`)}return{encode:FA,decodeUnsafe:pA,decode:zA}}var src=base,_brrp__multiformats_scope_baseX=src;class Encoder{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");this.name=e,this.prefix=a,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(e,a,s){mI(this,"name");mI(this,"prefix");mI(this,"baseDecode");mI(this,"prefixCodePoint");if(this.name=e,this.prefix=a,a.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=s}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return or(this,e)}}class ComposedDecoder{constructor(e){mI(this,"decoders");this.decoders=e}or(e){return or(this,e)}decode(e){const a=e[0],s=this.decoders[a];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or(o,e){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...e.decoders??{[e.prefix]:e}})}class Codec{constructor(e,a,s,AA){mI(this,"name");mI(this,"prefix");mI(this,"baseEncode");mI(this,"baseDecode");mI(this,"encoder");mI(this,"decoder");this.name=e,this.prefix=a,this.baseEncode=s,this.baseDecode=AA,this.encoder=new Encoder(e,a,s),this.decoder=new Decoder(e,a,AA)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function from({name:o,prefix:e,encode:a,decode:s}){return new Codec(o,e,a,s)}function baseX({name:o,prefix:e,alphabet:a}){const{encode:s,decode:AA}=_brrp__multiformats_scope_baseX(a,o);return from({prefix:e,name:o,encode:s,decode:eA=>coerce(AA(eA))})}function decode$1(o,e,a,s){const AA={};for(let uA=0;uA=8&&(oA-=8,BA[hA++]=255&nA>>oA)}if(oA>=a||255&nA<<8-oA)throw new SyntaxError("Unexpected end of data");return BA}function encode$1(o,e,a){const s=e[e.length-1]==="=",AA=(1<a;)BA-=a,eA+=e[AA&oA>>BA];if(BA!==0&&(eA+=e[AA&oA<(o[a]=e,o),[]),alphabetCharsToBytes=alphabet.reduce((o,e,a)=>(o[e.codePointAt(0)]=a,o),[]);function encode(o){return o.reduce((e,a)=>(e+=alphabetBytesToChars[a],e),"")}function decode(o){const e=[];for(const a of o){const s=alphabetCharsToBytes[a.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${a}`);e.push(s)}return new Uint8Array(e)}const base256emoji=from({prefix:"šŸš€",name:"base256emoji",encode,decode}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity=from({prefix:"\0",name:"identity",encode:o=>toString$1(o),decode:o=>fromString(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$3,...base256emoji$1},V=-1,names={},codes={},table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V,"ip6zone"],[43,8,"ipcidr"],[53,V,"dns",!0],[54,V,"dns4",!0],[55,V,"dns6",!0],[56,V,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V,"unix",!1,!0],[421,V,"ipfs"],[421,V,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V,"garlic64"],[448,0,"tls"],[449,V,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V,"memory"]];table.forEach(o=>{const e=createProtocol(...o);codes[e.code]=e,names[e.name]=e});function createProtocol(o,e,a,s,AA){return{code:o,size:e,name:a,resolvable:!!s,path:!!AA}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");const decoders=Object.values(bases).map(o=>o.decoder);(function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(e=>o=o.or(e)),o})();getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code;logger("ipfs-http-client:lib:error-handler");mergeOpts.bind({ignoreUndefined:!0});HTTP$1.HTTPError;Object.values(bases$1).map(o=>o.decoder).reduce((o,e)=>o.or(e),bases$1.identity.decoder);var indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(o,e){for(var a=new Array(arguments.length-1),s=0,AA=2,eA=!0;AA1&&oA.charAt(nA)==="=";)++hA;return Math.ceil(oA.length*3)/4-hA};for(var a=new Array(64),s=new Array(123),AA=0;AA<64;)s[a[AA]=AA<26?AA+65:AA<52?AA+71:AA<62?AA-4:AA-59|43]=AA++;e.encode=function(oA,nA,hA){for(var uA=null,FA=[],pA=0,zA=0,LA;nA>2],LA=(YA&3)<<4,zA=1;break;case 1:FA[pA++]=a[LA|YA>>4],LA=(YA&15)<<2,zA=2;break;case 2:FA[pA++]=a[LA|YA>>6],FA[pA++]=a[YA&63],zA=0;break}pA>8191&&((uA||(uA=[])).push(String.fromCharCode.apply(String,FA)),pA=0)}return zA&&(FA[pA++]=a[LA],FA[pA++]=61,zA===1&&(FA[pA++]=61)),uA?(pA&&uA.push(String.fromCharCode.apply(String,FA.slice(0,pA))),uA.join("")):String.fromCharCode.apply(String,FA.slice(0,pA))};var eA="invalid encoding";e.decode=function(oA,nA,hA){for(var uA=hA,FA=0,pA,zA=0;zA1)break;if((LA=s[LA])===void 0)throw Error(eA);switch(FA){case 0:pA=LA,FA=1;break;case 1:nA[hA++]=pA<<2|(LA&48)>>4,pA=LA,FA=2;break;case 2:nA[hA++]=(pA&15)<<4|(LA&60)>>2,pA=LA,FA=3;break;case 3:nA[hA++]=(pA&3)<<6|LA,FA=0;break}}if(FA===1)throw Error(eA);return hA-uA},e.test=function(oA){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(oA)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,a,s){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:a,ctx:s||this}),this};EventEmitter.prototype.off=function(e,a){if(e===void 0)this._listeners={};else if(a===void 0)this._listeners[e]=[];else for(var s=this._listeners[e],AA=0;AA0?0:2147483648,eA,BA);else if(isNaN(AA))s(2143289344,eA,BA);else if(AA>34028234663852886e22)s((oA<<31|2139095040)>>>0,eA,BA);else if(AA<11754943508222875e-54)s((oA<<31|Math.round(AA/1401298464324817e-60))>>>0,eA,BA);else{var nA=Math.floor(Math.log(AA)/Math.LN2),hA=Math.round(AA*Math.pow(2,-nA)*8388608)&8388607;s((oA<<31|nA+127<<23|hA)>>>0,eA,BA)}}o.writeFloatLE=e.bind(null,writeUintLE),o.writeFloatBE=e.bind(null,writeUintBE);function a(s,AA,eA){var BA=s(AA,eA),oA=(BA>>31)*2+1,nA=BA>>>23&255,hA=BA&8388607;return nA===255?hA?NaN:oA*(1/0):nA===0?oA*1401298464324817e-60*hA:oA*Math.pow(2,nA-150)*(hA+8388608)}o.readFloatLE=a.bind(null,readUintLE),o.readFloatBE=a.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),a=new Uint8Array(e.buffer),s=a[7]===128;function AA(nA,hA,uA){e[0]=nA,hA[uA]=a[0],hA[uA+1]=a[1],hA[uA+2]=a[2],hA[uA+3]=a[3],hA[uA+4]=a[4],hA[uA+5]=a[5],hA[uA+6]=a[6],hA[uA+7]=a[7]}function eA(nA,hA,uA){e[0]=nA,hA[uA]=a[7],hA[uA+1]=a[6],hA[uA+2]=a[5],hA[uA+3]=a[4],hA[uA+4]=a[3],hA[uA+5]=a[2],hA[uA+6]=a[1],hA[uA+7]=a[0]}o.writeDoubleLE=s?AA:eA,o.writeDoubleBE=s?eA:AA;function BA(nA,hA){return a[0]=nA[hA],a[1]=nA[hA+1],a[2]=nA[hA+2],a[3]=nA[hA+3],a[4]=nA[hA+4],a[5]=nA[hA+5],a[6]=nA[hA+6],a[7]=nA[hA+7],e[0]}function oA(nA,hA){return a[7]=nA[hA],a[6]=nA[hA+1],a[5]=nA[hA+2],a[4]=nA[hA+3],a[3]=nA[hA+4],a[2]=nA[hA+5],a[1]=nA[hA+6],a[0]=nA[hA+7],e[0]}o.readDoubleLE=s?BA:oA,o.readDoubleBE=s?oA:BA}():function(){function e(s,AA,eA,BA,oA,nA){var hA=BA<0?1:0;if(hA&&(BA=-BA),BA===0)s(0,oA,nA+AA),s(1/BA>0?0:2147483648,oA,nA+eA);else if(isNaN(BA))s(0,oA,nA+AA),s(2146959360,oA,nA+eA);else if(BA>17976931348623157e292)s(0,oA,nA+AA),s((hA<<31|2146435072)>>>0,oA,nA+eA);else{var uA;if(BA<22250738585072014e-324)uA=BA/5e-324,s(uA>>>0,oA,nA+AA),s((hA<<31|uA/4294967296)>>>0,oA,nA+eA);else{var FA=Math.floor(Math.log(BA)/Math.LN2);FA===1024&&(FA=1023),uA=BA*Math.pow(2,-FA),s(uA*4503599627370496>>>0,oA,nA+AA),s((hA<<31|FA+1023<<20|uA*1048576&1048575)>>>0,oA,nA+eA)}}}o.writeDoubleLE=e.bind(null,writeUintLE,0,4),o.writeDoubleBE=e.bind(null,writeUintBE,4,0);function a(s,AA,eA,BA,oA){var nA=s(BA,oA+AA),hA=s(BA,oA+eA),uA=(hA>>31)*2+1,FA=hA>>>20&2047,pA=4294967296*(hA&1048575)+nA;return FA===2047?pA?NaN:uA*(1/0):FA===0?uA*5e-324*pA:uA*Math.pow(2,FA-1075)*(pA+4503599627370496)}o.readDoubleLE=a.bind(null,readUintLE,0,4),o.readDoubleBE=a.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,e,a){e[a]=o&255,e[a+1]=o>>>8&255,e[a+2]=o>>>16&255,e[a+3]=o>>>24}function writeUintBE(o,e,a){e[a]=o>>>24,e[a+1]=o>>>16&255,e[a+2]=o>>>8&255,e[a+3]=o&255}function readUintLE(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0}function readUintBE(o,e){return(o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(o){}return null}var utf8$2={};(function(o){var e=o;e.length=function(s){for(var AA=0,eA=0,BA=0;BA191&&uA<224?nA[hA++]=(uA&31)<<6|s[AA++]&63:uA>239&&uA<365?(uA=((uA&7)<<18|(s[AA++]&63)<<12|(s[AA++]&63)<<6|s[AA++]&63)-65536,nA[hA++]=55296+(uA>>10),nA[hA++]=56320+(uA&1023)):nA[hA++]=(uA&15)<<12|(s[AA++]&63)<<6|s[AA++]&63,hA>8191&&((oA||(oA=[])).push(String.fromCharCode.apply(String,nA)),hA=0);return oA?(hA&&oA.push(String.fromCharCode.apply(String,nA.slice(0,hA))),oA.join("")):String.fromCharCode.apply(String,nA.slice(0,hA))},e.write=function(s,AA,eA){for(var BA=eA,oA,nA,hA=0;hA>6|192,AA[eA++]=oA&63|128):(oA&64512)===55296&&((nA=s.charCodeAt(hA+1))&64512)===56320?(oA=65536+((oA&1023)<<10)+(nA&1023),++hA,AA[eA++]=oA>>18|240,AA[eA++]=oA>>12&63|128,AA[eA++]=oA>>6&63|128,AA[eA++]=oA&63|128):(AA[eA++]=oA>>12|224,AA[eA++]=oA>>6&63|128,AA[eA++]=oA&63|128);return eA-BA}})(utf8$2);var pool_1=pool;function pool(o,e,a){var s=a||8192,AA=s>>>1,eA=null,BA=s;return function(nA){if(nA<1||nA>AA)return o(nA);BA+nA>s&&(eA=o(s),BA=0);var hA=e.call(eA,BA,BA+=nA);return BA&7&&(BA=(BA|7)+1),hA}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=e;var o=requireMinimal();function e(eA,BA){this.lo=eA>>>0,this.hi=BA>>>0}var a=e.zero=new e(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var s=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(BA){if(BA===0)return a;var oA=BA<0;oA&&(BA=-BA);var nA=BA>>>0,hA=(BA-nA)/4294967296>>>0;return oA&&(hA=~hA>>>0,nA=~nA>>>0,++nA>4294967295&&(nA=0,++hA>4294967295&&(hA=0))),new e(nA,hA)},e.from=function(BA){if(typeof BA=="number")return e.fromNumber(BA);if(o.isString(BA))if(o.Long)BA=o.Long.fromString(BA);else return e.fromNumber(parseInt(BA,10));return BA.low||BA.high?new e(BA.low>>>0,BA.high>>>0):a},e.prototype.toNumber=function(BA){if(!BA&&this.hi>>>31){var oA=~this.lo+1>>>0,nA=~this.hi>>>0;return oA||(nA=nA+1>>>0),-(oA+nA*4294967296)}return this.lo+this.hi*4294967296},e.prototype.toLong=function(BA){return o.Long?new o.Long(this.lo|0,this.hi|0,!!BA):{low:this.lo|0,high:this.hi|0,unsigned:!!BA}};var AA=String.prototype.charCodeAt;return e.fromHash=function(BA){return BA===s?a:new e((AA.call(BA,0)|AA.call(BA,1)<<8|AA.call(BA,2)<<16|AA.call(BA,3)<<24)>>>0,(AA.call(BA,4)|AA.call(BA,5)<<8|AA.call(BA,6)<<16|AA.call(BA,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var BA=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^BA)>>>0,this.lo=(this.lo<<1^BA)>>>0,this},e.prototype.zzDecode=function(){var BA=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^BA)>>>0,this.hi=(this.hi>>>1^BA)>>>0,this},e.prototype.length=function(){var BA=this.lo,oA=(this.lo>>>28|this.hi<<4)>>>0,nA=this.hi>>>24;return nA===0?oA===0?BA<16384?BA<128?1:2:BA<2097152?3:4:oA<16384?oA<128?5:6:oA<2097152?7:8:nA<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(o){var e=o;e.asPromise=aspromise,e.base64=base64$1,e.EventEmitter=eventemitter,e.float=float,e.inquire=inquire_1,e.utf8=utf8$2,e.pool=pool_1,e.LongBits=requireLongbits(),e.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),e.global=e.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(eA){return typeof eA=="number"&&isFinite(eA)&&Math.floor(eA)===eA},e.isString=function(eA){return typeof eA=="string"||eA instanceof String},e.isObject=function(eA){return eA&&typeof eA=="object"},e.isset=e.isSet=function(eA,BA){var oA=eA[BA];return oA!=null&&eA.hasOwnProperty(BA)?typeof oA!="object"||(Array.isArray(oA)?oA.length:Object.keys(oA).length)>0:!1},e.Buffer=function(){try{var AA=e.inquire("buffer").Buffer;return AA.prototype.utf8Write?AA:null}catch{return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(eA){return typeof eA=="number"?e.Buffer?e._Buffer_allocUnsafe(eA):new e.Array(eA):e.Buffer?e._Buffer_from(eA):typeof Uint8Array>"u"?eA:new Uint8Array(eA)},e.Array=typeof Uint8Array<"u"?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(eA){return eA?e.LongBits.from(eA).toHash():e.LongBits.zeroHash},e.longFromHash=function(eA,BA){var oA=e.LongBits.fromHash(eA);return e.Long?e.Long.fromBits(oA.lo,oA.hi,BA):oA.toNumber(!!BA)};function a(AA,eA,BA){for(var oA=Object.keys(eA),nA=0;nA-1;--hA)if(BA[nA[hA]]===1&&this[nA[hA]]!==void 0&&this[nA[hA]]!==null)return nA[hA]}},e.oneOfSetter=function(eA){return function(BA){for(var oA=0;oA127;)e[a++]=o&127|128,o>>>=7;e[a]=o}function VarintOp(o,e){this.len=o,this.next=void 0,this.val=e}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Writer$1.prototype.int32=function o(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)};Writer$1.prototype.sint32=function o(e){return this.uint32((e<<1^e>>31)>>>0)};function writeVarint64(o,e,a){for(;o.hi;)e[a++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)e[a++]=o.lo&127|128,o.lo=o.lo>>>7;e[a++]=o.lo}Writer$1.prototype.uint64=function o(e){var a=LongBits$1.from(e);return this._push(writeVarint64,a.length(),a)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(e){var a=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,a.length(),a)};Writer$1.prototype.bool=function o(e){return this._push(writeByte,1,e?1:0)};function writeFixed32(o,e,a){e[a]=o&255,e[a+1]=o>>>8&255,e[a+2]=o>>>16&255,e[a+3]=o>>>24}Writer$1.prototype.fixed32=function o(e){return this._push(writeFixed32,4,e>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(e){var a=LongBits$1.from(e);return this._push(writeFixed32,4,a.lo)._push(writeFixed32,4,a.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function o(e){return this._push(util$4.float.writeFloatLE,4,e)};Writer$1.prototype.double=function o(e){return this._push(util$4.float.writeDoubleLE,8,e)};var writeBytes=util$4.Array.prototype.set?function o(e,a,s){a.set(e,s)}:function o(e,a,s){for(var AA=0;AA>>0;if(!a)return this._push(writeByte,1,0);if(util$4.isString(e)){var s=Writer$1.alloc(a=base64.length(e));base64.decode(e,s,0),e=s}return this.uint32(a)._push(writeBytes,a,e)};Writer$1.prototype.string=function o(e){var a=utf8$1.length(e);return a?this.uint32(a)._push(utf8$1.write,a,e):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function o(){var e=this.head,a=this.tail,s=this.len;return this.reset().uint32(s),s&&(this.tail.next=e.next,this.tail=a,this.len+=s),this};Writer$1.prototype.finish=function o(){for(var e=this.head.next,a=this.constructor.alloc(this.len),s=0;e;)e.fn(e.val,a,s),s+=e.len,e=e.next;return a};Writer$1._configure=function(o){BufferWriter$1=o,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(e,a,s){a.set(e,s)}:function(e,a,s){if(e.copy)e.copy(a,s,0,e.length);else for(var AA=0;AA>>0;return this.uint32(a),a&&this._push(BufferWriter.writeBytesBuffer,a,e),this};function writeStringBuffer(o,e,a){o.length<40?util$3.utf8.write(o,e,a):e.utf8Write?e.utf8Write(o,a):e.write(o,a)}BufferWriter.prototype.string=function o(e){var a=util$3.Buffer.byteLength(e);return this.uint32(a),a&&this._push(writeStringBuffer,a,e),this};BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(o,e){return RangeError("index out of range: "+o.pos+" + "+(e||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")}:function o(e){if(Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")},create=function o(){return util$2.Buffer?function(a){return(Reader$1.create=function(AA){return util$2.Buffer.isBuffer(AA)?new BufferReader$1(AA):create_array(AA)})(a)}:create_array};Reader$1.create=create();Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice;Reader$1.prototype.uint32=function o(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return e}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var e=this.uint32();return e>>>1^-(e&1)|0};function readLongVarint(){var o=new LongBits(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;e<5;++e)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;e<5;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,e){return(o[e-4]|o[e-3]<<8|o[e-2]<<16|o[e-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Reader$1.prototype.bytes=function o(){var e=this.uint32(),a=this.pos,s=this.pos+e;if(s>this.len)throw indexOutOfRange(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(a,s);if(a===s){var AA=util$2.Buffer;return AA?AA.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,a,s)};Reader$1.prototype.string=function o(){var e=this.bytes();return utf8.read(e,0,e.length)};Reader$1.prototype.skip=function o(e){if(typeof e=="number"){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create(),BufferReader$1._configure();var e=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[e](!1)},uint64:function(){return readLongVarint.call(this)[e](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[e](!1)},fixed64:function(){return readFixed64.call(this)[e](!0)},sfixed64:function(){return readFixed64.call(this)[e](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(o,e,a){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!e,this.responseDelimited=!!a}Service.prototype.rpcCall=function o(e,a,s,AA,eA){if(!AA)throw TypeError("request must be specified");var BA=this;if(!eA)return util.asPromise(o,BA,e,a,s,AA);if(!BA.rpcImpl){setTimeout(function(){eA(Error("already ended"))},0);return}try{return BA.rpcImpl(e,a[BA.requestDelimited?"encodeDelimited":"encode"](AA).finish(),function(nA,hA){if(nA)return BA.emit("error",nA,e),eA(nA);if(hA===null){BA.end(!0);return}if(!(hA instanceof s))try{hA=s[BA.responseDelimited?"decodeDelimited":"decode"](hA)}catch(uA){return BA.emit("error",uA,e),eA(uA)}return BA.emit("data",hA,e),eA(null,hA)})}catch(oA){BA.emit("error",oA,e),setTimeout(function(){eA(oA)},0);return}};Service.prototype.end=function o(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var e=o;e.Service=service})(rpc);var roots={};(function(o){var e=o;e.build="minimal",e.Writer=writer,e.BufferWriter=writer_buffer,e.Reader=reader,e.BufferReader=reader_buffer,e.util=requireMinimal(),e.rpc=rpc,e.roots=roots,e.configure=a;function a(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}a()})(indexMinimal);var minimal=indexMinimal;const $protobuf=getDefaultExportFromCjs(minimal),$Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots["ipfs-unixfs"]||($protobuf.roots["ipfs-unixfs"]={});$root.Data=(()=>{function o(e){if(this.blocksizes=[],e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.Type=a.int32();break;case 2:eA.Data=a.bytes();break;case 3:eA.filesize=a.uint64();break;case 4:if(eA.blocksizes&&eA.blocksizes.length||(eA.blocksizes=[]),(BA&7)===2)for(var oA=a.uint32()+a.pos;a.pos>>0,a.filesize.high>>>0).toNumber(!0))),a.blocksizes){if(!Array.isArray(a.blocksizes))throw TypeError(".Data.blocksizes: array expected");s.blocksizes=[];for(var AA=0;AA>>0,a.blocksizes[AA].high>>>0).toNumber(!0))}if(a.hashType!=null&&($util.Long?(s.hashType=$util.Long.fromValue(a.hashType)).unsigned=!0:typeof a.hashType=="string"?s.hashType=parseInt(a.hashType,10):typeof a.hashType=="number"?s.hashType=a.hashType:typeof a.hashType=="object"&&(s.hashType=new $util.LongBits(a.hashType.low>>>0,a.hashType.high>>>0).toNumber(!0))),a.fanout!=null&&($util.Long?(s.fanout=$util.Long.fromValue(a.fanout)).unsigned=!0:typeof a.fanout=="string"?s.fanout=parseInt(a.fanout,10):typeof a.fanout=="number"?s.fanout=a.fanout:typeof a.fanout=="object"&&(s.fanout=new $util.LongBits(a.fanout.low>>>0,a.fanout.high>>>0).toNumber(!0))),a.mode!=null&&(s.mode=a.mode>>>0),a.mtime!=null){if(typeof a.mtime!="object")throw TypeError(".Data.mtime: object expected");s.mtime=$root.UnixTime.fromObject(a.mtime)}return s},o.toObject=function(a,s){s||(s={});var AA={};if((s.arrays||s.defaults)&&(AA.blocksizes=[]),s.defaults){if(AA.Type=s.enums===String?"Raw":0,s.bytes===String?AA.Data="":(AA.Data=[],s.bytes!==Array&&(AA.Data=$util.newBuffer(AA.Data))),$util.Long){var eA=new $util.Long(0,0,!0);AA.filesize=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.filesize=s.longs===String?"0":0;if($util.Long){var eA=new $util.Long(0,0,!0);AA.hashType=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.hashType=s.longs===String?"0":0;if($util.Long){var eA=new $util.Long(0,0,!0);AA.fanout=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.fanout=s.longs===String?"0":0;AA.mode=0,AA.mtime=null}if(a.Type!=null&&a.hasOwnProperty("Type")&&(AA.Type=s.enums===String?$root.Data.DataType[a.Type]:a.Type),a.Data!=null&&a.hasOwnProperty("Data")&&(AA.Data=s.bytes===String?$util.base64.encode(a.Data,0,a.Data.length):s.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.filesize!=null&&a.hasOwnProperty("filesize")&&(typeof a.filesize=="number"?AA.filesize=s.longs===String?String(a.filesize):a.filesize:AA.filesize=s.longs===String?$util.Long.prototype.toString.call(a.filesize):s.longs===Number?new $util.LongBits(a.filesize.low>>>0,a.filesize.high>>>0).toNumber(!0):a.filesize),a.blocksizes&&a.blocksizes.length){AA.blocksizes=[];for(var BA=0;BA>>0,a.blocksizes[BA].high>>>0).toNumber(!0):a.blocksizes[BA]}return a.hashType!=null&&a.hasOwnProperty("hashType")&&(typeof a.hashType=="number"?AA.hashType=s.longs===String?String(a.hashType):a.hashType:AA.hashType=s.longs===String?$util.Long.prototype.toString.call(a.hashType):s.longs===Number?new $util.LongBits(a.hashType.low>>>0,a.hashType.high>>>0).toNumber(!0):a.hashType),a.fanout!=null&&a.hasOwnProperty("fanout")&&(typeof a.fanout=="number"?AA.fanout=s.longs===String?String(a.fanout):a.fanout:AA.fanout=s.longs===String?$util.Long.prototype.toString.call(a.fanout):s.longs===Number?new $util.LongBits(a.fanout.low>>>0,a.fanout.high>>>0).toNumber(!0):a.fanout),a.mode!=null&&a.hasOwnProperty("mode")&&(AA.mode=a.mode),a.mtime!=null&&a.hasOwnProperty("mtime")&&(AA.mtime=$root.UnixTime.toObject(a.mtime,s)),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o.DataType=function(){const e={},a=Object.create(e);return a[e[0]="Raw"]=0,a[e[1]="Directory"]=1,a[e[2]="File"]=2,a[e[3]="Metadata"]=3,a[e[4]="Symlink"]=4,a[e[5]="HAMTShard"]=5,a}(),o})();$root.UnixTime=(()=>{function o(e){if(e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.Seconds=a.int64();break;case 2:eA.FractionalNanoseconds=a.fixed32();break;default:a.skipType(BA&7);break}}if(!eA.hasOwnProperty("Seconds"))throw $util.ProtocolError("missing required 'Seconds'",{instance:eA});return eA},o.fromObject=function(a){if(a instanceof $root.UnixTime)return a;var s=new $root.UnixTime;return a.Seconds!=null&&($util.Long?(s.Seconds=$util.Long.fromValue(a.Seconds)).unsigned=!1:typeof a.Seconds=="string"?s.Seconds=parseInt(a.Seconds,10):typeof a.Seconds=="number"?s.Seconds=a.Seconds:typeof a.Seconds=="object"&&(s.Seconds=new $util.LongBits(a.Seconds.low>>>0,a.Seconds.high>>>0).toNumber())),a.FractionalNanoseconds!=null&&(s.FractionalNanoseconds=a.FractionalNanoseconds>>>0),s},o.toObject=function(a,s){s||(s={});var AA={};if(s.defaults){if($util.Long){var eA=new $util.Long(0,0,!1);AA.Seconds=s.longs===String?eA.toString():s.longs===Number?eA.toNumber():eA}else AA.Seconds=s.longs===String?"0":0;AA.FractionalNanoseconds=0}return a.Seconds!=null&&a.hasOwnProperty("Seconds")&&(typeof a.Seconds=="number"?AA.Seconds=s.longs===String?String(a.Seconds):a.Seconds:AA.Seconds=s.longs===String?$util.Long.prototype.toString.call(a.Seconds):s.longs===Number?new $util.LongBits(a.Seconds.low>>>0,a.Seconds.high>>>0).toNumber():a.Seconds),a.FractionalNanoseconds!=null&&a.hasOwnProperty("FractionalNanoseconds")&&(AA.FractionalNanoseconds=a.FractionalNanoseconds),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o})();$root.Metadata=(()=>{function o(e){if(e)for(var a=Object.keys(e),s=0;s>>3){case 1:eA.MimeType=a.string();break;default:a.skipType(BA&7);break}}return eA},o.fromObject=function(a){if(a instanceof $root.Metadata)return a;var s=new $root.Metadata;return a.MimeType!=null&&(s.MimeType=String(a.MimeType)),s},o.toObject=function(a,s){s||(s={});var AA={};return s.defaults&&(AA.MimeType=""),a.MimeType!=null&&a.hasOwnProperty("MimeType")&&(AA.MimeType=a.MimeType),AA},o.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},o})();logger("ipfs-http-client:pubsub:subscribe");async function encryptFile(o,e){const a={name:o.name,type:o.type},s=JSON.stringify(a),eA=new TextEncoder().encode(s),BA=await readFileAsArrayBuffer(o);try{const oA=await window.crypto.subtle.encrypt(encryptionAlgorithm,e,BA),nA=await window.crypto.subtle.encrypt(encryptionAlgorithm,e,eA);return{encryptedFileData:bufferToBase64(oA),encryptedMetadata:bufferToBase64(nA),encryptionAlgorithm:{name:encryptionAlgorithm.name,length:encryptionAlgorithm.length,counter:encryptionAlgorithm.counter}}}catch(oA){throw console.error("Encryption failed:",oA),oA}}async function decryptFile(o,e){try{const a=convertCounterObjectToUint8Array(o.encryptionAlgorithm.counter),s=await window.crypto.subtle.decrypt({name:o.encryptionAlgorithm.name,counter:a,length:o.encryptionAlgorithm.length},e,base64ToArrayBuffer(o.encryptedFileData)),AA=await window.crypto.subtle.decrypt({name:o.encryptionAlgorithm.name,counter:a,length:o.encryptionAlgorithm.length},e,base64ToArrayBuffer(o.encryptedMetadata)),eA=new TextDecoder().decode(AA),BA=JSON.parse(eA);return{file:arrayBufferToFile(s,BA.name,BA.type)}}catch(a){throw console.error("Decryption failed:",a),a}}const uploadFileToIPFS=async o=>{const e="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI0ZDcyYWY4MS0xMmVjLTRlYzgtOTgzNi1hYzgxZDJmNWM3MmEiLCJlbWFpbCI6ImRpYWxsb3NlZ3VlQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaW5fcG9saWN5Ijp7InJlZ2lvbnMiOlt7ImlkIjoiRlJBMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfSx7ImlkIjoiTllDMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfV0sInZlcnNpb24iOjF9LCJtZmFfZW5hYmxlZCI6ZmFsc2UsInN0YXR1cyI6IkFDVElWRSJ9LCJhdXRoZW50aWNhdGlvblR5cGUiOiJzY29wZWRLZXkiLCJzY29wZWRLZXlLZXkiOiIyNjgwNGJkZGIxZWI5NGUwZGQ5ZSIsInNjb3BlZEtleVNlY3JldCI6ImY2YjhkMjk0MGU1MDE4ZWJmN2FjOGIwNWI3MThkZDE5MTliNTAxYTgxNjllMGU2ZDBjODNkOGE4ZDU3YTA1YjMiLCJpYXQiOjE3MTY0NDgzMzh9.3GeUk4N45fKAaMrtGoNI74pK1lnqEWO2YQayqmGc_cYd",a="https://api.pinata.cloud/pinning/pinFileToIPFS",s="https://blush-big-koala-295.mypinata.cloud",AA=JSON.stringify(o),BA=new TextEncoder().encode(AA),oA=new FormData;oA.append("file",new Blob([BA],{type:"application/json"}));{const nA=JSON.stringify({cidVersion:0});oA.append("pinataOptions",nA);try{const hA=await axios.post(a,oA,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"multipart/form-data"}});if(hA.status!==200)throw new Error(`IPFS upload failed: ${hA.statusText}`);return console.error("EHere we go "),`${s}/ipfs/${hA.data.IpfsHash}`}catch(hA){throw console.error("Error uploading to IPFS via Pinata:",hA),hA}}};async function getEncryptedFileCidHash(o){try{const e=await fetch(o,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`Network response was not ok: ${e.statusText}`);return await e.json()}catch(e){throw console.error("Error fetching data:",e),e}}function r(o){var e,a,s="";if(typeof o=="string"||typeof o=="number")s+=o;else if(typeof o=="object")if(Array.isArray(o)){var AA=o.length;for(e=0;etypeof o=="number"&&!isNaN(o),d=o=>typeof o=="string",u=o=>typeof o=="function",p=o=>d(o)||u(o)?o:null,m=o=>reactExports.isValidElement(o)||d(o)||u(o)||c(o);function f(o,e,a){a===void 0&&(a=300);const{scrollHeight:s,style:AA}=o;requestAnimationFrame(()=>{AA.minHeight="initial",AA.height=s+"px",AA.transition=`all ${a}ms`,requestAnimationFrame(()=>{AA.height="0",AA.padding="0",AA.margin="0",setTimeout(e,a)})})}function g(o){let{enter:e,exit:a,appendPosition:s=!1,collapse:AA=!0,collapseDuration:eA=300}=o;return function(BA){let{children:oA,position:nA,preventExitTransition:hA,done:uA,nodeRef:FA,isIn:pA,playToast:zA}=BA;const LA=s?`${e}--${nA}`:e,YA=s?`${a}--${nA}`:a,QI=reactExports.useRef(0);return reactExports.useLayoutEffect(()=>{const _A=FA.current,JA=LA.split(" "),MA=iI=>{iI.target===FA.current&&(zA(),_A.removeEventListener("animationend",MA),_A.removeEventListener("animationcancel",MA),QI.current===0&&iI.type!=="animationcancel"&&_A.classList.remove(...JA))};_A.classList.add(...JA),_A.addEventListener("animationend",MA),_A.addEventListener("animationcancel",MA)},[]),reactExports.useEffect(()=>{const _A=FA.current,JA=()=>{_A.removeEventListener("animationend",JA),AA?f(_A,uA,eA):uA()};pA||(hA?JA():(QI.current=1,_A.className+=` ${YA}`,_A.addEventListener("animationend",JA)))},[pA]),React.createElement(React.Fragment,null,oA)}}function y(o,e){return o!=null?{content:o.content,containerId:o.props.containerId,id:o.props.toastId,theme:o.props.theme,type:o.props.type,data:o.props.data||{},isLoading:o.props.isLoading,icon:o.props.icon,status:e}:{}}const v=new Map;let h=[];const T=new Set,E=o=>T.forEach(e=>e(o)),b=()=>v.size>0;function I(o,e){var a;if(e)return!((a=v.get(e))==null||!a.isToastActive(o));let s=!1;return v.forEach(AA=>{AA.isToastActive(o)&&(s=!0)}),s}function _(o,e){m(o)&&(b()||h.push({content:o,options:e}),v.forEach(a=>{a.buildToast(o,e)}))}function C(o,e){v.forEach(a=>{e!=null&&e!=null&&e.containerId?(e==null?void 0:e.containerId)===a.id&&a.toggle(o,e==null?void 0:e.id):a.toggle(o,e==null?void 0:e.id)})}function L(o){const{subscribe:e,getSnapshot:a,setProps:s}=reactExports.useRef(function(eA){const BA=eA.containerId||1;return{subscribe(oA){const nA=function(uA,FA,pA){let zA=1,LA=0,YA=[],QI=[],_A=[],JA=FA;const MA=new Map,iI=new Set,_g=()=>{_A=Array.from(MA.values()),iI.forEach(CI=>CI())},BI=CI=>{QI=CI==null?[]:QI.filter(VA=>VA!==CI),_g()},jA=CI=>{const{toastId:VA,onOpen:XI,updateId:aB,children:MB}=CI.props,RB=aB==null;CI.staleId&&MA.delete(CI.staleId),MA.set(VA,CI),QI=[...QI,CI.props.toastId].filter(PB=>PB!==CI.staleId),_g(),pA(y(CI,RB?"added":"updated")),RB&&u(XI)&&XI(reactExports.isValidElement(MB)&&MB.props)};return{id:uA,props:JA,observe:CI=>(iI.add(CI),()=>iI.delete(CI)),toggle:(CI,VA)=>{MA.forEach(XI=>{VA!=null&&VA!==XI.props.toastId||u(XI.toggle)&&XI.toggle(CI)})},removeToast:BI,toasts:MA,clearQueue:()=>{LA-=YA.length,YA=[]},buildToast:(CI,VA)=>{if((xB=>{let{containerId:iQ,toastId:CQ,updateId:tQ}=xB;const sQ=iQ?iQ!==uA:uA!==1,pQ=MA.has(CQ)&&tQ==null;return sQ||pQ})(VA))return;const{toastId:XI,updateId:aB,data:MB,staleId:RB,delay:PB}=VA,iB=()=>{BI(XI)},dB=aB==null;dB&&LA++;const HB={...JA,style:JA.toastStyle,key:zA++,...Object.fromEntries(Object.entries(VA).filter(xB=>{let[iQ,CQ]=xB;return CQ!=null})),toastId:XI,updateId:aB,data:MB,closeToast:iB,isIn:!1,className:p(VA.className||JA.toastClassName),bodyClassName:p(VA.bodyClassName||JA.bodyClassName),progressClassName:p(VA.progressClassName||JA.progressClassName),autoClose:!VA.isLoading&&(QB=VA.autoClose,yB=JA.autoClose,QB===!1||c(QB)&&QB>0?QB:yB),deleteToast(){const xB=MA.get(XI),{onClose:iQ,children:CQ}=xB.props;u(iQ)&&iQ(reactExports.isValidElement(CQ)&&CQ.props),pA(y(xB,"removed")),MA.delete(XI),LA--,LA<0&&(LA=0),YA.length>0?jA(YA.shift()):_g()}};var QB,yB;HB.closeButton=JA.closeButton,VA.closeButton===!1||m(VA.closeButton)?HB.closeButton=VA.closeButton:VA.closeButton===!0&&(HB.closeButton=!m(JA.closeButton)||JA.closeButton);let kB=CI;reactExports.isValidElement(CI)&&!d(CI.type)?kB=reactExports.cloneElement(CI,{closeToast:iB,toastProps:HB,data:MB}):u(CI)&&(kB=CI({closeToast:iB,toastProps:HB,data:MB}));const mB={content:kB,props:HB,staleId:RB};JA.limit&&JA.limit>0&&LA>JA.limit&&dB?YA.push(mB):c(PB)?setTimeout(()=>{jA(mB)},PB):jA(mB)},setProps(CI){JA=CI},setToggle:(CI,VA)=>{MA.get(CI).toggle=VA},isToastActive:CI=>QI.some(VA=>VA===CI),getSnapshot:()=>JA.newestOnTop?_A.reverse():_A}}(BA,eA,E);v.set(BA,nA);const hA=nA.observe(oA);return h.forEach(uA=>_(uA.content,uA.options)),h=[],()=>{hA(),v.delete(BA)}},setProps(oA){var nA;(nA=v.get(BA))==null||nA.setProps(oA)},getSnapshot(){var oA;return(oA=v.get(BA))==null?void 0:oA.getSnapshot()}}}(o)).current;s(o);const AA=reactExports.useSyncExternalStore(e,a,a);return{getToastToRender:function(eA){if(!AA)return[];const BA=new Map;return AA.forEach(oA=>{const{position:nA}=oA.props;BA.has(nA)||BA.set(nA,[]),BA.get(nA).push(oA)}),Array.from(BA,oA=>eA(oA[0],oA[1]))},isToastActive:I,count:AA==null?void 0:AA.length}}function N(o){const[e,a]=reactExports.useState(!1),[s,AA]=reactExports.useState(!1),eA=reactExports.useRef(null),BA=reactExports.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:oA,pauseOnHover:nA,closeToast:hA,onClick:uA,closeOnClick:FA}=o;var pA,zA;function LA(){a(!0)}function YA(){a(!1)}function QI(MA){const iI=eA.current;BA.canDrag&&iI&&(BA.didMove=!0,e&&YA(),BA.delta=o.draggableDirection==="x"?MA.clientX-BA.start:MA.clientY-BA.start,BA.start!==MA.clientX&&(BA.canCloseOnClick=!1),iI.style.transform=`translate3d(${o.draggableDirection==="x"?`${BA.delta}px, var(--y)`:`0, calc(${BA.delta}px + var(--y))`},0)`,iI.style.opacity=""+(1-Math.abs(BA.delta/BA.removalDistance)))}function _A(){document.removeEventListener("pointermove",QI),document.removeEventListener("pointerup",_A);const MA=eA.current;if(BA.canDrag&&BA.didMove&&MA){if(BA.canDrag=!1,Math.abs(BA.delta)>BA.removalDistance)return AA(!0),o.closeToast(),void o.collapseAll();MA.style.transition="transform 0.2s, opacity 0.2s",MA.style.removeProperty("transform"),MA.style.removeProperty("opacity")}}(zA=v.get((pA={id:o.toastId,containerId:o.containerId,fn:a}).containerId||1))==null||zA.setToggle(pA.id,pA.fn),reactExports.useEffect(()=>{if(o.pauseOnFocusLoss)return document.hasFocus()||YA(),window.addEventListener("focus",LA),window.addEventListener("blur",YA),()=>{window.removeEventListener("focus",LA),window.removeEventListener("blur",YA)}},[o.pauseOnFocusLoss]);const JA={onPointerDown:function(MA){if(o.draggable===!0||o.draggable===MA.pointerType){BA.didMove=!1,document.addEventListener("pointermove",QI),document.addEventListener("pointerup",_A);const iI=eA.current;BA.canCloseOnClick=!0,BA.canDrag=!0,iI.style.transition="none",o.draggableDirection==="x"?(BA.start=MA.clientX,BA.removalDistance=iI.offsetWidth*(o.draggablePercent/100)):(BA.start=MA.clientY,BA.removalDistance=iI.offsetHeight*(o.draggablePercent===80?1.5*o.draggablePercent:o.draggablePercent)/100)}},onPointerUp:function(MA){const{top:iI,bottom:_g,left:BI,right:jA}=eA.current.getBoundingClientRect();MA.nativeEvent.type!=="touchend"&&o.pauseOnHover&&MA.clientX>=BI&&MA.clientX<=jA&&MA.clientY>=iI&&MA.clientY<=_g?YA():LA()}};return oA&&nA&&(JA.onMouseEnter=YA,o.stacked||(JA.onMouseLeave=LA)),FA&&(JA.onClick=MA=>{uA&&uA(MA),BA.canCloseOnClick&&hA()}),{playToast:LA,pauseToast:YA,isRunning:e,preventExitTransition:s,toastRef:eA,eventHandlers:JA}}function $(o){let{delay:e,isRunning:a,closeToast:s,type:AA="default",hide:eA,className:BA,style:oA,controlledProgress:nA,progress:hA,rtl:uA,isIn:FA,theme:pA}=o;const zA=eA||nA&&hA===0,LA={...oA,animationDuration:`${e}ms`,animationPlayState:a?"running":"paused"};nA&&(LA.transform=`scaleX(${hA})`);const YA=clsx("Toastify__progress-bar",nA?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${pA}`,`Toastify__progress-bar--${AA}`,{"Toastify__progress-bar--rtl":uA}),QI=u(BA)?BA({rtl:uA,type:AA,defaultClassName:YA}):clsx(YA,BA),_A={[nA&&hA>=1?"onTransitionEnd":"onAnimationEnd"]:nA&&hA<1?null:()=>{FA&&s()}};return React.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":zA},React.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${pA} Toastify__progress-bar--${AA}`}),React.createElement("div",{role:"progressbar","aria-hidden":zA?"true":"false","aria-label":"notification timer",className:QI,style:LA,..._A}))}let w=1;const k=()=>""+w++;function P(o){return o&&(d(o.toastId)||c(o.toastId))?o.toastId:k()}function M(o,e){return _(o,e),e.toastId}function x(o,e){return{...e,type:e&&e.type||o,toastId:P(e)}}function A(o){return(e,a)=>M(e,x(o,a))}function B(o,e){return M(o,x("default",e))}B.loading=(o,e)=>M(o,x("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),B.promise=function(o,e,a){let s,{pending:AA,error:eA,success:BA}=e;AA&&(s=d(AA)?B.loading(AA,a):B.loading(AA.render,{...a,...AA}));const oA={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},nA=(uA,FA,pA)=>{if(FA==null)return void B.dismiss(s);const zA={type:uA,...oA,...a,data:pA},LA=d(FA)?{render:FA}:FA;return s?B.update(s,{...zA,...LA}):B(LA.render,{...zA,...LA}),pA},hA=u(o)?o():o;return hA.then(uA=>nA("success",BA,uA)).catch(uA=>nA("error",eA,uA)),hA},B.success=A("success"),B.info=A("info"),B.error=A("error"),B.warning=A("warning"),B.warn=B.warning,B.dark=(o,e)=>M(o,x("default",{theme:"dark",...e})),B.dismiss=function(o){(function(e){var a;if(b()){if(e==null||d(a=e)||c(a))v.forEach(s=>{s.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const s=v.get(e.containerId);s?s.removeToast(e.id):v.forEach(AA=>{AA.removeToast(e.id)})}}else h=h.filter(s=>e!=null&&s.options.toastId!==e)})(o)},B.clearWaitingQueue=function(o){o===void 0&&(o={}),v.forEach(e=>{!e.props.limit||o.containerId&&e.id!==o.containerId||e.clearQueue()})},B.isActive=I,B.update=function(o,e){e===void 0&&(e={});const a=((s,AA)=>{var eA;let{containerId:BA}=AA;return(eA=v.get(BA||1))==null?void 0:eA.toasts.get(s)})(o,e);if(a){const{props:s,content:AA}=a,eA={delay:100,...s,...e,toastId:e.toastId||o,updateId:k()};eA.toastId!==o&&(eA.staleId=o);const BA=eA.render||AA;delete eA.render,M(BA,eA)}},B.done=o=>{B.update(o,{progress:1})},B.onChange=function(o){return T.add(o),()=>{T.delete(o)}},B.play=o=>C(!0,o),B.pause=o=>C(!1,o);const O=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,D=o=>{let{theme:e,type:a,isLoading:s,...AA}=o;return React.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${a})`,...AA})},z={info:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(o){return React.createElement(D,{...o},React.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return React.createElement("div",{className:"Toastify__spinner"})}},R=o=>{const{isRunning:e,preventExitTransition:a,toastRef:s,eventHandlers:AA,playToast:eA}=N(o),{closeButton:BA,children:oA,autoClose:nA,onClick:hA,type:uA,hideProgressBar:FA,closeToast:pA,transition:zA,position:LA,className:YA,style:QI,bodyClassName:_A,bodyStyle:JA,progressClassName:MA,progressStyle:iI,updateId:_g,role:BI,progress:jA,rtl:CI,toastId:VA,deleteToast:XI,isIn:aB,isLoading:MB,closeOnClick:RB,theme:PB}=o,iB=clsx("Toastify__toast",`Toastify__toast-theme--${PB}`,`Toastify__toast--${uA}`,{"Toastify__toast--rtl":CI},{"Toastify__toast--close-on-click":RB}),dB=u(YA)?YA({rtl:CI,position:LA,type:uA,defaultClassName:iB}):clsx(iB,YA),HB=function(mB){let{theme:xB,type:iQ,isLoading:CQ,icon:tQ}=mB,sQ=null;const pQ={theme:xB,type:iQ};return tQ===!1||(u(tQ)?sQ=tQ({...pQ,isLoading:CQ}):reactExports.isValidElement(tQ)?sQ=reactExports.cloneElement(tQ,pQ):CQ?sQ=z.spinner():(kQ=>kQ in z)(iQ)&&(sQ=z[iQ](pQ))),sQ}(o),QB=!!jA||!nA,yB={closeToast:pA,type:uA,theme:PB};let kB=null;return BA===!1||(kB=u(BA)?BA(yB):reactExports.isValidElement(BA)?reactExports.cloneElement(BA,yB):function(mB){let{closeToast:xB,theme:iQ,ariaLabel:CQ="close"}=mB;return React.createElement("button",{className:`Toastify__close-button Toastify__close-button--${iQ}`,type:"button",onClick:tQ=>{tQ.stopPropagation(),xB(tQ)},"aria-label":CQ},React.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},React.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(yB)),React.createElement(zA,{isIn:aB,done:XI,position:LA,preventExitTransition:a,nodeRef:s,playToast:eA},React.createElement("div",{id:VA,onClick:hA,"data-in":aB,className:dB,...AA,style:QI,ref:s},React.createElement("div",{...aB&&{role:BI},className:u(_A)?_A({type:uA}):clsx("Toastify__toast-body",_A),style:JA},HB!=null&&React.createElement("div",{className:clsx("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!MB})},HB),React.createElement("div",null,oA)),kB,React.createElement($,{..._g&&!QB?{key:`pb-${_g}`}:{},rtl:CI,theme:PB,delay:nA,isRunning:e,isIn:aB,closeToast:pA,hide:FA,type:uA,style:iI,className:MA,controlledProgress:QB,progress:jA||0})))},S=function(o,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${o}-enter`,exit:`Toastify--animate Toastify__${o}-exit`,appendPosition:e}},H=g(S("bounce",!0));g(S("slide",!0));g(S("zoom"));g(S("flip"));const q={position:"top-right",transition:H,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function Q(o){let e={...q,...o};const a=o.stacked,[s,AA]=reactExports.useState(!0),eA=reactExports.useRef(null),{getToastToRender:BA,isToastActive:oA,count:nA}=L(e),{className:hA,style:uA,rtl:FA,containerId:pA}=e;function zA(YA){const QI=clsx("Toastify__toast-container",`Toastify__toast-container--${YA}`,{"Toastify__toast-container--rtl":FA});return u(hA)?hA({position:YA,rtl:FA,defaultClassName:QI}):clsx(QI,p(hA))}function LA(){a&&(AA(!0),B.play())}return O(()=>{if(a){var YA;const QI=eA.current.querySelectorAll('[data-in="true"]'),_A=12,JA=(YA=e.position)==null?void 0:YA.includes("top");let MA=0,iI=0;Array.from(QI).reverse().forEach((_g,BI)=>{const jA=_g;jA.classList.add("Toastify__toast--stacked"),BI>0&&(jA.dataset.collapsed=`${s}`),jA.dataset.pos||(jA.dataset.pos=JA?"top":"bot");const CI=MA*(s?.2:1)+(s?0:_A*BI);jA.style.setProperty("--y",`${JA?CI:-1*CI}px`),jA.style.setProperty("--g",`${_A}`),jA.style.setProperty("--s",""+(1-(s?iI:0))),MA+=jA.offsetHeight,iI+=.025})}},[s,nA,a]),React.createElement("div",{ref:eA,className:"Toastify",id:pA,onMouseEnter:()=>{a&&(AA(!1),B.pause())},onMouseLeave:LA},BA((YA,QI)=>{const _A=QI.length?{...uA}:{...uA,pointerEvents:"none"};return React.createElement("div",{className:zA(YA),style:_A,key:`container-${YA}`},QI.map(JA=>{let{content:MA,props:iI}=JA;return React.createElement(R,{...iI,stacked:a,collapseAll:LA,isIn:oA(iI.toastId,iI.containerId),style:iI.style,key:`toast-${iI.key}`},MA)}))}))}const Mint=()=>{const[o]=reactExports.useState({name:"",status:""}),{instance:e,createInstance:a}=useFhevm(),{addNFT:s}=useNFTs(),AA=()=>{const oA=jsxRuntimeExports.jsxs("div",{children:["Minting the file as an NFT failed. Ensure you are connected and have enough Zama: you acquire Zama fromĀ ",jsxRuntimeExports.jsx("a",{href:"https://faucet.zama.ai/",target:"_blank",rel:"noopener noreferrer",children:"https://faucet.zama.ai/"}),"."]});B.error(oA,{autoClose:1e4})},eA=async oA=>{if(!oA.target.files||oA.target.files.length===0)return;const nA=oA.target.files[0];try{const hA=await generateKey();if(!await getAccount())throw new Error("Account retrieval failed.");if(!e)throw new Error("Intance retrieval failed.");const FA=await encryptFile(nA,hA),pA=await BA(hA),zA={...FA,encryptedFileKey:pA},LA=await uploadFileToIPFS(zA);B.info("Your file is currently being minted as an NFT. This may take a few moments.");const YA=await mintToken(LA,pA);if(YA){const QI={id:Number(YA.tokenId),file:nA};s(QI),B.success("The File has been minted as an NFT and will soon appear in your gallery!")}}catch(hA){console.log("Failed to mint:",hA),AA()}},BA=async oA=>{if(!e)throw new Error("Intance retrieval failed.");const nA=[],hA=await exportCryptoKey(oA);for(const uA of hA){const FA=e.encrypt64(uA);console.log("ecrypted64 : ",FA),nA.push(FA)}return nA};return reactExports.useEffect(()=>{e||a().catch(console.error)},[e,a]),jsxRuntimeExports.jsx("section",{className:"mint",id:"mint",children:jsxRuntimeExports.jsx("div",{className:"container",children:jsxRuntimeExports.jsx("div",{className:"row",children:jsxRuntimeExports.jsx("div",{className:"col-12",children:jsxRuntimeExports.jsxs("div",{className:"mint-bx wow zoomIn",children:[jsxRuntimeExports.jsx("h2",{children:"Convert Files to NFTs"}),jsxRuntimeExports.jsxs("div",{className:"file-upload-container",children:[jsxRuntimeExports.jsxs("label",{htmlFor:"file-upload-input",className:"file-upload-label",children:[jsxRuntimeExports.jsx("input",{id:"file-upload-input",type:"file",style:{display:"none"},onChange:eA,accept:".jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .mp4"}),jsxRuntimeExports.jsxs("div",{className:"upload-area",children:[jsxRuntimeExports.jsx("img",{src:uploadIcon,alt:"Upload",className:"upload-icon"}),jsxRuntimeExports.jsx("span",{children:"Upload Files"})]}),jsxRuntimeExports.jsx("div",{className:"file-types-explanation",children:".jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .mp4"})]}),jsxRuntimeExports.jsx("p",{className:"upload-explanation",children:"The uploaded files are securely and confidentially saved on IPFS and accessible only by you or the people you have shared it with using Zama's fhEVM."}),o.status&&jsxRuntimeExports.jsx("p",{className:"file-upload-status",children:o.status}),o.name&&jsxRuntimeExports.jsxs("p",{className:"uploaded-file-info",children:["Name: ",o.name]})]})]})})})})})},SharedWith=({tokenId:o,open:e,onClose:a})=>{const[s,AA]=reactExports.useState([]),eA=async()=>{const nA=await getSharedWithAddresses(o);AA(nA)};reactExports.useEffect(()=>{e&&eA()},[e,o]);const BA=async nA=>{await revokeTokenAccess(o,nA)&&(B.success(`Revoke access for ${formatAddress(nA)} on NFT#${o} has succeeded!`),AA(uA=>uA.filter(FA=>FA!==nA)))},oA=async()=>{if(s.length==0)B.error(`No shared access for NFT#${o} !`);else{const nA=await getMaxUsersToRemove();await revokeAllSharedAccess(o,nA)&&(B.success(`Revoke all access for token NFT#${o} has succeeded!`),AA([]))}};return jsxRuntimeExports.jsxs(Modal$1,{show:e,onHide:a,centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsxs(Modal$1.Title,{children:["Shared With for NFT#",o]})}),jsxRuntimeExports.jsx(Modal$1.Body,{children:jsxRuntimeExports.jsx(ListGroup$1,{children:s.map(nA=>jsxRuntimeExports.jsxs(ListGroup$1.Item,{className:"d-flex justify-content-between align-items-center",children:[formatAddress(nA),jsxRuntimeExports.jsx(Button,{variant:"danger",onClick:()=>BA(nA),children:"Revoke"})]},nA))})}),jsxRuntimeExports.jsxs(Modal$1.Footer,{children:[jsxRuntimeExports.jsx(Button,{variant:"danger",onClick:oA,children:"Revoke All"}),jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:a,children:"Close"})]})]})};function getFileIcon(o){switch(o){case"application/pdf":return jsxRuntimeExports.jsx(FileEarmarkPdf,{});case"image/png":case"image/jpeg":case"image/gif":return jsxRuntimeExports.jsx(FileEarmarkImage,{});case"video/mp4":return jsxRuntimeExports.jsx(FileEarmarkPlay,{});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return jsxRuntimeExports.jsx(FileEarmarkWord,{});default:return jsxRuntimeExports.jsx(FileEarmark,{})}}function formatAddress(o,e=6){if(o.length<2*e+2)return o;const a=o.substring(0,e),s=o.substring(o.length-e);return`${a}...${s}`}function downloadFile(o){const e=document.createElement("a");e.href=window.URL.createObjectURL(o),e.download=o.name,document.body.appendChild(e),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)}function formatFileSize(o,e=2){if(o===0)return"0 Bytes";const a=1024,s=e<0?0:e,AA=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],eA=Math.floor(Math.log(o)/Math.log(a));return parseFloat((o/Math.pow(a,eA)).toFixed(s))+" "+AA[eA]}const ActionButtonHelper=({onDownload:o,onShare:e,onTransfer:a,onDelete:s,tokenId:AA=0})=>{const[eA,BA]=reactExports.useState(!1),[oA,nA]=reactExports.useState(!1),[hA,uA]=reactExports.useState(""),[FA,pA]=reactExports.useState(""),zA=JA=>{uA(JA),BA(!0)},LA=()=>{BA(!1),hA==="Share"?e(FA):hA==="Transfer"?a(FA):hA==="Delete"&&s()},YA=()=>{nA(!0)},QI=(JA,MA)=>jsxRuntimeExports.jsx(Tooltip$1,{...JA,children:MA}),_A=React.forwardRef(({onClick:JA},MA)=>jsxRuntimeExports.jsx("div",{ref:MA,onClick:iI=>{iI.preventDefault(),JA(iI)},className:"custom-toggle",title:"Actions",children:jsxRuntimeExports.jsx(ThreeDotsVertical,{})}));return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Dropdown$1,{children:[jsxRuntimeExports.jsx(Dropdown$1.Toggle,{as:_A}),jsxRuntimeExports.jsxs(Dropdown$1.Menu,{children:[jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Download"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:o,children:"Download"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Share"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Share"),children:"Share"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Shared With"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>YA(),children:"Shared With"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Transfer"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Transfer"),children:"Transfer"})}),jsxRuntimeExports.jsx(OverlayTrigger,{placement:"top",overlay:JA=>QI(JA,"Delete"),children:jsxRuntimeExports.jsx(Dropdown$1.Item,{onClick:()=>zA("Delete"),children:"Delete"})})]})]}),jsxRuntimeExports.jsx(SharedWith,{tokenId:AA,open:oA,onClose:()=>nA(!1)}),jsxRuntimeExports.jsxs(Modal$1,{show:eA,onHide:()=>BA(!1),centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsxs(Modal$1.Title,{children:["Confirm ",hA]})}),jsxRuntimeExports.jsxs(Modal$1.Body,{children:[AA!==null?jsxRuntimeExports.jsxs("p",{children:["Are you sure you want to ",hA.toLowerCase()," NFT #",AA,"?"]}):jsxRuntimeExports.jsxs("p",{children:["Are you sure you want to ",hA.toLowerCase()," this item?"]}),(hA==="Share"||hA==="Transfer")&&jsxRuntimeExports.jsxs(Form$1.Group,{children:[jsxRuntimeExports.jsx(Form$1.Label,{children:"Recipient Address"}),jsxRuntimeExports.jsx(Form$1.Control,{type:"text",placeholder:"0x123...",value:FA,onChange:JA=>pA(JA.target.value)})]})]}),jsxRuntimeExports.jsxs(Modal$1.Footer,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>BA(!1),children:"Cancel"}),jsxRuntimeExports.jsx(Button,{variant:"primary",onClick:LA,children:"Confirm"})]})]})]})},Gallery=()=>{const[o,e]=reactExports.useState(0),{instance:a,createInstance:s}=useFhevm(),[AA,eA]=reactExports.useState(0),[BA,oA]=reactExports.useState(0),nA=5,[hA,uA]=reactExports.useState(!1),{nfts:FA,removeNFT:pA,updateNFTs:zA,removeAllNFTs:LA}=useNFTs(),[YA,QI]=reactExports.useState([]),_A=async(CI,VA)=>{await shareToken(VA,CI)?B.success(`The NFT#${CI} has been share with : ${formatAddress(VA)}`):B.error(`Could not share NFT #${CI}! Please check if it is already shared with ${formatAddress(VA)}.`)},JA=async(CI,VA)=>{await transferToken(VA,CI)?(B.success(`The NFT#${CI} has been transfered and will be no more accessible!`),pA(CI)):B.error(`Could not transfer the NFT#${CI}!`)},MA=async CI=>{const VA=await getMaxUsersToRemove();await burnToken(CI,VA)?(B.success(`The NFT#${CI} has been deleted and will be no more accessible!`),pA(CI)):B.error(`Could not delete the NFT#${CI}!`)};reactExports.useEffect(()=>{a||s().catch(console.error)},[a,s,o]);const iI=async()=>{uA(!0);try{_g()}catch(CI){throw B.error("Error during NFTs fetch. This could be due to browser extensions, firewall settings, or security policies blocking these requests."),CI}try{BI()}catch(CI){throw B.error("Error during shared with NFTs fetch. This could be due to browser extensions, firewall settings, or security policies blocking these requests."),CI}},_g=async()=>{if(!FA){B.info("You have no NFTs to display!");return}try{if(!a)throw new Error("Intance retrieval failed.");const CI=await getSupply();if(eA(CI),CI<=0){B.info("You have no NFTs to display!"),LA();return}const VA=await getTokensInRange(0,5),XI=await getAccount();if(!XI)throw new Error("Account retrieval failed.");const aB=await getSignature(contractAddress,XI),MB=await Promise.all(VA.map(async RB=>{const PB=await jA(RB.cidHash,aB.publicKey,aB.signature,RB.tokenId);return{id:Number(RB.tokenId),file:PB.file}}));zA(MB),B.success("Gallery updated successfully!")}catch(CI){throw B.error("Error displaying Gallery!"),CI}},BI=async()=>{try{const CI=await getSharedWithSupply();if(oA(CI),CI<=0){B.info("You have no NFTs shared with you to display!"),QI([]);return}const VA=await getSharedTokensInRange(0,CI),XI=await getAccount();if(!XI)throw new Error("Account retrieval failed.");const aB=await getSignature(contractAddress,XI),MB=await Promise.all(VA.map(async RB=>{const PB=await jA(RB.cidHash,aB.publicKey,aB.signature,RB.tokenId);return{id:Number(RB.tokenId),file:PB.file}}));QI(MB),B.success("Shared NFTs updated successfully!")}catch(CI){throw CI}},jA=async(CI,VA,XI,aB)=>{try{if(!a)throw new Error("Intance retrieval failed.");const MB=await getEncryptedFileCidHash(CI);if(!MB)throw new Error("Dencrypting data failed.");console.log("cid: ",CI),console.log("Encrypted FIle: ",MB);const RB=await reencrypt(aB,VA,XI);let PB=[];RB.forEach(HB=>{if(HB){const QB=a.decrypt(contractAddress,HB);PB.push(QB)}});const iB=await importCryptoKey(PB);return await decryptFile(MB,iB)}catch(MB){throw B.error(`Error Wile trying to access the NFT# ${aB}. could not fetch ${CI}`),MB}};return jsxRuntimeExports.jsxs(Container,{className:"mt-4 gallery-container",id:"gallery",children:[jsxRuntimeExports.jsx(Row,{className:"mb-4",children:jsxRuntimeExports.jsxs(Col,{children:[jsxRuntimeExports.jsx("hr",{className:"header-divider"}),jsxRuntimeExports.jsx("h1",{className:"gallery-header",children:"My NFTs Gallery"}),jsxRuntimeExports.jsx("hr",{className:"header-divider"})]})}),!hA&&jsxRuntimeExports.jsx(Row,{children:jsxRuntimeExports.jsx(Col,{className:"d-flex justify-content-center",children:jsxRuntimeExports.jsx(Button,{className:"modern-button",onClick:()=>iI(),children:"Show Private Content"})})}),hA&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs(Table,{striped:!0,hover:!0,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{className:"nft-num",children:"NFT #"}),jsxRuntimeExports.jsx("th",{className:"name",children:"Name"}),jsxRuntimeExports.jsx("th",{className:"size",children:"Size"}),jsxRuntimeExports.jsx("th",{className:"actions",children:jsxRuntimeExports.jsx("button",{onClick:()=>_g(),title:"Refresh Gallery",className:"icon-button",children:jsxRuntimeExports.jsx(ArrowClockwise,{})})})]})}),jsxRuntimeExports.jsx("tbody",{children:FA.map(CI=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:CI.id}),jsxRuntimeExports.jsxs("td",{children:[getFileIcon(CI.file.type)," ",CI.file.name]}),jsxRuntimeExports.jsx("td",{children:formatFileSize(CI.file.size)}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(ActionButtonHelper,{onDownload:()=>downloadFile(CI.file),onShare:VA=>_A(CI.id,VA),onTransfer:VA=>JA(CI.id,VA),onDelete:()=>MA(CI.id),tokenId:CI.id})})]},CI.id))})]}),jsxRuntimeExports.jsx(Pagination$1,{className:"justify-content-center mt-4",children:[...Array(Math.ceil(AA/nA)).keys()].map(CI=>jsxRuntimeExports.jsx(Pagination$1.Item,{active:CI+1===o,onClick:()=>e(CI+1),children:CI+1},CI))}),jsxRuntimeExports.jsx("h3",{className:"shared-separator",children:"NFTs Shared With Me"}),jsxRuntimeExports.jsxs(Table,{striped:!0,hover:!0,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{className:"nft-num"}),jsxRuntimeExports.jsx("th",{className:"name"}),jsxRuntimeExports.jsx("th",{className:"size"}),jsxRuntimeExports.jsx("th",{className:"actions",children:jsxRuntimeExports.jsx("button",{onClick:()=>BI(),title:"Refresh Gallery",className:"icon-button",children:jsxRuntimeExports.jsx(ArrowClockwise,{})})})]})}),jsxRuntimeExports.jsx("tbody",{children:YA.map(CI=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:CI.id}),jsxRuntimeExports.jsxs("td",{children:[getFileIcon(CI.file.type)," ",CI.file.name]}),jsxRuntimeExports.jsx("td",{children:formatFileSize(CI.file.size)}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(Download,{onClick:()=>downloadFile(CI.file)})})]},CI.id))})]}),jsxRuntimeExports.jsx(Pagination$1,{className:"justify-content-center mt-4",children:[...Array(Math.ceil(BA/nA)).keys()].map(CI=>jsxRuntimeExports.jsx(Pagination$1.Item,{active:CI+1===o,onClick:()=>e(CI+1),children:CI+1},CI))})]})]})},Footer=({githubUrl:o})=>jsxRuntimeExports.jsx("footer",{className:"footer",children:jsxRuntimeExports.jsxs("div",{className:"footer-container",children:[jsxRuntimeExports.jsxs("span",{children:[" ",new Date().getFullYear()," DRM system using Zama's fhEVM"]}),jsxRuntimeExports.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"footer-link",children:"GitHub"})]})}),MetaMaskAlertModal=()=>{const[o,e]=reactExports.useState(!0),a=()=>e(!1);return jsxRuntimeExports.jsxs(Modal$1,{show:o,onHide:a,centered:!0,children:[jsxRuntimeExports.jsx(Modal$1.Header,{closeButton:!0,children:jsxRuntimeExports.jsx(Modal$1.Title,{children:"MetaMask Required"})}),jsxRuntimeExports.jsxs(Modal$1.Body,{children:[jsxRuntimeExports.jsx("p",{children:"This application requires MetaMask to work correctly. Please install or enable MetaMask to proceed."}),jsxRuntimeExports.jsx("a",{href:"https://metamask.io/download.html",target:"_blank",rel:"noopener noreferrer",children:"Download MetaMask"})]}),jsxRuntimeExports.jsx(Modal$1.Footer,{children:jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:a,children:"Close"})})]})};function App(){const[,o]=reactExports.useState(!1),[e,a]=reactExports.useState(!0),[s,AA]=reactExports.useState(""),[eA,BA]=reactExports.useState(!1);return reactExports.useEffect(()=>{typeof window.ethereum>"u"&&BA(!0)},[]),reactExports.useEffect(()=>{init().then(()=>{o(!0),a(!1)}).catch(oA=>{AA("Failed to initialize the application."),a(!1),console.error(oA)})},[]),e?jsxRuntimeExports.jsx("div",{children:"Loading..."}):s?jsxRuntimeExports.jsxs("div",{children:["Error: ",s]}):eA?jsxRuntimeExports.jsx(MetaMaskAlertModal,{}):jsxRuntimeExports.jsx(BrowserRouter,{children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Q,{position:"top-right",autoClose:7e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,style:{zIndex:9999}}),jsxRuntimeExports.jsx(NavBar,{}),jsxRuntimeExports.jsx(Banner,{}),jsxRuntimeExports.jsx(Mint,{}),jsxRuntimeExports.jsx(Gallery,{}),jsxRuntimeExports.jsx(Footer,{githubUrl:"https://github.com/El-hacen21/zama_bounty/"})]})})}var buffer={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var a=o.indexOf("=");a===-1&&(a=e);var s=a===e?0:4-a%4;return[a,s]}function byteLength(o){var e=getLens(o),a=e[0],s=e[1];return(a+s)*3/4-s}function _byteLength(o,e,a){return(e+a)*3/4-a}function toByteArray(o){var e,a=getLens(o),s=a[0],AA=a[1],eA=new Arr(_byteLength(o,s,AA)),BA=0,oA=AA>0?s-4:s,nA;for(nA=0;nA>16&255,eA[BA++]=e>>8&255,eA[BA++]=e&255;return AA===2&&(e=revLookup[o.charCodeAt(nA)]<<2|revLookup[o.charCodeAt(nA+1)]>>4,eA[BA++]=e&255),AA===1&&(e=revLookup[o.charCodeAt(nA)]<<10|revLookup[o.charCodeAt(nA+1)]<<4|revLookup[o.charCodeAt(nA+2)]>>2,eA[BA++]=e>>8&255,eA[BA++]=e&255),eA}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[o&63]}function encodeChunk(o,e,a){for(var s,AA=[],eA=e;eAoA?oA:BA+eA));return s===1?(e=o[a-1],AA.push(lookup[e>>2]+lookup[e<<4&63]+"==")):s===2&&(e=(o[a-2]<<8)+o[a-1],AA.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),AA.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(o,e,a,s,AA){var eA,BA,oA=AA*8-s-1,nA=(1<>1,uA=-7,FA=a?AA-1:0,pA=a?-1:1,zA=o[e+FA];for(FA+=pA,eA=zA&(1<<-uA)-1,zA>>=-uA,uA+=oA;uA>0;eA=eA*256+o[e+FA],FA+=pA,uA-=8);for(BA=eA&(1<<-uA)-1,eA>>=-uA,uA+=s;uA>0;BA=BA*256+o[e+FA],FA+=pA,uA-=8);if(eA===0)eA=1-hA;else{if(eA===nA)return BA?NaN:(zA?-1:1)*(1/0);BA=BA+Math.pow(2,s),eA=eA-hA}return(zA?-1:1)*BA*Math.pow(2,eA-s)};ieee754.write=function(o,e,a,s,AA,eA){var BA,oA,nA,hA=eA*8-AA-1,uA=(1<>1,pA=AA===23?Math.pow(2,-24)-Math.pow(2,-77):0,zA=s?0:eA-1,LA=s?1:-1,YA=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(oA=isNaN(e)?1:0,BA=uA):(BA=Math.floor(Math.log(e)/Math.LN2),e*(nA=Math.pow(2,-BA))<1&&(BA--,nA*=2),BA+FA>=1?e+=pA/nA:e+=pA*Math.pow(2,1-FA),e*nA>=2&&(BA++,nA/=2),BA+FA>=uA?(oA=0,BA=uA):BA+FA>=1?(oA=(e*nA-1)*Math.pow(2,AA),BA=BA+FA):(oA=e*Math.pow(2,FA-1)*Math.pow(2,AA),BA=0));AA>=8;o[a+zA]=oA&255,zA+=LA,oA/=256,AA-=8);for(BA=BA<0;o[a+zA]=BA&255,zA+=LA,BA/=256,hA-=8);o[a+zA-LA]|=YA*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh diff --git a/index.html b/index.html index f97bf91..6354098 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ DRM system using Zama's fhEVM - +