@magiclabs.ai/magicbook-client 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(O,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(O=typeof globalThis<"u"?globalThis:O||self,Z(O["magicbook-client"]={}))})(this,function(O){"use strict";var oi=Object.defineProperty;var li=(O,Z,q)=>Z in O?oi(O,Z,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[Z]=q;var b=(O,Z,q)=>(li(O,typeof Z!="symbol"?Z+"":Z,q),q);function Z(t,e,s){const n=e.pop()||"",r=e.reduce((i,a)=>i[a]=i[a]||{},t);r[n]=s}function q(t,e){return Object.keys(e).map(s=>{typeof t[s]=="object"&&typeof e[s]=="object"?q(t[s],e[s]):t[s]=e[s]}),t}function Cs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function Ct(t){return Object.keys(t).map(e=>{const s=Cs(e);s.includes("_")&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Ct(t[s]))}),t}function As(t){return t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""))}function At(t){return Object.keys(t).map(e=>{const s=As(e);s!==e&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=At(t[s]))}),t}function Rt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Rs}=Object.prototype,{getPrototypeOf:Qe}=Object,Ce=(t=>e=>{const s=Rs.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),z=t=>(t=t.toLowerCase(),e=>Ce(e)===t),Ae=t=>e=>typeof e===t,{isArray:ie}=Array,fe=Ae("undefined");function Is(t){return t!==null&&!fe(t)&&t.constructor!==null&&!fe(t.constructor)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const It=z("ArrayBuffer");function js(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&It(t.buffer),e}const Zs=Ae("string"),L=Ae("function"),jt=Ae("number"),Re=t=>t!==null&&typeof t=="object",Ls=t=>t===!0||t===!1,Ie=t=>{if(Ce(t)!=="object")return!1;const e=Qe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ds=z("Date"),Ps=z("File"),Bs=z("Blob"),Ms=z("FileList"),Us=t=>Re(t)&&L(t.pipe),zs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ce(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},$s=z("URLSearchParams"),Vs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function he(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ie(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let o;for(n=0;n<a;n++)o=i[n],e.call(null,t[o],o,t)}}function Zt(t,e){e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Lt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Dt=t=>!fe(t)&&t!==Lt;function et(){const{caseless:t}=Dt(this)&&this||{},e={},s=(n,r)=>{const i=t&&Zt(e,r)||r;Ie(e[i])&&Ie(n)?e[i]=et(e[i],n):Ie(n)?e[i]=et({},n):ie(n)?e[i]=n.slice():e[i]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&he(arguments[n],s);return e}const Fs=(t,e,s,{allOwnKeys:n}={})=>(he(e,(r,i)=>{s&&L(r)?t[i]=Rt(r,s):t[i]=r},{allOwnKeys:n}),t),Hs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Js=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Ws=(t,e,s,n)=>{let r,i,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)a=r[i],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=s!==!1&&Qe(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},Ks=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},qs=t=>{if(!t)return null;if(ie(t))return t;let e=t.length;if(!jt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Gs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qe(Uint8Array)),Xs=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Ys=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},Qs=z("HTMLFormElement"),en=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),Pt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),tn=z("RegExp"),Bt=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};he(s,(r,i)=>{e(r,i,t)!==!1&&(n[i]=r)}),Object.defineProperties(t,n)},sn=t=>{Bt(t,(e,s)=>{if(L(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(L(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},nn=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ie(t)?n(t):n(String(t).split(e)),s},rn=()=>{},an=(t,e)=>(t=+t,Number.isFinite(t)?t:e),tt="abcdefghijklmnopqrstuvwxyz",Mt="0123456789",Ut={DIGIT:Mt,ALPHA:tt,ALPHA_DIGIT:tt+tt.toUpperCase()+Mt},on=(t=16,e=Ut.ALPHA_DIGIT)=>{let s="";const{length:n}=e;for(;t--;)s+=e[Math.random()*n|0];return s};function ln(t){return!!(t&&L(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const cn=t=>{const e=new Array(10),s=(n,r)=>{if(Re(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const i=ie(n)?[]:{};return he(n,(a,o)=>{const u=s(a,r+1);!fe(u)&&(i[o]=u)}),e[r]=void 0,i}}return n};return s(t,0)},un=z("AsyncFunction"),c={isArray:ie,isArrayBuffer:It,isBuffer:Is,isFormData:zs,isArrayBufferView:js,isString:Zs,isNumber:jt,isBoolean:Ls,isObject:Re,isPlainObject:Ie,isUndefined:fe,isDate:Ds,isFile:Ps,isBlob:Bs,isRegExp:tn,isFunction:L,isStream:Us,isURLSearchParams:$s,isTypedArray:Gs,isFileList:Ms,forEach:he,merge:et,extend:Fs,trim:Vs,stripBOM:Hs,inherits:Js,toFlatObject:Ws,kindOf:Ce,kindOfTest:z,endsWith:Ks,toArray:qs,forEachEntry:Xs,matchAll:Ys,isHTMLForm:Qs,hasOwnProperty:Pt,hasOwnProp:Pt,reduceDescriptors:Bt,freezeMethods:sn,toObjectSet:nn,toCamelCase:en,noop:rn,toFiniteNumber:an,findKey:Zt,global:Lt,isContextDefined:Dt,ALPHABET:Ut,generateString:on,isSpecCompliantForm:ln,toJSONObject:cn,isAsyncFn:un,isThenable:t=>t&&(Re(t)||L(t))&&L(t.then)&&L(t.catch)};function T(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r)}c.inherits(T,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const zt=T.prototype,$t={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{$t[t]={value:t}}),Object.defineProperties(T,$t),Object.defineProperty(zt,"isAxiosError",{value:!0}),T.from=(t,e,s,n,r,i)=>{const a=Object.create(zt);return c.toFlatObject(t,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),T.call(a,t.message,e,s,n,r),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const dn=null;function st(t){return c.isPlainObject(t)||c.isArray(t)}function Vt(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Ft(t,e,s){return t?t.concat(e).map(function(r,i){return r=Vt(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function fn(t){return c.isArray(t)&&!t.some(st)}const hn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function je(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,K){return!c.isUndefined(K[S])});const n=s.metaTokens,r=s.visitor||f,i=s.dots,a=s.indexes,u=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(c.isDate(g))return g.toISOString();if(!u&&c.isBlob(g))throw new T("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(g)||c.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,S,K){let U=g;if(g&&!K&&typeof g=="object"){if(c.endsWith(S,"{}"))S=n?S:S.slice(0,-2),g=JSON.stringify(g);else if(c.isArray(g)&&fn(g)||(c.isFileList(g)||c.endsWith(S,"[]"))&&(U=c.toArray(g)))return S=Vt(S),U.forEach(function(Ye,ai){!(c.isUndefined(Ye)||Ye===null)&&e.append(a===!0?Ft([S],ai,i):a===null?S:S+"[]",l(Ye))}),!1}return st(g)?!0:(e.append(Ft(K,S,i),l(g)),!1)}const _=[],A=Object.assign(hn,{defaultVisitor:f,convertValue:l,isVisitable:st});function N(g,S){if(!c.isUndefined(g)){if(_.indexOf(g)!==-1)throw Error("Circular reference detected in "+S.join("."));_.push(g),c.forEach(g,function(U,de){(!(c.isUndefined(U)||U===null)&&r.call(e,U,c.isString(de)?de.trim():de,S,A))===!0&&N(U,S?S.concat(de):[de])}),_.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return N(t),e}function Ht(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function nt(t,e){this._pairs=[],t&&je(t,this,e)}const Jt=nt.prototype;Jt.append=function(e,s){this._pairs.push([e,s])},Jt.toString=function(e){const s=e?function(n){return e.call(this,n,Ht)}:Ht;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function mn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wt(t,e,s){if(!e)return t;const n=s&&s.encode||mn,r=s&&s.serialize;let i;if(r?i=r(e,s):i=c.isURLSearchParams(e)?e.toString():new nt(e,s).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class pn{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Kt=pn,qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yn=typeof URLSearchParams<"u"?URLSearchParams:nt,gn=typeof FormData<"u"?FormData:null,vn=typeof Blob<"u"?Blob:null,_n=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),bn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),$={isBrowser:!0,classes:{URLSearchParams:yn,FormData:gn,Blob:vn},isStandardBrowserEnv:_n,isStandardBrowserWebWorkerEnv:bn,protocols:["http","https","file","blob","url","data"]};function wn(t,e){return je(t,new $.classes.URLSearchParams,Object.assign({visitor:function(s,n,r,i){return $.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function xn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kn(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function Gt(t){function e(s,n,r,i){let a=s[i++];const o=Number.isFinite(+a),u=i>=s.length;return a=!a&&c.isArray(r)?r.length:a,u?(c.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!c.isObject(r[a]))&&(r[a]=[]),e(s,n,r[a],i)&&c.isArray(r[a])&&(r[a]=kn(r[a])),!o)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(xn(n),r,s,0)}),s}return null}const Sn={"Content-Type":void 0};function Tn(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Ze={transitional:qt,adapter:["xhr","http"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r&&r?JSON.stringify(Gt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return wn(e,this.formSerializer).toString();if((o=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return je(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||r?(s.setContentType("application/json",!1),Tn(e)):e}],transformResponse:[function(e){const s=this.transitional||Ze.transitional,n=s&&s.forcedJSONParsing,r=this.responseType==="json";if(e&&c.isString(e)&&(n&&!this.responseType||r)){const a=!(s&&s.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?T.from(o,T.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(e){Ze.headers[e]={}}),c.forEach(["post","put","patch"],function(e){Ze.headers[e]=c.merge(Sn)});const rt=Ze,En=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),On=t=>{const e={};let s,n,r;return t&&t.split(`
2
- `).forEach(function(a){r=a.indexOf(":"),s=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!s||e[s]&&En[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Xt=Symbol("internals");function me(t){return t&&String(t).trim().toLowerCase()}function Le(t){return t===!1||t==null?t:c.isArray(t)?t.map(Le):String(t)}function Nn(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const Cn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function it(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function An(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function Rn(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,i,a){return this[n].call(this,e,r,i,a)},configurable:!0})})}class De{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(o,u,l){const f=me(u);if(!f)throw new Error("header name must be a non-empty string");const _=c.findKey(r,f);(!_||r[_]===void 0||l===!0||l===void 0&&r[_]!==!1)&&(r[_||u]=Le(o))}const a=(o,u)=>c.forEach(o,(l,f)=>i(l,f,u));return c.isPlainObject(e)||e instanceof this.constructor?a(e,s):c.isString(e)&&(e=e.trim())&&!Cn(e)?a(On(e),s):e!=null&&i(s,e,n),this}get(e,s){if(e=me(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return Nn(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=me(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||it(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(a){if(a=me(a),a){const o=c.findKey(n,a);o&&(!s||it(n,n[o],o,s))&&(delete n[o],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||it(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const a=c.findKey(n,i);if(a){s[a]=Le(r),delete s[i];return}const o=e?An(i):String(i).trim();o!==i&&delete s[i],s[o]=Le(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Xt]=this[Xt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=me(a);n[o]||(Rn(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(De.prototype),c.freezeMethods(De);const H=De;function at(t,e){const s=this||rt,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Yt(t){return!!(t&&t.__CANCEL__)}function pe(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(pe,T,{__CANCEL__:!0});function In(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const jn=$.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Zn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Ln(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Qt(t,e){return t&&!Zn(e)?Ln(t,e):e}const Dn=$.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Pn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Bn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let _=i,A=0;for(;_!==r;)A+=s[_++],_=_%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function es(t,e){let s=0;const n=Bn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:dn,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&($.isStandardBrowserEnv||$.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=Qt(t.baseURL,t.url);l.open(t.method.toUpperCase(),Wt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function _(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};In(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=_:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(_)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||qt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},$.isStandardBrowserEnv){const N=(t.withCredentials||Dn(f))&&t.xsrfCookieName&&jn.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",es(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",es(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new pe(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Pn(f);if(A&&$.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Mn={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new pe(null,t)}function ts(t){return ot(t),t.headers=H.from(t.headers),t.data=at.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mn.getAdapter(t.adapter||rt.adapter)(t).then(function(n){return ot(t),n.data=at.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return Yt(n)||(ot(t),n&&n.response&&(n.response.data=at.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const ss=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,_){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:_},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,_){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,_)}else return n(l,f,_)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,_){if(_ in e)return n(l,f);if(_ in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(ss(l),ss(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const _=u[f]||r,A=_(t[f],e[f],f);c.isUndefined(A)&&_!==o||(s[f]=A)}),s}const ns="1.4.0",lt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{lt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const rs={};lt.transitional=function(e,s,n){function r(i,a){return"[Axios v"+ns+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!rs[a]&&(rs[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Un(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ct={assertOptions:Un,validators:lt},G=ct.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Kt,response:new Kt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ct.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,_=0,A;if(!u){const g=[ts.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);_<A;)f=f.then(g[_++],g[_++]);return f}A=o.length;let N=s;for(_=0;_<A;){const g=o[_++],S=o[_++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=ts.call(this,N)}catch(g){return Promise.reject(g)}for(_=0,A=l.length;_<A;)f=f.then(l[_++],l[_++]);return f}getUri(e){e=ae(this.defaults,e);const s=Qt(e.baseURL,e.url);return Wt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new pe(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new ut(function(r){e=r}),cancel:e}}}const zn=ut;function $n(t){return function(s){return t.apply(null,s)}}function Vn(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});const Fn=dt;function is(t){const e=new Me(t),s=Rt(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return is(ae(t,r))},s}const R=is(rt);R.Axios=Me,R.CanceledError=pe,R.CancelToken=zn,R.isCancel=Yt,R.VERSION=ns,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=$n,R.isAxiosError=Vn,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>Gt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=Fn,R.default=R;const ft=R;function ht({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}function mt(t){return t.replaceAll(" ","").trim()}async function as({url:t,apiKey:e,options:s}){return await ft.get(mt(t),ht({apiKey:e,options:s}))}async function os({url:t,apiKey:e,options:s,payload:n={}}){return await ft.post(mt(t),n,ht({apiKey:e,options:s}))}async function Hn({url:t,apiKey:e,options:s,payload:n}){return await ft.put(mt(t),n,ht({apiKey:e,options:s}))}async function ye(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Jn({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=(await os({url:`${e}/v1/images/book/${s}`,apiKey:t,payload:n})).data;return _s.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));const m=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},h=E.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"]),Wn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}D.create=t=>new D(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let ls=ge;function Kn(t){ls=t}function Ue(){return ls}const ze=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},qn=[];function p(t,e){const s=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),cs=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),yt=t=>t.status==="aborted",gt=t=>t.status==="dirty",$e=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}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}}const us=(t,e)=>{if($e(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new D(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return us(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return us(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return ue.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new fs({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gn=/^c[^\s-]{8,}$/i,Xn=/^[a-z][a-z0-9]*$/,Yn=/[0-9A-HJKMNP-TV-Z]{26}/,Qn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,er=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((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}))\])|(\[IPv6:(([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})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,tr=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,sr=/^(((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}))$/,nr=/^(([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})))$/,rr=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ir(t,e){return!!((e==="v4"||!e)&&sr.test(t)||(e==="v6"||!e)&&nr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")er.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")tr.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Gn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?rr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?ir(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function ar(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ar(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class oe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}oe.create=t=>new oe({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:m.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return p(s,{code:h.invalid_type,expected:m.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(p(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(p(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(p(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function le(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(le(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:le(t.element)}):t instanceof W?W.create(le(t.unwrap())):t instanceof re?re.create(le(t.unwrap())):t instanceof F?F.create(t.items.map(e=>le(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:m.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],_=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,_,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const _=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const _=await f.key;l.push({key:_,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return le(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return ds(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new D(o.ctx.common.issues));return p(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new D(u));return p(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return p(s,{code:h.invalid_type,expected:m.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(p(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function vt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&n===m.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=vt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=vt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(yt(i)||yt(a))return w;const o=vt(i.value,a.value);return o.valid?((gt(i)||gt(a))&&s.dirty(),{status:s.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:h.invalid_type,expected:m.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:h.invalid_type,expected:m.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:h.invalid_type,expected:m.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:h.invalid_type,expected:m.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ce extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return p(s,{code:h.invalid_type,expected:m.function,received:s.parsedType}),w;function n(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof ue?j(async(...o)=>{const u=new D([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new D([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new D([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ce({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ce({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return p(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function ds(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=ds;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=E.objectValues(s);return p(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class ue extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return p(s,{code:h.invalid_type,expected:m.promise,received:s.parsedType}),w;const n=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{p(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$e(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>$e(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const or=Symbol("zod_brand");class fs extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),cs(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const hs=(t,e={},s)=>t?oe.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):oe.create(),lr={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const cr=(t,e={message:`Input not instance of ${t.name}`})=>hs(s=>s instanceof t,e),ms=P.create,ps=Y.create,ur=Ge.create,dr=Q.create,ys=ve.create,fr=te.create,hr=Fe.create,mr=_e.create,pr=be.create,yr=oe.create,gr=se.create,vr=J.create,_r=He.create,br=B.create,wr=C.create,xr=C.strictCreate,kr=we.create,Sr=We.create,Tr=xe.create,Er=F.create,Or=ke.create,Nr=Ke.create,Cr=ne.create,Ar=ce.create,Rr=Se.create,Ir=Te.create,jr=ee.create,Zr=Ee.create,Lr=ue.create,gs=M.create,Dr=W.create,Pr=re.create,Br=M.createWithPreprocess,Mr=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:Kn,getErrorMap:Ue,makeIssue:ze,EMPTY_PATH:qn,addIssueToContext:p,ParseStatus:I,INVALID:w,DIRTY:cs,OK:j,isAborted:yt,isDirty:gt,isValid:$e,isAsync:Ve,get util(){return E},get objectUtil(){return pt},ZodParsedType:m,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:oe,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ce,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:ue,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:or,ZodBranded:fs,ZodPipeline:Ne,custom:hs,Schema:k,ZodSchema:k,late:lr,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:yr,array:br,bigint:dr,boolean:ys,date:fr,discriminatedUnion:Sr,effect:gs,enum:jr,function:Ar,instanceof:cr,intersection:Tr,lazy:Rr,literal:Ir,map:Nr,nan:ur,nativeEnum:Zr,never:vr,null:pr,nullable:Pr,number:ps,object:wr,oboolean:()=>ys().optional(),onumber:()=>ps().optional(),optional:Dr,ostring:()=>ms().optional(),pipeline:Mr,preprocess:Br,promise:Lr,record:Or,set:Cr,strictObject:xr,string:ms,symbol:hr,transformer:gs,tuple:Er,undefined:mr,union:kr,unknown:gr,void:_r,NEVER:w,ZodIssueCode:h,quotelessJson:Wn,ZodError:D});class vs{constructor(e,s){b(this,"client");b(this,"parentId");b(this,"images");b(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Jn(this.client,this.parentId,new bs(e)),new Promise(s=>{s(this.length)})}}const _s=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class bs{constructor(e){b(this,"handle");b(this,"url");b(this,"width");b(this,"height");b(this,"orientation");b(this,"taken_at");b(this,"camera_make");b(this,"camera");b(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const ws=["new","ingesting","submitted","storyboarding","deduplication","image selection","designing","layouting","embellishing","polishing","ready","error"],_t=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],bt={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},wt=["8x8","10x10","12x12","8x11","11x8","11x14"],xt=["sc","hc","pl"],kt=["sp","sl","dl"],St=["low","medium","high"],Tt=["best","most","all"],Et=["none","few","lots"],Ot=["none","few","lots"],xs={state:"error",slug:"error",progress:100,message:"Design failed"},Ur="https://api.sfly-sls.magicbook.io",zr="wss://socket.sfly-sls.magicbook.io",$r=parseInt("30000")||3e4;class Vr{constructor(e){b(this,"occasion");b(this,"style");b(this,"book_size");b(this,"cover_type");b(this,"page_type");b(this,"image_density");b(this,"image_filtering_level");b(this,"embellishment_level");b(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const Fr=d.object({occasion:d.enum(_t),style:d.string(),book_size:d.enum(wt),cover_type:d.enum(xt),page_type:d.enum(kt),image_density:d.enum(St),image_filtering_level:d.enum(Tt),embellishment_level:d.enum(Et),text_sticker_level:d.enum(Ot)}),ks=d.object({id:d.string(),title:d.string(),design_request:Fr,state:d.enum(ws).optional(),guid:d.string().optional()});class Nt{constructor(e){b(this,"id");b(this,"title");b(this,"design_request");b(this,"state");b(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new Vr(e.design_request),this.state=e.state,this.guid=e.guid}}function Ss(t){const e=bt[t.style].slug,s=Ct(JSON.parse(JSON.stringify(t)));return s.style=e,new Nt({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Xe=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),Ts=d.object({high:Xe,medium:Xe,low:Xe}),Es=d.object({densities:Ts});async function Hr({apiKey:t,apiHost:e},s,n,r){return ye(async()=>{const i=await as({url:`${e}/v1/designoptions/booksize/${s}/imagecount/${n}
4
- /imagefilteringlevel/${r}`,apiKey:t}),a=At(i.data);return Es.parse(a)})}const Jr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Wr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Kr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),qr=d.object({key:d.string(),value:d.any()}),Gr=d.object({type:d.string(),imageAssignment:Jr.optional(),position:Wr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),Xr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Kr}),Yr=d.object({properties:d.array(qr)}),Qr=d.object({backgroundId:d.string().nullable(),assets:d.array(Gr).optional()}),ei=d.object({pageNum:d.number(),type:d.string(),canvas:Qr}),ti=d.object({pages:d.array(ei),photoStrip:d.array(Xr)}),si=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:ti,reportingData:Yr});async function ni({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await os({url:`${t}/v1/books`,apiKey:e,payload:s})).data;return ks.safeParse(n),new Nt(n)})}async function Os({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await Hn({url:`${t}/v1/books/${s.id}`,apiKey:e,payload:s})).data;return ks.safeParse(n),new Nt(n)})}async function ri({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await as({url:`${t}/v1/books/${s}/format/galleon`,apiKey:e})).data;return si.parse(n)})}class Ns{constructor(e,s,n){b(this,"client");b(this,"webSocket");b(this,"parentId");b(this,"title");b(this,"occasion");b(this,"style");b(this,"bookSize");b(this,"coverType");b(this,"pageType");b(this,"imageDensity");b(this,"imageFilteringLevel");b(this,"embellishmentLevel");b(this,"textStickerLevel");b(this,"images");b(this,"guid");this.parentId=e,this.client=s,this.webSocket=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||_t[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(bt)[0]),this.bookSize=(n==null?void 0:n.bookSize)||wt[0],this.coverType=(n==null?void 0:n.coverType)||xt[0],this.pageType=(n==null?void 0:n.pageType)||kt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||St[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||Tt[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Et[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Ot[0],this.images=new vs(this.client,this.parentId)}async getOptions(e){return await Hr(this.client,this.bookSize,e||this.images.length,this.imageFilteringLevel)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Os(this.client,Ss(this)),this}async setGuid(e){return this.guid=e,await Os(this.client,Ss(this)),this.guid}async getJSON(){return await ri(this.client,this.parentId)}async eventHandler(e,s="MagicBook.designRequestUpdated"){const n=new CustomEvent(s,{detail:e});window.dispatchEvent(n),["error","ready"].includes(e.slug)&&this.webSocket.close()}timeoutHandler(){return setTimeout(()=>{this.eventHandler(xs)},$r)}async getProgress(){let e="new",s;this.webSocket.onmessage=n=>{const r=JSON.parse(n.data);e!==r.slug&&(s&&clearTimeout(s),s=this.timeoutHandler(),this.eventHandler(r),e=r.slug)},this.webSocket.onclose=()=>clearTimeout(s)}}class ii{constructor(e,s=Ur,n=zr){b(this,"apiKey");b(this,"apiHost");b(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await ni(this);return new Ns(s.id,this,e)}}O.DesignRequest=Ns,O.ImageServer=bs,O.Images=vs,O.MagicBookClient=ii,O.bookSizes=wt,O.coverTypes=xt,O.designOptionsSchema=Es,O.embellishmentLevels=Et,O.imageDensities=St,O.imageDensityOptionSchema=Xe,O.imageDensityOptionsSchema=Ts,O.imageFilteringLevels=Tt,O.imageServerSchema=_s,O.occasions=_t,O.pageTypes=kt,O.states=ws,O.styles=bt,O.textStickerLevels=Ot,O.timeoutMessage=xs,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
1
+ (function(O,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(O=typeof globalThis<"u"?globalThis:O||self,Z(O["magicbook-client"]={}))})(this,function(O){"use strict";var ci=Object.defineProperty;var ui=(O,Z,q)=>Z in O?ci(O,Z,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[Z]=q;var _=(O,Z,q)=>(ui(O,typeof Z!="symbol"?Z+"":Z,q),q);function Z(t,e,s){const n=e.pop()||"",r=e.reduce((i,a)=>i[a]=i[a]||{},t);r[n]=s}function q(t,e){return Object.keys(e).map(s=>{typeof t[s]=="object"&&typeof e[s]=="object"?q(t[s],e[s]):t[s]=e[s]}),t}function As(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function Rt(t){return Object.keys(t).map(e=>{const s=As(e);s.includes("_")&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Rt(t[s]))}),t}function Rs(t){return t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""))}function It(t){return Object.keys(t).map(e=>{const s=Rs(e);s!==e&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=It(t[s]))}),t}function jt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Is}=Object.prototype,{getPrototypeOf:et}=Object,Ce=(t=>e=>{const s=Is.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),$=t=>(t=t.toLowerCase(),e=>Ce(e)===t),Ae=t=>e=>typeof e===t,{isArray:ie}=Array,he=Ae("undefined");function js(t){return t!==null&&!he(t)&&t.constructor!==null&&!he(t.constructor)&&D(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Zt=$("ArrayBuffer");function Zs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Zt(t.buffer),e}const Ds=Ae("string"),D=Ae("function"),Dt=Ae("number"),Re=t=>t!==null&&typeof t=="object",Ls=t=>t===!0||t===!1,Ie=t=>{if(Ce(t)!=="object")return!1;const e=et(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ps=$("Date"),Bs=$("File"),Ms=$("Blob"),Us=$("FileList"),$s=t=>Re(t)&&D(t.pipe),zs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||D(t.append)&&((e=Ce(t))==="formdata"||e==="object"&&D(t.toString)&&t.toString()==="[object FormData]"))},Vs=$("URLSearchParams"),Fs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function me(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ie(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let o;for(n=0;n<a;n++)o=i[n],e.call(null,t[o],o,t)}}function Lt(t,e){e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Pt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Bt=t=>!he(t)&&t!==Pt;function tt(){const{caseless:t}=Bt(this)&&this||{},e={},s=(n,r)=>{const i=t&&Lt(e,r)||r;Ie(e[i])&&Ie(n)?e[i]=tt(e[i],n):Ie(n)?e[i]=tt({},n):ie(n)?e[i]=n.slice():e[i]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&me(arguments[n],s);return e}const Hs=(t,e,s,{allOwnKeys:n}={})=>(me(e,(r,i)=>{s&&D(r)?t[i]=jt(r,s):t[i]=r},{allOwnKeys:n}),t),Js=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Ws=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Ks=(t,e,s,n)=>{let r,i,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)a=r[i],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=s!==!1&&et(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},qs=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},Gs=t=>{if(!t)return null;if(ie(t))return t;let e=t.length;if(!Dt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Xs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&et(Uint8Array)),Ys=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Qs=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},en=$("HTMLFormElement"),tn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),Mt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),sn=$("RegExp"),Ut=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};me(s,(r,i)=>{e(r,i,t)!==!1&&(n[i]=r)}),Object.defineProperties(t,n)},nn=t=>{Ut(t,(e,s)=>{if(D(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(D(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},rn=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ie(t)?n(t):n(String(t).split(e)),s},an=()=>{},on=(t,e)=>(t=+t,Number.isFinite(t)?t:e),st="abcdefghijklmnopqrstuvwxyz",$t="0123456789",zt={DIGIT:$t,ALPHA:st,ALPHA_DIGIT:st+st.toUpperCase()+$t},ln=(t=16,e=zt.ALPHA_DIGIT)=>{let s="";const{length:n}=e;for(;t--;)s+=e[Math.random()*n|0];return s};function cn(t){return!!(t&&D(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const un=t=>{const e=new Array(10),s=(n,r)=>{if(Re(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const i=ie(n)?[]:{};return me(n,(a,o)=>{const u=s(a,r+1);!he(u)&&(i[o]=u)}),e[r]=void 0,i}}return n};return s(t,0)},dn=$("AsyncFunction"),c={isArray:ie,isArrayBuffer:Zt,isBuffer:js,isFormData:zs,isArrayBufferView:Zs,isString:Ds,isNumber:Dt,isBoolean:Ls,isObject:Re,isPlainObject:Ie,isUndefined:he,isDate:Ps,isFile:Bs,isBlob:Ms,isRegExp:sn,isFunction:D,isStream:$s,isURLSearchParams:Vs,isTypedArray:Xs,isFileList:Us,forEach:me,merge:tt,extend:Hs,trim:Fs,stripBOM:Js,inherits:Ws,toFlatObject:Ks,kindOf:Ce,kindOfTest:$,endsWith:qs,toArray:Gs,forEachEntry:Ys,matchAll:Qs,isHTMLForm:en,hasOwnProperty:Mt,hasOwnProp:Mt,reduceDescriptors:Ut,freezeMethods:nn,toObjectSet:rn,toCamelCase:tn,noop:an,toFiniteNumber:on,findKey:Lt,global:Pt,isContextDefined:Bt,ALPHABET:zt,generateString:ln,isSpecCompliantForm:cn,toJSONObject:un,isAsyncFn:dn,isThenable:t=>t&&(Re(t)||D(t))&&D(t.then)&&D(t.catch)};function T(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r)}c.inherits(T,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Vt=T.prototype,Ft={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Ft[t]={value:t}}),Object.defineProperties(T,Ft),Object.defineProperty(Vt,"isAxiosError",{value:!0}),T.from=(t,e,s,n,r,i)=>{const a=Object.create(Vt);return c.toFlatObject(t,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),T.call(a,t.message,e,s,n,r),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const fn=null;function nt(t){return c.isPlainObject(t)||c.isArray(t)}function Ht(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Jt(t,e,s){return t?t.concat(e).map(function(r,i){return r=Ht(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function hn(t){return c.isArray(t)&&!t.some(nt)}const mn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function je(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,K){return!c.isUndefined(K[S])});const n=s.metaTokens,r=s.visitor||f,i=s.dots,a=s.indexes,u=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(c.isDate(g))return g.toISOString();if(!u&&c.isBlob(g))throw new T("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(g)||c.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,S,K){let U=g;if(g&&!K&&typeof g=="object"){if(c.endsWith(S,"{}"))S=n?S:S.slice(0,-2),g=JSON.stringify(g);else if(c.isArray(g)&&hn(g)||(c.isFileList(g)||c.endsWith(S,"[]"))&&(U=c.toArray(g)))return S=Ht(S),U.forEach(function(Qe,li){!(c.isUndefined(Qe)||Qe===null)&&e.append(a===!0?Jt([S],li,i):a===null?S:S+"[]",l(Qe))}),!1}return nt(g)?!0:(e.append(Jt(K,S,i),l(g)),!1)}const b=[],A=Object.assign(mn,{defaultVisitor:f,convertValue:l,isVisitable:nt});function N(g,S){if(!c.isUndefined(g)){if(b.indexOf(g)!==-1)throw Error("Circular reference detected in "+S.join("."));b.push(g),c.forEach(g,function(U,fe){(!(c.isUndefined(U)||U===null)&&r.call(e,U,c.isString(fe)?fe.trim():fe,S,A))===!0&&N(U,S?S.concat(fe):[fe])}),b.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return N(t),e}function Wt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function rt(t,e){this._pairs=[],t&&je(t,this,e)}const Kt=rt.prototype;Kt.append=function(e,s){this._pairs.push([e,s])},Kt.toString=function(e){const s=e?function(n){return e.call(this,n,Wt)}:Wt;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function pn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qt(t,e,s){if(!e)return t;const n=s&&s.encode||pn,r=s&&s.serialize;let i;if(r?i=r(e,s):i=c.isURLSearchParams(e)?e.toString():new rt(e,s).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class yn{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Gt=yn,Xt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gn=typeof URLSearchParams<"u"?URLSearchParams:rt,vn=typeof FormData<"u"?FormData:null,_n=typeof Blob<"u"?Blob:null,bn=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),wn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),z={isBrowser:!0,classes:{URLSearchParams:gn,FormData:vn,Blob:_n},isStandardBrowserEnv:bn,isStandardBrowserWebWorkerEnv:wn,protocols:["http","https","file","blob","url","data"]};function xn(t,e){return je(t,new z.classes.URLSearchParams,Object.assign({visitor:function(s,n,r,i){return z.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function kn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Sn(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function Yt(t){function e(s,n,r,i){let a=s[i++];const o=Number.isFinite(+a),u=i>=s.length;return a=!a&&c.isArray(r)?r.length:a,u?(c.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!c.isObject(r[a]))&&(r[a]=[]),e(s,n,r[a],i)&&c.isArray(r[a])&&(r[a]=Sn(r[a])),!o)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(kn(n),r,s,0)}),s}return null}const Tn={"Content-Type":void 0};function En(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Ze={transitional:Xt,adapter:["xhr","http"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r&&r?JSON.stringify(Yt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return xn(e,this.formSerializer).toString();if((o=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return je(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||r?(s.setContentType("application/json",!1),En(e)):e}],transformResponse:[function(e){const s=this.transitional||Ze.transitional,n=s&&s.forcedJSONParsing,r=this.responseType==="json";if(e&&c.isString(e)&&(n&&!this.responseType||r)){const a=!(s&&s.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?T.from(o,T.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:z.classes.FormData,Blob:z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(e){Ze.headers[e]={}}),c.forEach(["post","put","patch"],function(e){Ze.headers[e]=c.merge(Tn)});const it=Ze,On=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Nn=t=>{const e={};let s,n,r;return t&&t.split(`
2
+ `).forEach(function(a){r=a.indexOf(":"),s=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!s||e[s]&&On[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Qt=Symbol("internals");function pe(t){return t&&String(t).trim().toLowerCase()}function De(t){return t===!1||t==null?t:c.isArray(t)?t.map(De):String(t)}function Cn(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const An=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function at(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function Rn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function In(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,i,a){return this[n].call(this,e,r,i,a)},configurable:!0})})}class Le{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(o,u,l){const f=pe(u);if(!f)throw new Error("header name must be a non-empty string");const b=c.findKey(r,f);(!b||r[b]===void 0||l===!0||l===void 0&&r[b]!==!1)&&(r[b||u]=De(o))}const a=(o,u)=>c.forEach(o,(l,f)=>i(l,f,u));return c.isPlainObject(e)||e instanceof this.constructor?a(e,s):c.isString(e)&&(e=e.trim())&&!An(e)?a(Nn(e),s):e!=null&&i(s,e,n),this}get(e,s){if(e=pe(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return Cn(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=pe(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||at(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(a){if(a=pe(a),a){const o=c.findKey(n,a);o&&(!s||at(n,n[o],o,s))&&(delete n[o],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||at(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const a=c.findKey(n,i);if(a){s[a]=De(r),delete s[i];return}const o=e?Rn(i):String(i).trim();o!==i&&delete s[i],s[o]=De(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
3
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Qt]=this[Qt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=pe(a);n[o]||(In(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(Le.prototype),c.freezeMethods(Le);const H=Le;function ot(t,e){const s=this||it,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function es(t){return!!(t&&t.__CANCEL__)}function ye(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(ye,T,{__CANCEL__:!0});function jn(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const Zn=z.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Dn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Ln(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function ts(t,e){return t&&!Dn(e)?Ln(t,e):e}const Pn=z.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Bn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Mn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let b=i,A=0;for(;b!==r;)A+=s[b++],b=b%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function ss(t,e){let s=0;const n=Mn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:fn,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&(z.isStandardBrowserEnv||z.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=ts(t.baseURL,t.url);l.open(t.method.toUpperCase(),qt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function b(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};jn(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=b:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(b)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||Xt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},z.isStandardBrowserEnv){const N=(t.withCredentials||Pn(f))&&t.xsrfCookieName&&Zn.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",ss(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",ss(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new ye(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Bn(f);if(A&&z.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Un={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function lt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ye(null,t)}function ns(t){return lt(t),t.headers=H.from(t.headers),t.data=ot.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Un.getAdapter(t.adapter||it.adapter)(t).then(function(n){return lt(t),n.data=ot.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return es(n)||(lt(t),n&&n.response&&(n.response.data=ot.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const rs=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,b){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:b},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,b){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,b)}else return n(l,f,b)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,b){if(b in e)return n(l,f);if(b in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(rs(l),rs(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const b=u[f]||r,A=b(t[f],e[f],f);c.isUndefined(A)&&b!==o||(s[f]=A)}),s}const is="1.4.0",ct={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ct[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const as={};ct.transitional=function(e,s,n){function r(i,a){return"[Axios v"+is+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!as[a]&&(as[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function $n(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ut={assertOptions:$n,validators:ct},G=ut.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Gt,response:new Gt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ut.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ut.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,b=0,A;if(!u){const g=[ns.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);b<A;)f=f.then(g[b++],g[b++]);return f}A=o.length;let N=s;for(b=0;b<A;){const g=o[b++],S=o[b++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=ns.call(this,N)}catch(g){return Promise.reject(g)}for(b=0,A=l.length;b<A;)f=f.then(l[b++],l[b++]);return f}getUri(e){e=ae(this.defaults,e);const s=ts(e.baseURL,e.url);return qt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class dt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new ye(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new dt(function(r){e=r}),cancel:e}}}const zn=dt;function Vn(t){return function(s){return t.apply(null,s)}}function Fn(t){return c.isObject(t)&&t.isAxiosError===!0}const ft={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ft).forEach(([t,e])=>{ft[e]=t});const Hn=ft;function os(t){const e=new Me(t),s=jt(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return os(ae(t,r))},s}const R=os(it);R.Axios=Me,R.CanceledError=ye,R.CancelToken=zn,R.isCancel=es,R.VERSION=is,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=Vn,R.isAxiosError=Fn,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>Yt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=Hn,R.default=R;const ht=R;function mt({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}function pt(t){return t.replaceAll(" ","").trim()}async function ls({url:t,apiKey:e,options:s}){return await ht.get(pt(t),mt({apiKey:e,options:s}))}async function yt({url:t,apiKey:e,options:s,payload:n={}}){return await ht.post(pt(t),n,mt({apiKey:e,options:s}))}async function Jn({url:t,apiKey:e,options:s,payload:n}){return await ht.put(pt(t),n,mt({apiKey:e,options:s}))}async function oe(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Wn({apiKey:t,apiHost:e},s,n){return oe(async()=>{const r=(await yt({url:`${e}/v1/images/book/${s}`,apiKey:t,payload:n})).data;return bs.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var gt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(gt||(gt={}));const m=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},h=E.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"]),Kn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class L extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}L.create=t=>new L(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let cs=ge;function qn(t){cs=t}function Ue(){return cs}const $e=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},Gn=[];function p(t,e){const s=$e({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),us=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),vt=t=>t.status==="aborted",_t=t=>t.status==="dirty",ze=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}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}}const ds=(t,e)=>{if(ze(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new L(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return ds(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return ds(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return de.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new hs({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xn=/^c[^\s-]{8,}$/i,Yn=/^[a-z][a-z0-9]*$/,Qn=/[0-9A-HJKMNP-TV-Z]{26}/,er=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,tr=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((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}))\])|(\[IPv6:(([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})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,sr=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,nr=/^(((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}))$/,rr=/^(([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})))$/,ir=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ar(t,e){return!!((e==="v4"||!e)&&nr.test(t)||(e==="v6"||!e)&&rr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")tr.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")sr.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")er.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?ir(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?ar(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function or(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?or(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class le extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}le.create=t=>new le({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:m.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return p(s,{code:h.invalid_type,expected:m.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(p(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(p(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(p(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function ce(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(ce(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:ce(t.element)}):t instanceof W?W.create(ce(t.unwrap())):t instanceof re?re.create(ce(t.unwrap())):t instanceof F?F.create(t.items.map(e=>ce(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:m.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],b=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,b,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const b=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,b,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const b=await f.key;l.push({key:b,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return ce(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return fs(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new L(o.ctx.common.issues));return p(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new L(u));return p(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return p(s,{code:h.invalid_type,expected:m.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(p(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function bt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&n===m.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=bt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=bt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(vt(i)||vt(a))return w;const o=bt(i.value,a.value);return o.valid?((_t(i)||_t(a))&&s.dirty(),{status:s.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:h.invalid_type,expected:m.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:h.invalid_type,expected:m.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:h.invalid_type,expected:m.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:h.invalid_type,expected:m.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ue extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return p(s,{code:h.invalid_type,expected:m.function,received:s.parsedType}),w;function n(o,u){return $e({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return $e({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof de?j(async(...o)=>{const u=new L([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new L([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new L([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ue({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ue({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ue({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return p(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function fs(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=fs;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=E.objectValues(s);return p(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class de extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return p(s,{code:h.invalid_type,expected:m.promise,received:s.parsedType}),w;const n=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}de.create=(t,e)=>new de({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{p(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ze(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>ze(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const lr=Symbol("zod_brand");class hs extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),us(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const ms=(t,e={},s)=>t?le.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):le.create(),cr={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const ur=(t,e={message:`Input not instance of ${t.name}`})=>ms(s=>s instanceof t,e),ps=P.create,ys=Y.create,dr=Ge.create,fr=Q.create,gs=ve.create,hr=te.create,mr=Fe.create,pr=_e.create,yr=be.create,gr=le.create,vr=se.create,_r=J.create,br=He.create,wr=B.create,xr=C.create,kr=C.strictCreate,Sr=we.create,Tr=We.create,Er=xe.create,Or=F.create,Nr=ke.create,Cr=Ke.create,Ar=ne.create,Rr=ue.create,Ir=Se.create,jr=Te.create,Zr=ee.create,Dr=Ee.create,Lr=de.create,vs=M.create,Pr=W.create,Br=re.create,Mr=M.createWithPreprocess,Ur=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:qn,getErrorMap:Ue,makeIssue:$e,EMPTY_PATH:Gn,addIssueToContext:p,ParseStatus:I,INVALID:w,DIRTY:us,OK:j,isAborted:vt,isDirty:_t,isValid:ze,isAsync:Ve,get util(){return E},get objectUtil(){return gt},ZodParsedType:m,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:le,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ue,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:de,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:lr,ZodBranded:hs,ZodPipeline:Ne,custom:ms,Schema:k,ZodSchema:k,late:cr,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:gr,array:wr,bigint:fr,boolean:gs,date:hr,discriminatedUnion:Tr,effect:vs,enum:Zr,function:Rr,instanceof:ur,intersection:Er,lazy:Ir,literal:jr,map:Cr,nan:dr,nativeEnum:Dr,never:_r,null:yr,nullable:Br,number:ys,object:xr,oboolean:()=>gs().optional(),onumber:()=>ys().optional(),optional:Pr,ostring:()=>ps().optional(),pipeline:Ur,preprocess:Mr,promise:Lr,record:Nr,set:Ar,strictObject:kr,string:ps,symbol:mr,transformer:vs,tuple:Or,undefined:pr,union:Sr,unknown:vr,void:br,NEVER:w,ZodIssueCode:h,quotelessJson:Kn,ZodError:L});class _s{constructor(e,s){_(this,"client");_(this,"parentId");_(this,"images");_(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Wn(this.client,this.parentId,new ws(e)),new Promise(s=>{s(this.length)})}}const bs=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class ws{constructor(e){_(this,"handle");_(this,"url");_(this,"width");_(this,"height");_(this,"orientation");_(this,"taken_at");_(this,"camera_make");_(this,"camera");_(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const xs=["new","ingesting","submitted","storyboarding","deduplication","image-selection","designing","laying-out","embellishing","polishing","ready","error","cancelled"],wt=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],xt={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},kt=["8x8","10x10","12x12","8x11","11x8","11x14"],St=["sc","hc","pl"],Tt=["sp","sl","dl"],Et=["low","medium","high"],Ot=["best","most","all"],Nt=["none","few","lots"],Ct=["none","few","lots"],ks={state:"error",slug:"error",progress:100,message:"Design failed"},Ss={state:"cancelled",slug:"cancelled",progress:100,message:"Design cancelled"};class $r{constructor(e){_(this,"occasion");_(this,"style");_(this,"book_size");_(this,"cover_type");_(this,"page_type");_(this,"image_density");_(this,"image_filtering_level");_(this,"embellishment_level");_(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const zr=d.object({occasion:d.enum(wt),style:d.string(),book_size:d.enum(kt),cover_type:d.enum(St),page_type:d.enum(Tt),image_density:d.enum(Et),image_filtering_level:d.enum(Ot),embellishment_level:d.enum(Nt),text_sticker_level:d.enum(Ct)}),At=d.object({id:d.string(),title:d.string(),design_request:zr,state:d.enum(xs).optional(),guid:d.string().optional()});class Xe{constructor(e){_(this,"id");_(this,"title");_(this,"design_request");_(this,"state");_(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new $r(e.design_request),this.state=e.state,this.guid=e.guid}}const Vr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Fr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Hr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),Jr=d.object({key:d.string(),value:d.any()}),Wr=d.object({type:d.string(),imageAssignment:Vr.optional(),position:Fr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),Kr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Hr}),qr=d.object({properties:d.array(Jr)}),Gr=d.object({backgroundId:d.string().nullable(),assets:d.array(Wr).optional()}),Xr=d.object({pageNum:d.number(),type:d.string(),canvas:Gr}),Yr=d.object({pages:d.array(Xr),photoStrip:d.array(Kr)}),Qr=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:Yr,reportingData:qr});async function ei({apiHost:t,apiKey:e},s){return oe(async()=>{const n=(await yt({url:`${t}/v1/books`,apiKey:e,payload:s})).data;return At.safeParse(n),new Xe(n)})}async function Ts({apiHost:t,apiKey:e},s){return oe(async()=>{const n=(await Jn({url:`${t}/v1/books/${s.id}`,apiKey:e,payload:s})).data;return At.safeParse(n),new Xe(n)})}async function ti({apiHost:t,apiKey:e},s){return oe(async()=>{const n=(await yt({url:`${t}/v1/books/${s}/cancel`,apiKey:e})).data;return At.safeParse(n),new Xe(n)})}async function si({apiHost:t,apiKey:e},s){return oe(async()=>{const n=(await ls({url:`${t}/v1/books/${s}/format/galleon`,apiKey:e})).data;return Qr.parse(n)})}const ni="https://api.sfly-sls.magicbook.io",ri="wss://socket.sfly-sls.magicbook.io",ii=parseInt("30000")||3e4;function Es(t){const e=xt[t.style].slug,s=Rt(JSON.parse(JSON.stringify(t)));return s.style=e,new Xe({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Ye=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),Os=d.object({high:Ye,medium:Ye,low:Ye}),Ns=d.object({densities:Os});async function ai({apiKey:t,apiHost:e},s,n,r){return oe(async()=>{const i=await ls({url:`${e}/v1/designoptions/booksize/${s}/imagecount/${n}
4
+ /imagefilteringlevel/${r}`,apiKey:t}),a=It(i.data);return Ns.parse(a)})}class Cs{constructor(e,s,n){_(this,"client");_(this,"webSocket");_(this,"state");_(this,"parentId");_(this,"title");_(this,"occasion");_(this,"style");_(this,"bookSize");_(this,"coverType");_(this,"pageType");_(this,"imageDensity");_(this,"imageFilteringLevel");_(this,"embellishmentLevel");_(this,"textStickerLevel");_(this,"images");_(this,"guid");this.parentId=e,this.client=s,this.webSocket=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),this.state="new",this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||wt[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(xt)[0]),this.bookSize=(n==null?void 0:n.bookSize)||kt[0],this.coverType=(n==null?void 0:n.coverType)||St[0],this.pageType=(n==null?void 0:n.pageType)||Tt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||Et[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||Ot[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Nt[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Ct[0],this.images=new _s(this.client,this.parentId)}async getOptions(e){return await ai(this.client,this.bookSize,e||this.images.length,this.imageFilteringLevel)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Ts(this.client,Es(this)),this}async setGuid(e){return this.guid=e,await Ts(this.client,Es(this)),this.guid}async getJSON(){return await si(this.client,this.parentId)}async cancel(){return await ti(this.client,this.parentId),this.state="cancelled",await this.eventHandler(Ss),this}async eventHandler(e,s="MagicBook.designRequestUpdated"){const n=new CustomEvent(s,{detail:e});window.dispatchEvent(n),["error","ready","cancelled"].includes(e.slug)&&this.webSocket.close()}timeoutHandler(){return setTimeout(()=>{this.eventHandler(ks)},ii)}async getProgress(){let e;this.webSocket.onmessage=s=>{const n=JSON.parse(s.data);this.state!==n.slug&&(e&&clearTimeout(e),e=this.timeoutHandler(),this.eventHandler(n),this.state=n.slug)},this.webSocket.onclose=()=>clearTimeout(e)}}class oi{constructor(e,s=ni,n=ri){_(this,"apiKey");_(this,"apiHost");_(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await ei(this);return new Cs(s.id,this,e)}}O.DesignRequest=Cs,O.ImageServer=ws,O.Images=_s,O.MagicBookClient=oi,O.bookSizes=kt,O.cancelledMessage=Ss,O.coverTypes=St,O.designOptionsSchema=Ns,O.embellishmentLevels=Nt,O.imageDensities=Et,O.imageDensityOptionSchema=Ye,O.imageDensityOptionsSchema=Os,O.imageFilteringLevels=Ot,O.imageServerSchema=bs,O.occasions=wt,O.pageTypes=Tt,O.states=xs,O.styles=xt,O.textStickerLevels=Ct,O.timeoutMessage=ks,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
package/models/book.d.ts CHANGED
@@ -88,7 +88,7 @@ export declare const BookPropsSchema: z.ZodObject<{
88
88
  embellishment_level: "none" | "few" | "lots";
89
89
  text_sticker_level: "none" | "few" | "lots";
90
90
  }>;
91
- state: z.ZodOptional<z.ZodEnum<["new", "ingesting", "submitted", "storyboarding", "deduplication", "image selection", "designing", "layouting", "embellishing", "polishing", "ready", "error"]>>;
91
+ state: z.ZodOptional<z.ZodEnum<["new", "ingesting", "submitted", "storyboarding", "deduplication", "image-selection", "designing", "laying-out", "embellishing", "polishing", "ready", "error", "cancelled"]>>;
92
92
  guid: z.ZodOptional<z.ZodString>;
93
93
  }, "strip", z.ZodTypeAny, {
94
94
  id: string;
@@ -104,7 +104,7 @@ export declare const BookPropsSchema: z.ZodObject<{
104
104
  embellishment_level: "none" | "few" | "lots";
105
105
  text_sticker_level: "none" | "few" | "lots";
106
106
  };
107
- state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "error" | undefined;
107
+ state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "laying-out" | "embellishing" | "polishing" | "ready" | "error" | "cancelled" | undefined;
108
108
  guid?: string | undefined;
109
109
  }, {
110
110
  id: string;
@@ -120,7 +120,7 @@ export declare const BookPropsSchema: z.ZodObject<{
120
120
  embellishment_level: "none" | "few" | "lots";
121
121
  text_sticker_level: "none" | "few" | "lots";
122
122
  };
123
- state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "error" | undefined;
123
+ state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "laying-out" | "embellishing" | "polishing" | "ready" | "error" | "cancelled" | undefined;
124
124
  guid?: string | undefined;
125
125
  }>;
126
126
  export type BookProps = z.infer<typeof BookPropsSchema>;
@@ -24,8 +24,8 @@ export type DesignRequestProps = {
24
24
  };
25
25
  export type State = typeof states[number];
26
26
  export type DesignRequestEventDetail = {
27
- state: State;
28
- slug: string;
27
+ state: string;
28
+ slug: State;
29
29
  progress: number;
30
30
  message: string;
31
31
  };
@@ -33,6 +33,7 @@ export type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
33
33
  export declare class DesignRequest {
34
34
  private client;
35
35
  private webSocket;
36
+ state: State;
36
37
  parentId: string;
37
38
  title: string;
38
39
  occasion: Occasion;
@@ -141,6 +142,7 @@ export declare class DesignRequest {
141
142
  }[];
142
143
  };
143
144
  }>;
145
+ cancel(): Promise<this>;
144
146
  private eventHandler;
145
147
  private timeoutHandler;
146
148
  private getProgress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magiclabs.ai/magicbook-client",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "private": false,
5
5
  "description": "TypeScript package to create photo books with the Magicbook API.",
6
6
  "repository": {