@adaptive-ai/sdk 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +4 -4
- package/dist/server/index.d.ts +70 -18
- package/dist/server/index.js +3 -3
- package/package.json +1 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
declare const OAuthProvider: {
|
|
6
|
+
readonly PLAID: "PLAID";
|
|
6
7
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
7
8
|
readonly GITHUB_BOT: "GITHUB_BOT";
|
|
8
9
|
readonly GOOGLE: "GOOGLE";
|
|
@@ -14,7 +15,6 @@ declare const OAuthProvider: {
|
|
|
14
15
|
readonly LINKEDIN: "LINKEDIN";
|
|
15
16
|
readonly YAHOO: "YAHOO";
|
|
16
17
|
readonly FIGMA: "FIGMA";
|
|
17
|
-
readonly PLAID: "PLAID";
|
|
18
18
|
readonly SQUARE: "SQUARE";
|
|
19
19
|
readonly SHOPIFY: "SHOPIFY";
|
|
20
20
|
readonly WHOOP: "WHOOP";
|
|
@@ -22,6 +22,7 @@ declare const OAuthProvider: {
|
|
|
22
22
|
export type OAuthProvider = (typeof OAuthProvider)[keyof typeof OAuthProvider];
|
|
23
23
|
declare const AuthProvider: {
|
|
24
24
|
readonly AC1: "AC1";
|
|
25
|
+
readonly PLAID: "PLAID";
|
|
25
26
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
26
27
|
readonly GITHUB_BOT: "GITHUB_BOT";
|
|
27
28
|
readonly GOOGLE: "GOOGLE";
|
|
@@ -33,7 +34,6 @@ declare const AuthProvider: {
|
|
|
33
34
|
readonly LINKEDIN: "LINKEDIN";
|
|
34
35
|
readonly YAHOO: "YAHOO";
|
|
35
36
|
readonly FIGMA: "FIGMA";
|
|
36
|
-
readonly PLAID: "PLAID";
|
|
37
37
|
readonly SQUARE: "SQUARE";
|
|
38
38
|
readonly SHOPIFY: "SHOPIFY";
|
|
39
39
|
readonly WHOOP: "WHOOP";
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useState,useEffect,useRef,useCallback}from'react';import {useMutation}from'@tanstack/react-query';import {identity}from'lodash';import {nanoid}from'nanoid';import Tt from'superjson';import {rpcClient,RpcError}from'typed-rpc';var Ln=Object.create;var Pt=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var Nn=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var nt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports);var Hn=(o,n,S,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of Fn(n))!Bn.call(o,e)&&e!==S&&Pt(o,e,{get:()=>n[e],enumerable:!(c=Dn(n,e))||c.enumerable});return o};var Ot=(o,n,S)=>(S=o!=null?Ln(Nn(o)):{},Hn(Pt(S,"default",{value:o,enumerable:true}),o));var Qt=nt((st,at)=>{(o=>{let n=(()=>{let R=0;return {escape:function(r){return r.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")},isDataUrl:function(r){return r.search(/^(data:)/)!==-1},canvasToBlob:function(r){return r.toBlob?new Promise(function(m){r.toBlob(m);}):(m=>new Promise(function(A){var y=a(m.toDataURL().split(",")[1]),T=y.length,w=new Uint8Array(T);for(let h=0;h<T;h++)w[h]=y.charCodeAt(h);A(new Blob([w],{type:"image/png"}));}))(r)},resolveUrl:function(r,m){var A=globalThis.document.implementation.createHTMLDocument(),y=A.createElement("base"),T=(A.head.appendChild(y),A.createElement("a"));return A.body.appendChild(T),y.href=m,T.href=r,T.href},getAndEncode:function(r){let m=v.impl.urlCache.find(function(A){return A.url===r});return m||(m={url:r,promise:null},v.impl.urlCache.push(m)),m.promise===null&&(v.impl.options.cacheBust&&(r+=(/\?/.test(r)?"&":"?")+new Date().getTime()),m.promise=new Promise(function(A){let y=new XMLHttpRequest;function T(U){console.error(U),A("");}function w(){var U=v.impl.options.imagePlaceholder;U?A(U):T("Status:"+y.status+" while fetching resource: "+r);}if(y.timeout=v.impl.options.httpTimeout,y.onerror=w,y.ontimeout=w,y.onloadend=function(){if(y.readyState===XMLHttpRequest.DONE){var U=y.status;if(U===0&&r.toLowerCase().startsWith("file://")||200<=U&&U<=300&&y.response!==null){U=y.response,U instanceof Blob||T("Expected response to be a Blob, but got: "+typeof U);let P=new globalThis.FileReader;P.onloadend=function(){var x=P.result;A(x);};try{P.readAsDataURL(U);}catch(x){T("Failed to read the response as Data URL: "+x.toString());}}else w();}},0<v.impl.options.useCredentialsFilters.length&&(v.impl.options.useCredentials=0<v.impl.options.useCredentialsFilters.filter(U=>0<=r.search(U)).length),v.impl.options.useCredentials&&(y.withCredentials=true),v.impl.options.corsImg&&r.indexOf("http")===0&&r.indexOf(globalThis.window.location.origin)===-1){var h=(v.impl.options.corsImg.method||"GET").toUpperCase()==="POST"?"POST":"GET";y.open(h,(v.impl.options.corsImg.url||"").replace("#{cors}",r),true);let U=false,P=v.impl.options.corsImg.headers||{},x=(Object.keys(P).forEach(function(H){P[H].indexOf("application/json")!==-1&&(U=true),y.setRequestHeader(H,P[H]);}),(H=>{try{return JSON.parse(JSON.stringify(H))}catch(L){T("corsImg.data is missing or invalid:"+L.toString());}})(v.impl.options.corsImg.data||""));Object.keys(x).forEach(function(H){typeof x[H]=="string"&&(x[H]=x[H].replace("#{cors}",r));}),y.responseType="blob",y.send(U?JSON.stringify(x):x);}else y.open("GET",r,true),y.responseType="blob",y.send();})),m.promise},uid:function(){return "u"+("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)+R++},asArray:function(r){var m=[],A=r.length;for(let y=0;y<A;y++)m.push(r[y]);return m},escapeXhtml:function(r){return r.replace(/%/g,"%25").replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(r){return r!=="data:,"?new Promise(function(m,A){let y=globalThis.document.createElementNS("http://www.w3.org/2000/svg","svg"),T=new globalThis.Image;v.impl.options.useCredentials&&(T.crossOrigin="use-credentials"),T.onload=function(){globalThis.document.body.removeChild(y),globalThis.window&&globalThis.window.requestAnimationFrame?globalThis.window.requestAnimationFrame(function(){m(T);}):m(T);},T.onerror=w=>{globalThis.document.body.removeChild(y),A(w);},y.appendChild(T),T.src=r,globalThis.document.body.appendChild(y);}):Promise.resolve()},width:function(r){var m=b(r,"width");if(!isNaN(m))return m;var m=b(r,"border-left-width"),A=b(r,"border-right-width");return r.scrollWidth+m+A},height:function(r){var m=b(r,"height");if(!isNaN(m))return m;var m=b(r,"border-top-width"),A=b(r,"border-bottom-width");return r.scrollHeight+m+A},getWindow:g,isElement:u,isElementHostForOpenShadowRoot:function(r){return u(r)&&r.shadowRoot!==null},isShadowRoot:M,isInShadowRoot:p,isHTMLElement:function(r){return r instanceof g(r).HTMLElement},isHTMLCanvasElement:function(r){return r instanceof g(r).HTMLCanvasElement},isHTMLInputElement:function(r){return r instanceof g(r).HTMLInputElement},isHTMLImageElement:function(r){return r instanceof g(r).HTMLImageElement},isHTMLLinkElement:function(r){return r instanceof g(r).HTMLLinkElement},isHTMLScriptElement:function(r){return r instanceof g(r).HTMLScriptElement},isHTMLStyleElement:function(r){return r instanceof g(r).HTMLStyleElement},isHTMLTextAreaElement:function(r){return r instanceof g(r).HTMLTextAreaElement},isShadowSlotElement:function(r){return p(r)&&r instanceof g(r).HTMLSlotElement},isSVGElement:function(r){return r instanceof g(r).SVGElement},isSVGRectElement:function(r){return r instanceof g(r).SVGRectElement},isDimensionMissing:function(r){return isNaN(r)||r<=0}};function g(r){return r=r?r.ownerDocument:void 0,(r?r.defaultView:void 0)||globalThis.window||o}function M(r){return r instanceof g(r).ShadowRoot}function p(r){return r!=null&&r.getRootNode!==void 0&&M(r.getRootNode())}function u(r){return r instanceof g(r).Element}function b(r,m){if(r.nodeType===E){let A=i(r).getPropertyValue(m);if(A.slice(-2)==="px")return A=A.slice(0,-2),parseFloat(A)}return NaN}})(),S=(()=>{let R=/url\(\s*(["']?)((?:\\.|[^\\)])+)\1\s*\)/gm;return {inlineAll:function(b,r,m){return g(b)?Promise.resolve(b).then(M).then(function(A){let y=Promise.resolve(b);return A.forEach(function(T){y=y.then(function(w){return u(w,T,r,m)});}),y}):Promise.resolve(b)},shouldProcess:g,impl:{readUrls:M,inline:u,urlAsRegex:p}};function g(b){return b.search(R)!==-1}function M(b){for(var r,m=[];(r=R.exec(b))!==null;)m.push(r[2]);return m.filter(function(A){return !n.isDataUrl(A)})}function p(b){return new RegExp(`url\\((["']?)(${n.escape(b)})\\1\\)`,"gm")}function u(b,r,m,A){return Promise.resolve(r).then(function(y){return m?n.resolveUrl(y,m):y}).then(A||n.getAndEncode).then(function(y){var T=p(r);return b.replace(T,`url($1${y}$1)`)})}})(),c={resolveAll:function(){return e().then(function(R){return Promise.all(R.map(function(g){return g.resolve()}))}).then(function(R){return R.join(`
|
|
2
|
-
`)})},impl:{readAll:e}};function e(){return Promise.resolve(n.asArray(globalThis.document.styleSheets)).then(function(g){let M=[];return g.forEach(function(p){var u=Object.getPrototypeOf(p);if(Object.prototype.hasOwnProperty.call(u,"cssRules"))try{n.asArray(p.cssRules||[]).forEach(M.push.bind(M));}catch(b){console.error("domtoimage: Error while reading CSS rules from: "+p.href,b.toString());}}),M}).then(function(g){return g.filter(function(M){return M.type===CSSRule.FONT_FACE_RULE}).filter(function(M){return S.shouldProcess(M.style.getPropertyValue("src"))})}).then(function(g){return g.map(R)});function R(g){return {resolve:function(){var M=(g.parentStyleSheet||{}).href;return S.inlineAll(g.cssText,M)},src:function(){return g.style.getPropertyValue("src")}}}}let t={inlineAll:function R(g){if(!n.isElement(g))return Promise.resolve(g);return M(g).then(function(){return n.isHTMLImageElement(g)?f(g).inline():Promise.all(n.asArray(g.childNodes).map(function(p){return R(p)}))});function M(p){let u=["background","background-image"],b=u.map(function(r){let m=p.style.getPropertyValue(r),A=p.style.getPropertyPriority(r);return m?S.inlineAll(m).then(function(y){p.style.setProperty(r,y,A);}):Promise.resolve()});return Promise.all(b).then(function(){return p})}},impl:{newImage:f}};function f(R){return {inline:function(g){return n.isDataUrl(R.src)?Promise.resolve():Promise.resolve(R.src).then(g||n.getAndEncode).then(function(M){return new Promise(function(p){R.onload=p,R.onerror=p,R.src=M;})})}}}let l={copyDefaultStyles:true,imagePlaceholder:void 0,cacheBust:false,useCredentials:false,useCredentialsFilters:[],httpTimeout:3e4,styleCaching:"strict",corsImg:void 0},v={toSvg:s,toPng:function(R,g){return d(R,g).then(function(M){return M.toDataURL()})},toJpeg:function(R,g){return d(R,g).then(function(M){return M.toDataURL("image/jpeg",(g?g.quality:void 0)||1)})},toBlob:function(R,g){return d(R,g).then(n.canvasToBlob)},toPixelData:function(R,g){return d(R,g).then(function(M){return M.getContext("2d").getImageData(0,0,n.width(R),n.height(R)).data})},toCanvas:d,impl:{fontFaces:c,images:t,util:n,inliner:S,urlCache:[],options:{},copyOptions:function(R){R.copyDefaultStyles===void 0?v.impl.options.copyDefaultStyles=l.copyDefaultStyles:v.impl.options.copyDefaultStyles=R.copyDefaultStyles,v.impl.options.imagePlaceholder=(R.imagePlaceholder===void 0?l:R).imagePlaceholder,v.impl.options.cacheBust=(R.cacheBust===void 0?l:R).cacheBust,v.impl.options.corsImg=(R.corsImg===void 0?l:R).corsImg,v.impl.options.useCredentials=(R.useCredentials===void 0?l:R).useCredentials,v.impl.options.useCredentialsFilters=(R.useCredentialsFilters===void 0?l:R).useCredentialsFilters,v.impl.options.httpTimeout=(R.httpTimeout===void 0?l:R).httpTimeout,v.impl.options.styleCaching=(R.styleCaching===void 0?l:R).styleCaching;}}},E=(typeof st=="object"&&typeof at=="object"?at.exports=v:o.domtoimage=v,(globalThis.Node===void 0?void 0:globalThis.Node.ELEMENT_NODE)||1),i=(o===void 0?void 0:o.getComputedStyle)||(globalThis.window===void 0?void 0:globalThis.window.getComputedStyle)||globalThis.getComputedStyle,a=(o===void 0?void 0:o.atob)||(globalThis.window===void 0?void 0:globalThis.window.atob)||globalThis.atob;function s(R,g){v.impl.util.getWindow(R);let p=(g=g||{},v.impl.copyOptions(g),[]);return Promise.resolve(R).then(function(u){if(u.nodeType===E)return u;var b=u,r=globalThis.document.createElement("span");return b.replaceWith(r),r.append(u),p.push({child:b,wrapper:r}),r}).then(function(u){return (function b(r,m,A,y){let T=m.filter;if(r===_||n.isHTMLScriptElement(r)||n.isHTMLStyleElement(r)||n.isHTMLLinkElement(r)||A!==null&&T&&!T(r))return Promise.resolve();return Promise.resolve(r).then(w).then(h).then(function(L){return x(L,P(r))}).then(U).then(function(L){return H(L,r)});function w(L){return n.isHTMLCanvasElement(L)?n.makeImage(L.toDataURL()):L.cloneNode(false)}function h(L){return m.adjustClonedNode&&m.adjustClonedNode(r,L,false),Promise.resolve(L)}function U(L){return m.adjustClonedNode&&m.adjustClonedNode(r,L,true),Promise.resolve(L)}function P(L){return n.isElementHostForOpenShadowRoot(L)?L.shadowRoot:L}function x(L,V){let B=K(V),D=Promise.resolve();if(B.length!==0){let G=i(W(V));n.asArray(B).forEach(function(Q){D=D.then(function(){return b(Q,m,G).then(function(q){q&&L.appendChild(q);})});});}return D.then(function(){return L});function W(G){return n.isShadowRoot(G)?G.host:G}function K(G){if(n.isShadowSlotElement(G)){let Q=G.assignedNodes();if(Q&&0<Q.length)return Q}return G.childNodes}}function H(L,V){return !n.isElement(L)||n.isShadowSlotElement(V)?Promise.resolve(L):Promise.resolve().then(D).then(W).then(K).then(G).then(B).then(function(){return L});function B(){n.isHTMLImageElement(L)&&(L.removeAttribute("loading"),V.srcset||V.sizes)&&(L.removeAttribute("srcset"),L.removeAttribute("sizes"),L.src=V.currentSrc||V.src);}function D(){function Q(z,$){$.font=z.font,$.fontFamily=z.fontFamily,$.fontFeatureSettings=z.fontFeatureSettings,$.fontKerning=z.fontKerning,$.fontSize=z.fontSize,$.fontStretch=z.fontStretch,$.fontStyle=z.fontStyle,$.fontVariant=z.fontVariant,$.fontVariantCaps=z.fontVariantCaps,$.fontVariantEastAsian=z.fontVariantEastAsian,$.fontVariantLigatures=z.fontVariantLigatures,$.fontVariantNumeric=z.fontVariantNumeric,$.fontVariationSettings=z.fontVariationSettings,$.fontWeight=z.fontWeight;}function q(z,$){let ie=i(z);ie.cssText?($.style.cssText=ie.cssText,Q(ie,$.style)):(C(m,z,ie,A,$),A===null&&(["inset-block","inset-block-start","inset-block-end"].forEach(se=>$.style.removeProperty(se)),["left","right","top","bottom"].forEach(se=>{$.style.getPropertyValue(se)&&$.style.setProperty(se,"0px");})));}q(V,L);}function W(){let Q=n.uid();function q(z){let $=i(V,z),ie=$.getPropertyValue("content");if(ie!==""&&ie!=="none"){let J=function(){let X=`.${Q}:`+z,ne=($.cssText?oe:j)();return globalThis.document.createTextNode(X+`{${ne}}`);function oe(){return `${$.cssText} content: ${ie};`}function j(){return n.asArray($).map(ee).join("; ")+";";function ee(Y){let ce=$.getPropertyValue(Y),ge=$.getPropertyPriority(Y)?" !important":"";return Y+": "+ce+ge}}};let Z=L.getAttribute("class")||"",te=(L.setAttribute("class",Z+" "+Q),globalThis.document.createElement("style"));te.appendChild(J()),L.appendChild(te);}}[":before",":after"].forEach(function(z){q(z);});}function K(){n.isHTMLTextAreaElement(V)&&(L.innerHTML=V.value),n.isHTMLInputElement(V)&&L.setAttribute("value",V.value);}function G(){n.isSVGElement(L)&&(L.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.isSVGRectElement(L))&&["width","height"].forEach(function(Q){let q=L.getAttribute(Q);q&&L.style.setProperty(Q,q);});}}})(u,g,null)}).then(g.disableEmbedFonts?Promise.resolve(R):I).then(g.disableInlineImages?Promise.resolve(R):O).then(function(u){g.bgcolor&&(u.style.backgroundColor=g.bgcolor),g.width&&(u.style.width=g.width+"px"),g.height&&(u.style.height=g.height+"px"),g.style&&Object.keys(g.style).forEach(function(r){u.style[r]=g.style[r];});let b=null;return typeof g.onclone=="function"&&(b=g.onclone(u)),Promise.resolve(b).then(function(){return u})}).then(function(u){let b=g.width||n.width(R),r=g.height||n.height(R);return Promise.resolve(u).then(function(m){return m.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(m)}).then(n.escapeXhtml).then(function(m){var A=(n.isDimensionMissing(b)?' width="100%"':` width="${b}"`)+(n.isDimensionMissing(r)?' height="100%"':` height="${r}"`);return `<svg xmlns="http://www.w3.org/2000/svg"${(n.isDimensionMissing(b)?"":` width="${b}"`)+(n.isDimensionMissing(r)?"":` height="${r}"`)}><foreignObject${A}>${m}</foreignObject></svg>`}).then(function(m){return "data:image/svg+xml;charset=utf-8,"+m})}).then(function(u){for(;0<p.length;){var b=p.pop();b.wrapper.replaceWith(b.child);}return u}).then(function(u){return v.impl.urlCache=[],_&&(globalThis.document.body.removeChild(_),_=null),N&&clearTimeout(N),N=setTimeout(()=>{N=null,F={};},2e4),u})}function d(R,g){return s(R,g=g||{}).then(n.makeImage).then(function(M){var p=typeof g.scale!="number"?1:g.scale,u=((r,m)=>{let A=g.width||n.width(r),y=g.height||n.height(r);return n.isDimensionMissing(A)&&(A=n.isDimensionMissing(y)?300:2*y),n.isDimensionMissing(y)&&(y=A/2),(r=globalThis.document.createElement("canvas")).width=A*m,r.height=y*m,g.bgcolor&&((m=r.getContext("2d")).fillStyle=g.bgcolor,m.fillRect(0,0,r.width,r.height)),r})(R,p),b=u.getContext("2d");return b.msImageSmoothingEnabled=false,b.imageSmoothingEnabled=false,M&&(b.scale(p,p),b.drawImage(M,0,0)),u})}let _=null;function I(R){return c.resolveAll().then(function(g){var M;return g!==""&&(M=globalThis.document.createElement("style"),R.appendChild(M),M.appendChild(globalThis.document.createTextNode(g))),R})}function O(R){return t.inlineAll(R).then(function(){return R})}function C(R,g,M,p,u){let b=v.impl.options.copyDefaultStyles?((m,A)=>{var y,T=(U=>(m.styleCaching!=="relaxed"?U:U.filter((P,x,H)=>x===0||x===H.length-1)).join(">"))(A=(U=>{var P=[];do if(U.nodeType===E){var x=U.tagName;if(P.push(x),k.includes(x))break}while(U=U.parentNode);return P})(A));{if(F[T])return F[T];A=((U,P)=>{let x=U.body;do{var H=P.pop(),H=U.createElement(H);x.appendChild(H),x=H;}while(0<P.length);return x.textContent="\u200B",x})((y=(()=>{if(_)return _.contentWindow;P=globalThis.document.characterSet||"UTF-8",U=(U=globalThis.document.doctype)?(`<!DOCTYPE ${D(U.name)} ${D(U.publicId)} `+D(U.systemId)).trim()+">":"",(_=globalThis.document.createElement("iframe")).id="domtoimage-sandbox-"+n.uid(),_.style.top="-9999px",_.style.visibility="hidden",_.style.position="fixed",globalThis.document.body.appendChild(_);var U,P,x=_,H="domtoimage-sandbox";try{return x.contentWindow.document.write(U+`<html><head><meta charset='${P}'><title>${H}</title></head><body></body></html>`),x.contentWindow}catch{}var L=globalThis.document.createElement("meta");L.setAttribute("charset",P);try{var V=globalThis.document.implementation.createHTMLDocument(H),B=(V.head.appendChild(L),U+V.documentElement.outerHTML);return x.setAttribute("srcdoc",B),x.contentWindow}catch{}return x.contentDocument.head.appendChild(L),x.contentDocument.title=H,x.contentWindow;function D(W){var K;return W?((K=globalThis.document.createElement("div")).innerText=W,K.innerHTML):""}})()).document,A),y=((U,P)=>{let x={},H=U.getComputedStyle(P);return n.asArray(H).forEach(function(L){x[L]=L==="width"||L==="height"?"auto":H.getPropertyValue(L);}),x})(y,A);var w=A;do{var h=w.parentElement;h!==null&&h.removeChild(w),w=h;}while(w&&w.tagName!=="BODY");return F[T]=y}})(R,g):{},r=u.style;n.asArray(M).forEach(function(m){var A,y,T,w;R.filterStyles&&!R.filterStyles(g,m)||(y=M.getPropertyValue(m),T=b[m],A=p?p.getPropertyValue(m):void 0,r.getPropertyValue(m))||(y!==T||p&&y!==A)&&(T=M.getPropertyPriority(m),A=r,y=y,T=T,w=0<=["background-clip"].indexOf(m=m),T?(A.setProperty(m,y,T),w&&A.setProperty("-webkit-"+m,y,T)):(A.setProperty(m,y),w&&A.setProperty("-webkit-"+m,y)));});}let N=null,F={},k=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"];})(st);});var zt=nt(()=>{});var pn=nt((oo,dn)=>{var wt=typeof Map=="function"&&Map.prototype,ct=Object.getOwnPropertyDescriptor&&wt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ye=wt&&ct&&typeof ct.get=="function"?ct.get:null,Gt=wt&&Map.prototype.forEach,yt=typeof Set=="function"&&Set.prototype,lt=Object.getOwnPropertyDescriptor&&yt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Je=yt&<&&typeof lt.get=="function"?lt.get:null,qt=yt&&Set.prototype.forEach,Yn=typeof WeakMap=="function"&&WeakMap.prototype,Ne=Yn?WeakMap.prototype.has:null,Jn=typeof WeakSet=="function"&&WeakSet.prototype,Be=Jn?WeakSet.prototype.has:null,Xn=typeof WeakRef=="function"&&WeakRef.prototype,Kt=Xn?WeakRef.prototype.deref:null,Zn=Boolean.prototype.valueOf,jn=Object.prototype.toString,er=Function.prototype.toString,tr=String.prototype.match,vt=String.prototype.slice,Ee=String.prototype.replace,nr=String.prototype.toUpperCase,Yt=String.prototype.toLowerCase,on=RegExp.prototype.test,Jt=Array.prototype.concat,ye=Array.prototype.join,rr=Array.prototype.slice,Xt=Math.floor,dt=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ut=Object.getOwnPropertySymbols,pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ke=typeof Symbol=="function"&&typeof Symbol.iterator=="object",He=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ke||true)?Symbol.toStringTag:null,sn=Object.prototype.propertyIsEnumerable,Zt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(o){return o.__proto__}:null);function jt(o,n){if(o===1/0||o===-1/0||o!==o||o&&o>-1e3&&o<1e3||on.call(/e/,n))return n;var S=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof o=="number"){var c=o<0?-Xt(-o):Xt(o);if(c!==o){var e=String(c),t=vt.call(n,e.length+1);return Ee.call(e,S,"$&_")+"."+Ee.call(Ee.call(t,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ee.call(n,S,"$&_")}var ht=zt(),en=ht.custom,tn=ln(en)?en:null,an={__proto__:null,double:'"',single:"'"},or={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};dn.exports=function o(n,S,c,e){var t=S||{};if(_e(t,"quoteStyle")&&!_e(an,t.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(_e(t,"maxStringLength")&&(typeof t.maxStringLength=="number"?t.maxStringLength<0&&t.maxStringLength!==1/0:t.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=_e(t,"customInspect")?t.customInspect:true;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(_e(t,"indent")&&t.indent!==null&&t.indent!==" "&&!(parseInt(t.indent,10)===t.indent&&t.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(_e(t,"numericSeparator")&&typeof t.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=t.numericSeparator;if(typeof n>"u")return "undefined";if(n===null)return "null";if(typeof n=="boolean")return n?"true":"false";if(typeof n=="string")return fn(n,t);if(typeof n=="number"){if(n===0)return 1/0/n>0?"0":"-0";var v=String(n);return l?jt(n,v):v}if(typeof n=="bigint"){var E=String(n)+"n";return l?jt(n,E):E}var i=typeof t.depth>"u"?5:t.depth;if(typeof c>"u"&&(c=0),c>=i&&i>0&&typeof n=="object")return gt(n)?"[Array]":"[Object]";var a=br(t,c);if(typeof e>"u")e=[];else if(un(e,n)>=0)return "[Circular]";function s(A,y,T){if(y&&(e=rr.call(e),e.push(y)),T){var w={depth:t.depth};return _e(t,"quoteStyle")&&(w.quoteStyle=t.quoteStyle),o(A,w,c+1,e)}return o(A,t,c+1,e)}if(typeof n=="function"&&!nn(n)){var d=pr(n),_=Ke(n,s);return "[Function"+(d?": "+d:" (anonymous)")+"]"+(_.length>0?" { "+ye.call(_,", ")+" }":"")}if(ln(n)){var I=ke?Ee.call(String(n),/^(Symbol\(.*\))_[^)]*$/,"$1"):pt.call(n);return typeof n=="object"&&!ke?Fe(I):I}if(vr(n)){for(var O="<"+Yt.call(String(n.nodeName)),C=n.attributes||[],N=0;N<C.length;N++)O+=" "+C[N].name+"="+cn(ir(C[N].value),"double",t);return O+=">",n.childNodes&&n.childNodes.length&&(O+="..."),O+="</"+Yt.call(String(n.nodeName))+">",O}if(gt(n)){if(n.length===0)return "[]";var F=Ke(n,s);return a&&!Ar(F)?"["+mt(F,a)+"]":"[ "+ye.call(F,", ")+" ]"}if(ar(n)){var k=Ke(n,s);return !("cause"in Error.prototype)&&"cause"in n&&!sn.call(n,"cause")?"{ ["+String(n)+"] "+ye.call(Jt.call("[cause]: "+s(n.cause),k),", ")+" }":k.length===0?"["+String(n)+"]":"{ ["+String(n)+"] "+ye.call(k,", ")+" }"}if(typeof n=="object"&&f){if(tn&&typeof n[tn]=="function"&&ht)return ht(n,{depth:i-c});if(f!=="symbol"&&typeof n.inspect=="function")return n.inspect()}if(hr(n)){var R=[];return Gt&&Gt.call(n,function(A,y){R.push(s(y,n,true)+" => "+s(A,n));}),rn("Map",Ye.call(n),R,a)}if(wr(n)){var g=[];return qt&&qt.call(n,function(A){g.push(s(A,n));}),rn("Set",Je.call(n),g,a)}if(gr(n))return ft("WeakMap");if(yr(n))return ft("WeakSet");if(mr(n))return ft("WeakRef");if(lr(n))return Fe(s(Number(n)));if(fr(n))return Fe(s(dt.call(n)));if(ur(n))return Fe(Zn.call(n));if(cr(n))return Fe(s(String(n)));if(typeof globalThis.window<"u"&&n===globalThis.window)return "{ [object Window] }";if(typeof globalThis<"u"&&n===globalThis||typeof global<"u"&&n===global)return "{ [object globalThis] }";if(!sr(n)&&!nn(n)){var M=Ke(n,s),p=Zt?Zt(n)===Object.prototype:n instanceof Object||n.constructor===Object,u=n instanceof Object?"":"null prototype",b=!p&&He&&Object(n)===n&&He in n?vt.call(Se(n),8,-1):u?"Object":"",r=p||typeof n.constructor!="function"?"":n.constructor.name?n.constructor.name+" ":"",m=r+(b||u?"["+ye.call(Jt.call([],b||[],u||[]),": ")+"] ":"");return M.length===0?m+"{}":a?m+"{"+mt(M,a)+"}":m+"{ "+ye.call(M,", ")+" }"}return String(n)};function cn(o,n,S){var c=S.quoteStyle||n,e=an[c];return e+o+e}function ir(o){return Ee.call(String(o),/"/g,""")}function Pe(o){return !He||!(typeof o=="object"&&(He in o||typeof o[He]<"u"))}function gt(o){return Se(o)==="[object Array]"&&Pe(o)}function sr(o){return Se(o)==="[object Date]"&&Pe(o)}function nn(o){return Se(o)==="[object RegExp]"&&Pe(o)}function ar(o){return Se(o)==="[object Error]"&&Pe(o)}function cr(o){return Se(o)==="[object String]"&&Pe(o)}function lr(o){return Se(o)==="[object Number]"&&Pe(o)}function ur(o){return Se(o)==="[object Boolean]"&&Pe(o)}function ln(o){if(ke)return o&&typeof o=="object"&&o instanceof Symbol;if(typeof o=="symbol")return true;if(!o||typeof o!="object"||!pt)return false;try{return pt.call(o),!0}catch{}return false}function fr(o){if(!o||typeof o!="object"||!dt)return false;try{return dt.call(o),!0}catch{}return false}var dr=Object.prototype.hasOwnProperty||function(o){return o in this};function _e(o,n){return dr.call(o,n)}function Se(o){return jn.call(o)}function pr(o){if(o.name)return o.name;var n=tr.call(er.call(o),/^function\s*([\w$]+)/);return n?n[1]:null}function un(o,n){if(o.indexOf)return o.indexOf(n);for(var S=0,c=o.length;S<c;S++)if(o[S]===n)return S;return -1}function hr(o){if(!Ye||!o||typeof o!="object")return false;try{Ye.call(o);try{Je.call(o);}catch{return !0}return o instanceof Map}catch{}return false}function gr(o){if(!Ne||!o||typeof o!="object")return false;try{Ne.call(o,Ne);try{Be.call(o,Be);}catch{return !0}return o instanceof WeakMap}catch{}return false}function mr(o){if(!Kt||!o||typeof o!="object")return false;try{return Kt.call(o),!0}catch{}return false}function wr(o){if(!Je||!o||typeof o!="object")return false;try{Je.call(o);try{Ye.call(o);}catch{return !0}return o instanceof Set}catch{}return false}function yr(o){if(!Be||!o||typeof o!="object")return false;try{Be.call(o,Be);try{Ne.call(o,Ne);}catch{return !0}return o instanceof WeakSet}catch{}return false}function vr(o){return !o||typeof o!="object"?false:typeof HTMLElement<"u"&&o instanceof HTMLElement?true:typeof o.nodeName=="string"&&typeof o.getAttribute=="function"}function fn(o,n){if(o.length>n.maxStringLength){var S=o.length-n.maxStringLength,c="... "+S+" more character"+(S>1?"s":"");return fn(vt.call(o,0,n.maxStringLength),n)+c}var e=or[n.quoteStyle||"single"];e.lastIndex=0;var t=Ee.call(Ee.call(o,e,"\\$1"),/[\x00-\x1f]/g,_r);return cn(t,"single",n)}function _r(o){var n=o.charCodeAt(0),S={8:"b",9:"t",10:"n",12:"f",13:"r"}[n];return S?"\\"+S:"\\x"+(n<16?"0":"")+nr.call(n.toString(16))}function Fe(o){return "Object("+o+")"}function ft(o){return o+" { ? }"}function rn(o,n,S,c){var e=c?mt(S,c):ye.call(S,", ");return o+" ("+n+") {"+e+"}"}function Ar(o){for(var n=0;n<o.length;n++)if(un(o[n],`
|
|
2
|
+
`)})},impl:{readAll:e}};function e(){return Promise.resolve(n.asArray(globalThis.document.styleSheets)).then(function(g){let M=[];return g.forEach(function(p){var u=Object.getPrototypeOf(p);if(Object.prototype.hasOwnProperty.call(u,"cssRules"))try{n.asArray(p.cssRules||[]).forEach(M.push.bind(M));}catch(b){console.error("domtoimage: Error while reading CSS rules from: "+p.href,b.toString());}}),M}).then(function(g){return g.filter(function(M){return M.type===CSSRule.FONT_FACE_RULE}).filter(function(M){return S.shouldProcess(M.style.getPropertyValue("src"))})}).then(function(g){return g.map(R)});function R(g){return {resolve:function(){var M=(g.parentStyleSheet||{}).href;return S.inlineAll(g.cssText,M)},src:function(){return g.style.getPropertyValue("src")}}}}let t={inlineAll:function R(g){if(!n.isElement(g))return Promise.resolve(g);return M(g).then(function(){return n.isHTMLImageElement(g)?f(g).inline():Promise.all(n.asArray(g.childNodes).map(function(p){return R(p)}))});function M(p){let u=["background","background-image"],b=u.map(function(r){let m=p.style.getPropertyValue(r),A=p.style.getPropertyPriority(r);return m?S.inlineAll(m).then(function(y){p.style.setProperty(r,y,A);}):Promise.resolve()});return Promise.all(b).then(function(){return p})}},impl:{newImage:f}};function f(R){return {inline:function(g){return n.isDataUrl(R.src)?Promise.resolve():Promise.resolve(R.src).then(g||n.getAndEncode).then(function(M){return new Promise(function(p){R.onload=p,R.onerror=p,R.src=M;})})}}}let l={copyDefaultStyles:true,imagePlaceholder:void 0,cacheBust:false,useCredentials:false,useCredentialsFilters:[],httpTimeout:3e4,styleCaching:"strict",corsImg:void 0},v={toSvg:s,toPng:function(R,g){return d(R,g).then(function(M){return M.toDataURL()})},toJpeg:function(R,g){return d(R,g).then(function(M){return M.toDataURL("image/jpeg",(g?g.quality:void 0)||1)})},toBlob:function(R,g){return d(R,g).then(n.canvasToBlob)},toPixelData:function(R,g){return d(R,g).then(function(M){return M.getContext("2d").getImageData(0,0,n.width(R),n.height(R)).data})},toCanvas:d,impl:{fontFaces:c,images:t,util:n,inliner:S,urlCache:[],options:{},copyOptions:function(R){R.copyDefaultStyles===void 0?v.impl.options.copyDefaultStyles=l.copyDefaultStyles:v.impl.options.copyDefaultStyles=R.copyDefaultStyles,v.impl.options.imagePlaceholder=(R.imagePlaceholder===void 0?l:R).imagePlaceholder,v.impl.options.cacheBust=(R.cacheBust===void 0?l:R).cacheBust,v.impl.options.corsImg=(R.corsImg===void 0?l:R).corsImg,v.impl.options.useCredentials=(R.useCredentials===void 0?l:R).useCredentials,v.impl.options.useCredentialsFilters=(R.useCredentialsFilters===void 0?l:R).useCredentialsFilters,v.impl.options.httpTimeout=(R.httpTimeout===void 0?l:R).httpTimeout,v.impl.options.styleCaching=(R.styleCaching===void 0?l:R).styleCaching;}}},E=(typeof st=="object"&&typeof at=="object"?at.exports=v:o.domtoimage=v,(globalThis.Node===void 0?void 0:globalThis.Node.ELEMENT_NODE)||1),i=(o===void 0?void 0:o.getComputedStyle)||(globalThis.window===void 0?void 0:globalThis.window.getComputedStyle)||globalThis.getComputedStyle,a=(o===void 0?void 0:o.atob)||(globalThis.window===void 0?void 0:globalThis.window.atob)||globalThis.atob;function s(R,g){v.impl.util.getWindow(R);let p=(g=g||{},v.impl.copyOptions(g),[]);return Promise.resolve(R).then(function(u){if(u.nodeType===E)return u;var b=u,r=globalThis.document.createElement("span");return b.replaceWith(r),r.append(u),p.push({child:b,wrapper:r}),r}).then(function(u){return (function b(r,m,A,y){let T=m.filter;if(r===_||n.isHTMLScriptElement(r)||n.isHTMLStyleElement(r)||n.isHTMLLinkElement(r)||A!==null&&T&&!T(r))return Promise.resolve();return Promise.resolve(r).then(w).then(h).then(function(L){return x(L,P(r))}).then(U).then(function(L){return H(L,r)});function w(L){return n.isHTMLCanvasElement(L)?n.makeImage(L.toDataURL()):L.cloneNode(false)}function h(L){return m.adjustClonedNode&&m.adjustClonedNode(r,L,false),Promise.resolve(L)}function U(L){return m.adjustClonedNode&&m.adjustClonedNode(r,L,true),Promise.resolve(L)}function P(L){return n.isElementHostForOpenShadowRoot(L)?L.shadowRoot:L}function x(L,V){let B=K(V),D=Promise.resolve();if(B.length!==0){let G=i(W(V));n.asArray(B).forEach(function(Q){D=D.then(function(){return b(Q,m,G).then(function(q){q&&L.appendChild(q);})});});}return D.then(function(){return L});function W(G){return n.isShadowRoot(G)?G.host:G}function K(G){if(n.isShadowSlotElement(G)){let Q=G.assignedNodes();if(Q&&0<Q.length)return Q}return G.childNodes}}function H(L,V){return !n.isElement(L)||n.isShadowSlotElement(V)?Promise.resolve(L):Promise.resolve().then(D).then(W).then(K).then(G).then(B).then(function(){return L});function B(){n.isHTMLImageElement(L)&&(L.removeAttribute("loading"),V.srcset||V.sizes)&&(L.removeAttribute("srcset"),L.removeAttribute("sizes"),L.src=V.currentSrc||V.src);}function D(){function Q(z,$){$.font=z.font,$.fontFamily=z.fontFamily,$.fontFeatureSettings=z.fontFeatureSettings,$.fontKerning=z.fontKerning,$.fontSize=z.fontSize,$.fontStretch=z.fontStretch,$.fontStyle=z.fontStyle,$.fontVariant=z.fontVariant,$.fontVariantCaps=z.fontVariantCaps,$.fontVariantEastAsian=z.fontVariantEastAsian,$.fontVariantLigatures=z.fontVariantLigatures,$.fontVariantNumeric=z.fontVariantNumeric,$.fontVariationSettings=z.fontVariationSettings,$.fontWeight=z.fontWeight;}function q(z,$){let ie=i(z);ie.cssText?($.style.cssText=ie.cssText,Q(ie,$.style)):(C(m,z,ie,A,$),A===null&&(["inset-block","inset-block-start","inset-block-end"].forEach(se=>$.style.removeProperty(se)),["left","right","top","bottom"].forEach(se=>{$.style.getPropertyValue(se)&&$.style.setProperty(se,"0px");})));}q(V,L);}function W(){let Q=n.uid();function q(z){let $=i(V,z),ie=$.getPropertyValue("content");if(ie!==""&&ie!=="none"){let J=function(){let X=`.${Q}:`+z,ne=($.cssText?oe:j)();return globalThis.document.createTextNode(X+`{${ne}}`);function oe(){return `${$.cssText} content: ${ie};`}function j(){return n.asArray($).map(ee).join("; ")+";";function ee(Y){let ce=$.getPropertyValue(Y),ge=$.getPropertyPriority(Y)?" !important":"";return Y+": "+ce+ge}}};let Z=L.getAttribute("class")||"",te=(L.setAttribute("class",Z+" "+Q),globalThis.document.createElement("style"));te.appendChild(J()),L.appendChild(te);}}[":before",":after"].forEach(function(z){q(z);});}function K(){n.isHTMLTextAreaElement(V)&&(L.innerHTML=V.value),n.isHTMLInputElement(V)&&L.setAttribute("value",V.value);}function G(){n.isSVGElement(L)&&(L.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.isSVGRectElement(L))&&["width","height"].forEach(function(Q){let q=L.getAttribute(Q);q&&L.style.setProperty(Q,q);});}}})(u,g,null)}).then(g.disableEmbedFonts?Promise.resolve(R):I).then(g.disableInlineImages?Promise.resolve(R):O).then(function(u){g.bgcolor&&(u.style.backgroundColor=g.bgcolor),g.width&&(u.style.width=g.width+"px"),g.height&&(u.style.height=g.height+"px"),g.style&&Object.keys(g.style).forEach(function(r){u.style[r]=g.style[r];});let b=null;return typeof g.onclone=="function"&&(b=g.onclone(u)),Promise.resolve(b).then(function(){return u})}).then(function(u){let b=g.width||n.width(R),r=g.height||n.height(R);return Promise.resolve(u).then(function(m){return m.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(m)}).then(n.escapeXhtml).then(function(m){var A=(n.isDimensionMissing(b)?' width="100%"':` width="${b}"`)+(n.isDimensionMissing(r)?' height="100%"':` height="${r}"`);return `<svg xmlns="http://www.w3.org/2000/svg"${(n.isDimensionMissing(b)?"":` width="${b}"`)+(n.isDimensionMissing(r)?"":` height="${r}"`)}><foreignObject${A}>${m}</foreignObject></svg>`}).then(function(m){return "data:image/svg+xml;charset=utf-8,"+m})}).then(function(u){for(;0<p.length;){var b=p.pop();b.wrapper.replaceWith(b.child);}return u}).then(function(u){return v.impl.urlCache=[],_&&(globalThis.document.body.removeChild(_),_=null),N&&clearTimeout(N),N=setTimeout(()=>{N=null,F={};},2e4),u})}function d(R,g){return s(R,g=g||{}).then(n.makeImage).then(function(M){var p=typeof g.scale!="number"?1:g.scale,u=((r,m)=>{let A=g.width||n.width(r),y=g.height||n.height(r);return n.isDimensionMissing(A)&&(A=n.isDimensionMissing(y)?300:2*y),n.isDimensionMissing(y)&&(y=A/2),(r=globalThis.document.createElement("canvas")).width=A*m,r.height=y*m,g.bgcolor&&((m=r.getContext("2d")).fillStyle=g.bgcolor,m.fillRect(0,0,r.width,r.height)),r})(R,p),b=u.getContext("2d");return b.msImageSmoothingEnabled=false,b.imageSmoothingEnabled=false,M&&(b.scale(p,p),b.drawImage(M,0,0)),u})}let _=null;function I(R){return c.resolveAll().then(function(g){var M;return g!==""&&(M=globalThis.document.createElement("style"),R.appendChild(M),M.appendChild(globalThis.document.createTextNode(g))),R})}function O(R){return t.inlineAll(R).then(function(){return R})}function C(R,g,M,p,u){let b=v.impl.options.copyDefaultStyles?((m,A)=>{var y,T=(U=>(m.styleCaching!=="relaxed"?U:U.filter((P,x,H)=>x===0||x===H.length-1)).join(">"))(A=(U=>{var P=[];do if(U.nodeType===E){var x=U.tagName;if(P.push(x),k.includes(x))break}while(U=U.parentNode);return P})(A));{if(F[T])return F[T];A=((U,P)=>{let x=U.body;do{var H=P.pop(),H=U.createElement(H);x.appendChild(H),x=H;}while(0<P.length);return x.textContent="\u200B",x})((y=(()=>{if(_)return _.contentWindow;P=globalThis.document.characterSet||"UTF-8",U=(U=globalThis.document.doctype)?(`<!DOCTYPE ${D(U.name)} ${D(U.publicId)} `+D(U.systemId)).trim()+">":"",(_=globalThis.document.createElement("iframe")).id="domtoimage-sandbox-"+n.uid(),_.style.top="-9999px",_.style.visibility="hidden",_.style.position="fixed",globalThis.document.body.appendChild(_);var U,P,x=_,H="domtoimage-sandbox";try{return x.contentWindow.document.write(U+`<html><head><meta charset='${P}'><title>${H}</title></head><body></body></html>`),x.contentWindow}catch{}var L=globalThis.document.createElement("meta");L.setAttribute("charset",P);try{var V=globalThis.document.implementation.createHTMLDocument(H),B=(V.head.appendChild(L),U+V.documentElement.outerHTML);return x.setAttribute("srcdoc",B),x.contentWindow}catch{}return x.contentDocument.head.appendChild(L),x.contentDocument.title=H,x.contentWindow;function D(W){var K;return W?((K=globalThis.document.createElement("div")).innerText=W,K.innerHTML):""}})()).document,A),y=((U,P)=>{let x={},H=U.getComputedStyle(P);return n.asArray(H).forEach(function(L){x[L]=L==="width"||L==="height"?"auto":H.getPropertyValue(L);}),x})(y,A);var w=A;do{var h=w.parentElement;h!==null&&h.removeChild(w),w=h;}while(w&&w.tagName!=="BODY");return F[T]=y}})(R,g):{},r=u.style;n.asArray(M).forEach(function(m){var A,y,T,w;R.filterStyles&&!R.filterStyles(g,m)||(y=M.getPropertyValue(m),T=b[m],A=p?p.getPropertyValue(m):void 0,r.getPropertyValue(m))||(y!==T||p&&y!==A)&&(T=M.getPropertyPriority(m),A=r,y=y,T=T,w=0<=["background-clip"].indexOf(m=m),T?(A.setProperty(m,y,T),w&&A.setProperty("-webkit-"+m,y,T)):(A.setProperty(m,y),w&&A.setProperty("-webkit-"+m,y)));});}let N=null,F={},k=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"];})(st);});var zt=nt(()=>{});var pn=nt((io,dn)=>{var wt=typeof Map=="function"&&Map.prototype,ct=Object.getOwnPropertyDescriptor&&wt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ye=wt&&ct&&typeof ct.get=="function"?ct.get:null,Gt=wt&&Map.prototype.forEach,yt=typeof Set=="function"&&Set.prototype,lt=Object.getOwnPropertyDescriptor&&yt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Je=yt&<&&typeof lt.get=="function"?lt.get:null,qt=yt&&Set.prototype.forEach,Yn=typeof WeakMap=="function"&&WeakMap.prototype,Ne=Yn?WeakMap.prototype.has:null,Jn=typeof WeakSet=="function"&&WeakSet.prototype,Be=Jn?WeakSet.prototype.has:null,Xn=typeof WeakRef=="function"&&WeakRef.prototype,Kt=Xn?WeakRef.prototype.deref:null,Zn=Boolean.prototype.valueOf,jn=Object.prototype.toString,er=Function.prototype.toString,tr=String.prototype.match,vt=String.prototype.slice,Ee=String.prototype.replace,nr=String.prototype.toUpperCase,Yt=String.prototype.toLowerCase,on=RegExp.prototype.test,Jt=Array.prototype.concat,ye=Array.prototype.join,rr=Array.prototype.slice,Xt=Math.floor,dt=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ut=Object.getOwnPropertySymbols,pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ke=typeof Symbol=="function"&&typeof Symbol.iterator=="object",He=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ke||true)?Symbol.toStringTag:null,sn=Object.prototype.propertyIsEnumerable,Zt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(o){return o.__proto__}:null);function jt(o,n){if(o===1/0||o===-1/0||o!==o||o&&o>-1e3&&o<1e3||on.call(/e/,n))return n;var S=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof o=="number"){var c=o<0?-Xt(-o):Xt(o);if(c!==o){var e=String(c),t=vt.call(n,e.length+1);return Ee.call(e,S,"$&_")+"."+Ee.call(Ee.call(t,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ee.call(n,S,"$&_")}var ht=zt(),en=ht.custom,tn=ln(en)?en:null,an={__proto__:null,double:'"',single:"'"},or={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};dn.exports=function o(n,S,c,e){var t=S||{};if(_e(t,"quoteStyle")&&!_e(an,t.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(_e(t,"maxStringLength")&&(typeof t.maxStringLength=="number"?t.maxStringLength<0&&t.maxStringLength!==1/0:t.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=_e(t,"customInspect")?t.customInspect:true;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(_e(t,"indent")&&t.indent!==null&&t.indent!==" "&&!(parseInt(t.indent,10)===t.indent&&t.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(_e(t,"numericSeparator")&&typeof t.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=t.numericSeparator;if(typeof n>"u")return "undefined";if(n===null)return "null";if(typeof n=="boolean")return n?"true":"false";if(typeof n=="string")return fn(n,t);if(typeof n=="number"){if(n===0)return 1/0/n>0?"0":"-0";var v=String(n);return l?jt(n,v):v}if(typeof n=="bigint"){var E=String(n)+"n";return l?jt(n,E):E}var i=typeof t.depth>"u"?5:t.depth;if(typeof c>"u"&&(c=0),c>=i&&i>0&&typeof n=="object")return gt(n)?"[Array]":"[Object]";var a=br(t,c);if(typeof e>"u")e=[];else if(un(e,n)>=0)return "[Circular]";function s(A,y,T){if(y&&(e=rr.call(e),e.push(y)),T){var w={depth:t.depth};return _e(t,"quoteStyle")&&(w.quoteStyle=t.quoteStyle),o(A,w,c+1,e)}return o(A,t,c+1,e)}if(typeof n=="function"&&!nn(n)){var d=pr(n),_=Ke(n,s);return "[Function"+(d?": "+d:" (anonymous)")+"]"+(_.length>0?" { "+ye.call(_,", ")+" }":"")}if(ln(n)){var I=ke?Ee.call(String(n),/^(Symbol\(.*\))_[^)]*$/,"$1"):pt.call(n);return typeof n=="object"&&!ke?Fe(I):I}if(vr(n)){for(var O="<"+Yt.call(String(n.nodeName)),C=n.attributes||[],N=0;N<C.length;N++)O+=" "+C[N].name+"="+cn(ir(C[N].value),"double",t);return O+=">",n.childNodes&&n.childNodes.length&&(O+="..."),O+="</"+Yt.call(String(n.nodeName))+">",O}if(gt(n)){if(n.length===0)return "[]";var F=Ke(n,s);return a&&!Ar(F)?"["+mt(F,a)+"]":"[ "+ye.call(F,", ")+" ]"}if(ar(n)){var k=Ke(n,s);return !("cause"in Error.prototype)&&"cause"in n&&!sn.call(n,"cause")?"{ ["+String(n)+"] "+ye.call(Jt.call("[cause]: "+s(n.cause),k),", ")+" }":k.length===0?"["+String(n)+"]":"{ ["+String(n)+"] "+ye.call(k,", ")+" }"}if(typeof n=="object"&&f){if(tn&&typeof n[tn]=="function"&&ht)return ht(n,{depth:i-c});if(f!=="symbol"&&typeof n.inspect=="function")return n.inspect()}if(hr(n)){var R=[];return Gt&&Gt.call(n,function(A,y){R.push(s(y,n,true)+" => "+s(A,n));}),rn("Map",Ye.call(n),R,a)}if(wr(n)){var g=[];return qt&&qt.call(n,function(A){g.push(s(A,n));}),rn("Set",Je.call(n),g,a)}if(gr(n))return ft("WeakMap");if(yr(n))return ft("WeakSet");if(mr(n))return ft("WeakRef");if(lr(n))return Fe(s(Number(n)));if(fr(n))return Fe(s(dt.call(n)));if(ur(n))return Fe(Zn.call(n));if(cr(n))return Fe(s(String(n)));if(typeof globalThis.window<"u"&&n===globalThis.window)return "{ [object Window] }";if(typeof globalThis<"u"&&n===globalThis||typeof global<"u"&&n===global)return "{ [object globalThis] }";if(!sr(n)&&!nn(n)){var M=Ke(n,s),p=Zt?Zt(n)===Object.prototype:n instanceof Object||n.constructor===Object,u=n instanceof Object?"":"null prototype",b=!p&&He&&Object(n)===n&&He in n?vt.call(Se(n),8,-1):u?"Object":"",r=p||typeof n.constructor!="function"?"":n.constructor.name?n.constructor.name+" ":"",m=r+(b||u?"["+ye.call(Jt.call([],b||[],u||[]),": ")+"] ":"");return M.length===0?m+"{}":a?m+"{"+mt(M,a)+"}":m+"{ "+ye.call(M,", ")+" }"}return String(n)};function cn(o,n,S){var c=S.quoteStyle||n,e=an[c];return e+o+e}function ir(o){return Ee.call(String(o),/"/g,""")}function Pe(o){return !He||!(typeof o=="object"&&(He in o||typeof o[He]<"u"))}function gt(o){return Se(o)==="[object Array]"&&Pe(o)}function sr(o){return Se(o)==="[object Date]"&&Pe(o)}function nn(o){return Se(o)==="[object RegExp]"&&Pe(o)}function ar(o){return Se(o)==="[object Error]"&&Pe(o)}function cr(o){return Se(o)==="[object String]"&&Pe(o)}function lr(o){return Se(o)==="[object Number]"&&Pe(o)}function ur(o){return Se(o)==="[object Boolean]"&&Pe(o)}function ln(o){if(ke)return o&&typeof o=="object"&&o instanceof Symbol;if(typeof o=="symbol")return true;if(!o||typeof o!="object"||!pt)return false;try{return pt.call(o),!0}catch{}return false}function fr(o){if(!o||typeof o!="object"||!dt)return false;try{return dt.call(o),!0}catch{}return false}var dr=Object.prototype.hasOwnProperty||function(o){return o in this};function _e(o,n){return dr.call(o,n)}function Se(o){return jn.call(o)}function pr(o){if(o.name)return o.name;var n=tr.call(er.call(o),/^function\s*([\w$]+)/);return n?n[1]:null}function un(o,n){if(o.indexOf)return o.indexOf(n);for(var S=0,c=o.length;S<c;S++)if(o[S]===n)return S;return -1}function hr(o){if(!Ye||!o||typeof o!="object")return false;try{Ye.call(o);try{Je.call(o);}catch{return !0}return o instanceof Map}catch{}return false}function gr(o){if(!Ne||!o||typeof o!="object")return false;try{Ne.call(o,Ne);try{Be.call(o,Be);}catch{return !0}return o instanceof WeakMap}catch{}return false}function mr(o){if(!Kt||!o||typeof o!="object")return false;try{return Kt.call(o),!0}catch{}return false}function wr(o){if(!Je||!o||typeof o!="object")return false;try{Je.call(o);try{Ye.call(o);}catch{return !0}return o instanceof Set}catch{}return false}function yr(o){if(!Be||!o||typeof o!="object")return false;try{Be.call(o,Be);try{Ne.call(o,Ne);}catch{return !0}return o instanceof WeakSet}catch{}return false}function vr(o){return !o||typeof o!="object"?false:typeof HTMLElement<"u"&&o instanceof HTMLElement?true:typeof o.nodeName=="string"&&typeof o.getAttribute=="function"}function fn(o,n){if(o.length>n.maxStringLength){var S=o.length-n.maxStringLength,c="... "+S+" more character"+(S>1?"s":"");return fn(vt.call(o,0,n.maxStringLength),n)+c}var e=or[n.quoteStyle||"single"];e.lastIndex=0;var t=Ee.call(Ee.call(o,e,"\\$1"),/[\x00-\x1f]/g,_r);return cn(t,"single",n)}function _r(o){var n=o.charCodeAt(0),S={8:"b",9:"t",10:"n",12:"f",13:"r"}[n];return S?"\\"+S:"\\x"+(n<16?"0":"")+nr.call(n.toString(16))}function Fe(o){return "Object("+o+")"}function ft(o){return o+" { ? }"}function rn(o,n,S,c){var e=c?mt(S,c):ye.call(S,", ");return o+" ("+n+") {"+e+"}"}function Ar(o){for(var n=0;n<o.length;n++)if(un(o[n],`
|
|
3
3
|
`)>=0)return false;return true}function br(o,n){var S;if(o.indent===" ")S=" ";else if(typeof o.indent=="number"&&o.indent>0)S=ye.call(Array(o.indent+1)," ");else return null;return {base:S,prev:ye.call(Array(n+1),S)}}function mt(o,n){if(o.length===0)return "";var S=`
|
|
4
4
|
`+n.prev+n.base;return S+ye.call(o,","+S)+`
|
|
5
5
|
`+n.prev}function Ke(o,n){var S=gt(o),c=[];if(S){c.length=o.length;for(var e=0;e<o.length;e++)c[e]=_e(o,e)?n(o[e],o):"";}var t=typeof ut=="function"?ut(o):[],f;if(ke){f={};for(var l=0;l<t.length;l++)f["$"+t[l]]=t[l];}for(var v in o)_e(o,v)&&(S&&String(Number(v))===v&&v<o.length||ke&&f["$"+v]instanceof Symbol||(on.call(/[^\w$]/,v)?c.push(n(v,o)+": "+n(o[v],o)):c.push(v+": "+n(o[v],o))));if(typeof ut=="function")for(var E=0;E<t.length;E++)sn.call(o,t[E])&&c.push("["+n(t[E])+"]: "+n(o[t[E]],o));return c}});function Vn(o,n){return n.forEach((function(S){S&&typeof S!="string"&&!Array.isArray(S)&&Object.keys(S).forEach((function(c){if(c!=="default"&&!(c in o)){var e=Object.getOwnPropertyDescriptor(S,c);Object.defineProperty(o,c,e.get?e:{enumerable:true,get:function(){return S[c]}});}}));})),Object.freeze(o)}function kt(o,n){return new Promise((function(S,c){let e;return Wn(o).then((function(t){try{return e=t,S(new Blob([n.slice(0,2),e,n.slice(2)],{type:"image/jpeg"}))}catch(f){return c(f)}}),c)}))}var Wn=o=>new Promise(((n,S)=>{let c=new globalThis.FileReader;c.addEventListener("load",(({target:{result:e}})=>{let t=new DataView(e),f=0;if(t.getUint16(f)!==65496)return S("not a valid JPEG");for(f+=2;;){let l=t.getUint16(f);if(l===65498)break;let v=t.getUint16(f+2);if(l===65505&&t.getUint32(f+4)===1165519206){let E=f+10,i;switch(t.getUint16(E)){case 18761:i=true;break;case 19789:i=false;break;default:return S("TIFF header contains invalid endian")}if(t.getUint16(E+2,i)!==42)return S("TIFF header contains invalid version");let a=t.getUint32(E+4,i),s=E+a+2+12*t.getUint16(E+a,i);for(let d=E+a+2;d<s;d+=12)if(t.getUint16(d,i)==274){if(t.getUint16(d+2,i)!==3)return S("Orientation data type is invalid");if(t.getUint32(d+4,i)!==1)return S("Orientation data count is invalid");t.setUint16(d+8,1,i);break}return n(e.slice(f,f+2+v))}f+=2+v;}return n(new Blob)})),c.readAsArrayBuffer(o);})),$e={},$n={get exports(){return $e},set exports(o){$e=o;}};(function(o){var n,S,c={};$n.exports=c,c.parse=function(e,t){for(var f=c.bin.readUshort,l=c.bin.readUint,v=0,E={},i=new Uint8Array(e),a=i.length-4;l(i,a)!=101010256;)a--;v=a,v+=4;var s=f(i,v+=4);f(i,v+=2);var d=l(i,v+=2),_=l(i,v+=4);v+=4,v=_;for(var I=0;I<s;I++){l(i,v),v+=4,v+=4,v+=4,l(i,v+=4),d=l(i,v+=4);var O=l(i,v+=4),C=f(i,v+=4),N=f(i,v+2),F=f(i,v+4);v+=6;var k=l(i,v+=8);v+=4,v+=C+N+F,c._readLocal(i,k,E,d,O,t);}return E},c._readLocal=function(e,t,f,l,v,E){var i=c.bin.readUshort,a=c.bin.readUint;a(e,t),i(e,t+=4),i(e,t+=2);var s=i(e,t+=2);a(e,t+=2),a(e,t+=4),t+=4;var d=i(e,t+=8),_=i(e,t+=2);t+=2;var I=c.bin.readUTF8(e,t,d);if(t+=d,t+=_,E)f[I]={size:v,csize:l};else {var O=new Uint8Array(e.buffer,t);if(s==0)f[I]=new Uint8Array(O.buffer.slice(t,t+l));else {if(s!=8)throw "unknown compression method: "+s;var C=new Uint8Array(v);c.inflateRaw(O,C),f[I]=C;}}},c.inflateRaw=function(e,t){return c.F.inflate(e,t)},c.inflate=function(e,t){return e[0],e[1],c.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},c.deflate=function(e,t){t==null&&(t={level:6});var f=0,l=new Uint8Array(50+Math.floor(1.1*e.length));l[f]=120,l[f+1]=156,f+=2,f=c.F.deflateRaw(e,l,f,t.level);var v=c.adler(e,0,e.length);return l[f+0]=v>>>24&255,l[f+1]=v>>>16&255,l[f+2]=v>>>8&255,l[f+3]=v>>>0&255,new Uint8Array(l.buffer,0,f+4)},c.deflateRaw=function(e,t){t==null&&(t={level:6});var f=new Uint8Array(50+Math.floor(1.1*e.length)),l=c.F.deflateRaw(e,f,l,t.level);return new Uint8Array(f.buffer,0,l)},c.encode=function(e,t){t==null&&(t=false);var f=0,l=c.bin.writeUint,v=c.bin.writeUshort,E={};for(var i in e){var a=!c._noNeed(i)&&!t,s=e[i],d=c.crc.crc(s,0,s.length);E[i]={cpr:a,usize:s.length,crc:d,file:a?c.deflateRaw(s):s};}for(var i in E)f+=E[i].file.length+30+46+2*c.bin.sizeUTF8(i);f+=22;var _=new Uint8Array(f),I=0,O=[];for(var i in E){var C=E[i];O.push(I),I=c._writeHeader(_,I,i,C,0);}var N=0,F=I;for(var i in E)C=E[i],O.push(I),I=c._writeHeader(_,I,i,C,1,O[N++]);var k=I-F;return l(_,I,101010256),I+=4,v(_,I+=4,N),v(_,I+=2,N),l(_,I+=2,k),l(_,I+=4,F),I+=4,I+=2,_.buffer},c._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return "png,jpg,jpeg,zip".indexOf(t)!=-1},c._writeHeader=function(e,t,f,l,v,E){var i=c.bin.writeUint,a=c.bin.writeUshort,s=l.file;return i(e,t,v==0?67324752:33639248),t+=4,v==1&&(t+=2),a(e,t,20),a(e,t+=2,0),a(e,t+=2,l.cpr?8:0),i(e,t+=2,0),i(e,t+=4,l.crc),i(e,t+=4,s.length),i(e,t+=4,l.usize),a(e,t+=4,c.bin.sizeUTF8(f)),a(e,t+=2,0),t+=2,v==1&&(t+=2,t+=2,i(e,t+=6,E),t+=4),t+=c.bin.writeUTF8(e,t,f),v==0&&(e.set(s,t),t+=s.length),t},c.crc={table:(function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var f=t,l=0;l<8;l++)1&f?f=3988292384^f>>>1:f>>>=1;e[t]=f;}return e})(),update:function(e,t,f,l){for(var v=0;v<l;v++)e=c.crc.table[255&(e^t[f+v])]^e>>>8;return e},crc:function(e,t,f){return 4294967295^c.crc.update(4294967295,e,t,f)}},c.adler=function(e,t,f){for(var l=1,v=0,E=t,i=t+f;E<i;){for(var a=Math.min(E+5552,i);E<a;)v+=l+=e[E++];l%=65521,v%=65521;}return v<<16|l},c.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,f){e[t]=255&f,e[t+1]=f>>8&255;},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,f){e[t]=255&f,e[t+1]=f>>8&255,e[t+2]=f>>16&255,e[t+3]=f>>24&255;},readASCII:function(e,t,f){for(var l="",v=0;v<f;v++)l+=String.fromCharCode(e[t+v]);return l},writeASCII:function(e,t,f){for(var l=0;l<f.length;l++)e[t+l]=f.charCodeAt(l);},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,f){for(var l,v="",E=0;E<f;E++)v+="%"+c.bin.pad(e[t+E].toString(16));try{l=decodeURIComponent(v);}catch{return c.bin.readASCII(e,t,f)}return l},writeUTF8:function(e,t,f){for(var l=f.length,v=0,E=0;E<l;E++){var i=f.charCodeAt(E);if((4294967168&i)==0)e[t+v]=i,v++;else if((4294965248&i)==0)e[t+v]=192|i>>6,e[t+v+1]=128|i>>0&63,v+=2;else if((4294901760&i)==0)e[t+v]=224|i>>12,e[t+v+1]=128|i>>6&63,e[t+v+2]=128|i>>0&63,v+=3;else {if((4292870144&i)!=0)throw "e";e[t+v]=240|i>>18,e[t+v+1]=128|i>>12&63,e[t+v+2]=128|i>>6&63,e[t+v+3]=128|i>>0&63,v+=4;}}return v},sizeUTF8:function(e){for(var t=e.length,f=0,l=0;l<t;l++){var v=e.charCodeAt(l);if((4294967168&v)==0)f++;else if((4294965248&v)==0)f+=2;else if((4294901760&v)==0)f+=3;else {if((4292870144&v)!=0)throw "e";f+=4;}}return f}},c.F={},c.F.deflateRaw=function(e,t,f,l){var v=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][l],E=c.F.U,i=c.F._goodIndex;c.F._hash;var a=c.F._putsE,s=0,d=f<<3,_=0,I=e.length;if(l==0){for(;s<I;)a(t,d,s+(r=Math.min(65535,I-s))==I?1:0),d=c.F._copyExact(e,s,r,t,d+8),s+=r;return d>>>3}var O=E.lits,C=E.strt,N=E.prev,F=0,k=0,R=0,g=0,M=0,p=0;for(I>2&&(C[p=c.F._hash(e,0)]=0),s=0;s<I;s++){if(M=p,s+1<I-2){p=c.F._hash(e,s+1);var u=s+1&32767;N[u]=C[p],C[p]=u;}if(_<=s){(F>14e3||k>26697)&&I-s>100&&(_<s&&(O[F]=s-_,F+=2,_=s),d=c.F._writeBlock(s==I-1||_==I?1:0,O,F,g,e,R,s-R,t,d),F=k=g=0,R=s);var b=0;s<I-2&&(b=c.F._bestMatch(e,s,N,M,Math.min(v[2],I-s),v[3]));var r=b>>>16,m=65535&b;if(b!=0){m=65535&b;var A=i(r=b>>>16,E.of0);E.lhst[257+A]++;var y=i(m,E.df0);E.dhst[y]++,g+=E.exb[A]+E.dxb[y],O[F]=r<<23|s-_,O[F+1]=m<<16|A<<8|y,F+=2,_=s+r;}else E.lhst[e[s]]++;k++;}}for(R==s&&e.length!=0||(_<s&&(O[F]=s-_,F+=2,_=s),d=c.F._writeBlock(1,O,F,g,e,R,s-R,t,d),F=0,k=0,F=k=g=0,R=s);(7&d)!=0;)d++;return d>>>3},c.F._bestMatch=function(e,t,f,l,v,E){var i=32767&t,a=f[i],s=i-a+32768&32767;if(a==i||l!=c.F._hash(e,t-s))return 0;for(var d=0,_=0,I=Math.min(32767,t);s<=I&&--E!=0&&a!=i;){if(d==0||e[t+d]==e[t+d-s]){var O=c.F._howLong(e,t,s);if(O>d){if(_=s,(d=O)>=v)break;s+2<O&&(O=s+2);for(var C=0,N=0;N<O-2;N++){var F=t-s+N+32768&32767,k=F-f[F]+32768&32767;k>C&&(C=k,a=F);}}}s+=(i=a)-(a=f[i])+32768&32767;}return d<<16|_},c.F._howLong=function(e,t,f){if(e[t]!=e[t-f]||e[t+1]!=e[t+1-f]||e[t+2]!=e[t+2-f])return 0;var l=t,v=Math.min(e.length,t+258);for(t+=3;t<v&&e[t]==e[t-f];)t++;return t-l},c.F._hash=function(e,t){return (e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},c.saved=0,c.F._writeBlock=function(e,t,f,l,v,E,i,a,s){var d,_,I,O,C,N,F,k,R,g=c.F.U,M=c.F._putsF,p=c.F._putsE;g.lhst[256]++,_=(d=c.F.getTrees())[0],I=d[1],O=d[2],C=d[3],N=d[4],F=d[5],k=d[6],R=d[7];var u=32+((s+3&7)==0?0:8-(s+3&7))+(i<<3),b=l+c.F.contSize(g.fltree,g.lhst)+c.F.contSize(g.fdtree,g.dhst),r=l+c.F.contSize(g.ltree,g.lhst)+c.F.contSize(g.dtree,g.dhst);r+=14+3*F+c.F.contSize(g.itree,g.ihst)+(2*g.ihst[16]+3*g.ihst[17]+7*g.ihst[18]);for(var m=0;m<286;m++)g.lhst[m]=0;for(m=0;m<30;m++)g.dhst[m]=0;for(m=0;m<19;m++)g.ihst[m]=0;var A=u<b&&u<r?0:b<r?1:2;if(M(a,s,e),M(a,s+1,A),s+=3,A==0){for(;(7&s)!=0;)s++;s=c.F._copyExact(v,E,i,a,s);}else {var y,T;if(A==1&&(y=g.fltree,T=g.fdtree),A==2){c.F.makeCodes(g.ltree,_),c.F.revCodes(g.ltree,_),c.F.makeCodes(g.dtree,I),c.F.revCodes(g.dtree,I),c.F.makeCodes(g.itree,O),c.F.revCodes(g.itree,O),y=g.ltree,T=g.dtree,p(a,s,C-257),p(a,s+=5,N-1),p(a,s+=5,F-4),s+=4;for(var w=0;w<F;w++)p(a,s+3*w,g.itree[1+(g.ordr[w]<<1)]);s+=3*F,s=c.F._codeTiny(k,g.itree,a,s),s=c.F._codeTiny(R,g.itree,a,s);}for(var h=E,U=0;U<f;U+=2){for(var P=t[U],x=P>>>23,H=h+(8388607&P);h<H;)s=c.F._writeLit(v[h++],y,a,s);if(x!=0){var L=t[U+1],V=L>>16,B=L>>8&255,D=255&L;p(a,s=c.F._writeLit(257+B,y,a,s),x-g.of0[B]),s+=g.exb[B],M(a,s=c.F._writeLit(D,T,a,s),V-g.df0[D]),s+=g.dxb[D],h+=x;}}s=c.F._writeLit(256,y,a,s);}return s},c.F._copyExact=function(e,t,f,l,v){var E=v>>>3;return l[E]=f,l[E+1]=f>>>8,l[E+2]=255-l[E],l[E+3]=255-l[E+1],E+=4,l.set(new Uint8Array(e.buffer,t,f),E),v+(f+4<<3)},c.F.getTrees=function(){for(var e=c.F.U,t=c.F._hufTree(e.lhst,e.ltree,15),f=c.F._hufTree(e.dhst,e.dtree,15),l=[],v=c.F._lenCodes(e.ltree,l),E=[],i=c.F._lenCodes(e.dtree,E),a=0;a<l.length;a+=2)e.ihst[l[a]]++;for(a=0;a<E.length;a+=2)e.ihst[E[a]]++;for(var s=c.F._hufTree(e.ihst,e.itree,7),d=19;d>4&&e.itree[1+(e.ordr[d-1]<<1)]==0;)d--;return [t,f,s,v,i,d,l,E]},c.F.getSecond=function(e){for(var t=[],f=0;f<e.length;f+=2)t.push(e[f+1]);return t},c.F.nonZero=function(e){for(var t="",f=0;f<e.length;f+=2)e[f+1]!=0&&(t+=(f>>1)+",");return t},c.F.contSize=function(e,t){for(var f=0,l=0;l<t.length;l++)f+=t[l]*e[1+(l<<1)];return f},c.F._codeTiny=function(e,t,f,l){for(var v=0;v<e.length;v+=2){var E=e[v],i=e[v+1];l=c.F._writeLit(E,t,f,l);var a=E==16?2:E==17?3:7;E>15&&(c.F._putsE(f,l,i,a),l+=a);}return l},c.F._lenCodes=function(e,t){for(var f=e.length;f!=2&&e[f-1]==0;)f-=2;for(var l=0;l<f;l+=2){var v=e[l+1],E=l+3<f?e[l+3]:-1,i=l+5<f?e[l+5]:-1,a=l==0?-1:e[l-1];if(v==0&&E==v&&i==v){for(var s=l+5;s+2<f&&e[s+2]==v;)s+=2;(d=Math.min(s+1-l>>>1,138))<11?t.push(17,d-3):t.push(18,d-11),l+=2*d-2;}else if(v==a&&E==v&&i==v){for(s=l+5;s+2<f&&e[s+2]==v;)s+=2;var d=Math.min(s+1-l>>>1,6);t.push(16,d-3),l+=2*d-2;}else t.push(v,0);}return f>>>1},c.F._hufTree=function(e,t,f){var l=[],v=e.length,E=t.length,i=0;for(i=0;i<E;i+=2)t[i]=0,t[i+1]=0;for(i=0;i<v;i++)e[i]!=0&&l.push({lit:i,f:e[i]});var a=l.length,s=l.slice(0);if(a==0)return 0;if(a==1){var d=l[0].lit;return s=d==0?1:0,t[1+(d<<1)]=1,t[1+(s<<1)]=1,1}l.sort((function(k,R){return k.f-R.f}));var _=l[0],I=l[1],O=0,C=1,N=2;for(l[0]={lit:-1,f:_.f+I.f,l:_,r:I,d:0};C!=a-1;)_=O!=C&&(N==a||l[O].f<l[N].f)?l[O++]:l[N++],I=O!=C&&(N==a||l[O].f<l[N].f)?l[O++]:l[N++],l[C++]={lit:-1,f:_.f+I.f,l:_,r:I};var F=c.F.setDepth(l[C-1],0);for(F>f&&(c.F.restrictDepth(s,f,F),F=f),i=0;i<a;i++)t[1+(s[i].lit<<1)]=s[i].d;return F},c.F.setDepth=function(e,t){return e.lit!=-1?(e.d=t,t):Math.max(c.F.setDepth(e.l,t+1),c.F.setDepth(e.r,t+1))},c.F.restrictDepth=function(e,t,f){var l=0,v=1<<f-t,E=0;for(e.sort((function(a,s){return s.d==a.d?a.f-s.f:s.d-a.d})),l=0;l<e.length&&e[l].d>t;l++){var i=e[l].d;e[l].d=t,E+=v-(1<<f-i);}for(E>>>=f-t;E>0;)(i=e[l].d)<t?(e[l].d++,E-=1<<t-i-1):l++;for(;l>=0;l--)e[l].d==t&&E<0&&(e[l].d--,E++);E!=0&&console.log("debt left");},c.F._goodIndex=function(e,t){var f=0;return t[16|f]<=e&&(f|=16),t[8|f]<=e&&(f|=8),t[4|f]<=e&&(f|=4),t[2|f]<=e&&(f|=2),t[1|f]<=e&&(f|=1),f},c.F._writeLit=function(e,t,f,l){return c.F._putsF(f,l,t[e<<1]),l+t[1+(e<<1)]},c.F.inflate=function(e,t){var f=Uint8Array;if(e[0]==3&&e[1]==0)return t||new f(0);var l=c.F,v=l._bitsF,E=l._bitsE,i=l._decodeTiny,a=l.makeCodes,s=l.codes2map,d=l._get17,_=l.U,I=t==null;I&&(t=new f(e.length>>>2<<3));for(var O,C,N=0,F=0,k=0,R=0,g=0,M=0,p=0,u=0,b=0;N==0;)if(N=v(e,b,1),F=v(e,b+1,2),b+=3,F!=0){if(I&&(t=c.F._check(t,u+(1<<17))),F==1&&(O=_.flmap,C=_.fdmap,M=511,p=31),F==2){k=E(e,b,5)+257,R=E(e,b+5,5)+1,g=E(e,b+10,4)+4,b+=14;for(var r=0;r<38;r+=2)_.itree[r]=0,_.itree[r+1]=0;var m=1;for(r=0;r<g;r++){var A=E(e,b+3*r,3);_.itree[1+(_.ordr[r]<<1)]=A,A>m&&(m=A);}b+=3*g,a(_.itree,m),s(_.itree,m,_.imap),O=_.lmap,C=_.dmap,b=i(_.imap,(1<<m)-1,k+R,e,b,_.ttree);var y=l._copyOut(_.ttree,0,k,_.ltree);M=(1<<y)-1;var T=l._copyOut(_.ttree,k,R,_.dtree);p=(1<<T)-1,a(_.ltree,y),s(_.ltree,y,O),a(_.dtree,T),s(_.dtree,T,C);}for(;;){var w=O[d(e,b)&M];b+=15&w;var h=w>>>4;if(!(h>>>8))t[u++]=h;else {if(h==256)break;var U=u+h-254;if(h>264){var P=_.ldef[h-257];U=u+(P>>>3)+E(e,b,7&P),b+=7&P;}var x=C[d(e,b)&p];b+=15&x;var H=x>>>4,L=_.ddef[H],V=(L>>>4)+v(e,b,15&L);for(b+=15&L,I&&(t=c.F._check(t,u+(1<<17)));u<U;)t[u]=t[u++-V],t[u]=t[u++-V],t[u]=t[u++-V],t[u]=t[u++-V];u=U;}}}else {(7&b)!=0&&(b+=8-(7&b));var B=4+(b>>>3),D=e[B-4]|e[B-3]<<8;I&&(t=c.F._check(t,u+D)),t.set(new f(e.buffer,e.byteOffset+B,D),u),b=B+D<<3,u+=D;}return t.length==u?t:t.slice(0,u)},c.F._check=function(e,t){var f=e.length;if(t<=f)return e;var l=new Uint8Array(Math.max(f<<1,t));return l.set(e,0),l},c.F._decodeTiny=function(e,t,f,l,v,E){for(var i=c.F._bitsE,a=c.F._get17,s=0;s<f;){var d=e[a(l,v)&t];v+=15&d;var _=d>>>4;if(_<=15)E[s]=_,s++;else {var I=0,O=0;_==16?(O=3+i(l,v,2),v+=2,I=E[s-1]):_==17?(O=3+i(l,v,3),v+=3):_==18&&(O=11+i(l,v,7),v+=7);for(var C=s+O;s<C;)E[s]=I,s++;}}return v},c.F._copyOut=function(e,t,f,l){for(var v=0,E=0,i=l.length>>>1;E<f;){var a=e[E+t];l[E<<1]=0,l[1+(E<<1)]=a,a>v&&(v=a),E++;}for(;E<i;)l[E<<1]=0,l[1+(E<<1)]=0,E++;return v},c.F.makeCodes=function(e,t){for(var f,l,v,E,i=c.F.U,a=e.length,s=i.bl_count,d=0;d<=t;d++)s[d]=0;for(d=1;d<a;d+=2)s[e[d]]++;var _=i.next_code;for(f=0,s[0]=0,l=1;l<=t;l++)f=f+s[l-1]<<1,_[l]=f;for(v=0;v<a;v+=2)(E=e[v+1])!=0&&(e[v]=_[E],_[E]++);},c.F.codes2map=function(e,t,f){for(var l=e.length,v=c.F.U.rev15,E=0;E<l;E+=2)if(e[E+1]!=0)for(var i=E>>1,a=e[E+1],s=i<<4|a,d=t-a,_=e[E]<<d,I=_+(1<<d);_!=I;)f[v[_]>>>15-t]=s,_++;},c.F.revCodes=function(e,t){for(var f=c.F.U.rev15,l=15-t,v=0;v<e.length;v+=2){var E=e[v]<<t-e[v+1];e[v]=f[E]>>>l;}},c.F._putsE=function(e,t,f){f<<=7&t;var l=t>>>3;e[l]|=f,e[l+1]|=f>>>8;},c.F._putsF=function(e,t,f){f<<=7&t;var l=t>>>3;e[l]|=f,e[l+1]|=f>>>8,e[l+2]|=f>>>16;},c.F._bitsE=function(e,t,f){return (e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<f)-1},c.F._bitsF=function(e,t,f){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<f)-1},c.F._get17=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},c.F._get25=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},c.F.U=(n=Uint16Array,S=Uint32Array,{next_code:new n(16),bl_count:new n(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new n(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new S(32),flmap:new n(512),fltree:[],fdmap:new n(32),fdtree:[],lmap:new n(32768),ltree:[],ttree:[],dmap:new n(32768),dtree:[],imap:new n(512),itree:[],rev15:new n(32768),lhst:new S(286),dhst:new S(30),ihst:new S(19),lits:new S(15e3),strt:new n(65536),prev:new n(32768)}),(function(){for(var e=c.F.U,t=0;t<32768;t++){var f=t;f=(4278255360&(f=(4042322160&(f=(3435973836&(f=(2863311530&f)>>>1|(1431655765&f)<<1))>>>2|(858993459&f)<<2))>>>4|(252645135&f)<<4))>>>8|(16711935&f)<<8,e.rev15[t]=(f>>>16|f<<16)>>>17;}function l(v,E,i){for(;E--!=0;)v.push(0,i);}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];l(e.fltree,144,8),l(e.fltree,112,9),l(e.fltree,24,7),l(e.fltree,8,8),c.F.makeCodes(e.fltree,9),c.F.codes2map(e.fltree,9,e.flmap),c.F.revCodes(e.fltree,9),l(e.fdtree,32,5),c.F.makeCodes(e.fdtree,5),c.F.codes2map(e.fdtree,5,e.fdmap),c.F.revCodes(e.fdtree,5),l(e.itree,19,0),l(e.ltree,286,0),l(e.dtree,30,0),l(e.ttree,320,0);})();})();var Qn=Vn({__proto__:null,default:$e},[$e]),he=(function(){var o={nextZero(i,a){for(;i[a]!=0;)a++;return a},readUshort:(i,a)=>i[a]<<8|i[a+1],writeUshort(i,a,s){i[a]=s>>8&255,i[a+1]=255&s;},readUint:(i,a)=>16777216*i[a]+(i[a+1]<<16|i[a+2]<<8|i[a+3]),writeUint(i,a,s){i[a]=s>>24&255,i[a+1]=s>>16&255,i[a+2]=s>>8&255,i[a+3]=255&s;},readASCII(i,a,s){let d="";for(let _=0;_<s;_++)d+=String.fromCharCode(i[a+_]);return d},writeASCII(i,a,s){for(let d=0;d<s.length;d++)i[a+d]=s.charCodeAt(d);},readBytes(i,a,s){let d=[];for(let _=0;_<s;_++)d.push(i[a+_]);return d},pad:i=>i.length<2?`0${i}`:i,readUTF8(i,a,s){let d,_="";for(let I=0;I<s;I++)_+=`%${o.pad(i[a+I].toString(16))}`;try{d=decodeURIComponent(_);}catch{return o.readASCII(i,a,s)}return d}};function n(i,a,s,d){let _=a*s,I=t(d),O=Math.ceil(a*I/8),C=new Uint8Array(4*_),N=new Uint32Array(C.buffer),{ctype:F}=d,{depth:k}=d,R=o.readUshort;if(F==6){let P=_<<2;if(k==8)for(var g=0;g<P;g+=4)C[g]=i[g],C[g+1]=i[g+1],C[g+2]=i[g+2],C[g+3]=i[g+3];if(k==16)for(g=0;g<P;g++)C[g]=i[g<<1];}else if(F==2){let P=d.tabs.tRNS;if(P==null){if(k==8)for(g=0;g<_;g++){var M=3*g;N[g]=255<<24|i[M+2]<<16|i[M+1]<<8|i[M];}if(k==16)for(g=0;g<_;g++)M=6*g,N[g]=255<<24|i[M+4]<<16|i[M+2]<<8|i[M];}else {var p=P[0];let x=P[1],H=P[2];if(k==8)for(g=0;g<_;g++){var u=g<<2;M=3*g,N[g]=255<<24|i[M+2]<<16|i[M+1]<<8|i[M],i[M]==p&&i[M+1]==x&&i[M+2]==H&&(C[u+3]=0);}if(k==16)for(g=0;g<_;g++)u=g<<2,M=6*g,N[g]=255<<24|i[M+4]<<16|i[M+2]<<8|i[M],R(i,M)==p&&R(i,M+2)==x&&R(i,M+4)==H&&(C[u+3]=0);}}else if(F==3){let P=d.tabs.PLTE,x=d.tabs.tRNS,H=x?x.length:0;if(k==1)for(var b=0;b<s;b++){var r=b*O,m=b*a;for(g=0;g<a;g++){u=m+g<<2;var A=3*(y=i[r+(g>>3)]>>7-((7&g)<<0)&1);C[u]=P[A],C[u+1]=P[A+1],C[u+2]=P[A+2],C[u+3]=y<H?x[y]:255;}}if(k==2)for(b=0;b<s;b++)for(r=b*O,m=b*a,g=0;g<a;g++)u=m+g<<2,A=3*(y=i[r+(g>>2)]>>6-((3&g)<<1)&3),C[u]=P[A],C[u+1]=P[A+1],C[u+2]=P[A+2],C[u+3]=y<H?x[y]:255;if(k==4)for(b=0;b<s;b++)for(r=b*O,m=b*a,g=0;g<a;g++)u=m+g<<2,A=3*(y=i[r+(g>>1)]>>4-((1&g)<<2)&15),C[u]=P[A],C[u+1]=P[A+1],C[u+2]=P[A+2],C[u+3]=y<H?x[y]:255;if(k==8)for(g=0;g<_;g++){var y;u=g<<2,A=3*(y=i[g]),C[u]=P[A],C[u+1]=P[A+1],C[u+2]=P[A+2],C[u+3]=y<H?x[y]:255;}}else if(F==4){if(k==8)for(g=0;g<_;g++){u=g<<2;var T=i[w=g<<1];C[u]=T,C[u+1]=T,C[u+2]=T,C[u+3]=i[w+1];}if(k==16)for(g=0;g<_;g++){var w;u=g<<2,T=i[w=g<<2],C[u]=T,C[u+1]=T,C[u+2]=T,C[u+3]=i[w+2];}}else if(F==0)for(p=d.tabs.tRNS?d.tabs.tRNS:-1,b=0;b<s;b++){let P=b*O,x=b*a;if(k==1)for(var h=0;h<a;h++){var U=(T=255*(i[P+(h>>>3)]>>>7-(7&h)&1))==255*p?0:255;N[x+h]=U<<24|T<<16|T<<8|T;}else if(k==2)for(h=0;h<a;h++)U=(T=85*(i[P+(h>>>2)]>>>6-((3&h)<<1)&3))==85*p?0:255,N[x+h]=U<<24|T<<16|T<<8|T;else if(k==4)for(h=0;h<a;h++)U=(T=17*(i[P+(h>>>1)]>>>4-((1&h)<<2)&15))==17*p?0:255,N[x+h]=U<<24|T<<16|T<<8|T;else if(k==8)for(h=0;h<a;h++)U=(T=i[P+h])==p?0:255,N[x+h]=U<<24|T<<16|T<<8|T;else if(k==16)for(h=0;h<a;h++)T=i[P+(h<<1)],U=R(i,P+(h<<1))==p?0:255,N[x+h]=U<<24|T<<16|T<<8|T;}return C}function S(i,a,s,d){let _=t(i),I=Math.ceil(s*_/8),O=new Uint8Array((I+1+i.interlace)*d);return a=i.tabs.CgBI?e(a,O):c(a,O),i.interlace==0?a=f(a,i,0,s,d):i.interlace==1&&(a=(function(N,F){let k=F.width,R=F.height,g=t(F),M=g>>3,p=Math.ceil(k*g/8),u=new Uint8Array(R*p),b=0,r=[0,0,4,0,2,0,1],m=[0,4,0,2,0,1,0],A=[8,8,8,4,4,2,2],y=[8,8,4,4,2,2,1],T=0;for(;T<7;){let h=A[T],U=y[T],P=0,x=0,H=r[T];for(;H<R;)H+=h,x++;let L=m[T];for(;L<k;)L+=U,P++;let V=Math.ceil(P*g/8);f(N,F,b,P,x);let B=0,D=r[T];for(;D<R;){let W=m[T],K=b+B*V<<3;for(;W<k;){var w;if(g==1&&(w=(w=N[K>>3])>>7-(7&K)&1,u[D*p+(W>>3)]|=w<<7-((7&W)<<0)),g==2&&(w=(w=N[K>>3])>>6-(7&K)&3,u[D*p+(W>>2)]|=w<<6-((3&W)<<1)),g==4&&(w=(w=N[K>>3])>>4-(7&K)&15,u[D*p+(W>>1)]|=w<<4-((1&W)<<2)),g>=8){let G=D*p+W*M;for(let Q=0;Q<M;Q++)u[G+Q]=N[(K>>3)+Q];}K+=g,W+=U;}B++,D+=h;}P*x!=0&&(b+=x*(1+V)),T+=1;}return u})(a,i)),a}function c(i,a){return e(new Uint8Array(i.buffer,2,i.length-6),a)}var e=(function(){let i={H:{}};return i.H.N=function(a,s){let d=Uint8Array,_,I,O=0,C=0,N=0,F=0,k=0,R=0,g=0,M=0,p=0;if(a[0]==3&&a[1]==0)return s||new d(0);let u=i.H,b=u.b,r=u.e,m=u.R,A=u.n,y=u.A,T=u.Z,w=u.m,h=s==null;for(h&&(s=new d(a.length>>>2<<5));O==0;)if(O=b(a,p,1),C=b(a,p+1,2),p+=3,C!=0){if(h&&(s=i.H.W(s,M+(1<<17))),C==1&&(_=w.J,I=w.h,R=511,g=31),C==2){N=r(a,p,5)+257,F=r(a,p+5,5)+1,k=r(a,p+10,4)+4,p+=14;let P=1;for(var U=0;U<38;U+=2)w.Q[U]=0,w.Q[U+1]=0;for(U=0;U<k;U++){let L=r(a,p+3*U,3);w.Q[1+(w.X[U]<<1)]=L,L>P&&(P=L);}p+=3*k,A(w.Q,P),y(w.Q,P,w.u),_=w.w,I=w.d,p=m(w.u,(1<<P)-1,N+F,a,p,w.v);let x=u.V(w.v,0,N,w.C);R=(1<<x)-1;let H=u.V(w.v,N,F,w.D);g=(1<<H)-1,A(w.C,x),y(w.C,x,_),A(w.D,H),y(w.D,H,I);}for(;;){let P=_[T(a,p)&R];p+=15&P;let x=P>>>4;if(!(x>>>8))s[M++]=x;else {if(x==256)break;{let H=M+x-254;if(x>264){let W=w.q[x-257];H=M+(W>>>3)+r(a,p,7&W),p+=7&W;}let L=I[T(a,p)&g];p+=15&L;let V=L>>>4,B=w.c[V],D=(B>>>4)+b(a,p,15&B);for(p+=15&B;M<H;)s[M]=s[M++-D],s[M]=s[M++-D],s[M]=s[M++-D],s[M]=s[M++-D];M=H;}}}}else {(7&p)!=0&&(p+=8-(7&p));let P=4+(p>>>3),x=a[P-4]|a[P-3]<<8;h&&(s=i.H.W(s,M+x)),s.set(new d(a.buffer,a.byteOffset+P,x),M),p=P+x<<3,M+=x;}return s.length==M?s:s.slice(0,M)},i.H.W=function(a,s){let d=a.length;if(s<=d)return a;let _=new Uint8Array(d<<1);return _.set(a,0),_},i.H.R=function(a,s,d,_,I,O){let C=i.H.e,N=i.H.Z,F=0;for(;F<d;){let k=a[N(_,I)&s];I+=15&k;let R=k>>>4;if(R<=15)O[F]=R,F++;else {let g=0,M=0;R==16?(M=3+C(_,I,2),I+=2,g=O[F-1]):R==17?(M=3+C(_,I,3),I+=3):R==18&&(M=11+C(_,I,7),I+=7);let p=F+M;for(;F<p;)O[F]=g,F++;}}return I},i.H.V=function(a,s,d,_){let I=0,O=0,C=_.length>>>1;for(;O<d;){let N=a[O+s];_[O<<1]=0,_[1+(O<<1)]=N,N>I&&(I=N),O++;}for(;O<C;)_[O<<1]=0,_[1+(O<<1)]=0,O++;return I},i.H.n=function(a,s){let d=i.H.m,_=a.length,I,O,C,N,F=d.j;for(var k=0;k<=s;k++)F[k]=0;for(k=1;k<_;k+=2)F[a[k]]++;let R=d.K;for(I=0,F[0]=0,O=1;O<=s;O++)I=I+F[O-1]<<1,R[O]=I;for(C=0;C<_;C+=2)N=a[C+1],N!=0&&(a[C]=R[N],R[N]++);},i.H.A=function(a,s,d){let _=a.length,I=i.H.m.r;for(let O=0;O<_;O+=2)if(a[O+1]!=0){let C=O>>1,N=a[O+1],F=C<<4|N,k=s-N,R=a[O]<<k,g=R+(1<<k);for(;R!=g;)d[I[R]>>>15-s]=F,R++;}},i.H.l=function(a,s){let d=i.H.m.r,_=15-s;for(let I=0;I<a.length;I+=2){let O=a[I]<<s-a[I+1];a[I]=d[O]>>>_;}},i.H.M=function(a,s,d){d<<=7&s;let _=s>>>3;a[_]|=d,a[_+1]|=d>>>8;},i.H.I=function(a,s,d){d<<=7&s;let _=s>>>3;a[_]|=d,a[_+1]|=d>>>8,a[_+2]|=d>>>16;},i.H.e=function(a,s,d){return (a[s>>>3]|a[1+(s>>>3)]<<8)>>>(7&s)&(1<<d)-1},i.H.b=function(a,s,d){return (a[s>>>3]|a[1+(s>>>3)]<<8|a[2+(s>>>3)]<<16)>>>(7&s)&(1<<d)-1},i.H.Z=function(a,s){return (a[s>>>3]|a[1+(s>>>3)]<<8|a[2+(s>>>3)]<<16)>>>(7&s)},i.H.i=function(a,s){return (a[s>>>3]|a[1+(s>>>3)]<<8|a[2+(s>>>3)]<<16|a[3+(s>>>3)]<<24)>>>(7&s)},i.H.m=(function(){let a=Uint16Array,s=Uint32Array;return {K:new a(16),j:new a(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new a(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new s(32),J:new a(512),_:[],h:new a(32),$:[],w:new a(32768),C:[],v:[],d:new a(32768),D:[],u:new a(512),Q:[],r:new a(32768),s:new s(286),Y:new s(30),a:new s(19),t:new s(15e3),k:new a(65536),g:new a(32768)}})(),(function(){let a=i.H.m;for(var s=0;s<32768;s++){let _=s;_=(2863311530&_)>>>1|(1431655765&_)<<1,_=(3435973836&_)>>>2|(858993459&_)<<2,_=(4042322160&_)>>>4|(252645135&_)<<4,_=(4278255360&_)>>>8|(16711935&_)<<8,a.r[s]=(_>>>16|_<<16)>>>17;}function d(_,I,O){for(;I--!=0;)_.push(0,O);}for(s=0;s<32;s++)a.q[s]=a.S[s]<<3|a.T[s],a.c[s]=a.p[s]<<4|a.z[s];d(a._,144,8),d(a._,112,9),d(a._,24,7),d(a._,8,8),i.H.n(a._,9),i.H.A(a._,9,a.J),i.H.l(a._,9),d(a.$,32,5),i.H.n(a.$,5),i.H.A(a.$,5,a.h),i.H.l(a.$,5),d(a.Q,19,0),d(a.C,286,0),d(a.D,30,0),d(a.v,320,0);})(),i.H.N})();function t(i){return [1,null,3,1,2,null,4][i.ctype]*i.depth}function f(i,a,s,d,_){let I=t(a),O=Math.ceil(d*I/8),C,N;I=Math.ceil(I/8);let F=i[s],k=0;if(F>1&&(i[s]=[0,0,1][F-2]),F==3)for(k=I;k<O;k++)i[k+1]=i[k+1]+(i[k+1-I]>>>1)&255;for(let R=0;R<_;R++)if(C=s+R*O,N=C+R+1,F=i[N-1],k=0,F==0)for(;k<O;k++)i[C+k]=i[N+k];else if(F==1){for(;k<I;k++)i[C+k]=i[N+k];for(;k<O;k++)i[C+k]=i[N+k]+i[C+k-I];}else if(F==2)for(;k<O;k++)i[C+k]=i[N+k]+i[C+k-O];else if(F==3){for(;k<I;k++)i[C+k]=i[N+k]+(i[C+k-O]>>>1);for(;k<O;k++)i[C+k]=i[N+k]+(i[C+k-O]+i[C+k-I]>>>1);}else {for(;k<I;k++)i[C+k]=i[N+k]+l(0,i[C+k-O],0);for(;k<O;k++)i[C+k]=i[N+k]+l(i[C+k-I],i[C+k-O],i[C+k-I-O]);}return i}function l(i,a,s){let d=i+a-s,_=d-i,I=d-a,O=d-s;return _*_<=I*I&&_*_<=O*O?i:I*I<=O*O?a:s}function v(i,a,s){s.width=o.readUint(i,a),a+=4,s.height=o.readUint(i,a),a+=4,s.depth=i[a],a++,s.ctype=i[a],a++,s.compress=i[a],a++,s.filter=i[a],a++,s.interlace=i[a],a++;}function E(i,a,s,d,_,I,O,C,N){let F=Math.min(a,_),k=Math.min(s,I),R=0,g=0;for(let T=0;T<k;T++)for(let w=0;w<F;w++)if(O>=0&&C>=0?(R=T*a+w<<2,g=(C+T)*_+O+w<<2):(R=(-C+T)*a-O+w<<2,g=T*_+w<<2),N==0)d[g]=i[R],d[g+1]=i[R+1],d[g+2]=i[R+2],d[g+3]=i[R+3];else if(N==1){var M=i[R+3]*.00392156862745098,p=i[R]*M,u=i[R+1]*M,b=i[R+2]*M,r=d[g+3]*(1/255),m=d[g]*r,A=d[g+1]*r,y=d[g+2]*r;let h=1-M,U=M+r*h,P=U==0?0:1/U;d[g+3]=255*U,d[g+0]=(p+m*h)*P,d[g+1]=(u+A*h)*P,d[g+2]=(b+y*h)*P;}else if(N==2)M=i[R+3],p=i[R],u=i[R+1],b=i[R+2],r=d[g+3],m=d[g],A=d[g+1],y=d[g+2],M==r&&p==m&&u==A&&b==y?(d[g]=0,d[g+1]=0,d[g+2]=0,d[g+3]=0):(d[g]=p,d[g+1]=u,d[g+2]=b,d[g+3]=M);else if(N==3){if(M=i[R+3],p=i[R],u=i[R+1],b=i[R+2],r=d[g+3],m=d[g],A=d[g+1],y=d[g+2],M==r&&p==m&&u==A&&b==y)continue;if(M<220&&r>20)return false}return true}return {decode:function(a){let s=new Uint8Array(a),d=8,_=o,I=_.readUshort,O=_.readUint,C={tabs:{},frames:[]},N=new Uint8Array(s.length),F,k=0,R=0,g=[137,80,78,71,13,10,26,10];for(var M=0;M<8;M++)if(s[M]!=g[M])throw "The input is not a PNG file!";for(;d<s.length;){let T=_.readUint(s,d);d+=4;let w=_.readASCII(s,d,4);if(d+=4,w=="IHDR")v(s,d,C);else if(w=="iCCP"){for(var p=d;s[p]!=0;)p++;_.readASCII(s,d,p-d),s[p+1];let h=s.slice(p+2,d+T),U=null;try{U=c(h);}catch{U=e(h);}C.tabs[w]=U;}else if(w=="CgBI")C.tabs[w]=s.slice(d,d+4);else if(w=="IDAT"){for(M=0;M<T;M++)N[k+M]=s[d+M];k+=T;}else if(w=="acTL")C.tabs[w]={num_frames:O(s,d),num_plays:O(s,d+4)},F=new Uint8Array(s.length);else if(w=="fcTL"){R!=0&&((y=C.frames[C.frames.length-1]).data=S(C,F.slice(0,R),y.rect.width,y.rect.height),R=0);let h={x:O(s,d+12),y:O(s,d+16),width:O(s,d+4),height:O(s,d+8)},U=I(s,d+22);U=I(s,d+20)/(U==0?100:U);let P={rect:h,delay:Math.round(1e3*U),dispose:s[d+24],blend:s[d+25]};C.frames.push(P);}else if(w=="fdAT"){for(M=0;M<T-4;M++)F[R+M]=s[d+M+4];R+=T-4;}else if(w=="pHYs")C.tabs[w]=[_.readUint(s,d),_.readUint(s,d+4),s[d+8]];else if(w=="cHRM")for(C.tabs[w]=[],M=0;M<8;M++)C.tabs[w].push(_.readUint(s,d+4*M));else if(w=="tEXt"||w=="zTXt"){C.tabs[w]==null&&(C.tabs[w]={});var u=_.nextZero(s,d),b=_.readASCII(s,d,u-d),r=d+T-u-1;if(w=="tEXt")A=_.readASCII(s,u+1,r);else {var m=c(s.slice(u+2,u+2+r));A=_.readUTF8(m,0,m.length);}C.tabs[w][b]=A;}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),u=0,p=d,u=_.nextZero(s,p),b=_.readASCII(s,p,u-p);let h=s[p=u+1];var A;s[p+1],p+=2,u=_.nextZero(s,p),_.readASCII(s,p,u-p),p=u+1,u=_.nextZero(s,p),_.readUTF8(s,p,u-p),r=T-((p=u+1)-d),h==0?A=_.readUTF8(s,p,r):(m=c(s.slice(p,p+r)),A=_.readUTF8(m,0,m.length)),C.tabs[w][b]=A;}else if(w=="PLTE")C.tabs[w]=_.readBytes(s,d,T);else if(w=="hIST"){let h=C.tabs.PLTE.length/3;for(C.tabs[w]=[],M=0;M<h;M++)C.tabs[w].push(I(s,d+2*M));}else if(w=="tRNS")C.ctype==3?C.tabs[w]=_.readBytes(s,d,T):C.ctype==0?C.tabs[w]=I(s,d):C.ctype==2&&(C.tabs[w]=[I(s,d),I(s,d+2),I(s,d+4)]);else if(w=="gAMA")C.tabs[w]=_.readUint(s,d)/1e5;else if(w=="sRGB")C.tabs[w]=s[d];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[I(s,d)]:C.ctype==2||C.ctype==6?C.tabs[w]=[I(s,d),I(s,d+2),I(s,d+4)]:C.ctype==3&&(C.tabs[w]=s[d]);else if(w=="IEND")break;d+=T,_.readUint(s,d),d+=4;}var y;return R!=0&&((y=C.frames[C.frames.length-1]).data=S(C,F.slice(0,R),y.rect.width,y.rect.height)),C.data=S(C,N,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},toRGBA8:function(a){let s=a.width,d=a.height;if(a.tabs.acTL==null)return [n(a.data,s,d,a).buffer];let _=[];a.frames[0].data==null&&(a.frames[0].data=a.data);let I=s*d*4,O=new Uint8Array(I),C=new Uint8Array(I),N=new Uint8Array(I);for(let k=0;k<a.frames.length;k++){let R=a.frames[k],g=R.rect.x,M=R.rect.y,p=R.rect.width,u=R.rect.height,b=n(R.data,p,u,a);if(k!=0)for(var F=0;F<I;F++)N[F]=O[F];if(R.blend==0?E(b,p,u,O,s,d,g,M,0):R.blend==1&&E(b,p,u,O,s,d,g,M,1),_.push(O.buffer.slice(0)),R.dispose!=0){if(R.dispose==1)E(C,p,u,O,s,d,g,M,0);else if(R.dispose==2)for(F=0;F<I;F++)O[F]=N[F];}}return _},_paeth:l,_copyTile:E,_bin:o}})();(function(){let{_copyTile:o}=he,{_bin:n}=he,S=he._paeth;var c={table:(function(){let p=new Uint32Array(256);for(let u=0;u<256;u++){let b=u;for(let r=0;r<8;r++)1&b?b=3988292384^b>>>1:b>>>=1;p[u]=b;}return p})(),update(p,u,b,r){for(let m=0;m<r;m++)p=c.table[255&(p^u[b+m])]^p>>>8;return p},crc:(p,u,b)=>4294967295^c.update(4294967295,p,u,b)};function e(p,u,b,r){u[b]+=p[0]*r>>4,u[b+1]+=p[1]*r>>4,u[b+2]+=p[2]*r>>4,u[b+3]+=p[3]*r>>4;}function t(p){return Math.max(0,Math.min(255,p))}function f(p,u){let b=p[0]-u[0],r=p[1]-u[1],m=p[2]-u[2],A=p[3]-u[3];return b*b+r*r+m*m+A*A}function l(p,u,b,r,m,A,y){y==null&&(y=1);let T=r.length,w=[];for(var h=0;h<T;h++){let D=r[h];w.push([D>>>0&255,D>>>8&255,D>>>16&255,D>>>24&255]);}for(h=0;h<T;h++){let D=4294967295;for(var U=0,P=0;P<T;P++){var x=f(w[h],w[P]);P!=h&&x<D&&(D=x,U=P);}}let H=new Uint32Array(m.buffer),L=new Int16Array(u*b*4),V=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(h=0;h<V.length;h++)V[h]=255*((V[h]+.5)/16-.5);for(let D=0;D<b;D++)for(let W=0;W<u;W++){var B;h=4*(D*u+W),y!=2?B=[t(p[h]+L[h]),t(p[h+1]+L[h+1]),t(p[h+2]+L[h+2]),t(p[h+3]+L[h+3])]:(x=V[4*(3&D)+(3&W)],B=[t(p[h]+x),t(p[h+1]+x),t(p[h+2]+x),t(p[h+3]+x)]),U=0;let K=16777215;for(P=0;P<T;P++){let q=f(B,w[P]);q<K&&(K=q,U=P);}let G=w[U],Q=[B[0]-G[0],B[1]-G[1],B[2]-G[2],B[3]-G[3]];y==1&&(W!=u-1&&e(Q,L,h+4,7),D!=b-1&&(W!=0&&e(Q,L,h+4*u-4,3),e(Q,L,h+4*u,5),W!=u-1&&e(Q,L,h+4*u+4,1))),A[h>>2]=U,H[h>>2]=r[U];}}function v(p,u,b,r,m){m==null&&(m={});let{crc:A}=c,y=n.writeUint,T=n.writeUshort,w=n.writeASCII,h=8,U=p.frames.length>1,P,x=false,H=33+(U?20:0);if(m.sRGB!=null&&(H+=13),m.pHYs!=null&&(H+=21),m.iCCP!=null&&(P=pako.deflate(m.iCCP),H+=21+P.length+4),p.ctype==3){for(var L=p.plte.length,V=0;V<L;V++)p.plte[V]>>>24!=255&&(x=true);H+=8+3*L+4+(x?8+1*L+4:0);}for(var B=0;B<p.frames.length;B++)U&&(H+=38),H+=(G=p.frames[B]).cimg.length+12,B!=0&&(H+=4);H+=12;let D=new Uint8Array(H),W=[137,80,78,71,13,10,26,10];for(V=0;V<8;V++)D[V]=W[V];if(y(D,h,13),h+=4,w(D,h,"IHDR"),h+=4,y(D,h,u),h+=4,y(D,h,b),h+=4,D[h]=p.depth,h++,D[h]=p.ctype,h++,D[h]=0,h++,D[h]=0,h++,D[h]=0,h++,y(D,h,A(D,h-17,17)),h+=4,m.sRGB!=null&&(y(D,h,1),h+=4,w(D,h,"sRGB"),h+=4,D[h]=m.sRGB,h++,y(D,h,A(D,h-5,5)),h+=4),m.iCCP!=null){let Q=13+P.length;y(D,h,Q),h+=4,w(D,h,"iCCP"),h+=4,w(D,h,"ICC profile"),h+=11,h+=2,D.set(P,h),h+=P.length,y(D,h,A(D,h-(Q+4),Q+4)),h+=4;}if(m.pHYs!=null&&(y(D,h,9),h+=4,w(D,h,"pHYs"),h+=4,y(D,h,m.pHYs[0]),h+=4,y(D,h,m.pHYs[1]),h+=4,D[h]=m.pHYs[2],h++,y(D,h,A(D,h-13,13)),h+=4),U&&(y(D,h,8),h+=4,w(D,h,"acTL"),h+=4,y(D,h,p.frames.length),h+=4,y(D,h,m.loop!=null?m.loop:0),h+=4,y(D,h,A(D,h-12,12)),h+=4),p.ctype==3){for(y(D,h,3*(L=p.plte.length)),h+=4,w(D,h,"PLTE"),h+=4,V=0;V<L;V++){let Q=3*V,q=p.plte[V],z=255&q,$=q>>>8&255,ie=q>>>16&255;D[h+Q+0]=z,D[h+Q+1]=$,D[h+Q+2]=ie;}if(h+=3*L,y(D,h,A(D,h-3*L-4,3*L+4)),h+=4,x){for(y(D,h,L),h+=4,w(D,h,"tRNS"),h+=4,V=0;V<L;V++)D[h+V]=p.plte[V]>>>24&255;h+=L,y(D,h,A(D,h-L-4,L+4)),h+=4;}}let K=0;for(B=0;B<p.frames.length;B++){var G=p.frames[B];U&&(y(D,h,26),h+=4,w(D,h,"fcTL"),h+=4,y(D,h,K++),h+=4,y(D,h,G.rect.width),h+=4,y(D,h,G.rect.height),h+=4,y(D,h,G.rect.x),h+=4,y(D,h,G.rect.y),h+=4,T(D,h,r[B]),h+=2,T(D,h,1e3),h+=2,D[h]=G.dispose,h++,D[h]=G.blend,h++,y(D,h,A(D,h-30,30)),h+=4);let Q=G.cimg;y(D,h,(L=Q.length)+(B==0?0:4)),h+=4;let q=h;w(D,h,B==0?"IDAT":"fdAT"),h+=4,B!=0&&(y(D,h,K++),h+=4),D.set(Q,h),h+=L,y(D,h,A(D,q,h-q)),h+=4;}return y(D,h,0),h+=4,w(D,h,"IEND"),h+=4,y(D,h,A(D,h-4,4)),h+=4,D.buffer}function E(p,u,b){for(let r=0;r<p.frames.length;r++){let m=p.frames[r];m.rect.width;let A=m.rect.height,y=new Uint8Array(A*m.bpl+A);m.cimg=d(m.img,A,m.bpp,m.bpl,y,u,b);}}function i(p,u,b,r,m){let A=m[0],y=m[1],T=m[2],w=m[3],h=m[4],U=m[5],P=6,x=8,H=255;for(var L=0;L<p.length;L++){let te=new Uint8Array(p[L]);for(var V=te.length,B=0;B<V;B+=4)H&=te[B+3];}let D=H!=255,W=(function(J,X,ne,oe,j,ue){let ee=[];for(var Y=0;Y<J.length;Y++){let le=new Uint8Array(J[Y]),pe=new Uint32Array(le.buffer);var ce;let de=0,ve=0,me=X,Ce=ne,et=oe?1:0;if(Y!=0){let kn=ue||oe||Y==1||ee[Y-2].dispose!=0?1:2,tt=0,Rt=1e9;for(let Le=0;Le<kn;Le++){var ge=new Uint8Array(J[Y-1-Le]);let Un=new Uint32Array(J[Y-1-Le]),Ae=X,be=ne,Oe=-1,De=-1;for(let Ie=0;Ie<ne;Ie++)for(let Re=0;Re<X;Re++)pe[ae=Ie*X+Re]!=Un[ae]&&(Re<Ae&&(Ae=Re),Re>Oe&&(Oe=Re),Ie<be&&(be=Ie),Ie>De&&(De=Ie));Oe==-1&&(Ae=be=Oe=De=0),j&&((1&Ae)==1&&Ae--,(1&be)==1&&be--);let Mt=(Oe-Ae+1)*(De-be+1);Mt<Rt&&(Rt=Mt,tt=Le,de=Ae,ve=be,me=Oe-Ae+1,Ce=De-be+1);}ge=new Uint8Array(J[Y-1-tt]),tt==1&&(ee[Y-1].dispose=2),ce=new Uint8Array(me*Ce*4),o(ge,X,ne,ce,me,Ce,-de,-ve,0),et=o(le,X,ne,ce,me,Ce,-de,-ve,3)?1:0,et==1?s(le,X,ne,ce,{x:de,y:ve,width:me,height:Ce}):o(le,X,ne,ce,me,Ce,-de,-ve,0);}else ce=le.slice(0);ee.push({rect:{x:de,y:ve,width:me,height:Ce},img:ce,blend:et,dispose:0});}if(oe)for(Y=0;Y<ee.length;Y++){if((Te=ee[Y]).blend==1)continue;let le=Te.rect,pe=ee[Y-1].rect,de=Math.min(le.x,pe.x),ve=Math.min(le.y,pe.y),me={x:de,y:ve,width:Math.max(le.x+le.width,pe.x+pe.width)-de,height:Math.max(le.y+le.height,pe.y+pe.height)-ve};ee[Y-1].dispose=1,Y-1!=0&&a(J,X,ne,ee,Y-1,me,j),a(J,X,ne,ee,Y,me,j);}let Ve=0;if(J.length!=1)for(var ae=0;ae<ee.length;ae++){var Te;Ve+=(Te=ee[ae]).rect.width*Te.rect.height;}return ee})(p,u,b,A,y,T),K={},G=[],Q=[];if(r!=0){let te=[];for(B=0;B<W.length;B++)te.push(W[B].img.buffer);let J=(function(j){let ue=0;for(var ee=0;ee<j.length;ee++)ue+=j[ee].byteLength;let Y=new Uint8Array(ue),ce=0;for(ee=0;ee<j.length;ee++){let ge=new Uint8Array(j[ee]),Ve=ge.length;for(let ae=0;ae<Ve;ae+=4){let Te=ge[ae],le=ge[ae+1],pe=ge[ae+2],de=ge[ae+3];de==0&&(Te=le=pe=0),Y[ce+ae]=Te,Y[ce+ae+1]=le,Y[ce+ae+2]=pe,Y[ce+ae+3]=de;}ce+=Ve;}return Y.buffer})(te),X=I(J,r);for(B=0;B<X.plte.length;B++)G.push(X.plte[B].est.rgba);let ne=0;for(B=0;B<W.length;B++){let oe=(z=W[B]).img.length;var q=new Uint8Array(X.inds.buffer,ne>>2,oe>>2);Q.push(q);let j=new Uint8Array(X.abuf,ne,oe);U&&l(z.img,z.rect.width,z.rect.height,G,j,q),z.img.set(j),ne+=oe;}}else for(L=0;L<W.length;L++){var z=W[L];let te=new Uint32Array(z.img.buffer);var $=z.rect.width;for(V=te.length,q=new Uint8Array(V),Q.push(q),B=0;B<V;B++){let J=te[B];if(B!=0&&J==te[B-1])q[B]=q[B-1];else if(B>$&&J==te[B-$])q[B]=q[B-$];else {let X=K[J];if(X==null&&(K[J]=X=G.length,G.push(J),G.length>=300))break;q[B]=X;}}}let ie=G.length;for(ie<=256&&h==0&&(x=ie<=2?1:ie<=4?2:ie<=16?4:8,x=Math.max(x,w)),L=0;L<W.length;L++){(z=W[L]).rect.x,z.rect.y,$=z.rect.width;let te=z.rect.height,J=z.img;new Uint32Array(J.buffer);let X=4*$,ne=4;if(ie<=256&&h==0){X=Math.ceil(x*$/8);var se=new Uint8Array(X*te);let oe=Q[L];for(let j=0;j<te;j++){B=j*X;let ue=j*$;if(x==8)for(var Z=0;Z<$;Z++)se[B+Z]=oe[ue+Z];else if(x==4)for(Z=0;Z<$;Z++)se[B+(Z>>1)]|=oe[ue+Z]<<4-4*(1&Z);else if(x==2)for(Z=0;Z<$;Z++)se[B+(Z>>2)]|=oe[ue+Z]<<6-2*(3&Z);else if(x==1)for(Z=0;Z<$;Z++)se[B+(Z>>3)]|=oe[ue+Z]<<7-1*(7&Z);}J=se,P=3,ne=1;}else if(D==0&&W.length==1){se=new Uint8Array($*te*3);let oe=$*te;for(B=0;B<oe;B++){let j=3*B,ue=4*B;se[j]=J[ue],se[j+1]=J[ue+1],se[j+2]=J[ue+2];}J=se,P=2,ne=3,X=3*$;}z.img=J,z.bpl=X,z.bpp=ne;}return {ctype:P,depth:x,plte:G,frames:W}}function a(p,u,b,r,m,A,y){let T=Uint8Array,w=Uint32Array,h=new T(p[m-1]),U=new w(p[m-1]),P=m+1<p.length?new T(p[m+1]):null,x=new T(p[m]),H=new w(x.buffer),L=u,V=b,B=-1,D=-1;for(let K=0;K<A.height;K++)for(let G=0;G<A.width;G++){let Q=A.x+G,q=A.y+K,z=q*u+Q,$=H[z];$==0||r[m-1].dispose==0&&U[z]==$&&(P==null||P[4*z+3]!=0)||(Q<L&&(L=Q),Q>B&&(B=Q),q<V&&(V=q),q>D&&(D=q));}B==-1&&(L=V=B=D=0),y&&((1&L)==1&&L--,(1&V)==1&&V--),A={x:L,y:V,width:B-L+1,height:D-V+1};let W=r[m];W.rect=A,W.blend=1,W.img=new Uint8Array(A.width*A.height*4),r[m-1].dispose==0?(o(h,u,b,W.img,A.width,A.height,-A.x,-A.y,0),s(x,u,b,W.img,A)):o(x,u,b,W.img,A.width,A.height,-A.x,-A.y,0);}function s(p,u,b,r,m){o(p,u,b,r,m.width,m.height,-m.x,-m.y,2);}function d(p,u,b,r,m,A,y){let T=[],w,h=[0,1,2,3,4];A!=-1?h=[A]:(u*r>5e5||b==1)&&(h=[0]),y&&(w={level:0});let U=Qn;for(var P=0;P<h.length;P++){for(let L=0;L<u;L++)_(m,p,L,r,b,h[P]);T.push(U.deflate(m,w));}let x,H=1e9;for(P=0;P<T.length;P++)T[P].length<H&&(x=P,H=T[P].length);return T[x]}function _(p,u,b,r,m,A){let y=b*r,T=y+b;if(p[T]=A,T++,A==0)if(r<500)for(var w=0;w<r;w++)p[T+w]=u[y+w];else p.set(new Uint8Array(u.buffer,y,r),T);else if(A==1){for(w=0;w<m;w++)p[T+w]=u[y+w];for(w=m;w<r;w++)p[T+w]=u[y+w]-u[y+w-m]+256&255;}else if(b==0){for(w=0;w<m;w++)p[T+w]=u[y+w];if(A==2)for(w=m;w<r;w++)p[T+w]=u[y+w];if(A==3)for(w=m;w<r;w++)p[T+w]=u[y+w]-(u[y+w-m]>>1)+256&255;if(A==4)for(w=m;w<r;w++)p[T+w]=u[y+w]-S(u[y+w-m],0,0)+256&255;}else {if(A==2)for(w=0;w<r;w++)p[T+w]=u[y+w]+256-u[y+w-r]&255;if(A==3){for(w=0;w<m;w++)p[T+w]=u[y+w]+256-(u[y+w-r]>>1)&255;for(w=m;w<r;w++)p[T+w]=u[y+w]+256-(u[y+w-r]+u[y+w-m]>>1)&255;}if(A==4){for(w=0;w<m;w++)p[T+w]=u[y+w]+256-S(0,u[y+w-r],0)&255;for(w=m;w<r;w++)p[T+w]=u[y+w]+256-S(u[y+w-m],u[y+w-r],u[y+w-m-r])&255;}}}function I(p,u){let b=new Uint8Array(p),r=b.slice(0),m=new Uint32Array(r.buffer),A=O(r,u),y=A[0],T=A[1],w=b.length,h=new Uint8Array(w>>2),U;if(b.length<2e7)for(var P=0;P<w;P+=4)U=C(y,x=b[P]*(1/255),H=b[P+1]*(1/255),L=b[P+2]*(1/255),V=b[P+3]*(1/255)),h[P>>2]=U.ind,m[P>>2]=U.est.rgba;else for(P=0;P<w;P+=4){var x=b[P]*.00392156862745098,H=b[P+1]*(1/255),L=b[P+2]*(1/255),V=b[P+3]*(1/255);for(U=y;U.left;)U=N(U.est,x,H,L,V)<=0?U.left:U.right;h[P>>2]=U.ind,m[P>>2]=U.est.rgba;}return {abuf:r.buffer,inds:h,plte:T}}function O(p,u,b){b==null&&(b=1e-4);let r=new Uint32Array(p.buffer),m={i0:0,i1:p.length,bst:null,est:null,tdst:0,left:null,right:null};m.bst=R(p,m.i0,m.i1),m.est=g(m.bst);let A=[m];for(;A.length<u;){let T=0,w=0;for(var y=0;y<A.length;y++)A[y].est.L>T&&(T=A[y].est.L,w=y);if(T<b)break;let h=A[w],U=F(p,r,h.i0,h.i1,h.est.e,h.est.eMq255);if(h.i0>=U||h.i1<=U){h.est.L=0;continue}let P={i0:h.i0,i1:U,bst:null,est:null,tdst:0,left:null,right:null};P.bst=R(p,P.i0,P.i1),P.est=g(P.bst);let x={i0:U,i1:h.i1,bst:null,est:null,tdst:0,left:null,right:null};for(x.bst={R:[],m:[],N:h.bst.N-P.bst.N},y=0;y<16;y++)x.bst.R[y]=h.bst.R[y]-P.bst.R[y];for(y=0;y<4;y++)x.bst.m[y]=h.bst.m[y]-P.bst.m[y];x.est=g(x.bst),h.left=P,h.right=x,A[w]=P,A.push(x);}for(A.sort(((T,w)=>w.bst.N-T.bst.N)),y=0;y<A.length;y++)A[y].ind=y;return [m,A]}function C(p,u,b,r,m){if(p.left==null)return p.tdst=(function(P,x,H,L,V){let B=x-P[0],D=H-P[1],W=L-P[2],K=V-P[3];return B*B+D*D+W*W+K*K})(p.est.q,u,b,r,m),p;let A=N(p.est,u,b,r,m),y=p.left,T=p.right;A>0&&(y=p.right,T=p.left);let w=C(y,u,b,r,m);if(w.tdst<=A*A)return w;let h=C(T,u,b,r,m);return h.tdst<w.tdst?h:w}function N(p,u,b,r,m){let{e:A}=p;return A[0]*u+A[1]*b+A[2]*r+A[3]*m-p.eMq}function F(p,u,b,r,m,A){for(r-=4;b<r;){for(;k(p,b,m)<=A;)b+=4;for(;k(p,r,m)>A;)r-=4;if(b>=r)break;let y=u[b>>2];u[b>>2]=u[r>>2],u[r>>2]=y,b+=4,r-=4;}for(;k(p,b,m)>A;)b-=4;return b+4}function k(p,u,b){return p[u]*b[0]+p[u+1]*b[1]+p[u+2]*b[2]+p[u+3]*b[3]}function R(p,u,b){let r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=[0,0,0,0],A=b-u>>2;for(let y=u;y<b;y+=4){let T=p[y]*.00392156862745098,w=p[y+1]*(1/255),h=p[y+2]*(1/255),U=p[y+3]*(1/255);m[0]+=T,m[1]+=w,m[2]+=h,m[3]+=U,r[0]+=T*T,r[1]+=T*w,r[2]+=T*h,r[3]+=T*U,r[5]+=w*w,r[6]+=w*h,r[7]+=w*U,r[10]+=h*h,r[11]+=h*U,r[15]+=U*U;}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m,N:A}}function g(p){let{R:u}=p,{m:b}=p,{N:r}=p,m=b[0],A=b[1],y=b[2],T=b[3],w=r==0?0:1/r,h=[u[0]-m*m*w,u[1]-m*A*w,u[2]-m*y*w,u[3]-m*T*w,u[4]-A*m*w,u[5]-A*A*w,u[6]-A*y*w,u[7]-A*T*w,u[8]-y*m*w,u[9]-y*A*w,u[10]-y*y*w,u[11]-y*T*w,u[12]-T*m*w,u[13]-T*A*w,u[14]-T*y*w,u[15]-T*T*w],U=h,P=M,x=[Math.random(),Math.random(),Math.random(),Math.random()],H=0,L=0;if(r!=0)for(let B=0;B<16&&(x=P.multVec(U,x),L=Math.sqrt(P.dot(x,x)),x=P.sml(1/L,x),!(B!=0&&Math.abs(L-H)<1e-9));B++)H=L;let V=[m*w,A*w,y*w,T*w];return {Cov:h,q:V,e:x,L:H,eMq255:P.dot(P.sml(255,V),x),eMq:P.dot(x,V),rgba:(Math.round(255*V[3])<<24|Math.round(255*V[2])<<16|Math.round(255*V[1])<<8|Math.round(255*V[0])<<0)>>>0}}var M={multVec:(p,u)=>[p[0]*u[0]+p[1]*u[1]+p[2]*u[2]+p[3]*u[3],p[4]*u[0]+p[5]*u[1]+p[6]*u[2]+p[7]*u[3],p[8]*u[0]+p[9]*u[1]+p[10]*u[2]+p[11]*u[3],p[12]*u[0]+p[13]*u[1]+p[14]*u[2]+p[15]*u[3]],dot:(p,u)=>p[0]*u[0]+p[1]*u[1]+p[2]*u[2]+p[3]*u[3],sml:(p,u)=>[p*u[0],p*u[1],p*u[2],p*u[3]]};he.encode=function(u,b,r,m,A,y,T){m==null&&(m=0),T==null&&(T=false);let w=i(u,b,r,m,[false,false,false,0,T,false]);return E(w,-1),v(w,b,r,A,y)},he.encodeLL=function(u,b,r,m,A,y,T,w){let h={ctype:0+(m==1?0:2)+(A==0?0:4),depth:y,frames:[]},U=(m+A)*y,P=U*b;for(let x=0;x<u.length;x++)h.frames.push({rect:{x:0,y:0,width:b,height:r},img:new Uint8Array(u[x]),blend:0,dispose:1,bpp:Math.ceil(U/8),bpl:Math.ceil(P/8)});return E(h,0,true),v(h,b,r,T,w)},he.encode.compress=i,he.encode.dither=l,he.quantize=I,he.quantize.getKDtree=O,he.quantize.getNearest=C;})();var Ut={toArrayBuffer(o,n){let S=o.width,c=o.height,e=S<<2,t=o.getContext("2d").getImageData(0,0,S,c),f=new Uint32Array(t.data.buffer),l=(32*S+31)/32<<2,v=l*c,E=122+v,i=new ArrayBuffer(E),a=new DataView(i),s=1<<20,d,_,I,O,C=s,N=0,F=0,k=0;function R(p){a.setUint16(F,p,true),F+=2;}function g(p){a.setUint32(F,p,true),F+=4;}function M(p){F+=p;}R(19778),g(E),M(4),g(122),g(108),g(S),g(-c>>>0),R(1),R(32),g(3),g(v),g(2835),g(2835),M(8),g(16711680),g(65280),g(255),g(4278190080),g(1466527264),(function p(){for(;N<c&&C>0;){for(O=122+N*l,d=0;d<e;)C--,_=f[k++],I=_>>>24,a.setUint32(O+d,_<<8|I),d+=4;N++;}k<f.length?(C=s,setTimeout(p,Ut._dly)):n(i);})();},toBlob(o,n){this.toArrayBuffer(o,(S=>{n(new Blob([S],{type:"image/bmp"}));}));},_dly:9},fe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},zn={[fe.CHROME]:16384,[fe.FIREFOX]:11180,[fe.DESKTOP_SAFARI]:16384,[fe.IE]:8192,[fe.IOS]:4096,[fe.ETC]:8192},ot=typeof globalThis.window<"u",Lt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Qe=ot&&globalThis.window.cordova&&globalThis.window.cordova.require&&globalThis.window.cordova.require("cordova/modulemapper"),Gn=(ot||Lt)&&(Qe&&Qe.getOriginalSymbol(globalThis.window,"File")||typeof File<"u"&&File),Dt=(ot||Lt)&&(Qe&&Qe.getOriginalSymbol(globalThis.window,"FileReader")||typeof globalThis.FileReader<"u"&&globalThis.FileReader);function it(o,n,S=Date.now()){return new Promise((c=>{let e=o.split(","),t=e[0].match(/:(.*?);/)[1],f=globalThis.atob(e[1]),l=f.length,v=new Uint8Array(l);for(;l--;)v[l]=f.charCodeAt(l);let E=new Blob([v],{type:t});E.name=n,E.lastModified=S,c(E);}))}function Ft(o){return new Promise(((n,S)=>{let c=new Dt;c.onload=()=>n(c.result),c.onerror=e=>S(e),c.readAsDataURL(o);}))}function Nt(o){return new Promise(((n,S)=>{let c=new globalThis.Image;c.onload=()=>n(c),c.onerror=e=>S(e),c.src=o;}))}function Me(){if(Me.cachedResult!==void 0)return Me.cachedResult;let o=fe.ETC,{userAgent:n}=navigator;return /Chrom(e|ium)/i.test(n)?o=fe.CHROME:/iP(ad|od|hone)/i.test(n)&&/WebKit/i.test(n)?o=fe.IOS:/Safari/i.test(n)?o=fe.DESKTOP_SAFARI:/Firefox/i.test(n)?o=fe.FIREFOX:(/MSIE/i.test(n)||globalThis.document.documentMode)&&(o=fe.IE),Me.cachedResult=o,Me.cachedResult}function Bt(o,n){let S=Me(),c=zn[S],e=o,t=n,f=e*t,l=e>t?t/e:e/t;for(;f>c*c;){let v=(c+e)/2,E=(c+t)/2;v<E?(t=E,e=E*l):(t=v*l,e=v),f=e*t;}return {width:e,height:t}}function qe(o,n){let S,c;try{if(S=new OffscreenCanvas(o,n),c=S.getContext("2d"),c===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{S=globalThis.document.createElement("canvas"),c=S.getContext("2d");}return S.width=o,S.height=n,[S,c]}function Ht(o,n){let{width:S,height:c}=Bt(o.width,o.height),[e,t]=qe(S,c);return n&&/jpe?g/.test(n)&&(t.fillStyle="white",t.fillRect(0,0,e.width,e.height)),t.drawImage(o,0,0,e.width,e.height),e}function We(){return We.cachedResult!==void 0||(We.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof globalThis.document<"u"&&"ontouchend"in globalThis.document),We.cachedResult}function ze(o,n={}){return new Promise((function(S,c){let e,t;var f=function(){try{return t=Ht(e,n.fileType||o.type),S([e,t])}catch(v){return c(v)}},l=function(v){try{var E=function(i){try{throw i}catch(a){return c(a)}};try{let i;return Ft(o).then((function(a){try{return i=a,Nt(i).then((function(s){try{return e=s,(function(){try{return f()}catch(d){return c(d)}})()}catch(d){return E(d)}}),E)}catch(s){return E(s)}}),E)}catch(i){E(i);}}catch(i){return c(i)}};try{if(We()||[fe.DESKTOP_SAFARI,fe.MOBILE_SAFARI].includes(Me()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(o).then((function(v){try{return e=v,f()}catch{return l()}}),l)}catch{l();}}))}function Ge(o,n,S,c,e=1){return new Promise((function(t,f){let l;if(n==="image/png"){let a,s,d;return a=o.getContext("2d"),{data:s}=a.getImageData(0,0,o.width,o.height),d=he.encode([s.buffer],o.width,o.height,4096*e),l=new Blob([d],{type:n}),l.name=S,l.lastModified=c,v.call(this)}{let a=function(){return v.call(this)};if(n==="image/bmp")return new Promise((s=>Ut.toBlob(o,s))).then(function(s){try{return l=s,l.name=S,l.lastModified=c,a.call(this)}catch(d){return f(d)}}.bind(this),f);{let s=function(){return a.call(this)};if(typeof OffscreenCanvas=="function"&&o instanceof OffscreenCanvas)return o.convertToBlob({type:n,quality:e}).then(function(d){try{return l=d,l.name=S,l.lastModified=c,s.call(this)}catch(_){return f(_)}}.bind(this),f);{let d;return d=o.toDataURL(n,e),it(d,S,c).then(function(_){try{return l=_,s.call(this)}catch(I){return f(I)}}.bind(this),f)}}}function v(){return t(l)}}))}function we(o){o.width=0,o.height=0;}function xe(){return new Promise((function(o,n){let c,e,t,f;return xe.cachedResult!==void 0?o(xe.cachedResult):(it("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(l){try{return c=l,ze(c).then((function(v){try{return e=v[1],Ge(e,c.type,c.name,c.lastModified).then((function(E){try{return t=E,we(e),ze(t).then((function(i){try{return f=i[0],xe.cachedResult=f.width===1&&f.height===2,o(xe.cachedResult)}catch(a){return n(a)}}),n)}catch(i){return n(i)}}),n)}catch(E){return n(E)}}),n)}catch(v){return n(v)}}),n))}))}function Vt(o){return new Promise(((n,S)=>{let c=new Dt;c.onload=e=>{let t=new DataView(e.target.result);if(t.getUint16(0,false)!=65496)return n(-2);let f=t.byteLength,l=2;for(;l<f;){if(t.getUint16(l+2,false)<=8)return n(-1);let v=t.getUint16(l,false);if(l+=2,v==65505){if(t.getUint32(l+=2,false)!=1165519206)return n(-1);let E=t.getUint16(l+=6,false)==18761;l+=t.getUint32(l+4,E);let i=t.getUint16(l,E);l+=2;for(let a=0;a<i;a++)if(t.getUint16(l+12*a,E)==274)return n(t.getUint16(l+12*a+8,E))}else {if((65280&v)!=65280)break;l+=t.getUint16(l,false);}}return n(-1)},c.onerror=e=>S(e),c.readAsArrayBuffer(o);}))}function Wt(o,n){let{width:S}=o,{height:c}=o,{maxWidthOrHeight:e}=n,t,f=o;return isFinite(e)&&(S>e||c>e)&&([f,t]=qe(S,c),S>c?(f.width=e,f.height=c/S*e):(f.width=S/c*e,f.height=e),t.drawImage(o,0,0,f.width,f.height),we(o)),f}function $t(o,n){let{width:S}=o,{height:c}=o,[e,t]=qe(S,c);switch(n>4&&n<9?(e.width=c,e.height=S):(e.width=S,e.height=c),n){case 2:t.transform(-1,0,0,1,S,0);break;case 3:t.transform(-1,0,0,-1,S,c);break;case 4:t.transform(1,0,0,-1,0,c);break;case 5:t.transform(0,1,1,0,0,0);break;case 6:t.transform(0,1,-1,0,c,0);break;case 7:t.transform(0,-1,-1,0,c,S);break;case 8:t.transform(0,-1,1,0,0,S);}return t.drawImage(o,0,0,S,c),we(o),e}function xt(o,n,S=0){return new Promise((function(c,e){let t,f,l,v,E,i,a,s,d,_,I,O,C,N,F,k,R,g,M,p;function u(r=5){if(n.signal&&n.signal.aborted)throw n.signal.reason;t+=r,n.onProgress(Math.min(t,100));}function b(r){if(n.signal&&n.signal.aborted)throw n.signal.reason;t=Math.min(Math.max(r,t),100),n.onProgress(t);}return t=S,f=n.maxIteration||10,l=1024*n.maxSizeMB*1024,u(),ze(o,n).then(function(r){try{return [,v]=r,u(),E=Wt(v,n),u(),new Promise((function(m,A){var y;if(!(y=n.exifOrientation))return Vt(o).then(function(w){try{return y=w,T.call(this)}catch(h){return A(h)}}.bind(this),A);function T(){return m(y)}return T.call(this)})).then(function(m){try{return i=m,u(),xe().then(function(A){try{return a=A?E:$t(E,i),u(),s=n.initialQuality||1,d=n.fileType||o.type,Ge(a,d,o.name,o.lastModified,s).then(function(y){try{{let U=function(){if(f--&&(F>l||F>C)){let x,H;return x=p?.95*M.width:M.width,H=p?.95*M.height:M.height,[R,g]=qe(x,H),g.drawImage(M,0,0,x,H),s*=d==="image/png"?.85:.95,Ge(R,d,o.name,o.lastModified,s).then((function(L){try{return k=L,we(M),M=R,F=k.size,b(Math.min(99,Math.floor((N-F)/(N-l)*100))),U}catch(V){return e(V)}}),e)}return [1]},P=function(){return we(M),we(R),we(E),we(a),we(v),b(100),c(k)};var w=U,h=P;if(_=y,u(),I=_.size>l,O=_.size>o.size,!I&&!O)return b(100),c(_);var T;return C=o.size,N=_.size,F=N,M=a,p=!n.alwaysKeepResolution&&I,(T=function(x){for(;x;){if(x.then)return void x.then(T,e);try{if(x.pop){if(x.length)return x.pop()?P.call(this):x;x=U;}else x=x.call(this);}catch(H){return e(H)}}}.bind(this))(U)}}catch(U){return e(U)}}.bind(this),e)}catch(y){return e(y)}}.bind(this),e)}catch(A){return e(A)}}.bind(this),e)}catch(m){return e(m)}}.bind(this),e)}))}var qn=`
|
|
@@ -226,13 +226,13 @@ self.addEventListener('message', async (e) => {
|
|
|
226
226
|
max-width: 100%;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
`,globalThis.document.head.appendChild(o);let n=globalThis.document.createElement("div");n.className="__drawer_container __hidden";let S=globalThis.document.createElement("iframe");S.className="__drawer_frame __hidden",S.id="__AUTH_DRAWER",S.setAttribute("allow","fullscreen; camera; microphone; gyroscope; accelerometer; clipboard-write; clipboard-read; autoplay; geolocation; display-capture; picture-in-picture; payment; midi; bluetooth; web-share; screen-wake-lock; xr-spatial-tracking; encrypted-media; idle-detection; hid; serial; window-management"),S.loading="eager",S.referrerPolicy="unsafe-url",S.title="Login";let c=globalThis.document.createElement("div");c.setAttribute("alt","Close"),c.className="__auth_close_button",n.appendChild(S),n.appendChild(c),globalThis.document.body.appendChild(n);let e=globalThis.document.querySelector(".__auth_close_button"),t=new Map;function f(){n.classList.add("__hidden"),S.classList.add("__hidden"),t.forEach(({popup:E,cleanup:i})=>{i();try{E?.close();}catch{}});}let l=globalThis.document.createElement("iframe");l.style.display="none",l.id="__CONNECT_LISTENER",l.src=`${globalThis.window.__ROOT_URL__}/connect-listener`,globalThis.document.body.appendChild(l);let v=new Promise(E=>{globalThis.window.addEventListener("message",i=>{i.data?.type==="connect-listener:ready"&&(console.log("connect listener ready"),E());});});globalThis.window.__REQUEST_CONNECTION__=async E=>{let{connectId:i,provider:a,scope:s,mode:d,appId:_}=E;if(d!=="request_only"){await v;let g=await new Promise(M=>{let p=setTimeout(()=>{globalThis.window.removeEventListener("message",u),M({connections:[]});},3e3),u=b=>{let r=b.data;r?.type!=="connect:check:result"||r?.connectId!==i||(clearTimeout(p),globalThis.window.removeEventListener("message",u),M({connections:r.connections??[]}));};globalThis.window.addEventListener("message",u),l.contentWindow?.postMessage({type:"connect:check",connectId:i,provider:a,scope:s,appId:_},"*");});if(g.connections.length>0)return {status:"connected",connectId:i,connections:g.connections};if(d==="check_only")return {status:"error",connectId:i,error:"no_connections",errorDescription:"No existing connections found."}}let I=new URL("/connect",globalThis.window.__ROOT_URL__);I.searchParams.set("connectId",i),I.searchParams.set("provider",a),s&&I.searchParams.set("scope",s),d&&I.searchParams.set("mode",d),_&&I.searchParams.set("appId",_);let O=Math.min(720,Math.floor(globalThis.window.screen.availWidth*.9)),C=Math.min(800,Math.floor(globalThis.window.screen.availHeight*.9)),N=Math.floor(globalThis.window.screenX+(globalThis.window.outerWidth-O)/2),F=Math.floor(globalThis.window.screenY+(globalThis.window.outerHeight-C)/2),k=`popup=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${O},height=${C},left=${N},top=${F}`,R=d!=="check_only"?globalThis.window.open(I.toString(),`ac1_connect_${i}`,k):null;return new Promise(g=>{let M=()=>{globalThis.window.removeEventListener("message",p),globalThis.window.clearInterval(u),t.delete(i);},p=b=>{let r=b.data||{};if(r.type==="connect:result"&&r.connectId===i){M();try{R?.close();}catch{}r.status==="error"?g({status:"error",connectId:i,error:r.error,errorDescription:r.errorDescription}):g({status:"connected",connectId:i,connections:r.connections??[]});}},u=globalThis.window.setInterval(()=>{R?.closed&&(M(),g({status:"error",connectId:i,error:"popup_closed",errorDescription:"The connect window was closed before finishing."}));},250);t.set(i,{popup:R,cleanup:M}),globalThis.window.addEventListener("message",p);})},globalThis.window.addEventListener("message",E=>{!E.data||typeof E.data!="object"||E.data.type==="closeAuthDrawer"&&f();}),e?.addEventListener("click",f),n.addEventListener("click",E=>{E.target===n&&f();});}var _t=o=>{let{email:n,phoneNumber:S}=o??{},c=n??S,e=new URLSearchParams;o&&"redirectUri"in o&&o.redirectUri?e.set("returnTo",o.redirectUri):e.set("returnTo",globalThis.window.location.pathname+globalThis.window.location.search),c&&e.set("identity",c),e.set("stripped","true");let t=globalThis.window.__APP_ID__;Tr(`${globalThis.window.__ROOT_URL__}/setup/${t}?${e.toString()}`);};function Cr(o={}){let[n,S]=useState({userId:void 0,status:"loading",signIn:_t,providers:[]});return useEffect(()=>{(async()=>{try{let t=await(await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json","x-guest-api-internal":"session",...globalThis.window.__IS_TESTING__?{"x-is-testing":"true"}:{}}})).json()??{};S({userId:t.userId??null,status:"authenticated",signIn:_t,providers:t?.providers??[]});}catch{if(o.required){let t=encodeURIComponent(globalThis.window.location.pathname+globalThis.window.location.search),f=globalThis.window.__APP_ID__;globalThis.window.top?globalThis.window.top.location.href=`${globalThis.window.__ROOT_URL__}/setup/${f}?returnTo=${t}`:globalThis.window.location.href=`${globalThis.window.__ROOT_URL__}/setup/${f}?returnTo=${t}`;}else S({userId:null,status:"unauthenticated",signIn:_t,providers:[]});}})();},[o.required]),n}async function Ir(o){let n=`c_${Math.random().toString(36).slice(2)}_${Date.now()}`;return await globalThis.window.__REQUEST_CONNECTION__({connectId:n,provider:o.provider,scope:o.scope?.join(","),mode:o.mode??"get_or_request",appId:globalThis.window.__APP_ID__})}function gn(o){return `drive-picker:${o}`}function mn(o,n){let{origin:S,localStorage:c}=n,e=n.allowedOrigins??[S];return {postMessage:t=>{o.postMessage(t,S);},subscribe:t=>{let f=l=>{t(l.data,l.origin);};return globalThis.window.addEventListener("message",f),()=>globalThis.window.removeEventListener("message",f)},isOriginAllowed:t=>e.includes("*")||!!t&&e.includes(t),localStorage:c}}function At(){return Math.random().toString(36).substring(2,15)}function wn(o,n,S,c={}){let{timeout:e=3e4}=c,t=n.localStorage??(typeof globalThis.window<"u"&&typeof localStorage<"u"),f=new Map,l=[],v=false,E=null,i=null,a=false,s=null,d,_,I=new Promise((r,m)=>{d=r,_=m;});function O(){v=true,E&&(E(),E=null),i&&(globalThis.window.removeEventListener("storage",i),i=null);for(let[r,{reject:m}]of f)m(new Error("Connection closed")),f.delete(r);for(let r of l)r.reject?.(new Error("Connection closed"));l.length=0;}function C(r){if(t)try{localStorage.setItem(`__comms__:${o}:${"id"in r?r.id:At()}`,JSON.stringify(r));}catch{}}function N(r,m,A){if(v)return;let y={__comms__:o,id:r,type:"response",result:m,error:A};n.postMessage(y),C(y);}async function F(r,m,A){if(!(r in S)){N(A,void 0,`Method '${r}' not defined`);return}try{let y=await S[r](...m);N(A,y);}catch(y){let T=y instanceof Error?y.message:String(y);N(A,void 0,T);}}async function k(r,m){if(!(r in S)){console.warn(`[WindowComms] Signal to unknown method '${r}' ignored`);return}try{await S[r](...m);}catch(A){console.error(`[WindowComms] Error in signal handler '${r}':`,A);}}function R(r,m,A){let y=f.get(r);if(y){if(f.delete(r),t)try{localStorage.removeItem(`__comms__:${o}:${r}`);}catch{}A?y.reject(new Error(A)):y.resolve(m);}}function g(r){switch(r.type){case "call":F(r.method,r.args,r.id);break;case "signal":k(r.method,r.args);break;case "response":R(r.id,r.result,r.error);break;default:console.warn(`[WindowComms] Unknown message type: ${r.type}`);break}}function M(){for(let r of l)b(r.message,r.resolve,r.reject);l.splice(0,l.length);}function p(r,m){if(typeof r=="string")try{r=JSON.parse(r);}catch{return}if(!(typeof r!="object"||r===null)&&!(n.isOriginAllowed&&!n.isOriginAllowed(m))){if("__comms_ping__"in r){r.__comms_ping__===o&&(a=true,u&&(clearTimeout(u),u=null,n.postMessage({__comms_ping__:o})),d(),M());return}!("__comms__"in r)||r.__comms__!==o||"type"in r&&g(r);}}let u=null;e>0&&(u=setTimeout(()=>{!a&&!v&&(s=new Error(`Handshake timed out after ${e}ms`),O(),_(s));},e)),E=n.subscribe(p),t&&(i=r=>{if(!(!r.key||!r.newValue)&&r.key.startsWith(`__comms__:${o}:`))try{let m=JSON.parse(r.newValue);if(!m||typeof m!="object"||m.__comms__!==o)return;localStorage.removeItem(r.key),"type"in m&&g(m);}catch{}},globalThis.window.addEventListener("storage",i)),n.postMessage({__comms_ping__:o});function b(r,m,A){r.type==="call"&&m&&A&&(f.set(r.id,{resolve:m,reject:A}),e>0&&setTimeout(()=>{f.has(r.id)&&(f.delete(r.id),A(new Error(`Call to '${r.method}' timed out after ${e}ms`)));},e)),n.postMessage(r),C(r);}return {call:(r,...m)=>{if(v)return Promise.reject(s??new Error("Connection closed"));let A=At(),y={__comms__:o,id:A,type:"call",method:r,args:m};return new Promise((T,w)=>{a?b(y,h=>T(h),w):l.push({id:A,message:y,resolve:h=>T(h),reject:w});})},signal:(r,...m)=>{if(v)return;let A={__comms__:o,id:At(),type:"signal",method:r,args:m};a?b(A):l.push({id:A.id,message:A});},close:O,ready:I}}var yn=false,Ue=new Map,bt=new Map;function Xe(o,n,S,c){let e=Ue.get(o),t=bt.get(o);Ue.delete(o),bt.delete(o),t?.close(),c&&console.error("Drive Picker error:",c),e?.({action:n,docs:S});}function Rr(){yn||(yn=true,globalThis.window.addEventListener("message",o=>{let n=o.data;if(typeof n=="string")try{n=JSON.parse(n);}catch{return}if(n?.type==="FILE_PICKER_RESULT"){if(!vn())return;let{pickerId:S}=n;Ue.get(S)&&Xe(S,n.action,n.docs,n.error);}}));}function vn(){return typeof globalThis.window.ReactNativeWebView<"u"}function Mr(o,n,S){globalThis.window.ReactNativeWebView.postMessage(JSON.stringify({type:"requestFilePicker",pickerId:o,connectionId:n,builderCalls:S}));}function Pr(o,n,S,c){if(vn()){Rr(),c&&Ue.set(o,c),Mr(o,n,S);return}let e=Math.min(1024,Math.floor(globalThis.window.screen.availWidth*.9)),t=Math.min(680,Math.floor(globalThis.window.screen.availHeight*.9)),f=Math.floor(globalThis.window.screenX+(globalThis.window.outerWidth-e)/2),l=Math.floor(globalThis.window.screenY+(globalThis.window.outerHeight-t)/2),v=`popup=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${e},height=${t},left=${f},top=${l}`,E=new URLSearchParams({pickerId:o,connectionId:n,origin:globalThis.window.location.origin}),i=`${globalThis.window.__ROOT_URL__}/drive-picker?${E.toString()}`,a=globalThis.window.open(i,`drive_picker_${o}`,v);if(!a){console.error("Failed to open picker popup - popup may be blocked"),c?.({action:"cancel"});return}c&&Ue.set(o,c);let s={onResult:O=>{Xe(o,O.action,O.docs,O.error);try{a.close();}catch{}}},d=mn(a,{origin:"*",localStorage:true}),_=wn(gn(o),d,s);bt.set(o,_),_.signal("init",{connectionToken:n,builderCalls:S}),_.ready.catch(O=>{console.error("Picker handshake failed:",O),Xe(o,"cancel",void 0,O.message);});let I=globalThis.window.setInterval(()=>{a.closed&&(globalThis.window.clearInterval(I),Ue.has(o)&&Xe(o,"cancel"));},500);}var _n={DOCS:"DOCS",DOCS_IMAGES:"DOCS_IMAGES",DOCS_IMAGES_AND_VIDEOS:"DOCS_IMAGES_AND_VIDEOS",DOCS_VIDEOS:"DOCS_VIDEOS",DOCUMENTS:"DOCUMENTS",DRAWINGS:"DRAWINGS",FOLDERS:"FOLDERS",FORMS:"FORMS",PDFS:"PDFS",PHOTOS:"PHOTOS",PRESENTATIONS:"PRESENTATIONS",RECENTLY_PICKED:"RECENTLY_PICKED",SPREADSHEETS:"SPREADSHEETS"},Or={MINE_ONLY:"MINE_ONLY",MULTISELECT_ENABLED:"MULTISELECT_ENABLED",NAV_HIDDEN:"NAV_HIDDEN",SIMPLE_UPLOAD_ENABLED:"SIMPLE_UPLOAD_ENABLED",SUPPORT_DRIVES:"SUPPORT_DRIVES"},xr={PICKED:"picked",CANCEL:"cancel"},Ze=class{viewType;viewCalls=[];constructor(n){this.viewType=n??_n.DOCS;}setMimeTypes(n){return this.viewCalls.push(["setMimeTypes",[n]]),this}setIncludeFolders(n){return this.viewCalls.push(["setIncludeFolders",[n]]),this}setSelectFolderEnabled(n){return this.viewCalls.push(["setSelectFolderEnabled",[n]]),this}setParent(n){return this.viewCalls.push(["setParent",[n]]),this}setQuery(n){return this.viewCalls.push(["setQuery",[n]]),this}setFileIds(n){let S=Array.isArray(n)?n.join(","):n;return this.viewCalls.push(["setFileIds",[S]]),this}setOwnedByMe(n){return this.viewCalls.push(["setOwnedByMe",[n]]),this}setStarred(n){return this.viewCalls.push(["setStarred",[n]]),this}_toConfig(){return {type:this.viewType,calls:this.viewCalls.length>0?this.viewCalls:void 0}}},je=class{viewCalls=[];setParent(n){return this.viewCalls.push(["setParent",[n]]),this}_toConfig(){return {type:"DocsUploadView",calls:this.viewCalls.length>0?this.viewCalls:void 0}}},Et=class{constructor(n,S,c){this.connectionToken=n;this.builderCalls=S;this.callback=c;}setVisible(n){if(n){let S=Math.random().toString(36).substring(2,15);Pr(S,this.connectionToken,this.builderCalls,this.callback);}}},St=class{connectionToken;calls=[];pickerCallback;constructor(n){return this.connectionToken=n,new Proxy(this,{get(S,c,e){return c==="setCallback"?t=>(S.pickerCallback=t,e):c==="build"?()=>S._build():c in S&&typeof S[c]!="function"?S[c]:(...t)=>{if(c==="addView"){let f=t[0];f instanceof Ze||f instanceof je?S.calls.push([c,[f._toConfig()]]):S.calls.push([c,t]);}else S.calls.push([c,t]);return e}}})}_build(){return new Et(this.connectionToken,this.calls,this.pickerCallback)}setTitle(n){return this}setLocale(n){return this}enableFeature(n){return this}disableFeature(n){return this}addView(n){return this}hideTitleBar(){return this}setSize(n,S){return this}setMaxItems(n){return this}setSelectableMimeTypes(n){return this}setCallback(n){return this}build(){return this._build()}};function kr(o){return new Ze(o)}function Ur(){return new je}async function bn({channelId:o,initialData:n,broadcastOnly:S,onUpdate:c}){let e=n,t=0,f=globalThis.window.__REALTIME_DOMAIN__;if(S)return {getData(){return e},setData(v){e=v,fetch(`https://${f}/${o}`,{method:"POST",body:Tt.stringify(e)}).catch(console.error),c?.(v);},destroy(){}};let l=new WebSocket(`wss://${f}/${o}`);return new Promise((v,E)=>{function i(_){try{let I=JSON.parse(_.data.toString());I?.id&&I.id>t?(e=Tt.parse(I.payload),c?.(e),t=I.id):console.error("Invalid message:",_.data);}catch{console.error("Error parsing message:",_.data);}}function a(_){d(),E(_);}function s(){v({getData(){return e},setData(_){e=_,c?.(_),l.send(Tt.stringify(_));},destroy:d});}function d(){l.removeEventListener("message",i),l.removeEventListener("error",a),l.removeEventListener("open",s),l.close();}l.addEventListener("message",i),l.addEventListener("error",a),l.addEventListener("open",s);})}function En(o,n){let S=useRef(null),[c,e]=useState(0);return useEffect(()=>((async()=>o&&(S.current=await bn({channelId:o,initialData:n,onUpdate:()=>{e(t=>t+1);}})))(),S.current?.destroy),[o,e]),[S.current?.getData(),S.current?.setData??identity]}function Vr(o){let[n,S]=useState(null),[c]=En(n,void 0),e=o.mutationFn;if(!e)throw new Error("useRealtimeMutation requires a mutationFn option.");let t=useCallback(async l=>{let v=nanoid(32);return S(v),await e({...l,__channelId:v})},[o?.mutationFn]);return {...useMutation({...o,mutationFn:t}),data:c}}function Sn(o){return o?.message?.startsWith("__MISSING AUTH FOR SCOPE")}function In(o){return o[0]}function Qr(o){let S=o?.message?.slice("__MISSING AUTH FOR SCOPE:".length+1).trim()??"",c=JSON.parse(atob(S.split(" ")?.[0])),e=c?.provider,t=c?.scope;return {provider:e,scope:t,isPopup:o?.message?.endsWith("--popup"),accountId:c?.accountId}}var zr=60,Gr=30*1e3,Ct=0,Rn=Date.now(),It=false;function qr(){return rpcClient({transport:async(o,n)=>{let S=Date.now();if(S-Rn>=Gr)Rn=S,Ct=0,It=false;else if(Ct>=zr)throw It||(globalThis.window.dispatchEvent(new Event("rate-limit-exceeded")),It=true),new RpcError("Rate limit exceeded",-32e3,{status:429});Ct++;let c="/api/"+o.method,e=o.params&&In(o.params)?.__channelId;e&&delete In(o.params)?.__channelId;let t=await fetch(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e?{"x-channel-id":e}:{},...globalThis.window.__IS_TESTING__?{"x-is-testing":"true"}:{},"x-boxman-box-id":globalThis.window.__BOX_ID__},body:Tt.stringify(o),signal:n});if(!t.ok){let l=t.statusText,v=-32e3;try{let{message:E,code:i}=await t.json();E&&(l=E),i&&(v=i);}catch{}throw l.trim()===""&&(l=`Request failed with status: ${t.status}`),new RpcError(l,v,{status:t.status})}let f=Tt.deserialize(await t.json());if(Sn(f.error)){let l=encodeURIComponent(globalThis.window.location.pathname+globalThis.window.location.search),v=Qr(f.error),E=[`returnTo=${l}`,v.provider?`&provider=${v.provider}`:"",v.scope?`&scope=${v.scope.join(",")}`:"",v.accountId?`&accountId=${v.accountId}`:""].filter(Boolean).join("&");if(v.isPopup){globalThis.window.__OPEN_AUTH_DRAWER__(`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}&stripped=true`);return}let i=globalThis.window.top??globalThis.window;return i.location.href=`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}`,null}return f}})}function Ro(o){return new Promise(n=>{let S=new globalThis.FileReader;S.onload=()=>{n(S.result);},S.readAsDataURL(o);})}function Kr(){let o={...globalThis.window.console};function n(S,c){let e=(0, On.default)(c,{depth:5,maxStringLength:512,indent:2});fetch("/_logger",{method:"POST",body:`[console.${S.toLowerCase()}] ${e}`}).catch(()=>{});}globalThis.window.console.log=(...S)=>{n("LOG",S),o.log(...S);},globalThis.window.console.error=(...S)=>{n("ERROR",S),o.error(...S);},globalThis.window.console.info=(...S)=>{n("INFO",S),o.info(...S);},globalThis.window.console.warn=(...S)=>{n("WARN",S),o.warn(...S);};}var Mn=false;function Yr(o,n=globalThis.window.parent,S="*"){n?.postMessage({...o,source:"iframe"},{targetOrigin:S});}function Jr(o){let n=o.toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="local.acflare.com"||n.endsWith(".local")||n.endsWith(".local.acflare.com")}function Xr(){let o=new Set;o.add(globalThis.window.location.hostname);for(let n of [globalThis.window.__BASE_URL__,globalThis.window.__ROOT_URL__])if(n)try{o.add(new URL(n).hostname);}catch{}for(let n of o)if(Jr(n))return true;return false}function xn(o){if(o.source!==globalThis.window.parent)return false;if(globalThis.window.__IS_TESTING__)return true;let n=new Set;for(let S of [globalThis.window.__BASE_URL__,globalThis.window.__ROOT_URL__])if(S)try{n.add(new URL(S).origin);}catch{}return n.size===0?Xr()?(Mn||(Mn=true,console.warn("[sdk] No trusted parent origins could be derived from __BASE_URL__/__ROOT_URL__. Falling back to source-only parent validation in local development.")),true):false:n.has(o.origin)}function Zr(){globalThis.window.addEventListener("message",async o=>{if(!xn(o))return;let{origin:n,source:S,data:c}=o,{type:e}=c;if(e==="screenshot"){let t=globalThis.window.getComputedStyle(globalThis.document.body).backgroundColor,f=await Pn.default.toPng(globalThis.document.body,{bgcolor:t,style:{transform:"translateY("+-globalThis.window.scrollY+"px)"},width:globalThis.window.innerWidth,height:globalThis.window.innerHeight,copyDefaultStyles:false}),l=await fetch(f).then(a=>a.blob()),v=await re(l,{maxSizeMB:4,maxWidthOrHeight:1920,useWebWorker:false}),i={type:"screenshot",payload:{screenshot:await re.getDataUrlFromFile(v)}};Yr(i,S,n);}});}function jr(){let o="--guest-top-inset",n="--guest-bottom-inset",S="__guest-inset-style",c="__NATIVE_VIEWPORT_INSET__",e=()=>{if(globalThis.document.getElementById(S))return;let E=globalThis.document.createElement("style");E.id=S,E.textContent=`
|
|
229
|
+
`,globalThis.document.head.appendChild(o);let n=globalThis.document.createElement("div");n.className="__drawer_container __hidden";let S=globalThis.document.createElement("iframe");S.className="__drawer_frame __hidden",S.id="__AUTH_DRAWER",S.setAttribute("allow","fullscreen; camera; microphone; gyroscope; accelerometer; clipboard-write; clipboard-read; autoplay; geolocation; display-capture; picture-in-picture; payment; midi; bluetooth; web-share; screen-wake-lock; xr-spatial-tracking; encrypted-media; idle-detection; hid; serial; window-management"),S.loading="eager",S.referrerPolicy="unsafe-url",S.title="Login";let c=globalThis.document.createElement("div");c.setAttribute("alt","Close"),c.className="__auth_close_button",n.appendChild(S),n.appendChild(c),globalThis.document.body.appendChild(n);let e=globalThis.document.querySelector(".__auth_close_button"),t=new Map;function f(){n.classList.add("__hidden"),S.classList.add("__hidden"),t.forEach(({popup:E,cleanup:i})=>{i();try{E?.close();}catch{}});}let l=globalThis.document.createElement("iframe");l.style.display="none",l.id="__CONNECT_LISTENER",l.src=`${globalThis.window.__ROOT_URL__}/connect-listener`,globalThis.document.body.appendChild(l);let v=new Promise(E=>{globalThis.window.addEventListener("message",i=>{i.data?.type==="connect-listener:ready"&&(console.log("connect listener ready"),E());});});globalThis.window.__REQUEST_CONNECTION__=async E=>{let{connectId:i,provider:a,scope:s,mode:d,appId:_}=E;if(d!=="request_only"){await v;let g=await new Promise(M=>{let p=setTimeout(()=>{globalThis.window.removeEventListener("message",u),M({connections:[]});},3e3),u=b=>{let r=b.data;r?.type!=="connect:check:result"||r?.connectId!==i||(clearTimeout(p),globalThis.window.removeEventListener("message",u),M({connections:r.connections??[]}));};globalThis.window.addEventListener("message",u),l.contentWindow?.postMessage({type:"connect:check",connectId:i,provider:a,scope:s,appId:_},"*");});if(g.connections.length>0)return {status:"connected",connectId:i,connections:g.connections};if(d==="check_only")return {status:"error",connectId:i,error:"no_connections",errorDescription:"No existing connections found."}}let I=new URL("/connect",globalThis.window.__ROOT_URL__);I.searchParams.set("connectId",i),I.searchParams.set("provider",a),s&&I.searchParams.set("scope",s),d&&I.searchParams.set("mode",d),_&&I.searchParams.set("appId",_);let O=Math.min(720,Math.floor(globalThis.window.screen.availWidth*.9)),C=Math.min(800,Math.floor(globalThis.window.screen.availHeight*.9)),N=Math.floor(globalThis.window.screenX+(globalThis.window.outerWidth-O)/2),F=Math.floor(globalThis.window.screenY+(globalThis.window.outerHeight-C)/2),k=`popup=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${O},height=${C},left=${N},top=${F}`,R=d!=="check_only"?globalThis.window.open(I.toString(),`ac1_connect_${i}`,k):null;return new Promise(g=>{let M=()=>{globalThis.window.removeEventListener("message",p),globalThis.window.clearInterval(u),t.delete(i);},p=b=>{let r=b.data||{};if(r.type==="connect:result"&&r.connectId===i){M();try{R?.close();}catch{}r.status==="error"?g({status:"error",connectId:i,error:r.error,errorDescription:r.errorDescription}):g({status:"connected",connectId:i,connections:r.connections??[]});}},u=globalThis.window.setInterval(()=>{R?.closed&&(M(),g({status:"error",connectId:i,error:"popup_closed",errorDescription:"The connect window was closed before finishing."}));},250);t.set(i,{popup:R,cleanup:M}),globalThis.window.addEventListener("message",p);})},globalThis.window.addEventListener("message",E=>{!E.data||typeof E.data!="object"||E.data.type==="closeAuthDrawer"&&f();}),e?.addEventListener("click",f),n.addEventListener("click",E=>{E.target===n&&f();});}var _t=o=>{let{email:n,phoneNumber:S}=o??{},c=n??S,e=new URLSearchParams;o&&"redirectUri"in o&&o.redirectUri?e.set("returnTo",o.redirectUri):e.set("returnTo",globalThis.window.location.pathname+globalThis.window.location.search),c&&e.set("identity",c),e.set("stripped","true");let t=globalThis.window.__APP_ID__;Tr(`${globalThis.window.__ROOT_URL__}/setup/${t}?${e.toString()}`);};function Cr(o={}){let[n,S]=useState({userId:void 0,status:"loading",signIn:_t,providers:[]});return useEffect(()=>{(async()=>{try{let t=await(await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json","x-guest-api-internal":"session",...globalThis.window.__IS_TESTING__?{"x-is-testing":"true"}:{}}})).json()??{};S({userId:t.userId??null,status:"authenticated",signIn:_t,providers:t?.providers??[]});}catch{if(o.required){let t=encodeURIComponent(globalThis.window.location.pathname+globalThis.window.location.search),f=globalThis.window.__APP_ID__;globalThis.window.top?globalThis.window.top.location.href=`${globalThis.window.__ROOT_URL__}/setup/${f}?returnTo=${t}`:globalThis.window.location.href=`${globalThis.window.__ROOT_URL__}/setup/${f}?returnTo=${t}`;}else S({userId:null,status:"unauthenticated",signIn:_t,providers:[]});}})();},[o.required]),n}async function Ir(o){let n=`c_${Math.random().toString(36).slice(2)}_${Date.now()}`;return await globalThis.window.__REQUEST_CONNECTION__({connectId:n,provider:o.provider,scope:o.scope?.join(","),mode:o.mode??"get_or_request",appId:globalThis.window.__APP_ID__})}function gn(o){return `drive-picker:${o}`}function mn(o,n){let{origin:S,localStorage:c}=n,e=n.allowedOrigins??[S];return {postMessage:t=>{o.postMessage(t,S);},subscribe:t=>{let f=l=>{t(l.data,l.origin);};return globalThis.window.addEventListener("message",f),()=>globalThis.window.removeEventListener("message",f)},isOriginAllowed:t=>e.includes("*")||!!t&&e.includes(t),localStorage:c}}function At(){return Math.random().toString(36).substring(2,15)}function wn(o,n,S,c={}){let{timeout:e=3e4}=c,t=n.localStorage??(typeof globalThis.window<"u"&&typeof localStorage<"u"),f=new Map,l=[],v=false,E=null,i=null,a=false,s=null,d,_,I=new Promise((r,m)=>{d=r,_=m;});function O(){v=true,E&&(E(),E=null),i&&(globalThis.window.removeEventListener("storage",i),i=null);for(let[r,{reject:m}]of f)m(new Error("Connection closed")),f.delete(r);for(let r of l)r.reject?.(new Error("Connection closed"));l.length=0;}function C(r){if(t)try{localStorage.setItem(`__comms__:${o}:${"id"in r?r.id:At()}`,JSON.stringify(r));}catch{}}function N(r,m,A){if(v)return;let y={__comms__:o,id:r,type:"response",result:m,error:A};n.postMessage(y),C(y);}async function F(r,m,A){if(!(r in S)){N(A,void 0,`Method '${r}' not defined`);return}try{let y=await S[r](...m);N(A,y);}catch(y){let T=y instanceof Error?y.message:String(y);N(A,void 0,T);}}async function k(r,m){if(!(r in S)){console.warn(`[WindowComms] Signal to unknown method '${r}' ignored`);return}try{await S[r](...m);}catch(A){console.error(`[WindowComms] Error in signal handler '${r}':`,A);}}function R(r,m,A){let y=f.get(r);if(y){if(f.delete(r),t)try{localStorage.removeItem(`__comms__:${o}:${r}`);}catch{}A?y.reject(new Error(A)):y.resolve(m);}}function g(r){switch(r.type){case "call":F(r.method,r.args,r.id);break;case "signal":k(r.method,r.args);break;case "response":R(r.id,r.result,r.error);break;default:console.warn(`[WindowComms] Unknown message type: ${r.type}`);break}}function M(){for(let r of l)b(r.message,r.resolve,r.reject);l.splice(0,l.length);}function p(r,m){if(typeof r=="string")try{r=JSON.parse(r);}catch{return}if(!(typeof r!="object"||r===null)&&!(n.isOriginAllowed&&!n.isOriginAllowed(m))){if("__comms_ping__"in r){r.__comms_ping__===o&&(a=true,u&&(clearTimeout(u),u=null,n.postMessage({__comms_ping__:o})),d(),M());return}!("__comms__"in r)||r.__comms__!==o||"type"in r&&g(r);}}let u=null;e>0&&(u=setTimeout(()=>{!a&&!v&&(s=new Error(`Handshake timed out after ${e}ms`),O(),_(s));},e)),E=n.subscribe(p),t&&(i=r=>{if(!(!r.key||!r.newValue)&&r.key.startsWith(`__comms__:${o}:`))try{let m=JSON.parse(r.newValue);if(!m||typeof m!="object"||m.__comms__!==o)return;localStorage.removeItem(r.key),"type"in m&&g(m);}catch{}},globalThis.window.addEventListener("storage",i)),n.postMessage({__comms_ping__:o});function b(r,m,A){r.type==="call"&&m&&A&&(f.set(r.id,{resolve:m,reject:A}),e>0&&setTimeout(()=>{f.has(r.id)&&(f.delete(r.id),A(new Error(`Call to '${r.method}' timed out after ${e}ms`)));},e)),n.postMessage(r),C(r);}return {call:(r,...m)=>{if(v)return Promise.reject(s??new Error("Connection closed"));let A=At(),y={__comms__:o,id:A,type:"call",method:r,args:m};return new Promise((T,w)=>{a?b(y,h=>T(h),w):l.push({id:A,message:y,resolve:h=>T(h),reject:w});})},signal:(r,...m)=>{if(v)return;let A={__comms__:o,id:At(),type:"signal",method:r,args:m};a?b(A):l.push({id:A.id,message:A});},close:O,ready:I}}var yn=false,Ue=new Map,bt=new Map;function Xe(o,n,S,c){let e=Ue.get(o),t=bt.get(o);Ue.delete(o),bt.delete(o),t?.close(),c&&console.error("Drive Picker error:",c),e?.({action:n,docs:S});}function Rr(){yn||(yn=true,globalThis.window.addEventListener("message",o=>{let n=o.data;if(typeof n=="string")try{n=JSON.parse(n);}catch{return}if(n?.type==="FILE_PICKER_RESULT"){if(!vn())return;let{pickerId:S}=n;Ue.get(S)&&Xe(S,n.action,n.docs,n.error);}}));}function vn(){return typeof globalThis.window.ReactNativeWebView<"u"}function Mr(o,n,S){globalThis.window.ReactNativeWebView.postMessage(JSON.stringify({type:"requestFilePicker",pickerId:o,connectionId:n,builderCalls:S}));}function Pr(o,n,S,c){if(vn()){Rr(),c&&Ue.set(o,c),Mr(o,n,S);return}let e=Math.min(1024,Math.floor(globalThis.window.screen.availWidth*.9)),t=Math.min(680,Math.floor(globalThis.window.screen.availHeight*.9)),f=Math.floor(globalThis.window.screenX+(globalThis.window.outerWidth-e)/2),l=Math.floor(globalThis.window.screenY+(globalThis.window.outerHeight-t)/2),v=`popup=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${e},height=${t},left=${f},top=${l}`,E=new URLSearchParams({pickerId:o,connectionId:n,origin:globalThis.window.location.origin}),i=`${globalThis.window.__ROOT_URL__}/drive-picker?${E.toString()}`,a=globalThis.window.open(i,`drive_picker_${o}`,v);if(!a){console.error("Failed to open picker popup - popup may be blocked"),c?.({action:"cancel"});return}c&&Ue.set(o,c);let s={onResult:O=>{Xe(o,O.action,O.docs,O.error);try{a.close();}catch{}}},d=mn(a,{origin:"*",localStorage:true}),_=wn(gn(o),d,s);bt.set(o,_),_.signal("init",{connectionToken:n,builderCalls:S}),_.ready.catch(O=>{console.error("Picker handshake failed:",O),Xe(o,"cancel",void 0,O.message);});let I=globalThis.window.setInterval(()=>{a.closed&&(globalThis.window.clearInterval(I),Ue.has(o)&&Xe(o,"cancel"));},500);}var _n={DOCS:"DOCS",DOCS_IMAGES:"DOCS_IMAGES",DOCS_IMAGES_AND_VIDEOS:"DOCS_IMAGES_AND_VIDEOS",DOCS_VIDEOS:"DOCS_VIDEOS",DOCUMENTS:"DOCUMENTS",DRAWINGS:"DRAWINGS",FOLDERS:"FOLDERS",FORMS:"FORMS",PDFS:"PDFS",PHOTOS:"PHOTOS",PRESENTATIONS:"PRESENTATIONS",RECENTLY_PICKED:"RECENTLY_PICKED",SPREADSHEETS:"SPREADSHEETS"},Or={MINE_ONLY:"MINE_ONLY",MULTISELECT_ENABLED:"MULTISELECT_ENABLED",NAV_HIDDEN:"NAV_HIDDEN",SIMPLE_UPLOAD_ENABLED:"SIMPLE_UPLOAD_ENABLED",SUPPORT_DRIVES:"SUPPORT_DRIVES"},xr={PICKED:"picked",CANCEL:"cancel"},Ze=class{viewType;viewCalls=[];constructor(n){this.viewType=n??_n.DOCS;}setMimeTypes(n){return this.viewCalls.push(["setMimeTypes",[n]]),this}setIncludeFolders(n){return this.viewCalls.push(["setIncludeFolders",[n]]),this}setSelectFolderEnabled(n){return this.viewCalls.push(["setSelectFolderEnabled",[n]]),this}setParent(n){return this.viewCalls.push(["setParent",[n]]),this}setQuery(n){return this.viewCalls.push(["setQuery",[n]]),this}setFileIds(n){let S=Array.isArray(n)?n.join(","):n;return this.viewCalls.push(["setFileIds",[S]]),this}setOwnedByMe(n){return this.viewCalls.push(["setOwnedByMe",[n]]),this}setStarred(n){return this.viewCalls.push(["setStarred",[n]]),this}_toConfig(){return {type:this.viewType,calls:this.viewCalls.length>0?this.viewCalls:void 0}}},je=class{viewCalls=[];setParent(n){return this.viewCalls.push(["setParent",[n]]),this}_toConfig(){return {type:"DocsUploadView",calls:this.viewCalls.length>0?this.viewCalls:void 0}}},Et=class{constructor(n,S,c){this.connectionToken=n;this.builderCalls=S;this.callback=c;}setVisible(n){if(n){let S=Math.random().toString(36).substring(2,15);Pr(S,this.connectionToken,this.builderCalls,this.callback);}}},St=class{connectionToken;calls=[];pickerCallback;constructor(n){return this.connectionToken=n,new Proxy(this,{get(S,c,e){return c==="setCallback"?t=>(S.pickerCallback=t,e):c==="build"?()=>S._build():c in S&&typeof S[c]!="function"?S[c]:(...t)=>{if(c==="addView"){let f=t[0];f instanceof Ze||f instanceof je?S.calls.push([c,[f._toConfig()]]):S.calls.push([c,t]);}else S.calls.push([c,t]);return e}}})}_build(){return new Et(this.connectionToken,this.calls,this.pickerCallback)}setTitle(n){return this}setLocale(n){return this}enableFeature(n){return this}disableFeature(n){return this}addView(n){return this}hideTitleBar(){return this}setSize(n,S){return this}setMaxItems(n){return this}setSelectableMimeTypes(n){return this}setCallback(n){return this}build(){return this._build()}};function kr(o){return new Ze(o)}function Ur(){return new je}async function bn({channelId:o,initialData:n,broadcastOnly:S,onUpdate:c}){let e=n,t=0,f=globalThis.window.__REALTIME_DOMAIN__;if(S)return {getData(){return e},setData(v){e=v,fetch(`https://${f}/${o}`,{method:"POST",body:Tt.stringify(e)}).catch(console.error),c?.(v);},destroy(){}};let l=new WebSocket(`wss://${f}/${o}`);return new Promise((v,E)=>{function i(_){try{let I=JSON.parse(_.data.toString());I?.id&&I.id>t?(e=Tt.parse(I.payload),c?.(e),t=I.id):console.error("Invalid message:",_.data);}catch{console.error("Error parsing message:",_.data);}}function a(_){d(),E(_);}function s(){v({getData(){return e},setData(_){e=_,c?.(_),l.send(Tt.stringify(_));},destroy:d});}function d(){l.removeEventListener("message",i),l.removeEventListener("error",a),l.removeEventListener("open",s),l.close();}l.addEventListener("message",i),l.addEventListener("error",a),l.addEventListener("open",s);})}function En(o,n){let S=useRef(null),[c,e]=useState(0);return useEffect(()=>((async()=>o&&(S.current=await bn({channelId:o,initialData:n,onUpdate:()=>{e(t=>t+1);}})))(),S.current?.destroy),[o,e]),[S.current?.getData(),S.current?.setData??identity]}function Vr(o){let[n,S]=useState(null),[c]=En(n,void 0),e=o.mutationFn;if(!e)throw new Error("useRealtimeMutation requires a mutationFn option.");let t=useCallback(async l=>{let v=nanoid(32);return S(v),await e({...l,__channelId:v})},[o?.mutationFn]);return {...useMutation({...o,mutationFn:t}),data:c}}function Sn(o){return o?.message?.startsWith("__MISSING AUTH FOR SCOPE")}function In(o){return o[0]}function zr(o){let S=o?.message?.slice("__MISSING AUTH FOR SCOPE:".length+1).trim()??"",c=JSON.parse(atob(S.split(" ")?.[0])),e=c?.provider,t=c?.scope;return {provider:e,scope:t,isPopup:o?.message?.endsWith("--popup"),accountId:c?.accountId}}var Gr=60,qr=30*1e3,Ct=0,Rn=Date.now(),It=false;function Kr(){return rpcClient({transport:async(o,n)=>{let S=Date.now();if(S-Rn>=qr)Rn=S,Ct=0,It=false;else if(Ct>=Gr)throw It||(globalThis.window.dispatchEvent(new Event("rate-limit-exceeded")),It=true),new RpcError("Rate limit exceeded",-32e3,{status:429});Ct++;let c="/api/"+o.method,e=o.params&&In(o.params)?.__channelId;e&&delete In(o.params)?.__channelId;let t=await fetch(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e?{"x-channel-id":e}:{},...globalThis.window.__IS_TESTING__?{"x-is-testing":"true"}:{},"x-boxman-box-id":globalThis.window.__BOX_ID__},body:Tt.stringify(o),signal:n});if(!t.ok){let l=t.statusText,v=-32e3;try{let{message:E,code:i}=await t.json();E&&(l=E),i&&(v=i);}catch{}throw l.trim()===""&&(l=`Request failed with status: ${t.status}`),new RpcError(l,v,{status:t.status})}let f=Tt.deserialize(await t.json());if(Sn(f.error)){let l=encodeURIComponent(globalThis.window.location.pathname+globalThis.window.location.search),v=zr(f.error),E=[`returnTo=${l}`,v.provider?`&provider=${v.provider}`:"",v.scope?`&scope=${v.scope.join(",")}`:"",v.accountId?`&accountId=${v.accountId}`:""].filter(Boolean).join("&");if(v.isPopup){globalThis.window.__OPEN_AUTH_DRAWER__(`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}&stripped=true`);return}let i=globalThis.window.top??globalThis.window;return i.location.href=`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}`,null}return f}})}function Mo(o){return new Promise(n=>{let S=new globalThis.FileReader;S.onload=()=>{n(S.result);},S.readAsDataURL(o);})}function Yr(){let o={...globalThis.window.console};function n(S,c){let e=(0, On.default)(c,{depth:5,maxStringLength:512,indent:2});fetch("/_logger",{method:"POST",body:`[console.${S.toLowerCase()}] ${e}`}).catch(()=>{});}globalThis.window.console.log=(...S)=>{n("LOG",S),o.log(...S);},globalThis.window.console.error=(...S)=>{n("ERROR",S),o.error(...S);},globalThis.window.console.info=(...S)=>{n("INFO",S),o.info(...S);},globalThis.window.console.warn=(...S)=>{n("WARN",S),o.warn(...S);};}var Mn=false;function Jr(o,n=globalThis.window.parent,S="*"){n?.postMessage({...o,source:"iframe"},{targetOrigin:S});}function Xr(o){let n=o.toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="local.acflare.com"||n.endsWith(".local")||n.endsWith(".local.acflare.com")}function Zr(){let o=new Set;o.add(globalThis.window.location.hostname);for(let n of [globalThis.window.__BASE_URL__,globalThis.window.__ROOT_URL__])if(n)try{o.add(new URL(n).hostname);}catch{}for(let n of o)if(Xr(n))return true;return false}function xn(o){if(o.source!==globalThis.window.parent)return false;if(globalThis.window.__IS_TESTING__)return true;let n=new Set;for(let S of [globalThis.window.__BASE_URL__,globalThis.window.__ROOT_URL__])if(S)try{n.add(new URL(S).origin);}catch{}return n.size===0?Zr()?(Mn||(Mn=true,console.warn("[sdk] No trusted parent origins could be derived from __BASE_URL__/__ROOT_URL__. Falling back to source-only parent validation in local development.")),true):false:n.has(o.origin)}function jr(){globalThis.window.addEventListener("message",async o=>{if(!xn(o))return;let{origin:n,source:S,data:c}=o,{type:e}=c;if(e==="screenshot"){let t=globalThis.window.getComputedStyle(globalThis.document.body).backgroundColor,f=await Pn.default.toPng(globalThis.document.body,{bgcolor:t,style:{transform:"translateY("+-globalThis.window.scrollY+"px)"},width:globalThis.window.innerWidth,height:globalThis.window.innerHeight,copyDefaultStyles:false}),l=await fetch(f).then(a=>a.blob()),v=await re(l,{maxSizeMB:4,maxWidthOrHeight:1920,useWebWorker:false}),i={type:"screenshot",payload:{screenshot:await re.getDataUrlFromFile(v)}};Jr(i,S,n);}});}function eo(){let o="--guest-top-inset",n="--guest-bottom-inset",S="__guest-inset-style",c="__NATIVE_VIEWPORT_INSET__",e=()=>{if(globalThis.document.getElementById(S))return;let E=globalThis.document.createElement("style");E.id=S,E.textContent=`
|
|
230
230
|
#root {
|
|
231
231
|
padding-top: var(${o}, 0px);
|
|
232
232
|
padding-bottom: var(${n}, 0px);
|
|
233
233
|
}
|
|
234
|
-
`,globalThis.document.head.appendChild(E);},t=E=>{let i=typeof E=="number"?E:typeof E=="string"?Number.parseFloat(E):Number.NaN;return Number.isFinite(i)?i:null},f=E=>{e();let i=t(E.top)??0;globalThis.document.documentElement.style.setProperty(o,`${Math.max(0,i)}px`);let a=t(E.bottom)??0;globalThis.document.documentElement.style.setProperty(n,`${Math.max(0,a)}px`);},l=E=>{if(!E)return null;if(typeof E=="string")try{let i=JSON.parse(E);return i&&typeof i=="object"?i:null}catch{return null}return typeof E=="object"?E:null};globalThis.window.addEventListener("message",E=>{let i=l(E.data);i?.type!=="viewportInset"||!(typeof globalThis.window.ReactNativeWebView<"u"&&i?.source==="native")&&!xn(E)||f(i?.payload??{});});let v=globalThis.window[c]??null;v&&f(v);}function
|
|
234
|
+
`,globalThis.document.head.appendChild(E);},t=E=>{let i=typeof E=="number"?E:typeof E=="string"?Number.parseFloat(E):Number.NaN;return Number.isFinite(i)?i:null},f=E=>{e();let i=t(E.top)??0;globalThis.document.documentElement.style.setProperty(o,`${Math.max(0,i)}px`);let a=t(E.bottom)??0;globalThis.document.documentElement.style.setProperty(n,`${Math.max(0,a)}px`);},l=E=>{if(!E)return null;if(typeof E=="string")try{let i=JSON.parse(E);return i&&typeof i=="object"?i:null}catch{return null}return typeof E=="object"?E:null};globalThis.window.addEventListener("message",E=>{let i=l(E.data);i?.type!=="viewportInset"||!(typeof globalThis.window.ReactNativeWebView<"u"&&i?.source==="native")&&!xn(E)||f(i?.payload??{});});let v=globalThis.window[c]??null;v&&f(v);}function Po({appId:o,rootUrl:n,baseUrl:S,isTesting:c,realtimeDomain:e,boxId:t}){typeof globalThis.window>"u"||globalThis.window.__APP_ID__||(globalThis.window.__APP_ID__=o,globalThis.window.__ROOT_URL__=n,globalThis.window.__BASE_URL__=S,globalThis.window.__IS_TESTING__=c,globalThis.window.__REALTIME_DOMAIN__=e,globalThis.window.__BOX_ID__=t,jr(),Yr(),hn(),eo(),globalThis.window.onerror=function(f){console.error("Global JS error:",f);},globalThis.window.onunhandledrejection=function(f){console.error("Unhandled promise rejection:",f.reason);});}function Oo(){return globalThis.window.__BASE_URL__}/*! Bundled license information:
|
|
235
235
|
|
|
236
236
|
dom-to-image-more/dist/dom-to-image-more.min.js:
|
|
237
237
|
(*! dom-to-image-more 23-10-2025 *)
|
|
238
|
-
*/export{xr as Action,Ur as DocsUploadView,kr as DocsView,Or as Feature,St as PickerBuilder,_n as ViewId,
|
|
238
|
+
*/export{xr as Action,Ur as DocsUploadView,kr as DocsView,Or as Feature,St as PickerBuilder,_n as ViewId,Kr as apiClient,Ir as connect,bn as connectToRealtimeStore,Mo as encodeFileAsBase64DataURL,Oo as getBaseUrl,Po as initializeClientEnvironment,Cr as useAuth,Vr as useRealtimeMutation,En as useRealtimeStore};
|
package/dist/server/index.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ import { Job, JobStatus } from 'plainjob';
|
|
|
8
8
|
import superjson from 'superjson';
|
|
9
9
|
import { handleRpc } from 'typed-rpc/server';
|
|
10
10
|
|
|
11
|
+
declare const UserTier: {
|
|
12
|
+
readonly FREE: "FREE";
|
|
13
|
+
readonly ONE: "ONE";
|
|
14
|
+
readonly TWO: "TWO";
|
|
15
|
+
};
|
|
16
|
+
export type UserTier = (typeof UserTier)[keyof typeof UserTier];
|
|
11
17
|
declare const ProductKind: {
|
|
12
18
|
readonly SUBSCRIPTION: "SUBSCRIPTION";
|
|
13
19
|
readonly IN_APP_PURCHASE: "IN_APP_PURCHASE";
|
|
@@ -1647,6 +1653,7 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
1647
1653
|
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1648
1654
|
provider: z.ZodNativeEnum<{
|
|
1649
1655
|
readonly AC1: "AC1";
|
|
1656
|
+
readonly PLAID: "PLAID";
|
|
1650
1657
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
1651
1658
|
readonly GITHUB_BOT: "GITHUB_BOT";
|
|
1652
1659
|
readonly GOOGLE: "GOOGLE";
|
|
@@ -1658,26 +1665,35 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
1658
1665
|
readonly LINKEDIN: "LINKEDIN";
|
|
1659
1666
|
readonly YAHOO: "YAHOO";
|
|
1660
1667
|
readonly FIGMA: "FIGMA";
|
|
1661
|
-
readonly PLAID: "PLAID";
|
|
1662
1668
|
readonly SQUARE: "SQUARE";
|
|
1663
1669
|
readonly SHOPIFY: "SHOPIFY";
|
|
1664
1670
|
readonly WHOOP: "WHOOP";
|
|
1665
1671
|
}>;
|
|
1666
1672
|
event: z.ZodString;
|
|
1667
1673
|
handler: z.ZodEffects<z.ZodString, string, string>;
|
|
1674
|
+
slug: z.ZodString;
|
|
1675
|
+
name: z.ZodString;
|
|
1676
|
+
description: z.ZodString;
|
|
1668
1677
|
}, "strip", z.ZodTypeAny, {
|
|
1678
|
+
description: string;
|
|
1669
1679
|
event: string;
|
|
1670
|
-
|
|
1680
|
+
name: string;
|
|
1681
|
+
provider: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1";
|
|
1682
|
+
slug: string;
|
|
1671
1683
|
handler: string;
|
|
1672
1684
|
}, {
|
|
1685
|
+
description: string;
|
|
1673
1686
|
event: string;
|
|
1674
|
-
|
|
1687
|
+
name: string;
|
|
1688
|
+
provider: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1";
|
|
1689
|
+
slug: string;
|
|
1675
1690
|
handler: string;
|
|
1676
1691
|
}>, "many">>;
|
|
1677
1692
|
webhooks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1678
1693
|
handler: z.ZodEffects<z.ZodString, string, string>;
|
|
1679
1694
|
provider: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<{
|
|
1680
1695
|
readonly AC1: "AC1";
|
|
1696
|
+
readonly PLAID: "PLAID";
|
|
1681
1697
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
1682
1698
|
readonly GITHUB_BOT: "GITHUB_BOT";
|
|
1683
1699
|
readonly GOOGLE: "GOOGLE";
|
|
@@ -1689,19 +1705,34 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
1689
1705
|
readonly LINKEDIN: "LINKEDIN";
|
|
1690
1706
|
readonly YAHOO: "YAHOO";
|
|
1691
1707
|
readonly FIGMA: "FIGMA";
|
|
1692
|
-
readonly PLAID: "PLAID";
|
|
1693
1708
|
readonly SQUARE: "SQUARE";
|
|
1694
1709
|
readonly SHOPIFY: "SHOPIFY";
|
|
1695
1710
|
readonly WHOOP: "WHOOP";
|
|
1696
1711
|
}>>>;
|
|
1712
|
+
slug: z.ZodString;
|
|
1713
|
+
name: z.ZodString;
|
|
1714
|
+
description: z.ZodString;
|
|
1697
1715
|
}, "strip", z.ZodTypeAny, {
|
|
1716
|
+
description: string;
|
|
1717
|
+
name: string;
|
|
1718
|
+
slug: string;
|
|
1698
1719
|
handler: string;
|
|
1699
|
-
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "
|
|
1720
|
+
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1" | null | undefined;
|
|
1700
1721
|
}, {
|
|
1722
|
+
description: string;
|
|
1723
|
+
name: string;
|
|
1724
|
+
slug: string;
|
|
1701
1725
|
handler: string;
|
|
1702
|
-
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "
|
|
1726
|
+
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1" | null | undefined;
|
|
1703
1727
|
}>, "many">>;
|
|
1704
1728
|
}, "strip", z.ZodTypeAny, {
|
|
1729
|
+
webhooks: {
|
|
1730
|
+
description: string;
|
|
1731
|
+
name: string;
|
|
1732
|
+
slug: string;
|
|
1733
|
+
handler: string;
|
|
1734
|
+
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1" | null | undefined;
|
|
1735
|
+
}[];
|
|
1705
1736
|
crons: {
|
|
1706
1737
|
slug: string;
|
|
1707
1738
|
schedule: string;
|
|
@@ -1714,13 +1745,12 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
1714
1745
|
maxExecutions?: number | undefined;
|
|
1715
1746
|
}[];
|
|
1716
1747
|
events: {
|
|
1748
|
+
description: string;
|
|
1717
1749
|
event: string;
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
webhooks: {
|
|
1750
|
+
name: string;
|
|
1751
|
+
provider: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1";
|
|
1752
|
+
slug: string;
|
|
1722
1753
|
handler: string;
|
|
1723
|
-
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "PLAID" | "SQUARE" | "SHOPIFY" | "WHOOP" | "AC1" | null | undefined;
|
|
1724
1754
|
}[];
|
|
1725
1755
|
}, {
|
|
1726
1756
|
crons: {
|
|
@@ -1734,19 +1764,26 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
1734
1764
|
stopAt?: string | undefined;
|
|
1735
1765
|
maxExecutions?: number | undefined;
|
|
1736
1766
|
}[];
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1767
|
+
webhooks?: {
|
|
1768
|
+
description: string;
|
|
1769
|
+
name: string;
|
|
1770
|
+
slug: string;
|
|
1740
1771
|
handler: string;
|
|
1772
|
+
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1" | null | undefined;
|
|
1741
1773
|
}[] | undefined;
|
|
1742
|
-
|
|
1774
|
+
events?: {
|
|
1775
|
+
description: string;
|
|
1776
|
+
event: string;
|
|
1777
|
+
name: string;
|
|
1778
|
+
provider: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "SQUARE" | "SHOPIFY" | "WHOOP" | "PLAID" | "AC1";
|
|
1779
|
+
slug: string;
|
|
1743
1780
|
handler: string;
|
|
1744
|
-
provider?: "GITHUB_USER" | "GITHUB_BOT" | "GOOGLE" | "SLACK" | "SLACK_BOT" | "DISCORD" | "NOTION" | "TWITTER" | "LINKEDIN" | "YAHOO" | "FIGMA" | "PLAID" | "SQUARE" | "SHOPIFY" | "WHOOP" | "AC1" | null | undefined;
|
|
1745
1781
|
}[] | undefined;
|
|
1746
1782
|
}>;
|
|
1747
1783
|
export type AppConfig = z.infer<typeof appConfigSchema>;
|
|
1748
1784
|
declare const AuthProvider: {
|
|
1749
1785
|
readonly AC1: "AC1";
|
|
1786
|
+
readonly PLAID: "PLAID";
|
|
1750
1787
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
1751
1788
|
readonly GITHUB_BOT: "GITHUB_BOT";
|
|
1752
1789
|
readonly GOOGLE: "GOOGLE";
|
|
@@ -1758,7 +1795,6 @@ declare const AuthProvider: {
|
|
|
1758
1795
|
readonly LINKEDIN: "LINKEDIN";
|
|
1759
1796
|
readonly YAHOO: "YAHOO";
|
|
1760
1797
|
readonly FIGMA: "FIGMA";
|
|
1761
|
-
readonly PLAID: "PLAID";
|
|
1762
1798
|
readonly SQUARE: "SQUARE";
|
|
1763
1799
|
readonly SHOPIFY: "SHOPIFY";
|
|
1764
1800
|
readonly WHOOP: "WHOOP";
|
|
@@ -2129,14 +2165,30 @@ declare let client: {
|
|
|
2129
2165
|
error: "SEED";
|
|
2130
2166
|
providers: never[];
|
|
2131
2167
|
userId?: undefined;
|
|
2168
|
+
tier?: undefined;
|
|
2169
|
+
handle?: undefined;
|
|
2170
|
+
credits?: undefined;
|
|
2132
2171
|
} | {
|
|
2133
2172
|
userId: null;
|
|
2134
2173
|
error: null;
|
|
2135
2174
|
providers: never[];
|
|
2175
|
+
tier?: undefined;
|
|
2176
|
+
handle?: undefined;
|
|
2177
|
+
credits?: undefined;
|
|
2136
2178
|
} | {
|
|
2137
|
-
userId: string;
|
|
2179
|
+
userId: string | null;
|
|
2138
2180
|
error: null;
|
|
2139
2181
|
providers: AuthProvider[];
|
|
2182
|
+
tier: UserTier | null;
|
|
2183
|
+
handle: string | null;
|
|
2184
|
+
credits: {
|
|
2185
|
+
available: number;
|
|
2186
|
+
daily: number;
|
|
2187
|
+
monthly: number;
|
|
2188
|
+
promotional: number;
|
|
2189
|
+
nextDailyRefresh: Date;
|
|
2190
|
+
nextMonthlyRefresh: Date;
|
|
2191
|
+
} | null;
|
|
2140
2192
|
}>>;
|
|
2141
2193
|
};
|
|
2142
2194
|
sendEmail: {
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {z}from'zod';import {createTRPCProxyClient,httpLink}from'@trpc/client';import P from'superjson';import {handleRpc}from'typed-rpc/server';import {inspect}from'util';import {AsyncLocalStorage}from'async_hooks';import
|
|
1
|
+
import {z}from'zod';import {createTRPCProxyClient,httpLink}from'@trpc/client';import P from'superjson';import {handleRpc}from'typed-rpc/server';import {inspect}from'util';import {AsyncLocalStorage}from'async_hooks';import Ne from'better-sqlite3';import {better,defineQueue,defineWorker,JobStatus}from'plainjob';var le={GITHUB_USER:"GITHUB_USER",GITHUB_BOT:"GITHUB_BOT",GOOGLE:"GOOGLE",SLACK:"SLACK",SLACK_BOT:"SLACK_BOT",DISCORD:"DISCORD",NOTION:"NOTION",TWITTER:"TWITTER",LINKEDIN:"LINKEDIN",YAHOO:"YAHOO",FIGMA:"FIGMA",SQUARE:"SQUARE",SHOPIFY:"SHOPIFY",WHOOP:"WHOOP"},fe={...le,PLAID:"PLAID"},C={...fe,AC1:"AC1"};var me=z.object({slug:z.string(),name:z.string().optional(),schedule:z.string(),description:z.string().optional(),rpcEndpoint:z.string(),isEnabled:z.boolean().default(true),stopAt:z.string().datetime().optional(),maxExecutions:z.number().optional(),timezone:z.string().optional()}),$=z.string().refine(e=>/^[a-zA-Z0-9_]+$/.test(e),"Must be a valid identifier (letters, numbers, and underscores only)."),ge=z.object({handler:$,provider:z.nativeEnum(C).nullish(),slug:z.string(),name:z.string(),description:z.string()}),he=z.object({provider:z.nativeEnum(C),event:z.string().min(1),handler:$,slug:z.string().min(1).max(64),name:z.string().min(1).max(128),description:z.string().min(1).max(256)}),Ee=z.object({crons:z.array(me),events:z.array(he).default([]),webhooks:z.array(ge).default([])});function N(e){let r=Object.create(null);for(let t in e){let o=e[t];r[o]=t;}return r}var x={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};N(x);N(x);typeof window>"u"||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID;var S=class e extends Error{static prefix="__MISSING AUTH FOR SCOPE";static jsonRpcCode=-32001;constructor({provider:r,scope:t,accountId:o,popup:n=false}){let s=btoa(JSON.stringify({provider:r,scope:t,accountId:o}));super(`${e.prefix}: ${s}${n?" --popup":" end"}`);}jsonRpcError(){return {code:e.jsonRpcCode,message:this.message}}static check(r){return r?.message?.startsWith(e.prefix)}};var oe=new AsyncLocalStorage;function F(){return oe.getStore()}async function se(e,r){return oe.run(e,r)}function ie({environment:e,dbPath:r="errors.db"}){let t=new Ne(r,{fileMustExist:false});t.pragma("journal_mode = WAL"),t.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS error_logs (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
environment TEXT NOT NULL,
|
|
@@ -22,5 +22,5 @@ import {z}from'zod';import {createTRPCProxyClient,httpLink}from'@trpc/client';im
|
|
|
22
22
|
SELECT * FROM error_logs
|
|
23
23
|
ORDER BY created_at DESC
|
|
24
24
|
LIMIT ?
|
|
25
|
-
`).all(d)}function
|
|
26
|
-
export{Ee as appConfigSchema,
|
|
25
|
+
`).all(d)}function u({body:d,requestId:p}){let g=d,m,h;try{let T=JSON.parse(d);g=T.message??d,m=T.stack,h=T.metadata;}catch{}let E=g.startsWith("[console.warn]")||g.startsWith("[console.error]");return E&&s({source:"client",message:g,stack:m,metadata:h,requestId:p}),{message:g,persisted:E}}function a({result:d,requestId:p}){let m=d.json?.error;return m?(s({source:"server",message:m.message??"Unknown RPC error",stack:m.stack,requestId:p,metadata:m.data?{errorData:m.data}:void 0}),true):false}function l({logger:d=console}={}){n||(process.on("uncaughtException",p=>{s({source:"server",message:p.message,stack:p.stack,metadata:{type:"uncaughtException"}}),d.error("Uncaught exception:",p);}),process.on("unhandledRejection",p=>{s({source:"server",message:p instanceof Error?p.message:String(p),stack:p instanceof Error?p.stack:void 0,metadata:{type:"unhandledRejection"}}),d.error("Unhandled rejection:",p);}),n=true);}return {captureClientLog:u,captureRpcError:a,getRecentErrors:c,hasErrors:i,logError:s,registerProcessHandlers:l}}var Me={error:console.error.bind(console),warn:console.warn.bind(console),info:()=>{},debug:()=>{}};function j(e){try{return JSON.parse(e.data)}catch{return null}}function ae({dbPath:e,handlers:r,errorTracker:t,queueName:o="default",logger:n=Me}){let s=new Ne(e,{fileMustExist:false});s.pragma("journal_mode = WAL");let i=better(s),c=defineQueue({connection:i}),u=new Proxy({},{get(m,h){return E=>c.add(o,{action:h,payload:E})}});function a(m){return c.getJobById(m)}function l(){return c.countJobs({status:JobStatus.Processing})}function d(){return c.countJobs({status:JobStatus.Pending})}function p(){return {pending:c.countJobs({status:JobStatus.Pending}),processing:c.countJobs({status:JobStatus.Processing}),done:c.countJobs({status:JobStatus.Done}),failed:c.countJobs({status:JobStatus.Failed})}}function g(){let m=defineWorker(o,async h=>{let E=j(h);if(!E)throw new Error(`Failed to parse queue payload for job ${h.id}`);let T=r[E.action];if(!T)throw new Error(`No handler registered for action: ${E.action}`);console.log(`Processing job ${h.id} with action: ${E.action}`),await T(E.payload,h);},{queue:c,logger:n,onCompleted:h=>{let T=j(h)?.action??"unknown";console.log(`Job ${h.id} completed: ${T}`);},onFailed:(h,E)=>{let T=j(h);t?.logError({source:"worker",message:E instanceof Error?E.message:String(E),stack:E instanceof Error?E.stack:void 0,metadata:{jobId:h.id,action:T?.action}}),console.error(`Job ${h.id} failed: ${T?.action??"unknown"}`,E);}});return m.start(),m}return {getActiveJobCount:l,getJob:a,getJobCounts:p,getPendingJobCount:d,queue:u,startWorker:g}}var J=createTRPCProxyClient({transformer:P,links:[]}),w;function Hr({baseUrl:e,realtimeDomain:r,guestServicesUrl:t,environment:o,queueDbPath:n,errorsDbPath:s,apiKey:i}){return globalThis.env||(globalThis.env={},globalThis.env.BASE_URL=e,globalThis.env.REALTIME_DOMAIN=r,globalThis.env.GUEST_SERVICES_URL=t,J=createTRPCProxyClient({transformer:P,links:[httpLink({url:t,transformer:P,headers:()=>{let c=F();return {...c?.requestId?{"x-request-id":c.requestId}:{},...i?{"x-boxman-api-key":i}:{},"x-boxman-app-base-url":e}}})]}),console.log("Adaptive SDK server environment initialized")),w?(w.environment=o,w.queueDbPath=n,w.errorsDbPath=s):w={environment:o,queueDbPath:n,errorsDbPath:s},w}function I(){if(!w)throw new Error("Adaptive SDK server environment is not initialized. Please call initializeServerEnvironment first.");return w}function pe(){let e=I();!e.errorTracker&&e.errorsDbPath&&(e.errorTracker=ie({environment:e.environment,dbPath:e.errorsDbPath}),e.errorTracker.registerProcessHandlers());let{errorTracker:r}=e;if(!r)throw new Error("Adaptive SDK error tracking is not initialized. Pass `errorsDbPath` to initializeServerEnvironment first.");return r}function Qe({handlers:e,queueName:r,logger:t,autoStartWorker:o=true}){let n=I();if(!n.queue){if(!n.queueDbPath)throw new Error("Adaptive SDK queue is not initialized. Pass `queueDbPath` to initializeServerEnvironment first.");n.queue=ae({dbPath:n.queueDbPath,handlers:e,queueName:r,logger:t,errorTracker:n.errorsDbPath?pe():void 0});}o&&!n.queueWorkerStarted&&(n.queue.startWorker(),n.queueWorkerStarted=true);let{queue:s}=n;if(!s)throw new Error("Adaptive SDK queue is not initialized. Pass `queueDbPath` to initializeServerEnvironment first.");return s}function Lr(){return new Proxy({},{get(e,r){let t=I();if(!t.queue)throw new Error("Adaptive SDK queue is not initialized. Pass `queueDbPath` to initializeServerEnvironment first.");return r==="getJob"?t.queue.getJob:t.queue.queue[r]}})}function Q(e,r){return r.endsWith("*")?e.startsWith(r.slice(0,-1)):e===r}function Je(e){return e?.toLowerCase().startsWith("curl/")??false}function Mr({procedures:e,jobs:r,transcoder:t,rpcPath:o="/api/*",loggerPath:n="/_logger",queueStatusPath:s="/_queue/status"}){let i=I(),c=i.errorsDbPath?pe():void 0,u=r&&i.queueDbPath?Qe({handlers:r}):void 0;return async(a,l)=>{let d=new URL(a.req.url).pathname;if(n&&c&&a.req.method==="POST"&&Q(d,n)){let p=await a.req.text(),g=a.req.header("x-request-id"),{message:m}=c.captureClientLog({body:p,requestId:g??void 0});return console.log("[browser]",m),a.json({status:"ok"})}if(s&&u&&a.req.method==="GET"&&Q(d,s))return a.json({activeJobs:u.getActiveJobCount(),pendingJobs:u.getPendingJobCount()});if(a.req.method==="POST"&&Q(d,o)){let p=await a.req.json(),g=a.req.header("x-request-id"),m=a.req.header("x-channel-id"),h=a.req.header("user-agent");g||console.warn("Request is missing x-request-id header. Adaptive AI SDK relies on this for request context."),Je(h)&&console.error(`[${g??"unknown-request-id"}] Curl request received by Adaptive SDK server. Use the run RPC endpoint MCP instead.`,{method:a.req.method,url:a.req.url,userAgent:h}),console.log(`[${g}] Starting request ${a.req.method} ${a.req.url}`),m&&console.log(`[${g}] Channel ID: ${m}`);let T=await se({requestId:g??"unknown-request-id",channelId:m,hasTasks:false},async()=>await handleRpc(p,e,{transcoder:t}));return console.log(`[${g}] Response:`,inspect(T,{depth:3,colors:true})),c?.captureRpcError({result:T,requestId:g??void 0}),a.json(T)}await l();}}var Be=new Proxy({},{get(e,r){return async t=>{if(globalThis.env===void 0)throw new Error("Adaptive SDK server environment is not initialized. Please call initializeServerEnvironment first.");let n=J[r];if(!n||typeof n.mutate!="function")throw new Error(`Property "${String(r)}" is not a mutation procedure`);return n.mutate(t)}}});async function Ur(e){return await J.executeComposioTool.mutate(e)}function Fr(){return globalThis.env.BASE_URL}var B=null;function jr(){return B}function Qr({channelId:e,onUpdate:r}){let t=new WebSocket(`wss://${globalThis.env.REALTIME_DOMAIN}/${e}`),o=-1;function n(s){r&&(B=Date.now());try{let i=JSON.parse(s.data.toString());if(i?.id&&i.id>o){let c=P.parse(i.payload);r?.(c),o=i.id;}}catch{}}return t.addEventListener("message",n),{destroy(){t.close(),t.removeEventListener("message",n);}}}async function ue({channelId:e,data:r}){B=Date.now(),await fetch(`https://${globalThis.env.REALTIME_DOMAIN}/${e}`,{method:"POST",body:P.stringify(r)}).catch(console.error);}async function Jr(){let e,r=F()?.channelId;if(!r)throw new Error("API's using `startRealtimeResponse` must be called via `useRealtimeMutation`.");return {next(t){e=t,ue({channelId:r,data:t});},end(){return ue({channelId:r,data:e}),e}}}function ce(e){throw new S({provider:"AC1",popup:true})}async function Br(e){let r=await Be.getCurrentUser();if(r?.error==="SEED")throw new Error('Call to "getAuth" in seed function is not allowed. Seed functions should not depend on user data.');if(r.userId)return {userId:r.userId,status:"authenticated",signIn:ce,providers:r.providers};if(e?.required)throw new S({provider:"AC1"});return {userId:null,status:"unauthenticated",signIn:ce,providers:[]}}
|
|
26
|
+
export{Ee as appConfigSchema,Ur as executeComposioTool,Br as getAuth,Fr as getBaseUrl,pe as getErrorTracker,jr as getLastStreamTime,Lr as getQueue,Qr as getRealtimeStore,Mr as honoMiddleware,Hr as initializeServerEnvironment,Be as mcp,se as runWithContext,ue as setRealtimeStore,Jr as startRealtimeResponse};
|