1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4318],{18282:function(e){"use strict";e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),a=i.charCodeAt(0);if(255!==t[a])throw TypeError(i+" is ambiguous");t[a]=n}var s=e.length,o=e.charAt(0),l=Math.log(s)/Math.log(256),d=Math.log(256)/Math.log(s);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,i=0;e[r]===o;)n++,r++;for(var a=(e.length-r)*l+1>>>0,d=new Uint8Array(a);e[r];){var u=e.charCodeAt(r);if(u>255)return;var c=t[u];if(255===c)return;for(var h=0,p=a-1;(0!==c||h<i)&&-1!==p;p--,h++)c+=s*d[p]>>>0,d[p]=c%256>>>0,c=c/256>>>0;if(0!==c)throw Error("Non-zero carry");i=h,r++}for(var f=a-i;f!==a&&0===d[f];)f++;for(var m=new Uint8Array(n+(a-f)),y=n;f!==a;)m[y++]=d[f++];return m}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,a=t.length;i!==a&&0===t[i];)i++,r++;for(var l=(a-i)*d+1>>>0,u=new Uint8Array(l);i!==a;){for(var c=t[i],h=0,p=l-1;(0!==c||h<n)&&-1!==p;p--,h++)c+=256*u[p]>>>0,u[p]=c%s>>>0,c=c/s>>>0;if(0!==c)throw Error("Non-zero carry");n=h,i++}for(var f=l-n;f!==l&&0===u[f];)f++;for(var m=o.repeat(r);f<l;++f)m+=e.charAt(u[f]);return m},decodeUnsafe:u,decode:function(e){var t=u(e);if(t)return t;throw Error("Non-base"+s+" character")}}}},59147:function(e,t,r){let n=r(18282);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},40257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(44227)},44227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],d=!1,u=-1;function c(){d&&n&&(d=!1,n.length?l=n.concat(l):u=-1,l.length&&h())}function h(){if(!d){var e=o(c);d=!0;for(var t=l.length;t;){for(n=l,l=[];++u<t;)n&&n[u].run();u=-1,t=l.length}n=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new p(e,t)),1!==l.length||d||o(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=f,i.addListener=f,i.once=f,i.off=f,i.removeListener=f,i.removeAllListeners=f,i.emit=f,i.prependListener=f,i.prependOnceListener=f,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}},s=!0;try{t[e](a,a.exports,n),s=!1}finally{s&&delete r[e]}return a.exports}n.ab="//";var i=n(229);e.exports=i}()},75807:function(e,t,r){!function(e){"use strict";var t,n=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},i=function(){throw Error("no PRNG")},a=new Uint8Array(16),s=new Uint8Array(32);s[0]=9;var o=n(),l=n([1]),d=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,t,r,n){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function y(e,t,r,n,i){var a,s=0;for(a=0;a<i;a++)s|=e[t+a]^r[n+a];return(1&s-1>>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function v(e,t,r,n){return y(e,t,r,n,32)}function _(e,t,r,n){!function(e,t,r,n){for(var i,a=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,d=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,u=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,v=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,_=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=a,x=s,k=o,T=l,E=d,C=u,S=c,O=h,A=p,Z=f,P=m,I=y,N=g,j=v,R=_,M=b,L=0;L<20;L+=2)E^=(i=w+N|0)<<7|i>>>25,A^=(i=E+w|0)<<9|i>>>23,N^=(i=A+E|0)<<13|i>>>19,w^=(i=N+A|0)<<18|i>>>14,Z^=(i=C+x|0)<<7|i>>>25,j^=(i=Z+C|0)<<9|i>>>23,x^=(i=j+Z|0)<<13|i>>>19,C^=(i=x+j|0)<<18|i>>>14,R^=(i=P+S|0)<<7|i>>>25,k^=(i=R+P|0)<<9|i>>>23,S^=(i=k+R|0)<<13|i>>>19,P^=(i=S+k|0)<<18|i>>>14,T^=(i=M+I|0)<<7|i>>>25,O^=(i=T+M|0)<<9|i>>>23,I^=(i=O+T|0)<<13|i>>>19,M^=(i=I+O|0)<<18|i>>>14,x^=(i=w+T|0)<<7|i>>>25,k^=(i=x+w|0)<<9|i>>>23,T^=(i=k+x|0)<<13|i>>>19,w^=(i=T+k|0)<<18|i>>>14,S^=(i=C+E|0)<<7|i>>>25,O^=(i=S+C|0)<<9|i>>>23,E^=(i=O+S|0)<<13|i>>>19,C^=(i=E+O|0)<<18|i>>>14,I^=(i=P+Z|0)<<7|i>>>25,A^=(i=I+P|0)<<9|i>>>23,Z^=(i=A+I|0)<<13|i>>>19,P^=(i=Z+A|0)<<18|i>>>14,N^=(i=M+R|0)<<7|i>>>25,j^=(i=N+M|0)<<9|i>>>23,R^=(i=j+N|0)<<13|i>>>19,M^=(i=R+j|0)<<18|i>>>14;w=w+a|0,x=x+s|0,k=k+o|0,T=T+l|0,E=E+d|0,C=C+u|0,S=S+c|0,O=O+h|0,A=A+p|0,Z=Z+f|0,P=P+m|0,I=I+y|0,N=N+g|0,j=j+v|0,R=R+_|0,M=M+b|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=T>>>0&255,e[13]=T>>>8&255,e[14]=T>>>16&255,e[15]=T>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=C>>>0&255,e[21]=C>>>8&255,e[22]=C>>>16&255,e[23]=C>>>24&255,e[24]=S>>>0&255,e[25]=S>>>8&255,e[26]=S>>>16&255,e[27]=S>>>24&255,e[28]=O>>>0&255,e[29]=O>>>8&255,e[30]=O>>>16&255,e[31]=O>>>24&255,e[32]=A>>>0&255,e[33]=A>>>8&255,e[34]=A>>>16&255,e[35]=A>>>24&255,e[36]=Z>>>0&255,e[37]=Z>>>
18&255,e[38]=Z>>>16&255,e[39]=Z>>>24&255,e[40]=P>>>0&255,e[41]=P>>>8&255,e[42]=P>>>16&255,e[43]=P>>>24&255,e[44]=I>>>0&255,e[45]=I>>>8&255,e[46]=I>>>16&255,e[47]=I>>>24&255,e[48]=N>>>0&255,e[49]=N>>>8&255,e[50]=N>>>16&255,e[51]=N>>>24&255,e[52]=j>>>0&255,e[53]=j>>>8&255,e[54]=j>>>16&255,e[55]=j>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=M>>>0&255,e[61]=M>>>8&255,e[62]=M>>>16&255,e[63]=M>>>24&255}(e,t,r,n)}function b(e,t,r,n){!function(e,t,r,n){for(var i,a=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,d=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,u=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,v=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,_=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=a,x=s,k=o,T=l,E=d,C=u,S=c,O=h,A=p,Z=f,P=m,I=y,N=g,j=v,R=_,M=b,L=0;L<20;L+=2)E^=(i=w+N|0)<<7|i>>>25,A^=(i=E+w|0)<<9|i>>>23,N^=(i=A+E|0)<<13|i>>>19,w^=(i=N+A|0)<<18|i>>>14,Z^=(i=C+x|0)<<7|i>>>25,j^=(i=Z+C|0)<<9|i>>>23,x^=(i=j+Z|0)<<13|i>>>19,C^=(i=x+j|0)<<18|i>>>14,R^=(i=P+S|0)<<7|i>>>25,k^=(i=R+P|0)<<9|i>>>23,S^=(i=k+R|0)<<13|i>>>19,P^=(i=S+k|0)<<18|i>>>14,T^=(i=M+I|0)<<7|i>>>25,O^=(i=T+M|0)<<9|i>>>23,I^=(i=O+T|0)<<13|i>>>19,M^=(i=I+O|0)<<18|i>>>14,x^=(i=w+T|0)<<7|i>>>25,k^=(i=x+w|0)<<9|i>>>23,T^=(i=k+x|0)<<13|i>>>19,w^=(i=T+k|0)<<18|i>>>14,S^=(i=C+E|0)<<7|i>>>25,O^=(i=S+C|0)<<9|i>>>23,E^=(i=O+S|0)<<13|i>>>19,C^=(i=E+O|0)<<18|i>>>14,I^=(i=P+Z|0)<<7|i>>>25,A^=(i=I+P|0)<<9|i>>>23,Z^=(i=A+I|0)<<13|i>>>19,P^=(i=Z+A|0)<<18|i>>>14,N^=(i=M+R|0)<<7|i>>>25,j^=(i=N+M|0)<<9|i>>>23,R^=(i=j+N|0)<<13|i>>>19,M^=(i=R+j|0)<<18|i>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=C>>>0&255,e[5]=C>>>8&255,e[6]=C>>>16&255,e[7]=C>>>24&255,e[8]=P>>>0&255,e[9]=P>>>8&255,e[10]=P>>>16&255,e[11]=P>>>24&255,e[12]=M>>>0&255,e[13]=M>>>8&255,e[14]=M>>>16&255,e[15]=M>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=O>>>0&255,e[21]=O>>>8&255,e[22]=O>>>16&255,e[23]=O>>>24&255,e[24]=A>>>0&255,e[25]=A>>>8&255,e[26]=A>>>16&255,e[27]=A>>>24&255,e[28]=Z>>>0&255,e[29]=Z>>>8&255,e[30]=Z>>>16&255,e[31]=Z>>>24&255}(e,t,r,n)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function x(e,t,r,n,i,a,s){var o,l,d=new Uint8Array(16),u=new Uint8Array(64);for(l=0;l<16;l++)d[l]=0;for(l=0;l<8;l++)d[l]=a[l];for(;i>=64;){for(_(u,d,s,w),l=0;l<64;l++)e[t+l]=r[n+l]^u[l];for(l=8,o=1;l<16;l++)o=o+(255&d[l])|0,d[l]=255&o,o>>>=8;i-=64,t+=64,n+=64}if(i>0)for(_(u,d,s,w),l=0;l<i;l++)e[t+l]=r[n+l]^u[l];return 0}function k(e,t,r,n,i){var a,s,o=new Uint8Array(16),l=new Uint8Array(64);for(s=0;s<16;s++)o[s]=0;for(s=0;s<8;s++)o[s]=n[s];for(;r>=64;){for(_(l,o,i,w),s=0;s<64;s++)e[t+s]=l[s];for(s=8,a=1;s<16;s++)a=a+(255&o[s])|0,o[s]=255&a,a>>>=8;r-=64,t+=64}if(r>0)for(_(l,o,i,w),s=0;s<r;s++)e[t+s]=l[s];return 0}function T(e,t,r,n,i){var a=new Uint8Array(32);b(a,n,i,w);for(var s=new Uint8Array(8),o=0;o<8;o++)s[o]=n[o+16];return k(e,t,r,s,a)}function E(e,t,r,n,i,a,s){var o=new Uint8Array(32);b(o,a,s,w);for(var l=new Uint8Array(8),d=0;d<8;d++)l[d]=a[d+16];return x(e,t,r,n,i,l,o)}var C=function(e){var t,r,n,i,a,s,o,l;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=(t>>>13|r<<3)&8191,n=255&e[4]|(255&e[5])<<8,this.r[2]=(r>>>10|n<<6)&7939,i=255&e[6]|(255&e[7])<<8,this.r[3]=(n>>>7|i<<9)&8191,a=255&e[8]|(255&e[9])<<8,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=(a>>>14|s<<2)&8191,o=255&e[12]|(255&e[13])<<8,this.r[7]=(s>>>11|o<<5)&8065,l=255&e[14]|(255&e[15])<<8,this.r[8]=(o>>>8|l<<8)&8191,this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function S(e,t,r,n,i,a){var s=new C(a);return s.update(r,n,i),s.finish(e,t),0}function O(e,t,r,n,i,a){var s=new Uint8Array(16);return S(s,0,r,n,i,a),g(e,t,s,0)}function A(e,t,r,n,i){var a;if(r<32)return -1;for(E(e,0,t,0,r,n,i),S(e,16,e,32,r-32,e),a=0;a<16;a++)e[a]=0;return 0}function Z(e,t,r,n,i){var a,s=new Uint8Array(32);if(r<32||(T(s,0,32,n,i),0!==O(t,16,t,32,r-32,s)))return -1;for(E(e,0,t,0,r,n,i),a=0;a<32;a++)e[a]=0;return 0}function P(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function I(e){var t,r,n=1;for(t=0;t<16;t++)n=Math.floor((r=e[t]+n+65535)/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function N(e,t,r){for(var n,i=~(r-1),a=0;a<16;a++)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function j(e,t){var r,i,a,s=n(),o=n();for(r=0;r<16;r++)o[r]=t[r];for(I(o),I(o),I(o),i=0;i<2;i++){for(r=1,s[0]=o[0]-65517;r<15;r++)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),a=s[15]>>16&1,s[14]&=65535,N(o,s,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}
1function R(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return j(r,e),j(n,t),v(r,0,n,0)}function M(e){var t=new Uint8Array(32);return j(t,e),1&t[0]}function L(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function $(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function D(e,t,r){var n,i,a=0,s=0,o=0,l=0,d=0,u=0,c=0,h=0,p=0,f=0,m=0,y=0,g=0,v=0,_=0,b=0,w=0,x=0,k=0,T=0,E=0,C=0,S=0,O=0,A=0,Z=0,P=0,I=0,N=0,j=0,R=0,M=r[0],L=r[1],U=r[2],$=r[3],D=r[4],V=r[5],z=r[6],B=r[7],K=r[8],q=r[9],F=r[10],W=r[11],H=r[12],Y=r[13],G=r[14],J=r[15];a+=(n=t[0])*M,s+=n*L,o+=n*U,l+=n*$,d+=n*D,u+=n*V,c+=n*z,h+=n*B,p+=n*K,f+=n*q,m+=n*F,y+=n*W,g+=n*H,v+=n*Y,_+=n*G,b+=n*J,s+=(n=t[1])*M,o+=n*L,l+=n*U,d+=n*$,u+=n*D,c+=n*V,h+=n*z,p+=n*B,f+=n*K,m+=n*q,y+=n*F,g+=n*W,v+=n*H,_+=n*Y,b+=n*G,w+=n*J,o+=(n=t[2])*M,l+=n*L,d+=n*U,u+=n*$,c+=n*D,h+=n*V,p+=n*z,f+=n*B,m+=n*K,y+=n*q,g+=n*F,v+=n*W,_+=n*H,b+=n*Y,w+=n*G,x+=n*J,l+=(n=t[3])*M,d+=n*L,u+=n*U,c+=n*$,h+=n*D,p+=n*V,f+=n*z,m+=n*B,y+=n*K,g+=n*q,v+=n*F,_+=n*W,b+=n*H,w+=n*Y,x+=n*G,k+=n*J,d+=(n=t[4])*M,u+=n*L,c+=n*U,h+=n*$,p+=n*D,f+=n*V,m+=n*z,y+=n*B,g+=n*K,v+=n*q,_+=n*F,b+=n*W,w+=n*H,x+=n*Y,k+=n*G,T+=n*J,u+=(n=t[5])*M,c+=n*L,h+=n*U,p+=n*$,f+=n*D,m+=n*V,y+=n*z,g+=n*B,v+=n*K,_+=n*q,b+=n*F,w+=n*W,x+=n*H,k+=n*Y,T+=n*G,E+=n*J,c+=(n=t[6])*M,h+=n*L,p+=n*U,f+=n*$,m+=n*D,y+=n*V,g+=n*z,v+=n*B,_+=n*K,b+=n*q,w+=n*F,x+=n*W,k+=n*H,T+=n*Y,E+=n*G,C+=n*J,h+=(n=t[7])*M,p+=n*L,f+=n*U,m+=n*$,y+=n*D,g+=n*V,v+=n*z,_+=n*B,b+=n*K,w+=n*q,x+=n*F,k+=n*W,T+=n*H,E+=n*Y,C+=n*G,S+=n*J,p+=(n=t[8])*M,f+=n*L,m+=n*U,y+=n*$,g+=n*D,v+=n*V,_+=n*z,b+=n*B,w+=n*K,x+=n*q,k+=n*F,T+=n*W,E+=n*H,C+=n*Y,S+=n*G,O+=n*J,f+=(n=t[9])*M,m+=n*L,y+=n*U,g+=n*$,v+=n*D,_+=n*V,b+=n*z,w+=n*B,x+=n*K,k+=n*q,T+=n*F,E+=n*W,C+=n*H,S+=n*Y,O+=n*G,A+=n*J,m+=(n=t[10])*M,y+=n*L,g+=n*U,v+=n*$,_+=n*D,b+=n*V,w+=n*z,x+=n*B,k+=n*K,T+=n*q,E+=n*F,C+=n*W,S+=n*H,O+=n*Y,A+=n*G,Z+=n*J,y+=(n=t[11])*M,g+=n*L,v+=n*U,_+=n*$,b+=n*D,w+=n*V,x+=n*z,k+=n*B,T+=n*K,E+=n*q,C+=n*F,S+=n*W,O+=n*H,A+=n*Y,Z+=n*G,P+=n*J,g+=(n=t[12])*M,v+=n*L,_+=n*U,b+=n*$,w+=n*D,x+=n*V,k+=n*z,T+=n*B,E+=n*K,C+=n*q,S+=n*F,O+=n*W,A+=n*H,Z+=n*Y,P+=n*G,I+=n*J,v+=(n=t[13])*M,_+=n*L,b+=n*U,w+=n*$,x+=n*D,k+=n*V,T+=n*z,E+=n*B,C+=n*K,S+=n*q,O+=n*F,A+=n*W,Z+=n*H,P+=n*Y,I+=n*G,N+=n*J,_+=(n=t[14])*M,b+=n*L,w+=n*U,x+=n*$,k+=n*D,T+=n*V,E+=n*z,C+=n*B,S+=n*K,O+=n*q,A+=n*F,Z+=n*W,P+=n*H,I+=n*Y,N+=n*G,j+=n*J,b+=(n=t[15])*M,w+=n*L,x+=n*U,k+=n*$,T+=n*D,E+=n*V,C+=n*z,S+=n*B,O+=n*K,A+=n*q,Z+=n*F,P+=n*W,I+=n*H,N+=n*Y,j+=n*G,R+=n*J,a+=38*w,s+=38*x,o+=38*k,l+=38*T,d+=38*E,u+=38*C,c+=38*S,h+=38*O,p+=38*A,f+=38*Z,m+=38*P,y+=38*I,g+=38*N,v+=38*j,_+=38*R,i=Math.floor((n=a+(i=1)+65535)/65536),a=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=o+i+65535)/65536),o=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=v+i+65535)/65536),v=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,a+=i-1+37*(i-1),i=Math.floor((n=a+(i=1)+65535)/65536),a=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=o+i+65535)/65536),o=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=v+i+65535)/65536),v=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,a+=i-1+37*(i-1),e[0]=a,e[1]=s,e[2]=o,e[3]=l,e[4]=d,e[5]=u,e[6]=c,e[7]=h,e[8]=p,e[9]=f,e[10]=m,e[11]=y,e[12]=g,e[13]=v,e[14]=_,e[15]=b}function V(e,t){D(e,t,t)}function z(e,t){var r,i=n();for(r=0;r<16;r++)i[r]=t[r];for(r=253;r>=0;r--)V(i,i),2!==r&&4!==r&&D(i,i,t);for(r=0;r<16;r++)e[r]=i[r]}function B(e,t){var r,i=n();for(r=0;r<16;r++)i[r]=t[r];for(r=250;r>=0;r--)V(i,i),1!==r&&D(i,i,t);for(r=0;r<16;r++)e[r]=i[r]}function K(e,t,r){var i,a,s=new Uint8Array(32),o=new Float64Array(80),l=n(),u=n(),c=n(),h=n(),p=n(),f=n();for(a=0;a<31;a++)s[a]=t[a];for(s[31]=127&t[31]|64,s[0]&=248,L(o,r),a=0;a<16;a++)u[a]=o[a],h[a]=l[a]=c[a]=0;for(a=254,l[0]=h[0]=1;a>=0;--a)N(l,u,i=s[a>>>3]>>>(7&a)&1),N(c,h,i),U(p,l,c),$(l,l,c),U(c,u,h),$(u,u,h),V(h,p),V(f,l),D(l,c,l),D(c,u,p),U(p,l,c),$(l,l,c),V(u,l),$(c,h,f),D(l,c,d),U(l,l,h),D(c,c,l),D(l,h,f),D(h,u,o),V(u,p),N(l,u,i),N(c,h,i);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=c[a],o[a+48]=u[a],o[a+64]=h[a];var m=o.subarray(32),y=o.subarray(16);return z(m,m),D(y,y,m),j(e,y),0}function q(e,t){return K(e,t,s)}function F(e,t){return i(t,32),q(e,t)}function W(e,t,r){var n=new Uint8Array(32);return K(n,r,t),b(e,a,n,w)}C.prototype.blocks=function(e,t,r){for(var n,i,a,s,o,l,d,u,c,h,p,f,m,y,g,v,_,b,w,x=this.fin?0:2048,k=this.h[0],T=this.h[1],E=this.h[2],C=this.h[3],S=this.h[4],O=this.h[5],A=this.h[6],Z=this.h[7],P=this.h[8],I=this.h[9],N=this.r[0],j=this.r[1],R=this.r[2],M=this.r[3],L=this.r[4],U=this.r[5],$=this.r[6],D=this.r[7],V=this.r[8],z=this.r[9];r>=16;)k+=8191&(n=255&e[t+0]|(255&e[t+1])<<8),T+=(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3)&8191,E+=(i>>>10|(a=255&e[t+4]|(255&e[t+5])<<8)<<6)&8191,C+=(a>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9)&8191,S+=(s>>>4|(o=255&e[t+8]|(255&e[t+9])<<8)<<12)&8191,O+=o>>>1&8191,A+=(o>>>14|(l=255&e[t+10]|(255&e[t+11])<<8)<<2)&8191,Z+=(l>>>11|(d=255&e[t+12]|(255&e[t+13])<<8)<<5)&8191,P+=(d>>>8|(u=255&e[t+14]|(255&e[t+15])<<8)<<8)&8191,I+=u>>>5|x,c=(h=(c=0)+k*N+5*z*T+5*V*E+5*D*C+5*$*S)>>>
113,h&=8191,h+=5*U*O+5*L*A+5*M*Z+5*R*P+5*j*I,c+=h>>>13,h&=8191,c=(p=c+k*j+T*N+5*z*E+5*V*C+5*D*S)>>>13,p&=8191,p+=5*$*O+5*U*A+5*L*Z+5*M*P+5*R*I,c+=p>>>13,p&=8191,c=(f=c+k*R+T*j+E*N+5*z*C+5*V*S)>>>13,f&=8191,f+=5*D*O+5*$*A+5*U*Z+5*L*P+5*M*I,c+=f>>>13,f&=8191,c=(m=c+k*M+T*R+E*j+C*N+5*z*S)>>>13,m&=8191,m+=5*V*O+5*D*A+5*$*Z+5*U*P+5*L*I,c+=m>>>13,m&=8191,c=(y=c+k*L+T*M+E*R+C*j+S*N)>>>13,y&=8191,y+=5*z*O+5*V*A+5*D*Z+5*$*P+5*U*I,c+=y>>>13,y&=8191,c=(g=c+k*U+T*L+E*M+C*R+S*j)>>>13,g&=8191,g+=O*N+5*z*A+5*V*Z+5*D*P+5*$*I,c+=g>>>13,g&=8191,c=(v=c+k*$+T*U+E*L+C*M+S*R)>>>13,v&=8191,v+=O*j+A*N+5*z*Z+5*V*P+5*D*I,c+=v>>>13,v&=8191,c=(_=c+k*D+T*$+E*U+C*L+S*M)>>>13,_&=8191,_+=O*R+A*j+Z*N+5*z*P+5*V*I,c+=_>>>13,_&=8191,c=(b=c+k*V+T*D+E*$+C*U+S*L)>>>13,b&=8191,b+=O*M+A*R+Z*j+P*N+5*z*I,c+=b>>>13,b&=8191,c=(w=c+k*z+T*V+E*D+C*$+S*U)>>>13,w&=8191,w+=O*L+A*M+Z*R+P*j+I*N,c+=w>>>13,w&=8191,h=8191&(c=(c=(c<<2)+c|0)+h|0),c>>>=13,p+=c,k=h,T=p,E=f,C=m,S=y,O=g,A=v,Z=_,P=b,I=w,t+=16,r-=16;this.h[0]=k,this.h[1]=T,this.h[2]=E,this.h[3]=C,this.h[4]=S,this.h[5]=O,this.h[6]=A,this.h[7]=Z,this.h[8]=P,this.h[9]=I},C.prototype.finish=function(e,t){var r,n,i,a,s=new Uint16Array(10);if(this.leftover){for(a=this.leftover,this.buffer[a++]=1;a<16;a++)this.buffer[a]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,a=2;a<10;a++)this.h[a]+=r,r=this.h[a]>>>13,this.h[a]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,a=1;a<10;a++)s[a]=this.h[a]+r,r=s[a]>>>13,s[a]&=8191;for(s[9]-=8192,n=(1^r)-1,a=0;a<10;a++)s[a]&=n;for(a=0,n=~n;a<10;a++)this.h[a]=this.h[a]&n|s[a];for(a=1,this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>
1>>8|this.h[9]<<5)&65535,i=this.h[0]+this.pad[0],this.h[0]=65535&i;a<8;a++)i=(this.h[a]+this.pad[a]|0)+(i>>>16)|0,this.h[a]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},C.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n<i;n++)this.buffer[this.leftover+n]=e[t+n];if(r-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=e[t+n];this.leftover+=r}};var H=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,
11126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Y(e,t,r,n){for(var i,a,s,o,l,d,u,c,h,p,f,m,y,g,v,_,b,w,x,k,T,E,C,S,O,A,Z=new Int32Array(16),P=new Int32Array(16),I=e[0],N=e[1],j=e[2],R=e[3],M=e[4],L=e[5],U=e[6],$=e[7],D=t[0],V=t[1],z=t[2],B=t[3],K=t[4],q=t[5],F=t[6],W=t[7],Y=0;n>=128;){for(x=0;x<16;x++)k=8*x+Y,Z[x]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],P[x]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(x=0;x<80;x++)if(i=I,a=N,s=j,o=R,l=M,d=L,u=U,c=$,h=D,p=V,f=z,m=B,y=K,g=q,v=F,_=W,T=$,C=65535&(E=W),S=E>>>16,O=65535&T,A=T>>>16,T=(M>>>14|K<<18)^(M>>>18|K<<14)^(K>>>9|M<<23),C+=65535&(E=(K>>>14|M<<18)^(K>>>18|M<<14)^(M>>>9|K<<23)),S+=E>>>16,O+=65535&T,A+=T>>>16,T=M&L^~M&U,C+=65535&(E=K&q^~K&F),S+=E>>>16,O+=65535&T,A+=T>>>16,T=H[2*x],C+=65535&(E=H[2*x+1]),S+=E>>>16,O+=65535&T,A+=T>>>16,T=Z[x%16],C+=65535&(E=P[x%16]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,b=65535&O|A<<16,w=65535&C|S<<16,T=b,C=65535&(E=w),S=E>>>16,O=65535&T,A=T>>>16,T=(I>>>28|D<<4)^(D>>>2|I<<30)^(D>>>7|I<<25),C+=65535&(E=(D>>>28|I<<4)^(I>>>2|D<<30)^(I>>>7|D<<25)),S+=E>>>16,O+=65535&T,A+=T>>>16,T=I&N^I&j^N&j,C+=65535&(E=D&V^D&z^V&z),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,c=65535&O|A<<16,_=65535&C|S<<16,T=o,C=65535&(E=m),S=E>>>16,O=65535&T,A=T>>>16,T=b,C+=65535&(E=w),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,o=65535&O|A<<16,m=65535&C|S<<16,N=i,j=a,R=s,M=o,L=l,U=d,$=u,I=c,V=h,z=p,B=f,K=m,q=y,F=g,W=v,D=_,x%16==15)for(k=0;k<16;k++)T=Z[k],C=65535&(E=P[k]),S=E>>>16,O=65535&T,A=T>>>16,T=Z[(k+9)%16],C+=65535&(E=P[(k+9)%16]),S+=E>>>16,O+=65535&T,A+=T>>>16,T=((b=Z[(k+1)%16])>>>1|(w=P[(k+1)%16])<<31)^(b>>>8|w<<24)^b>>>7,C+=65535&(E=(w>>>1|b<<31)^(w>>>8|b<<24)^(w>>>7|b<<25)),S+=E>>>16,O+=65535&T,A+=T>>>16,T=((b=Z[(k+14)%16])>>>19|(w=P[(k+14)%16])<<13)^(w>>>29|b<<3)^b>>>6,C+=65535&(E=(w>>>19|b<<13)^(b>>>29|w<<3)^(w>>>6|b<<26)),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,Z[k]=65535&O|A<<16,P[k]=65535&C|S<<16;T=I,C=65535&(E=D),S=E>>>16,O=65535&T,A=T>>>16,T=e[0],C+=65535&(E=t[0]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[0]=I=65535&O|A<<16,t[0]=D=65535&C|S<<16,T=N,C=65535&(E=V),S=E>>>16,O=65535&T,A=T>>>16,T=e[1],C+=65535&(E=t[1]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[1]=N=65535&O|A<<16,t[1]=V=65535&C|S<<16,T=j,C=65535&(E=z),S=E>>>16,O=65535&T,A=T>>>16,T=e[2],C+=65535&(E=t[2]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[2]=j=65535&O|A<<16,t[2]=z=65535&C|S<<16,T=R,C=65535&(E=B),S=E>>>16,O=65535&T,A=T>>>16,T=e[3],C+=65535&(E=t[3]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[3]=R=65535&O|A<<16,t[3]=B=65535&C|S<<16,T=M,C=65535&(E=K),S=E>>>16,O=65535&T,A=T>>>16,T=e[4],C+=65535&(E=t[4]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[4]=M=65535&O|A<<16,t[4]=K=65535&C|S<<16,T=L,C=65535&(E=q),S=E>>>16,O=65535&T,A=T>>>16,T=e[5],C+=65535&(E=t[5]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[5]=L=65535&O|A<<16,t[5]=q=65535&C|S<<16,T=U,C=65535&(E=F),S=E>>>16,O=65535&T,A=T>>>16,T=e[6],C+=65535&(E=t[6]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[6]=U=65535&O|A<<16,t[6]=F=65535&C|S<<16,T=$,C=65535&(E=W),S=E>>>16,O=65535&T,A=T>>>16,T=e[7],C+=65535&(E=t[7]),S+=E>>>16,O+=65535&T,A+=T>>>16,S+=C>>>16,O+=S>>>16,A+=O>>>16,e[7]=$=65535&O|A<<16,t[7]=W=65535&C|S<<16,Y+=128,n-=128}return n}function G(e,t,r){var n,i=new Int32Array(8),a=new Int32Array(8),s=new Uint8Array(256),o=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,Y(i,a,t,r),r%=128,n=0;n<r;n++)s[n]=t[o-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,m(s,r-8,o/536870912|0,o<<3),Y(i,a,s,r),n=0;n<8;n++)m(e,8*n,i[n],a[n]);return 0}function J(e,t){var r=n(),i=n(),a=n(),s=n(),o=n(),l=n(),d=n(),u=n(),h=n();$(r,e[1],e[0]),$(h,t[1],t[0]),D(r,r,h),U(i,e[0],e[1]),U(h,t[0],t[1]),D(i,i,h),D(a,e[3],t[3]),D(a,a,c),D(s,e[2],t[2]),U(s,s,s),$(o,i,r),$(l,s,a),U(d,s,a),U(u,i,r),D(e[0],o,l),D(e[1],u,d),D(e[2],d,l),D(e[3],o,u)}function Q(e,t,r){var n;for(n=0;n<4;n++)N(e[n],t[n],r)}function X(e,t){var r=n(),i=n(),a=n();z(a,t[2]),D(r,t[0],a),D(i,t[1],a),j(e,i),e[31]^=M(r)<<7}function ee(e,t,r){var n,i;for(P(e[0],o),P(e[1],l),P(e[2],l),P(e[3],o),i=255;i>=0;--i)Q(e,t,n=r[i/8|0]>>(7&i)&1),J(t,e),J(e,e),Q(e,t,n)}function et(e,t){var r=[n(),n(),n(),n()];P(r[0],h),P(r[1],p),P(r[2],l),D(r[3],h,p),ee(e,r,t)}function er(e,t,r){var a,s=new Uint8Array(64),o=[n(),n(),n(),n()];for(r||i(t,32),G(s,t,32),s[0]&=248,s[31]&=127,s[31]|=64,et(o,s),X(e,o),a=0;a<32;a++)t[a+32]=e[a];return 0}var en=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ei(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*en[i-(n-32)],r=Math.floor((t[i]+128)/256),t[i]-=256*r;t[i]+=r,t[n]=0}for(i=0,r=0;i<32;i++)t[i]+=r-(t[31]>>4)*en[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*en[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function ea(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ei(e,r)}function es(e,t,r,i){var a,s,o=new Uint8Array(64),l=new Uint8Array(64),d=new Uint8Array(64),u=new Float64Array(64),c=[n(),n(),n(),n()];for(G(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64,a=0;a<r;a++)e[64+a]=t[a];for(a=0;a<32;a++)e[32+a]=o[32+a];for(G(d,e.subarray(32),r+32),ea(d),et(c,d),X(e,c),a=32;a<64;a++)e[a]=i[a];for(G(l,e,r+64),ea(l),a=0;a<64;a++)u[a]=0;for(a=0;a<32;a++)u[a]=d[a];for(a=0;a<32;a++)for(s=0;s<32;s++)u[a+s]+=l[a]*o[s];return ei(e.subarray(32),u),r+64}
1function eo(e,t,r,i){var a,s,d,c,h,p,m,y,g=new Uint8Array(32),_=new Uint8Array(64),b=[n(),n(),n(),n()],w=[n(),n(),n(),n()];if(r<64||(a=n(),s=n(),d=n(),c=n(),h=n(),p=n(),m=n(),(P(w[2],l),L(w[1],i),V(d,w[1]),D(c,d,u),$(d,d,w[2]),U(c,w[2],c),V(h,c),V(p,h),D(m,p,h),D(a,m,d),D(a,a,c),B(a,a),D(a,a,d),D(a,a,c),D(a,a,c),D(w[0],a,c),V(s,w[0]),D(s,s,c),R(s,d)&&D(w[0],w[0],f),V(s,w[0]),D(s,s,c),R(s,d))?-1:(M(w[0])===i[31]>>7&&$(w[0],o,w[0]),D(w[3],w[0],w[1]),0)))return -1;for(y=0;y<r;y++)e[y]=t[y];for(y=0;y<32;y++)e[y+32]=i[y];if(G(_,e,r),ea(_),ee(b,w,_),et(w,t.subarray(32)),J(b,w),X(g,b),r-=64,v(t,0,g,0)){for(y=0;y<r;y++)e[y]=0;return -1}for(y=0;y<r;y++)e[y]=t[y+64];return r}function el(e,t){if(32!==e.length)throw Error("bad key size");if(24!==t.length)throw Error("bad nonce size")}function ed(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw TypeError("unexpected type, use Uint8Array")}function eu(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:E,crypto_stream:T,crypto_stream_salsa20_xor:x,crypto_stream_salsa20:k,crypto_onetimeauth:S,crypto_onetimeauth_verify:O,crypto_verify_16:g,crypto_verify_32:v,crypto_secretbox:A,crypto_secretbox_open:Z,crypto_scalarmult:K,crypto_scalarmult_base:q,crypto_box_beforenm:W,crypto_box_afternm:A,crypto_box:function(e,t,r,n,i,a){var s=new Uint8Array(32);return W(s,i,a),A(e,t,r,n,s)},crypto_box_open:function(e,t,r,n,i,a){var s=new Uint8Array(32);return W(s,i,a),Z(e,t,r,n,s)},crypto_box_keypair:F,crypto_hash:G,crypto_sign:es,crypto_sign_keypair:er,crypto_sign_open:eo,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:16,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:64,crypto_sign_PUBLICKEYBYTES:32,crypto_sign_SECRETKEYBYTES:64,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:n,D:u,L:en,pack25519:j,unpack25519:L,M:D,A:U,S:V,Z:$,pow2523:B,add:J,set25519:P,modL:ei,scalarmult:ee,scalarbase:et},e.randomBytes=function(e){var t=new Uint8Array(e);return i(t,e),t},e.secretbox=function(e,t,r){ed(e,t,r),el(r,t);for(var n=new Uint8Array(32+e.length),i=new Uint8Array(n.length),a=0;a<e.length;a++)n[a+32]=e[a];return A(i,n,n.length,t,r),i.subarray(16)},e.secretbox.open=function(e,t,r){ed(e,t,r),el(r,t);for(var n=new Uint8Array(16+e.length),i=new Uint8Array(n.length),a=0;a<e.length;a++)n[a+16]=e[a];return n.length<32||0!==Z(i,n,n.length,t,r)?null:i.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=16,e.scalarMult=function(e,t){if(ed(e,t),32!==e.length)throw Error("bad n size");if(32!==t.length)throw Error("bad p size");var r=new Uint8Array(32);return K(r,e,t),r},e.scalarMult.base=function(e){if(ed(e),32!==e.length)throw Error("bad n size");var t=new Uint8Array(32);return q(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,n,i){var a=e.box.before(n,i);return e.secretbox(t,r,a)},e.box.before=function(e,t){ed(e,t),function(e,t){if(32!==e.length)throw Error("bad public key size");if(32!==t.length)throw Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return W(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,n,i){var a=e.box.before(n,i);return e.secretbox.open(t,r,a)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return F(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(ed(e),32!==e.length)throw Error("bad secret key size");var t=new Uint8Array(32);return q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(ed(e,t),64!==t.length)throw Error("bad secret key size");var r=new Uint8Array(64+e.length);return es(r,e,e.length,t),r},e.sign.open=function(e,t){if(ed(e,t),32!==t.length)throw Error("bad public key size");
1var r=new Uint8Array(e.length),n=eo(r,e,e.length,t);if(n<0)return null;for(var i=new Uint8Array(n),a=0;a<i.length;a++)i[a]=r[a];return i},e.sign.detached=function(t,r){for(var n=e.sign(t,r),i=new Uint8Array(64),a=0;a<i.length;a++)i[a]=n[a];return i},e.sign.detached.verify=function(e,t,r){if(ed(e,t,r),64!==t.length)throw Error("bad signature size");if(32!==r.length)throw Error("bad public key size");var n,i=new Uint8Array(64+e.length),a=new Uint8Array(64+e.length);for(n=0;n<64;n++)i[n]=t[n];for(n=0;n<e.length;n++)i[n+64]=e[n];return eo(a,i,i.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return er(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(ed(e),64!==e.length)throw Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(ed(e),32!==e.length)throw Error("bad seed size");for(var t=new Uint8Array(32),r=new Uint8Array(64),n=0;n<32;n++)r[n]=e[n];return er(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=32,e.sign.secretKeyLength=64,e.sign.seedLength=32,e.sign.signatureLength=64,e.hash=function(e){ed(e);var t=new Uint8Array(64);return G(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return ed(e,t),0!==e.length&&0!==t.length&&e.length===t.length&&0===y(e,0,t,0,e.length)},e.setPRNG=function(e){i=e},(t="undefined"!=typeof self?self.crypto||self.msCrypto:null)&&t.getRandomValues?e.setPRNG(function(e,r){var n,i=new Uint8Array(r);for(n=0;n<r;n+=65536)t.getRandomValues(i.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)e[n]=i[n];eu(i)}):(t=r(55024))&&t.randomBytes&&e.setPRNG(function(e,r){var n,i=t.randomBytes(r);for(n=0;n<r;n++)e[n]=i[n];eu(i)})}(e.exports?e.exports:self.nacl=self.nacl||{})},26623:function(e,t,r){"use strict";r.d(t,{a:function(){return i}});var n=r(2265),i=()=>(0,n.createContext)(null)},37758:function(e,t,r){"use strict";r.d(t,{a:function(){return d},c:function(){return c}});var n=r(26623),i=r(36105),a=r(2265),s=r(11724),o=r(26729),l=r(57437),d=(0,a.createContext)(null),u=(0,n.a)();function c({children:e,apiKey:t,appId:r,extensionId:n,overrideBaseUrl:c}){let h=(0,a.useMemo)(()=>(0,i.a)(t,"@crossmint/client-sdk-react-base","2.2.6"),[t]),[p,f]=(0,a.useState)(0),m=(0,a.useRef)(null);null==m.current&&(m.current=new Proxy(function e(t,r){let{apiKey:n,jwt:i,overrideBaseUrl:a,appId:l,extensionId:d}=t,u=(0,s.d)(n,r);if(!u.isValid)throw Error(u.message);return{apiKey:n,jwt:i,overrideBaseUrl:a,appId:l,extensionId:d,setJwt:function(r){return e((0,o.b)((0,o.a)({},t),{jwt:r}))}}}({apiKey:t,overrideBaseUrl:c,appId:r,extensionId:n}),{set:(e,t,r)=>("jwt"===t&&e.jwt!==r&&f(e=>e+1),Reflect.set(e,t,r))}));let y=(0,a.useCallback)(e=>{if(null==m.current)throw Error("CrossmintProvider is not initialized");e!==m.current.jwt&&(m.current.jwt=e)},[]),g=(0,a.useMemo)(()=>{if(!m.current)throw Error("CrossmintProvider is not initialized");return{get crossmint(){return m.current},setJwt:y}},[y,p]);return(0,l.jsx)(u.Provider,{value:h,children:(0,l.jsx)(d.Provider,{value:g,children:e})})}},36105:function(e,t,r){"use strict";r.d(t,{a:function(){return w}});var n=r(11724),i=r(40257),a=["debug","info","warn","error"],s=class{constructor(e="debug"){this.minLogLevel=e,this.id="console"}write(e){if(!this.shouldLog(e.level))return;let{level:t,message:r,context:n}=e,i=this.getConsoleMethod(t),a=this.formatMessage(r,n);Object.keys(n).length>0?i(a,n):i(a)}getConsoleMethod(e){switch(e){case"debug":return console.debug;case"info":return console.info;case"warn":return console.warn;case"error":return this.isProduction()?console.error:console.warn;default:return console.log}}isProduction(){return void 0!==i&&null!=i.env}formatMessage(e,t){return""===e&&Object.keys(t).length>0?`[SDK] ${JSON.stringify(t)}`:""!==e?`[SDK] ${e}`:"[SDK]"}shouldLog(e){return"silent"!==this.minLogLevel&&a.indexOf(e)>=a.indexOf(this.minLogLevel)}},o=r(40257);function l(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"undefined"!=typeof window&&void 0!==window.document?"browser":void 0!==o&&null!=o.versions&&null!=o.versions.node?"server"
1:"unknown"}var d=r(26729),u=new class{constructor(){this.sinks=[],this.sinkMap=new Map,this.initialized=!1}init(e){if(this.initialized){e.forEach(e=>this.addSink(e));return}this.sinks=[],this.sinkMap.clear(),this.initialized=!0,e.forEach(e=>this.addSink(e))}addSink(e){this.initialized||this.init([]),this.sinkMap.has(e.id)||(this.sinks.push(e),this.sinkMap.set(e.id,e))}getSinks(){return[...this.sinks]}isInitialized(){return this.initialized}flush(){return(0,d.d)(this,null,function*(){let e=[];for(let t of this.sinks)if("function"==typeof t.flush){let r=t.flush();r instanceof Promise&&e.push(r)}yield Promise.allSettled(e)})}},c=new Set(["jwt","apikey","api_key","authorization","x-api-key","accesstoken","access_token","authtoken","auth_token","bearertoken","bearer_token","idtoken","id_token","refreshtoken","refresh_token","secret","client_secret","password","privatekey","private_key","credential","authdata","bearer","derivedkeybytes","secretkey","keypair"]);function h(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,10);return`${e}-${t}`}function p(...e){let t={};for(let r of e)null!=r&&Object.assign(t,r);return t}var f=r(40257),m="pub9d76220d6115fba533270f58bbd2ebce",y=function(){if("undefined"!=typeof crypto&&null!=crypto.randomUUID)return crypto.randomUUID().replace(/-/g,"").substring(0,16);let e="";for(let t=0;t<16;t++)e+="0123456789abcdef"[Math.floor(16*Math.random())];return e}(),g=class{constructor(e,t,r,n){this.initialized=!1,this.batchQueue=[],this.batchTimeout=null,this.BATCH_SIZE=10,this.BATCH_TIMEOUT_MS=5e3,this.platform=e,this.id=`${e}-datadog`,this.agentInfo=null!=n?n:{},this.options={clientToken:m,site:"datadoghq.com",service:null!=r?r:"crossmint-sdk",env:t,sampleRate:100,forwardErrorsToLogs:!1};let i=`https://http-intake.logs.datadoghq.com/v1/input/${m}`;this.intakeUrl=`https://telemetry.crossmint.com/dd?ddforward=${encodeURIComponent(i)}`}initialize(){this.initialized||(this.initialized=!0)}write(e){this.initialized||this.initialize(),this.batchQueue.push(e),this.batchQueue.length>=this.BATCH_SIZE?this.flush():null==this.batchTimeout&&(this.batchTimeout=setTimeout(()=>{this.flush()},this.BATCH_TIMEOUT_MS))}flush(){return(0,d.d)(this,null,function*(){var e;if(0===this.batchQueue.length)return;let t=this.batchQueue.splice(0);null!=this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=null);try{let r;switch(this.platform){case"browser":r="undefined"!=typeof window?window.location.hostname:"browser";break;case"react-native":r="react-native";break;case"server":r=void 0!==f&&null!=(e=f.env.HOSTNAME)?e:"unknown"}let n=this.getAgentInfo(),i=t.map(e=>{var t,i,a;return(0,d.a)((0,d.a)({ddtags:`env:${null!=(t=this.options.env)?t:"production"},service:${null!=(i=this.options.service)?i:"crossmint-sdk"}`,hostname:r,message:e.message,service:null!=(a=this.options.service)?a:"crossmint-sdk",status:this.mapLevelToStatus(e.level),timestamp:e.timestamp,"dd-session_id":y},n),e.context)});if("undefined"==typeof fetch){let e="server"===this.platform?"fetch is not available. Please use Node.js 18+ or polyfill fetch (e.g., node-fetch)":`fetch is not available in this ${this.platform} environment`;throw Error(e)}let a=yield fetch(this.intakeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){let e=yield a.text();console.warn("[SDK Logger] Datadog proxy returned error:",a.status,a.statusText,e)}}catch(e){console.warn("[SDK Logger] Error sending logs to Datadog:",e)}})}mapLevelToStatus(e){switch(e){case"debug":case"info":default:return"info";case"warn":return"warn";case"error":return"error"}}getAgentInfo(){let e=(0,d.a)({},this.agentInfo);return"browser"===this.platform&&"undefined"!=typeof navigator&&(e.user_agent=navigator.userAgent),e}},v=class extends g{constructor(e){super("browser",e,window.location.hostname)}},_=class extends g{constructor(e){super("server",e)}},b=class e{constructor(e){this.globalContext={},this.initialized=!1,this.asyncContextStore=null,null!=e&&this.init(e)}init(t){var r;if(this.initialized){this.warn("SdkLogger.init called multiple times. Ignoring subsequent calls.");return}let n=null!=(r=t.platform)?r:l(),i={sdk_version:t.packageVersion,sdk_name:t.packageName,platform:n,environment:t.environment,project_id:t.projectId,package:t.packageName,origin:"crossmint-sdk"};this.setContext(i),null!=t.additionalContext&&this.setContext(t.additionalContext),u.isInitialized()||u.
1init([new s(t.consoleLogLevel)]),e.flushListenersSetup||(this.setupFlushListeners(n),e.flushListenersSetup=!0),this.initialized=!0}addSink(e){if(!this.initialized){console.warn("[SdkLogger] Cannot add sink before initialization. Call init() first.");return}u.addSink(e)}setContext(e){this.globalContext=p(this.globalContext,e)}getExecutionContext(){return null!=this.asyncContextStore?this.asyncContextStore.getStore():this.currentExecutionContext}getOrCreateAsyncContextStore(){var e;return null===this.asyncContextStore&&(this.asyncContextStore=function(){var e;if(!(void 0===f||(null==(e=f.versions)?void 0:e.node)==null))try{return new((0,d.c)("node:async_hooks")).AsyncLocalStorage}catch(e){return}}()),null!=(e=this.asyncContextStore)?e:void 0}debug(e,...t){this.log("debug",e,...t)}info(e,...t){this.log("info",e,...t)}warn(e,...t){this.log("warn",e,...t)}error(e,...t){this.log("error",e,...t)}withExecutionContext(e,t,r){var n,i;let a;let s=this.getOrCreateAsyncContextStore();if(null!=s){let n=s.getStore();if((null==n?void 0:n.execution_id)!=null)return r();let i=h(),a=(0,d.a)((0,d.b)((0,d.a)({},null!=n?n:{}),{execution_id:i,method:e}),null!=t?t:{});return s.run(a,r)}if((null==(n=this.currentExecutionContext)?void 0:n.execution_id)!=null)return r();let o=this.currentExecutionContext,l=h(),u=(0,d.a)((0,d.b)((0,d.a)({},null!=o?o:{}),{execution_id:l,method:e}),null!=t?t:{});this.currentExecutionContext=u;try{a=r()}catch(e){throw this.currentExecutionContext=o,e}return null!=(i=a)&&"function"==typeof i.then?a.finally(()=>{this.currentExecutionContext=o}):(this.currentExecutionContext=o,a)}getCurrentExecutionId(){var e;return null==(e=this.getExecutionContext())?void 0:e.execution_id}flush(){return(0,d.d)(this,null,function*(){yield u.flush()})}setupFlushListeners(e){"browser"===e?this.setupBrowserFlushListeners():"server"===e&&this.setupServerFlushListeners()}setupBrowserFlushListeners(){"undefined"!=typeof window&&(window.addEventListener("beforeunload",()=>{this.flush()}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()}),window.addEventListener("pagehide",()=>{this.flush()}))}setupServerFlushListeners(){if(void 0===f)return;let e=()=>(0,d.d)(this,null,function*(){try{yield this.flush()}catch(e){console.error("[SdkLogger] Error flushing logs on exit:",e)}});f.once("SIGTERM",e),f.once("SIGINT",e),f.once("beforeExit",e)}log(e,t,...r){var n;if(!this.initialized){("error"===e?console.error:"warn"===e?console.warn:console.log)("[SDK Logger not initialized]",t,...r);return}let{message:i,context:a}=function(e){let t=[],r={};for(let n of e)null==n?t.push(String(n)):n instanceof Error?(r.error={name:n.name,message:n.message,stack:n.stack},t.push(n.message)):"object"==typeof n?Object.assign(r,n):t.push(String(n));return{message:t.join(" "),context:r}}([t,...r]),s={level:e,message:i,context:function e(t,r=0){if(r>10||null==t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(t=>e(t,r+1));if(t instanceof Error)return(0,d.a)({name:t.name,message:t.message,stack:t.stack},e(Object.fromEntries(Object.entries(t)),r+1));let n={};for(let[i,a]of Object.entries(t))c.has(i.toLowerCase())?n[i]="string"==typeof a&&a.length>20?`${a.slice(0,4)}...${a.slice(-4)}`:"[REDACTED]":n[i]=e(a,r+1);return n}(p(this.globalContext,null!=(n=this.getExecutionContext())?n:{},a)),timestamp:Date.now()};for(let e of u.getSinks())try{e.write(s)}catch(e){console.error("[SdkLogger] Error writing to sink:",e)}}};function w(e,t,r,i){let a=(0,n.d)(e);if(!a.isValid)throw Error(`Invalid API key: ${a.message}`);let{environment:s,projectId:o}=a,d=new b({packageName:t,packageVersion:r,environment:s,projectId:o,consoleLogLevel:i}),u=l();if("browser"===u){let e=new v(s);d.addSink(e)}else if("server"===u){let e=new _(s);d.addSink(e)}return d}b.flushListenersSetup=!1},58788:function(e,t,r){"use strict";r.d(t,{b:function(){return c}});var n=r(79601),i=r(9801),a=r(26623),s=r(36105),o=r(37758),l=r(2265),d=r(57437),u=(0,a.a)();function c(e){var{apiKey:t,consoleLogLevel:r}=e,a=(0,i.c)(e,["apiKey","consoleLogLevel"]);let c=(0,l.useMemo)(()=>(0,s.a)(t,n.b.name,n.b.version,r),[t,r]);return(0,d.jsx)(u.Provider,{value:c,children:(0,d.jsx)(o.c,(0,i.a)({apiKey:t},a))})}},54403:function(e,t,r){"use strict";r.d(t,{a:function(){return Y}});var n=r(9801);let i=["https://api.basistheory.com","https://api.test.basistheory.com","https://agentic.basistheory.com"],a=["agentic-token"],s=["vic","agentpay"],o="bt_agentic_device_id",l="VERIFICATION_STATE_INVA
1LID";function d(){let e=globalThis.crypto;if("function"==typeof e?.randomUUID)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;let r=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}let u=null;class c extends Error{constructor(e){super(e),this.name="AgenticVerificationError",Object.setPrototypeOf(this,c.prototype)}}class h extends c{constructor(e,{status:t,problem:r,traceId:n}){super(e),this.name="ApiError",this.status=t,this.type=r?.type,this.title=r?.title,this.detail=r?.detail,this.errors=r?.errors,this.debug=r?.debug,this.traceId=n,Object.setPrototypeOf(this,h.prototype)}}class p extends c{constructor(e="Verification was cancelled."){super(e),this.name="VerificationCancelledError",Object.setPrototypeOf(this,p.prototype)}}class f extends c{constructor(e="The browser blocked the verification popup.\nAllow popups for this site and try again."){super(e),this.name="PopupBlockedError",Object.setPrototypeOf(this,f.prototype)}}class m extends c{constructor(e="The verification popup was closed before completion."){super(e),this.name="PopupClosedError",Object.setPrototypeOf(this,m.prototype)}}class y extends c{constructor(e="Verification timed out."){super(e),this.name="CeremonyTimeoutError",Object.setPrototypeOf(this,y.prototype)}}class g extends c{constructor(e="This card does not support verification.\nTry another card or contact support.",t){super(e),this.name="VerificationNotSupportedError",this.apiError=t,Object.setPrototypeOf(this,g.prototype)}}class v extends c{constructor(e){super(e),this.name="ConfigurationError",Object.setPrototypeOf(this,v.prototype)}}function _(e){let t=new Set,r=!1;return{async selectOtpMethod(t){try{return await e.selectOtpMethod(t)??null}catch{return null}},async collectOtp(t){let r=await e.collectOtp(t);if(null==r)return null;if("string"!=typeof r)throw new v("handlers.collectOtp must resolve a string code (or null to cancel).");return{code:r}},async confirmCeremony({network:n,action:i,isRestart:a,openPopup:s}){let o,l=!1,d=await e.confirmCeremony({network:n,action:i,isRestart:a,openPopup:()=>r?null:(l||(o=s(),l=!0,o&&("object"==typeof o||"function"==typeof o)&&t.add(o)),o)});if(l)return o;if(null==d||!1===d)return null;throw new v("handlers.confirmCeremony must call request.openPopup() synchronously inside the user gesture and return its result (or return null to cancel).")},promptRetry:()=>Promise.resolve(!1),showWaiting(){},showProgress(){},showSuccess(){},showTerminalError(){},hide(){},dispose(){for(let e of(r=!0,t))try{e.close?.()}catch{}t.clear()}}}function b(e,t){let r=new AbortController,n=setTimeout(()=>{r.abort(t??new DOMException("The operation timed out.","TimeoutError"))},e);return{signal:r.signal,cancel:()=>clearTimeout(n)}}function w(e){let t=new AbortController;for(let r of e)if(r){if(r.aborted){t.abort(r.reason);break}r.addEventListener("abort",()=>t.abort(r.reason),{once:!0,signal:t.signal})}return t.signal}function x(e){if(e?.aborted)throw e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError")}function k(e,t){return t?new Promise((r,n)=>{let i=()=>{e.catch(()=>{}),n(t.reason instanceof Error?t.reason:new DOMException("The operation was aborted.","AbortError"))};t.aborted?i():(t.addEventListener("abort",i,{once:!0}),e.then(e=>{t.removeEventListener("abort",i),r(e)},e=>{t.removeEventListener("abort",i),n(e)}))}):e}let T=!1;async function E(e){let t=null;try{t=await e.json()}catch{t=null}let r=e.headers.get("bt-trace-id")??void 0;return new h(t?.detail||t?.title||`The Basis Theory API responded with HTTP ${e.status}.`,{status:e.status,problem:t,traceId:r})}let C=` 2:host { 3 all: initial; 4 --bt-agentic-success-soft: color-mix( 5 in srgb, var(--bt-agentic-success) 10%, transparent 6 ); 7 --bt-agentic-error-soft: color-mix( 8 in srgb, var(--bt-agentic-error) 10%, transparent 9 ); 10} 11*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } 12.overlay { 13 position: fixed; inset: 0; z-index: 2147483647; 14 background: rgba(0, 0, 0, 0.72); 15 display: flex; align-items: center; justify-content: center; 16 padding: 16px; 17 font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 18 -webkit-font-smoothing: antialiased; 19} 20.modal { 21 width: min(440px, calc(100vw - 32px)); 22 min-height: 420px; 23 max-height: calc(100vh - 32px); 24 overflow-y: auto; 25 background: var(--bt-agentic-background); 26 color: var(--bt-agentic-font); 27 border: 1px solid var(--bt-agentic-secondary); 28 border-radius: 16px; 29 padding: 32px; 30 position: relative; 31 display: grid; 32 grid-template-rows: auto minmax(0, 1fr) auto; 33 row-gap: 28px; 34 box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4); 35} 36.modal:focus { outline: none; } 37.modal-header { width: 100%; align-self: start; } 38.title { 39 font-size: 20px; font-weight: 700; text-align: center; 40 color: var(--bt-agentic-font); 41} 42.subtitle { 43 font-size: 14px; line-height: 1.5; text-align: center; 44 color: var(--bt-agentic-font); opacity: 0.65; 45 width: 100%; margin: 8px 0 0;
46 overflow-wrap: anywhere; white-space: pre-line; 47} 48.modal-middle { 49 width: 100%; min-height: 96px; 50 display: flex; flex-direction: column; 51 align-items: center; justify-content: center; gap: 24px; 52} 53.status-icon { 54 display: block; flex: none; margin: 0 auto; 55} 56.content { width: 100%; } 57.buttons { 58 display: flex; flex-direction: column; gap: 10px; 59 width: 100%; align-self: end; 60} 61.btn { 62 width: 100%; min-height: 44px; border: 0; border-radius: 10px; 63 font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; 64 color: var(--bt-agentic-font); 65} 66.btn:disabled { opacity: 0.5; cursor: not-allowed; } 67.btn:focus-visible { 68 outline: 2px solid var(--bt-agentic-primary); outline-offset: 2px; 69} 70.btn-primary { 71 background: var(--bt-agentic-primary); 72 color: var(--bt-agentic-background); 73} 74.btn-secondary { background: var(--bt-agentic-secondary); } 75.btn-tertiary { background: transparent; opacity: 0.8; } 76.btn-primary:hover:not(:disabled), 77.btn-secondary:hover:not(:disabled) { filter: brightness(1.08); } 78.btn-tertiary:hover:not(:disabled) { opacity: 1; } 79@supports (background: color-mix(in srgb, red 50%, blue)) { 80 .btn-primary:hover:not(:disabled) { 81 filter: none; 82 background: color-mix( 83 in srgb, 84 var(--bt-agentic-primary) 92%, 85 var(--bt-agentic-background) 8% 86 ); 87 } 88 .btn-secondary:hover:not(:disabled) { 89 filter: none; 90 background: color-mix(in srgb, var(--bt-agentic-secondary) 85%, #ffffff 15%); 91 } 92} 93.methods { display: flex; flex-direction: column; gap: 10px; } 94.method { 95 display: flex; gap: 12px; align-items: flex-start; width: 100%; 96 background: var(--bt-agentic-secondary); color: var(--bt-agentic-font); 97 border: 2px solid transparent; border-radius: 12px; 98 padding: 14px 16px; cursor: pointer; text-align: left; font: inherit; 99} 100.method[aria-checked='true'], 101.method:focus-visible { 102 border-color: var(--bt-agentic-primary); outline: none; 103} 104.method .radio { 105 width: 18px; height: 18px; flex: none; margin-top: 2px; 106 border: 2px solid var(--bt-agentic-font); border-radius: 50%; 107 opacity: 0.5; position: relative; 108} 109.method[aria-checked='true'] .radio { 110 border-color: var(--bt-agentic-primary); opacity: 1; 111} 112.method[aria-checked='true'] .radio::after { 113 content: ''; position: absolute; inset: 3px; border-radius: 50%; 114 background: var(--bt-agentic-primary); 115} 116.method-label { font-weight: 700; font-size: 15px; } 117.method-value { 118 font-size: 13px; opacity: 0.65; margin-top: 2px; overflow-wrap: anywhere; 119} 120.otp-row { 121 display: flex; gap: 10px; justify-content: center; 122 width: fit-content; max-width: 100%; margin-inline: auto; 123} 124.otp-box { 125 width: 48px; height: 56px; min-width: 0; flex: 1 1 48px; 126 border-radius: 10px; 127 border: 2px solid transparent; 128 background: var(--bt-agentic-secondary); color: var(--bt-agentic-font); 129 font: inherit; font-size: 22px; text-align: center; 130} 131.otp-box:focus { border-color: var(--bt-agentic-primary); outline: none; } 132.hint { font-size: 12px; opacity: 0.55; text-align: center; margin-top: 14px; } 133.error-text { 134 color: var(--bt-agentic-error); font-size: 13px; text-align: center; 135 margin-top: 12px; min-height: 1em; overflow-wrap: anywhere; 136 white-space: pre-line; 137} 138.error-text:empty { display: none; } 139.content > .error-text:first-child { margin-top: 0; } 140.spinner { 141 width: 64px; height: 64px; border-radius: 50%; 142 border: 4px solid var(--bt-agentic-secondary); 143 border-top-color: var(--bt-agentic-primary); 144 animation: bt-agentic-spin 0.9s linear infinite; 145} 146@keyframes bt-agentic-spin { to { transform: rotate(360deg); } } 147@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } } 148.success-icon { 149 width: 80px; height: 80px; border-radius: 50%; 150 border: 2px solid var(--bt-agentic-success); 151 background: var(--bt-agentic-success-soft); position: relative; 152} 153.success-icon::after { 154 content: ''; position: absolute; width: 18px; height: 32px; 155 left: 29px;
155 top: 17px; 156 border: solid var(--bt-agentic-success); border-width: 0 4px 4px 0; 157 transform: rotate(45deg); 158} 159.fingerprint-icon { 160 width: 80px; height: 80px; border-radius: 50%; 161 border: 2px solid var(--bt-agentic-primary); 162 background: color-mix(in srgb, var(--bt-agentic-primary) 7%, transparent); 163 color: var(--bt-agentic-primary); 164 display: flex; align-items: center; justify-content: center; 165} 166.fingerprint-icon svg { width: 52px; height: 52px; } 167.fingerprint-icon path { 168 fill: currentColor; 169} 170.error-icon { 171 width: 80px; height: 80px; border-radius: 50%; 172 border: 2px solid var(--bt-agentic-error); 173 background: var(--bt-agentic-error-soft); position: relative; 174} 175.error-icon::before, .error-icon::after { 176 content: ''; position: absolute; left: 21px; top: 36px; 177 width: 34px; height: 4px; border-radius: 999px; 178 background: var(--bt-agentic-error); 179} 180.error-icon::before { transform: rotate(45deg); } 181.error-icon::after { transform: rotate(-45deg); } 182`,S={methodSelectTitle:"Verify Your Identity",methodSelectSubtitle:"Select a method to receive your verification code.",methodLabelSms:"Text a code",methodLabelEmail:"Email a code",methodLabelOutboundCall:"Call me with a code",methodLabelBanking:"Online banking",methodLabelFallback:"Verify",otpTitle:"Enter Verification Code",otpSubtitleSms:"Enter the code sent to your phone.",otpSubtitleEmail:"Enter the code sent to your email.",otpSubtitleFallback:"Enter the verification code you received.",otpHint:"Code expires in {minutes} min \xb7 {attempts} attempts",otpInvalid:"Invalid code. Please try again.",continueButton:"Continue",confirmButton:"Confirm",backButton:"Back",cancelButton:"Cancel",tryAgainButton:"Try Again",closeButton:"Close",visaAuthenticateTitle:"Confirm With Your Visa Passkey",visaAuthenticateSubtitle:"Confirm with a passkey in a secure Visa window.",visaRegisterTitle:"Set Up Your Visa Passkey",visaRegisterSubtitle:"Create a passkey in a secure Visa window.",visaRestartTitle:"Confirm With Your Visa Passkey",visaRestartSubtitle:"Confirm verification with the created passkey.",mastercardRedirectTitle:"Verify With Mastercard",mastercardRedirectSubtitle:"A secure Mastercard window will open.",waitingTitle:"Verification in Progress",waitingSubtitle:"Complete verification in the secure window.",progressTitle:"Verification in Progress",progressSubtitle:"Keep this page open while verification completes.",errorTitle:"Something Went Wrong",successTitle:"Verification Complete",retryErrorSubtitle:"Verification could not be completed.\nPlease try again.",terminalErrorSubtitle:"Verification could not be completed.\nTry another card or contact support."};function O(e,t,r){let n=document.createElement(e);return t&&(n.className=t),void 0!==r&&(n.textContent=r),n}function A(e){let t=O("div",`status-icon ${e}`);return t.setAttribute("aria-hidden","true"),t}function Z(e){let t=A("spinner");return t.removeAttribute("aria-hidden"),t.setAttribute("role","progressbar"),t.setAttribute("aria-label",e),t}function P(e,t){return(e instanceof y||e instanceof f||e instanceof m||e instanceof g)&&e.message||t}let I={primaryColor:"#ffffff",secondaryColor:"#212124",backgroundColor:"#0d0d10",fontColor:"#e4e4e7",successColor:"#6ee7b7",errorColor:"#fda4af"},N={primaryColor:"--bt-agentic-primary",secondaryColor:"--bt-agentic-secondary",backgroundColor:"--bt-agentic-background",fontColor:"--bt-agentic-font",successColor:"--bt-agentic-success",errorColor:"--bt-agentic-error"};function j({expectedOrigins:e,getSource:t,onMessage:r}){let n=n=>{if(!e.includes(n.origin))return;if(t){let e=t();if(!e||n.source!==e)return}let i=n.data;i&&"object"==typeof i&&r(i,n)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}function R(e,t){return new Promise((r,n)=>{try{x(t)}catch(e){n(e);return}let i=setTimeout(()=>{t?.removeEventListener("abort",a),r()},e),a=()=>{clearTimeout(i),n(t?.reason instanceof Error?t.reason:new DOMException("The operation was aborted.","AbortError"))};t?.addEventListener("abort",a,{once:!0})})}function M(e,t){let r;try{r=new URL(e)}catch{throw new c(`${t} is not a valid absolute URL.`)}if("https:"!==r.protocol&&"http:"!==r.protocol)throw new c(`${t} must be an http(s) URL, got "${r.protocol}".`);return r}async function L({complete:e,attempts:t=10,delayMs:r=2e3,expiresAt:n,external:i=!1,signal:a}){let s=i?6*t:t;if(i&&n){let e=Date.parse(n)-Date.now();Number.isFinite(e)&&(s=Math.max(1,Math.min(s,Math.ceil(e/r))))}for(let t=0;t<s;t+=1){let n=await e();if("active"===n.status||n.next_action)return n;t<s-1&&await R(r,a)}throw new y("Mastercard has not confirmed the verification yet. Ask the cardholder to finish the Mastercard window, then try again.")}function U(e){M(e.iframe_url,"The Visa embed iframe_url");let t=new URLSearchParams({apiKey:e.api_key,clientAppId:e.client_app_id,topOrigin:window.location.origin,integrator_origin:window.location.origin});return`${e.iframe_url}?${t}`}let $=Symbol("back");function D(e){return e instanceof h&&409===e.status&&"string"==typeof e.type&&e.type.endsWith("_IN_PROGRESS")}async function V(e){if(e.provider)return{provider:e.provider};if(!e.transport.getAllowance)throw new v("No `provider` was given and provider discovery is unavailable. Either pass `provider` to verifyAllowance (read it from the allowance's rails[] entry — never infer it from card brand), or supply a `getAllowance` function with a custom transport. Public applications can verify allowances but cannot read them.");let t=await k(e.transport.getAllowance(e.allowanceId,{signal:e.signal}),e.signal),r=(Array.isArray(t?.rails)?t.rails:[]).find(t=>t.rail===e.rail);if(!r?.provider)throw new v(`Allowance "${e.allowanceId}" has no "${e.rail}" rail, so there is nothing to verify. Check the allowance rails, or pass \`rail\`/\`provider\` explicitly.`);if("error"===r.status)throw new v(`The "${e.rail}" rail on allowance "${e.allowanceId}" is in the error state \u2014 verification cannot fix a failed rail. Repair it first with POST /allowances/{id}/rails/retry.`);let n=String(r.provider);if(!s.includes(n))throw new v(`The allowance's "${e.rail}" rail uses provider "${n}", which is not supported.`);return{provider:n}}async function z(e,t,r){let n={rail:e.rail,provider:t,...r},i=0;for(;;){x(e.signal);try{let t=await k(e.transport.verify(e.allowanceId,n,{signal:e.signal}),e.signal);return e.emit({type:"state_change",allowanceId:e.allowanceId,action:r.action,status:t.status,nextActionType:t.next_action?.type??null}),t}catch(t){if(D(t)&&i<4){i+=1,await R(1e3*2**(i-1),e.signal);continue}throw t}}}async function B(e,t,r,n){let i=1,a=null;for(;;){x(e.signal);let s=await k(e.presenter.collectOtp({method:r.method,codeExpirationMinutes:r.code_expiration_minutes??5,maxAttempts:r.max_attempts??3,attempt:i,error:a,canGoBack:n}),e.signal);if(null==s)throw new p;if("back"in s&&s.back)return $;e.presenter.showProgress();try{return await z(e,t,{action:"submit_otp",otp_code:s.code})}catch(e){if(e instanceof h&&"INVALID_OTP"===e.type){a=e,i+=1;continue}throw e}}}async function K(e,t,r){for(;;){x(e.signal);let n=await k(e.presenter.selectOtpMethod(r),e.signal);if(null==n)throw new p;e.presenter.showProgress();let i=await z(e,t,{action:"select_otp_method",method_id:n});if("active"===i.status||i.next_action?.type!=="otp")return i;let a=await B(e,t,i.next_action,!0);if(a!==$)return a}}async function q(e,t){let{presenter:r,signal:n}=e,i=null,a=!1;try{r.showProgress();let s=await z(e,t,{action:"start",display_name:e.displayName,device_context:e.deviceContextFactory()});for(;"active"!==s.status;){x(n);let o=s.next_action;if(!o)throw new c("The API reported that verification is still required but returned no next action. Retry the verification.");switch(o.type){case"passkey_session":r.showProgress(),i?.dispose(),i=await function({embed:e,clientName:t,signal:r}){let n=U(e),i=new URL(n,window.location.href).origin,a=document.createElement("iframe");a.src=n,a.setAttribute("allow","publickey-credentials-get; publickey-credentials-create"),a.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"),a.style.cssText="position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;border:0;visibility:hidden;";let s=null,o=!1,l=()=>{o||(o=!0,s?.(),s=null,a.remove())};return new Promise((o,d)=>{let u=setTimeout(()=>{h(new y("Verification could not load.\nTurn off ad/content blocking and try again."))},15e3),h=e=>{clearTimeout(u),r?.removeEventListener("abort",p),l(),d(e)},p=()=>{h(r?.reason instanceof Error?r.reason:new DOMException("The operation was aborted.","AbortError"))};r?.aborted?p():(r?.addEventListener("abort",p,{once:!0}),s=j({expectedOrigins:[i],getSource:()=>a.contentWindow,onMessage:s=>{if("AUTH_READY"===s.type)return void a.contentWindow?.postMessage({requestID:s.requestID,type:"CREATE_AUTH_SESSION",version:"1",contentType:"application/json",client:{id:e.client_app_id,name:t}},i);if("AUTH_SESSION_CREATED"===s.type){let e=s.sessionContext||{};if(!e.secureToken)return void h(new c("Visa created an auth session without a secure token. Try again."));clearTimeout(u),r?.removeEventListener("abort",p),o({secureToken:e.secureToken,url:n,origin:i,dispose:l})}}}),document.body.appendChild(a))})}({embed:o.embed,clientName:e.displayName,signal:n}),s=await z(e,t,{action:"submit_session",session_context:{secure_token:i.secureToken}});break;case"select_otp_method":{let r=o.methods,n=Array.isArray(r)?r.filter(e=>e?.type!=="customerservice"):[];if(0===n.length)throw new c("The API offered no actionable verification methods for this card.");
182s=await K(e,t,n);break}case"otp":{let r=await B(e,t,o,!1);if(r===$)throw new c("Cannot go back from this step.");s=r;break}case"passkey":{let l=o.passkey_context,d=o.embed?U(o.embed):i?.url;if(!d)throw new c("The passkey step carried no embed block and no Visa session is mounted.");let u=await k(r.confirmCeremony({network:"visa",action:l.action,isRestart:a,openPopup:()=>(x(n),function({url:e}){let t=Math.max(0,(window.screen.width-560)/2),r=Math.max(0,(window.screen.height-600)/2),n=window.open(e,"VPP_POPUP",`width=560,height=600,left=${t},top=${r},toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes`);if(!n)throw new f("The browser blocked the Visa verification popup.\nAllow popups for this site and try again.");return{popup:n,origin:new URL(e,window.location.href).origin,close:()=>{n.closed||n.close()}}}({url:d}))}),n);if(!u)throw new p;r.showWaiting("visa"),e.emit({type:"ceremony_open",network:"visa",action:l.action});let h=await function(e,t,{signal:r}={}){let{popup:n,origin:i,close:a}=e;return new Promise((e,s)=>{let o,l=()=>{},d=(t,n)=>{clearInterval(o),l(),r?.removeEventListener("abort",u),a(),t?s(t):e(n)},u=()=>{d(r?.reason instanceof Error?r.reason:new DOMException("The operation was aborted.","AbortError"))};r?.aborted?u():(r?.addEventListener("abort",u,{once:!0}),l=j({expectedOrigins:[i],getSource:()=>n,onMessage:e=>{if("AUTH_READY"===e.type)return void n.postMessage({requestID:e.requestID,type:"AUTHENTICATE",version:"1",authenticationContext:{endpoint:t.endpoint,identifier:t.identifier,payload:t.payload,action:t.action,platformType:t.platform_type,authenticationPreferencesEnabled:{responseMode:t.auth_preferences?.response_mode,responseType:t.auth_preferences?.response_type}}},i);if("AUTH_COMPLETE"===e.type){let t;return void d(null,{identifier:(t=e.assuranceData||{}).identifier,dfp_session_id:t.rpID,fido_assertion_data:{code:t.fidoBlob}})}"AUTH_CANCELLED"===e.type?d(new p("The Visa verification was cancelled in the Visa window.")):("AUTH_FAILED"===e.type||"AUTH_NOT_PERFORMED"===e.type||"AUTH_NOT_SUPPORTED"===e.type)&&d(new c(e.error?.message||`The Visa passkey ceremony ended with ${e.type}.`))}}),o=setInterval(()=>{n.closed&&d(new m("The Visa verification popup was closed before completion."))},500))})}(u,l,{signal:n});"REGISTER"===l.action?(a=!0,r.showProgress(),e.emit({type:"restart",reason:"register_complete"}),s=await z(e,t,{action:"start",display_name:e.displayName,device_context:e.deviceContextFactory()})):(r.showProgress(),s=await z(e,t,{action:"submit_passkey",assurance_data:h}));break}case"redirect":{let i=await k(r.confirmCeremony({network:"mastercard",action:"redirect",isRestart:!1,openPopup:()=>(x(n),function({uri:e,openRedirect:t}){if(M(e,"The Mastercard redirect uri"),t)return t(e),{popup:null,close:()=>{}};let r=window.open(e,"mc-auth","width=480,height=720");if(!r)throw new f("The browser blocked the Mastercard verification popup.\nAllow popups for this site and try again.");return{popup:r,close:()=>{r.closed||r.close()}}}({uri:o.uri,openRedirect:e.openRedirect}))}),n);if(!i)throw new p;r.showWaiting("mastercard"),e.emit({type:"ceremony_open",network:"mastercard"});let a=null,l=new AbortController,d=w([n,l.signal]),u=function(e,{bridgeOrigins:t,signal:r}){let{popup:n}=e;return n?new Promise((e,i)=>{let a,s=()=>{},o=t=>{clearInterval(a),s(),r?.removeEventListener("abort",l),e(t)},l=()=>{clearInterval(a),s(),i(r?.reason instanceof Error?r.reason:new DOMException("The operation was aborted.","AbortError"))};r?.aborted?l():(r?.addEventListener("abort",l,{once:!0}),s=j({expectedOrigins:t,getSource:()=>n,onMessage:e=>{"mastercard_verification_complete"===e.type&&o("message")}}),a=setInterval(()=>{n.closed&&o("closed")},500))}):Promise.resolve("external")}(i,{bridgeOrigins:e.bridgeOrigins,signal:d});u.catch(()=>{});try{for(;;){let r,i=new AbortController,s=R(15e3,w([n,i.signal])).then(()=>"probe");s.catch(()=>{});try{r=await Promise.race([u,s])}finally{i.abort()}if("probe"!==r)break;let o=await z(e,t,{action:"complete"});if("active"===o.status||o.next_action){a=o,await u;break}}}finally{l.abort(),i.close(),await u.catch(()=>{})}r.showProgress(),s=a??await L({complete:()=>z(e,t,{action:"complete"}),attempts:e.mcPollAttempts,delayMs:e.mcPollDelayMs,expiresAt:o.expires_at,external:null===i.popup,signal:n});break}default:throw new c(`The API returned an unsupported verification step "${o.type}". Update @basis-theory/web-agentic to the latest version.`)}}return s}finally{i?.dispose()}}async function F(e){let{presenter:t}=e,r=!1;try{let n;try{({provider:n}=await V(e))}catch(r){let t=r instanceof v||r instanceof p||r instanceof y?r:new v("Could not read the allowance to discover the provider"+(r instanceof Error?` (${r.message})`:"")+". Pass `provider` to verifyAllowance (from the allowance's rails[]), or fix the custom `getAllowance` function.");throw t!==r&&(t.cause=r),e.emit({type:"error",error:t}),t}for(;;){x(e.signal);try{let r=await q(e,n);await k(Promise.resolve(t.showSuccess()),e.signal).catch(()=>{}),x(e.signal),e.emit({type:"success",allowanceId:e.allowanceId});let i={status:r.status,rail:r.rail??e.rail,provider:r.provider??n};if(e.transport.getAllowance)try{i.allowance=await k(e.transport.getAllowance(e.allowanceId,{signal:e.signal}),e.signal)}catch{x(e.signal)}return i}catch(i){let n=i instanceof h&&"VERIFICATION_NOT_SUPPORTED"===i.type?new g("This card does not support verification.\nTry another card or contact support.",i):i instanceof DOMException&&"AbortError"===i.name?new p:i;if(e.emit({type:"error",error:n}),n instanceof p)throw n;if(n instanceof h&&n.type===l&&!r){r=!0,e.emit({type:"restart",reason:"state_invalid"});continue}if((n instanceof m||n instanceof y||n instanceof f||n instanceof h&&(D(n)||0===n.status||"PROVIDER_VERIFICATION_FAILED"===n.type||n.type===l))&&await k(t.promptRetry(n),e.signal)){e.emit({type:"restart",reason:"user_retry"});continue}throw n instanceof p||await k(Promise.resolve(t.showTerminalError(n instanceof Error?n:new c("Verification failed."))),e.signal).catch(()=>{}),n}}}finally{t.hide()}}var W=r(2265),H={production:"https://api.basistheory.com/agentic",test:"https://api.test.basistheory.com/agentic"};function Y({orderIntent:e,displayName:t,appearance:r,onVerificationComplete:l,onVerificationError:m}){var g;let x=(0,W.useRef)(l),k=(0,W.useRef)(m),j=function(e){var t,r,n,i,a,s,o,l,d;if(null==e)return;let u=null==(t=e.variables)?void 0:t.colors,c={primaryColor:null!=(a=null==(i=null==(n=null==(r=e.rules)?void 0:r.PrimaryButton)?void 0:n.colors)?void 0:i.background)?a:null==u?void 0:u.accent,secondaryColor:null!=(d=null==(l=null==(o=null==(s=e.rules)?void 0:s.Input)?void 0:o.colors)?void 0:l.background)?d:null==u?void 0:u.backgroundSecondary,backgroundColor:null==u?void 0:u.backgroundPrimary,fontColor:null==u?void 0:u.textPrimary,successColor:null==u?void 0:u.success,errorColor:null==u?void 0:u.danger};if(!Object.values(c).every(e=>null==e))return c}(r),R=null==(g=e.rails.find(e=>"agentic-token"===e.rail&&"pending_verification"===e.status))?void 0:g.provider,{allowanceId:M,environment:L,publicApiKey:U}=e.verificationConfig,$=null!=j,D=null==j?void 0:j.primaryColor,V=null==j?void 0:j.secondaryColor,z=null==j?void 0:j.backgroundColor,B=null==j?void 0:j.fontColor,K=null==j?void 0:j.successColor,q=null==j?void 0:j.errorColor;return(0,W.useEffect)(()=>{x.current=l},[l]),(0,W.useEffect)(()=>{k.current=m},[m]),(0,W.useEffect)(()=>{var e;
182if(null==R){null==(e=k.current)||e.call(k,Error("Order intent does not have a rail pending verification"));return}let r=!1,l;return function(){(0,n.d)(this,null,function*(){var e,n;try{l=function(e={}){let t,{apiKey:r,apiBaseUrl:n="https://api.basistheory.com/agentic",verify:l,getAllowance:m,displayName:g="Agent",platformType:x="WEB",bridgeOrigins:k,ui:j=!0,appearance:R,strings:M,otpLength:L=6,handlers:U,openRedirect:$,completePollAttempts:D=10,completePollDelayMs:V=2e3,requestTimeoutMs:z,onEvent:B}=e;if(!l&&!r)throw new v("AgenticVerification requires either `apiKey` (a PUBLIC application key with agentic:allowance:verify) or a custom `verify` transport function.");if(l&&"function"!=typeof l)throw new v("`verify` must be a function.");if(m&&"function"!=typeof m)throw new v("`getAllowance` must be a function.");if("string"!=typeof g||g.length<1||g.length>60)throw new v("`displayName` must be a string of 1–60 characters.");if("string"!=typeof x||0===x.length)throw new v("`platformType` must be a non-empty string (normally `WEB`, `MOBILE`, or `NATIVE`).");if(!j){for(let e of["selectOtpMethod","collectOtp","confirmCeremony"])if("function"!=typeof U?.[e])throw new v(`Headless mode (ui: false) requires handlers.${e}. Provide handlers.selectOtpMethod, handlers.collectOtp, and handlers.confirmCeremony.`)}let K=function(e){let t=e??{},r=[],n={};for(let e of Object.keys(N)){let i=t[e]??I[e];if(!function(e){if("string"!=typeof e||!e.trim())return!1;let t=document.createElement("span");return t.style.color=e,""!==t.style.color||"u">typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("color",e)}(i)){r.push(`${e}: ${JSON.stringify(t[e])}`);continue}n[N[e]]=i}if(r.length>0)throw new v("Invalid appearance value(s) — each must be a valid CSS color: "+r.join(", "));return n}(R),q=function(e){if(!e)return{...S};let t={...S};for(let r of Object.keys(S)){let n=e[r];"string"==typeof n&&(t[r]=n)}return t}(M);r&&!T&&r.includes("_pvt_")&&(T=!0,console.warn('[@basis-theory/web-agentic] The configured apiKey looks like a PRIVATE application key (contains "_pvt_"). Private keys must never ship in a browser — anyone can read them from your page. Create a PUBLIC application with the agentic:allowance:verify permission and use its key instead.'));let W=l?function({verify:e,getAllowance:t}){return{verify:(t,r,n)=>Promise.resolve(e(t,r,n)),getAllowance:t?(e,r)=>Promise.resolve(t(e,r)):null}}({verify:l,getAllowance:m}):function({apiKey:e,apiBaseUrl:t,requestTimeoutMs:r=3e4}){let n=t.replace(/\/+$/,"");async function i(t,{method:i,body:a,signal:s}){let o,l=b(r,new y(`The Basis Theory API request timed out after ${r}ms.`)),d=w([s,l.signal]);try{o=await fetch(`${n}${t}`,{method:i,headers:{"BT-API-KEY":e,"Content-Type":"application/json"},credentials:"omit",body:void 0===a?void 0:JSON.stringify(a),signal:d})}catch(t){if(d.aborted&&d.reason instanceof Error)throw d.reason;let e=new h("The request to the Basis Theory API failed — check your network connection and try again.",{status:0,problem:{type:"NETWORK_ERROR",title:"Network request failed"}});throw e.cause=t,e}finally{l.cancel()}if(!o.ok)throw await E(o);return o.json()}return{verify:(e,t,r)=>i(`/allowances/${encodeURIComponent(e)}/verify`,{method:"POST",body:t,signal:r?.signal}),getAllowance:null}}({apiKey:r,apiBaseUrl:n,requestTimeoutMs:z});if(!Number.isInteger(D)||D<1||"number"!=typeof V||V<0)throw new v("`completePollAttempts` must be an integer >= 1 and `completePollDelayMs` a number >= 0.");if(k){if(!Array.isArray(k)||0===k.length||k.some(e=>"string"!=typeof e||0===e.length))throw new v("`bridgeOrigins` must be a non-empty array of origin strings, e.g. ['https://api.basistheory.com'].");t=k}else{let e=new Set(i);try{e.add(new URL(n).origin)}catch{throw new v(`\`apiBaseUrl\` is not a valid URL: ${JSON.stringify(n)}`)}t=Array.from(e)}let H=e=>{try{B?.(e)}catch{}},Y=null,G=null,J=e=>{Y===e&&(Y=null,G=null)},Q=e=>(function(e={}){let t={screen_height:window.screen.height,screen_width:window.screen.width,color_depth:window.screen.colorDepth,user_agent_string:navigator.userAgent,java_script_enabled:!0,client_device_id:function(){try{let e=window.localStorage.getItem(o);if(e)return e;let t=d().replaceAll("-","").slice(0,24);return window.localStorage.setItem(o,t),t}catch{return u||(u=d().replaceAll("-","").slice(0,24)),u}}(),client_reference_id:d(),platform_type:"WEB"};navigator.language&&(t.language_code=navigator.language);let r=Intl.DateTimeFormat().resolvedOptions().timeZone;return r&&(t.time_zone=r),{...t,...e}})({platform_type:x,...e});return{collectDeviceContext:Q,async verifyAllowance(e,r={}){if("string"!=typeof e||0===e.length)throw new v('verifyAllowance requires an allowance id (e.g. "alw_...").');if(Y)throw new c(`A verification is already in progress on this instance${G?` for allowance "${G}"`:""}. Verify calls must be serialized \u2014 await the in-flight verifyAllowance before starting another.`);let{rail:n="agentic-token",provider:i,displayName:o,timeoutMs:l=3e5,signal:d}=r;if(!a.includes(n))throw new v(`Unsupported rail: ${JSON.stringify(n)}.`);if(void 0!==i&&!s.includes(i))throw new v(`Unsupported provider: ${JSON.stringify(i)}.`);if(void 0!==o&&("string"!=typeof o||o.length<1||o.length>60))throw new v("`displayName` must be a string of 1–60 characters.");if(d?.aborted)throw new p;let u=new AbortController;Y=u,G=e;let h=b(l,new y(`Verification did not complete within ${l}ms.`)),m=()=>u.abort(new p);d?.addEventListener("abort",m,{once:!0});let x=w([u.signal,h.signal]),k=j?function({cssVars:e,strings:t,otpLength:r=6,onCancel:n}){let i=null,a=null,s=null,o=null,l=null,d=null,u=null;function c(){null!==d&&(clearTimeout(d),d=null);let e=u;u=null,e?.()}function h(e){if("Escape"===e.key){e.preventDefault(),l?.();return}if("Tab"!==e.key||!s)return;let t=Array.from(s.querySelectorAll('button, input, [tabindex]:not
182([tabindex="-1"])')).filter(e=>!e.disabled&&null!==e.offsetParent);if(0===t.length)return;let r=t[0],n=t[t.length-1],i=a.activeElement;e.shiftKey&&i===r?(e.preventDefault(),n.focus()):e.shiftKey||i!==n||(e.preventDefault(),r.focus())}function p({title:t,subtitle:r,icon:n,content:d,buttons:u,onEscape:c,initialFocus:p}){!function(){if(i&&a&&s)return;for(let[t,r]of(o=document.activeElement,(i=document.createElement("div")).setAttribute("data-bt-web-agentic",""),Object.entries(e)))i.style.setProperty(t,r);a=i.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=C;let r=O("div","overlay");(s=O("div","modal")).setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-labelledby","bt-agentic-title"),r.appendChild(s),a.append(t,r),a.addEventListener("keydown",h),document.body.appendChild(i)}();let f=s;f.replaceChildren(),f.className="modal",f.tabIndex=-1,l=c??null,f.removeAttribute("aria-describedby");let m=O("div","modal-header"),y=O("h2","title",t);if(y.id="bt-agentic-title",m.appendChild(y),r){let e=O("p","subtitle",r);e.id="bt-agentic-subtitle",m.appendChild(e),f.setAttribute("aria-describedby",e.id)}f.appendChild(m);let g=O("div","modal-middle");if(n&&g.appendChild(n),d&&d.length>0){let e=O("div","content");for(let t of d)e.appendChild(t);g.appendChild(e)}f.appendChild(g);let v=O("div","buttons");if(u&&u.length>0)for(let e of u)v.appendChild(e);f.appendChild(v);let _=p??f;_?.focus?.()}function m(e,t,r){let n=O("button",`btn btn-${t}`,e);return n.type="button",n.addEventListener("click",r),n}function y(){c(),i&&(a?.removeEventListener("keydown",h),i.remove(),i=null,a=null,s=null,l=null,o instanceof HTMLElement&&o.focus?.(),o=null)}return{selectOtpMethod:e=>new Promise(r=>{let n=e[0]?.id??null,i=[],a=O("div","methods");for(let r of(a.setAttribute("role","radiogroup"),a.setAttribute("aria-label",t.methodSelectTitle),e)){let e=O("button","method");e.type="button",e.setAttribute("role","radio"),e.setAttribute("aria-checked",r.id===n?"true":"false"),e.appendChild(O("span","radio"));let s=O("span");s.appendChild(O("span","method-label",r?.type==="sms"?t.methodLabelSms:r?.type==="email"?t.methodLabelEmail:r?.type==="outboundcall"?t.methodLabelOutboundCall:r?.type==="otponlinebanking"?t.methodLabelBanking:t.methodLabelFallback));let o=O("div","method-value",r.value);s.appendChild(o),e.appendChild(s),e.addEventListener("click",()=>{for(let e of(n=r.id,i))e.setAttribute("aria-checked","false");e.setAttribute("aria-checked","true")}),i.push(e),a.appendChild(e)}p({title:t.methodSelectTitle,subtitle:t.methodSelectSubtitle,content:[a],buttons:[m(t.continueButton,"primary",()=>r(n)),m(t.cancelButton,"tertiary",()=>r(null))],onEscape:()=>r(null)})}),collectOtp:({method:e,codeExpirationMinutes:n,maxAttempts:i,error:a,canGoBack:s})=>new Promise(o=>{var l,d;let u=[],c=O("div","otp-row");for(let e=0;e<r;e+=1){let t=O("input","otp-box");t.setAttribute("type","text"),t.setAttribute("maxlength","1"),t.setAttribute("inputmode","numeric"),t.setAttribute("autocomplete",0===e?"one-time-code":"off"),t.setAttribute("aria-label",`Digit ${e+1}`),u.push(t),c.appendChild(t)}let h=()=>u.map(e=>e.value).join(""),f=()=>{_.disabled=h().length!==r};u.forEach((e,t)=>{e.addEventListener("input",()=>{let r=e.value.slice(-1);e.value=r,r&&t<u.length-1&&u[t+1].focus(),f()}),e.addEventListener("keydown",r=>{"Backspace"===r.key&&""===e.value&&t>0&&u[t-1].focus(),"Enter"!==r.key||_.disabled||v()}),e.addEventListener("paste",e=>{e.preventDefault();let t=(e.clipboardData?.getData("text")??"").replace(/\s+/g,"");if(t){for(let e=0;e<u.length;e+=1)u[e].value=t[e]??"";u[Math.min(t.length,u.length-1)].focus(),f()}})});let y=O("div","hint",(l=t.otpHint,d={minutes:n,attempts:i},l.replace(/\{(\w+)\}/g,(e,t)=>t in d?String(d[t]):e))),g=O("div","error-text",a?t.otpInvalid:"");g.setAttribute("role","alert"),g.setAttribute("aria-live","assertive");let v=()=>o({code:h()}),_=m(t.confirmButton,"primary",v);_.disabled=!0;let b=[_];s&&b.push(m(t.backButton,"secondary",()=>o({back:!0}))),b.push(m(t.cancelButton,"tertiary",()=>o(null))),p({title:t.otpTitle,subtitle:e?.type==="sms"?t.otpSubtitleSms:e?.type==="email"?t.otpSubtitleEmail:t.otpSubtitleFallback,content:[c,y,g],buttons:b,onEscape:()=>o(null),initialFocus:u[0]})}),confirmCeremony:({network:e,action:r,isRestart:n,openPopup:i})=>new Promise((a,s)=>{let o=t.mastercardRedirectTitle,l=t.mastercardRedirectSubtitle;"visa"===e&&(n?(o=t.visaRestartTitle,l=t.visaRestartSubtitle):"REGISTER"===r?(o=t.visaRegisterTitle,l=t.visaRegisterSubtitle):(o=t.visaAuthenticateTitle,l=t.visaAuthenticateSubtitle));let d=m(t.continueButton,"primary",()=>{try{a(i())}catch(e){if(e instanceof f)return void c(e.message);s(e)}}),u=m(t.cancelButton,"tertiary",()=>a(null)),c=(e="")=>{let t,r,n,i;if(e){let r=O("div","error-text",e);r.setAttribute("role","alert"),t=[r]}p({title:o,subtitle:l,icon:(r=A("fingerprint-icon"),(n=document.createElementNS("http://www.w3.org/2000/svg","svg")).setAttribute("viewBox","0 0 24 24"),n.setAttribute("focusable","false"),(i=document.createElementNS("http://www.w3.org/2000/svg","path")).setAttribute("d","M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28zM3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7-.23.16-.54.11-.7-.12-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21zm6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39-2.57 0-4.66 1.97-4.66 4.39 0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15zm7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12zM14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94 1.7 0 3.08 1.32 3.08 2.94 0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-
1825.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38z"),n.appendChild(i),r.appendChild(n),r),content:t,buttons:[d,u],onEscape:()=>a(null)})};c()}),promptRetry:e=>new Promise(r=>{p({title:t.errorTitle,subtitle:P(e,t.retryErrorSubtitle),icon:A("error-icon"),buttons:[m(t.tryAgainButton,"primary",()=>r(!0)),m(t.cancelButton,"tertiary",()=>r(!1))],onEscape:()=>r(!1)})}),showWaiting(){p({title:t.waitingTitle,subtitle:t.waitingSubtitle,icon:Z(t.waitingTitle),buttons:[m(t.cancelButton,"tertiary",n)],onEscape:n})},showProgress(){p({title:t.progressTitle,subtitle:t.progressSubtitle,icon:Z(t.progressTitle),buttons:[m(t.cancelButton,"tertiary",n)],onEscape:n})},showSuccess:()=>(c(),new Promise(e=>{u=e,p({title:t.successTitle,icon:A("success-icon"),buttons:[m(t.closeButton,"primary",c)],onEscape:c}),d=setTimeout(()=>{d=null,u=null,e()},1400)})),showTerminalError:e=>new Promise(r=>{p({title:t.errorTitle,subtitle:P(e,t.terminalErrorSubtitle),icon:A("error-icon"),buttons:[m(t.closeButton,"primary",()=>r())],onEscape:()=>r()})}),hide:y,dispose:y}}({cssVars:K,strings:q,otpLength:L,onCancel:()=>u.abort(new p)}):_(U);if(j&&U){let e=_(U),t=k.dispose?.bind(k);for(let r of(k.dispose=()=>{e.dispose(),t?.()},["selectOtpMethod","collectOtp","confirmCeremony"]))"function"==typeof U[r]&&(k[r]=e[r])}try{return await F({transport:W,allowanceId:e,rail:n,provider:i,displayName:o??g,deviceContextFactory:Q,presenter:k,bridgeOrigins:t,openRedirect:$,mcPollAttempts:D,mcPollDelayMs:V,signal:x,emit:H})}finally{h.cancel(),d?.removeEventListener("abort",m),k.dispose?.(),J(u)}},dispose(){let e=Y;J(e),e?.abort(new p("The AgenticVerification instance was disposed."))}}}({apiKey:U,apiBaseUrl:H[L],displayName:t,appearance:$?{primaryColor:D,secondaryColor:V,backgroundColor:z,fontColor:B,successColor:K,errorColor:q}:void 0}),yield l.verifyAllowance(M,{provider:R}),r||null==(e=x.current)||e.call(x)}catch(e){r||null==(n=k.current)||n.call(k,e)}})}(),()=>{r=!0,null==l||l.dispose()}},[M,z,t,L,q,B,$,R,D,U,V,K]),null}},9801:function(e,t,r){"use strict";r.d(t,{a:function(){return l},c:function(){return d},d:function(){return u}});var n=Object.defineProperty,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,o=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,t)=>{for(var r in t||(t={}))a.call(t,r)&&o(e,r,t[r]);if(i)for(var r of i(t))s.call(t,r)&&o(e,r,t[r]);return e},d=(e,t)=>{var r={};for(var n in e)a.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&i)for(var n of i(e))0>t.indexOf(n)&&s.call(e,n)&&(r[n]=e[n]);return r},u=(e,t,r)=>new Promise((n,i)=>{var a=e=>{try{o(r.next(e))}catch(e){i(e)}},s=e=>{try{o(r.throw(e))}catch(e){i(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,s);o((r=r.apply(e,t)).next())})},79601:function(e,t,r){"use strict";r.d(t,{a:function(){return n},b:function(){return i}});var n="4.6.0",i={name:"@crossmint/client-sdk-react-ui",version:n,repository:"https://github.com/Crossmint/crossmint-sdk",license:"Apache-2.0",author:"Paella Labs Inc",sideEffects:!1,type:"module",exports:{import:"./dist/index.js",require:"./dist/index.cjs"},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["dist","LICENSE","README.md"],scripts:{build:"cross-env NODE_OPTIONS='--max-old-space-size=16384' tsup",dev:"cross-env NODE_OPTIONS='--max-old-space-size=16384' tsup --watch","test:vitest":"vitest run","generate:docs":"typedoc && node scripts/generate-reference.mjs"},dependencies:{"@basis-theory/web-agentic":"1.2.2","@crossmint/client-sdk-auth":"workspace:*","@crossmint/client-sdk-base":"workspace:*","@crossmint/client-sdk-react-base":"workspace:*","@crossmint/client-sdk-window":"workspace:*","@crossmint/client-signers":"workspace:*","@crossmint/common-sdk-auth":"workspace:*","@crossmint/common-sdk-base":"workspace:*","@crossmint/wallets-sdk":"workspace:*","@dynamic-labs/ethereum":"4.28.0","@dynamic-labs/sdk-react-core":"4.28.0","@dynamic-labs/solana":"4.28.0","@dynamic-labs/sui":"4.28.0","@emotion/react":"^11.11.0","@emotion/styled":"11.14.1","@ethersproject/transactions":"5.7.0","@mysten/sui":"1.24.0","@solana/web3.js":"1.98.1",bs58:"5.0.0",clsx:"2.1.1",color:"4.2.3","input-otp":"1.4.2","lodash.isequal":"4.5.0",ox:"0.6.9","react-jss":"10.10.0","react-transition-group":"4.4.5",viem:"2.33.1",zod:"3.22.4"},devDependencies:{"@testing-library/react":"^16.0.1","@types/color":"4.2.0","@types/lodash.isequal":"4.5.6","@types/react":"^19.1.10","@types/react-dom":"^19.1.0","@types/react-transition-group":"4.4.12","pino-pretty":"^7.6.0",react:"^19.1.0","react-dom":"^19.1.0",typedoc:"0.28.16"}
182,peerDependencies:{"@solana/web3.js":"^1.98.1",react:">=17.0.2","react-dom":">=17.0.2"}}},24115:function(e,t,r){"use strict";let n,i;r.d(t,{a:function(){return nx}});var a,s,o,l,d,u,c,h,p,f,m,y,g,v,_=r(79601).a,b=r(26729),w=class extends Error{constructor(e,t,r,n){super(e),this.status=t,this.statusText=r,this.responseBody=n,this.name="ApiClientError"}},x=class e{makeRequest(e,t){return(0,b.d)(this,null,function*(){var r;let n=yield fetch(this.buildUrl(e),(0,b.b)((0,b.a)({},t),{headers:(0,b.a)((0,b.a)({},this.commonHeaders),t.headers)})),i=(null!=(r=n.headers.get("content-type"))?r:"").includes("application/json");if(n.status>=500||!n.ok&&!i){let e=null;try{e=yield n.text()}catch(e){}throw new w(`API request failed: ${n.status} ${n.statusText}`,n.status,n.statusText,e)}return n})}buildUrl(t){return`${e.normalizePath(this.baseUrl)}/${e.normalizePath(t)}`}get(e,t){return(0,b.d)(this,null,function*(){return yield this.makeRequest(e,(0,b.b)((0,b.a)({},t),{method:"GET"}))})}post(e,t){return(0,b.d)(this,null,function*(){return yield this.makeRequest(e,(0,b.b)((0,b.a)({},t),{method:"POST"}))})}put(e,t){return(0,b.d)(this,null,function*(){return yield this.makeRequest(e,(0,b.b)((0,b.a)({},t),{method:"PUT"}))})}delete(e,t){return(0,b.d)(this,null,function*(){return yield this.makeRequest(e,(0,b.b)((0,b.a)({},t),{method:"DELETE"}))})}patch(e,t){return(0,b.d)(this,null,function*(){return yield this.makeRequest(e,(0,b.b)((0,b.a)({},t),{method:"PATCH"}))})}static normalizePath(e){return e=(e=e.startsWith("/")?e.slice(1):e).endsWith("/")?e.slice(0,-1):e}},k=r(11724),T=class extends x{constructor(e,{internalConfig:t}){let r=(0,k.d)(e.apiKey,t.apiKeyExpectations);if(!r.isValid)throw Error(r.message);super(),this.crossmint=e,this.parsedAPIKey=r,this.internalConfig=t}get baseUrl(){if(this.crossmint.overrideBaseUrl)return x.normalizePath(this.crossmint.overrideBaseUrl);let e=function(e,t){switch(e){case"development":return"http://localhost:3000";case"staging":return"https://staging.crossmint.com";case"production":return"https://www.crossmint.com"}}(this.parsedAPIKey.environment);return x.normalizePath(e)}get commonHeaders(){return(0,b.a)((0,b.a)((0,b.a)({"x-client-name":this.internalConfig.sdkMetadata.name,"x-client-version":this.internalConfig.sdkMetadata.version,"x-api-key":this.crossmint.apiKey},this.crossmint.appId?{"x-app-identifier":this.crossmint.appId}:{}),this.crossmint.extensionId?{"x-extension-id":this.crossmint.extensionId}:{}),this.resolvedJwt?{Authorization:`Bearer ${this.resolvedJwt}`}:{})}get environment(){return this.parsedAPIKey.environment}get resolvedJwt(){return this.crossmint.jwt}};(p=a||(a={})).assertEqual=e=>e,p.assertIs=function(e){},p.assertNever=function(e){throw Error()},p.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},p.getValidEnumValues=e=>{let t=p.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return p.objectValues(r)},p.objectValues=e=>p.objectKeys(e).map(function(t){return e[t]}),p.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},p.find=(e,t)=>{for(let r of e)if(t(r))return r},p.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,p.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},p.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(s||(s={})).mergeShapes=(e,t)=>({...e,...t});let E=a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),C=e=>{switch(typeof e){case"undefined":return E.undefined;case"string":return E.string;case"number":return isNaN(e)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":if(Array.isArray(e))return E.array;if(null===e)return E.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return E.promise;if("undefined"!=typeof Map&&e instanceof Map)return E.map;if("undefined"!=typeof Set&&e instanceof Set)return E.set;if("undefined"!=typeof Date&&e instanceof Date)return E.date;return E.object;default:return E.unknown}}
182,S=a.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class O extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}O.create=e=>new O(e);let A=(e,t)=>{let r;switch(e.code){case S.invalid_type:r=e.received===E.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case S.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,a.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:r=`Unrecognized key(s) in object: ${a.joinValues(e.keys,", ")}`;break;case S.invalid_union:r="Invalid input";break;case S.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${a.joinValues(e.options)}`;break;case S.invalid_enum_value:r=`Invalid enum value. Expected ${a.joinValues(e.options)}, received '${e.received}'`;break;case S.invalid_arguments:r="Invalid function arguments";break;case S.invalid_return_type:r="Invalid function return type";break;case S.invalid_date:r="Invalid date";break;case S.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:a.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case S.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case S.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case S.custom:r="Invalid input";break;case S.invalid_intersection_types:r="Intersection results could not be merged";break;case S.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case S.not_finite:r="Number must be finite";break;default:r=t.defaultError,a.assertNever(e)}return{message:r}},Z=A;function P(){return Z}let I=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a},o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:i.message||o}};function N(e,t){let r=I({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,P(),A].filter(e=>!!e)});e.common.issues.push(r)}class j{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return R;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t)r.push({key:await e.key,value:await e.value});return j.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return R;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let R=Object.freeze({status:"aborted"}),M=e=>({status:"dirty",value:e}),L=e=>
182({status:"valid",value:e}),U=e=>"aborted"===e.status,$=e=>"dirty"===e.status,D=e=>"valid"===e.status,V=e=>"undefined"!=typeof Promise&&e instanceof Promise;(f=o||(o={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},f.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class z{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let B=(e,t)=>{if(D(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new O(e.common.issues);return this._error=t,this._error}}};function K(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=r?r:t.defaultError},description:i}}class q{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return C(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(V(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},i=this._parseSync({data:e,path:n.path,parent:n});return B(n,i)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},n=this._parse({data:e,path:r.path,parent:r});return B(r,await (V(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),a=()=>n.addIssue({code:S.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new eA({schema:this,typeName:l.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return eZ.create(this,this._def)}nullable(){return eP.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eh.create(this,this._def)}promise(){return eO.create(this,this._def)}or(e){return ef.create([this,e],this._def)}and(e){return eg.create(this,e,this._def)}transform(e){return new eA({...K(this._def),schema:this,typeName:l.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eI({...K(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:l.ZodDefault})}brand(){return new eM({typeName:l.ZodBranded,type:this,...K(this._def)})}catch(e){return new eN({...K(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:l.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eL.create(this,e)}readonly(){return eU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let F=/^c[^\s-]{8,}
182$/i,W=/^[a-z][a-z0-9]*$/,H=/^[0-9A-HJKMNP-TV-Z]{26}$/,Y=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,G=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,J=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Q=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,X=e=>e.precision?e.offset?RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");class ee extends q{_parse(e){let t;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.string,received:t.parsedType}),R}let r=new j;for(let o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if("max"===o.kind)e.data.length>o.value&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if("length"===o.kind){let n=e.data.length>o.value,i=e.data.length<o.value;(n||i)&&(t=this._getOrReturnCtx(e,t),n?N(t,{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&N(t,{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if("email"===o.kind)G.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"email",code:S.invalid_string,message:o.message}),r.dirty());else if("emoji"===o.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"emoji",code:S.invalid_string,message:o.message}),r.dirty());else if("uuid"===o.kind)Y.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"uuid",code:S.invalid_string,message:o.message}),r.dirty());else if("cuid"===o.kind)F.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"cuid",code:S.invalid_string,message:o.message}),r.dirty());else if("cuid2"===o.kind)W.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"cuid2",code:S.invalid_string,message:o.message}),r.dirty());else if("ulid"===o.kind)H.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"ulid",code:S.invalid_string,message:o.message}),r.dirty());else if("url"===o.kind)try{new URL(e.data)}catch(n){N(t=this._getOrReturnCtx(e,t),{validation:"url",code:S.invalid_string,message:o.message}),r.dirty()}else if("regex"===o.kind)o.regex.lastIndex=0,o.regex.test(e.data)||(N(t=this._getOrReturnCtx(e,t),{validation:"regex",code:S.invalid_string,message:o.message}),r.dirty());else if("trim"===o.kind)e.data=e.data.trim();else if("includes"===o.kind)e.data.includes(o.value,o.position)||(N(t=this._getOrReturnCtx(e,t),{code:S.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty());else if("toLowerCase"===o.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===o.kind)e.data=e.data.toUpperCase();else if("startsWith"===o.kind)e.data.startsWith(o.value)||(N(t=this._getOrReturnCtx(e,t),{code:S.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty());else if("endsWith"===o.kind)e.data.endsWith(o.value)||(N(t=this._getOrReturnCtx(e,t),{code:S.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty());else if("datetime"===o.kind)X(o).test(e.data)||(N(t=this._getOrReturnCtx(e,t),{code:S.invalid_string,validation:"datetime",message:o.message}),r.dirty());else if("ip"===o.kind){var i,s;i=e.data,("v4"===(s=o.version)||!s)&&J.test(i)||("v6"===s||!s)&&Q.test(i)||(N(t=this._getOrReturnCtx(e,t),{validation:"ip",code:S.invalid_string,message:o.message}),r.dirty())}else a.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:S.invalid_string,...o.errToObj(r)})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...o.errToObj(e)})}url(e){return this._addCheck({kind:"url",...o.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...o.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...o.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...o.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...o.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...o.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...o.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...o.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...o.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...o.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...o.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...o.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...o.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...o.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...o.errToObj(t)})}nonempty(e){return this.min(1,o.errToObj(e))}trim(){return new ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}
182get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ee.create=e=>{var t;return new ee({checks:[],typeName:l.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...K(e)})};class et extends q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==E.number){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.number,received:t.parsedType}),R}let r=new j;for(let n of this._def.checks)"int"===n.kind?a.isInteger(e.data)||(N(t=this._getOrReturnCtx(e,t),{code:S.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(N(t=this._getOrReturnCtx(e,t),{code:S.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(N(t=this._getOrReturnCtx(e,t),{code:S.not_finite,message:n.message}),r.dirty()):a.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,o.toString(t))}gt(e,t){return this.setLimit("min",e,!1,o.toString(t))}lte(e,t){return this.setLimit("max",e,!0,o.toString(t))}lt(e,t){return this.setLimit("max",e,!1,o.toString(t))}setLimit(e,t,r,n){return new et({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:o.toString(n)}]})}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:o.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:o.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:o.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:o.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:o.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:o.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:o.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:o.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:o.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&a.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}et.create=e=>new et({checks:[],typeName:l.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...K(e)});class er extends q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==E.bigint){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.bigint,received:t.parsedType}),R}let r=new j;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(N(t=this._getOrReturnCtx(e,t),{code:S.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):a.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,o.toString(t))}gt(e,t){return this.setLimit("min",e,!1,o.toString(t))}lte(e,t){return this.setLimit("max",e,!0,o.toString(t))}lt(e,t){return this.setLimit("max",e,!1,o.toString(t))}setLimit(e,t,r,n){return new er({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:o.toString(n)}]})}_addCheck(e){return new er({...this._def,checks:[...this._def.checks,e]})}
182positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:o.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:o.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:o.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:o.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:o.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}er.create=e=>{var t;return new er({checks:[],typeName:l.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...K(e)})};class en extends q{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.boolean,received:t.parsedType}),R}return L(e.data)}}en.create=e=>new en({typeName:l.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...K(e)});class ei extends q{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.date,received:t.parsedType}),R}if(isNaN(e.data.getTime()))return N(this._getOrReturnCtx(e),{code:S.invalid_date}),R;let r=new j;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(N(t=this._getOrReturnCtx(e,t),{code:S.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):a.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ei({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:o.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:o.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ei.create=e=>new ei({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:l.ZodDate,...K(e)});class ea extends q{_parse(e){if(this._getType(e)!==E.symbol){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.symbol,received:t.parsedType}),R}return L(e.data)}}ea.create=e=>new ea({typeName:l.ZodSymbol,...K(e)});class es extends q{_parse(e){if(this._getType(e)!==E.undefined){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.undefined,received:t.parsedType}),R}return L(e.data)}}es.create=e=>new es({typeName:l.ZodUndefined,...K(e)});class eo extends q{_parse(e){if(this._getType(e)!==E.null){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.null,received:t.parsedType}),R}return L(e.data)}}eo.create=e=>new eo({typeName:l.ZodNull,...K(e)});class el extends q{constructor(){super(...arguments),this._any=!0}_parse(e){return L(e.data)}}el.create=e=>new el({typeName:l.ZodAny,...K(e)});class ed extends q{constructor(){super(...arguments),this._unknown=!0}_parse(e){return L(e.data)}}ed.create=e=>new ed({typeName:l.ZodUnknown,...K(e)});class eu extends q{_parse(e){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.never,received:t.parsedType}),R}}eu.create=e=>new eu({typeName:l.ZodNever,...K(e)});class ec extends q{_parse(e){if(this._getType(e)!==E.undefined){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.void,received:t.parsedType}),R}return L(e.data)}}ec.create=e=>new ec({typeName:l.ZodVoid,...K(e)});class eh extends q{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==E.array)return N(t,{code:S.invalid_type,expected:E.array,received:t.parsedType}),R;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(N(t,{code:e?S.too_big:S.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(N(t,{code:S.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(N(t,{code:S.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new z(t,e,t.path,r)))).then(e=>j.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new z(t,e,t.path,r)));return j.mergeArray(r,i)}
182get element(){return this._def.type}min(e,t){return new eh({...this._def,minLength:{value:e,message:o.toString(t)}})}max(e,t){return new eh({...this._def,maxLength:{value:e,message:o.toString(t)}})}length(e,t){return new eh({...this._def,exactLength:{value:e,message:o.toString(t)}})}nonempty(e){return this.min(1,e)}}eh.create=(e,t)=>new eh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:l.ZodArray,...K(t)});class ep extends q{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=a.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==E.object){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.object,received:t.parsedType}),R}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof eu&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new z(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof eu){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(N(r,{code:S.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new z(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e}).then(e=>j.mergeObjectSync(t,e)):j.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return o.errToObj,new ep({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,a,s;let l=null!==(a=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=o.errToObj(e).message)&&void 0!==s?s:l}:{message:l}}}:{}})}strip(){return new ep({...this._def,unknownKeys:"strip"})}passthrough(){return new ep({...this._def,unknownKeys:"passthrough"})}extend(e){return new ep({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ep({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:l.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ep({...this._def,catchall:e})}pick(e){let t={};return a.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new ep({...this._def,shape:()=>t})}omit(e){let t={};return a.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new ep({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ep){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=eZ.create(e(i))}return new ep({...t._def,shape:()=>r})}return t instanceof eh?new eh({...t._def,type:e(t.element)}):t instanceof eZ?eZ.create(e(t.unwrap())):t instanceof eP?eP.create(e(t.unwrap())):t instanceof ev?ev.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return a.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new ep({...this._def,shape:()=>t})}required(e){let t={};return a.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eZ;)e=e._def.innerType;t[r]=e}}),new ep({...this._def,shape:()=>t})}keyof(){return eE(a.objectKeys(this.shape))}}ep.create=(e,t)=>new ep({shape:()=>e,unknownKeys:"strip",catchall:eu.create(),typeName:l.ZodObject,...K(t)}),ep.strictCreate=(e,t)=>new ep({shape:()=>e,unknownKeys:"strict",catchall:eu.create(),typeName:l.ZodObject,...K(t)}),ep.lazycreate=(e,t)=>new ep({shape:e,unknownKeys:"strip",catchall:eu.create(),typeName:l.ZodObject,...K(t)});class ef extends q{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new O(e.ctx.common.issues));return N(t,{code:S.invalid_union,unionErrors:r}),R});{let e;let n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new O(e));return N(t,{code:S.invalid_union,unionErrors:i}),R}}get options(){return this._def.options}}ef.create=(e,t)=>
182new ef({options:e,typeName:l.ZodUnion,...K(t)});let em=e=>{if(e instanceof ek)return em(e.schema);if(e instanceof eA)return em(e.innerType());if(e instanceof eT)return[e.value];if(e instanceof eC)return e.options;if(e instanceof eS)return Object.keys(e.enum);if(e instanceof eI)return em(e._def.innerType);if(e instanceof es)return[void 0];else if(e instanceof eo)return[null];else return null};class ey extends q{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.object)return N(t,{code:S.invalid_type,expected:E.object,received:t.parsedType}),R;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(N(t,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=em(r.shape[e]);if(!t)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new ey({typeName:l.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...K(r)})}}class eg extends q{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(U(e)||U(n))return R;let i=function e(t,r){let n=C(t),i=C(r);if(t===r)return{valid:!0,data:t};if(n===E.object&&i===E.object){let n=a.objectKeys(r),i=a.objectKeys(t).filter(e=>-1!==n.indexOf(e)),s={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};s[n]=i.data}return{valid:!0,data:s}}if(n===E.array&&i===E.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===E.date&&i===E.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,n.value);return i.valid?(($(e)||$(n))&&t.dirty(),{status:t.value,value:i.data}):(N(r,{code:S.invalid_intersection_types}),R)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eg.create=(e,t,r)=>new eg({left:e,right:t,typeName:l.ZodIntersection,...K(r)});class ev extends q{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.array)return N(r,{code:S.invalid_type,expected:E.array,received:r.parsedType}),R;if(r.data.length<this._def.items.length)return N(r,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new z(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>j.mergeArray(t,e)):j.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ev({...this._def,rest:e})}}ev.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ev({items:e,typeName:l.ZodTuple,rest:null,...K(t)})};class e_ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return N(r,{code:S.invalid_type,expected:E.object,received:r.parsedType}),R;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new z(r,e,r.path,e)),value:a._parse(new z(r,r.data[e],r.path,e))});return r.common.async?j.mergeObjectAsync(t,n):j.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new e_(t instanceof q?{keyType:e,valueType:t,typeName:l.ZodRecord,...K(r)}:{keyType:ee.create(),valueType:e,typeName:l.ZodRecord,...K(t)})}}class eb extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.map)return N(r,{code:S.invalid_type,expected:E.map,received:r.parsedType}),R;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new z(r,e,r.path,[a,"key"])),value:i._parse(new z(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return R;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return R;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}eb.create=(e,t,r)=>new eb({valueType:t,keyType:e,typeName:l.ZodMap,...K(r)});class ew extends q{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.set)return N(r,{code:S.invalid_type,expected:E.set,received:r.parsedType}),R;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(N(r,{code:S.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(N(r,{code:S.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return R;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new z(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new ew({...this._def,minSize:{value:e,message:o.toString(t)}})}max(e,t){return new ew({...this._def,maxSize:{value:e,message:o.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ew.create=(e,t)=>
182new ew({valueType:e,minSize:null,maxSize:null,typeName:l.ZodSet,...K(t)});class ex extends q{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.function)return N(t,{code:S.invalid_type,expected:E.function,received:t.parsedType}),R;function r(e,r){return I({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,P(),A].filter(e=>!!e),issueData:{code:S.invalid_arguments,argumentsError:r}})}function n(e,r){return I({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,P(),A].filter(e=>!!e),issueData:{code:S.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof eO){let e=this;return L(async function(...t){let s=new O([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw s.addIssue(r(t,e)),s}),l=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw s.addIssue(n(l,e)),s})})}{let e=this;return L(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new O([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new O([n(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ex({...this._def,args:ev.create(e).rest(ed.create())})}returns(e){return new ex({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ex({args:e||ev.create([]).rest(ed.create()),returns:t||ed.create(),typeName:l.ZodFunction,...K(r)})}}class ek extends q{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ek.create=(e,t)=>new ek({getter:e,typeName:l.ZodLazy,...K(t)});class eT extends q{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return N(t,{received:t.data,code:S.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eE(e,t){return new eC({values:e,typeName:l.ZodEnum,...K(t)})}eT.create=(e,t)=>new eT({value:e,typeName:l.ZodLiteral,...K(t)});class eC extends q{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return N(t,{expected:a.joinValues(r),received:t.parsedType,code:S.invalid_type}),R}if(-1===this._def.values.indexOf(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return N(t,{received:t.data,code:S.invalid_enum_value,options:r}),R}return L(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return eC.create(e)}exclude(e){return eC.create(this.options.filter(t=>!e.includes(t)))}}eC.create=eE;class eS extends q{_parse(e){let t=a.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==E.string&&r.parsedType!==E.number){let e=a.objectValues(t);return N(r,{expected:a.joinValues(e),received:r.parsedType,code:S.invalid_type}),R}if(-1===t.indexOf(e.data)){let e=a.objectValues(t);return N(r,{received:r.data,code:S.invalid_enum_value,options:e}),R}return L(e.data)}get enum(){return this._def.values}}eS.create=(e,t)=>new eS({values:e,typeName:l.ZodNativeEnum,...K(t)});class eO extends q{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==E.promise&&!1===t.common.async?(N(t,{code:S.invalid_type,expected:E.promise,received:t.parsedType}),R):L((t.parsedType===E.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eO.create=(e,t)=>new eO({type:e,typeName:l.ZodPromise,...K(t)});class eA extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{N(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then(e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?R:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?R:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>D(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!D(e))return e;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}}a.assertNever(n)}}eA.create=(e,t,r)=>new eA({schema:e,typeName:l.ZodEffects,effect:t,...K(r)}),eA.createWithPreprocess=(e,t,r)=>new eA({schema:t,effect:{type:"preprocess",transform:e},typeName:l.ZodEffects,...K(r)});class eZ extends q{_parse(e){return this._getType(e)===E.undefined?L(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eZ.create=(e,t)=>
182new eZ({innerType:e,typeName:l.ZodOptional,...K(t)});class eP extends q{_parse(e){return this._getType(e)===E.null?L(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eP.create=(e,t)=>new eP({innerType:e,typeName:l.ZodNullable,...K(t)});class eI extends q{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===E.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eI.create=(e,t)=>new eI({innerType:e,typeName:l.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...K(t)});class eN extends q{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return V(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new O(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new O(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eN.create=(e,t)=>new eN({innerType:e,typeName:l.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...K(t)});class ej extends q{_parse(e){if(this._getType(e)!==E.nan){let t=this._getOrReturnCtx(e);return N(t,{code:S.invalid_type,expected:E.nan,received:t.parsedType}),R}return{status:"valid",value:e.data}}}ej.create=e=>new ej({typeName:l.ZodNaN,...K(e)});let eR=Symbol("zod_brand");class eM extends q{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eL extends q{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?R:"dirty"===e.status?(t.dirty(),M(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?R:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eL({in:e,out:t,typeName:l.ZodPipeline})}}class eU extends q{_parse(e){let t=this._def.innerType._parse(e);return D(t)&&(t.value=Object.freeze(t.value)),t}}eU.create=(e,t)=>new eU({innerType:e,typeName:l.ZodReadonly,...K(t)});let e$=(e,t={},r)=>e?el.create().superRefine((n,i)=>{var a,s;if(!e(n)){let e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s;i.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):el.create(),eD={object:ep.lazycreate};(m=l||(l={})).ZodString="ZodString",m.ZodNumber="ZodNumber",m.ZodNaN="ZodNaN",m.ZodBigInt="ZodBigInt",m.ZodBoolean="ZodBoolean",m.ZodDate="ZodDate",m.ZodSymbol="ZodSymbol",m.ZodUndefined="ZodUndefined",m.ZodNull="ZodNull",m.ZodAny="ZodAny",m.ZodUnknown="ZodUnknown",m.ZodNever="ZodNever",m.ZodVoid="ZodVoid",m.ZodArray="ZodArray",m.ZodObject="ZodObject",m.ZodUnion="ZodUnion",m.ZodDiscriminatedUnion="ZodDiscriminatedUnion",m.ZodIntersection="ZodIntersection",m.ZodTuple="ZodTuple",m.ZodRecord="ZodRecord",m.ZodMap="ZodMap",m.ZodSet="ZodSet",m.ZodFunction="ZodFunction",m.ZodLazy="ZodLazy",m.ZodLiteral="ZodLiteral",m.ZodEnum="ZodEnum",m.ZodEffects="ZodEffects",m.ZodNativeEnum="ZodNativeEnum",m.ZodOptional="ZodOptional",m.ZodNullable="ZodNullable",m.ZodDefault="ZodDefault",m.ZodCatch="ZodCatch",m.ZodPromise="ZodPromise",m.ZodBranded="ZodBranded",m.ZodPipeline="ZodPipeline",m.ZodReadonly="ZodReadonly";let eV=ee.create,ez=et.create,eB=ej.create,eK=er.create,eq=en.create,eF=ei.create,eW=ea.create,eH=es.create,eY=eo.create,eG=el.create,eJ=ed.create,eQ=eu.create,eX=ec.create,e5=eh.create,e1=ep.create,e0=ep.strictCreate,e2=ef.create,e6=ey.create,e3=eg.create,e4=ev.create,e8=e_.create,e9=eb.create,e7=ew.create,te=ex.create,tt=ek.create,tr=eT.create,tn=eC.create,ti=eS.create,ta=eO.create,ts=eA.create,to=eZ.create,tl=eP.create,td=eA.createWithPreprocess,tu=eL.create;var tc=Object.freeze({__proto__:null,defaultErrorMap:A,setErrorMap:function(e){Z=e},getErrorMap:P,makeIssue:I,EMPTY_PATH:[],addIssueToContext:N,ParseStatus:j,INVALID:R,DIRTY:M,OK:L,isAborted:U,isDirty:$,isValid:D,isAsync:V,get util(){return a},get objectUtil(){return s},ZodParsedType:E,getParsedType:C,ZodType:q,ZodString:ee,ZodNumber:et,ZodBigInt:er,ZodBoolean:en,ZodDate:ei,ZodSymbol:ea,ZodUndefined:es,ZodNull:eo,ZodAny:el,ZodUnknown:ed,ZodNever:eu,ZodVoid:ec,ZodArray:eh,ZodObject:ep,ZodUnion:ef,ZodDiscriminatedUnion:ey,ZodIntersection:eg,ZodTuple:ev,ZodRecord:e_,ZodMap:eb,ZodSet:ew,ZodFunction:ex,ZodLazy:ek,ZodLiteral:eT,ZodEnum:eC,ZodNativeEnum:eS,ZodPromise:eO,ZodEffects:eA,ZodTransformer:eA,ZodOptional:eZ,ZodNullable:eP,ZodDefault:eI,ZodCatch:eN,ZodNaN:ej,BRAND:eR,ZodBranded:eM,ZodPipeline:eL,ZodReadonly:eU,custom:e$,Schema:q,ZodSchema:q,late:eD,get ZodFirstPartyTypeKind(){return l},coerce:{string:e=>ee.create({...e,coerce:!0}),number:e=>et.create({...e,coerce:!0}),boolean:e=>en.create({...e,coerce:!0}),bigint:e=>er.create({...e,coerce:!0}),date:e=>ei.create({...e,coerce:!0})},any:eG,array:e5,bigint:eK,boolean:eq,date:eF,discriminatedUnion:e6,effect:ts,enum:tn,function:te,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>e$(t=>t instanceof e,t),intersection:e3,lazy:tt,literal:tr,map:e9,nan:eB,nativeEnum:ti,never:eQ,null:eY,nullable:tl,number:ez,object:e1,oboolean:()=>eq().optional(),onumber:()=>ez().optional(),optional:to,ostring:()=>eV().optional(),pipeline:tu,preprocess:td,promise:ta,record:e8,set:e7,strictObject:e0,string:eV,symbol:eW,transformer:ts,tuple:e4,undefined:eH,union:e2,unknown:eJ,void:eX,NEVER:R,ZodIssueCode:S,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:O}),th={"ui:height.changed":tc.object({height:tc.number()}),"payment-method:selected":tc.any()},tp={},tf=Object.defineProperty,tm=Object.getOwnPropertySymbols,ty=Object.prototype.hasOwnProperty,tg=Object.prototype.propertyIsEnumerable,tv=(e,t,r)=>t in e?tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,t_=(e,t)=>
182{for(var r in t||(t={}))ty.call(t,r)&&tv(e,r,t[r]);if(tm)for(var r of tm(t))tg.call(t,r)&&tv(e,r,t[r]);return e},tb=(e,t)=>{var r={};for(var n in e)ty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&tm)for(var n of tm(e))0>t.indexOf(n)&&tg.call(e,n)&&(r[n]=e[n]);return r};function tw(e){return new URL(e).origin}var tx=Object.defineProperty,tk=Object.defineProperties,tT=Object.getOwnPropertyDescriptors,tE=Object.getOwnPropertySymbols,tC=Object.prototype.hasOwnProperty,tS=Object.prototype.propertyIsEnumerable,tO=(e,t,r)=>t in e?tx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tA=(e,t)=>{for(var r in t||(t={}))tC.call(t,r)&&tO(e,r,t[r]);if(tE)for(var r of tE(t))tS.call(t,r)&&tO(e,r,t[r]);return e},tZ=(e,t)=>tk(e,tT(t)),tP=(e,t)=>{var r={};for(var n in e)tC.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&tE)for(var n of tE(e))0>t.indexOf(n)&&tS.call(e,n)&&(r[n]=e[n]);return r},tI=(e,t,r)=>new Promise((n,i)=>{var a=e=>{try{o(r.next(e))}catch(e){i(e)}},s=e=>{try{o(r.throw(e))}catch(e){i(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,s);o((r=r.apply(e,t)).next())}),tN=class{constructor(e,t,r){this.transport=e,this.incomingEvents=t,this.outgoingEvents=r}send(e,t){let r=this.outgoingEvents[e].safeParse(t);r.success?(console.info(`[EventEmitter] send: ${String(e)}`),this.transport.send({event:e,data:t})):console.error(`[EventEmitter] send() - Validation failed for event: ${String(e)}`,r.error)}on(e,t){return this.transport.addMessageListener(r=>{if(r.data.event===e){let n=this.incomingEvents[e].safeParse(r.data.data);n.success?t(n.data):console.error(`[EventEmitter] on() - Validation failed for event: ${String(e)}`,n.error)}})}sendAction({event:e,data:t,responseEvent:r,options:n}){var i;let a=null!=(i=null==n?void 0:n.timeoutMs)?i:7e3,s=null==n?void 0:n.maxRetries;return console.info(`[EventEmitter] sendAction: ${String(e)} \u2192 waiting ${String(r)} (timeout: ${a}ms)`),new Promise((i,o)=>{let l,d=0,u=setTimeout(()=>{l&&clearInterval(l),this.off(c),console.warn(`[EventEmitter] sendAction: timeout after ${a/1e3}s waiting for ${String(r)}`),o(`Timed out waiting for ${String(r)} event${null!=n&&n.condition?", with condition,":""} after ${a/1e3}s`)},a),c=this.on(r,e=>{null!=n&&n.condition&&!n.condition(e)||(l&&clearInterval(l),clearTimeout(u),this.off(c),console.info(`[EventEmitter] sendAction: received ${String(r)}`),i(e))});this.send(e,t),null!=n&&n.intervalMs&&(l=setInterval(()=>{if(void 0!==s&&d>=s){clearInterval(l),clearTimeout(u),this.off(c),console.warn(`[EventEmitter] sendAction: max retries (${s}) reached for ${String(e)}`),o(`Max retries (${s}) reached waiting for ${String(r)} event${null!=n&&n.condition?", with condition":""}`);return}d++,this.send(e,t)},null==n?void 0:n.intervalMs))})}onAction(e){return tI(this,null,function*(){var t,{event:r,options:n}=e,i=tP(e,["event","options"]);let a=null!=(t=null==n?void 0:n.timeoutMs)?t:7e3;return new Promise((e,t)=>{let s=setTimeout(()=>{this.off(o),console.warn(`[EventEmitter] onAction() - Timeout after ${a/1e3}s waiting for ${String(r)}`),t(`Timed out waiting for ${String(r)} event${null!=n&&n.condition?", with condition,":""} after ${a/1e3}s`)},a),o=this.on(r,t=>{if(!(null!=n&&n.condition&&!n.condition(t))){if(console.info(`[EventEmitter] onAction: received ${String(r)}`),"callback"in i&&null!=i.callback){let e=i.callback(t);this.send(i.responseEvent,e)}this.off(o),clearTimeout(s),e(t)}})})})}off(e){this.transport.removeMessageListener(e)}},tj=(e=13)=>{let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>(e%36).toString(36)).join("")};(y=d||(d={})).assertEqual=e=>e,y.assertIs=function(e){},y.assertNever=function(e){throw Error()},y.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},y.getValidEnumValues=e=>{let t=y.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return y.objectValues(r)},y.objectValues=e=>y.objectKeys(e).map(function(t){return e[t]}),y.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},y.find=(e,t)=>{for(let r of e)if(t(r))return r},y.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,y.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},y.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(u||(u={})).mergeShapes=(e,t)=>({...e,...t});let tR=d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tM=e=>{switch(typeof e){case"undefined":return tR.undefined;case"string":return tR.string;case"number":return isNaN(e)?tR.nan:tR.number;case"boolean":return tR.boolean;case"function":return tR.function;case"bigint":return tR.bigint;case"symbol":return tR.symbol;case"object":if(Array.isArray(e))return tR.array;if(null===e)return tR.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return tR.promise;if("undefined"!=typeof Map&&e instanceof Map)return tR.map;if("undefined"!=typeof Set&&e instanceof Set)return tR.set;if("undefined"!=typeof Date&&e instanceof Date)return tR.date;return tR.object;default:return tR.unknown}}
182,tL=d.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class tU extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}tU.create=e=>new tU(e);let t$=(e,t)=>{let r;switch(e.code){case tL.invalid_type:r=e.received===tR.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case tL.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,d.jsonStringifyReplacer)}`;break;case tL.unrecognized_keys:r=`Unrecognized key(s) in object: ${d.joinValues(e.keys,", ")}`;break;case tL.invalid_union:r="Invalid input";break;case tL.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${d.joinValues(e.options)}`;break;case tL.invalid_enum_value:r=`Invalid enum value. Expected ${d.joinValues(e.options)}, received '${e.received}'`;break;case tL.invalid_arguments:r="Invalid function arguments";break;case tL.invalid_return_type:r="Invalid function return type";break;case tL.invalid_date:r="Invalid date";break;case tL.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:d.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case tL.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case tL.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case tL.custom:r="Invalid input";break;case tL.invalid_intersection_types:r="Intersection results could not be merged";break;case tL.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case tL.not_finite:r="Number must be finite";break;default:r=t.defaultError,d.assertNever(e)}return{message:r}},tD=t$;function tV(){return tD}let tz=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a},o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:i.message||o}};function tB(e,t){let r=tz({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,tV(),t$].filter(e=>!!e)});e.common.issues.push(r)}class tK{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return tq;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t)r.push({key:await e.key,value:await e.value});return tK.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return tq;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let tq=Object.freeze({status:"aborted"}),tF=e=>({status:"dirty",value:e}),tW=e=>
182({status:"valid",value:e}),tH=e=>"aborted"===e.status,tY=e=>"dirty"===e.status,tG=e=>"valid"===e.status,tJ=e=>"undefined"!=typeof Promise&&e instanceof Promise;(g=c||(c={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},g.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class tQ{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let tX=(e,t)=>{if(tG(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new tU(e.common.issues);return this._error=t,this._error}}};function t5(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=r?r:t.defaultError},description:i}}class t1{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return tM(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:tM(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tK,ctx:{common:e.parent.common,data:e.data,parsedType:tM(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(tJ(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tM(e)},i=this._parseSync({data:e,path:n.path,parent:n});return tX(n,i)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tM(e)},n=this._parse({data:e,path:r.path,parent:r});return tX(r,await (tJ(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),a=()=>n.addIssue({code:tL.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new rA({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return rZ.create(this,this._def)}nullable(){return rP.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rh.create(this,this._def)}promise(){return rO.create(this,this._def)}or(e){return rf.create([this,e],this._def)}and(e){return rg.create(this,e,this._def)}transform(e){return new rA({...t5(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new rI({...t5(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:h.ZodDefault})}brand(){return new rM({typeName:h.ZodBranded,type:this,...t5(this._def)})}catch(e){return new rN({...t5(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:h.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rL.create(this,e)}readonly(){return rU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let t0=/^c[^\s-]{8,}
182$/i,t2=/^[a-z][a-z0-9]*$/,t6=/^[0-9A-HJKMNP-TV-Z]{26}$/,t3=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,t4=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,t8=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,t9=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,t7=e=>e.precision?e.offset?RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");class re extends t1{_parse(e){let t;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==tR.string){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.string,received:t.parsedType}),tq}let r=new tK;for(let s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if("max"===s.kind)e.data.length>s.value&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if("length"===s.kind){let n=e.data.length>s.value,i=e.data.length<s.value;(n||i)&&(t=this._getOrReturnCtx(e,t),n?tB(t,{code:tL.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&tB(t,{code:tL.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if("email"===s.kind)t4.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"email",code:tL.invalid_string,message:s.message}),r.dirty());else if("emoji"===s.kind)i||(i=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),i.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"emoji",code:tL.invalid_string,message:s.message}),r.dirty());else if("uuid"===s.kind)t3.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"uuid",code:tL.invalid_string,message:s.message}),r.dirty());else if("cuid"===s.kind)t0.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"cuid",code:tL.invalid_string,message:s.message}),r.dirty());else if("cuid2"===s.kind)t2.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"cuid2",code:tL.invalid_string,message:s.message}),r.dirty());else if("ulid"===s.kind)t6.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"ulid",code:tL.invalid_string,message:s.message}),r.dirty());else if("url"===s.kind)try{new URL(e.data)}catch(n){tB(t=this._getOrReturnCtx(e,t),{validation:"url",code:tL.invalid_string,message:s.message}),r.dirty()}else if("regex"===s.kind)s.regex.lastIndex=0,s.regex.test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{validation:"regex",code:tL.invalid_string,message:s.message}),r.dirty());else if("trim"===s.kind)e.data=e.data.trim();else if("includes"===s.kind)e.data.includes(s.value,s.position)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty());else if("toLowerCase"===s.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===s.kind)e.data=e.data.toUpperCase();else if("startsWith"===s.kind)e.data.startsWith(s.value)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty());else if("endsWith"===s.kind)e.data.endsWith(s.value)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty());else if("datetime"===s.kind)t7(s).test(e.data)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.invalid_string,validation:"datetime",message:s.message}),r.dirty());else if("ip"===s.kind){var n,a;
182n=e.data,("v4"===(a=s.version)||!a)&&t8.test(n)||("v6"===a||!a)&&t9.test(n)||(tB(t=this._getOrReturnCtx(e,t),{validation:"ip",code:tL.invalid_string,message:s.message}),r.dirty())}else d.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:tL.invalid_string,...c.errToObj(r)})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...c.errToObj(e)})}url(e){return this._addCheck({kind:"url",...c.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...c.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...c.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...c.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...c.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...c.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...c.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...c.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...c.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...c.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...c.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...c.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...c.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...c.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...c.errToObj(t)})}nonempty(e){return this.min(1,c.errToObj(e))}trim(){return new re({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}re.create=e=>{var t;return new re({checks:[],typeName:h.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...t5(e)})};class rt extends t1{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==tR.number){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.number,received:t.parsedType}),tq}let r=new tK;for(let n of this._def.checks)"int"===n.kind?d.isInteger(e.data)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(tB(t=this._getOrReturnCtx(e,t),{code:tL.not_finite,message:n.message}),r.dirty()):d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,c.toString(t))}gt(e,t){return this.setLimit("min",e,!1,c.toString(t))}lte(e,t){return this.setLimit("max",e,!0,c.toString(t))}lt(e,t){return this.setLimit("max",e,!1,c.toString(t))}setLimit(e,t,r,n){return new rt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:c.toString(n)}]})}_addCheck(e){return new rt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:c.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:c.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:c.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&d.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}rt.create=e=>new rt({checks:[],typeName:h.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...t5(e)});class rr extends t1{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==tR.bigint){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.bigint,received:t.parsedType}),tq}let r=new tK;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,c.toString(t))}gt(e,t){return this.setLimit("min",e,!1,c.toString(t))}lte(e,t){return this.setLimit("max",e,!0,c.toString(t))}lt(e,t){return this.setLimit("max",e,!1,c.toString(t))}setLimit(e,t,r,n){return new rr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:c.toString(n)}]})}_addCheck(e){return new rr({...this._def,checks:[...this._def.checks,e]})}
182positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:c.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rr.create=e=>{var t;return new rr({checks:[],typeName:h.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...t5(e)})};class rn extends t1{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==tR.boolean){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.boolean,received:t.parsedType}),tq}return tW(e.data)}}rn.create=e=>new rn({typeName:h.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...t5(e)});class ri extends t1{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==tR.date){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.date,received:t.parsedType}),tq}if(isNaN(e.data.getTime()))return tB(this._getOrReturnCtx(e),{code:tL.invalid_date}),tq;let r=new tK;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(tB(t=this._getOrReturnCtx(e,t),{code:tL.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):d.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ri({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:c.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:c.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ri.create=e=>new ri({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:h.ZodDate,...t5(e)});class ra extends t1{_parse(e){if(this._getType(e)!==tR.symbol){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.symbol,received:t.parsedType}),tq}return tW(e.data)}}ra.create=e=>new ra({typeName:h.ZodSymbol,...t5(e)});class rs extends t1{_parse(e){if(this._getType(e)!==tR.undefined){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.undefined,received:t.parsedType}),tq}return tW(e.data)}}rs.create=e=>new rs({typeName:h.ZodUndefined,...t5(e)});class ro extends t1{_parse(e){if(this._getType(e)!==tR.null){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.null,received:t.parsedType}),tq}return tW(e.data)}}ro.create=e=>new ro({typeName:h.ZodNull,...t5(e)});class rl extends t1{constructor(){super(...arguments),this._any=!0}_parse(e){return tW(e.data)}}rl.create=e=>new rl({typeName:h.ZodAny,...t5(e)});class rd extends t1{constructor(){super(...arguments),this._unknown=!0}_parse(e){return tW(e.data)}}rd.create=e=>new rd({typeName:h.ZodUnknown,...t5(e)});class ru extends t1{_parse(e){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.never,received:t.parsedType}),tq}}ru.create=e=>new ru({typeName:h.ZodNever,...t5(e)});class rc extends t1{_parse(e){if(this._getType(e)!==tR.undefined){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.void,received:t.parsedType}),tq}return tW(e.data)}}rc.create=e=>new rc({typeName:h.ZodVoid,...t5(e)});class rh extends t1{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==tR.array)return tB(t,{code:tL.invalid_type,expected:tR.array,received:t.parsedType}),tq;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(tB(t,{code:e?tL.too_big:tL.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(tB(t,{code:tL.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(tB(t,{code:tL.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new tQ(t,e,t.path,r)))).then(e=>tK.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new tQ(t,e,t.path,r)));return tK.mergeArray(r,i)}
182get element(){return this._def.type}min(e,t){return new rh({...this._def,minLength:{value:e,message:c.toString(t)}})}max(e,t){return new rh({...this._def,maxLength:{value:e,message:c.toString(t)}})}length(e,t){return new rh({...this._def,exactLength:{value:e,message:c.toString(t)}})}nonempty(e){return this.min(1,e)}}rh.create=(e,t)=>new rh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...t5(t)});class rp extends t1{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=d.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==tR.object){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.object,received:t.parsedType}),tq}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ru&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new tQ(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ru){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(tB(r,{code:tL.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new tQ(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e}).then(e=>tK.mergeObjectSync(t,e)):tK.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return c.errToObj,new rp({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,a,s;let o=null!==(a=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=c.errToObj(e).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new rp({...this._def,unknownKeys:"strip"})}passthrough(){return new rp({...this._def,unknownKeys:"passthrough"})}extend(e){return new rp({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new rp({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new rp({...this._def,catchall:e})}pick(e){let t={};return d.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new rp({...this._def,shape:()=>t})}omit(e){let t={};return d.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new rp({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof rp){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=rZ.create(e(i))}return new rp({...t._def,shape:()=>r})}return t instanceof rh?new rh({...t._def,type:e(t.element)}):t instanceof rZ?rZ.create(e(t.unwrap())):t instanceof rP?rP.create(e(t.unwrap())):t instanceof rv?rv.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return d.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new rp({...this._def,shape:()=>t})}required(e){let t={};return d.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof rZ;)e=e._def.innerType;t[r]=e}}),new rp({...this._def,shape:()=>t})}keyof(){return rE(d.objectKeys(this.shape))}}rp.create=(e,t)=>new rp({shape:()=>e,unknownKeys:"strip",catchall:ru.create(),typeName:h.ZodObject,...t5(t)}),rp.strictCreate=(e,t)=>new rp({shape:()=>e,unknownKeys:"strict",catchall:ru.create(),typeName:h.ZodObject,...t5(t)}),rp.lazycreate=(e,t)=>new rp({shape:e,unknownKeys:"strip",catchall:ru.create(),typeName:h.ZodObject,...t5(t)});class rf extends t1{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new tU(e.ctx.common.issues));return tB(t,{code:tL.invalid_union,unionErrors:r}),tq});{let e;let n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new tU(e));return tB(t,{code:tL.invalid_union,unionErrors:i}),tq}}get options(){return this._def.options}}rf.create=(e,t)=>
182new rf({options:e,typeName:h.ZodUnion,...t5(t)});let rm=e=>{if(e instanceof rk)return rm(e.schema);if(e instanceof rA)return rm(e.innerType());if(e instanceof rT)return[e.value];if(e instanceof rC)return e.options;if(e instanceof rS)return Object.keys(e.enum);if(e instanceof rI)return rm(e._def.innerType);if(e instanceof rs)return[void 0];else if(e instanceof ro)return[null];else return null};class ry extends t1{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tR.object)return tB(t,{code:tL.invalid_type,expected:tR.object,received:t.parsedType}),tq;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(tB(t,{code:tL.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),tq)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=rm(r.shape[e]);if(!t)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new ry({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...t5(r)})}}class rg extends t1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(tH(e)||tH(n))return tq;let i=function e(t,r){let n=tM(t),i=tM(r);if(t===r)return{valid:!0,data:t};if(n===tR.object&&i===tR.object){let n=d.objectKeys(r),i=d.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===tR.array&&i===tR.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===tR.date&&i===tR.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,n.value);return i.valid?((tY(e)||tY(n))&&t.dirty(),{status:t.value,value:i.data}):(tB(r,{code:tL.invalid_intersection_types}),tq)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}rg.create=(e,t,r)=>new rg({left:e,right:t,typeName:h.ZodIntersection,...t5(r)});class rv extends t1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tR.array)return tB(r,{code:tL.invalid_type,expected:tR.array,received:r.parsedType}),tq;if(r.data.length<this._def.items.length)return tB(r,{code:tL.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tq;!this._def.rest&&r.data.length>this._def.items.length&&(tB(r,{code:tL.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new tQ(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>tK.mergeArray(t,e)):tK.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new rv({...this._def,rest:e})}}rv.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new rv({items:e,typeName:h.ZodTuple,rest:null,...t5(t)})};class r_ extends t1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tR.object)return tB(r,{code:tL.invalid_type,expected:tR.object,received:r.parsedType}),tq;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new tQ(r,e,r.path,e)),value:a._parse(new tQ(r,r.data[e],r.path,e))});return r.common.async?tK.mergeObjectAsync(t,n):tK.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new r_(t instanceof t1?{keyType:e,valueType:t,typeName:h.ZodRecord,...t5(r)}:{keyType:re.create(),valueType:e,typeName:h.ZodRecord,...t5(t)})}}class rb extends t1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tR.map)return tB(r,{code:tL.invalid_type,expected:tR.map,received:r.parsedType}),tq;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new tQ(r,e,r.path,[a,"key"])),value:i._parse(new tQ(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return tq;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return tq;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}rb.create=(e,t,r)=>new rb({valueType:t,keyType:e,typeName:h.ZodMap,...t5(r)});class rw extends t1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tR.set)return tB(r,{code:tL.invalid_type,expected:tR.set,received:r.parsedType}),tq;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(tB(r,{code:tL.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(tB(r,{code:tL.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return tq;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new tQ(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new rw({...this._def,minSize:{value:e,message:c.toString(t)}})}max(e,t){return new rw({...this._def,maxSize:{value:e,message:c.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}rw.create=(e,t)=>
182new rw({valueType:e,minSize:null,maxSize:null,typeName:h.ZodSet,...t5(t)});class rx extends t1{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tR.function)return tB(t,{code:tL.invalid_type,expected:tR.function,received:t.parsedType}),tq;function r(e,r){return tz({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tV(),t$].filter(e=>!!e),issueData:{code:tL.invalid_arguments,argumentsError:r}})}function n(e,r){return tz({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tV(),t$].filter(e=>!!e),issueData:{code:tL.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof rO){let e=this;return tW(async function(...t){let s=new tU([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw s.addIssue(r(t,e)),s}),l=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw s.addIssue(n(l,e)),s})})}{let e=this;return tW(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new tU([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new tU([n(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new rx({...this._def,args:rv.create(e).rest(rd.create())})}returns(e){return new rx({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new rx({args:e||rv.create([]).rest(rd.create()),returns:t||rd.create(),typeName:h.ZodFunction,...t5(r)})}}class rk extends t1{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rk.create=(e,t)=>new rk({getter:e,typeName:h.ZodLazy,...t5(t)});class rT extends t1{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return tB(t,{received:t.data,code:tL.invalid_literal,expected:this._def.value}),tq}return{status:"valid",value:e.data}}get value(){return this._def.value}}function rE(e,t){return new rC({values:e,typeName:h.ZodEnum,...t5(t)})}rT.create=(e,t)=>new rT({value:e,typeName:h.ZodLiteral,...t5(t)});class rC extends t1{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return tB(t,{expected:d.joinValues(r),received:t.parsedType,code:tL.invalid_type}),tq}if(-1===this._def.values.indexOf(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return tB(t,{received:t.data,code:tL.invalid_enum_value,options:r}),tq}return tW(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return rC.create(e)}exclude(e){return rC.create(this.options.filter(t=>!e.includes(t)))}}rC.create=rE;class rS extends t1{_parse(e){let t=d.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==tR.string&&r.parsedType!==tR.number){let e=d.objectValues(t);return tB(r,{expected:d.joinValues(e),received:r.parsedType,code:tL.invalid_type}),tq}if(-1===t.indexOf(e.data)){let e=d.objectValues(t);return tB(r,{received:r.data,code:tL.invalid_enum_value,options:e}),tq}return tW(e.data)}get enum(){return this._def.values}}rS.create=(e,t)=>new rS({values:e,typeName:h.ZodNativeEnum,...t5(t)});class rO extends t1{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==tR.promise&&!1===t.common.async?(tB(t,{code:tL.invalid_type,expected:tR.promise,received:t.parsedType}),tq):tW((t.parsedType===tR.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}rO.create=(e,t)=>new rO({type:e,typeName:h.ZodPromise,...t5(t)});class rA extends t1{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{tB(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then(e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?tq:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?tq:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>tG(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!tG(e))return e;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}}d.assertNever(n)}}rA.create=(e,t,r)=>new rA({schema:e,typeName:h.ZodEffects,effect:t,...t5(r)}),rA.createWithPreprocess=(e,t,r)=>new rA({schema:t,effect:{type:"preprocess",transform:e},typeName:h.ZodEffects,...t5(r)});class rZ extends t1{_parse(e){return this._getType(e)===tR.undefined?tW(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rZ.create=(e,t)=>
182new rZ({innerType:e,typeName:h.ZodOptional,...t5(t)});class rP extends t1{_parse(e){return this._getType(e)===tR.null?tW(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rP.create=(e,t)=>new rP({innerType:e,typeName:h.ZodNullable,...t5(t)});class rI extends t1{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===tR.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rI.create=(e,t)=>new rI({innerType:e,typeName:h.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...t5(t)});class rN extends t1{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tJ(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tU(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new tU(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}rN.create=(e,t)=>new rN({innerType:e,typeName:h.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...t5(t)});class rj extends t1{_parse(e){if(this._getType(e)!==tR.nan){let t=this._getOrReturnCtx(e);return tB(t,{code:tL.invalid_type,expected:tR.nan,received:t.parsedType}),tq}return{status:"valid",value:e.data}}}rj.create=e=>new rj({typeName:h.ZodNaN,...t5(e)});let rR=Symbol("zod_brand");class rM extends t1{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class rL extends t1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tq:"dirty"===e.status?(t.dirty(),tF(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tq:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new rL({in:e,out:t,typeName:h.ZodPipeline})}}class rU extends t1{_parse(e){let t=this._def.innerType._parse(e);return tG(t)&&(t.value=Object.freeze(t.value)),t}}rU.create=(e,t)=>new rU({innerType:e,typeName:h.ZodReadonly,...t5(t)});let r$=(e,t={},r)=>e?rl.create().superRefine((n,i)=>{var a,s;if(!e(n)){let e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s;i.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):rl.create(),rD={object:rp.lazycreate};(v=h||(h={})).ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly";let rV=re.create,rz=rt.create,rB=rj.create,rK=rr.create,rq=rn.create,rF=ri.create,rW=ra.create,rH=rs.create,rY=ro.create,rG=rl.create,rJ=rd.create,rQ=ru.create,rX=rc.create,r5=rh.create,r1=rp.create,r0=rp.strictCreate,r2=rf.create,r6=ry.create,r3=rg.create,r4=rv.create,r8=r_.create,r9=rb.create,r7=rw.create,ne=rx.create,nt=rk.create,nr=rT.create,nn=rC.create,ni=rS.create,na=rO.create,ns=rA.create,no=rZ.create,nl=rP.create,nd=rA.createWithPreprocess,nu=rL.create;var nc=Object.freeze({__proto__:null,defaultErrorMap:t$,setErrorMap:function(e){tD=e},getErrorMap:tV,makeIssue:tz,EMPTY_PATH:[],addIssueToContext:tB,ParseStatus:tK,INVALID:tq,DIRTY:tF,OK:tW,isAborted:tH,isDirty:tY,isValid:tG,isAsync:tJ,get util(){return d},get objectUtil(){return u},ZodParsedType:tR,getParsedType:tM,ZodType:t1,ZodString:re,ZodNumber:rt,ZodBigInt:rr,ZodBoolean:rn,ZodDate:ri,ZodSymbol:ra,ZodUndefined:rs,ZodNull:ro,ZodAny:rl,ZodUnknown:rd,ZodNever:ru,ZodVoid:rc,ZodArray:rh,ZodObject:rp,ZodUnion:rf,ZodDiscriminatedUnion:ry,ZodIntersection:rg,ZodTuple:rv,ZodRecord:r_,ZodMap:rb,ZodSet:rw,ZodFunction:rx,ZodLazy:rk,ZodLiteral:rT,ZodEnum:rC,ZodNativeEnum:rS,ZodPromise:rO,ZodEffects:rA,ZodTransformer:rA,ZodOptional:rZ,ZodNullable:rP,ZodDefault:rI,ZodCatch:rN,ZodNaN:rj,BRAND:rR,ZodBranded:rM,ZodPipeline:rL,ZodReadonly:rU,custom:r$,Schema:t1,ZodSchema:t1,late:rD,get ZodFirstPartyTypeKind(){return h},coerce:{string:e=>re.create({...e,coerce:!0}),number:e=>rt.create({...e,coerce:!0}),boolean:e=>rn.create({...e,coerce:!0}),bigint:e=>rr.create({...e,coerce:!0}),date:e=>ri.create({...e,coerce:!0})},any:rG,array:r5,bigint:rK,boolean:rq,date:rF,discriminatedUnion:r6,effect:ns,enum:nn,function:ne,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>r$(t=>t instanceof e,t),intersection:r3,lazy:nt,literal:nr,map:r9,nan:rB,nativeEnum:ni,never:rQ,null:rY,nullable:nl,number:rz,object:r1,oboolean:()=>rq().optional(),onumber:()=>rz().optional(),optional:no,ostring:()=>rV().optional(),pipeline:nu,preprocess:nd,promise:na,record:r8,set:r7,strictObject:r0,string:rV,symbol:rW,transformer:ns,tuple:r4,undefined:rH,union:r2,unknown:rJ,void:rX,NEVER:tq,ZodIssueCode:tL,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:tU}),nh={timeoutMs:1e4,intervalMs:100},np={fromChild:{handshakeResponse:nc.object({requestVerificationId:nc.string()})},fromParent:{handshakeRequest:nc.object({requestVerificationId:nc.string()}),handshakeComplete:nc.object({requestVerificationId:nc.string()})}},nf=class extends tN{constructor(e,t){super(e,tA(tA({},null==t?void 0:t.incomingEvents),np.fromChild),tA(tA({},null==t?void 0:t.outgoingEvents),np.fromParent)),this.isConnected=!1,this.connectionGeneration=0,this.handshakeOptions=tA(tA({},nh),null==t?void 0:t.handshakeOptions)}handshakeWithChild(){return tI(this,null,function*(){return null==this._ongoingHandshakeWithChild&&(this._ongoingHandshakeWithChild=tI(this,null,function*(){try{yield this._performHandshake()}finally{this._ongoingHandshakeWithChild=void 0}})),yield this._ongoingHandshakeWithChild})}_performHandshake(){return tI(this,null,function*(){if(this.isConnected)return;
182console.info(`[HandshakeParent] Starting handshake (timeout: ${this.handshakeOptions.timeoutMs}ms)`);let e=tj();yield this._sendAction({event:"handshakeRequest",data:{requestVerificationId:e},responseEvent:"handshakeResponse",options:{timeoutMs:this.handshakeOptions.timeoutMs,intervalMs:this.handshakeOptions.intervalMs,condition:t=>t.requestVerificationId===e}}),this._send("handshakeComplete",{requestVerificationId:e}),this.isConnected=!0,this.connectionGeneration++,console.info("[HandshakeParent] Handshake completed")})}_send(e,t){return super.send(e,t)}_sendAction(e){return super.sendAction(tZ(tA({},e),{options:e.options}))}},nm=class{constructor(e,t){this.otherWindow=e,this.targetOrigin=t,this.listeners=new Map}send(e){Array.isArray(this.targetOrigin)?this.targetOrigin.forEach(t=>{this.otherWindow.postMessage(e,t)}):this.otherWindow.postMessage(e,this.targetOrigin)}addMessageListener(e){let t=t=>{this.isTargetOrigin(t.origin)&&t.source===this.otherWindow&&e({type:t.type,data:t.data})},r=tj();return window.addEventListener("message",t),this.listeners.set(r,t),r}removeMessageListener(e){let t=this.listeners.get(e);null!=t&&(window.removeEventListener("message",t),this.listeners.delete(e))}isTargetOrigin(e){return Array.isArray(this.targetOrigin)?this.targetOrigin.includes(e):"*"===this.targetOrigin||this.targetOrigin===e}},ny=class e extends nf{constructor(e,t,r,n=nm){let i=e.contentWindow;if(!i)throw Error("IFrame must have a contentWindow");super(new n(i,t),r),this.iframe=e}static init(t,r){return tI(this,arguments,function*(t,r,n=nm){let i="string"==typeof t?yield function(e){return tI(this,null,function*(){let t=document.createElement("iframe");return t.src=e,new Promise((e,r)=>{t.onload=()=>e(t),t.onerror=()=>r("Failed to load iframe content"),document.body.appendChild(t)})})}(t):t,a=(null==r?void 0:r.targetOrigin)||tw(i.src);return new e(i,a,r,n)})}static initExistingIFrame(t,r,n=nm){let i=(null==r?void 0:r.targetOrigin)||tw(t.src);return new e(t,i,r,n)}},ng=r(37758),nv=r(2265),n_=r(57437);function nb(e){let[t,r]=(0,nv.useState)(null),[n,i]=(0,nv.useState)(0),a=(0,nv.useRef)(null),{crossmint:s}=function(e){let t=(0,nv.useContext)(ng.a);if(null==t)throw Error("useCrossmint must be used within a CrossmintProvider");return t}(),o=function({apiClient:e}){return{iframe:{getUrl:function(t){let r=e.buildUrl("/sdk/unstable/payment-method-management"),n=new URLSearchParams,{allowedPaymentMethodTypes:i,allowedModes:a}=t;return function(e,t){for(let[r,n]of Object.entries(t))if(!(!n||"function"==typeof n)){if("object"==typeof n)e.append(r,JSON.stringify(n,(e,t)=>"function"==typeof t?"function":t));else if("string"==typeof n){if("undefined"===n)continue;e.append(r,n)}else["boolean","number"].includes(typeof n)&&e.append(r,n.toString())}}(n,t_(t_(t_({},tb(t,["allowedPaymentMethodTypes","allowedModes"])),null!=i&&i.length?{allowedPaymentMethodTypes:i}:{}),null!=a&&a.length?{allowedModes:a}:{})),n.append("apiKey",e.crossmint.apiKey),n.append("sdkMetadata",JSON.stringify(e.internalConfig.sdkMetadata)),`${r}?${n.toString()}`},createClient:function(e){return ny.initExistingIFrame(e,{incomingEvents:th,outgoingEvents:tp})}}}}({apiClient:new T(s,{internalConfig:{sdkMetadata:{name:"@crossmint/client-sdk-react-ui",version:_},apiKeyExpectations:{usageOrigin:"client"}}})});return(0,nv.useEffect)(()=>{let e=a.current;!e||t||r(o.iframe.createClient(e))},[a.current,t]),(0,nv.useEffect)(()=>{if(null!=t)return t.on("ui:height.changed",e=>i(e.height)),t.on("payment-method:selected",t=>{var r;return null==(r=e.onPaymentMethodSelected)?void 0:r.call(e,t)}),()=>{t.off("ui:height.changed"),t.off("payment-method:selected"),t.off("agentic-enrollment:created")}},[t]),(0,n_.jsx)("iframe",{ref:a,src:o.iframe.getUrl(e),id:"crossmint-payment-method-management.iframe",role:"crossmint-payment-method-management.iframe",allow:"payment *; microphone; camera",style:{boxShadow:"none",border:"none",padding:"0px",width:"100%",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",transform:"translate(0px)",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${n}px`,backgroundColor:"transparent"}})}var nw=r(9801);function nx(e){return(0,n_.jsx)(nb,(0,nw.a)({},e))}},26729:function(e,t,r){"use strict";let n;r.d(t,{a:function(){return c},b:function(){return h},c:function(){return p},d:function(){return f}});var i=Object.defineProperty,a=Object.defineProperties,s=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,u=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c=(e,t)=>{for(var r in t||(t={}))l.call(t,r)&&u(e,r,t[r]);if(o)for(var r of o(t))d.call(t,r)&&u(e,r,t[r]);return e},h=(e,t)=>a(e,s(t)),p=(n=function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(n,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):n),f=(e,t,r)=>new Promise((n,i)=>{var a=e=>{try{o(r.next(e))}catch(e){i(e)}},s=e=>{try{o(r.throw(e))}catch(e){i(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,s);o((r=r.apply(e,t)).next())})},11724:function(e,t,r){"use strict";r.d(t,{d:function(){return c}});var n="3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5",i="8erZh8YApGck3iUSUHqATBxqMTM1Ukp9mHmvGgUWHtkK",a={CLIENT:"ck",SERVER:"sk"},s={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"}
182,o={CLIENT:"client",SERVER:"server"},l=r(26729),d=r(59147),u=r(75807);function c(e,t){let r=function(e,t){let r;if(e.startsWith("sk_live")||e.startsWith("sk_test"))return{isValid:!1,message:"Old API key format detected. Please create a new API key from the Crossmint console."};let n=e.startsWith(a.CLIENT+"_")?o.CLIENT:e.startsWith(a.SERVER+"_")?o.SERVER:null;if(null==n)return{isValid:!1,message:`Malformed API key. Must start with '${a.CLIENT}' or '${a.SERVER}'.`};if((null==t?void 0:t.usageOrigin)!=null&&n!==t.usageOrigin)return{isValid:!1,message:`Disallowed API key. You passed a ${n} API key, but a ${t.usageOrigin} API key is required.`};let i=(r=e.slice(3)).startsWith(s.DEVELOPMENT+"_")?s.DEVELOPMENT:r.startsWith(s.STAGING+"_")?s.STAGING:r.startsWith(s.PRODUCTION+"_")?s.PRODUCTION:null;return null==i?{isValid:!1,message:`Malformed API key. Must have a valid environment: '${s.DEVELOPMENT}', '${s.STAGING}' or '${s.PRODUCTION}'.`}:(null==t?void 0:t.environment)!=null&&i!==t.environment?{isValid:!1,message:`Disallowed API key. You passed a ${i} API key, but a ${t.environment} API key is required.`}:{isValid:!0,usageOrigin:n,environment:i,prefix:`${"client"===n?"ck":"sk"}_${i}`}}(e,t);if(!r.isValid)return r;let{prefix:c}=r,{keyData:h,keyDataWithoutPrefix:p,signature:f}=function(e,t){let r=e.slice(`${t}_`.length),n=d.decode(r),[i,a]=new TextDecoder().decode(n).split(":");return{keyData:`${t}.${i}`,keyDataWithoutPrefix:i,signature:a}}(e,c);if(!function(e,t,r){let a=function(e){switch(e){case"development":case"staging":return n;case"production":return i;default:return null}}(null==r?void 0:r.environment);function s(r){try{let n=d.decode(t),i=new TextEncoder().encode(e),a=d.decode(r);return u.sign.detached.verify(i,n,a)}catch(e){return console.error("Failed to validate API key signature"),!1}}return null!=a?s(a):s(i)||s(n)}(h,f,t))return{isValid:!1,message:"Invalid API key. Failed to validate signature"};let[m]=p.split(".");return(0,l.b)((0,l.a)({},r),{projectId:m})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.