UNPKG

autogram-sdk

Version:
2 lines 1 MB
var AutogramSDK=(()=>{var Fu=Object.create;var Lo=Object.defineProperty,Tu=Object.defineProperties,g4=Object.getOwnPropertyDescriptor,Du=Object.getOwnPropertyDescriptors,Pu=Object.getOwnPropertyNames,m4=Object.getOwnPropertySymbols,Qu=Object.getPrototypeOf,A4=Object.prototype.hasOwnProperty,Uu=Object.prototype.propertyIsEnumerable;var w4=Math.pow,b4=(o,s,c)=>s in o?Lo(o,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[s]=c,a1=(o,s)=>{for(var c in s||(s={}))A4.call(s,c)&&b4(o,c,s[c]);if(m4)for(var c of m4(s))Uu.call(s,c)&&b4(o,c,s[c]);return o},pe=(o,s)=>Tu(o,Du(s));var Gu=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(s,c)=>(typeof require!="undefined"?require:s)[c]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var Hu=(o,s)=>()=>(s||o((s={exports:{}}).exports,s),s.exports);var zu=(o,s,c,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of Pu(s))!A4.call(o,d)&&d!==c&&Lo(o,d,{get:()=>s[d],enumerable:!(l=g4(s,d))||l.enumerable});return o};var x4=(o,s,c)=>(c=o!=null?Fu(Qu(o)):{},zu(s||!o||!o.__esModule?Lo(c,"default",{value:o,enumerable:!0}):c,o));var Z2=(o,s,c,l)=>{for(var d=l>1?void 0:l?g4(s,c):s,p=o.length-1,h;p>=0;p--)(h=o[p])&&(d=(l?h(s,c,d):h(d))||d);return l&&d&&Lo(s,c,d),d};var ke=(o,s,c)=>new Promise((l,d)=>{var p=m=>{try{u(c.next(m))}catch(w){d(w)}},h=m=>{try{u(c.throw(m))}catch(w){d(w)}},u=m=>m.done?l(m.value):Promise.resolve(m.value).then(p,h);u((c=c.apply(o,s)).next())});var Ad=Hu((un,gd)=>{var vc=typeof globalThis!="undefined"&&globalThis||typeof self!="undefined"&&self||typeof global!="undefined"&&global,hc=function(){function o(){this.fetch=!1,this.DOMException=vc.DOMException}return o.prototype=vc,new o}();(function(o){var s=function(c){var l=typeof o!="undefined"&&o||typeof self!="undefined"&&self||typeof l!="undefined"&&l,d={searchParams:"URLSearchParams"in l,iterable:"Symbol"in l&&"iterator"in Symbol,blob:"FileReader"in l&&"Blob"in l&&function(){try{return new Blob,!0}catch(S){return!1}}(),formData:"FormData"in l,arrayBuffer:"ArrayBuffer"in l};function p(S){return S&&DataView.prototype.isPrototypeOf(S)}if(d.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(S){return S&&h.indexOf(Object.prototype.toString.call(S))>-1};function m(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function w(S){return typeof S!="string"&&(S=String(S)),S}function A(S){var G={next:function(){var e1=S.shift();return{done:e1===void 0,value:e1}}};return d.iterable&&(G[Symbol.iterator]=function(){return G}),G}function x(S){this.map={},S instanceof x?S.forEach(function(G,e1){this.append(e1,G)},this):Array.isArray(S)?S.forEach(function(G){this.append(G[0],G[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(G){this.append(G,S[G])},this)}x.prototype.append=function(S,G){S=m(S),G=w(G);var e1=this.map[S];this.map[S]=e1?e1+", "+G:G},x.prototype.delete=function(S){delete this.map[m(S)]},x.prototype.get=function(S){return S=m(S),this.has(S)?this.map[S]:null},x.prototype.has=function(S){return this.map.hasOwnProperty(m(S))},x.prototype.set=function(S,G){this.map[m(S)]=w(G)},x.prototype.forEach=function(S,G){for(var e1 in this.map)this.map.hasOwnProperty(e1)&&S.call(G,this.map[e1],e1,this)},x.prototype.keys=function(){var S=[];return this.forEach(function(G,e1){S.push(e1)}),A(S)},x.prototype.values=function(){var S=[];return this.forEach(function(G){S.push(G)}),A(S)},x.prototype.entries=function(){var S=[];return this.forEach(function(G,e1){S.push([e1,G])}),A(S)},d.iterable&&(x.prototype[Symbol.iterator]=x.prototype.entries);function I(S){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}function C(S){return new Promise(function(G,e1){S.onload=function(){G(S.result)},S.onerror=function(){e1(S.error)}})}function F(S){var G=new FileReader,e1=C(G);return G.readAsArrayBuffer(S),e1}function T(S){var G=new FileReader,e1=C(G);return G.readAsText(S),e1}function P(S){for(var G=new Uint8Array(S),e1=new Array(G.length),f1=0;f1<G.length;f1++)e1[f1]=String.fromCharCode(G[f1]);return e1.join("")}function H(S){if(S.slice)return S.slice(0);var G=new Uint8Array(S.byteLength);return G.set(new Uint8Array(S)),G.buffer}function J(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:d.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:d.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:d.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():d.arrayBuffer&&d.blob&&p(S)?(this._bodyArrayBuffer=H(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||u(S))?this._bodyArrayBuffer=H(S):this._bodyText=S=Object.prototype.toString.call(S):this._bodyText="",this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):d.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d.blob&&(this.blob=function(){var S=I(this);if(S)return S;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var S=I(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(F)}),this.text=function(){var S=I(this);if(S)return S;if(this._bodyBlob)return T(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(Q)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function W(S){var G=S.toUpperCase();return L.indexOf(G)>-1?G:S}function z(S,G){if(!(this instanceof z))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');G=G||{};var e1=G.body;if(S instanceof z){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,G.headers||(this.headers=new x(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!e1&&S._bodyInit!=null&&(e1=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=G.credentials||this.credentials||"same-origin",(G.headers||!this.headers)&&(this.headers=new x(G.headers)),this.method=W(G.method||this.method||"GET"),this.mode=G.mode||this.mode||null,this.signal=G.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&e1)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(e1),(this.method==="GET"||this.method==="HEAD")&&(G.cache==="no-store"||G.cache==="no-cache")){var f1=/([?&])_=[^&]*/;if(f1.test(this.url))this.url=this.url.replace(f1,"$1_="+new Date().getTime());else{var l1=/\?/;this.url+=(l1.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function Q(S){var G=new FormData;return S.trim().split("&").forEach(function(e1){if(e1){var f1=e1.split("="),l1=f1.shift().replace(/\+/g," "),c1=f1.join("=").replace(/\+/g," ");G.append(decodeURIComponent(l1),decodeURIComponent(c1))}}),G}function U(S){var G=new x,e1=S.replace(/\r?\n[\t ]+/g," ");return e1.split("\r").map(function(f1){return f1.indexOf(` `)===0?f1.substr(1,f1.length):f1}).forEach(function(f1){var l1=f1.split(":"),c1=l1.shift().trim();if(c1){var t1=l1.join(":").trim();G.append(c1,t1)}}),G}J.call(z.prototype);function V(S,G){if(!(this instanceof V))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');G||(G={}),this.type="default",this.status=G.status===void 0?200:G.status,this.ok=this.status>=200&&this.status<300,this.statusText=G.statusText===void 0?"":""+G.statusText,this.headers=new x(G.headers),this.url=G.url||"",this._initBody(S)}J.call(V.prototype),V.prototype.clone=function(){return new V(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new x(this.headers),url:this.url})},V.error=function(){var S=new V(null,{status:0,statusText:""});return S.type="error",S};var _=[301,302,303,307,308];V.redirect=function(S,G){if(_.indexOf(G)===-1)throw new RangeError("Invalid status code");return new V(null,{status:G,headers:{location:S}})},c.DOMException=l.DOMException;try{new c.DOMException}catch(S){c.DOMException=function(G,e1){this.message=G,this.name=e1;var f1=Error(G);this.stack=f1.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function r1(S,G){return new Promise(function(e1,f1){var l1=new z(S,G);if(l1.signal&&l1.signal.aborted)return f1(new c.DOMException("Aborted","AbortError"));var c1=new XMLHttpRequest;function t1(){c1.abort()}c1.onload=function(){var B1={status:c1.status,statusText:c1.statusText,headers:U(c1.getAllResponseHeaders()||"")};B1.url="responseURL"in c1?c1.responseURL:B1.headers.get("X-Request-URL");var k1="response"in c1?c1.response:c1.responseText;setTimeout(function(){e1(new V(k1,B1))},0)},c1.onerror=function(){setTimeout(function(){f1(new TypeError("Network request failed"))},0)},c1.ontimeout=function(){setTimeout(function(){f1(new TypeError("Network request failed"))},0)},c1.onabort=function(){setTimeout(function(){f1(new c.DOMException("Aborted","AbortError"))},0)};function O1(B1){try{return B1===""&&l.location.href?l.location.href:B1}catch(k1){return B1}}c1.open(l1.method,O1(l1.url),!0),l1.credentials==="include"?c1.withCredentials=!0:l1.credentials==="omit"&&(c1.withCredentials=!1),"responseType"in c1&&(d.blob?c1.responseType="blob":d.arrayBuffer&&l1.headers.get("Content-Type")&&l1.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(c1.responseType="arraybuffer")),G&&typeof G.headers=="object"&&!(G.headers instanceof x)?Object.getOwnPropertyNames(G.headers).forEach(function(B1){c1.setRequestHeader(B1,w(G.headers[B1]))}):l1.headers.forEach(function(B1,k1){c1.setRequestHeader(k1,B1)}),l1.signal&&(l1.signal.addEventListener("abort",t1),c1.onreadystatechange=function(){c1.readyState===4&&l1.signal.removeEventListener("abort",t1)}),c1.send(typeof l1._bodyInit=="undefined"?null:l1._bodyInit)})}return r1.polyfill=!0,l.fetch||(l.fetch=r1,l.Headers=x,l.Request=z,l.Response=V),c.Headers=x,c.Request=z,c.Response=V,c.fetch=r1,c}({})})(hc);hc.fetch.ponyfill=!0;delete hc.fetch.polyfill;var Bs=vc.fetch?vc:hc;un=Bs.fetch;un.default=Bs.fetch;un.fetch=Bs.fetch;un.Headers=Bs.Headers;un.Request=Bs.Request;un.Response=Bs.Response;gd.exports=un});function O0(o){return new Promise((s,c)=>{o.oncomplete=o.onsuccess=()=>s(o.result),o.onabort=o.onerror=()=>c(o.error)})}function Yu(o,s){let c=indexedDB.open(o);c.onupgradeneeded=()=>c.result.createObjectStore(s);let l=O0(c);return(d,p)=>l.then(h=>p(h.transaction(s,d).objectStore(s)))}var S0;function y4(){return S0||(S0=Yu("keyval-store","keyval")),S0}function k4(o,s=y4()){return s("readonly",c=>O0(c.get(o)))}function I4(o,s,c=y4()){return c("readwrite",l=>(l.put(s,o),O0(l.transaction)))}var ls=crypto,Jo=o=>o instanceof CryptoKey;var Gi=new TextEncoder,po=new TextDecoder,Z6=w4(2,32);function B4(...o){let s=o.reduce((d,{length:p})=>d+p,0),c=new Uint8Array(s),l=0;for(let d of o)c.set(d,l),l+=d.length;return c}var qu=o=>{let s=o;typeof s=="string"&&(s=Gi.encode(s));let c=32768,l=[];for(let d=0;d<s.length;d+=c)l.push(String.fromCharCode.apply(null,s.subarray(d,d+c)));return btoa(l.join(""))},Ko=o=>qu(o).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Vu=o=>{let s=atob(o),c=new Uint8Array(s.length);for(let l=0;l<s.length;l++)c[l]=s.charCodeAt(l);return c},Wo=o=>{let s=o;s instanceof Uint8Array&&(s=po.decode(s)),s=s.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Vu(s)}catch(c){throw new TypeError("The input to be decoded is not correctly encoded.")}};var Va=class extends Error{constructor(s,c){var l;super(s,c),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(l=Error.captureStackTrace)==null||l.call(Error,this,this.constructor)}};Va.code="ERR_JOSE_GENERIC";var R0=class extends Va{constructor(s,c,l="unspecified",d="unspecified"){super(s,{cause:{claim:l,reason:d,payload:c}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=l,this.reason=d,this.payload=c}};R0.code="ERR_JWT_CLAIM_VALIDATION_FAILED";var N0=class extends Va{constructor(s,c,l="unspecified",d="unspecified"){super(s,{cause:{claim:l,reason:d,payload:c}}),this.code="ERR_JWT_EXPIRED",this.claim=l,this.reason=d,this.payload=c}};N0.code="ERR_JWT_EXPIRED";var F0=class extends Va{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}};F0.code="ERR_JOSE_ALG_NOT_ALLOWED";var _2=class extends Va{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}};_2.code="ERR_JOSE_NOT_SUPPORTED";var T0=class extends Va{constructor(s="decryption operation failed",c){super(s,c),this.code="ERR_JWE_DECRYPTION_FAILED"}};T0.code="ERR_JWE_DECRYPTION_FAILED";var D0=class extends Va{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}};D0.code="ERR_JWE_INVALID";var Hi=class extends Va{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}};Hi.code="ERR_JWS_INVALID";var vo=class extends Va{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}};vo.code="ERR_JWT_INVALID";var P0=class extends Va{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}};P0.code="ERR_JWK_INVALID";var Q0=class extends Va{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}};Q0.code="ERR_JWKS_INVALID";var U0=class extends Va{constructor(s="no applicable key found in the JSON Web Key Set",c){super(s,c),this.code="ERR_JWKS_NO_MATCHING_KEY"}};U0.code="ERR_JWKS_NO_MATCHING_KEY";var G0=class extends Va{constructor(s="multiple matching keys found in the JSON Web Key Set",c){super(s,c),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}};G0.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";var H0=class extends Va{constructor(s="request timed out",c){super(s,c),this.code="ERR_JWKS_TIMEOUT"}};H0.code="ERR_JWKS_TIMEOUT";var z0=class extends Va{constructor(s="signature verification failed",c){super(s,c),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}};z0.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function zi(o,s="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${s} must be ${o}`)}function Xo(o,s){return o.name===s}function Y0(o){return parseInt(o.name.slice(4),10)}function $u(o){switch(o){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function Lu(o,s){if(s.length&&!s.some(c=>o.usages.includes(c))){let c="CryptoKey does not support this operation, its usages must include ";if(s.length>2){let l=s.pop();c+=`one of ${s.join(", ")}, or ${l}.`}else s.length===2?c+=`one of ${s[0]} or ${s[1]}.`:c+=`${s[0]}.`;throw new TypeError(c)}}function E4(o,s,...c){switch(s){case"HS256":case"HS384":case"HS512":{if(!Xo(o.algorithm,"HMAC"))throw zi("HMAC");let l=parseInt(s.slice(2),10);if(Y0(o.algorithm.hash)!==l)throw zi(`SHA-${l}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Xo(o.algorithm,"RSASSA-PKCS1-v1_5"))throw zi("RSASSA-PKCS1-v1_5");let l=parseInt(s.slice(2),10);if(Y0(o.algorithm.hash)!==l)throw zi(`SHA-${l}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Xo(o.algorithm,"RSA-PSS"))throw zi("RSA-PSS");let l=parseInt(s.slice(2),10);if(Y0(o.algorithm.hash)!==l)throw zi(`SHA-${l}`,"algorithm.hash");break}case"EdDSA":{if(o.algorithm.name!=="Ed25519"&&o.algorithm.name!=="Ed448")throw zi("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!Xo(o.algorithm,"ECDSA"))throw zi("ECDSA");let l=$u(s);if(o.algorithm.namedCurve!==l)throw zi(l,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}Lu(o,c)}function M4(o,s,...c){var l;if(c=c.filter(Boolean),c.length>2){let d=c.pop();o+=`one of type ${c.join(", ")}, or ${d}.`}else c.length===2?o+=`one of type ${c[0]} or ${c[1]}.`:o+=`of type ${c[0]}.`;return s==null?o+=` Received ${s}`:typeof s=="function"&&s.name?o+=` Received function ${s.name}`:typeof s=="object"&&s!=null&&(l=s.constructor)!=null&&l.name&&(o+=` Received an instance of ${s.constructor.name}`),o}var q0=(o,...s)=>M4("Key must be ",o,...s);function V0(o,s,...c){return M4(`Key for the ${o} algorithm must be `,s,...c)}var $0=o=>Jo(o)?!0:(o==null?void 0:o[Symbol.toStringTag])==="KeyObject",ds=["CryptoKey"];var Ju=(...o)=>{let s=o.filter(Boolean);if(s.length===0||s.length===1)return!0;let c;for(let l of s){let d=Object.keys(l);if(!c||c.size===0){c=new Set(d);continue}for(let p of d){if(c.has(p))return!1;c.add(p)}}return!0},j4=Ju;function Ku(o){return typeof o=="object"&&o!==null}function ho(o){if(!Ku(o)||Object.prototype.toString.call(o)!=="[object Object]")return!1;if(Object.getPrototypeOf(o)===null)return!0;let s=o;for(;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(o)===s}var C4=(o,s)=>{if(o.startsWith("RS")||o.startsWith("PS")){let{modulusLength:c}=s.algorithm;if(typeof c!="number"||c<2048)throw new TypeError(`${o} requires key modulusLength to be 2048 bits or larger`)}};function Cn(o){return ho(o)&&typeof o.kty=="string"}function S4(o){return o.kty!=="oct"&&typeof o.d=="string"}function O4(o){return o.kty!=="oct"&&typeof o.d=="undefined"}function R4(o){return Cn(o)&&o.kty==="oct"&&typeof o.k=="string"}function Xu(o){let s,c;switch(o.kty){case"RSA":{switch(o.alg){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${o.alg.slice(-3)}`},c=o.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.alg.slice(-3)}`},c=o.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(o.alg.slice(-3),10)||1}`},c=o.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new _2('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(o.alg){case"ES256":s={name:"ECDSA",namedCurve:"P-256"},c=o.d?["sign"]:["verify"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},c=o.d?["sign"]:["verify"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},c=o.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":s={name:"ECDH",namedCurve:o.crv},c=o.d?["deriveBits"]:[];break;default:throw new _2('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(o.alg){case"EdDSA":s={name:o.crv},c=o.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":s={name:o.crv},c=o.d?["deriveBits"]:[];break;default:throw new _2('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new _2('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:s,keyUsages:c}}var Zu=o=>ke(void 0,null,function*(){var p,h;if(!o.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:s,keyUsages:c}=Xu(o),l=[s,(p=o.ext)!=null?p:!1,(h=o.key_ops)!=null?h:c],d=a1({},o);return delete d.alg,delete d.use,ls.subtle.importKey("jwk",d,...l)}),N4=Zu;var F4=o=>Wo(o),ps,vs,T4=o=>(o==null?void 0:o[Symbol.toStringTag])==="KeyObject",Zo=(o,s,c,l,d=!1)=>ke(void 0,null,function*(){let p=o.get(s);if(p!=null&&p[l])return p[l];let h=yield N4(pe(a1({},c),{alg:l}));return d&&Object.freeze(s),p?p[l]=h:o.set(s,{[l]:h}),h}),_u=(o,s)=>{if(T4(o)){let c=o.export({format:"jwk"});return delete c.d,delete c.dp,delete c.dq,delete c.p,delete c.q,delete c.qi,c.k?F4(c.k):(vs||(vs=new WeakMap),Zo(vs,o,c,s))}return Cn(o)?o.k?Wo(o.k):(vs||(vs=new WeakMap),Zo(vs,o,o,s,!0)):o},em=(o,s)=>{if(T4(o)){let c=o.export({format:"jwk"});return c.k?F4(c.k):(ps||(ps=new WeakMap),Zo(ps,o,c,s))}return Cn(o)?o.k?Wo(o.k):(ps||(ps=new WeakMap),Zo(ps,o,o,s,!0)):o},L0={normalizePublicKey:_u,normalizePrivateKey:em};var hs=o=>o==null?void 0:o[Symbol.toStringTag],J0=(o,s,c)=>{var l,d;if(s.use!==void 0&&s.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(s.key_ops!==void 0&&((d=(l=s.key_ops).includes)==null?void 0:d.call(l,c))!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${c}`);if(s.alg!==void 0&&s.alg!==o)throw new TypeError(`Invalid key for this operation, when present its alg must be ${o}`);return!0},tm=(o,s,c,l)=>{if(!(s instanceof Uint8Array)){if(l&&Cn(s)){if(R4(s)&&J0(o,s,c))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!$0(s))throw new TypeError(V0(o,s,...ds,"Uint8Array",l?"JSON Web Key":null));if(s.type!=="secret")throw new TypeError(`${hs(s)} instances for symmetric algorithms must be of type "secret"`)}},rm=(o,s,c,l)=>{if(l&&Cn(s))switch(c){case"sign":if(S4(s)&&J0(o,s,c))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(O4(s)&&J0(o,s,c))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!$0(s))throw new TypeError(V0(o,s,...ds,l?"JSON Web Key":null));if(s.type==="secret")throw new TypeError(`${hs(s)} instances for asymmetric algorithms must not be of type "secret"`);if(c==="sign"&&s.type==="public")throw new TypeError(`${hs(s)} instances for asymmetric algorithm signing must be of type "private"`);if(c==="decrypt"&&s.type==="public")throw new TypeError(`${hs(s)} instances for asymmetric algorithm decryption must be of type "private"`);if(s.algorithm&&c==="verify"&&s.type==="private")throw new TypeError(`${hs(s)} instances for asymmetric algorithm verifying must be of type "public"`);if(s.algorithm&&c==="encrypt"&&s.type==="private")throw new TypeError(`${hs(s)} instances for asymmetric algorithm encryption must be of type "public"`)};function D4(o,s,c,l){s.startsWith("HS")||s==="dir"||s.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(s)?tm(s,c,l,o):rm(s,c,l,o)}var kb=D4.bind(void 0,!1),P4=D4.bind(void 0,!0);function am(o,s,c,l,d){if(d.crit!==void 0&&(l==null?void 0:l.crit)===void 0)throw new o('"crit" (Critical) Header Parameter MUST be integrity protected');if(!l||l.crit===void 0)return new Set;if(!Array.isArray(l.crit)||l.crit.length===0||l.crit.some(h=>typeof h!="string"||h.length===0))throw new o('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let p;c!==void 0?p=new Map([...Object.entries(c),...s.entries()]):p=s;for(let h of l.crit){if(!p.has(h))throw new _2(`Extension Header Parameter "${h}" is not recognized`);if(d[h]===void 0)throw new o(`Extension Header Parameter "${h}" is missing`);if(p.get(h)&&l[h]===void 0)throw new o(`Extension Header Parameter "${h}" MUST be integrity protected`)}return new Set(l.crit)}var Q4=am;function K0(o,s){let c=`SHA-${o.slice(-3)}`;switch(o){case"HS256":case"HS384":case"HS512":return{hash:c,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:c,name:"RSA-PSS",saltLength:o.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:c,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:c,name:"ECDSA",namedCurve:s.namedCurve};case"EdDSA":return{name:s.name};default:throw new _2(`alg ${o} is not supported either by JOSE or your javascript runtime`)}}function W0(o,s,c){return ke(this,null,function*(){if(c==="sign"&&(s=yield L0.normalizePrivateKey(s,o)),c==="verify"&&(s=yield L0.normalizePublicKey(s,o)),Jo(s))return E4(s,o,c),s;if(s instanceof Uint8Array){if(!o.startsWith("HS"))throw new TypeError(q0(s,...ds));return ls.subtle.importKey("raw",s,{hash:`SHA-${o.slice(-3)}`,name:"HMAC"},!1,[c])}throw new TypeError(q0(s,...ds,"Uint8Array","JSON Web Key"))})}var ln=o=>Math.floor(o.getTime()/1e3);var im=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,_o=o=>{let s=im.exec(o);if(!s||s[4]&&s[1])throw new TypeError("Invalid time period format");let c=parseFloat(s[2]),l=s[3].toLowerCase(),d;switch(l){case"sec":case"secs":case"second":case"seconds":case"s":d=Math.round(c);break;case"minute":case"minutes":case"min":case"mins":case"m":d=Math.round(c*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":d=Math.round(c*3600);break;case"day":case"days":case"d":d=Math.round(c*86400);break;case"week":case"weeks":case"w":d=Math.round(c*604800);break;default:d=Math.round(c*31557600);break}return s[1]==="-"||s[4]==="ago"?-d:d};var nm=(o,s,c)=>ke(void 0,null,function*(){let l=yield W0(o,s,"sign");C4(o,l);let d=yield ls.subtle.sign(K0(o,l.algorithm),l,c);return new Uint8Array(d)}),U4=nm;var ec=class{constructor(s){if(!(s instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=s}setProtectedHeader(s){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=s,this}setUnprotectedHeader(s){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=s,this}sign(s,c){return ke(this,null,function*(){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Hi("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!j4(this._protectedHeader,this._unprotectedHeader))throw new Hi("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let l=a1(a1({},this._protectedHeader),this._unprotectedHeader),d=Q4(Hi,new Map([["b64",!0]]),c==null?void 0:c.crit,this._protectedHeader,l),p=!0;if(d.has("b64")&&(p=this._protectedHeader.b64,typeof p!="boolean"))throw new Hi('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:h}=l;if(typeof h!="string"||!h)throw new Hi('JWS "alg" (Algorithm) Header Parameter missing or invalid');P4(h,s,"sign");let u=this._payload;p&&(u=Gi.encode(Ko(u)));let m;this._protectedHeader?m=Gi.encode(Ko(JSON.stringify(this._protectedHeader))):m=Gi.encode("");let w=B4(m,Gi.encode("."),u),A=yield U4(h,s,w),x={signature:Ko(A),payload:""};return p&&(x.payload=po.decode(u)),this._unprotectedHeader&&(x.header=this._unprotectedHeader),this._protectedHeader&&(x.protected=po.decode(m)),x})}};var tc=class{constructor(s){this._flattened=new ec(s)}setProtectedHeader(s){return this._flattened.setProtectedHeader(s),this}sign(s,c){return ke(this,null,function*(){let l=yield this._flattened.sign(s,c);if(l.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${l.protected}.${l.payload}.${l.signature}`})}};function Sn(o,s){if(!Number.isFinite(s))throw new TypeError(`Invalid ${o} input`);return s}var rc=class{constructor(s={}){if(!ho(s))throw new TypeError("JWT Claims Set MUST be an object");this._payload=s}setIssuer(s){return this._payload=pe(a1({},this._payload),{iss:s}),this}setSubject(s){return this._payload=pe(a1({},this._payload),{sub:s}),this}setAudience(s){return this._payload=pe(a1({},this._payload),{aud:s}),this}setJti(s){return this._payload=pe(a1({},this._payload),{jti:s}),this}setNotBefore(s){return typeof s=="number"?this._payload=pe(a1({},this._payload),{nbf:Sn("setNotBefore",s)}):s instanceof Date?this._payload=pe(a1({},this._payload),{nbf:Sn("setNotBefore",ln(s))}):this._payload=pe(a1({},this._payload),{nbf:ln(new Date)+_o(s)}),this}setExpirationTime(s){return typeof s=="number"?this._payload=pe(a1({},this._payload),{exp:Sn("setExpirationTime",s)}):s instanceof Date?this._payload=pe(a1({},this._payload),{exp:Sn("setExpirationTime",ln(s))}):this._payload=pe(a1({},this._payload),{exp:ln(new Date)+_o(s)}),this}setIssuedAt(s){return typeof s=="undefined"?this._payload=pe(a1({},this._payload),{iat:ln(new Date)}):s instanceof Date?this._payload=pe(a1({},this._payload),{iat:Sn("setIssuedAt",ln(s))}):typeof s=="string"?this._payload=pe(a1({},this._payload),{iat:Sn("setIssuedAt",ln(new Date)+_o(s))}):this._payload=pe(a1({},this._payload),{iat:Sn("setIssuedAt",s)}),this}};var uo=class extends rc{setProtectedHeader(s){return this._protectedHeader=s,this}sign(s,c){return ke(this,null,function*(){var d;let l=new tc(Gi.encode(JSON.stringify(this._payload)));if(l.setProtectedHeader(this._protectedHeader),Array.isArray((d=this._protectedHeader)==null?void 0:d.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new vo("JWTs MUST NOT use unencoded payload");return l.sign(s,c)})}};var cr;(function(o){o.assertEqual=d=>d;function s(d){}o.assertIs=s;function c(d){throw new Error}o.assertNever=c,o.arrayToEnum=d=>{let p={};for(let h of d)p[h]=h;return p},o.getValidEnumValues=d=>{let p=o.objectKeys(d).filter(u=>typeof d[d[u]]!="number"),h={};for(let u of p)h[u]=d[u];return o.objectValues(h)},o.objectValues=d=>o.objectKeys(d).map(function(p){return d[p]}),o.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{let p=[];for(let h in d)Object.prototype.hasOwnProperty.call(d,h)&&p.push(h);return p},o.find=(d,p)=>{for(let h of d)if(p(h))return h},o.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&isFinite(d)&&Math.floor(d)===d;function l(d,p=" | "){return d.map(h=>typeof h=="string"?`'${h}'`:h).join(p)}o.joinValues=l,o.jsonStringifyReplacer=(d,p)=>typeof p=="bigint"?p.toString():p})(cr||(cr={}));var Z0;(function(o){o.mergeShapes=(s,c)=>a1(a1({},s),c)})(Z0||(Z0={}));var Ie=cr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dn=o=>{switch(typeof o){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return isNaN(o)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(o)?Ie.array:o===null?Ie.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?Ie.promise:typeof Map!="undefined"&&o instanceof Map?Ie.map:typeof Set!="undefined"&&o instanceof Set?Ie.set:typeof Date!="undefined"&&o instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},G1=cr.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"]),sm=o=>JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:"),z2=class o extends Error{constructor(s){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let c=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,c):this.__proto__=c,this.name="ZodError",this.issues=s}get errors(){return this.issues}format(s){let c=s||function(p){return p.message},l={_errors:[]},d=p=>{for(let h of p.issues)if(h.code==="invalid_union")h.unionErrors.map(d);else if(h.code==="invalid_return_type")d(h.returnTypeError);else if(h.code==="invalid_arguments")d(h.argumentsError);else if(h.path.length===0)l._errors.push(c(h));else{let u=l,m=0;for(;m<h.path.length;){let w=h.path[m];m===h.path.length-1?(u[w]=u[w]||{_errors:[]},u[w]._errors.push(c(h))):u[w]=u[w]||{_errors:[]},u=u[w],m++}}};return d(this),l}static assert(s){if(!(s instanceof o))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,cr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=c=>c.message){let c={},l=[];for(let d of this.issues)d.path.length>0?(c[d.path[0]]=c[d.path[0]]||[],c[d.path[0]].push(s(d))):l.push(s(d));return{formErrors:l,fieldErrors:c}}get formErrors(){return this.flatten()}};z2.create=o=>new z2(o);var bs=(o,s)=>{let c;switch(o.code){case G1.invalid_type:o.received===Ie.undefined?c="Required":c=`Expected ${o.expected}, received ${o.received}`;break;case G1.invalid_literal:c=`Invalid literal value, expected ${JSON.stringify(o.expected,cr.jsonStringifyReplacer)}`;break;case G1.unrecognized_keys:c=`Unrecognized key(s) in object: ${cr.joinValues(o.keys,", ")}`;break;case G1.invalid_union:c="Invalid input";break;case G1.invalid_union_discriminator:c=`Invalid discriminator value. Expected ${cr.joinValues(o.options)}`;break;case G1.invalid_enum_value:c=`Invalid enum value. Expected ${cr.joinValues(o.options)}, received '${o.received}'`;break;case G1.invalid_arguments:c="Invalid function arguments";break;case G1.invalid_return_type:c="Invalid function return type";break;case G1.invalid_date:c="Invalid date";break;case G1.invalid_string:typeof o.validation=="object"?"includes"in o.validation?(c=`Invalid input: must include "${o.validation.includes}"`,typeof o.validation.position=="number"&&(c=`${c} at one or more positions greater than or equal to ${o.validation.position}`)):"startsWith"in o.validation?c=`Invalid input: must start with "${o.validation.startsWith}"`:"endsWith"in o.validation?c=`Invalid input: must end with "${o.validation.endsWith}"`:cr.assertNever(o.validation):o.validation!=="regex"?c=`Invalid ${o.validation}`:c="Invalid";break;case G1.too_small:o.type==="array"?c=`Array must contain ${o.exact?"exactly":o.inclusive?"at least":"more than"} ${o.minimum} element(s)`:o.type==="string"?c=`String must contain ${o.exact?"exactly":o.inclusive?"at least":"over"} ${o.minimum} character(s)`:o.type==="number"?c=`Number must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${o.minimum}`:o.type==="date"?c=`Date must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(o.minimum))}`:c="Invalid input";break;case G1.too_big:o.type==="array"?c=`Array must contain ${o.exact?"exactly":o.inclusive?"at most":"less than"} ${o.maximum} element(s)`:o.type==="string"?c=`String must contain ${o.exact?"exactly":o.inclusive?"at most":"under"} ${o.maximum} character(s)`:o.type==="number"?c=`Number must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="bigint"?c=`BigInt must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="date"?c=`Date must be ${o.exact?"exactly":o.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(o.maximum))}`:c="Invalid input";break;case G1.custom:c="Invalid input";break;case G1.invalid_intersection_types:c="Intersection results could not be merged";break;case G1.not_multiple_of:c=`Number must be a multiple of ${o.multipleOf}`;break;case G1.not_finite:c="Number must be finite";break;default:c=s.defaultError,cr.assertNever(o)}return{message:c}},z4=bs;function om(o){z4=o}function ac(){return z4}var ic=o=>{let{data:s,path:c,errorMaps:l,issueData:d}=o,p=[...c,...d.path||[]],h=pe(a1({},d),{path:p});if(d.message!==void 0)return pe(a1({},d),{path:p,message:d.message});let u="",m=l.filter(w=>!!w).slice().reverse();for(let w of m)u=w(h,{data:s,defaultError:u}).message;return pe(a1({},d),{path:p,message:u})},cm=[];function he(o,s){let c=ac(),l=ic({issueData:s,data:o.data,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,c,c===bs?void 0:bs].filter(d=>!!d)});o.common.issues.push(l)}var s2=class o{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,c){let l=[];for(let d of c){if(d.status==="aborted")return ut;d.status==="dirty"&&s.dirty(),l.push(d.value)}return{status:s.value,value:l}}static mergeObjectAsync(s,c){return ke(this,null,function*(){let l=[];for(let d of c){let p=yield d.key,h=yield d.value;l.push({key:p,value:h})}return o.mergeObjectSync(s,l)})}static mergeObjectSync(s,c){let l={};for(let d of c){let{key:p,value:h}=d;if(p.status==="aborted"||h.status==="aborted")return ut;p.status==="dirty"&&s.dirty(),h.status==="dirty"&&s.dirty(),p.value!=="__proto__"&&(typeof h.value!="undefined"||d.alwaysSet)&&(l[p.value]=h.value)}return{status:s.value,value:l}}},ut=Object.freeze({status:"aborted"}),ms=o=>({status:"dirty",value:o}),b2=o=>({status:"valid",value:o}),_0=o=>o.status==="aborted",e3=o=>o.status==="dirty",go=o=>o.status==="valid",Ao=o=>typeof Promise!="undefined"&&o instanceof Promise;function nc(o,s,c,l){if(c==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof s=="function"?o!==s||!l:!s.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?l:c==="a"?l.call(o):l?l.value:s.get(o)}function Y4(o,s,c,l,d){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof s=="function"?o!==s||!d:!s.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?d.call(o,c):d?d.value=c:s.set(o,c),c}var Ke;(function(o){o.errToObj=s=>typeof s=="string"?{message:s}:s||{},o.toString=s=>typeof s=="string"?s:s==null?void 0:s.message})(Ke||(Ke={}));var mo,bo,ti=class{constructor(s,c,l,d){this._cachedPath=[],this.parent=s,this.data=c,this._path=l,this._key=d}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}},G4=(o,s)=>{if(go(s))return{success:!0,data:s.value};if(!o.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let c=new z2(o.common.issues);return this._error=c,this._error}}};function Ct(o){if(!o)return{};let{errorMap:s,invalid_type_error:c,required_error:l,description:d}=o;if(s&&(c||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return s?{errorMap:s,description:d}:{errorMap:(h,u)=>{var m,w;let{message:A}=o;return h.code==="invalid_enum_value"?{message:A!=null?A:u.defaultError}:typeof u.data=="undefined"?{message:(m=A!=null?A:l)!==null&&m!==void 0?m:u.defaultError}:h.code!=="invalid_type"?{message:u.defaultError}:{message:(w=A!=null?A:c)!==null&&w!==void 0?w:u.defaultError}},description:d}}var St=class{constructor(s){this.spa=this.safeParseAsync,this._def=s,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(s){return dn(s.data)}_getOrReturnCtx(s,c){return c||{common:s.parent.common,data:s.data,parsedType:dn(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}_processInputParams(s){return{status:new s2,ctx:{common:s.parent.common,data:s.data,parsedType:dn(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}}_parseSync(s){let c=this._parse(s);if(Ao(c))throw new Error("Synchronous parse encountered promise.");return c}_parseAsync(s){let c=this._parse(s);return Promise.resolve(c)}parse(s,c){let l=this.safeParse(s,c);if(l.success)return l.data;throw l.error}safeParse(s,c){var l;let d={common:{issues:[],async:(l=c==null?void 0:c.async)!==null&&l!==void 0?l:!1,contextualErrorMap:c==null?void 0:c.errorMap},path:(c==null?void 0:c.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:dn(s)},p=this._parseSync({data:s,path:d.path,parent:d});return G4(d,p)}parseAsync(s,c){return ke(this,null,function*(){let l=yield this.safeParseAsync(s,c);if(l.success)return l.data;throw l.error})}safeParseAsync(s,c){return ke(this,null,function*(){let l={common:{issues:[],contextualErrorMap:c==null?void 0:c.errorMap,async:!0},path:(c==null?void 0:c.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:dn(s)},d=this._parse({data:s,path:l.path,parent:l}),p=yield Ao(d)?d:Promise.resolve(d);return G4(l,p)})}refine(s,c){let l=d=>typeof c=="string"||typeof c=="undefined"?{message:c}:typeof c=="function"?c(d):c;return this._refinement((d,p)=>{let h=s(d),u=()=>p.addIssue(a1({code:G1.custom},l(d)));return typeof Promise!="undefined"&&h instanceof Promise?h.then(m=>m?!0:(u(),!1)):h?!0:(u(),!1)})}refinement(s,c){return this._refinement((l,d)=>s(l)?!0:(d.addIssue(typeof c=="function"?c(l,d):c),!1))}_refinement(s){return new Y2({schema:this,typeName:vt.ZodEffects,effect:{type:"refinement",refinement:s}})}superRefine(s){return this._refinement(s)}optional(){return ei.create(this,this._def)}nullable(){return Ii.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vi.create(this,this._def)}promise(){return hn.create(this,this._def)}or(s){return Pn.create([this,s],this._def)}and(s){return Qn.create(this,s,this._def)}transform(s){return new Y2(pe(a1({},Ct(this._def)),{schema:this,typeName:vt.ZodEffects,effect:{type:"transform",transform:s}}))}default(s){let c=typeof s=="function"?s:()=>s;return new Yn(pe(a1({},Ct(this._def)),{innerType:this,defaultValue:c,typeName:vt.ZodDefault}))}brand(){return new wo(a1({typeName:vt.ZodBranded,type:this},Ct(this._def)))}catch(s){let c=typeof s=="function"?s:()=>s;return new qn(pe(a1({},Ct(this._def)),{innerType:this,catchValue:c,typeName:vt.ZodCatch}))}describe(s){let c=this.constructor;return new c(pe(a1({},this._def),{description:s}))}pipe(s){return xo.create(this,s)}readonly(){return Vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fm=/^c[^\s-]{8,}$/i,lm=/^[0-9a-z]+$/,dm=/^[0-9A-HJKMNP-TV-Z]{26}$/,pm=/^[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,vm=/^[a-z0-9_-]{21}$/i,hm=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,um=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",X0,bm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,gm=/^(([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})))$/,Am=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,q4="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wm=new RegExp(`^${q4}$`);function V4(o){let s="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return o.precision?s=`${s}\\.\\d{${o.precision}}`:o.precision==null&&(s=`${s}(\\.\\d+)?`),s}function xm(o){return new RegExp(`^${V4(o)}$`)}function $4(o){let s=`${q4}T${V4(o)}`,c=[];return c.push(o.local?"Z?":"Z"),o.offset&&c.push("([+-]\\d{2}:?\\d{2})"),s=`${s}(${c.join("|")})`,new RegExp(`^${s}$`)}function ym(o,s){return!!((s==="v4"||!s)&&bm.test(o)||(s==="v6"||!s)&&gm.test(o))}var pn=class o extends St{_parse(s){if(this._def.coerce&&(s.data=String(s.data)),this._getType(s)!==Ie.string){let p=this._getOrReturnCtx(s);return he(p,{code:G1.invalid_type,expected:Ie.string,received:p.parsedType}),ut}let l=new s2,d;for(let p of this._def.checks)if(p.kind==="min")s.data.length<p.value&&(d=this._getOrReturnCtx(s,d),he(d,{code:G1.too_small,minimum:p.value,type:"string",inclusive:!0,exact:!1,message:p.message}),l.dirty());else if(p.kind==="max")s.data.length>p.value&&(d=this._getOrReturnCtx(s,d),he(d,{code:G1.too_big,maximum:p.value,type:"string",inclusive:!0,exact:!1,message:p.message}),l.dirty());else if(p.kind==="length"){let h=s.data.length>p.value,u=s.data.length<p.value;(h||u)&&(d=this._getOrReturnCtx(s,d),h?he(d,{code:G1.too_big,maximum:p.value,type:"string",inclusive:!0,exact:!0,message:p.message}):u&&he(d,{code:G1.too_small,minimum:p.value,type:"string",inclusive:!0,exact:!0,message:p.message}),l.dirty())}else if(p.kind==="email")um.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"email",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="emoji")X0||(X0=new RegExp(mm,"u")),X0.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"emoji",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="uuid")pm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"uuid",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="nanoid")vm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"nanoid",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="cuid")fm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"cuid",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="cuid2")lm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"cuid2",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="ulid")dm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"ulid",code:G1.invalid_string,message:p.message}),l.dirty());else if(p.kind==="url")try{new URL(s.data)}catch(h){d=this._getOrReturnCtx(s,d),he(d,{validation:"url",code:G1.invalid_string,message:p.message}),l.dirty()}else p.kind==="regex"?(p.regex.lastIndex=0,p.regex.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"regex",code:G1.invalid_string,message:p.message}),l.dirty())):p.kind==="trim"?s.data=s.data.trim():p.kind==="includes"?s.data.includes(p.value,p.position)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:{includes:p.value,position:p.position},message:p.message}),l.dirty()):p.kind==="toLowerCase"?s.data=s.data.toLowerCase():p.kind==="toUpperCase"?s.data=s.data.toUpperCase():p.kind==="startsWith"?s.data.startsWith(p.value)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:{startsWith:p.value},message:p.message}),l.dirty()):p.kind==="endsWith"?s.data.endsWith(p.value)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:{endsWith:p.value},message:p.message}),l.dirty()):p.kind==="datetime"?$4(p).test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:"datetime",message:p.message}),l.dirty()):p.kind==="date"?wm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:"date",message:p.message}),l.dirty()):p.kind==="time"?xm(p).test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{code:G1.invalid_string,validation:"time",message:p.message}),l.dirty()):p.kind==="duration"?hm.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"duration",code:G1.invalid_string,message:p.message}),l.dirty()):p.kind==="ip"?ym(s.data,p.version)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"ip",code:G1.invalid_string,message:p.message}),l.dirty()):p.kind==="base64"?Am.test(s.data)||(d=this._getOrReturnCtx(s,d),he(d,{validation:"base64",code:G1.invalid_string,message:p.message}),l.dirty()):cr.assertNever(p);return{status:l.value,value:s.data}}_regex(s,c,l){return this.refinement(d=>s.test(d),a1({validation:c,code:G1.invalid_string},Ke.errToObj(l)))}_addCheck(s){return new o(pe(a1({},this._def),{checks:[...this._def.checks,s]}))}email(s){return this._addCheck(a1({kind:"email"},Ke.errToObj(s)))}url(s){return this._addCheck(a1({kind:"url"},Ke.errToObj(s)))}emoji(s){return this._addCheck(a1({kind:"emoji"},Ke.errToObj(s)))}uuid(s){return this._addCheck(a1({kind:"uuid"},Ke.errToObj(s)))}nanoid(s){return this._addCheck(a1({kind:"nanoid"},Ke.errToObj(s)))}cuid(s){return this._addCheck(a1({kind:"cuid"},Ke.errToObj(s)))}cuid2(s){return this._addCheck(a1({kind:"cuid2"},Ke.errToObj(s)))}ulid(s){return this._addCheck(a1({kind:"ulid"},Ke.errToObj(s)))}base64(s){return this._addCheck(a1({kind:"base64"},Ke.errToObj(s)))}ip(s){return this._addCheck(a1({kind:"ip"},Ke.errToObj(s)))}datetime(s){var c,l;return typeof s=="string"?t