@animaapp/anima-sdk 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var Uo=Object.defineProperty,Lo=Object.defineProperties;var Mo=Object.getOwnPropertyDescriptors;var An=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable;var In=e=>{throw TypeError(e)},Nn=Math.pow,xn=(e,t,n)=>t in e?Uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))Jo.call(t,n)&&xn(e,n,t[n]);if(An)for(var n of An(t))Bo.call(t,n)&&xn(e,n,t[n]);return e},y=(e,t)=>Lo(e,Mo(t));var Dt=(e,t,n)=>t.has(e)||In("Cannot "+n);var v=(e,t,n)=>(Dt(e,t,"read from private field"),n?n.call(e):t.get(e)),re=(e,t,n)=>t.has(e)?In("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),X=(e,t,n,r)=>(Dt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),j=(e,t,n)=>(Dt(e,t,"access private method"),n);var k=(e,t,n)=>new Promise((r,o)=>{var i=c=>{try{s(n.next(c))}catch(u){o(u)}},a=c=>{try{s(n.throw(c))}catch(u){o(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,a);s((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Vo=4,Rn=0,Pn=1,Wo=2;function Be(e){let t=e.length;for(;--t>=0;)e[t]=0}const Ho=0,yr=1,Ko=2,Go=3,qo=258,gn=29,lt=256,nt=lt+1+gn,Pe=30,mn=19,br=2*nt+1,Se=15,Ft=16,Xo=7,yn=256,wr=16,vr=17,kr=18,Wt=new Uint8Array([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]),wt=new Uint8Array([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]),Yo=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=512,de=new Array((nt+2)*2);Be(de);const et=new Array(Pe*2);Be(et);const rt=new Array(Qo);Be(rt);const ot=new Array(qo-Go+1);Be(ot);const bn=new Array(gn);Be(bn);const zt=new Array(Pe);Be(zt);function Ct(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}let Sr,Er,Tr;function jt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const $r=e=>e<256?rt[e]:rt[256+(e>>>7)],it=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},B=(e,t,n)=>{e.bi_valid>Ft-n?(e.bi_buf|=t<<e.bi_valid&65535,it(e,e.bi_buf),e.bi_buf=t>>Ft-e.bi_valid,e.bi_valid+=n-Ft):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},ie=(e,t,n)=>{B(e,n[t*2],n[t*2+1])},Zr=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},ei=e=>{e.bi_valid===16?(it(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},ti=(e,t)=>{const n=t.dyn_tree,r=t.max_code,o=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,f,_,m,w=0;for(f=0;f<=Se;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;u<br;u++)l=e.heap[u],f=n[n[l*2+1]*2+1]+1,f>c&&(f=c,w++),n[l*2+1]=f,!(l>r)&&(e.bl_count[f]++,_=0,l>=s&&(_=a[l-s]),m=n[l*2],e.opt_len+=m*(f+_),i&&(e.static_len+=m*(o[l*2+1]+_)));if(w!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,w-=2}while(w>0);for(f=c;f!==0;f--)for(l=e.bl_count[f];l!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),l--)}},Or=(e,t,n)=>{const r=new Array(Se+1);let o=0,i,a;for(i=1;i<=Se;i++)o=o+n[i-1]<<1,r[i]=o;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=Zr(r[s]++,s))}},ni=()=>{let e,t,n,r,o;const i=new Array(Se+1);for(n=0,r=0;r<gn-1;r++)for(bn[r]=n,e=0;e<1<<Wt[r];e++)ot[n++]=r;for(ot[n-1]=r,o=0,r=0;r<16;r++)for(zt[r]=o,e=0;e<1<<wt[r];e++)rt[o++]=r;for(o>>=7;r<Pe;r++)for(zt[r]=o<<7,e=0;e<1<<wt[r]-7;e++)rt[256+o++]=r;for(t=0;t<=Se;t++)i[t]=0;for(e=0;e<=143;)de[e*2+1]=8,e++,i[8]++;for(;e<=255;)de[e*2+1]=9,e++,i[9]++;for(;e<=279;)de[e*2+1]=7,e++,i[7]++;for(;e<=287;)de[e*2+1]=8,e++,i[8]++;for(Or(de,nt+1,i),e=0;e<Pe;e++)et[e*2+1]=5,et[e*2]=Zr(e,5);Sr=new Ct(de,Wt,lt+1,nt,Se),Er=new Ct(et,wt,0,Pe,Se),Tr=new Ct(new Array(0),Yo,0,mn,Xo)},Ar=e=>{let t;for(t=0;t<nt;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Pe;t++)e.dyn_dtree[t*2]=0;for(t=0;t<mn;t++)e.bl_tree[t*2]=0;e.dyn_ltree[yn*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},xr=e=>{e.bi_valid>8?it(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Dn=(e,t,n,r)=>{const o=t*2,i=n*2;return e[o]<e[i]||e[o]===e[i]&&r[t]<=r[n]},Ut=(e,t,n)=>{const r=e.heap[n];let o=n<<1;for(;o<=e.heap_len&&(o<e.heap_len&&Dn(t,e.heap[o+1],e.heap[o],e.depth)&&o++,!Dn(t,r,e.heap[o],e.depth));)e.heap[n]=e.heap[o],n=o,o<<=1;e.heap[n]=r},Fn=(e,t,n)=>{let r,o,i=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+i++]&255,r+=(e.pending_buf[e.sym_buf+i++]&255)<<8,o=e.pending_buf[e.sym_buf+i++],r===0?ie(e,o,t):(a=ot[o],ie(e,a+lt+1,t),s=Wt[a],s!==0&&(o-=bn[a],B(e,o,s)),r--,a=$r(r),ie(e,a,n),s=wt[a],s!==0&&(r-=zt[a],B(e,r,s)));while(i<e.sym_next);ie(e,yn,t)},Ht=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,i=t.stat_desc.elems;let a,s,c=-1,u;for(e.heap_len=0,e.heap_max=br,a=0;a<i;a++)n[a*2]!==0?(e.heap[++e.heap_len]=c=a,e.depth[a]=0):n[a*2+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=c<2?++c:0,n[u*2]=1,e.depth[u]=0,e.opt_len--,o&&(e.static_len-=r[u*2+1]);for(t.max_code=c,a=e.heap_len>>1;a>=1;a--)Ut(e,n,a);u=i;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ut(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,Ut(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ti(e,t),Or(n,c,e.bl_count)},Cn=(e,t,n)=>{let r,o=-1,i,a=t[1],s=0,c=7,u=4;for(a===0&&(c=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)i=a,a=t[(r+1)*2+1],!(++s<c&&i===a)&&(s<u?e.bl_tree[i*2]+=s:i!==0?(i!==o&&e.bl_tree[i*2]++,e.bl_tree[wr*2]++):s<=10?e.bl_tree[vr*2]++:e.bl_tree[kr*2]++,s=0,o=i,a===0?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},jn=(e,t,n)=>{let r,o=-1,i,a=t[1],s=0,c=7,u=4;for(a===0&&(c=138,u=3),r=0;r<=n;r++)if(i=a,a=t[(r+1)*2+1],!(++s<c&&i===a)){if(s<u)do ie(e,i,e.bl_tree);while(--s!==0);else i!==0?(i!==o&&(ie(e,i,e.bl_tree),s--),ie(e,wr,e.bl_tree),B(e,s-3,2)):s<=10?(ie(e,vr,e.bl_tree),B(e,s-3,3)):(ie(e,kr,e.bl_tree),B(e,s-11,7));s=0,o=i,a===0?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}},ri=e=>{let t;for(Cn(e,e.dyn_ltree,e.l_desc.max_code),Cn(e,e.dyn_dtree,e.d_desc.max_code),Ht(e,e.bl_desc),t=mn-1;t>=3&&e.bl_tree[zr[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},oi=(e,t,n,r)=>{let o;for(B(e,t-257,5),B(e,n-1,5),B(e,r-4,4),o=0;o<r;o++)B(e,e.bl_tree[zr[o]*2+1],3);jn(e,e.dyn_ltree,t-1),jn(e,e.dyn_dtree,n-1)},ii=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Rn;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return Pn;for(n=32;n<lt;n++)if(e.dyn_ltree[n*2]!==0)return Pn;return Rn};let Un=!1;const ai=e=>{Un||(ni(),Un=!0),e.l_desc=new jt(e.dyn_ltree,Sr),e.d_desc=new jt(e.dyn_dtree,Er),e.bl_desc=new jt(e.bl_tree,Tr),e.bi_buf=0,e.bi_valid=0,Ar(e)},Ir=(e,t,n,r)=>{B(e,(Ho<<1)+(r?1:0),3),xr(e),it(e,n),it(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},si=e=>{B(e,yr<<1,3),ie(e,yn,de),ei(e)},ci=(e,t,n,r)=>{let o,i,a=0;e.level>0?(e.strm.data_type===Wo&&(e.strm.data_type=ii(e)),Ht(e,e.l_desc),Ht(e,e.d_desc),a=ri(e),o=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=o&&(o=i)):o=i=n+5,n+4<=o&&t!==-1?Ir(e,t,n,r):e.strategy===Vo||i===o?(B(e,(yr<<1)+(r?1:0),3),Fn(e,de,et)):(B(e,(Ko<<1)+(r?1:0),3),oi(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Fn(e,e.dyn_ltree,e.dyn_dtree)),Ar(e),r&&xr(e)},ui=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(ot[n]+lt+1)*2]++,e.dyn_dtree[$r(t)*2]++),e.sym_next===e.sym_end);var li=ai,fi=Ir,di=ci,hi=ui,pi=si,_i={_tr_init:li,_tr_stored_block:fi,_tr_flush_block:di,_tr_tally:hi,_tr_align:pi};const gi=(e,t,n,r)=>{let o=e&65535|0,i=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do o=o+t[r++]|0,i=i+o|0;while(--a);o%=65521,i%=65521}return o|i<<16|0};var Nr=gi;const mi=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},yi=new Uint32Array(mi()),bi=(e,t,n,r)=>{const o=yi,i=r+n;e^=-1;for(let a=r;a<i;a++)e=e>>>8^o[(e^t[a])&255];return e^-1};var pe=bi,St={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Rr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:wi,_tr_stored_block:Kt,_tr_flush_block:vi,_tr_tally:me,_tr_align:ki}=_i,{Z_NO_FLUSH:ye,Z_PARTIAL_FLUSH:zi,Z_FULL_FLUSH:Si,Z_FINISH:ee,Z_BLOCK:Ln,Z_OK:C,Z_STREAM_END:Mn,Z_STREAM_ERROR:se,Z_DATA_ERROR:Ei,Z_BUF_ERROR:Lt,Z_DEFAULT_COMPRESSION:Ti,Z_FILTERED:$i,Z_HUFFMAN_ONLY:_t,Z_RLE:Zi,Z_FIXED:Oi,Z_DEFAULT_STRATEGY:Ai,Z_UNKNOWN:xi,Z_DEFLATED:At}=Rr,Ii=9,Ni=15,Ri=8,Pi=29,Di=256,Gt=Di+1+Pi,Fi=30,Ci=19,ji=2*Gt+1,Ui=15,z=3,ge=258,ce=ge+z+1,Li=32,je=42,wn=57,qt=69,Xt=73,Yt=91,Qt=103,Ee=113,Ge=666,J=1,Ve=2,$e=3,We=4,Mi=3,Te=(e,t)=>(e.msg=St[t],t),Jn=e=>e*2-(e>4?9:0),_e=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ji=e=>{let t,n,r,o=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=o?n-o:0;while(--t);t=o,r=t;do n=e.prev[--r],e.prev[r]=n>=o?n-o:0;while(--t)};let Bi=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,be=Bi;const G=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},q=(e,t)=>{vi(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,G(e.strm)},$=(e,t)=>{e.pending_buf[e.pending++]=t},Ke=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},en=(e,t,n,r)=>{let o=e.avail_in;return o>r&&(o=r),o===0?0:(e.avail_in-=o,t.set(e.input.subarray(e.next_in,e.next_in+o),n),e.state.wrap===1?e.adler=Nr(e.adler,t,o,n):e.state.wrap===2&&(e.adler=pe(e.adler,t,o,n)),e.next_in+=o,e.total_in+=o,o)},Pr=(e,t)=>{let n=e.max_chain_length,r=e.strstart,o,i,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-ce?e.strstart-(e.w_size-ce):0,u=e.window,l=e.w_mask,d=e.prev,f=e.strstart+ge;let _=u[r+a-1],m=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(o=t,!(u[o+a]!==m||u[o+a-1]!==_||u[o]!==u[r]||u[++o]!==u[r+1])){r+=2,o++;do;while(u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&r<f);if(i=ge-(f-r),r=f-ge,i>a){if(e.match_start=t,a=i,i>=s)break;_=u[r+a-1],m=u[r+a]}}while((t=d[t&l])>c&&--n!==0);return a<=e.lookahead?a:e.lookahead},Ue=e=>{const t=e.w_size;let n,r,o;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ce)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ji(e),r+=t),e.strm.avail_in===0)break;if(n=en(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=z)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=be(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=be(e,e.ins_h,e.window[o+z-1]),e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<z)););}while(e.lookahead<ce&&e.strm.avail_in!==0)},Dr=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,o,i,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i||(i=e.strm.avail_out-i,o=e.strstart-e.block_start,r>o+e.strm.avail_in&&(r=o+e.strm.avail_in),r>i&&(r=i),r<n&&(r===0&&t!==ee||t===ye||r!==o+e.strm.avail_in)))break;a=t===ee&&r===o+e.strm.avail_in?1:0,Kt(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,G(e.strm),o&&(o>r&&(o=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+o),e.strm.next_out),e.strm.next_out+=o,e.strm.avail_out-=o,e.strm.total_out+=o,e.block_start+=o,r-=o),r&&(en(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?We:t!==ye&&t!==ee&&e.strm.avail_in===0&&e.strstart===e.block_start?Ve:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(en(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,o=e.strstart-e.block_start,(o>=n||(o||t===ee)&&t!==ye&&e.strm.avail_in===0&&o<=i)&&(r=o>i?i:o,a=t===ee&&e.strm.avail_in===0&&r===o?1:0,Kt(e,e.block_start,r,a),e.block_start+=r,G(e.strm)),a?$e:J)},Mt=(e,t)=>{let n,r;for(;;){if(e.lookahead<ce){if(Ue(e),e.lookahead<ce&&t===ye)return J;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-ce&&(e.match_length=Pr(e,n)),e.match_length>=z)if(r=me(e,e.strstart-e.match_start,e.match_length-z),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=z){e.match_length--;do e.strstart++,e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=be(e,e.ins_h,e.window[e.strstart+1]);else r=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=e.strstart<z-1?e.strstart:z-1,t===ee?(q(e,!0),e.strm.avail_out===0?$e:We):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:Ve},Ae=(e,t)=>{let n,r,o;for(;;){if(e.lookahead<ce){if(Ue(e),e.lookahead<ce&&t===ye)return J;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=z-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-ce&&(e.match_length=Pr(e,n),e.match_length<=5&&(e.strategy===$i||e.match_length===z&&e.strstart-e.match_start>4096)&&(e.match_length=z-1)),e.prev_length>=z&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-z,r=me(e,e.strstart-1-e.prev_match,e.prev_length-z),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=o&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=z-1,e.strstart++,r&&(q(e,!1),e.strm.avail_out===0))return J}else if(e.match_available){if(r=me(e,0,e.window[e.strstart-1]),r&&q(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return J}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=me(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<z-1?e.strstart:z-1,t===ee?(q(e,!0),e.strm.avail_out===0?$e:We):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:Ve},Vi=(e,t)=>{let n,r,o,i;const a=e.window;for(;;){if(e.lookahead<=ge){if(Ue(e),e.lookahead<=ge&&t===ye)return J;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=z&&e.strstart>0&&(o=e.strstart-1,r=a[o],r===a[++o]&&r===a[++o]&&r===a[++o])){i=e.strstart+ge;do;while(r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&o<i);e.match_length=ge-(i-o),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=z?(n=me(e,1,e.match_length-z),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=0,t===ee?(q(e,!0),e.strm.avail_out===0?$e:We):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:Ve},Wi=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Ue(e),e.lookahead===0)){if(t===ye)return J;break}if(e.match_length=0,n=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=0,t===ee?(q(e,!0),e.strm.avail_out===0?$e:We):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:Ve};function oe(e,t,n,r,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=o}const qe=[new oe(0,0,0,0,Dr),new oe(4,4,8,4,Mt),new oe(4,5,16,8,Mt),new oe(4,6,32,32,Mt),new oe(4,4,16,16,Ae),new oe(8,16,32,32,Ae),new oe(8,16,128,128,Ae),new oe(8,32,128,256,Ae),new oe(32,128,258,1024,Ae),new oe(32,258,258,4096,Ae)],Hi=e=>{e.window_size=2*e.w_size,_e(e.head),e.max_lazy_match=qe[e.level].max_lazy,e.good_match=qe[e.level].good_length,e.nice_match=qe[e.level].nice_length,e.max_chain_length=qe[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=z-1,e.match_available=0,e.ins_h=0};function Ki(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=At,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ji*2),this.dyn_dtree=new Uint16Array((2*Fi+1)*2),this.bl_tree=new Uint16Array((2*Ci+1)*2),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Ui+1),this.heap=new Uint16Array(2*Gt+1),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Gt+1),_e(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ft=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==je&&t.status!==wn&&t.status!==qt&&t.status!==Xt&&t.status!==Yt&&t.status!==Qt&&t.status!==Ee&&t.status!==Ge?1:0},Fr=e=>{if(ft(e))return Te(e,se);e.total_in=e.total_out=0,e.data_type=xi;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?wn:t.wrap?je:Ee,e.adler=t.wrap===2?0:1,t.last_flush=-2,wi(t),C},Cr=e=>{const t=Fr(e);return t===C&&Hi(e.state),t},Gi=(e,t)=>ft(e)||e.state.wrap!==2?se:(e.state.gzhead=t,C),jr=(e,t,n,r,o,i)=>{if(!e)return se;let a=1;if(t===Ti&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),o<1||o>Ii||n!==At||r<8||r>15||t<0||t>9||i<0||i>Oi||r===8&&a!==1)return Te(e,se);r===8&&(r=9);const s=new Ki;return e.state=s,s.strm=e,s.status=je,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=o+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+z-1)/z),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<o+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=t,s.strategy=i,s.method=n,Cr(e)},qi=(e,t)=>jr(e,t,At,Ni,Ri,Ai),Xi=(e,t)=>{if(ft(e)||t>Ln||t<0)return e?Te(e,se):se;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Ge&&t!==ee)return Te(e,e.avail_out===0?Lt:se);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(G(e),e.avail_out===0)return n.last_flush=-1,C}else if(e.avail_in===0&&Jn(t)<=Jn(r)&&t!==ee)return Te(e,Lt);if(n.status===Ge&&e.avail_in!==0)return Te(e,Lt);if(n.status===je&&n.wrap===0&&(n.status=Ee),n.status===je){let o=At+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=_t||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,o|=i<<6,n.strstart!==0&&(o|=Li),o+=31-o%31,Ke(n,o),n.strstart!==0&&(Ke(n,e.adler>>>16),Ke(n,e.adler&65535)),e.adler=1,n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,C}if(n.status===wn){if(e.adler=0,$(n,31),$(n,139),$(n,8),n.gzhead)$(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),$(n,n.gzhead.time&255),$(n,n.gzhead.time>>8&255),$(n,n.gzhead.time>>16&255),$(n,n.gzhead.time>>24&255),$(n,n.level===9?2:n.strategy>=_t||n.level<2?4:0),$(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&($(n,n.gzhead.extra.length&255),$(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=pe(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=qt;else if($(n,0),$(n,0),$(n,0),$(n,0),$(n,0),$(n,n.level===9?2:n.strategy>=_t||n.level<2?4:0),$(n,Mi),n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,C}if(n.status===qt){if(n.gzhead.extra){let o=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex+=s,G(e),n.pending!==0)return n.last_flush=-1,C;o=0,i-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=Xt}if(n.status===Xt){if(n.gzhead.name){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),G(e),n.pending!==0)return n.last_flush=-1,C;o=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,$(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=Yt}if(n.status===Yt){if(n.gzhead.comment){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),G(e),n.pending!==0)return n.last_flush=-1,C;o=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,$(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o))}n.status=Qt}if(n.status===Qt){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(G(e),n.pending!==0))return n.last_flush=-1,C;$(n,e.adler&255),$(n,e.adler>>8&255),e.adler=0}if(n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,C}if(e.avail_in!==0||n.lookahead!==0||t!==ye&&n.status!==Ge){let o=n.level===0?Dr(n,t):n.strategy===_t?Wi(n,t):n.strategy===Zi?Vi(n,t):qe[n.level].func(n,t);if((o===$e||o===We)&&(n.status=Ge),o===J||o===$e)return e.avail_out===0&&(n.last_flush=-1),C;if(o===Ve&&(t===zi?ki(n):t!==Ln&&(Kt(n,0,0,!1),t===Si&&(_e(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),G(e),e.avail_out===0))return n.last_flush=-1,C}return t!==ee?C:n.wrap<=0?Mn:(n.wrap===2?($(n,e.adler&255),$(n,e.adler>>8&255),$(n,e.adler>>16&255),$(n,e.adler>>24&255),$(n,e.total_in&255),$(n,e.total_in>>8&255),$(n,e.total_in>>16&255),$(n,e.total_in>>24&255)):(Ke(n,e.adler>>>16),Ke(n,e.adler&65535)),G(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?C:Mn)},Yi=e=>{if(ft(e))return se;const t=e.state.status;return e.state=null,t===Ee?Te(e,Ei):C},Qi=(e,t)=>{let n=t.length;if(ft(e))return se;const r=e.state,o=r.wrap;if(o===2||o===1&&r.status!==je||r.lookahead)return se;if(o===1&&(e.adler=Nr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){o===0&&(_e(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(t.subarray(n-r.w_size,n),0),t=c,n=r.w_size}const i=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Ue(r);r.lookahead>=z;){let c=r.strstart,u=r.lookahead-(z-1);do r.ins_h=be(r,r.ins_h,r.window[c+z-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--u);r.strstart=c,r.lookahead=z-1,Ue(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=z-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=i,r.wrap=o,C};var ea=qi,ta=jr,na=Cr,ra=Fr,oa=Gi,ia=Xi,aa=Yi,sa=Qi,ca="pako deflate (from Nodeca project)",tt={deflateInit:ea,deflateInit2:ta,deflateReset:na,deflateResetKeep:ra,deflateSetHeader:oa,deflate:ia,deflateEnd:aa,deflateSetDictionary:sa,deflateInfo:ca};const ua=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var la=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)ua(n,r)&&(e[r]=n[r])}}return e},fa=e=>{let t=0;for(let r=0,o=e.length;r<o;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,o=0,i=e.length;r<i;r++){let a=e[r];n.set(a,o),o+=a.length}return n},Ur={assign:la,flattenChunks:fa};let Lr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Lr=!1}const at=new Uint8Array(256);for(let e=0;e<256;e++)at[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;at[254]=at[254]=1;var da=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,o,i,a=e.length,s=0;for(o=0;o<a;o++)n=e.charCodeAt(o),(n&64512)===55296&&o+1<a&&(r=e.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),i=0,o=0;i<s;o++)n=e.charCodeAt(o),(n&64512)===55296&&o+1<a&&(r=e.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t};const ha=(e,t)=>{if(t<65534&&e.subarray&&Lr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var pa=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,o;const i=new Array(n*2);for(o=0,r=0;r<n;){let a=e[r++];if(a<128){i[o++]=a;continue}let s=at[a];if(s>4){i[o++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r<n;)a=a<<6|e[r++]&63,s--;if(s>1){i[o++]=65533;continue}a<65536?i[o++]=a:(a-=65536,i[o++]=55296|a>>10&1023,i[o++]=56320|a&1023)}return ha(i,o)},_a=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+at[e[n]]>t?n:t},Mr={string2buf:da,buf2string:pa,utf8border:_a};function ga(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var ma=ga;const Jr=Object.prototype.toString,{Z_NO_FLUSH:ya,Z_SYNC_FLUSH:ba,Z_FULL_FLUSH:wa,Z_FINISH:va,Z_OK:Et,Z_STREAM_END:ka,Z_DEFAULT_COMPRESSION:za,Z_DEFAULT_STRATEGY:Sa,Z_DEFLATED:Ea}=Rr;function xt(e){this.options=Ur.assign({level:za,method:Ea,chunkSize:16384,windowBits:15,memLevel:8,strategy:Sa},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ma,this.strm.avail_out=0;let n=tt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Et)throw new Error(St[n]);if(t.header&&tt.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Mr.string2buf(t.dictionary):Jr.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=tt.deflateSetDictionary(this.strm,r),n!==Et)throw new Error(St[n]);this._dict_set=!0}}xt.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let o,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?va:ya,typeof e=="string"?n.input=Mr.string2buf(e):Jr.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===ba||i===wa)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(o=tt.deflate(n,i),o===ka)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),o=tt.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Et;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};xt.prototype.onData=function(e){this.chunks.push(e)};xt.prototype.onEnd=function(e){e===Et&&(this.result=Ur.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ta(e,t){const n=new xt(t);if(n.push(e,!0),n.err)throw n.msg||St[n.err];return n.result}function $a(e,t){return t=t||{},t.gzip=!0,Ta(e,t)}var Za=$a,Oa={gzip:Za};const{gzip:Aa}=Oa;var xa=Aa;class fe extends Error{constructor({name:t,reason:n,status:r,detail:o}){super(),this.name=t,this.message=n,this.detail=o,this.status=r}}class Br extends Error{constructor(){super("Malformatted Figma Token")}}class Vr extends Error{constructor(){super("Missing Figma Token")}}class tn extends Error{constructor(){super("Needs Reauth Figma Token")}}class nn extends Error{constructor(){super("Expired Figma Token")}}class rn extends Error{constructor(){super("File Not Exportable")}}class on extends Error{constructor({reason:t}){super("Unknown Forbidden Figma Error"),this.reason=t}}const Wr="Not Found";class Hr extends Error{constructor({cause:t}){super(Wr),this.cause=t}}const Ia=e=>e.message===Wr,Kr="Unknown Figma API Exception";class Gr extends Error{constructor({cause:t}){super(Kr),this.cause=t}}const Na=e=>e.message===Kr,qr="Rate Limit Exceeded";class an extends Error{constructor({cause:t}){super(qr),this.cause=t}}const Ra=e=>e.message===qr,Xr="Request Too Large";class Yr extends Error{constructor({cause:t}){super(Xr),this.cause=t}}const Pa=e=>e.message===Xr;function h(e,t,n){var s;function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const l=a.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){const _=d[f];_ in c||(c[_]=l[_].bind(c))}}const o=(s=n==null?void 0:n.Parent)!=null?s:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(c){var d;var u;const l=n!=null&&n.Parent?new i:this;r(l,c),(d=(u=l._zod).deferred)!=null||(u.deferred=[]);for(const f of l._zod.deferred)f();return l}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>{var u,l;return n!=null&&n.Parent&&c instanceof n.Parent?!0:(l=(u=c==null?void 0:c._zod)==null?void 0:u.traits)==null?void 0:l.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class De extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Qr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const eo={};function we(e){return eo}function to(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function sn(e,t){return typeof t=="bigint"?t.toString():t}function vn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kn(e){return e==null}function zn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Da(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(o=Number.parseInt(c[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/Nn(10,i)}const Bn=Symbol("evaluating");function Z(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Bn)return r===void 0&&(r=Bn,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ze(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ke(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Vn(e){return JSON.stringify(e)}function Fa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const no="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Tt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ca=vn(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function Le(e){if(Tt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Tt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ro(e){return Le(e)?p({},e):Array.isArray(e)?[...e]:e}const ja=new Set(["string","number","symbol"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?y(p({},t),{error:()=>t.error}):t}function Ua(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const La={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ma(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ke(e._zod.def,{get shape(){const a={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return Ze(this,"shape",a),a},checks:[]});return ze(e,i)}function Ja(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ke(e._zod.def,{get shape(){const a=p({},e._zod.def.shape);for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Ze(this,"shape",a),a},checks:[]});return ze(e,i)}function Ba(e,t){if(!Le(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ke(e._zod.def,{get shape(){const i=p(p({},e._zod.def.shape),t);return Ze(this,"shape",i),i}});return ze(e,o)}function Va(e,t){if(!Le(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ke(e._zod.def,{get shape(){const r=p(p({},e._zod.def.shape),t);return Ze(this,"shape",r),r}});return ze(e,n)}function Wa(e,t){const n=ke(e._zod.def,{get shape(){const r=p(p({},e._zod.def.shape),t._zod.def.shape);return Ze(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ze(e,n)}function Ha(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=ke(t._zod.def,{get shape(){const s=t._zod.def.shape,c=p({},s);if(n)for(const u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(const u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Ze(this,"shape",c),c},checks:[]});return ze(t,a)}function Ka(e,t,n){const r=ke(t._zod.def,{get shape(){const o=t._zod.def.shape,i=p({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Ze(this,"shape",i),i}});return ze(t,r)}function Ne(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Re(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function gt(e){return typeof e=="string"?e:e==null?void 0:e.message}function ve(e,t,n){var o,i,a,s,c,u,l,d,f,_,m;const r=y(p({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const w=(m=(_=(d=(u=gt((s=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:s.call(a,e)))!=null?u:gt((c=t==null?void 0:t.error)==null?void 0:c.call(t,e)))!=null?d:gt((l=n.customError)==null?void 0:l.call(n,e)))!=null?_:gt((f=n.localeError)==null?void 0:f.call(n,e)))!=null?m:"Invalid input";r.message=w}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Sn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function st(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:p({},t)}const oo=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,sn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},io=h("$ZodError",oo),ao=h("$ZodError",oo,{Parent:Error});function Ga(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function qa(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,s=0;for(;s<i.path.length;){const c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return r(e),n}const En=e=>(t,n,r,o)=>{var s;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new De;if(a.issues.length){const c=new((s=o==null?void 0:o.Err)!=null?s:e)(a.issues.map(u=>ve(u,i,we())));throw no(c,o==null?void 0:o.callee),c}return a.value},Tn=e=>(t,n,r,o)=>k(null,null,function*(){var s;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const c=new((s=o==null?void 0:o.Err)!=null?s:e)(a.issues.map(u=>ve(u,i,we())));throw no(c,o==null?void 0:o.callee),c}return a.value}),It=e=>(t,n,r)=>{const o=r?y(p({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new De;return i.issues.length?{success:!1,error:new(e!=null?e:io)(i.issues.map(a=>ve(a,o,we())))}:{success:!0,data:i.value}},Xa=It(ao),Nt=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ve(a,o,we())))}:{success:!0,data:i.value}}),Ya=Nt(ao),Qa=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return En(e)(t,n,o)},es=e=>(t,n,r)=>En(e)(t,n,r),ts=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Tn(e)(t,n,o)}),ns=e=>(t,n,r)=>k(null,null,function*(){return Tn(e)(t,n,r)}),rs=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return It(e)(t,n,o)},os=e=>(t,n,r)=>It(e)(t,n,r),is=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Nt(e)(t,n,o)}),as=e=>(t,n,r)=>k(null,null,function*(){return Nt(e)(t,n,r)}),ss=/^[cC][^\s-]{8,}$/,cs=/^[0-9a-z]+$/,us=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ls=/^[0-9a-vA-V]{20}$/,fs=/^[A-Za-z0-9]{27}$/,ds=/^[a-zA-Z0-9_-]{21}$/,hs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ps=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_s=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ms(){return new RegExp(gs,"u")}const ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ws=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,vs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ks=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,so=/^[A-Za-z0-9_-]*$/,zs=/^\+[1-9]\d{6,14}$/,co="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ss=new RegExp(`^${co}$`);function uo(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Es(e){return new RegExp(`^${uo(e)}$`)}function Ts(e){const t=uo({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${co}T(?:${r})$`)}const $s=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Zs=/^-?\d+$/,lo=/^-?\d+(?:\.\d+)?$/,Os=/^(?:true|false)$/i,As=/^[^A-Z]*$/,xs=/^[^a-z]*$/,W=h("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),fo={number:"number",bigint:"bigint",object:"date"},ho=h("$ZodCheckLessThan",(e,t)=>{W.init(e,t);const n=fo[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),po=h("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);const n=fo[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Is=h("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Da(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ns=h("$ZodCheckNumberFormat",(e,t)=>{var a;W.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=La[t.format];e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,c.minimum=o,c.maximum=i,n&&(c.pattern=Zs)}),e._zod.check=s=>{const c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Rs=h("$ZodCheckMaxLength",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!kn(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const s=Sn(i);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ps=h("$ZodCheckMinLength",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!kn(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const s=Sn(i);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ds=h("$ZodCheckLengthEquals",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!kn(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const s=Sn(i),c=a>t.length;o.issues.push(y(p({origin:s},c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),Rt=h("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;W.init(e,t),e._zod.onattach.push(a=>{var c;const s=a._zod.bag;s.format=t.format,t.pattern&&((c=s.patterns)!=null||(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(y(p({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),Fs=h("$ZodCheckRegex",(e,t)=>{Rt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Cs=h("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=As),Rt.init(e,t)}),js=h("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=xs),Rt.init(e,t)}),Us=h("$ZodCheckIncludes",(e,t)=>{W.init(e,t);const n=Me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ls=h("$ZodCheckStartsWith",(e,t)=>{var r;W.init(e,t);const n=new RegExp(`^${Me(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ms=h("$ZodCheckEndsWith",(e,t)=>{var r;W.init(e,t);const n=new RegExp(`.*${Me(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Js=h("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Bs{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1
+ "use strict";var Bo=Object.defineProperty,Vo=Object.defineProperties;var Wo=Object.getOwnPropertyDescriptors;var Rn=Object.getOwnPropertySymbols;var Ho=Object.prototype.hasOwnProperty,Ko=Object.prototype.propertyIsEnumerable;var Dn=e=>{throw TypeError(e)},Fn=Math.pow,Pn=(e,t,n)=>t in e?Bo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))Ho.call(t,n)&&Pn(e,n,t[n]);if(Rn)for(var n of Rn(t))Ko.call(t,n)&&Pn(e,n,t[n]);return e},y=(e,t)=>Vo(e,Wo(t));var jt=(e,t,n)=>t.has(e)||Dn("Cannot "+n);var v=(e,t,n)=>(jt(e,t,"read from private field"),n?n.call(e):t.get(e)),re=(e,t,n)=>t.has(e)?Dn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),X=(e,t,n,r)=>(jt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),j=(e,t,n)=>(jt(e,t,"access private method"),n);var k=(e,t,n)=>new Promise((r,o)=>{var i=c=>{try{s(n.next(c))}catch(u){o(u)}},a=c=>{try{s(n.throw(c))}catch(u){o(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,a);s((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Go=4,Cn=0,jn=1,qo=2;function Ve(e){let t=e.length;for(;--t>=0;)e[t]=0}const Xo=0,kr=1,Yo=2,Qo=3,ei=258,bn=29,dt=256,ot=dt+1+bn,De=30,wn=19,zr=2*ot+1,Se=15,Ut=16,ti=7,vn=256,Sr=16,Er=17,Tr=18,Gt=new Uint8Array([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]),zt=new Uint8Array([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]),ni=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),$r=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ri=512,de=new Array((ot+2)*2);Ve(de);const nt=new Array(De*2);Ve(nt);const it=new Array(ri);Ve(it);const at=new Array(ei-Qo+1);Ve(at);const kn=new Array(bn);Ve(kn);const Tt=new Array(De);Ve(Tt);function Lt(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}let Zr,Or,Ar;function Mt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const xr=e=>e<256?it[e]:it[256+(e>>>7)],st=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},B=(e,t,n)=>{e.bi_valid>Ut-n?(e.bi_buf|=t<<e.bi_valid&65535,st(e,e.bi_buf),e.bi_buf=t>>Ut-e.bi_valid,e.bi_valid+=n-Ut):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},ie=(e,t,n)=>{B(e,n[t*2],n[t*2+1])},Ir=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},oi=e=>{e.bi_valid===16?(st(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},ii=(e,t)=>{const n=t.dyn_tree,r=t.max_code,o=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,f,_,m,w=0;for(f=0;f<=Se;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;u<zr;u++)l=e.heap[u],f=n[n[l*2+1]*2+1]+1,f>c&&(f=c,w++),n[l*2+1]=f,!(l>r)&&(e.bl_count[f]++,_=0,l>=s&&(_=a[l-s]),m=n[l*2],e.opt_len+=m*(f+_),i&&(e.static_len+=m*(o[l*2+1]+_)));if(w!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,w-=2}while(w>0);for(f=c;f!==0;f--)for(l=e.bl_count[f];l!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),l--)}},Nr=(e,t,n)=>{const r=new Array(Se+1);let o=0,i,a;for(i=1;i<=Se;i++)o=o+n[i-1]<<1,r[i]=o;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=Ir(r[s]++,s))}},ai=()=>{let e,t,n,r,o;const i=new Array(Se+1);for(n=0,r=0;r<bn-1;r++)for(kn[r]=n,e=0;e<1<<Gt[r];e++)at[n++]=r;for(at[n-1]=r,o=0,r=0;r<16;r++)for(Tt[r]=o,e=0;e<1<<zt[r];e++)it[o++]=r;for(o>>=7;r<De;r++)for(Tt[r]=o<<7,e=0;e<1<<zt[r]-7;e++)it[256+o++]=r;for(t=0;t<=Se;t++)i[t]=0;for(e=0;e<=143;)de[e*2+1]=8,e++,i[8]++;for(;e<=255;)de[e*2+1]=9,e++,i[9]++;for(;e<=279;)de[e*2+1]=7,e++,i[7]++;for(;e<=287;)de[e*2+1]=8,e++,i[8]++;for(Nr(de,ot+1,i),e=0;e<De;e++)nt[e*2+1]=5,nt[e*2]=Ir(e,5);Zr=new Lt(de,Gt,dt+1,ot,Se),Or=new Lt(nt,zt,0,De,Se),Ar=new Lt(new Array(0),ni,0,wn,ti)},Rr=e=>{let t;for(t=0;t<ot;t++)e.dyn_ltree[t*2]=0;for(t=0;t<De;t++)e.dyn_dtree[t*2]=0;for(t=0;t<wn;t++)e.bl_tree[t*2]=0;e.dyn_ltree[vn*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Pr=e=>{e.bi_valid>8?st(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Un=(e,t,n,r)=>{const o=t*2,i=n*2;return e[o]<e[i]||e[o]===e[i]&&r[t]<=r[n]},Jt=(e,t,n)=>{const r=e.heap[n];let o=n<<1;for(;o<=e.heap_len&&(o<e.heap_len&&Un(t,e.heap[o+1],e.heap[o],e.depth)&&o++,!Un(t,r,e.heap[o],e.depth));)e.heap[n]=e.heap[o],n=o,o<<=1;e.heap[n]=r},Ln=(e,t,n)=>{let r,o,i=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+i++]&255,r+=(e.pending_buf[e.sym_buf+i++]&255)<<8,o=e.pending_buf[e.sym_buf+i++],r===0?ie(e,o,t):(a=at[o],ie(e,a+dt+1,t),s=Gt[a],s!==0&&(o-=kn[a],B(e,o,s)),r--,a=xr(r),ie(e,a,n),s=zt[a],s!==0&&(r-=Tt[a],B(e,r,s)));while(i<e.sym_next);ie(e,vn,t)},qt=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,i=t.stat_desc.elems;let a,s,c=-1,u;for(e.heap_len=0,e.heap_max=zr,a=0;a<i;a++)n[a*2]!==0?(e.heap[++e.heap_len]=c=a,e.depth[a]=0):n[a*2+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=c<2?++c:0,n[u*2]=1,e.depth[u]=0,e.opt_len--,o&&(e.static_len-=r[u*2+1]);for(t.max_code=c,a=e.heap_len>>1;a>=1;a--)Jt(e,n,a);u=i;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Jt(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,Jt(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ii(e,t),Nr(n,c,e.bl_count)},Mn=(e,t,n)=>{let r,o=-1,i,a=t[1],s=0,c=7,u=4;for(a===0&&(c=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)i=a,a=t[(r+1)*2+1],!(++s<c&&i===a)&&(s<u?e.bl_tree[i*2]+=s:i!==0?(i!==o&&e.bl_tree[i*2]++,e.bl_tree[Sr*2]++):s<=10?e.bl_tree[Er*2]++:e.bl_tree[Tr*2]++,s=0,o=i,a===0?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},Jn=(e,t,n)=>{let r,o=-1,i,a=t[1],s=0,c=7,u=4;for(a===0&&(c=138,u=3),r=0;r<=n;r++)if(i=a,a=t[(r+1)*2+1],!(++s<c&&i===a)){if(s<u)do ie(e,i,e.bl_tree);while(--s!==0);else i!==0?(i!==o&&(ie(e,i,e.bl_tree),s--),ie(e,Sr,e.bl_tree),B(e,s-3,2)):s<=10?(ie(e,Er,e.bl_tree),B(e,s-3,3)):(ie(e,Tr,e.bl_tree),B(e,s-11,7));s=0,o=i,a===0?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}},si=e=>{let t;for(Mn(e,e.dyn_ltree,e.l_desc.max_code),Mn(e,e.dyn_dtree,e.d_desc.max_code),qt(e,e.bl_desc),t=wn-1;t>=3&&e.bl_tree[$r[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ci=(e,t,n,r)=>{let o;for(B(e,t-257,5),B(e,n-1,5),B(e,r-4,4),o=0;o<r;o++)B(e,e.bl_tree[$r[o]*2+1],3);Jn(e,e.dyn_ltree,t-1),Jn(e,e.dyn_dtree,n-1)},ui=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Cn;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return jn;for(n=32;n<dt;n++)if(e.dyn_ltree[n*2]!==0)return jn;return Cn};let Bn=!1;const li=e=>{Bn||(ai(),Bn=!0),e.l_desc=new Mt(e.dyn_ltree,Zr),e.d_desc=new Mt(e.dyn_dtree,Or),e.bl_desc=new Mt(e.bl_tree,Ar),e.bi_buf=0,e.bi_valid=0,Rr(e)},Dr=(e,t,n,r)=>{B(e,(Xo<<1)+(r?1:0),3),Pr(e),st(e,n),st(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},fi=e=>{B(e,kr<<1,3),ie(e,vn,de),oi(e)},di=(e,t,n,r)=>{let o,i,a=0;e.level>0?(e.strm.data_type===qo&&(e.strm.data_type=ui(e)),qt(e,e.l_desc),qt(e,e.d_desc),a=si(e),o=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=o&&(o=i)):o=i=n+5,n+4<=o&&t!==-1?Dr(e,t,n,r):e.strategy===Go||i===o?(B(e,(kr<<1)+(r?1:0),3),Ln(e,de,nt)):(B(e,(Yo<<1)+(r?1:0),3),ci(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Ln(e,e.dyn_ltree,e.dyn_dtree)),Rr(e),r&&Pr(e)},hi=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(at[n]+dt+1)*2]++,e.dyn_dtree[xr(t)*2]++),e.sym_next===e.sym_end);var pi=li,_i=Dr,gi=di,mi=hi,yi=fi,bi={_tr_init:pi,_tr_stored_block:_i,_tr_flush_block:gi,_tr_tally:mi,_tr_align:yi};const wi=(e,t,n,r)=>{let o=e&65535|0,i=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do o=o+t[r++]|0,i=i+o|0;while(--a);o%=65521,i%=65521}return o|i<<16|0};var Fr=wi;const vi=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},ki=new Uint32Array(vi()),zi=(e,t,n,r)=>{const o=ki,i=r+n;e^=-1;for(let a=r;a<i;a++)e=e>>>8^o[(e^t[a])&255];return e^-1};var pe=zi,$t={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Cr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Si,_tr_stored_block:Xt,_tr_flush_block:Ei,_tr_tally:me,_tr_align:Ti}=bi,{Z_NO_FLUSH:ye,Z_PARTIAL_FLUSH:$i,Z_FULL_FLUSH:Zi,Z_FINISH:ee,Z_BLOCK:Vn,Z_OK:F,Z_STREAM_END:Wn,Z_STREAM_ERROR:se,Z_DATA_ERROR:Oi,Z_BUF_ERROR:Bt,Z_DEFAULT_COMPRESSION:Ai,Z_FILTERED:xi,Z_HUFFMAN_ONLY:yt,Z_RLE:Ii,Z_FIXED:Ni,Z_DEFAULT_STRATEGY:Ri,Z_UNKNOWN:Pi,Z_DEFLATED:Nt}=Cr,Di=9,Fi=15,Ci=8,ji=29,Ui=256,Yt=Ui+1+ji,Li=30,Mi=19,Ji=2*Yt+1,Bi=15,z=3,ge=258,ce=ge+z+1,Vi=32,Ue=42,zn=57,Qt=69,en=73,tn=91,nn=103,Ee=113,Xe=666,J=1,We=2,$e=3,He=4,Wi=3,Te=(e,t)=>(e.msg=$t[t],t),Hn=e=>e*2-(e>4?9:0),_e=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Hi=e=>{let t,n,r,o=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=o?n-o:0;while(--t);t=o,r=t;do n=e.prev[--r],e.prev[r]=n>=o?n-o:0;while(--t)};let Ki=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,be=Ki;const G=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},q=(e,t)=>{Ei(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,G(e.strm)},$=(e,t)=>{e.pending_buf[e.pending++]=t},qe=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},rn=(e,t,n,r)=>{let o=e.avail_in;return o>r&&(o=r),o===0?0:(e.avail_in-=o,t.set(e.input.subarray(e.next_in,e.next_in+o),n),e.state.wrap===1?e.adler=Fr(e.adler,t,o,n):e.state.wrap===2&&(e.adler=pe(e.adler,t,o,n)),e.next_in+=o,e.total_in+=o,o)},jr=(e,t)=>{let n=e.max_chain_length,r=e.strstart,o,i,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-ce?e.strstart-(e.w_size-ce):0,u=e.window,l=e.w_mask,d=e.prev,f=e.strstart+ge;let _=u[r+a-1],m=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(o=t,!(u[o+a]!==m||u[o+a-1]!==_||u[o]!==u[r]||u[++o]!==u[r+1])){r+=2,o++;do;while(u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&u[++r]===u[++o]&&r<f);if(i=ge-(f-r),r=f-ge,i>a){if(e.match_start=t,a=i,i>=s)break;_=u[r+a-1],m=u[r+a]}}while((t=d[t&l])>c&&--n!==0);return a<=e.lookahead?a:e.lookahead},Le=e=>{const t=e.w_size;let n,r,o;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ce)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Hi(e),r+=t),e.strm.avail_in===0)break;if(n=rn(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=z)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=be(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=be(e,e.ins_h,e.window[o+z-1]),e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<z)););}while(e.lookahead<ce&&e.strm.avail_in!==0)},Ur=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,o,i,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i||(i=e.strm.avail_out-i,o=e.strstart-e.block_start,r>o+e.strm.avail_in&&(r=o+e.strm.avail_in),r>i&&(r=i),r<n&&(r===0&&t!==ee||t===ye||r!==o+e.strm.avail_in)))break;a=t===ee&&r===o+e.strm.avail_in?1:0,Xt(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,G(e.strm),o&&(o>r&&(o=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+o),e.strm.next_out),e.strm.next_out+=o,e.strm.avail_out-=o,e.strm.total_out+=o,e.block_start+=o,r-=o),r&&(rn(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?He:t!==ye&&t!==ee&&e.strm.avail_in===0&&e.strstart===e.block_start?We:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(rn(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,o=e.strstart-e.block_start,(o>=n||(o||t===ee)&&t!==ye&&e.strm.avail_in===0&&o<=i)&&(r=o>i?i:o,a=t===ee&&e.strm.avail_in===0&&r===o?1:0,Xt(e,e.block_start,r,a),e.block_start+=r,G(e.strm)),a?$e:J)},Vt=(e,t)=>{let n,r;for(;;){if(e.lookahead<ce){if(Le(e),e.lookahead<ce&&t===ye)return J;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-ce&&(e.match_length=jr(e,n)),e.match_length>=z)if(r=me(e,e.strstart-e.match_start,e.match_length-z),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=z){e.match_length--;do e.strstart++,e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=be(e,e.ins_h,e.window[e.strstart+1]);else r=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=e.strstart<z-1?e.strstart:z-1,t===ee?(q(e,!0),e.strm.avail_out===0?$e:He):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:We},xe=(e,t)=>{let n,r,o;for(;;){if(e.lookahead<ce){if(Le(e),e.lookahead<ce&&t===ye)return J;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=z-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-ce&&(e.match_length=jr(e,n),e.match_length<=5&&(e.strategy===xi||e.match_length===z&&e.strstart-e.match_start>4096)&&(e.match_length=z-1)),e.prev_length>=z&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-z,r=me(e,e.strstart-1-e.prev_match,e.prev_length-z),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=o&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=z-1,e.strstart++,r&&(q(e,!1),e.strm.avail_out===0))return J}else if(e.match_available){if(r=me(e,0,e.window[e.strstart-1]),r&&q(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return J}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=me(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<z-1?e.strstart:z-1,t===ee?(q(e,!0),e.strm.avail_out===0?$e:He):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:We},Gi=(e,t)=>{let n,r,o,i;const a=e.window;for(;;){if(e.lookahead<=ge){if(Le(e),e.lookahead<=ge&&t===ye)return J;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=z&&e.strstart>0&&(o=e.strstart-1,r=a[o],r===a[++o]&&r===a[++o]&&r===a[++o])){i=e.strstart+ge;do;while(r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&o<i);e.match_length=ge-(i-o),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=z?(n=me(e,1,e.match_length-z),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=0,t===ee?(q(e,!0),e.strm.avail_out===0?$e:He):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:We},qi=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Le(e),e.lookahead===0)){if(t===ye)return J;break}if(e.match_length=0,n=me(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(q(e,!1),e.strm.avail_out===0))return J}return e.insert=0,t===ee?(q(e,!0),e.strm.avail_out===0?$e:He):e.sym_next&&(q(e,!1),e.strm.avail_out===0)?J:We};function oe(e,t,n,r,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=o}const Ye=[new oe(0,0,0,0,Ur),new oe(4,4,8,4,Vt),new oe(4,5,16,8,Vt),new oe(4,6,32,32,Vt),new oe(4,4,16,16,xe),new oe(8,16,32,32,xe),new oe(8,16,128,128,xe),new oe(8,32,128,256,xe),new oe(32,128,258,1024,xe),new oe(32,258,258,4096,xe)],Xi=e=>{e.window_size=2*e.w_size,_e(e.head),e.max_lazy_match=Ye[e.level].max_lazy,e.good_match=Ye[e.level].good_length,e.nice_match=Ye[e.level].nice_length,e.max_chain_length=Ye[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=z-1,e.match_available=0,e.ins_h=0};function Yi(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Nt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ji*2),this.dyn_dtree=new Uint16Array((2*Li+1)*2),this.bl_tree=new Uint16Array((2*Mi+1)*2),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Bi+1),this.heap=new Uint16Array(2*Yt+1),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Yt+1),_e(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ht=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ue&&t.status!==zn&&t.status!==Qt&&t.status!==en&&t.status!==tn&&t.status!==nn&&t.status!==Ee&&t.status!==Xe?1:0},Lr=e=>{if(ht(e))return Te(e,se);e.total_in=e.total_out=0,e.data_type=Pi;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?zn:t.wrap?Ue:Ee,e.adler=t.wrap===2?0:1,t.last_flush=-2,Si(t),F},Mr=e=>{const t=Lr(e);return t===F&&Xi(e.state),t},Qi=(e,t)=>ht(e)||e.state.wrap!==2?se:(e.state.gzhead=t,F),Jr=(e,t,n,r,o,i)=>{if(!e)return se;let a=1;if(t===Ai&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),o<1||o>Di||n!==Nt||r<8||r>15||t<0||t>9||i<0||i>Ni||r===8&&a!==1)return Te(e,se);r===8&&(r=9);const s=new Yi;return e.state=s,s.strm=e,s.status=Ue,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=o+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+z-1)/z),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<o+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=t,s.strategy=i,s.method=n,Mr(e)},ea=(e,t)=>Jr(e,t,Nt,Fi,Ci,Ri),ta=(e,t)=>{if(ht(e)||t>Vn||t<0)return e?Te(e,se):se;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Xe&&t!==ee)return Te(e,e.avail_out===0?Bt:se);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(G(e),e.avail_out===0)return n.last_flush=-1,F}else if(e.avail_in===0&&Hn(t)<=Hn(r)&&t!==ee)return Te(e,Bt);if(n.status===Xe&&e.avail_in!==0)return Te(e,Bt);if(n.status===Ue&&n.wrap===0&&(n.status=Ee),n.status===Ue){let o=Nt+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=yt||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,o|=i<<6,n.strstart!==0&&(o|=Vi),o+=31-o%31,qe(n,o),n.strstart!==0&&(qe(n,e.adler>>>16),qe(n,e.adler&65535)),e.adler=1,n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===zn){if(e.adler=0,$(n,31),$(n,139),$(n,8),n.gzhead)$(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),$(n,n.gzhead.time&255),$(n,n.gzhead.time>>8&255),$(n,n.gzhead.time>>16&255),$(n,n.gzhead.time>>24&255),$(n,n.level===9?2:n.strategy>=yt||n.level<2?4:0),$(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&($(n,n.gzhead.extra.length&255),$(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=pe(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Qt;else if($(n,0),$(n,0),$(n,0),$(n,0),$(n,0),$(n,n.level===9?2:n.strategy>=yt||n.level<2?4:0),$(n,Wi),n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===Qt){if(n.gzhead.extra){let o=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex+=s,G(e),n.pending!==0)return n.last_flush=-1,F;o=0,i-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=en}if(n.status===en){if(n.gzhead.name){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),G(e),n.pending!==0)return n.last_flush=-1,F;o=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,$(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=tn}if(n.status===tn){if(n.gzhead.comment){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o)),G(e),n.pending!==0)return n.last_flush=-1,F;o=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,$(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>o&&(e.adler=pe(e.adler,n.pending_buf,n.pending-o,o))}n.status=nn}if(n.status===nn){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(G(e),n.pending!==0))return n.last_flush=-1,F;$(n,e.adler&255),$(n,e.adler>>8&255),e.adler=0}if(n.status=Ee,G(e),n.pending!==0)return n.last_flush=-1,F}if(e.avail_in!==0||n.lookahead!==0||t!==ye&&n.status!==Xe){let o=n.level===0?Ur(n,t):n.strategy===yt?qi(n,t):n.strategy===Ii?Gi(n,t):Ye[n.level].func(n,t);if((o===$e||o===He)&&(n.status=Xe),o===J||o===$e)return e.avail_out===0&&(n.last_flush=-1),F;if(o===We&&(t===$i?Ti(n):t!==Vn&&(Xt(n,0,0,!1),t===Zi&&(_e(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),G(e),e.avail_out===0))return n.last_flush=-1,F}return t!==ee?F:n.wrap<=0?Wn:(n.wrap===2?($(n,e.adler&255),$(n,e.adler>>8&255),$(n,e.adler>>16&255),$(n,e.adler>>24&255),$(n,e.total_in&255),$(n,e.total_in>>8&255),$(n,e.total_in>>16&255),$(n,e.total_in>>24&255)):(qe(n,e.adler>>>16),qe(n,e.adler&65535)),G(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?F:Wn)},na=e=>{if(ht(e))return se;const t=e.state.status;return e.state=null,t===Ee?Te(e,Oi):F},ra=(e,t)=>{let n=t.length;if(ht(e))return se;const r=e.state,o=r.wrap;if(o===2||o===1&&r.status!==Ue||r.lookahead)return se;if(o===1&&(e.adler=Fr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){o===0&&(_e(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(t.subarray(n-r.w_size,n),0),t=c,n=r.w_size}const i=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Le(r);r.lookahead>=z;){let c=r.strstart,u=r.lookahead-(z-1);do r.ins_h=be(r,r.ins_h,r.window[c+z-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--u);r.strstart=c,r.lookahead=z-1,Le(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=z-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=i,r.wrap=o,F};var oa=ea,ia=Jr,aa=Mr,sa=Lr,ca=Qi,ua=ta,la=na,fa=ra,da="pako deflate (from Nodeca project)",rt={deflateInit:oa,deflateInit2:ia,deflateReset:aa,deflateResetKeep:sa,deflateSetHeader:ca,deflate:ua,deflateEnd:la,deflateSetDictionary:fa,deflateInfo:da};const ha=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var pa=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)ha(n,r)&&(e[r]=n[r])}}return e},_a=e=>{let t=0;for(let r=0,o=e.length;r<o;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,o=0,i=e.length;r<i;r++){let a=e[r];n.set(a,o),o+=a.length}return n},Br={assign:pa,flattenChunks:_a};let Vr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Vr=!1}const ct=new Uint8Array(256);for(let e=0;e<256;e++)ct[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;ct[254]=ct[254]=1;var ga=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,o,i,a=e.length,s=0;for(o=0;o<a;o++)n=e.charCodeAt(o),(n&64512)===55296&&o+1<a&&(r=e.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),i=0,o=0;i<s;o++)n=e.charCodeAt(o),(n&64512)===55296&&o+1<a&&(r=e.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t};const ma=(e,t)=>{if(t<65534&&e.subarray&&Vr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var ya=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,o;const i=new Array(n*2);for(o=0,r=0;r<n;){let a=e[r++];if(a<128){i[o++]=a;continue}let s=ct[a];if(s>4){i[o++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r<n;)a=a<<6|e[r++]&63,s--;if(s>1){i[o++]=65533;continue}a<65536?i[o++]=a:(a-=65536,i[o++]=55296|a>>10&1023,i[o++]=56320|a&1023)}return ma(i,o)},ba=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+ct[e[n]]>t?n:t},Wr={string2buf:ga,buf2string:ya,utf8border:ba};function wa(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var va=wa;const Hr=Object.prototype.toString,{Z_NO_FLUSH:ka,Z_SYNC_FLUSH:za,Z_FULL_FLUSH:Sa,Z_FINISH:Ea,Z_OK:Zt,Z_STREAM_END:Ta,Z_DEFAULT_COMPRESSION:$a,Z_DEFAULT_STRATEGY:Za,Z_DEFLATED:Oa}=Cr;function Rt(e){this.options=Br.assign({level:$a,method:Oa,chunkSize:16384,windowBits:15,memLevel:8,strategy:Za},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new va,this.strm.avail_out=0;let n=rt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Zt)throw new Error($t[n]);if(t.header&&rt.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Wr.string2buf(t.dictionary):Hr.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=rt.deflateSetDictionary(this.strm,r),n!==Zt)throw new Error($t[n]);this._dict_set=!0}}Rt.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let o,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?Ea:ka,typeof e=="string"?n.input=Wr.string2buf(e):Hr.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===za||i===Sa)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(o=rt.deflate(n,i),o===Ta)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),o=rt.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Zt;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Rt.prototype.onData=function(e){this.chunks.push(e)};Rt.prototype.onEnd=function(e){e===Zt&&(this.result=Br.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Aa(e,t){const n=new Rt(t);if(n.push(e,!0),n.err)throw n.msg||$t[n.err];return n.result}function xa(e,t){return t=t||{},t.gzip=!0,Aa(e,t)}var Ia=xa,Na={gzip:Ia};const{gzip:Ra}=Na;var Pa=Ra;class fe extends Error{constructor({name:t,reason:n,status:r,detail:o}){super(),this.name=t,this.message=n,this.detail=o,this.status=r}}class Kr extends Error{constructor(){super("Malformatted Figma Token")}}class Gr extends Error{constructor(){super("Missing Figma Token")}}class on extends Error{constructor(){super("Needs Reauth Figma Token")}}class an extends Error{constructor(){super("Expired Figma Token")}}class sn extends Error{constructor(){super("File Not Exportable")}}class cn extends Error{constructor({reason:t}){super("Unknown Forbidden Figma Error"),this.reason=t}}const qr="Not Found";class Xr extends Error{constructor({cause:t}){super(qr),this.cause=t}}const Da=e=>e.message===qr,Yr="Unknown Figma API Exception";class Qr extends Error{constructor({cause:t}){super(Yr),this.cause=t}}const Fa=e=>e.message===Yr,eo="Rate Limit Exceeded";class un extends Error{constructor({cause:t}){super(eo),this.cause=t}}const Ca=e=>e.message===eo,to="Request Too Large";class no extends Error{constructor({cause:t}){super(to),this.cause=t}}const ja=e=>e.message===to;function h(e,t,n){var s;function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const l=a.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){const _=d[f];_ in c||(c[_]=l[_].bind(c))}}const o=(s=n==null?void 0:n.Parent)!=null?s:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(c){var d;var u;const l=n!=null&&n.Parent?new i:this;r(l,c),(d=(u=l._zod).deferred)!=null||(u.deferred=[]);for(const f of l._zod.deferred)f();return l}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>{var u,l;return n!=null&&n.Parent&&c instanceof n.Parent?!0:(l=(u=c==null?void 0:c._zod)==null?void 0:u.traits)==null?void 0:l.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Fe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ro extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const oo={};function we(e){return oo}function io(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ln(e,t){return typeof t=="bigint"?t.toString():t}function Sn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function En(e){return e==null}function Tn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ua(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(o=Number.parseInt(c[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/Fn(10,i)}const Kn=Symbol("evaluating");function Z(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kn)return r===void 0&&(r=Kn,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ze(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ke(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Gn(e){return JSON.stringify(e)}function La(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ao="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ot(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ma=Sn(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function Me(e){if(Ot(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ot(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function so(e){return Me(e)?p({},e):Array.isArray(e)?[...e]:e}const Ja=new Set(["string","number","symbol"]);function Je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?y(p({},t),{error:()=>t.error}):t}function Ba(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Va={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Wa(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ke(e._zod.def,{get shape(){const a={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return Ze(this,"shape",a),a},checks:[]});return ze(e,i)}function Ha(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ke(e._zod.def,{get shape(){const a=p({},e._zod.def.shape);for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Ze(this,"shape",a),a},checks:[]});return ze(e,i)}function Ka(e,t){if(!Me(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ke(e._zod.def,{get shape(){const i=p(p({},e._zod.def.shape),t);return Ze(this,"shape",i),i}});return ze(e,o)}function Ga(e,t){if(!Me(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ke(e._zod.def,{get shape(){const r=p(p({},e._zod.def.shape),t);return Ze(this,"shape",r),r}});return ze(e,n)}function qa(e,t){const n=ke(e._zod.def,{get shape(){const r=p(p({},e._zod.def.shape),t._zod.def.shape);return Ze(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ze(e,n)}function Xa(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=ke(t._zod.def,{get shape(){const s=t._zod.def.shape,c=p({},s);if(n)for(const u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(const u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Ze(this,"shape",c),c},checks:[]});return ze(t,a)}function Ya(e,t,n){const r=ke(t._zod.def,{get shape(){const o=t._zod.def.shape,i=p({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Ze(this,"shape",i),i}});return ze(t,r)}function Re(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Pe(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function bt(e){return typeof e=="string"?e:e==null?void 0:e.message}function ve(e,t,n){var o,i,a,s,c,u,l,d,f,_,m;const r=y(p({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const w=(m=(_=(d=(u=bt((s=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:s.call(a,e)))!=null?u:bt((c=t==null?void 0:t.error)==null?void 0:c.call(t,e)))!=null?d:bt((l=n.customError)==null?void 0:l.call(n,e)))!=null?_:bt((f=n.localeError)==null?void 0:f.call(n,e)))!=null?m:"Invalid input";r.message=w}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function $n(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ut(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:p({},t)}const co=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ln,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},uo=h("$ZodError",co),lo=h("$ZodError",co,{Parent:Error});function Qa(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function es(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,s=0;for(;s<i.path.length;){const c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return r(e),n}const Zn=e=>(t,n,r,o)=>{var s;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Fe;if(a.issues.length){const c=new((s=o==null?void 0:o.Err)!=null?s:e)(a.issues.map(u=>ve(u,i,we())));throw ao(c,o==null?void 0:o.callee),c}return a.value},On=e=>(t,n,r,o)=>k(null,null,function*(){var s;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const c=new((s=o==null?void 0:o.Err)!=null?s:e)(a.issues.map(u=>ve(u,i,we())));throw ao(c,o==null?void 0:o.callee),c}return a.value}),Pt=e=>(t,n,r)=>{const o=r?y(p({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Fe;return i.issues.length?{success:!1,error:new(e!=null?e:uo)(i.issues.map(a=>ve(a,o,we())))}:{success:!0,data:i.value}},ts=Pt(lo),Dt=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ve(a,o,we())))}:{success:!0,data:i.value}}),ns=Dt(lo),rs=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zn(e)(t,n,o)},os=e=>(t,n,r)=>Zn(e)(t,n,r),is=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return On(e)(t,n,o)}),as=e=>(t,n,r)=>k(null,null,function*(){return On(e)(t,n,r)}),ss=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Pt(e)(t,n,o)},cs=e=>(t,n,r)=>Pt(e)(t,n,r),us=e=>(t,n,r)=>k(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Dt(e)(t,n,o)}),ls=e=>(t,n,r)=>k(null,null,function*(){return Dt(e)(t,n,r)}),fs=/^[cC][^\s-]{8,}$/,ds=/^[0-9a-z]+$/,hs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ps=/^[0-9a-vA-V]{20}$/,_s=/^[A-Za-z0-9]{27}$/,gs=/^[a-zA-Z0-9_-]{21}$/,ms=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ys=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ws="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vs(){return new RegExp(ws,"u")}const ks=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ss=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Es=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ts=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fo=/^[A-Za-z0-9_-]*$/,$s=/^\+[1-9]\d{6,14}$/,ho="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zs=new RegExp(`^${ho}$`);function po(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Os(e){return new RegExp(`^${po(e)}$`)}function As(e){const t=po({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ho}T(?:${r})$`)}const xs=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Is=/^-?\d+$/,_o=/^-?\d+(?:\.\d+)?$/,Ns=/^(?:true|false)$/i,Rs=/^[^A-Z]*$/,Ps=/^[^a-z]*$/,W=h("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),go={number:"number",bigint:"bigint",object:"date"},mo=h("$ZodCheckLessThan",(e,t)=>{W.init(e,t);const n=go[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yo=h("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);const n=go[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ds=h("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ua(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Fs=h("$ZodCheckNumberFormat",(e,t)=>{var a;W.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Va[t.format];e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,c.minimum=o,c.maximum=i,n&&(c.pattern=Is)}),e._zod.check=s=>{const c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Cs=h("$ZodCheckMaxLength",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!En(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const s=$n(i);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),js=h("$ZodCheckMinLength",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!En(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const s=$n(i);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Us=h("$ZodCheckLengthEquals",(e,t)=>{var r;var n;W.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!En(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const s=$n(i),c=a>t.length;o.issues.push(y(p({origin:s},c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),Ft=h("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;W.init(e,t),e._zod.onattach.push(a=>{var c;const s=a._zod.bag;s.format=t.format,t.pattern&&((c=s.patterns)!=null||(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(y(p({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),Ls=h("$ZodCheckRegex",(e,t)=>{Ft.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ms=h("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Rs),Ft.init(e,t)}),Js=h("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ps),Ft.init(e,t)}),Bs=h("$ZodCheckIncludes",(e,t)=>{W.init(e,t);const n=Je(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Vs=h("$ZodCheckStartsWith",(e,t)=>{var r;W.init(e,t);const n=new RegExp(`^${Je(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ws=h("$ZodCheckEndsWith",(e,t)=>{var r;W.init(e,t);const n=new RegExp(`.*${Je(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Ks{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
2
2
  `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){var i;const t=Function,n=this==null?void 0:this.args,o=[...((i=this==null?void 0:this.content)!=null?i:[""]).map(a=>` ${a}`)];return new t(...n,o.join(`
3
- `))}}const Vs={major:4,minor:3,patch:6},I=h("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vs;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const c of s._zod.onattach)c(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,l,d)=>{let f=Ne(u),_;for(const m of l){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(f)continue;const w=u.issues.length,O=m._zod.check(u);if(O instanceof Promise&&(d==null?void 0:d.async)===!1)throw new De;if(_||O instanceof Promise)_=(_!=null?_:Promise.resolve()).then(()=>k(null,null,function*(){yield O,u.issues.length!==w&&(f||(f=Ne(u,w)))}));else{if(u.issues.length===w)continue;f||(f=Ne(u,w))}}return _?_.then(()=>u):u},c=(u,l,d)=>{if(Ne(u))return u.aborted=!0,u;const f=s(l,r,d);if(f instanceof Promise){if(d.async===!1)throw new De;return f.then(_=>e._zod.parse(_,d))}return e._zod.parse(f,d)};e._zod.run=(u,l)=>{if(l.skipChecks)return e._zod.parse(u,l);if(l.direction==="backward"){const f=e._zod.parse({value:u.value,issues:[]},y(p({},l),{skipChecks:!0}));return f instanceof Promise?f.then(_=>c(_,u,l)):c(f,u,l)}const d=e._zod.parse(u,l);if(d instanceof Promise){if(l.async===!1)throw new De;return d.then(f=>s(f,r,l))}return s(d,r,l)}}Z(e,"~standard",()=>({validate:s=>{var c;try{const u=Xa(e,s);return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}}catch(u){return Ya(e,s).then(l=>{var d;return l.success?{value:l.data}:{issues:(d=l.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),$n=h("$ZodString",(e,t)=>{var n,r,o;I.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:$s(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(s){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),x=h("$ZodStringFormat",(e,t)=>{Rt.init(e,t),$n.init(e,t)}),Ws=h("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ps),x.init(e,t)}),Hs=h("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Wn(i))}else(r=t.pattern)!=null||(t.pattern=Wn());x.init(e,t)}),Ks=h("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=_s),x.init(e,t)}),Gs=h("$ZodURL",(e,t)=>{x.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),qs=h("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ms()),x.init(e,t)}),Xs=h("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ds),x.init(e,t)}),Ys=h("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ss),x.init(e,t)}),Qs=h("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cs),x.init(e,t)}),ec=h("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=us),x.init(e,t)}),tc=h("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ls),x.init(e,t)}),nc=h("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fs),x.init(e,t)}),rc=h("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ts(t)),x.init(e,t)}),oc=h("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ss),x.init(e,t)}),ic=h("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Es(t)),x.init(e,t)}),ac=h("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hs),x.init(e,t)}),sc=h("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ys),x.init(e,t),e._zod.bag.format="ipv4"}),cc=h("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bs),x.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),uc=h("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ws),x.init(e,t)}),lc=h("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=vs),x.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _o(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const fc=h("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ks),x.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{_o(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function dc(e){if(!so.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return _o(n)}const hc=h("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=so),x.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{dc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),pc=h("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zs),x.init(e,t)});function _c(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const gc=h("$ZodJWT",(e,t)=>{x.init(e,t),e._zod.check=n=>{_c(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),go=h("$ZodNumber",(e,t)=>{var n;I.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:lo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(p({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),mc=h("$ZodNumberFormat",(e,t)=>{Ns.init(e,t),go.init(e,t)}),yc=h("$ZodBoolean",(e,t)=>{I.init(e,t),e._zod.pattern=Os,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),bc=h("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=n=>n}),wc=h("$ZodNever",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Hn(e,t,n){e.issues.length&&t.issues.push(...Re(n,e.issues)),t.value[n]=e.value}const vc=h("$ZodArray",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const s=o[a],c=t.element._zod.run({value:s,issues:[]},r);c instanceof Promise?i.push(c.then(u=>Hn(u,n,a))):Hn(c,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function $t(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Re(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function mo(e){var r,o,i,a;const t=Object.keys(e.shape);for(const s of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[s])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=Ua(e.shape);return y(p({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function yo(e,t,n,r,o,i){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(const d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}const f=c.run({value:t[d],issues:[]},r);f instanceof Promise?e.push(f.then(_=>$t(_,n,d,t,l))):$t(f,n,d,t,l)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const kc=h("$ZodObject",(e,t)=>{I.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const s=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c=p({},s);return Object.defineProperty(t,"shape",{value:c}),c}})}const r=vn(()=>mo(t));Z(e._zod,"propValues",()=>{var u;const s=t.shape,c={};for(const l in s){const d=s[l]._zod;if(d.values){(u=c[l])!=null||(c[l]=new Set);for(const f of d.values)c[l].add(f)}}return c});const o=Tt,i=t.catchall;let a;e._zod.parse=(s,c)=>{a!=null||(a=r.value);const u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};const l=[],d=a.shape;for(const f of a.keys){const _=d[f],m=_._zod.optout==="optional",w=_._zod.run({value:u[f],issues:[]},c);w instanceof Promise?l.push(w.then(O=>$t(O,s,f,u,m))):$t(w,s,f,u,m)}return i?yo(l,u,s,c,r.value,e):l.length?Promise.all(l).then(()=>s):s}}),zc=h("$ZodObjectJIT",(e,t)=>{kc.init(e,t);const n=e._zod.parse,r=vn(()=>mo(t)),o=f=>{var K;const _=new Bs(["shape","payload","ctx"]),m=r.value,w=T=>{const S=Vn(T);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};_.write("const input = payload.value;");const O=Object.create(null);let U=0;for(const T of m.keys)O[T]=`key_${U++}`;_.write("const newResult = {};");for(const T of m.keys){const S=O[T],P=Vn(T),b=f[T],ue=((K=b==null?void 0:b._zod)==null?void 0:K.optout)==="optional";_.write(`const ${S} = ${w(T)};`),ue?_.write(`
3
+ `))}}const Gs={major:4,minor:3,patch:6},I=h("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gs;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const c of s._zod.onattach)c(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,l,d)=>{let f=Re(u),_;for(const m of l){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(f)continue;const w=u.issues.length,O=m._zod.check(u);if(O instanceof Promise&&(d==null?void 0:d.async)===!1)throw new Fe;if(_||O instanceof Promise)_=(_!=null?_:Promise.resolve()).then(()=>k(null,null,function*(){yield O,u.issues.length!==w&&(f||(f=Re(u,w)))}));else{if(u.issues.length===w)continue;f||(f=Re(u,w))}}return _?_.then(()=>u):u},c=(u,l,d)=>{if(Re(u))return u.aborted=!0,u;const f=s(l,r,d);if(f instanceof Promise){if(d.async===!1)throw new Fe;return f.then(_=>e._zod.parse(_,d))}return e._zod.parse(f,d)};e._zod.run=(u,l)=>{if(l.skipChecks)return e._zod.parse(u,l);if(l.direction==="backward"){const f=e._zod.parse({value:u.value,issues:[]},y(p({},l),{skipChecks:!0}));return f instanceof Promise?f.then(_=>c(_,u,l)):c(f,u,l)}const d=e._zod.parse(u,l);if(d instanceof Promise){if(l.async===!1)throw new Fe;return d.then(f=>s(f,r,l))}return s(d,r,l)}}Z(e,"~standard",()=>({validate:s=>{var c;try{const u=ts(e,s);return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}}catch(u){return ns(e,s).then(l=>{var d;return l.success?{value:l.data}:{issues:(d=l.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),An=h("$ZodString",(e,t)=>{var n,r,o;I.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:xs(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(s){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),x=h("$ZodStringFormat",(e,t)=>{Ft.init(e,t),An.init(e,t)}),qs=h("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ys),x.init(e,t)}),Xs=h("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=qn(i))}else(r=t.pattern)!=null||(t.pattern=qn());x.init(e,t)}),Ys=h("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bs),x.init(e,t)}),Qs=h("$ZodURL",(e,t)=>{x.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ec=h("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=vs()),x.init(e,t)}),tc=h("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gs),x.init(e,t)}),nc=h("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fs),x.init(e,t)}),rc=h("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ds),x.init(e,t)}),oc=h("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hs),x.init(e,t)}),ic=h("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ps),x.init(e,t)}),ac=h("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=_s),x.init(e,t)}),sc=h("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=As(t)),x.init(e,t)}),cc=h("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zs),x.init(e,t)}),uc=h("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Os(t)),x.init(e,t)}),lc=h("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ms),x.init(e,t)}),fc=h("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ks),x.init(e,t),e._zod.bag.format="ipv4"}),dc=h("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zs),x.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),hc=h("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ss),x.init(e,t)}),pc=h("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Es),x.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function bo(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const _c=h("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ts),x.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{bo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function gc(e){if(!fo.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return bo(n)}const mc=h("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fo),x.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{gc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yc=h("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=$s),x.init(e,t)});function bc(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const wc=h("$ZodJWT",(e,t)=>{x.init(e,t),e._zod.check=n=>{bc(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),wo=h("$ZodNumber",(e,t)=>{var n;I.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:_o,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(p({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),vc=h("$ZodNumberFormat",(e,t)=>{Fs.init(e,t),wo.init(e,t)}),kc=h("$ZodBoolean",(e,t)=>{I.init(e,t),e._zod.pattern=Ns,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),zc=h("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=n=>n}),Sc=h("$ZodNever",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Xn(e,t,n){e.issues.length&&t.issues.push(...Pe(n,e.issues)),t.value[n]=e.value}const Ec=h("$ZodArray",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const s=o[a],c=t.element._zod.run({value:s,issues:[]},r);c instanceof Promise?i.push(c.then(u=>Xn(u,n,a))):Xn(c,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function At(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Pe(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function vo(e){var r,o,i,a;const t=Object.keys(e.shape);for(const s of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[s])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=Ba(e.shape);return y(p({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function ko(e,t,n,r,o,i){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(const d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}const f=c.run({value:t[d],issues:[]},r);f instanceof Promise?e.push(f.then(_=>At(_,n,d,t,l))):At(f,n,d,t,l)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Tc=h("$ZodObject",(e,t)=>{I.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const s=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c=p({},s);return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Sn(()=>vo(t));Z(e._zod,"propValues",()=>{var u;const s=t.shape,c={};for(const l in s){const d=s[l]._zod;if(d.values){(u=c[l])!=null||(c[l]=new Set);for(const f of d.values)c[l].add(f)}}return c});const o=Ot,i=t.catchall;let a;e._zod.parse=(s,c)=>{a!=null||(a=r.value);const u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};const l=[],d=a.shape;for(const f of a.keys){const _=d[f],m=_._zod.optout==="optional",w=_._zod.run({value:u[f],issues:[]},c);w instanceof Promise?l.push(w.then(O=>At(O,s,f,u,m))):At(w,s,f,u,m)}return i?ko(l,u,s,c,r.value,e):l.length?Promise.all(l).then(()=>s):s}}),$c=h("$ZodObjectJIT",(e,t)=>{Tc.init(e,t);const n=e._zod.parse,r=Sn(()=>vo(t)),o=f=>{var K;const _=new Ks(["shape","payload","ctx"]),m=r.value,w=T=>{const S=Gn(T);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};_.write("const input = payload.value;");const O=Object.create(null);let U=0;for(const T of m.keys)O[T]=`key_${U++}`;_.write("const newResult = {};");for(const T of m.keys){const S=O[T],P=Gn(T),b=f[T],ue=((K=b==null?void 0:b._zod)==null?void 0:K.optout)==="optional";_.write(`const ${S} = ${w(T)};`),ue?_.write(`
4
4
  if (${S}.issues.length) {
5
5
  if (${P} in input) {
6
6
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
@@ -34,11 +34,11 @@
34
34
  newResult[${P}] = ${S}.value;
35
35
  }
36
36
 
37
- `)}_.write("payload.value = newResult;"),_.write("return payload;");const H=_.compile();return(T,S)=>H(f,T,S)};let i;const a=Tt,s=!eo.jitless,u=s&&Ca.value,l=t.catchall;let d;e._zod.parse=(f,_)=>{d!=null||(d=r.value);const m=f.value;return a(m)?s&&u&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(i||(i=o(t.shape)),f=i(f,_),l?yo([],m,f,_,d,e):f):n(f,_):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Kn(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Ne(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>ve(a,r,we())))}),t)}const Sc=h("$ZodUnion",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Z(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>zn(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const s=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Kn(c,o,e,i)):Kn(s,o,e,i)}}),Ec=h("$ZodIntersection",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Gn(n,c,u)):Gn(n,i,a)}});function cn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Le(e)&&Le(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=p(p({},e),t);for(const i of r){const a=cn(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=cn(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Gn(e,t,n){const r=new Map;let o;for(const s of t.issues)if(s.code==="unrecognized_keys"){o!=null||(o=s);for(const c of s.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(s);for(const s of n.issues)if(s.code==="unrecognized_keys")for(const c of s.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(s);const i=[...r].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push(y(p({},o),{keys:i})),Ne(e))return e;const a=cn(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Tc=h("$ZodRecord",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Le(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const s=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);const l=t.valueType._zod.run({value:o[u],issues:[]},r);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&n.issues.push(...Re(u,d.issues)),n.value[u]=d.value})):(l.issues.length&&n.issues.push(...Re(u,l.issues)),n.value[u]=l.value)}let c;for(const u in o)s.has(u)||(c=c!=null?c:[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&lo.test(s)&&c.issues.length){const d=t.keyType._zod.run({value:Number(s),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?n.value[s]=o[s]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>ve(d,r,we())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&n.issues.push(...Re(s,d.issues)),n.value[c.value]=d.value})):(l.issues.length&&n.issues.push(...Re(s,l.issues)),n.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),$c=h("$ZodEnum",(e,t)=>{I.init(e,t);const n=to(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ja.has(typeof o)).map(o=>typeof o=="string"?Me(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Zc=h("$ZodLiteral",(e,t)=>{if(I.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Me(r):r?Me(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Oc=h("$ZodTransform",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Qr(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new De;return n.value=o,n}});function qn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const bo=h("$ZodOptional",(e,t)=>{I.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Z(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>qn(i,n.value)):qn(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Ac=h("$ZodExactOptional",(e,t)=>{bo.init(e,t),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),xc=h("$ZodNullable",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zn(n.source)}|null)$`):void 0}),Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ic=h("$ZodDefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Xn(i,t)):Xn(o,t)}});function Xn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Nc=h("$ZodPrefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Rc=h("$ZodNonOptional",(e,t)=>{I.init(e,t),Z(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Yn(i,e)):Yn(o,e)}});function Yn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Pc=h("$ZodCatch",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(y(p({},n),{error:{issues:i.issues.map(a=>ve(a,r,we()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(y(p({},n),{error:{issues:o.issues.map(i=>ve(i,r,we()))},input:n.value})),n.issues=[]),n)}}),Dc=h("$ZodPipe",(e,t)=>{I.init(e,t),Z(e._zod,"values",()=>t.in._zod.values),Z(e._zod,"optin",()=>t.in._zod.optin),Z(e._zod,"optout",()=>t.out._zod.optout),Z(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>mt(a,t.in,r)):mt(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>mt(i,t.out,r)):mt(o,t.out,r)}});function mt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Fc=h("$ZodReadonly",(e,t)=>{I.init(e,t),Z(e._zod,"propValues",()=>t.innerType._zod.propValues),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Z(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Qn):Qn(o)}});function Qn(e){return e.value=Object.freeze(e.value),e}const Cc=h("$ZodCustom",(e,t)=>{W.init(e,t),I.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>er(i,n,r,e));er(o,n,r,e)}});function er(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(st(i))}}var tr;class jc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=p({},(r=this.get(n))!=null?r:{});delete o.id;const i=p(p({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Uc(){return new jc}var mr;(mr=(tr=globalThis).__zod_globalRegistry)!=null||(tr.__zod_globalRegistry=Uc());const Xe=globalThis.__zod_globalRegistry;function Lc(e,t){return new e(p({type:"string"},g(t)))}function Mc(e,t){return new e(p({type:"string",format:"email",check:"string_format",abort:!1},g(t)))}function nr(e,t){return new e(p({type:"string",format:"guid",check:"string_format",abort:!1},g(t)))}function Jc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1},g(t)))}function Bc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},g(t)))}function Vc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},g(t)))}function Wc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},g(t)))}function Hc(e,t){return new e(p({type:"string",format:"url",check:"string_format",abort:!1},g(t)))}function Kc(e,t){return new e(p({type:"string",format:"emoji",check:"string_format",abort:!1},g(t)))}function Gc(e,t){return new e(p({type:"string",format:"nanoid",check:"string_format",abort:!1},g(t)))}function qc(e,t){return new e(p({type:"string",format:"cuid",check:"string_format",abort:!1},g(t)))}function Xc(e,t){return new e(p({type:"string",format:"cuid2",check:"string_format",abort:!1},g(t)))}function Yc(e,t){return new e(p({type:"string",format:"ulid",check:"string_format",abort:!1},g(t)))}function Qc(e,t){return new e(p({type:"string",format:"xid",check:"string_format",abort:!1},g(t)))}function eu(e,t){return new e(p({type:"string",format:"ksuid",check:"string_format",abort:!1},g(t)))}function tu(e,t){return new e(p({type:"string",format:"ipv4",check:"string_format",abort:!1},g(t)))}function nu(e,t){return new e(p({type:"string",format:"ipv6",check:"string_format",abort:!1},g(t)))}function ru(e,t){return new e(p({type:"string",format:"cidrv4",check:"string_format",abort:!1},g(t)))}function ou(e,t){return new e(p({type:"string",format:"cidrv6",check:"string_format",abort:!1},g(t)))}function iu(e,t){return new e(p({type:"string",format:"base64",check:"string_format",abort:!1},g(t)))}function au(e,t){return new e(p({type:"string",format:"base64url",check:"string_format",abort:!1},g(t)))}function su(e,t){return new e(p({type:"string",format:"e164",check:"string_format",abort:!1},g(t)))}function cu(e,t){return new e(p({type:"string",format:"jwt",check:"string_format",abort:!1},g(t)))}function uu(e,t){return new e(p({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},g(t)))}function lu(e,t){return new e(p({type:"string",format:"date",check:"string_format"},g(t)))}function fu(e,t){return new e(p({type:"string",format:"time",check:"string_format",precision:null},g(t)))}function du(e,t){return new e(p({type:"string",format:"duration",check:"string_format"},g(t)))}function hu(e,t){return new e(p({type:"number",checks:[]},g(t)))}function pu(e,t){return new e(p({type:"number",check:"number_format",abort:!1,format:"safeint"},g(t)))}function _u(e,t){return new e(p({type:"boolean"},g(t)))}function gu(e){return new e({type:"unknown"})}function mu(e,t){return new e(p({type:"never"},g(t)))}function rr(e,t){return new ho(y(p({check:"less_than"},g(t)),{value:e,inclusive:!1}))}function Jt(e,t){return new ho(y(p({check:"less_than"},g(t)),{value:e,inclusive:!0}))}function or(e,t){return new po(y(p({check:"greater_than"},g(t)),{value:e,inclusive:!1}))}function Bt(e,t){return new po(y(p({check:"greater_than"},g(t)),{value:e,inclusive:!0}))}function ir(e,t){return new Is(y(p({check:"multiple_of"},g(t)),{value:e}))}function wo(e,t){return new Rs(y(p({check:"max_length"},g(t)),{maximum:e}))}function Zt(e,t){return new Ps(y(p({check:"min_length"},g(t)),{minimum:e}))}function vo(e,t){return new Ds(y(p({check:"length_equals"},g(t)),{length:e}))}function yu(e,t){return new Fs(y(p({check:"string_format",format:"regex"},g(t)),{pattern:e}))}function bu(e){return new Cs(p({check:"string_format",format:"lowercase"},g(e)))}function wu(e){return new js(p({check:"string_format",format:"uppercase"},g(e)))}function vu(e,t){return new Us(y(p({check:"string_format",format:"includes"},g(t)),{includes:e}))}function ku(e,t){return new Ls(y(p({check:"string_format",format:"starts_with"},g(t)),{prefix:e}))}function zu(e,t){return new Ms(y(p({check:"string_format",format:"ends_with"},g(t)),{suffix:e}))}function He(e){return new Js({check:"overwrite",tx:e})}function Su(e){return He(t=>t.normalize(e))}function Eu(){return He(e=>e.trim())}function Tu(){return He(e=>e.toLowerCase())}function $u(){return He(e=>e.toUpperCase())}function Zu(){return He(e=>Fa(e))}function Ou(e,t,n){return new e(p({type:"array",element:t},g(n)))}function Au(e,t,n){return new e(p({type:"custom",check:"custom",fn:t},g(n)))}function xu(e){const t=Iu(n=>(n.addIssue=r=>{var o,i,a,s;if(typeof r=="string")n.issues.push(st(r,n.value,t._zod.def));else{const c=r;c.fatal&&(c.continue=!1),(o=c.code)!=null||(c.code="custom"),(i=c.input)!=null||(c.input=n.value),(a=c.inst)!=null||(c.inst=t),(s=c.continue)!=null||(c.continue=!t._zod.def.abort),n.issues.push(st(c))}},e(n.value,n)));return t}function Iu(e,t){const n=new W(p({check:"custom"},g(t)));return n._zod.check=e,n}function ko(e){var n,r,o,i,a,s,c,u,l;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:Xe,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(s=e==null?void 0:e.io)!=null?s:"output",counter:0,seen:new Map,cycles:(c=e==null?void 0:e.cycles)!=null?c:"ref",reused:(u=e==null?void 0:e.reused)!=null?u:"inline",external:(l=e==null?void 0:e.external)!=null?l:void 0}}function F(e,t,n={path:[],schemaPath:[]}){var l,d,f;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const s=(d=(l=e._zod).toJSONSchema)==null?void 0:d.call(l);if(s)a.schema=s;else{const _=y(p({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,_);else{const w=a.schema,O=t.processors[o.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);O(e,t,w,_)}const m=e._zod.parent;m&&(a.ref||(a.ref=m),F(m,t,_),t.seen.get(m).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&M(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((f=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function zo(e,t){var a,s,c,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const l of e.seen.entries()){const d=(a=e.metadataRegistry.get(l[0]))==null?void 0:a.id;if(d){const f=r.get(d);if(f&&f!==l[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(d,l[0])}}const o=l=>{var w,O,U,H,K;const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(w=e.external.registry.get(l[0]))==null?void 0:w.id,S=(O=e.external.uri)!=null?O:(b=>b);if(T)return{ref:S(T)};const P=(H=(U=l[1].defId)!=null?U:l[1].schema.id)!=null?H:`schema${e.counter++}`;return l[1].defId=P,{defId:P,ref:`${S("__shared")}#/${d}/${P}`}}if(l[1]===n)return{ref:"#"};const _=`#/${d}/`,m=(K=l[1].schema.id)!=null?K:`__schema${e.counter++}`;return{defId:m,ref:_+m}},i=l=>{if(l[1].schema.$ref)return;const d=l[1],{ref:f,defId:_}=o(l);d.def=p({},d.schema),_&&(d.defId=_);const m=d.schema;for(const w in m)delete m[w];m.$ref=f};if(e.cycles==="throw")for(const l of e.seen.entries()){const d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${(s=d.cycle)==null?void 0:s.join("/")}/<root>
37
+ `)}_.write("payload.value = newResult;"),_.write("return payload;");const H=_.compile();return(T,S)=>H(f,T,S)};let i;const a=Ot,s=!oo.jitless,u=s&&Ma.value,l=t.catchall;let d;e._zod.parse=(f,_)=>{d!=null||(d=r.value);const m=f.value;return a(m)?s&&u&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(i||(i=o(t.shape)),f=i(f,_),l?ko([],m,f,_,d,e):f):n(f,_):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Yn(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Re(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>ve(a,r,we())))}),t)}const Zc=h("$ZodUnion",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Z(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Tn(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const s=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Yn(c,o,e,i)):Yn(s,o,e,i)}}),Oc=h("$ZodIntersection",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Qn(n,c,u)):Qn(n,i,a)}});function fn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Me(e)&&Me(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=p(p({},e),t);for(const i of r){const a=fn(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=fn(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Qn(e,t,n){const r=new Map;let o;for(const s of t.issues)if(s.code==="unrecognized_keys"){o!=null||(o=s);for(const c of s.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(s);for(const s of n.issues)if(s.code==="unrecognized_keys")for(const c of s.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(s);const i=[...r].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push(y(p({},o),{keys:i})),Re(e))return e;const a=fn(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Ac=h("$ZodRecord",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Me(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const s=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);const l=t.valueType._zod.run({value:o[u],issues:[]},r);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&n.issues.push(...Pe(u,d.issues)),n.value[u]=d.value})):(l.issues.length&&n.issues.push(...Pe(u,l.issues)),n.value[u]=l.value)}let c;for(const u in o)s.has(u)||(c=c!=null?c:[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&_o.test(s)&&c.issues.length){const d=t.keyType._zod.run({value:Number(s),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?n.value[s]=o[s]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>ve(d,r,we())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&n.issues.push(...Pe(s,d.issues)),n.value[c.value]=d.value})):(l.issues.length&&n.issues.push(...Pe(s,l.issues)),n.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),xc=h("$ZodEnum",(e,t)=>{I.init(e,t);const n=io(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ja.has(typeof o)).map(o=>typeof o=="string"?Je(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Ic=h("$ZodLiteral",(e,t)=>{if(I.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Je(r):r?Je(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Nc=h("$ZodTransform",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ro(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Fe;return n.value=o,n}});function er(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const zo=h("$ZodOptional",(e,t)=>{I.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Z(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>er(i,n.value)):er(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Rc=h("$ZodExactOptional",(e,t)=>{zo.init(e,t),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Pc=h("$ZodNullable",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)}|null)$`):void 0}),Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Dc=h("$ZodDefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>tr(i,t)):tr(o,t)}});function tr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Fc=h("$ZodPrefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Cc=h("$ZodNonOptional",(e,t)=>{I.init(e,t),Z(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>nr(i,e)):nr(o,e)}});function nr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jc=h("$ZodCatch",(e,t)=>{I.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(y(p({},n),{error:{issues:i.issues.map(a=>ve(a,r,we()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(y(p({},n),{error:{issues:o.issues.map(i=>ve(i,r,we()))},input:n.value})),n.issues=[]),n)}}),Uc=h("$ZodPipe",(e,t)=>{I.init(e,t),Z(e._zod,"values",()=>t.in._zod.values),Z(e._zod,"optin",()=>t.in._zod.optin),Z(e._zod,"optout",()=>t.out._zod.optout),Z(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>wt(a,t.in,r)):wt(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>wt(i,t.out,r)):wt(o,t.out,r)}});function wt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Lc=h("$ZodReadonly",(e,t)=>{I.init(e,t),Z(e._zod,"propValues",()=>t.innerType._zod.propValues),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Z(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(rr):rr(o)}});function rr(e){return e.value=Object.freeze(e.value),e}const Mc=h("$ZodCustom",(e,t)=>{W.init(e,t),I.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>or(i,n,r,e));or(o,n,r,e)}});function or(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(ut(i))}}var ir;class Jc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=p({},(r=this.get(n))!=null?r:{});delete o.id;const i=p(p({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bc(){return new Jc}var vr;(vr=(ir=globalThis).__zod_globalRegistry)!=null||(ir.__zod_globalRegistry=Bc());const Qe=globalThis.__zod_globalRegistry;function Vc(e,t){return new e(p({type:"string"},g(t)))}function Wc(e,t){return new e(p({type:"string",format:"email",check:"string_format",abort:!1},g(t)))}function ar(e,t){return new e(p({type:"string",format:"guid",check:"string_format",abort:!1},g(t)))}function Hc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1},g(t)))}function Kc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},g(t)))}function Gc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},g(t)))}function qc(e,t){return new e(p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},g(t)))}function Xc(e,t){return new e(p({type:"string",format:"url",check:"string_format",abort:!1},g(t)))}function Yc(e,t){return new e(p({type:"string",format:"emoji",check:"string_format",abort:!1},g(t)))}function Qc(e,t){return new e(p({type:"string",format:"nanoid",check:"string_format",abort:!1},g(t)))}function eu(e,t){return new e(p({type:"string",format:"cuid",check:"string_format",abort:!1},g(t)))}function tu(e,t){return new e(p({type:"string",format:"cuid2",check:"string_format",abort:!1},g(t)))}function nu(e,t){return new e(p({type:"string",format:"ulid",check:"string_format",abort:!1},g(t)))}function ru(e,t){return new e(p({type:"string",format:"xid",check:"string_format",abort:!1},g(t)))}function ou(e,t){return new e(p({type:"string",format:"ksuid",check:"string_format",abort:!1},g(t)))}function iu(e,t){return new e(p({type:"string",format:"ipv4",check:"string_format",abort:!1},g(t)))}function au(e,t){return new e(p({type:"string",format:"ipv6",check:"string_format",abort:!1},g(t)))}function su(e,t){return new e(p({type:"string",format:"cidrv4",check:"string_format",abort:!1},g(t)))}function cu(e,t){return new e(p({type:"string",format:"cidrv6",check:"string_format",abort:!1},g(t)))}function uu(e,t){return new e(p({type:"string",format:"base64",check:"string_format",abort:!1},g(t)))}function lu(e,t){return new e(p({type:"string",format:"base64url",check:"string_format",abort:!1},g(t)))}function fu(e,t){return new e(p({type:"string",format:"e164",check:"string_format",abort:!1},g(t)))}function du(e,t){return new e(p({type:"string",format:"jwt",check:"string_format",abort:!1},g(t)))}function hu(e,t){return new e(p({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},g(t)))}function pu(e,t){return new e(p({type:"string",format:"date",check:"string_format"},g(t)))}function _u(e,t){return new e(p({type:"string",format:"time",check:"string_format",precision:null},g(t)))}function gu(e,t){return new e(p({type:"string",format:"duration",check:"string_format"},g(t)))}function mu(e,t){return new e(p({type:"number",checks:[]},g(t)))}function yu(e,t){return new e(p({type:"number",check:"number_format",abort:!1,format:"safeint"},g(t)))}function bu(e,t){return new e(p({type:"boolean"},g(t)))}function wu(e){return new e({type:"unknown"})}function vu(e,t){return new e(p({type:"never"},g(t)))}function sr(e,t){return new mo(y(p({check:"less_than"},g(t)),{value:e,inclusive:!1}))}function Wt(e,t){return new mo(y(p({check:"less_than"},g(t)),{value:e,inclusive:!0}))}function cr(e,t){return new yo(y(p({check:"greater_than"},g(t)),{value:e,inclusive:!1}))}function Ht(e,t){return new yo(y(p({check:"greater_than"},g(t)),{value:e,inclusive:!0}))}function ur(e,t){return new Ds(y(p({check:"multiple_of"},g(t)),{value:e}))}function So(e,t){return new Cs(y(p({check:"max_length"},g(t)),{maximum:e}))}function xt(e,t){return new js(y(p({check:"min_length"},g(t)),{minimum:e}))}function Eo(e,t){return new Us(y(p({check:"length_equals"},g(t)),{length:e}))}function ku(e,t){return new Ls(y(p({check:"string_format",format:"regex"},g(t)),{pattern:e}))}function zu(e){return new Ms(p({check:"string_format",format:"lowercase"},g(e)))}function Su(e){return new Js(p({check:"string_format",format:"uppercase"},g(e)))}function Eu(e,t){return new Bs(y(p({check:"string_format",format:"includes"},g(t)),{includes:e}))}function Tu(e,t){return new Vs(y(p({check:"string_format",format:"starts_with"},g(t)),{prefix:e}))}function $u(e,t){return new Ws(y(p({check:"string_format",format:"ends_with"},g(t)),{suffix:e}))}function Ke(e){return new Hs({check:"overwrite",tx:e})}function Zu(e){return Ke(t=>t.normalize(e))}function Ou(){return Ke(e=>e.trim())}function Au(){return Ke(e=>e.toLowerCase())}function xu(){return Ke(e=>e.toUpperCase())}function Iu(){return Ke(e=>La(e))}function Nu(e,t,n){return new e(p({type:"array",element:t},g(n)))}function Ru(e,t,n){return new e(p({type:"custom",check:"custom",fn:t},g(n)))}function Pu(e){const t=Du(n=>(n.addIssue=r=>{var o,i,a,s;if(typeof r=="string")n.issues.push(ut(r,n.value,t._zod.def));else{const c=r;c.fatal&&(c.continue=!1),(o=c.code)!=null||(c.code="custom"),(i=c.input)!=null||(c.input=n.value),(a=c.inst)!=null||(c.inst=t),(s=c.continue)!=null||(c.continue=!t._zod.def.abort),n.issues.push(ut(c))}},e(n.value,n)));return t}function Du(e,t){const n=new W(p({check:"custom"},g(t)));return n._zod.check=e,n}function To(e){var n,r,o,i,a,s,c,u,l;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:Qe,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(s=e==null?void 0:e.io)!=null?s:"output",counter:0,seen:new Map,cycles:(c=e==null?void 0:e.cycles)!=null?c:"ref",reused:(u=e==null?void 0:e.reused)!=null?u:"inline",external:(l=e==null?void 0:e.external)!=null?l:void 0}}function D(e,t,n={path:[],schemaPath:[]}){var l,d,f;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const s=(d=(l=e._zod).toJSONSchema)==null?void 0:d.call(l);if(s)a.schema=s;else{const _=y(p({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,_);else{const w=a.schema,O=t.processors[o.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);O(e,t,w,_)}const m=e._zod.parent;m&&(a.ref||(a.ref=m),D(m,t,_),t.seen.get(m).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&M(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((f=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function $o(e,t){var a,s,c,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const l of e.seen.entries()){const d=(a=e.metadataRegistry.get(l[0]))==null?void 0:a.id;if(d){const f=r.get(d);if(f&&f!==l[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(d,l[0])}}const o=l=>{var w,O,U,H,K;const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(w=e.external.registry.get(l[0]))==null?void 0:w.id,S=(O=e.external.uri)!=null?O:(b=>b);if(T)return{ref:S(T)};const P=(H=(U=l[1].defId)!=null?U:l[1].schema.id)!=null?H:`schema${e.counter++}`;return l[1].defId=P,{defId:P,ref:`${S("__shared")}#/${d}/${P}`}}if(l[1]===n)return{ref:"#"};const _=`#/${d}/`,m=(K=l[1].schema.id)!=null?K:`__schema${e.counter++}`;return{defId:m,ref:_+m}},i=l=>{if(l[1].schema.$ref)return;const d=l[1],{ref:f,defId:_}=o(l);d.def=p({},d.schema),_&&(d.defId=_);const m=d.schema;for(const w in m)delete m[w];m.$ref=f};if(e.cycles==="throw")for(const l of e.seen.entries()){const d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${(s=d.cycle)==null?void 0:s.join("/")}/<root>
38
38
 
39
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const d=l[1];if(t===l[0]){i(l);continue}if(e.external){const _=(c=e.external.registry.get(l[0]))==null?void 0:c.id;if(t!==l[0]&&_){i(l);continue}}if((u=e.metadataRegistry.get(l[0]))==null?void 0:u.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&e.reused==="ref"){i(l);continue}}}function So(e,t){var a,s,c,u,l;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=d=>{var U,H,K;const f=e.seen.get(d);if(f.ref===null)return;const _=(U=f.def)!=null?U:f.schema,m=p({},_),w=f.ref;if(f.ref=null,w){r(w);const T=e.seen.get(w),S=T.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(_.allOf=(H=_.allOf)!=null?H:[],_.allOf.push(S)):Object.assign(_,S),Object.assign(_,m),d._zod.parent===w)for(const b in _)b==="$ref"||b==="allOf"||b in m||delete _[b];if(S.$ref&&T.def)for(const b in _)b==="$ref"||b==="allOf"||b in T.def&&JSON.stringify(_[b])===JSON.stringify(T.def[b])&&delete _[b]}const O=d._zod.parent;if(O&&O!==w){r(O);const T=e.seen.get(O);if(T!=null&&T.schema.$ref&&(_.$ref=T.schema.$ref,T.def))for(const S in _)S==="$ref"||S==="allOf"||S in T.def&&JSON.stringify(_[S])===JSON.stringify(T.def[S])&&delete _[S]}e.override({zodSchema:d,jsonSchema:_,path:(K=f.path)!=null?K:[]})};for(const d of[...e.seen.entries()].reverse())r(d[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const d=(s=e.external.registry.get(t))==null?void 0:s.id;if(!d)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(d)}Object.assign(o,(c=n.def)!=null?c:n.schema);const i=(l=(u=e.external)==null?void 0:u.defs)!=null?l:{};for(const d of e.seen.entries()){const f=d[1];f.def&&f.defId&&(i[f.defId]=f.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const d=JSON.parse(JSON.stringify(o));return Object.defineProperty(d,"~standard",{value:y(p({},t["~standard"]),{jsonSchema:{input:Ot(t,"input",e.processors),output:Ot(t,"output",e.processors)}}),enumerable:!1,writable:!1}),d}catch(d){throw new Error("Error converting schema to JSON.")}}function M(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return M(r.element,n);if(r.type==="set")return M(r.valueType,n);if(r.type==="lazy")return M(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return M(r.innerType,n);if(r.type==="intersection")return M(r.left,n)||M(r.right,n);if(r.type==="record"||r.type==="map")return M(r.keyType,n)||M(r.valueType,n);if(r.type==="pipe")return M(r.in,n)||M(r.out,n);if(r.type==="object"){for(const o in r.shape)if(M(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(M(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(M(o,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}const Nu=(e,t={})=>n=>{const r=ko(y(p({},n),{processors:t}));return F(e,r),zo(r,e),So(r,e)},Ot=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ko(y(p({},o!=null?o:{}),{target:i,io:t,processors:n}));return F(e,a),zo(a,e),So(a,e)},Ru={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pu=(e,t,n,r)=>{var l;const o=n;o.type="string";const{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=(l=Ru[s])!=null?l:s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>y(p({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:f.source}))])}},Du=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Fu=(e,t,n,r)=>{n.type="boolean"},Cu=(e,t,n,r)=>{n.not={}},ju=(e,t,n,r)=>{},Uu=(e,t,n,r)=>{const o=e._zod.def,i=to(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Lu=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},Mu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ju=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Bu=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=F(i.element,t,y(p({},r),{path:[...r.path,"items"]}))},Vu=(e,t,n,r)=>{var u;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const l in a)o.properties[l]=F(a[l],t,y(p({},r),{path:[...r.path,"properties",l]}));const s=new Set(Object.keys(a)),c=new Set([...s].filter(l=>{const d=i.shape[l]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),((u=i.catchall)==null?void 0:u._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=F(i.catchall,t,y(p({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Wu=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>F(s,t,y(p({},r),{path:[...r.path,i?"oneOf":"anyOf",c]})));i?n.oneOf=a:n.anyOf=a},Hu=(e,t,n,r)=>{const o=e._zod.def,i=F(o.left,t,y(p({},r),{path:[...r.path,"allOf",0]})),a=F(o.right,t,y(p({},r),{path:[...r.path,"allOf",1]})),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];n.allOf=c},Ku=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,s=a._zod.bag,c=s==null?void 0:s.patterns;if(i.mode==="loose"&&c&&c.size>0){const l=F(i.valueType,t,y(p({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=F(i.keyType,t,y(p({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=F(i.valueType,t,y(p({},r),{path:[...r.path,"additionalProperties"]}));const u=a._zod.values;if(u){const l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Gu=(e,t,n,r)=>{const o=e._zod.def,i=F(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},qu=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Xu=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Yu=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Qu=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(s){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},el=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;F(i,t,r);const a=t.seen.get(e);a.ref=i},tl=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Eo=(e,t,n,r)=>{const o=e._zod.def;F(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},nl=h("ZodISODateTime",(e,t)=>{rc.init(e,t),R.init(e,t)});function rl(e){return uu(nl,e)}const ol=h("ZodISODate",(e,t)=>{oc.init(e,t),R.init(e,t)});function il(e){return lu(ol,e)}const al=h("ZodISOTime",(e,t)=>{ic.init(e,t),R.init(e,t)});function sl(e){return fu(al,e)}const cl=h("ZodISODuration",(e,t)=>{ac.init(e,t),R.init(e,t)});function ul(e){return du(cl,e)}const ll=(e,t)=>{io.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>qa(e,n)},flatten:{value:n=>Ga(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,sn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,sn,2)}},isEmpty:{get(){return e.issues.length===0}}})},te=h("ZodError",ll,{Parent:Error}),fl=En(te),dl=Tn(te),hl=It(te),pl=Nt(te),_l=Qa(te),gl=es(te),ml=ts(te),yl=ns(te),bl=rs(te),wl=os(te),vl=is(te),kl=as(te),N=h("ZodType",(e,t)=>(I.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ot(e,"input"),output:Ot(e,"output")}}),e.toJSONSchema=Nu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(ke(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>ze(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>fl(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>hl(e,n,r),e.parseAsync=(n,r)=>k(null,null,function*(){return dl(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>k(null,null,function*(){return pl(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>_l(e,n,r),e.decode=(n,r)=>gl(e,n,r),e.encodeAsync=(n,r)=>k(null,null,function*(){return ml(e,n,r)}),e.decodeAsync=(n,r)=>k(null,null,function*(){return yl(e,n,r)}),e.safeEncode=(n,r)=>bl(e,n,r),e.safeDecode=(n,r)=>wl(e,n,r),e.safeEncodeAsync=(n,r)=>k(null,null,function*(){return vl(e,n,r)}),e.safeDecodeAsync=(n,r)=>k(null,null,function*(){return kl(e,n,r)}),e.refine=(n,r)=>e.check(yf(n,r)),e.superRefine=n=>e.check(bf(n)),e.overwrite=n=>e.check(He(n)),e.optional=()=>ur(e),e.exactOptional=()=>of(e),e.nullable=()=>lr(e),e.nullish=()=>ur(lr(e)),e.nonoptional=n=>ff(e,n),e.array=()=>ln(e),e.or=n=>Zo([e,n]),e.and=n=>Xl(e,n),e.transform=n=>fr(e,nf(n)),e.default=n=>cf(e,n),e.prefault=n=>lf(e,n),e.catch=n=>hf(e,n),e.pipe=n=>fr(e,n),e.readonly=()=>gf(e),e.describe=n=>{const r=e.clone();return Xe.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Xe.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xe.get(e);const r=e.clone();return Xe.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),To=h("_ZodString",(e,t)=>{var r,o,i;$n.init(e,t),N.init(e,t),e._zod.processJSONSchema=(a,s,c)=>Pu(e,a,s);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(yu(...a)),e.includes=(...a)=>e.check(vu(...a)),e.startsWith=(...a)=>e.check(ku(...a)),e.endsWith=(...a)=>e.check(zu(...a)),e.min=(...a)=>e.check(Zt(...a)),e.max=(...a)=>e.check(wo(...a)),e.length=(...a)=>e.check(vo(...a)),e.nonempty=(...a)=>e.check(Zt(1,...a)),e.lowercase=a=>e.check(bu(a)),e.uppercase=a=>e.check(wu(a)),e.trim=()=>e.check(Eu()),e.normalize=(...a)=>e.check(Su(...a)),e.toLowerCase=()=>e.check(Tu()),e.toUpperCase=()=>e.check($u()),e.slugify=()=>e.check(Zu())}),zl=h("ZodString",(e,t)=>{$n.init(e,t),To.init(e,t),e.email=n=>e.check(Mc(Sl,n)),e.url=n=>e.check(Hc(El,n)),e.jwt=n=>e.check(cu(Ul,n)),e.emoji=n=>e.check(Kc(Tl,n)),e.guid=n=>e.check(nr(ar,n)),e.uuid=n=>e.check(Jc(yt,n)),e.uuidv4=n=>e.check(Bc(yt,n)),e.uuidv6=n=>e.check(Vc(yt,n)),e.uuidv7=n=>e.check(Wc(yt,n)),e.nanoid=n=>e.check(Gc($l,n)),e.guid=n=>e.check(nr(ar,n)),e.cuid=n=>e.check(qc(Zl,n)),e.cuid2=n=>e.check(Xc(Ol,n)),e.ulid=n=>e.check(Yc(Al,n)),e.base64=n=>e.check(iu(Fl,n)),e.base64url=n=>e.check(au(Cl,n)),e.xid=n=>e.check(Qc(xl,n)),e.ksuid=n=>e.check(eu(Il,n)),e.ipv4=n=>e.check(tu(Nl,n)),e.ipv6=n=>e.check(nu(Rl,n)),e.cidrv4=n=>e.check(ru(Pl,n)),e.cidrv6=n=>e.check(ou(Dl,n)),e.e164=n=>e.check(su(jl,n)),e.datetime=n=>e.check(rl(n)),e.date=n=>e.check(il(n)),e.time=n=>e.check(sl(n)),e.duration=n=>e.check(ul(n))});function xe(e){return Lc(zl,e)}const R=h("ZodStringFormat",(e,t)=>{x.init(e,t),To.init(e,t)}),Sl=h("ZodEmail",(e,t)=>{Ks.init(e,t),R.init(e,t)}),ar=h("ZodGUID",(e,t)=>{Ws.init(e,t),R.init(e,t)}),yt=h("ZodUUID",(e,t)=>{Hs.init(e,t),R.init(e,t)}),El=h("ZodURL",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Tl=h("ZodEmoji",(e,t)=>{qs.init(e,t),R.init(e,t)}),$l=h("ZodNanoID",(e,t)=>{Xs.init(e,t),R.init(e,t)}),Zl=h("ZodCUID",(e,t)=>{Ys.init(e,t),R.init(e,t)}),Ol=h("ZodCUID2",(e,t)=>{Qs.init(e,t),R.init(e,t)}),Al=h("ZodULID",(e,t)=>{ec.init(e,t),R.init(e,t)}),xl=h("ZodXID",(e,t)=>{tc.init(e,t),R.init(e,t)}),Il=h("ZodKSUID",(e,t)=>{nc.init(e,t),R.init(e,t)}),Nl=h("ZodIPv4",(e,t)=>{sc.init(e,t),R.init(e,t)}),Rl=h("ZodIPv6",(e,t)=>{cc.init(e,t),R.init(e,t)}),Pl=h("ZodCIDRv4",(e,t)=>{uc.init(e,t),R.init(e,t)}),Dl=h("ZodCIDRv6",(e,t)=>{lc.init(e,t),R.init(e,t)}),Fl=h("ZodBase64",(e,t)=>{fc.init(e,t),R.init(e,t)}),Cl=h("ZodBase64URL",(e,t)=>{hc.init(e,t),R.init(e,t)}),jl=h("ZodE164",(e,t)=>{pc.init(e,t),R.init(e,t)}),Ul=h("ZodJWT",(e,t)=>{gc.init(e,t),R.init(e,t)}),$o=h("ZodNumber",(e,t)=>{var r,o,i,a,s,c,u,l,d;go.init(e,t),N.init(e,t),e._zod.processJSONSchema=(f,_,m)=>Du(e,f,_),e.gt=(f,_)=>e.check(or(f,_)),e.gte=(f,_)=>e.check(Bt(f,_)),e.min=(f,_)=>e.check(Bt(f,_)),e.lt=(f,_)=>e.check(rr(f,_)),e.lte=(f,_)=>e.check(Jt(f,_)),e.max=(f,_)=>e.check(Jt(f,_)),e.int=f=>e.check(sr(f)),e.safe=f=>e.check(sr(f)),e.positive=f=>e.check(or(0,f)),e.nonnegative=f=>e.check(Bt(0,f)),e.negative=f=>e.check(rr(0,f)),e.nonpositive=f=>e.check(Jt(0,f)),e.multipleOf=(f,_)=>e.check(ir(f,_)),e.step=(f,_)=>e.check(ir(f,_)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(c=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(s=n.exclusiveMaximum)!=null?s:Number.POSITIVE_INFINITY))!=null?c:null,e.isInt=((u=n.format)!=null?u:"").includes("int")||Number.isSafeInteger((l=n.multipleOf)!=null?l:.5),e.isFinite=!0,e.format=(d=n.format)!=null?d:null});function Ll(e){return hu($o,e)}const Ml=h("ZodNumberFormat",(e,t)=>{mc.init(e,t),$o.init(e,t)});function sr(e){return pu(Ml,e)}const Jl=h("ZodBoolean",(e,t)=>{yc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r)});function Y(e){return _u(Jl,e)}const Bl=h("ZodUnknown",(e,t)=>{bc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju()});function un(){return gu(Bl)}const Vl=h("ZodNever",(e,t)=>{wc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r)});function Wl(e){return mu(Vl,e)}const Hl=h("ZodArray",(e,t)=>{vc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Zt(n,r)),e.nonempty=n=>e.check(Zt(1,n)),e.max=(n,r)=>e.check(wo(n,r)),e.length=(n,r)=>e.check(vo(n,r)),e.unwrap=()=>e.element});function ln(e,t){return Ou(Hl,e,t)}const Kl=h("ZodObject",(e,t)=>{zc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,o),Z(e,"shape",()=>t.shape),e.keyof=()=>Ye(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(y(p({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(y(p({},e._zod.def),{catchall:un()})),e.loose=()=>e.clone(y(p({},e._zod.def),{catchall:un()})),e.strict=()=>e.clone(y(p({},e._zod.def),{catchall:Wl()})),e.strip=()=>e.clone(y(p({},e._zod.def),{catchall:void 0})),e.extend=n=>Ba(e,n),e.safeExtend=n=>Va(e,n),e.merge=n=>Wa(e,n),e.pick=n=>Ma(e,n),e.omit=n=>Ja(e,n),e.partial=(...n)=>Ha(Oo,e,n[0]),e.required=(...n)=>Ka(Ao,e,n[0])});function bt(e,t){const n=p({type:"object",shape:e!=null?e:{}},g(t));return new Kl(n)}const Gl=h("ZodUnion",(e,t)=>{Sc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e.options=t.options});function Zo(e,t){return new Gl(p({type:"union",options:e},g(t)))}const ql=h("ZodIntersection",(e,t)=>{Ec.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o)});function Xl(e,t){return new ql({type:"intersection",left:e,right:t})}const Yl=h("ZodRecord",(e,t)=>{Tc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ql(e,t,n){return new Yl(p({type:"record",keyType:e,valueType:t},g(n)))}const fn=h("ZodEnum",(e,t)=>{$c.init(e,t),N.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Uu(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new fn(y(p(y(p({},t),{checks:[]}),g(o)),{entries:i}))},e.exclude=(r,o)=>{const i=p({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new fn(y(p(y(p({},t),{checks:[]}),g(o)),{entries:i}))}});function Ye(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new fn(p({type:"enum",entries:n},g(t)))}const ef=h("ZodLiteral",(e,t)=>{Zc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cr(e,t){return new ef(p({type:"literal",values:Array.isArray(e)?e:[e]},g(t)))}const tf=h("ZodTransform",(e,t)=>{Oc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Qr(e.constructor.name);n.addIssue=i=>{var a,s,c;if(typeof i=="string")n.issues.push(st(i,n.value,t));else{const u=i;u.fatal&&(u.continue=!1),(a=u.code)!=null||(u.code="custom"),(s=u.input)!=null||(u.input=n.value),(c=u.inst)!=null||(u.inst=e),n.issues.push(st(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function nf(e){return new tf({type:"transform",transform:e})}const Oo=h("ZodOptional",(e,t)=>{bo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new Oo({type:"optional",innerType:e})}const rf=h("ZodExactOptional",(e,t)=>{Ac.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function of(e){return new rf({type:"optional",innerType:e})}const af=h("ZodNullable",(e,t)=>{xc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lr(e){return new af({type:"nullable",innerType:e})}const sf=h("ZodDefault",(e,t)=>{Ic.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cf(e,t){return new sf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ro(t)}})}const uf=h("ZodPrefault",(e,t)=>{Nc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e,t){return new uf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ro(t)}})}const Ao=h("ZodNonOptional",(e,t)=>{Rc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ff(e,t){return new Ao(p({type:"nonoptional",innerType:e},g(t)))}const df=h("ZodCatch",(e,t)=>{Pc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hf(e,t){return new df({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const pf=h("ZodPipe",(e,t)=>{Dc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,o),e.in=t.in,e.out=t.out});function fr(e,t){return new pf({type:"pipe",in:e,out:t})}const _f=h("ZodReadonly",(e,t)=>{Fc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function gf(e){return new _f({type:"readonly",innerType:e})}const mf=h("ZodCustom",(e,t)=>{Cc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mu(e,n)});function yf(e,t={}){return Au(mf,e,t)}function bf(e){return xu(e)}const wf=bt({language:Ye(["typescript","javascript"]).optional(),disableMarkedForExport:Y().optional(),allowAutoSelectFirstNode:Y().optional().default(!0),enableDisplayDataId:Y().optional(),enableDisplayDataName:Y().optional(),enableDisplayDataVariant:Y().optional()}).and(Zo([bt({framework:cr("react"),model:xe().optional(),styling:Ye(["plain_css","tailwind","inline_styles"]),uiLibrary:Ye(["mui","antd","radix","shadcn","clean_react","custom_design_system"]).optional(),responsivePages:ln(bt({name:xe(),framesId:ln(xe())})).optional(),enableUILibraryTheming:Y().optional(),enableCompactStructure:Y().optional(),enableDisplayScreenModelId:Y().optional(),enableGeneratePackageLock:Y().optional(),enableAnimationsPreset:Y().optional(),enableAutoSplit:Y().optional(),autoSplitThreshold:Ll().optional(),url:xe().url().optional(),codegenSettings:Ql(xe(),un()).optional(),designSystemId:xe().optional()}),bt({framework:cr("html"),styling:Ye(["plain_css","inline_styles","tailwind"]),enableTranslation:Y().optional()})])),xo=e=>{const t=wf.safeParse(e);if(t.success===!1){const n=new Error("Invalid codegen settings");throw n.cause=t.error,n}return t.data},Zn=(e,t)=>{if(e.id===t)return e;if("children"in e)for(const n of e.children){const r=Zn(n,t);if(r)return r}return null},dr=new Set(["FRAME","INSTANCE","COMPONENT","COMPONENT_SET","GROUP"]),Io=(e,t,n={allowAutoSelectFirstNode:!0})=>{const r=Zn(e.document,t);if(!r)return{isValid:!1,reason:"There is no node with the given id"};if(r.type==="CANVAS"){const o=r.children.filter(i=>dr.has(i.type));return o.length===0?{isValid:!1,reason:"Selected node is a page with no valid children"}:o.length===1?{isValid:!0,node:o[0],note:"Selected node is a page with a single valid children - returning it instead"}:n.allowAutoSelectFirstNode?{isValid:!0,node:o[0],note:"Selected node is a page with multiple valid children - returning the first one instead"}:{isValid:!1,reason:"Selected node is a page with multiple children"}}return dr.has(r.type)?{isValid:!0,node:r}:{isValid:!1,reason:"Selected node type is not supported"}};function vf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vt={exports:{}},kf=vt.exports,hr;function zf(){return hr||(hr=1,(function(e,t){(function(n,r){e.exports=r()})(kf,(function(){var n=typeof Promise=="function",r=(function(b){if(typeof globalThis=="object")return globalThis;Object.defineProperty(b,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var ue=typeDetectGlobalObject;return delete b.typeDetectGlobalObject,ue})(Object.prototype),o=typeof Symbol!="undefined",i=typeof Map!="undefined",a=typeof Set!="undefined",s=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",l=o&&typeof Symbol.iterator!="undefined",d=o&&typeof Symbol.toStringTag!="undefined",f=a&&typeof Set.prototype.entries=="function",_=i&&typeof Map.prototype.entries=="function",m=f&&Object.getPrototypeOf(new Set().entries()),w=_&&Object.getPrototypeOf(new Map().entries()),O=l&&typeof Array.prototype[Symbol.iterator]=="function",U=O&&Object.getPrototypeOf([][Symbol.iterator]()),H=l&&typeof String.prototype[Symbol.iterator]=="function",K=H&&Object.getPrototypeOf(""[Symbol.iterator]()),T=8,S=-1;function P(b){var ue=typeof b;if(ue!=="object")return ue;if(b===null)return"null";if(b===r)return"global";if(Array.isArray(b)&&(d===!1||!(Symbol.toStringTag in b)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&b===window.location)return"Location";if(typeof window.document=="object"&&b===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&b===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&b===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&b instanceof window.HTMLElement){if(b.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(b.tagName==="TD")return"HTMLTableDataCellElement";if(b.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=d&&b[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var D=Object.getPrototypeOf(b);return D===RegExp.prototype?"RegExp":D===Date.prototype?"Date":n&&D===Promise.prototype?"Promise":a&&D===Set.prototype?"Set":i&&D===Map.prototype?"Map":c&&D===WeakSet.prototype?"WeakSet":s&&D===WeakMap.prototype?"WeakMap":u&&D===DataView.prototype?"DataView":i&&D===w?"Map Iterator":a&&D===m?"Set Iterator":O&&D===U?"Array Iterator":H&&D===K?"String Iterator":D===null?"Object":Object.prototype.toString.call(b).slice(T,S)}return P}))})(vt)),vt.exports}var Sf=zf();const Ef=vf(Sf),On=typeof Buffer!="undefined",Tf=On&&typeof Buffer.from!="undefined",$f=On?function(t){return Buffer.isBuffer(t)}:function(){return!1},Zf=Tf?function(t){return Buffer.from(t)}:On?function(t){return new Buffer(t)}:function(t){return t};function Je(e){return $f(e)?"Buffer":Ef(e)}const Of=new Set(["Arguments","Array","Map","Object","Set"]);function Af(e,t,n=null){switch(n||Je(e)){case"Arguments":case"Array":case"Object":return e[t];case"Map":return e.get(t);case"Set":return t}}function dn(e){return Of.has(e)}function pr(e,t,n,r=null){switch(r||Je(e)){case"Arguments":case"Array":case"Object":e[t]=n;break;case"Map":e.set(t,n);break;case"Set":e.add(n);break}return e}const xf=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,If=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Nf=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Vt=xf||If||Nf||Function("return this")();function Rf(e){return e.slice(0)}function Pf(e){return new Boolean(e.valueOf())}function Df(e){return new DataView(e.buffer)}function Ff(e){return Zf(e)}function Cf(e){return new Date(e.getTime())}function jf(e){return new Number(e)}function Uf(e){return new RegExp(e.source,e.flags)}function Lf(e){return new String(e)}function le(e,t){return Vt[t].from?Vt[t].from(e):new Vt[t](e)}function L(e){return e}function _r(){return[]}function Mf(){return new Map}function Jf(){return{}}function Bf(){return new Set}const Vf=new Map([["ArrayBuffer",Rf],["Boolean",Pf],["Buffer",Ff],["DataView",Df],["Date",Cf],["Number",jf],["RegExp",Uf],["String",Lf],["Float32Array",le],["Float64Array",le],["Int16Array",le],["Int32Array",le],["Int8Array",le],["Uint16Array",le],["Uint32Array",le],["Uint8Array",le],["Uint8ClampedArray",le],["Array Iterator",L],["Map Iterator",L],["Promise",L],["Set Iterator",L],["String Iterator",L],["function",L],["global",L],["WeakMap",L],["WeakSet",L],["boolean",L],["null",L],["number",L],["string",L],["symbol",L],["undefined",L],["Arguments",_r],["Array",_r],["Map",Mf],["Object",Jf],["Set",Bf]]);function Wf(){}function hn(e,t=null,n=Wf){arguments.length===2&&typeof t=="function"&&(n=t,t=null);const r=t||Je(e),o=Vf.get(r);if(r==="Object"){const i=n(e,r);if(i!==void 0)return i}return o?o(e,r):e}function gr(e,t={}){typeof t=="function"&&(t={customizer:t});const{customizer:n}=t,r=Je(e);if(!dn(r))return pn(e,null,null,null);const o=hn(e,r,n),i=new WeakMap([[e,o]]),a=new WeakSet([e]);return pn(e,o,i,a)}function pn(e,t,n,r,o){const i=Je(e),a=hn(e,i);if(!dn(i))return a;let s;switch(i){case"Arguments":case"Array":s=Object.keys(e);break;case"Object":s=Object.keys(e),s.push(...Object.getOwnPropertySymbols(e));break;case"Map":case"Set":s=e.keys();break}for(let c of s){const u=Af(e,c,i);if(r.has(u))pr(t,c,n.get(u),i);else{const l=Je(u),d=hn(u,l);dn(l)&&(n.set(u,d),r.add(u)),pr(t,c,pn(u,d,n,r),i)}}return t}var ct,Fe,he,Q,V,_n,kt,Qe;class No{constructor({fetch:t=globalThis.fetch.bind(globalThis),baseAddress:n="https://api.figma.com/",defaultOptions:r={}}={}){re(this,V);re(this,ct);re(this,Fe);re(this,he);re(this,Q);X(this,ct,n),X(this,Fe,t),X(this,Q,r),X(this,he,v(this,Q)),r.token&&j(this,V,_n).call(this,r.token)}hasDefaultToken(){return!!v(this,Q).token}updateDefaultOptions(t){t.token&&j(this,V,_n).call(this,t.token),X(this,Q,p(p({},v(this,Q)),t)),X(this,he,v(this,Q))}withOptions(t){return X(this,he,p(p(p({},v(this,Q)),v(this,he)),t)),this}getHeaders(t){const n={"Content-Type":"application/json"},r=t!=null?t:v(this,Q).token;if(r!=null&&r.startsWith("figd_"))n["X-FIGMA-TOKEN"]=r;else if(r!=null&&r.startsWith("figu_"))n.Authorization=`Bearer ${r}`;else throw new Vr;return n}getFile(o){return k(this,arguments,function*({fileKey:t,nodeIds:n=[],depth:r}){const i=new URLSearchParams({plugin_data:"857346721138427857",geometry:"paths"});n.length>0&&i.append("ids",n.join(",")),r&&i.append("depth",`${r}`);const a=i.toString(),s=`v1/files/${t}?${a}`;return yield j(this,V,Qe).call(this,s)})}getNodeImages(a){return k(this,arguments,function*({fileKey:t,nodeIds:n,scale:r=1,as:o="arrayBuffer",format:i="jpg"}){const c=(yield j(this,V,Qe).call(this,`v1/images/${t}?ids=${n}&format=${i}&scale=${r}`)).images;if(o==="links")return c;const u=n.map(f=>k(this,null,function*(){const _=c[f];if(!_)return null;const m=yield v(this,Fe).call(this,_);return m.ok?yield m.arrayBuffer():null})),l=yield Promise.allSettled(u);return n.reduce((f,_,m)=>{const w=l[m];return w.status==="fulfilled"?f[_]=w.value:f[_]=null,f},{})})}getImageFills(n){return k(this,arguments,function*({fileKey:t}){var i,a;const r=`v1/files/${t}/images`;return(a=(i=(yield j(this,V,Qe).call(this,r)).meta)==null?void 0:i.images)!=null?a:{}})}getMe(){return k(this,null,function*(){return yield j(this,V,Qe).call(this,"v1/me")})}}ct=new WeakMap,Fe=new WeakMap,he=new WeakMap,Q=new WeakMap,V=new WeakSet,_n=function(t){if(!t.startsWith("figd_")&&!t.startsWith("figu_"))throw new Br},kt=function(t,n){return k(this,null,function*(){var o;const r=yield n();if(!r.ok){const i=r.status;let a=null;try{a=yield r.text()}catch(s){}if(i===403)throw a!=null&&a.includes("Invalid token")?new tn:a!=null&&a.includes("Token expired")?new nn:a!=null&&a.includes("File not exportable")?new rn:new on({reason:a});if(i===404)throw new Hr({cause:r});if(i===429){const s=r.headers.get("Retry-After"),c=s?Number(s):null;if(!c)throw new an({cause:r});if(yield(o=t.onRateLimited)==null?void 0:o.call(t,{retryAfter:c,figmaPlanTier:r.headers.get("X-Figma-Plan-Tier"),figmaRateLimitType:r.headers.get("X-Figma-Rate-Limit-Type")}))return new Promise((l,d)=>{var _;const f=setTimeout(()=>{var m;(m=t.abortSignal)!=null&&m.aborted||j(this,V,kt).call(this,t,n).then(l).catch(d)},c*1e3+1e3);(_=t.abortSignal)==null||_.addEventListener("abort",()=>{clearTimeout(f),d(new Error("The operation was aborted."))})});throw new an({cause:r})}else throw i===500&&(a!=null&&a.includes("Request too large"))?new Yr({cause:r}):new Gr({cause:r})}return r})},Qe=function(t){return k(this,null,function*(){const n=gr(v(this,he));X(this,he,gr(v(this,Q)));const r=()=>k(this,null,function*(){return yield v(this,Fe).call(this,`${v(this,ct)}${t}`,{method:"GET",headers:this.getHeaders(n.token),signal:n.abortSignal})});try{return yield(yield j(this,V,kt).call(this,n,r)).json()}catch(o){if(n.onForbidden&&(o instanceof tn||o instanceof nn||o instanceof rn||o instanceof on)){const i=yield n.onForbidden(o);if(i)return n.token=i.retry.newToken,yield(yield j(this,V,kt).call(this,n,r)).json()}throw o}})};const Hf={codegen:"f2c",l2c:"l2c",p2c:"p2c"};var A,Ce,ut,ae,Ro,Ie;class Kf{constructor({auth:t,apiBaseAddress:n="https://public-api.animaapp.com",figmaRestApi:r=new No}={}){re(this,ae);re(this,A);re(this,Ce);re(this,ut);X(this,Ce,n),X(this,ut,r),t&&(this.auth=t)}hasAuth(){return!!v(this,A)}set auth(t){X(this,A,t)}get headers(){const t={"Content-Type":"application/json"};return v(this,A)&&(t.Authorization=`Bearer ${v(this,A).token}`,"teamId"in v(this,A)&&(t["X-Team-Id"]=v(this,A).teamId)),t}generateCode(o){return k(this,arguments,function*(t,n={},r){var u;let i;try{i=yield v(this,ut).withOptions({token:t.figmaToken,abortSignal:r}).getFile({fileKey:t.fileKey})}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l}const a=xo(t.settings);i&&(yield j(this,ae,Ro).call(this,i,t.nodesId,{allowAutoSelectFirstNode:(u=a.allowAutoSelectFirstNode)!=null?u:!0}));let s=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(s!=null&&s.externalId||(s={externalId:v(this,A).userId}));const c={tracking:s,fileKey:t.fileKey,figmaToken:t.figmaToken,nodesId:t.nodesId,figmaRateLimitMaxWait:t.figmaRateLimitMaxWait,assetsStorage:t.assetsStorage,language:a.language,model:a.model,framework:a.framework,styling:a.styling,uiLibrary:a.uiLibrary,enableTranslation:a.enableTranslation,enableUILibraryTheming:a.enableUILibraryTheming,enableCompactStructure:a.enableCompactStructure,enableAutoSplit:a.enableAutoSplit,autoSplitThreshold:a.autoSplitThreshold,disableMarkedForExport:a.disableMarkedForExport,allowAutoSelectFirstNode:a.allowAutoSelectFirstNode,enableDisplayScreenModelId:a.enableDisplayScreenModelId,enableGeneratePackageLock:a.enableGeneratePackageLock,enableAnimationsPreset:a.enableAnimationsPreset,enableDisplayDataId:a.enableDisplayDataId,enableDisplayDataName:a.enableDisplayDataName,enableDisplayDataVariant:a.enableDisplayDataVariant,codegenSettings:a.codegenSettings,dsId:a.designSystemId,webhookUrl:t.webhookUrl,prompt:t.prompt,images:t.images,createSession:t.createSession};return j(this,ae,Ie).call(this,"POST","/v1/codegen",c,n,"codegen",r)})}generateCodeFromWebsite(o){return k(this,arguments,function*(t,n={},r){var u;let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));let a;if(t.mhtmlUrl)a={type:"hosted-mhtml",mhtmlUrl:t.mhtmlUrl,url:t.url};else if(t.mhtml)a={type:"mhtml",mhtml:t.mhtml,url:t.url};else if(t.url)a={type:"url",url:t.url};else throw new Error("Either 'url', 'mhtml' or 'mhtmlUrl' must be provided");let s;t.experimental_useNewReactEngine&&(s="react-v2");const c={tracking:i,assetsStorage:t.assetsStorage,prompt:t.prompt,images:t.images,dsId:t.dsId,params:p({input:a,conventions:{framework:t.settings.framework,language:t.settings.language,styling:t.settings.styling},assetsStorage:{type:"bundled"},engine:s,htmlOptimizations:t.htmlOptimizations,subpages:t.subpages},(u=t.settings.codegenSettings)!=null?u:{})};return j(this,ae,Ie).call(this,"POST","/v1/l2c",c,n,"l2c",r)})}discoverSubpages(t,n){return k(this,null,function*(){if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const r=yield fetch(`${v(this,Ce)}/v1/l2c/discover-subpages`,{method:"POST",headers:this.headers,body:JSON.stringify(t),signal:n});if(!r.ok){const o=yield r.text();let i=o;try{const a=JSON.parse(o);typeof(a==null?void 0:a.error)=="string"?i=a.error:typeof(a==null?void 0:a.message)=="string"&&(i=a.message)}catch(a){}throw new fe({name:"HTTP error from Anima API",reason:i||"Failed to discover website subpages",status:r.status})}return r.json()})}generateCodeFromPrompt(o){return k(this,arguments,function*(t,n={},r){var s;let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));const a={tracking:i,assetsStorage:t.assetsStorage,params:p({prompt:t.prompt,guidelines:t.guidelines,images:t.images,conventions:{language:t.settings.language,framework:t.settings.framework,styling:t.settings.styling,uiLibrary:t.settings.uiLibrary},dsId:t.settings.dsId,fastMode:t.settings.fastMode,imageMode:t.settings.imageMode},(s=t.settings.codegenSettings)!=null?s:{}),webhookUrl:t.webhookUrl};return j(this,ae,Ie).call(this,"POST","/v1/p2c",a,n,"p2c",r)})}generateLink2Code(o){return k(this,arguments,function*(t,n={},r){let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));const a={tracking:i,assetsStorage:t.assetsStorage,params:t.params};return j(this,ae,Ie).call(this,"POST","/v1/l2c",a,n,"l2c",r)})}attachToGenerationJob(o){return k(this,arguments,function*(t,n={},r){const i={};return j(this,ae,Ie).call(this,"GET",`/v1/jobs/${t.sessionId}`,i,n,void 0,r)})}}A=new WeakMap,Ce=new WeakMap,ut=new WeakMap,ae=new WeakSet,Ro=function(t,n,r){return k(this,null,function*(){const i=n.map(a=>Io(t,a,r)).find(a=>!a.isValid);if(i)throw new fe({name:"Task Crashed",reason:i.reason})})},Ie=function(t,n,r,o,i,a){return k(this,null,function*(){var w,O,U,H,K,T,S,P,b,ue,Oe;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const s={},c={method:t,headers:y(p({},this.headers),{Accept:"text/event-stream"}),signal:a};if(t==="POST"){const D=xa(JSON.stringify(r));c.body=D,c.headers=y(p({},c.headers),{"Content-Encoding":"gzip","Content-Type":"application/json"})}const u=yield fetch(`${v(this,Ce)}${n}`,c);if(!u.ok){const D=yield u.text();let ne;try{ne=JSON.parse(D)}catch(Pt){}throw((w=ne==null?void 0:ne.error)==null?void 0:w.name)==="ZodError"?(console.log("Zod validation error:",JSON.stringify(ne.error.issues,null,2)),new fe({name:"HTTP error from Anima API",reason:"Invalid body payload",detail:ne.error.issues,status:u.status})):typeof ne=="object"?new fe({name:`Error "${ne}"`,reason:"Unknown",status:u.status}):new fe({name:"HTTP error from Anima API",reason:D,status:u.status})}if(!u.body)throw new fe({name:"Stream Error",reason:"Response body is null",status:u.status});const l=u.headers.get("x-anima-job-type"),d=l&&Hf[l];d&&typeof o=="function"&&o({type:"set_job_type",payload:{jobType:d}});const f=u.body.getReader(),_=new TextDecoder;let m="";try{for(;;){const{done:D,value:ne}=yield f.read();if(D)break;m+=_.decode(ne,{stream:!0});const Pt=m.split(`
40
- `);m=Pt.pop()||"";for(const pt of Pt)if(!(!pt.trim()||pt.startsWith(":"))&&pt.startsWith("data: ")){let E;try{E=JSON.parse(pt.slice(6))}catch(sd){continue}switch(E.type){case"queueing":{typeof o=="function"?o(E):(O=o.onQueueing)==null||O.call(o,{sessionId:E.sessionId});break}case"start":{s.sessionId=E.sessionId,typeof o=="function"?o(E):(U=o.onStart)==null||U.call(o,{sessionId:E.sessionId});break}case"pre_codegen":{i==="codegen"&&(typeof o=="function"?o(E):(H=o.onPreCodegen)==null||H.call(o,{message:E.message}));break}case"assets_uploaded":{typeof o=="function"?o(E):(K=o.onAssetsUploaded)==null||K.call(o);break}case"assets_list":{s.assets=E.payload.assets,typeof o=="function"?o(E):(T=o.onAssetsList)==null||T.call(o,E.payload);break}case"figma_metadata":{i==="codegen"&&(s.figmaFileName=E.figmaFileName,s.figmaSelectedFrameName=E.figmaSelectedFrameName,typeof o=="function"?o(E):(S=o.onFigmaMetadata)==null||S.call(o,{figmaFileName:E.figmaFileName,figmaSelectedFrameName:E.figmaSelectedFrameName}));break}case"generating_code":{E.payload.status==="success"&&(s.files=E.payload.files),typeof o=="function"?o(E):(P=o.onGeneratingCode)==null||P.call(o,{status:E.payload.status,progress:E.payload.progress,files:E.payload.files});break}case"progress_messages_updated":{typeof o=="function"?o(E):(b=o.onProgressMessagesUpdated)==null||b.call(o,E.payload.progressMessages);break}case"job_status_updated":{typeof o=="function"?o(E):(ue=o.onJobStatusUpdated)==null||ue.call(o,E.payload.jobStatus);break}case"codegen_completed":case"generation_completed":{typeof o=="function"?o(E):(Oe=o.onCodegenCompleted)==null||Oe.call(o);break}case"error":throw new fe({name:E.payload.errorName,reason:E.payload.reason});case"done":return s.tokenUsage=E.payload.tokenUsage,s.sessionId=E.payload.sessionId,s}}}}finally{f.cancel()}throw new fe({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})};const Gf=e=>{var t;if(!e)return[!1,"",""];try{const n=new URL(e),r=n.pathname;if(n.origin!=="https://www.figma.com"&&n.origin!=="https://embed.figma.com")return[!1,"",""];const o=n.toString();if(e!==o)return[!1,"",""];const i=((t=n.searchParams.get("node-id"))!=null?t:"").replace(/-/g,":"),a=r.split("/")[2];return[(r.startsWith("/file/")&&n.searchParams.get("type")!=="whiteboard"||r.startsWith("/design/")||r.startsWith("/proto/"))&&a.length===22,a,i]}catch(n){return[!1,"",""]}},qf=({fileKey:e,nodeId:t,duplicate:n})=>{const r=new URL("https://www.figma.com");return r.pathname=`design/${e}`,n&&(r.pathname=`${r.pathname}/dummy/duplicate`),t&&r.searchParams.set("node-id",t.replace(":","-")),r};class Xf extends Error{constructor(t,n){super(t),this.response=n}}const Yf=({files:e,screenPath:t="src/screens"})=>{const n={},r=new Set;function o(i){if(r.has(i)||!e[i])return;r.add(i),n[i]=e[i],Qf(e[i].content).forEach(s=>{try{const c=ed(i,s);if(c.startsWith("src/")){const u=c.split("/").slice(0,-1).join("/");td(e,u).forEach(d=>{r.has(d)||o(d)})}}catch(c){console.warn(`Failed to resolve import ${s} in ${i}:`,c)}})}return Object.entries(e).forEach(([i,a])=>{i.startsWith(t)?o(i):i.startsWith("src/")||(n[i]=a)}),n};function Qf(e){const t=/import.*?["']([^"']+)["']/g,n=/export.*from\s+["']([^"']+)["']/g,r=[];let o;for(;(o=t.exec(e))!==null;)r.push(o[1]);for(;(o=n.exec(e))!==null;)r.push(o[1]);return[...new Set(r)]}function ed(e,t){if(!t.startsWith("."))return t;const n=e.split("/").slice(0,-1),r=t.split("/"),o=[...n];for(const i of r)i===".."?o.pop():i!=="."&&o.push(i);return o.join("/")}function td(e,t){return Object.keys(e).filter(n=>n.startsWith(t))}function dt(e,t,n){return new ReadableStream({start(r){n.call(e,t,o=>{o.type==="error"||r.enqueue(o),(o.type==="aborted"||o.type==="error")&&r.close()}).then(o=>{r.enqueue({type:"done",payload:{tokenUsage:o.tokenUsage,sessionId:o.sessionId}}),r.close()}).catch(o=>{r.enqueue({type:"error",payload:{name:"name"in o?o.name:"Unknown error",message:"message"in o?o.message:"Unknown",status:"status"in o?o.status:void 0,detail:"detail"in o?o.detail:void 0,errorPayload:"payload"in o?o.payload:void 0}}),r.close()})}})}const Po=(e,t)=>dt(e,t,e.generateCode);function ht(e){return k(this,null,function*(){var a,s,c,u;const[t,n]=e.tee(),r=yield t.getReader().read();if(r.done||!r.value||r.value.type==="error"&&((a=r.value.payload)!=null&&a.status))return new Response(JSON.stringify(r.value),{status:((s=r.value)==null?void 0:s.type)==="error"&&(u=(c=r.value.payload)==null?void 0:c.status)!=null?u:500,headers:{"Content-Type":"application/json"}});const o=new TextEncoder,i=n.pipeThrough(new TransformStream({transform(l,d){const f=`event: ${l.type}
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const d=l[1];if(t===l[0]){i(l);continue}if(e.external){const _=(c=e.external.registry.get(l[0]))==null?void 0:c.id;if(t!==l[0]&&_){i(l);continue}}if((u=e.metadataRegistry.get(l[0]))==null?void 0:u.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&e.reused==="ref"){i(l);continue}}}function Zo(e,t){var a,s,c,u,l;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=d=>{var U,H,K;const f=e.seen.get(d);if(f.ref===null)return;const _=(U=f.def)!=null?U:f.schema,m=p({},_),w=f.ref;if(f.ref=null,w){r(w);const T=e.seen.get(w),S=T.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(_.allOf=(H=_.allOf)!=null?H:[],_.allOf.push(S)):Object.assign(_,S),Object.assign(_,m),d._zod.parent===w)for(const b in _)b==="$ref"||b==="allOf"||b in m||delete _[b];if(S.$ref&&T.def)for(const b in _)b==="$ref"||b==="allOf"||b in T.def&&JSON.stringify(_[b])===JSON.stringify(T.def[b])&&delete _[b]}const O=d._zod.parent;if(O&&O!==w){r(O);const T=e.seen.get(O);if(T!=null&&T.schema.$ref&&(_.$ref=T.schema.$ref,T.def))for(const S in _)S==="$ref"||S==="allOf"||S in T.def&&JSON.stringify(_[S])===JSON.stringify(T.def[S])&&delete _[S]}e.override({zodSchema:d,jsonSchema:_,path:(K=f.path)!=null?K:[]})};for(const d of[...e.seen.entries()].reverse())r(d[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const d=(s=e.external.registry.get(t))==null?void 0:s.id;if(!d)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(d)}Object.assign(o,(c=n.def)!=null?c:n.schema);const i=(l=(u=e.external)==null?void 0:u.defs)!=null?l:{};for(const d of e.seen.entries()){const f=d[1];f.def&&f.defId&&(i[f.defId]=f.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const d=JSON.parse(JSON.stringify(o));return Object.defineProperty(d,"~standard",{value:y(p({},t["~standard"]),{jsonSchema:{input:It(t,"input",e.processors),output:It(t,"output",e.processors)}}),enumerable:!1,writable:!1}),d}catch(d){throw new Error("Error converting schema to JSON.")}}function M(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return M(r.element,n);if(r.type==="set")return M(r.valueType,n);if(r.type==="lazy")return M(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return M(r.innerType,n);if(r.type==="intersection")return M(r.left,n)||M(r.right,n);if(r.type==="record"||r.type==="map")return M(r.keyType,n)||M(r.valueType,n);if(r.type==="pipe")return M(r.in,n)||M(r.out,n);if(r.type==="object"){for(const o in r.shape)if(M(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(M(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(M(o,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}const Fu=(e,t={})=>n=>{const r=To(y(p({},n),{processors:t}));return D(e,r),$o(r,e),Zo(r,e)},It=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=To(y(p({},o!=null?o:{}),{target:i,io:t,processors:n}));return D(e,a),$o(a,e),Zo(a,e)},Cu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ju=(e,t,n,r)=>{var l;const o=n;o.type="string";const{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=(l=Cu[s])!=null?l:s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>y(p({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:f.source}))])}},Uu=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Lu=(e,t,n,r)=>{n.type="boolean"},Mu=(e,t,n,r)=>{n.not={}},Ju=(e,t,n,r)=>{},Bu=(e,t,n,r)=>{const o=e._zod.def,i=io(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Vu=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},Wu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Hu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ku=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=D(i.element,t,y(p({},r),{path:[...r.path,"items"]}))},Gu=(e,t,n,r)=>{var u;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const l in a)o.properties[l]=D(a[l],t,y(p({},r),{path:[...r.path,"properties",l]}));const s=new Set(Object.keys(a)),c=new Set([...s].filter(l=>{const d=i.shape[l]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),((u=i.catchall)==null?void 0:u._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,y(p({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},qu=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>D(s,t,y(p({},r),{path:[...r.path,i?"oneOf":"anyOf",c]})));i?n.oneOf=a:n.anyOf=a},Xu=(e,t,n,r)=>{const o=e._zod.def,i=D(o.left,t,y(p({},r),{path:[...r.path,"allOf",0]})),a=D(o.right,t,y(p({},r),{path:[...r.path,"allOf",1]})),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];n.allOf=c},Yu=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,s=a._zod.bag,c=s==null?void 0:s.patterns;if(i.mode==="loose"&&c&&c.size>0){const l=D(i.valueType,t,y(p({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=D(i.keyType,t,y(p({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=D(i.valueType,t,y(p({},r),{path:[...r.path,"additionalProperties"]}));const u=a._zod.values;if(u){const l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Qu=(e,t,n,r)=>{const o=e._zod.def,i=D(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},el=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},tl=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},nl=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},rl=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(s){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},ol=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;D(i,t,r);const a=t.seen.get(e);a.ref=i},il=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Oo=(e,t,n,r)=>{const o=e._zod.def;D(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},al=h("ZodISODateTime",(e,t)=>{sc.init(e,t),R.init(e,t)});function sl(e){return hu(al,e)}const cl=h("ZodISODate",(e,t)=>{cc.init(e,t),R.init(e,t)});function ul(e){return pu(cl,e)}const ll=h("ZodISOTime",(e,t)=>{uc.init(e,t),R.init(e,t)});function fl(e){return _u(ll,e)}const dl=h("ZodISODuration",(e,t)=>{lc.init(e,t),R.init(e,t)});function hl(e){return gu(dl,e)}const pl=(e,t)=>{uo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>es(e,n)},flatten:{value:n=>Qa(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ln,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ln,2)}},isEmpty:{get(){return e.issues.length===0}}})},te=h("ZodError",pl,{Parent:Error}),_l=Zn(te),gl=On(te),ml=Pt(te),yl=Dt(te),bl=rs(te),wl=os(te),vl=is(te),kl=as(te),zl=ss(te),Sl=cs(te),El=us(te),Tl=ls(te),N=h("ZodType",(e,t)=>(I.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:It(e,"input"),output:It(e,"output")}}),e.toJSONSchema=Fu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(ke(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>ze(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>_l(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ml(e,n,r),e.parseAsync=(n,r)=>k(null,null,function*(){return gl(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>k(null,null,function*(){return yl(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>bl(e,n,r),e.decode=(n,r)=>wl(e,n,r),e.encodeAsync=(n,r)=>k(null,null,function*(){return vl(e,n,r)}),e.decodeAsync=(n,r)=>k(null,null,function*(){return kl(e,n,r)}),e.safeEncode=(n,r)=>zl(e,n,r),e.safeDecode=(n,r)=>Sl(e,n,r),e.safeEncodeAsync=(n,r)=>k(null,null,function*(){return El(e,n,r)}),e.safeDecodeAsync=(n,r)=>k(null,null,function*(){return Tl(e,n,r)}),e.refine=(n,r)=>e.check(kf(n,r)),e.superRefine=n=>e.check(zf(n)),e.overwrite=n=>e.check(Ke(n)),e.optional=()=>hr(e),e.exactOptional=()=>uf(e),e.nullable=()=>pr(e),e.nullish=()=>hr(pr(e)),e.nonoptional=n=>_f(e,n),e.array=()=>hn(e),e.or=n=>Io([e,n]),e.and=n=>tf(e,n),e.transform=n=>_r(e,sf(n)),e.default=n=>df(e,n),e.prefault=n=>pf(e,n),e.catch=n=>mf(e,n),e.pipe=n=>_r(e,n),e.readonly=()=>wf(e),e.describe=n=>{const r=e.clone();return Qe.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Qe.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qe.get(e);const r=e.clone();return Qe.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ao=h("_ZodString",(e,t)=>{var r,o,i;An.init(e,t),N.init(e,t),e._zod.processJSONSchema=(a,s,c)=>ju(e,a,s);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(ku(...a)),e.includes=(...a)=>e.check(Eu(...a)),e.startsWith=(...a)=>e.check(Tu(...a)),e.endsWith=(...a)=>e.check($u(...a)),e.min=(...a)=>e.check(xt(...a)),e.max=(...a)=>e.check(So(...a)),e.length=(...a)=>e.check(Eo(...a)),e.nonempty=(...a)=>e.check(xt(1,...a)),e.lowercase=a=>e.check(zu(a)),e.uppercase=a=>e.check(Su(a)),e.trim=()=>e.check(Ou()),e.normalize=(...a)=>e.check(Zu(...a)),e.toLowerCase=()=>e.check(Au()),e.toUpperCase=()=>e.check(xu()),e.slugify=()=>e.check(Iu())}),$l=h("ZodString",(e,t)=>{An.init(e,t),Ao.init(e,t),e.email=n=>e.check(Wc(Zl,n)),e.url=n=>e.check(Xc(Ol,n)),e.jwt=n=>e.check(du(Bl,n)),e.emoji=n=>e.check(Yc(Al,n)),e.guid=n=>e.check(ar(lr,n)),e.uuid=n=>e.check(Hc(vt,n)),e.uuidv4=n=>e.check(Kc(vt,n)),e.uuidv6=n=>e.check(Gc(vt,n)),e.uuidv7=n=>e.check(qc(vt,n)),e.nanoid=n=>e.check(Qc(xl,n)),e.guid=n=>e.check(ar(lr,n)),e.cuid=n=>e.check(eu(Il,n)),e.cuid2=n=>e.check(tu(Nl,n)),e.ulid=n=>e.check(nu(Rl,n)),e.base64=n=>e.check(uu(Ll,n)),e.base64url=n=>e.check(lu(Ml,n)),e.xid=n=>e.check(ru(Pl,n)),e.ksuid=n=>e.check(ou(Dl,n)),e.ipv4=n=>e.check(iu(Fl,n)),e.ipv6=n=>e.check(au(Cl,n)),e.cidrv4=n=>e.check(su(jl,n)),e.cidrv6=n=>e.check(cu(Ul,n)),e.e164=n=>e.check(fu(Jl,n)),e.datetime=n=>e.check(sl(n)),e.date=n=>e.check(ul(n)),e.time=n=>e.check(fl(n)),e.duration=n=>e.check(hl(n))});function Ie(e){return Vc($l,e)}const R=h("ZodStringFormat",(e,t)=>{x.init(e,t),Ao.init(e,t)}),Zl=h("ZodEmail",(e,t)=>{Ys.init(e,t),R.init(e,t)}),lr=h("ZodGUID",(e,t)=>{qs.init(e,t),R.init(e,t)}),vt=h("ZodUUID",(e,t)=>{Xs.init(e,t),R.init(e,t)}),Ol=h("ZodURL",(e,t)=>{Qs.init(e,t),R.init(e,t)}),Al=h("ZodEmoji",(e,t)=>{ec.init(e,t),R.init(e,t)}),xl=h("ZodNanoID",(e,t)=>{tc.init(e,t),R.init(e,t)}),Il=h("ZodCUID",(e,t)=>{nc.init(e,t),R.init(e,t)}),Nl=h("ZodCUID2",(e,t)=>{rc.init(e,t),R.init(e,t)}),Rl=h("ZodULID",(e,t)=>{oc.init(e,t),R.init(e,t)}),Pl=h("ZodXID",(e,t)=>{ic.init(e,t),R.init(e,t)}),Dl=h("ZodKSUID",(e,t)=>{ac.init(e,t),R.init(e,t)}),Fl=h("ZodIPv4",(e,t)=>{fc.init(e,t),R.init(e,t)}),Cl=h("ZodIPv6",(e,t)=>{dc.init(e,t),R.init(e,t)}),jl=h("ZodCIDRv4",(e,t)=>{hc.init(e,t),R.init(e,t)}),Ul=h("ZodCIDRv6",(e,t)=>{pc.init(e,t),R.init(e,t)}),Ll=h("ZodBase64",(e,t)=>{_c.init(e,t),R.init(e,t)}),Ml=h("ZodBase64URL",(e,t)=>{mc.init(e,t),R.init(e,t)}),Jl=h("ZodE164",(e,t)=>{yc.init(e,t),R.init(e,t)}),Bl=h("ZodJWT",(e,t)=>{wc.init(e,t),R.init(e,t)}),xo=h("ZodNumber",(e,t)=>{var r,o,i,a,s,c,u,l,d;wo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(f,_,m)=>Uu(e,f,_),e.gt=(f,_)=>e.check(cr(f,_)),e.gte=(f,_)=>e.check(Ht(f,_)),e.min=(f,_)=>e.check(Ht(f,_)),e.lt=(f,_)=>e.check(sr(f,_)),e.lte=(f,_)=>e.check(Wt(f,_)),e.max=(f,_)=>e.check(Wt(f,_)),e.int=f=>e.check(fr(f)),e.safe=f=>e.check(fr(f)),e.positive=f=>e.check(cr(0,f)),e.nonnegative=f=>e.check(Ht(0,f)),e.negative=f=>e.check(sr(0,f)),e.nonpositive=f=>e.check(Wt(0,f)),e.multipleOf=(f,_)=>e.check(ur(f,_)),e.step=(f,_)=>e.check(ur(f,_)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(c=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(s=n.exclusiveMaximum)!=null?s:Number.POSITIVE_INFINITY))!=null?c:null,e.isInt=((u=n.format)!=null?u:"").includes("int")||Number.isSafeInteger((l=n.multipleOf)!=null?l:.5),e.isFinite=!0,e.format=(d=n.format)!=null?d:null});function Vl(e){return mu(xo,e)}const Wl=h("ZodNumberFormat",(e,t)=>{vc.init(e,t),xo.init(e,t)});function fr(e){return yu(Wl,e)}const Hl=h("ZodBoolean",(e,t)=>{kc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r)});function Y(e){return bu(Hl,e)}const Kl=h("ZodUnknown",(e,t)=>{zc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju()});function dn(){return wu(Kl)}const Gl=h("ZodNever",(e,t)=>{Sc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mu(e,n,r)});function ql(e){return vu(Gl,e)}const Xl=h("ZodArray",(e,t)=>{Ec.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(xt(n,r)),e.nonempty=n=>e.check(xt(1,n)),e.max=(n,r)=>e.check(So(n,r)),e.length=(n,r)=>e.check(Eo(n,r)),e.unwrap=()=>e.element});function hn(e,t){return Nu(Xl,e,t)}const Yl=h("ZodObject",(e,t)=>{$c.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),Z(e,"shape",()=>t.shape),e.keyof=()=>et(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(y(p({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(y(p({},e._zod.def),{catchall:dn()})),e.loose=()=>e.clone(y(p({},e._zod.def),{catchall:dn()})),e.strict=()=>e.clone(y(p({},e._zod.def),{catchall:ql()})),e.strip=()=>e.clone(y(p({},e._zod.def),{catchall:void 0})),e.extend=n=>Ka(e,n),e.safeExtend=n=>Ga(e,n),e.merge=n=>qa(e,n),e.pick=n=>Wa(e,n),e.omit=n=>Ha(e,n),e.partial=(...n)=>Xa(No,e,n[0]),e.required=(...n)=>Ya(Ro,e,n[0])});function kt(e,t){const n=p({type:"object",shape:e!=null?e:{}},g(t));return new Yl(n)}const Ql=h("ZodUnion",(e,t)=>{Zc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o),e.options=t.options});function Io(e,t){return new Ql(p({type:"union",options:e},g(t)))}const ef=h("ZodIntersection",(e,t)=>{Oc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o)});function tf(e,t){return new ef({type:"intersection",left:e,right:t})}const nf=h("ZodRecord",(e,t)=>{Ac.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function rf(e,t,n){return new nf(p({type:"record",keyType:e,valueType:t},g(n)))}const pn=h("ZodEnum",(e,t)=>{xc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Bu(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new pn(y(p(y(p({},t),{checks:[]}),g(o)),{entries:i}))},e.exclude=(r,o)=>{const i=p({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new pn(y(p(y(p({},t),{checks:[]}),g(o)),{entries:i}))}});function et(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new pn(p({type:"enum",entries:n},g(t)))}const of=h("ZodLiteral",(e,t)=>{Ic.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function dr(e,t){return new of(p({type:"literal",values:Array.isArray(e)?e:[e]},g(t)))}const af=h("ZodTransform",(e,t)=>{Nc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ro(e.constructor.name);n.addIssue=i=>{var a,s,c;if(typeof i=="string")n.issues.push(ut(i,n.value,t));else{const u=i;u.fatal&&(u.continue=!1),(a=u.code)!=null||(u.code="custom"),(s=u.input)!=null||(u.input=n.value),(c=u.inst)!=null||(u.inst=e),n.issues.push(ut(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function sf(e){return new af({type:"transform",transform:e})}const No=h("ZodOptional",(e,t)=>{zo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hr(e){return new No({type:"optional",innerType:e})}const cf=h("ZodExactOptional",(e,t)=>{Rc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function uf(e){return new cf({type:"optional",innerType:e})}const lf=h("ZodNullable",(e,t)=>{Pc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pr(e){return new lf({type:"nullable",innerType:e})}const ff=h("ZodDefault",(e,t)=>{Dc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function df(e,t){return new ff({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():so(t)}})}const hf=h("ZodPrefault",(e,t)=>{Fc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pf(e,t){return new hf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():so(t)}})}const Ro=h("ZodNonOptional",(e,t)=>{Cc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _f(e,t){return new Ro(p({type:"nonoptional",innerType:e},g(t)))}const gf=h("ZodCatch",(e,t)=>{jc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mf(e,t){return new gf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const yf=h("ZodPipe",(e,t)=>{Uc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ol(e,n,r,o),e.in=t.in,e.out=t.out});function _r(e,t){return new yf({type:"pipe",in:e,out:t})}const bf=h("ZodReadonly",(e,t)=>{Lc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new bf({type:"readonly",innerType:e})}const vf=h("ZodCustom",(e,t)=>{Mc.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n)});function kf(e,t={}){return Ru(vf,e,t)}function zf(e){return Pu(e)}const Sf=kt({language:et(["typescript","javascript"]).optional(),disableMarkedForExport:Y().optional(),allowAutoSelectFirstNode:Y().optional().default(!0),enableDisplayDataId:Y().optional(),enableDisplayDataName:Y().optional(),enableDisplayDataVariant:Y().optional()}).and(Io([kt({framework:dr("react"),model:Ie().optional(),styling:et(["plain_css","tailwind","inline_styles"]),uiLibrary:et(["mui","antd","radix","shadcn","clean_react","custom_design_system"]).optional(),responsivePages:hn(kt({name:Ie(),framesId:hn(Ie())})).optional(),enableUILibraryTheming:Y().optional(),enableCompactStructure:Y().optional(),enableDisplayScreenModelId:Y().optional(),enableGeneratePackageLock:Y().optional(),enableAnimationsPreset:Y().optional(),enableAutoSplit:Y().optional(),autoSplitThreshold:Vl().optional(),url:Ie().url().optional(),codegenSettings:rf(Ie(),dn()).optional(),designSystemId:Ie().optional()}),kt({framework:dr("html"),styling:et(["plain_css","inline_styles","tailwind"]),enableTranslation:Y().optional()})])),Po=e=>{const t=Sf.safeParse(e);if(t.success===!1){const n=new Error("Invalid codegen settings");throw n.cause=t.error,n}return t.data},xn=(e,t)=>{if(e.id===t)return e;if("children"in e)for(const n of e.children){const r=xn(n,t);if(r)return r}return null},gr=new Set(["FRAME","INSTANCE","COMPONENT","COMPONENT_SET","GROUP"]),Do=(e,t,n={allowAutoSelectFirstNode:!0})=>{const r=xn(e.document,t);if(!r)return{isValid:!1,reason:"There is no node with the given id"};if(r.type==="CANVAS"){const o=r.children.filter(i=>gr.has(i.type));return o.length===0?{isValid:!1,reason:"Selected node is a page with no valid children"}:o.length===1?{isValid:!0,node:o[0],note:"Selected node is a page with a single valid children - returning it instead"}:n.allowAutoSelectFirstNode?{isValid:!0,node:o[0],note:"Selected node is a page with multiple valid children - returning the first one instead"}:{isValid:!1,reason:"Selected node is a page with multiple children"}}return gr.has(r.type)?{isValid:!0,node:r}:{isValid:!1,reason:"Selected node type is not supported"}};function Ef(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var St={exports:{}},Tf=St.exports,mr;function $f(){return mr||(mr=1,(function(e,t){(function(n,r){e.exports=r()})(Tf,(function(){var n=typeof Promise=="function",r=(function(b){if(typeof globalThis=="object")return globalThis;Object.defineProperty(b,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var ue=typeDetectGlobalObject;return delete b.typeDetectGlobalObject,ue})(Object.prototype),o=typeof Symbol!="undefined",i=typeof Map!="undefined",a=typeof Set!="undefined",s=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",l=o&&typeof Symbol.iterator!="undefined",d=o&&typeof Symbol.toStringTag!="undefined",f=a&&typeof Set.prototype.entries=="function",_=i&&typeof Map.prototype.entries=="function",m=f&&Object.getPrototypeOf(new Set().entries()),w=_&&Object.getPrototypeOf(new Map().entries()),O=l&&typeof Array.prototype[Symbol.iterator]=="function",U=O&&Object.getPrototypeOf([][Symbol.iterator]()),H=l&&typeof String.prototype[Symbol.iterator]=="function",K=H&&Object.getPrototypeOf(""[Symbol.iterator]()),T=8,S=-1;function P(b){var ue=typeof b;if(ue!=="object")return ue;if(b===null)return"null";if(b===r)return"global";if(Array.isArray(b)&&(d===!1||!(Symbol.toStringTag in b)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&b===window.location)return"Location";if(typeof window.document=="object"&&b===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&b===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&b===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&b instanceof window.HTMLElement){if(b.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(b.tagName==="TD")return"HTMLTableDataCellElement";if(b.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=d&&b[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var C=Object.getPrototypeOf(b);return C===RegExp.prototype?"RegExp":C===Date.prototype?"Date":n&&C===Promise.prototype?"Promise":a&&C===Set.prototype?"Set":i&&C===Map.prototype?"Map":c&&C===WeakSet.prototype?"WeakSet":s&&C===WeakMap.prototype?"WeakMap":u&&C===DataView.prototype?"DataView":i&&C===w?"Map Iterator":a&&C===m?"Set Iterator":O&&C===U?"Array Iterator":H&&C===K?"String Iterator":C===null?"Object":Object.prototype.toString.call(b).slice(T,S)}return P}))})(St)),St.exports}var Zf=$f();const Of=Ef(Zf),In=typeof Buffer!="undefined",Af=In&&typeof Buffer.from!="undefined",xf=In?function(t){return Buffer.isBuffer(t)}:function(){return!1},If=Af?function(t){return Buffer.from(t)}:In?function(t){return new Buffer(t)}:function(t){return t};function Be(e){return xf(e)?"Buffer":Of(e)}const Nf=new Set(["Arguments","Array","Map","Object","Set"]);function Rf(e,t,n=null){switch(n||Be(e)){case"Arguments":case"Array":case"Object":return e[t];case"Map":return e.get(t);case"Set":return t}}function _n(e){return Nf.has(e)}function yr(e,t,n,r=null){switch(r||Be(e)){case"Arguments":case"Array":case"Object":e[t]=n;break;case"Map":e.set(t,n);break;case"Set":e.add(n);break}return e}const Pf=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,Df=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ff=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Kt=Pf||Df||Ff||Function("return this")();function Cf(e){return e.slice(0)}function jf(e){return new Boolean(e.valueOf())}function Uf(e){return new DataView(e.buffer)}function Lf(e){return If(e)}function Mf(e){return new Date(e.getTime())}function Jf(e){return new Number(e)}function Bf(e){return new RegExp(e.source,e.flags)}function Vf(e){return new String(e)}function le(e,t){return Kt[t].from?Kt[t].from(e):new Kt[t](e)}function L(e){return e}function br(){return[]}function Wf(){return new Map}function Hf(){return{}}function Kf(){return new Set}const Gf=new Map([["ArrayBuffer",Cf],["Boolean",jf],["Buffer",Lf],["DataView",Uf],["Date",Mf],["Number",Jf],["RegExp",Bf],["String",Vf],["Float32Array",le],["Float64Array",le],["Int16Array",le],["Int32Array",le],["Int8Array",le],["Uint16Array",le],["Uint32Array",le],["Uint8Array",le],["Uint8ClampedArray",le],["Array Iterator",L],["Map Iterator",L],["Promise",L],["Set Iterator",L],["String Iterator",L],["function",L],["global",L],["WeakMap",L],["WeakSet",L],["boolean",L],["null",L],["number",L],["string",L],["symbol",L],["undefined",L],["Arguments",br],["Array",br],["Map",Wf],["Object",Hf],["Set",Kf]]);function qf(){}function gn(e,t=null,n=qf){arguments.length===2&&typeof t=="function"&&(n=t,t=null);const r=t||Be(e),o=Gf.get(r);if(r==="Object"){const i=n(e,r);if(i!==void 0)return i}return o?o(e,r):e}function wr(e,t={}){typeof t=="function"&&(t={customizer:t});const{customizer:n}=t,r=Be(e);if(!_n(r))return mn(e,null,null,null);const o=gn(e,r,n),i=new WeakMap([[e,o]]),a=new WeakSet([e]);return mn(e,o,i,a)}function mn(e,t,n,r,o){const i=Be(e),a=gn(e,i);if(!_n(i))return a;let s;switch(i){case"Arguments":case"Array":s=Object.keys(e);break;case"Object":s=Object.keys(e),s.push(...Object.getOwnPropertySymbols(e));break;case"Map":case"Set":s=e.keys();break}for(let c of s){const u=Rf(e,c,i);if(r.has(u))yr(t,c,n.get(u),i);else{const l=Be(u),d=gn(u,l);_n(l)&&(n.set(u,d),r.add(u)),yr(t,c,mn(u,d,n,r),i)}}return t}var lt,Ce,he,Q,V,yn,Et,tt;class Fo{constructor({fetch:t=globalThis.fetch.bind(globalThis),baseAddress:n="https://api.figma.com/",defaultOptions:r={}}={}){re(this,V);re(this,lt);re(this,Ce);re(this,he);re(this,Q);X(this,lt,n),X(this,Ce,t),X(this,Q,r),X(this,he,v(this,Q)),r.token&&j(this,V,yn).call(this,r.token)}hasDefaultToken(){return!!v(this,Q).token}updateDefaultOptions(t){t.token&&j(this,V,yn).call(this,t.token),X(this,Q,p(p({},v(this,Q)),t)),X(this,he,v(this,Q))}withOptions(t){return X(this,he,p(p(p({},v(this,Q)),v(this,he)),t)),this}getHeaders(t){const n={"Content-Type":"application/json"},r=t!=null?t:v(this,Q).token;if(r!=null&&r.startsWith("figd_"))n["X-FIGMA-TOKEN"]=r;else if(r!=null&&r.startsWith("figu_"))n.Authorization=`Bearer ${r}`;else throw new Gr;return n}getFile(o){return k(this,arguments,function*({fileKey:t,nodeIds:n=[],depth:r}){const i=new URLSearchParams({plugin_data:"857346721138427857",geometry:"paths"});n.length>0&&i.append("ids",n.join(",")),r&&i.append("depth",`${r}`);const a=i.toString(),s=`v1/files/${t}?${a}`;return yield j(this,V,tt).call(this,s)})}getNodeImages(a){return k(this,arguments,function*({fileKey:t,nodeIds:n,scale:r=1,as:o="arrayBuffer",format:i="jpg"}){const c=(yield j(this,V,tt).call(this,`v1/images/${t}?ids=${n}&format=${i}&scale=${r}`)).images;if(o==="links")return c;const u=n.map(f=>k(this,null,function*(){const _=c[f];if(!_)return null;const m=yield v(this,Ce).call(this,_);return m.ok?yield m.arrayBuffer():null})),l=yield Promise.allSettled(u);return n.reduce((f,_,m)=>{const w=l[m];return w.status==="fulfilled"?f[_]=w.value:f[_]=null,f},{})})}getImageFills(n){return k(this,arguments,function*({fileKey:t}){var i,a;const r=`v1/files/${t}/images`;return(a=(i=(yield j(this,V,tt).call(this,r)).meta)==null?void 0:i.images)!=null?a:{}})}getMe(){return k(this,null,function*(){return yield j(this,V,tt).call(this,"v1/me")})}}lt=new WeakMap,Ce=new WeakMap,he=new WeakMap,Q=new WeakMap,V=new WeakSet,yn=function(t){if(!t.startsWith("figd_")&&!t.startsWith("figu_"))throw new Kr},Et=function(t,n){return k(this,null,function*(){var o;const r=yield n();if(!r.ok){const i=r.status;let a=null;try{a=yield r.text()}catch(s){}if(i===403)throw a!=null&&a.includes("Invalid token")?new on:a!=null&&a.includes("Token expired")?new an:a!=null&&a.includes("File not exportable")?new sn:new cn({reason:a});if(i===404)throw new Xr({cause:r});if(i===429){const s=r.headers.get("Retry-After"),c=s?Number(s):null;if(!c)throw new un({cause:r});if(yield(o=t.onRateLimited)==null?void 0:o.call(t,{retryAfter:c,figmaPlanTier:r.headers.get("X-Figma-Plan-Tier"),figmaRateLimitType:r.headers.get("X-Figma-Rate-Limit-Type")}))return new Promise((l,d)=>{var _;const f=setTimeout(()=>{var m;(m=t.abortSignal)!=null&&m.aborted||j(this,V,Et).call(this,t,n).then(l).catch(d)},c*1e3+1e3);(_=t.abortSignal)==null||_.addEventListener("abort",()=>{clearTimeout(f),d(new Error("The operation was aborted."))})});throw new un({cause:r})}else throw i===500&&(a!=null&&a.includes("Request too large"))?new no({cause:r}):new Qr({cause:r})}return r})},tt=function(t){return k(this,null,function*(){const n=wr(v(this,he));X(this,he,wr(v(this,Q)));const r=()=>k(this,null,function*(){return yield v(this,Ce).call(this,`${v(this,lt)}${t}`,{method:"GET",headers:this.getHeaders(n.token),signal:n.abortSignal})});try{return yield(yield j(this,V,Et).call(this,n,r)).json()}catch(o){if(n.onForbidden&&(o instanceof on||o instanceof an||o instanceof sn||o instanceof cn)){const i=yield n.onForbidden(o);if(i)return n.token=i.retry.newToken,yield(yield j(this,V,Et).call(this,n,r)).json()}throw o}})};const Xf={codegen:"f2c",l2c:"l2c",p2c:"p2c"};var A,je,ft,ae,Co,Ne;class Yf{constructor({auth:t,apiBaseAddress:n="https://public-api.animaapp.com",figmaRestApi:r=new Fo}={}){re(this,ae);re(this,A);re(this,je);re(this,ft);X(this,je,n),X(this,ft,r),t&&(this.auth=t)}hasAuth(){return!!v(this,A)}set auth(t){X(this,A,t)}get headers(){const t={"Content-Type":"application/json"};return v(this,A)&&(t.Authorization=`Bearer ${v(this,A).token}`,"teamId"in v(this,A)&&(t["X-Team-Id"]=v(this,A).teamId)),t}generateCode(o){return k(this,arguments,function*(t,n={},r){var u;let i;try{i=yield v(this,ft).withOptions({token:t.figmaToken,abortSignal:r}).getFile({fileKey:t.fileKey})}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l}const a=Po(t.settings);i&&(yield j(this,ae,Co).call(this,i,t.nodesId,{allowAutoSelectFirstNode:(u=a.allowAutoSelectFirstNode)!=null?u:!0}));let s=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(s!=null&&s.externalId||(s={externalId:v(this,A).userId}));const c={tracking:s,fileKey:t.fileKey,figmaToken:t.figmaToken,nodesId:t.nodesId,figmaRateLimitMaxWait:t.figmaRateLimitMaxWait,assetsStorage:t.assetsStorage,language:a.language,model:a.model,framework:a.framework,styling:a.styling,uiLibrary:a.uiLibrary,enableTranslation:a.enableTranslation,enableUILibraryTheming:a.enableUILibraryTheming,enableCompactStructure:a.enableCompactStructure,enableAutoSplit:a.enableAutoSplit,autoSplitThreshold:a.autoSplitThreshold,disableMarkedForExport:a.disableMarkedForExport,allowAutoSelectFirstNode:a.allowAutoSelectFirstNode,enableDisplayScreenModelId:a.enableDisplayScreenModelId,enableGeneratePackageLock:a.enableGeneratePackageLock,enableAnimationsPreset:a.enableAnimationsPreset,enableDisplayDataId:a.enableDisplayDataId,enableDisplayDataName:a.enableDisplayDataName,enableDisplayDataVariant:a.enableDisplayDataVariant,codegenSettings:a.codegenSettings,dsId:a.designSystemId,webhookUrl:t.webhookUrl,prompt:t.prompt,images:t.images,createSession:t.createSession};return j(this,ae,Ne).call(this,"POST","/v1/codegen",c,n,"codegen",r)})}generateCodeFromWebsite(o){return k(this,arguments,function*(t,n={},r){var u;let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));let a;if(t.mhtmlUrl)a={type:"hosted-mhtml",mhtmlUrl:t.mhtmlUrl,url:t.url};else if(t.mhtml)a={type:"mhtml",mhtml:t.mhtml,url:t.url};else if(t.url)a={type:"url",url:t.url};else throw new Error("Either 'url', 'mhtml' or 'mhtmlUrl' must be provided");let s;t.experimental_useNewReactEngine&&(s="react-v2");const c={tracking:i,assetsStorage:t.assetsStorage,prompt:t.prompt,images:t.images,dsId:t.dsId,params:p({input:a,conventions:{framework:t.settings.framework,language:t.settings.language,styling:t.settings.styling},assetsStorage:{type:"bundled"},engine:s,htmlOptimizations:t.htmlOptimizations,subpages:t.subpages},(u=t.settings.codegenSettings)!=null?u:{})};return j(this,ae,Ne).call(this,"POST","/v1/l2c",c,n,"l2c",r)})}discoverSubpages(t,n){return k(this,null,function*(){if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const r=yield fetch(`${v(this,je)}/v1/l2c/discover-subpages`,{method:"POST",headers:this.headers,body:JSON.stringify(t),signal:n});if(!r.ok){const o=yield r.text();let i=o;try{const a=JSON.parse(o);typeof(a==null?void 0:a.error)=="string"?i=a.error:typeof(a==null?void 0:a.message)=="string"&&(i=a.message)}catch(a){}throw new fe({name:"HTTP error from Anima API",reason:i||"Failed to discover website subpages",status:r.status})}return r.json()})}generateCodeFromPrompt(o){return k(this,arguments,function*(t,n={},r){var s;let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));const a={tracking:i,assetsStorage:t.assetsStorage,params:p({prompt:t.prompt,guidelines:t.guidelines,images:t.images,conventions:{language:t.settings.language,framework:t.settings.framework,styling:t.settings.styling,uiLibrary:t.settings.uiLibrary},dsId:t.settings.dsId,fastMode:t.settings.fastMode,imageMode:t.settings.imageMode},(s=t.settings.codegenSettings)!=null?s:{}),webhookUrl:t.webhookUrl};return j(this,ae,Ne).call(this,"POST","/v1/p2c",a,n,"p2c",r)})}generateLink2Code(o){return k(this,arguments,function*(t,n={},r){let i=t.tracking;v(this,A)&&"userId"in v(this,A)&&v(this,A).userId&&(i!=null&&i.externalId||(i={externalId:v(this,A).userId}));const a={tracking:i,assetsStorage:t.assetsStorage,params:t.params};return j(this,ae,Ne).call(this,"POST","/v1/l2c",a,n,"l2c",r)})}attachToGenerationJob(o){return k(this,arguments,function*(t,n={},r){const i={};return j(this,ae,Ne).call(this,"GET",`/v1/jobs/${t.sessionId}`,i,n,void 0,r)})}}A=new WeakMap,je=new WeakMap,ft=new WeakMap,ae=new WeakSet,Co=function(t,n,r){return k(this,null,function*(){const i=n.map(a=>Do(t,a,r)).find(a=>!a.isValid);if(i)throw new fe({name:"Task Crashed",reason:i.reason})})},Ne=function(t,n,r,o,i,a){return k(this,null,function*(){var w,O,U,H,K,T,S,P,b,ue,Oe,C;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const s={},c={method:t,headers:y(p({},this.headers),{Accept:"text/event-stream"}),signal:a};if(t==="POST"){const Ae=Pa(JSON.stringify(r));c.body=Ae,c.headers=y(p({},c.headers),{"Content-Encoding":"gzip","Content-Type":"application/json"})}const u=yield fetch(`${v(this,je)}${n}`,c);if(!u.ok){const Ae=yield u.text();let ne;try{ne=JSON.parse(Ae)}catch(Ct){}throw((w=ne==null?void 0:ne.error)==null?void 0:w.name)==="ZodError"?(console.log("Zod validation error:",JSON.stringify(ne.error.issues,null,2)),new fe({name:"HTTP error from Anima API",reason:"Invalid body payload",detail:ne.error.issues,status:u.status})):typeof ne=="object"?new fe({name:`Error "${ne}"`,reason:"Unknown",status:u.status}):new fe({name:"HTTP error from Anima API",reason:Ae,status:u.status})}if(!u.body)throw new fe({name:"Stream Error",reason:"Response body is null",status:u.status});const l=u.headers.get("x-anima-job-type"),d=l&&Xf[l];d&&typeof o=="function"&&o({type:"set_job_type",payload:{jobType:d}});const f=u.body.getReader(),_=new TextDecoder;let m="";try{for(;;){const{done:Ae,value:ne}=yield f.read();if(Ae)break;m+=_.decode(ne,{stream:!0});const Ct=m.split(`
40
+ `);m=Ct.pop()||"";for(const gt of Ct)if(!(!gt.trim()||gt.startsWith(":"))&&gt.startsWith("data: ")){let E;try{E=JSON.parse(gt.slice(6))}catch(Ge){continue}switch(E.type){case"queueing":{typeof o=="function"?o(E):(O=o.onQueueing)==null||O.call(o,{sessionId:E.sessionId});break}case"start":{s.sessionId=E.sessionId,typeof o=="function"?o(E):(U=o.onStart)==null||U.call(o,{sessionId:E.sessionId});break}case"pre_codegen":{i==="codegen"&&(typeof o=="function"?o(E):(H=o.onPreCodegen)==null||H.call(o,{message:E.message}));break}case"assets_uploaded":{typeof o=="function"?o(E):(K=o.onAssetsUploaded)==null||K.call(o);break}case"assets_list":{s.assets=E.payload.assets,typeof o=="function"?o(E):(T=o.onAssetsList)==null||T.call(o,E.payload);break}case"figma_metadata":{i==="codegen"&&(s.figmaFileName=E.figmaFileName,s.figmaSelectedFrameName=E.figmaSelectedFrameName,typeof o=="function"?o(E):(S=o.onFigmaMetadata)==null||S.call(o,{figmaFileName:E.figmaFileName,figmaSelectedFrameName:E.figmaSelectedFrameName}));break}case"generating_code":{E.payload.status==="success"&&(s.files=E.payload.files),typeof o=="function"?o(E):(P=o.onGeneratingCode)==null||P.call(o,{status:E.payload.status,progress:E.payload.progress,files:E.payload.files});break}case"progress_messages_updated":{typeof o=="function"?o(E):(b=o.onProgressMessagesUpdated)==null||b.call(o,E.payload.progressMessages);break}case"job_status_updated":{typeof o=="function"?o(E):(ue=o.onJobStatusUpdated)==null||ue.call(o,E.payload.jobStatus);break}case"codegen_completed":case"generation_completed":{typeof o=="function"?o(E):(Oe=o.onCodegenCompleted)==null||Oe.call(o);break}case"error":throw new fe({name:E.payload.errorName,reason:E.payload.reason});case"done":{s.tokenUsage=E.payload.tokenUsage,s.sessionId=E.payload.sessionId;const Ge=(C=E.payload)==null?void 0:C.metadata;if(Ge&&typeof Ge=="object"){const mt=Ge.viewport;(mt==="desktop"||mt==="mobile"||mt==="tablet")&&(s.viewport=mt);const Nn=Ge.viewportReason;typeof Nn=="string"&&(s.viewportReason=Nn)}return s}}}}}finally{f.cancel()}throw new fe({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})};const Qf=e=>{var t;if(!e)return[!1,"",""];try{const n=new URL(e),r=n.pathname;if(n.origin!=="https://www.figma.com"&&n.origin!=="https://embed.figma.com")return[!1,"",""];const o=n.toString();if(e!==o)return[!1,"",""];const i=((t=n.searchParams.get("node-id"))!=null?t:"").replace(/-/g,":"),a=r.split("/")[2];return[(r.startsWith("/file/")&&n.searchParams.get("type")!=="whiteboard"||r.startsWith("/design/")||r.startsWith("/proto/"))&&a.length===22,a,i]}catch(n){return[!1,"",""]}},ed=({fileKey:e,nodeId:t,duplicate:n})=>{const r=new URL("https://www.figma.com");return r.pathname=`design/${e}`,n&&(r.pathname=`${r.pathname}/dummy/duplicate`),t&&r.searchParams.set("node-id",t.replace(":","-")),r};class td extends Error{constructor(t,n){super(t),this.response=n}}const nd=({files:e,screenPath:t="src/screens"})=>{const n={},r=new Set;function o(i){if(r.has(i)||!e[i])return;r.add(i),n[i]=e[i],rd(e[i].content).forEach(s=>{try{const c=od(i,s);if(c.startsWith("src/")){const u=c.split("/").slice(0,-1).join("/");id(e,u).forEach(d=>{r.has(d)||o(d)})}}catch(c){console.warn(`Failed to resolve import ${s} in ${i}:`,c)}})}return Object.entries(e).forEach(([i,a])=>{i.startsWith(t)?o(i):i.startsWith("src/")||(n[i]=a)}),n};function rd(e){const t=/import.*?["']([^"']+)["']/g,n=/export.*from\s+["']([^"']+)["']/g,r=[];let o;for(;(o=t.exec(e))!==null;)r.push(o[1]);for(;(o=n.exec(e))!==null;)r.push(o[1]);return[...new Set(r)]}function od(e,t){if(!t.startsWith("."))return t;const n=e.split("/").slice(0,-1),r=t.split("/"),o=[...n];for(const i of r)i===".."?o.pop():i!=="."&&o.push(i);return o.join("/")}function id(e,t){return Object.keys(e).filter(n=>n.startsWith(t))}function pt(e,t,n){return new ReadableStream({start(r){n.call(e,t,o=>{o.type==="error"||r.enqueue(o),(o.type==="aborted"||o.type==="error")&&r.close()}).then(o=>{r.enqueue({type:"done",payload:{tokenUsage:o.tokenUsage,sessionId:o.sessionId}}),r.close()}).catch(o=>{r.enqueue({type:"error",payload:{name:"name"in o?o.name:"Unknown error",message:"message"in o?o.message:"Unknown",status:"status"in o?o.status:void 0,detail:"detail"in o?o.detail:void 0,errorPayload:"payload"in o?o.payload:void 0}}),r.close()})}})}const jo=(e,t)=>pt(e,t,e.generateCode);function _t(e){return k(this,null,function*(){var a,s,c,u;const[t,n]=e.tee(),r=yield t.getReader().read();if(r.done||!r.value||r.value.type==="error"&&((a=r.value.payload)!=null&&a.status))return new Response(JSON.stringify(r.value),{status:((s=r.value)==null?void 0:s.type)==="error"&&(u=(c=r.value.payload)==null?void 0:c.status)!=null?u:500,headers:{"Content-Type":"application/json"}});const o=new TextEncoder,i=n.pipeThrough(new TransformStream({transform(l,d){const f=`event: ${l.type}
41
41
  data: ${JSON.stringify(l)}
42
42
 
43
- `;d.enqueue(o.encode(f))}}));return new Response(i,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})})}const nd=(e,t)=>k(null,null,function*(){const n=Po(e,t);return ht(n)}),Do=(e,t)=>dt(e,t,e.generateCodeFromWebsite),rd=(e,t)=>k(null,null,function*(){const n=Do(e,t);return ht(n)}),Fo=(e,t)=>dt(e,t,e.generateCodeFromPrompt),od=(e,t)=>k(null,null,function*(){const n=Fo(e,t);return ht(n)}),Co=(e,t)=>dt(e,t,e.attachToGenerationJob),id=(e,t)=>k(null,null,function*(){const n=Co(e,t);return ht(n)}),jo=(e,t)=>dt(e,t,e.generateLink2Code),ad=(e,t)=>k(null,null,function*(){const n=jo(e,t);return ht(n)});exports.Anima=Kf;exports.CodegenError=fe;exports.ExpiredFigmaToken=nn;exports.FigmaRestApi=No;exports.FileNotExportable=rn;exports.MalformattedFigmaToken=Br;exports.MissingFigmaToken=Vr;exports.NeedsReauthFigmaToken=tn;exports.NotFound=Hr;exports.RateLimitExceeded=an;exports.RequestTooLarge=Yr;exports.ResponseError=Xf;exports.UnknownFigmaApiException=Gr;exports.UnknownForbiddenFigmaError=on;exports.attachToGenerationJobResponseEventStream=id;exports.attachToGenerationJobStream=Co;exports.createCodeFromPromptResponseEventStream=od;exports.createCodeFromPromptStream=Fo;exports.createCodeFromWebsiteResponseEventStream=rd;exports.createCodeFromWebsiteStream=Do;exports.createCodegenResponseEventStream=nd;exports.createCodegenStream=Po;exports.createLink2CodeResponseEventStream=ad;exports.createLink2CodeStream=jo;exports.findChildrenNode=Zn;exports.formatToFigmaLink=qf;exports.getRelatedScreenFiles=Yf;exports.isNodeCodegenCompatible=Io;exports.isNotFound=Ia;exports.isRateLimitExceeded=Ra;exports.isRequestTooLarge=Pa;exports.isUnknownFigmaApiException=Na;exports.isValidFigmaUrl=Gf;exports.validateSettings=xo;
43
+ `;d.enqueue(o.encode(f))}}));return new Response(i,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})})}const ad=(e,t)=>k(null,null,function*(){const n=jo(e,t);return _t(n)}),Uo=(e,t)=>pt(e,t,e.generateCodeFromWebsite),sd=(e,t)=>k(null,null,function*(){const n=Uo(e,t);return _t(n)}),Lo=(e,t)=>pt(e,t,e.generateCodeFromPrompt),cd=(e,t)=>k(null,null,function*(){const n=Lo(e,t);return _t(n)}),Mo=(e,t)=>pt(e,t,e.attachToGenerationJob),ud=(e,t)=>k(null,null,function*(){const n=Mo(e,t);return _t(n)}),Jo=(e,t)=>pt(e,t,e.generateLink2Code),ld=(e,t)=>k(null,null,function*(){const n=Jo(e,t);return _t(n)});exports.Anima=Yf;exports.CodegenError=fe;exports.ExpiredFigmaToken=an;exports.FigmaRestApi=Fo;exports.FileNotExportable=sn;exports.MalformattedFigmaToken=Kr;exports.MissingFigmaToken=Gr;exports.NeedsReauthFigmaToken=on;exports.NotFound=Xr;exports.RateLimitExceeded=un;exports.RequestTooLarge=no;exports.ResponseError=td;exports.UnknownFigmaApiException=Qr;exports.UnknownForbiddenFigmaError=cn;exports.attachToGenerationJobResponseEventStream=ud;exports.attachToGenerationJobStream=Mo;exports.createCodeFromPromptResponseEventStream=cd;exports.createCodeFromPromptStream=Lo;exports.createCodeFromWebsiteResponseEventStream=sd;exports.createCodeFromWebsiteStream=Uo;exports.createCodegenResponseEventStream=ad;exports.createCodegenStream=jo;exports.createLink2CodeResponseEventStream=ld;exports.createLink2CodeStream=Jo;exports.findChildrenNode=xn;exports.formatToFigmaLink=ed;exports.getRelatedScreenFiles=nd;exports.isNodeCodegenCompatible=Do;exports.isNotFound=Da;exports.isRateLimitExceeded=Ca;exports.isRequestTooLarge=ja;exports.isUnknownFigmaApiException=Fa;exports.isValidFigmaUrl=Qf;exports.validateSettings=Po;
44
44
  //# sourceMappingURL=index.cjs.map