UNPKG

@hauser1993/kyc-sdk

Version:

Your custom version of Ballerine web UI SDK - an open-source infrastructure for user identity and risk management. Compose verification processes for any vertical and geography using modular building blocks, components, and 3rd party integrations.

22 lines 689 kB
(function(wn,re){typeof exports=="object"&&typeof module<"u"?re(exports):typeof define=="function"&&define.amd?define(["exports"],re):(wn=typeof globalThis<"u"?globalThis:wn||self,re(wn.BallerineSDK={}))})(this,function(wn){"use strict";var qB=Object.defineProperty;var YB=(wn,re,C)=>re in wn?qB(wn,re,{enumerable:!0,configurable:!0,writable:!0,value:C}):wn[re]=C;var gc=(wn,re,C)=>(YB(wn,typeof re!="symbol"?re+"":re,C),C);/*! Ballerine SDK - v1.0.2 - production-build */const re={Welcome:"welcome",DocumentSelection:"document-selection",DocumentStart:"document-start",DocumentPhoto:"document-photo",CheckDocument:"check-document",DocumentPhotoBackStart:"document-photo-back-start",DocumentPhotoBack:"document-photo-back",CheckDocumentPhotoBack:"check-document-photo-back",SelfieStart:"selfie-start",Selfie:"selfie",CheckSelfie:"check-selfie",A4DocumentStart:"a4-document-start",A4DocumentPhoto:"a4-document-photo",CheckA4Document:"check-a4-document",Registration:"registration",QRcode:"qrcode",Final:"final",Loading:"loading",Resubmission:"resubmission",Decline:"decline",Error:"error"},C={Image:"image",Photo:"photo",Title:"title",Paragraph:"paragraph",Button:"button",Input:"input",Container:"container",DocumentOption:"document-option",IconButton:"icon-button",IconCloseButton:"icon-close-button",CameraButton:"camera-button",VideoContainer:"video-container",List:"list",ErrorText:"error-text",Loader:"loader",QRcode:"qrcode"};function K(){}const Ri=t=>t;function Ho(t,e){for(const r in e)t[r]=e[r];return t}function Of(t){return t()}function Af(){return Object.create(null)}function kn(t){t.forEach(Of)}function Mi(t){return typeof t=="function"}function xe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Vo;function ai(t,e){return Vo||(Vo=document.createElement("a")),Vo.href=e,t===Vo.href}function wg(t){return Object.keys(t).length===0}function yc(t,...e){if(t==null)return K;const r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function oi(t){let e;return yc(t,r=>e=r)(),e}function ie(t,e,r){t.$$.on_destroy.push(yc(e,r))}function gr(t,e,r,n){if(t){const i=Bf(t,e,r,n);return t[0](i)}}function Bf(t,e,r,n){return t[1]&&n?Ho(r.ctx.slice(),t[1](n(e))):r.ctx}function yr(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],o=Math.max(e.dirty.length,i.length);for(let c=0;c<o;c+=1)a[c]=e.dirty[c]|i[c];return a}return e.dirty|i}return e.dirty}function vr(t,e,r,n,i,a){if(i){const o=Bf(e,r,n,a);t.p(o,i)}}function _r(t){if(t.ctx.length>32){const e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function Df(t){return t??""}function at(t,e,r){return t.set(r),e}function Ff(t){const e=typeof t=="string"&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}const Tf=typeof window<"u";let Go=Tf?()=>window.performance.now():()=>Date.now(),vc=Tf?t=>requestAnimationFrame(t):K;const Ni=new Set;function Pf(t){Ni.forEach(e=>{e.c(t)||(Ni.delete(e),e.f())}),Ni.size!==0&&vc(Pf)}function zo(t){let e;return Ni.size===0&&vc(Pf),{promise:new Promise(r=>{Ni.add(e={c:t,f:r})}),abort(){Ni.delete(e)}}}function fe(t,e){t.appendChild(e)}function Oe(t,e,r){const n=_c(t);if(!n.getElementById(e)){const i=ce("style");i.id=e,i.textContent=r,Rf(n,i)}}function _c(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function kg(t){const e=ce("style");return Rf(_c(t),e),e.sheet}function Rf(t,e){return fe(t.head||t,e),e.sheet}function L(t,e,r){t.insertBefore(e,r||null)}function j(t){t.parentNode&&t.parentNode.removeChild(t)}function tt(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function ce(t){return document.createElement(t)}function dt(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function si(t){return document.createTextNode(t)}function ne(){return si(" ")}function Ue(){return si("")}function _t(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function D(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Cg(t){return Array.from(t.childNodes)}function Mf(t,e){e=""+e,t.data!==e&&(t.data=e)}function Ft(t,e,r,n){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function ot(t,e,r){t.classList[r?"add":"remove"](e)}function Nf(t,e,{bubbles:r=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}class Ig{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,r,n=null){this.e||(this.is_svg?this.e=dt(r.nodeName):this.e=ce(r.nodeType===11?"TEMPLATE":r.nodeName),this.t=r.tagName!=="TEMPLATE"?r:r.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let r=0;r<this.n.length;r+=1)L(this.t,this.n[r],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(j)}}function ji(t,e){return new t(e)}const Ko=new Map;let Zo=0;function Og(t){let e=5381,r=t.length;for(;r--;)e=(e<<5)-e^t.charCodeAt(r);return e>>>0}function Ag(t,e){const r={stylesheet:kg(e),rules:{}};return Ko.set(t,r),r}function bc(t,e,r,n,i,a,o,c=0){const s=16.666/n;let u=`{ `;for(let v=0;v<=1;v+=s){const y=e+(r-e)*a(v);u+=v*100+`%{${o(y,1-y)}} `}const l=u+`100% {${o(r,1-r)}} }`,p=`__svelte_${Og(l)}_${c}`,d=_c(t),{stylesheet:g,rules:f}=Ko.get(d)||Ag(d,t);f[p]||(f[p]=!0,g.insertRule(`@keyframes ${p} ${l}`,g.cssRules.length));const m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${p} ${n}ms linear ${i}ms 1 both`,Zo+=1,p}function Wo(t,e){const r=(t.style.animation||"").split(", "),n=r.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=r.length-n.length;i&&(t.style.animation=n.join(", "),Zo-=i,Zo||Bg())}function Bg(){vc(()=>{Zo||(Ko.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&j(e)}),Ko.clear())})}function Dg(t,e,r,n){if(!e)return K;const i=t.getBoundingClientRect();if(e.left===i.left&&e.right===i.right&&e.top===i.top&&e.bottom===i.bottom)return K;const{delay:a=0,duration:o=300,easing:c=Ri,start:s=Go()+a,end:u=s+o,tick:l=K,css:p}=r(t,{from:e,to:i},n);let d=!0,g=!1,f;function m(){p&&(f=bc(t,0,1,o,a,c,p)),a||(g=!0)}function v(){p&&Wo(t,f),d=!1}return zo(y=>{if(!g&&y>=s&&(g=!0),g&&y>=u&&(l(1,0),v()),!d)return!1;if(g){const b=y-s,_=0+1*c(b/o);l(_,1-_)}return!0}),m(),l(0,1),v}function Fg(t){const e=getComputedStyle(t);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:r,height:n}=e,i=t.getBoundingClientRect();t.style.position="absolute",t.style.width=r,t.style.height=n,jf(t,i)}}function jf(t,e){const r=t.getBoundingClientRect();if(e.left!==r.left||e.top!==r.top){const n=getComputedStyle(t),i=n.transform==="none"?"":n.transform;t.style.transform=`${i} translate(${e.left-r.left}px, ${e.top-r.top}px)`}}let Ia;function Oa(t){Ia=t}function qo(){if(!Ia)throw new Error("Function called outside component initialization");return Ia}function Li(t){qo().$$.on_mount.push(t)}function nr(t){qo().$$.on_destroy.push(t)}function Tg(){const t=qo();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const a=Nf(e,r,{cancelable:n});return i.slice().forEach(o=>{o.call(t,a)}),!a.defaultPrevented}return!0}}function Pg(t,e){return qo().$$.context.set(t,e),e}function Aa(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const Ui=[],Hi=[];let Vi=[];const Lf=[],Rg=Promise.resolve();let xc=!1;function Mg(){xc||(xc=!0,Rg.then(Uf))}function Fr(t){Vi.push(t)}const Sc=new Set;let Gi=0;function Uf(){if(Gi!==0)return;const t=Ia;do{try{for(;Gi<Ui.length;){const e=Ui[Gi];Gi++,Oa(e),Ng(e.$$)}}catch(e){throw Ui.length=0,Gi=0,e}for(Oa(null),Ui.length=0,Gi=0;Hi.length;)Hi.pop()();for(let e=0;e<Vi.length;e+=1){const r=Vi[e];Sc.has(r)||(Sc.add(r),r())}Vi.length=0}while(Ui.length);for(;Lf.length;)Lf.pop()();xc=!1,Sc.clear(),Oa(t)}function Ng(t){if(t.fragment!==null){t.update(),kn(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Fr)}}function jg(t){const e=[],r=[];Vi.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),Vi=e}let Ba;function Hf(){return Ba||(Ba=Promise.resolve(),Ba.then(()=>{Ba=null})),Ba}function Yo(t,e,r){t.dispatchEvent(Nf(`${e?"intro":"outro"}${r}`))}const Jo=new Set;let Tr;function Fe(){Tr={r:0,c:[],p:Tr}}function Te(){Tr.r||kn(Tr.c),Tr=Tr.p}function S(t,e){t&&t.i&&(Jo.delete(t),t.i(e))}function E(t,e,r,n){if(t&&t.o){if(Jo.has(t))return;Jo.add(t),Tr.c.push(()=>{Jo.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}const Vf={duration:0};function $c(t,e,r){const n={direction:"in"};let i=e(t,r,n),a=!1,o,c,s=0;function u(){o&&Wo(t,o)}function l(){const{delay:d=0,duration:g=300,easing:f=Ri,tick:m=K,css:v}=i||Vf;v&&(o=bc(t,0,1,g,d,f,v,s++)),m(0,1);const y=Go()+d,b=y+g;c&&c.abort(),a=!0,Fr(()=>Yo(t,!0,"start")),c=zo(_=>{if(a){if(_>=b)return m(1,0),Yo(t,!0,"end"),u(),a=!1;if(_>=y){const x=f((_-y)/g);m(x,1-x)}}return a})}let p=!1;return{start(){p||(p=!0,Wo(t),Mi(i)?(i=i(n),Hf().then(l)):l())},invalidate(){p=!1},end(){a&&(u(),a=!1)}}}function Ec(t,e,r){const n={direction:"out"};let i=e(t,r,n),a=!0,o;const c=Tr;c.r+=1;function s(){const{delay:u=0,duration:l=300,easing:p=Ri,tick:d=K,css:g}=i||Vf;g&&(o=bc(t,1,0,l,u,p,g));const f=Go()+u,m=f+l;Fr(()=>Yo(t,!1,"start")),zo(v=>{if(a){if(v>=m)return d(0,1),Yo(t,!1,"end"),--c.r||kn(c.c),!1;if(v>=f){const y=p((v-f)/l);d(1-y,y)}}return a})}return Mi(i)?Hf().then(()=>{i=i(n),s()}):s(),{end(u){u&&i.tick&&i.tick(1,0),a&&(o&&Wo(t,o),a=!1)}}}function Lg(t,e){E(t,1,1,()=>{e.delete(t.key)})}function Ug(t,e){t.f(),Lg(t,e)}function Hg(t,e,r,n,i,a,o,c,s,u,l,p){let d=t.length,g=a.length,f=d;const m={};for(;f--;)m[t[f].key]=f;const v=[],y=new Map,b=new Map,_=[];for(f=g;f--;){const I=p(i,a,f),M=r(I);let U=o.get(M);U?n&&_.push(()=>U.p(I,e)):(U=u(M,I),U.c()),y.set(M,v[f]=U),M in m&&b.set(M,Math.abs(f-m[M]))}const x=new Set,k=new Set;function B(I){S(I,1),I.m(c,l),o.set(I.key,I),l=I.first,g--}for(;d&&g;){const I=v[g-1],M=t[d-1],U=I.key,P=M.key;I===M?(l=I.first,d--,g--):y.has(P)?!o.has(U)||x.has(U)?B(I):k.has(P)?d--:b.get(U)>b.get(P)?(k.add(U),B(I)):(x.add(P),d--):(s(M,o),d--)}for(;d--;){const I=t[d];y.has(I.key)||s(I,o)}for(;g;)B(v[g-1]);return kn(_),v}function Vg(t,e){const r={},n={},i={$$scope:1};let a=t.length;for(;a--;){const o=t[a],c=e[a];if(c){for(const s in o)s in c||(n[s]=1);for(const s in c)i[s]||(r[s]=c[s],i[s]=1);t[a]=c}else for(const s in o)i[s]=1}for(const o in n)o in r||(r[o]=void 0);return r}function Gg(t){return typeof t=="object"&&t!==null?t:{}}function z(t){t&&t.c()}function V(t,e,r,n){const{fragment:i,after_update:a}=t.$$;i&&i.m(e,r),n||Fr(()=>{const o=t.$$.on_mount.map(Of).filter(Mi);t.$$.on_destroy?t.$$.on_destroy.push(...o):kn(o),t.$$.on_mount=[]}),a.forEach(Fr)}function G(t,e){const r=t.$$;r.fragment!==null&&(jg(r.after_update),kn(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function zg(t,e){t.$$.dirty[0]===-1&&(Ui.push(t),Mg(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Se(t,e,r,n,i,a,o,c=[-1]){const s=Ia;Oa(t);const u=t.$$={fragment:null,ctx:[],props:a,update:K,not_equal:i,bound:Af(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(s?s.$$.context:[])),callbacks:Af(),dirty:c,skip_bound:!1,root:e.target||s.$$.root};o&&o(u.root);let l=!1;if(u.ctx=r?r(t,e.props||{},(p,d,...g)=>{const f=g.length?g[0]:d;return u.ctx&&i(u.ctx[p],u.ctx[p]=f)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](f),l&&zg(t,p)),d}):[],u.update(),l=!0,kn(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=Cg(e.target);u.fragment&&u.fragment.l(p),p.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&S(t.$$.fragment),V(t,e.target,e.anchor,e.customElement),Uf()}Oa(s)}class $e{$destroy(){G(this,1),this.$destroy=K}$on(e,r){if(!Mi(r))return K;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!wg(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const zi=[];function Kg(t,e){return{subscribe:cn(t,e).subscribe}}function cn(t,e=K){let r;const n=new Set;function i(c){if(xe(t,c)&&(t=c,r)){const s=!zi.length;for(const u of n)u[1](),zi.push(u,t);if(s){for(let u=0;u<zi.length;u+=2)zi[u][0](zi[u+1]);zi.length=0}}}function a(c){i(c(t))}function o(c,s=K){const u=[c,s];return n.add(u),n.size===1&&(r=e(i)||K),c(t),()=>{n.delete(u),n.size===0&&r&&(r(),r=null)}}return{set:i,update:a,subscribe:o}}function Zg(t,e,r){const n=!Array.isArray(t),i=n?[t]:t,a=e.length<2;return Kg(r,o=>{let c=!1;const s=[];let u=0,l=K;const p=()=>{if(u)return;l();const g=e(n?s[0]:s,o);a?o(g):l=Mi(g)?g:K},d=i.map((g,f)=>yc(g,m=>{s[f]=m,u&=~(1<<f),c&&p()},()=>{u|=1<<f}));return c=!0,p(),function(){kn(d),l(),c=!1}})}const Wg=[re.Welcome,re.DocumentSelection,re.DocumentPhoto,re.CheckDocument,re.DocumentPhotoBackStart,re.DocumentPhotoBack,re.CheckDocumentPhotoBack,re.SelfieStart,re.Selfie,re.CheckSelfie,re.QRcode,re.Loading],Gf={backendConfig:{baseUrl:"http://localhost:3000/api/v1",auth:{method:"basic",authorizationHeader:"Bearer 12345678-1234-1234-1234-123456789012"},endpoints:{startVerification:"/v2/enduser/verify",getVerificationStatus:"/v2/enduser/verify/status/{verificationId}",processStepData:"/v2/enduser/verify/partial",getConfig:"/v2/clients/{clientId}/config",uploadFile:"/collection-flow/files",updateContext:"/collection-flow/sync/context"}},isDevelopment:!1,defaultLanguage:"en",endUserInfo:{id:"test-id123"},flows:{default:{name:"default",stepsOrder:Wg,syncFlow:!0,useFinalQueryParams:!0}},metricsConfig:{enabled:!0}},me=cn(Gf);Object.defineProperty(window,"configStore",{get:()=>me.subscribe(t=>console.log(t))});/** * workflow-core * * Copyright (c) Ballerine * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function zf(t,e,r,n,i,a,o){try{var c=t[a](o),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,i)}function Ln(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var a=t.apply(e,r);function o(s){zf(a,n,i,o,c,"next",s)}function c(s){zf(a,n,i,o,c,"throw",s)}o(void 0)})}}function qg(t,e,r){if(Kf())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Da(i,r.prototype),i}function wc(){return wc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},wc.apply(null,arguments)}function kc(t){return kc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kc(t)}function pt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Da(t,e)}function Yg(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Kf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kf=function(){return!!t})()}function ct(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(g,f,m,v){var y=f&&f.prototype instanceof c?f:c,b=Object.create(y.prototype);return mn(b,"_invoke",function(_,x,k){var B,I,M,U=0,P=k||[],N=!1,q={p:0,n:0,v:t,a:J,f:J.bind(t,4),d:function(X,H){return B=X,I=0,M=t,q.n=H,o}};function J(X,H){for(I=X,M=H,e=0;!N&&U&&!Y&&e<P.length;e++){var Y,te=P[e],Q=q.p,oe=te[2];X>3?(Y=oe===H)&&(I=te[4]||3,M=te[5]===t?te[3]:te[5],te[4]=3,te[5]=t):te[0]<=Q&&((Y=X<2&&Q<te[1])?(I=0,q.v=H,q.n=te[1]):Q<oe&&(Y=X<3||te[0]>H||H>oe)&&(te[4]=X,te[5]=H,q.n=oe,I=0))}if(Y||X>1)return o;throw N=!0,H}return function(X,H,Y){if(U>1)throw TypeError("Generator is already running");for(N&&H===1&&J(H,Y),I=H,M=Y;(e=I<2?t:M)||!N;){B||(I?I<3?(I>1&&(q.n=-1),J(I,M)):q.n=M:q.v=M);try{if(U=2,B){if(I||(X="next"),e=B[X]){if(!(e=e.call(B,M)))throw TypeError("iterator result is not an object");if(!e.done)return e;M=e.value,I<2&&(I=0)}else I===1&&(e=B.return)&&e.call(B),I<2&&(M=TypeError("The iterator does not provide a '"+X+"' method"),I=1);B=t}else if((e=(N=q.n<0)?M:_.call(x,q))!==o)break}catch(te){B=t,I=1,M=te}finally{U=1}}return{value:e,done:N}}}(g,m,v),!0),b}var o={};function c(){}function s(){}function u(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(mn(e={},n,function(){return this}),e),p=u.prototype=c.prototype=Object.create(l);function d(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,u):(g.__proto__=u,mn(g,i,"GeneratorFunction")),g.prototype=Object.create(p),g}return s.prototype=u,mn(p,"constructor",u),mn(u,"constructor",s),s.displayName="GeneratorFunction",mn(u,i,"GeneratorFunction"),mn(p),mn(p,i,"Generator"),mn(p,n,function(){return this}),mn(p,"toString",function(){return"[object Generator]"}),(ct=function(){return{w:a,m:d}})()}function mn(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}mn=function(a,o,c,s){if(o)i?i(a,o,{value:c,enumerable:!s,configurable:!s,writable:!s}):a[o]=c;else{let u=function(l,p){mn(a,l,function(d){return this._invoke(l,p,d)})};u("next",0),u("throw",1),u("return",2)}},mn(t,e,r,n)}function Da(t,e){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Da(t,e)}function Xo(t){var e=typeof Map=="function"?new Map:void 0;return Xo=function(r){if(r===null||!Yg(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return qg(r,arguments,kc(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Da(n,r)},Xo(t)}/** * workflow-core * * Copyright (c) Ballerine * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */var Fa=function(t){function e(r){var n;return n=t.call(this,"Field "+r+" is missing or null")||this,n.name=e.name,n}return pt(e,t),e}(Xo(Error)),Un=function(t){function e(r,n,i){var a,o=i==null?void 0:i.errors.map(function(c){return{message:c.message,path:c.path.join(".")}});return a=t.call(this,"Validation failed for '"+r+"', message: "+n+", "+(o?"error: "+JSON.stringify(i,null,2):" "))||this,a.name="ValidationFailedError",a.errors=o,a}return pt(e,t),e}(Xo(Error)),Ge;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const a={};for(const o of i)a[o]=o;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of a)o[c]=i[c];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(const o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ge||(Ge={}));var Cc;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Cc||(Cc={}));const pe=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pr=t=>{switch(typeof t){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return isNaN(t)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(t)?pe.array:t===null?pe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pe.promise:typeof Map<"u"&&t instanceof Map?pe.map:typeof Set<"u"&&t instanceof Set?pe.set:typeof Date<"u"&&t instanceof Date?pe.date:pe.object;default:return pe.unknown}},se=Ge.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"]),Jg=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class gn extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let c=n,s=0;for(;s<o.path.length;){const u=o.path[s];s===o.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(r(o))):c[u]=c[u]||{_errors:[]},c=c[u],s++}}};return i(this),n}static assert(e){if(!(e instanceof gn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}gn.create=t=>new gn(t);const Ki=(t,e)=>{let r;switch(t.code){case se.invalid_type:t.received===pe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case se.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ge.jsonStringifyReplacer)}`;break;case se.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ge.joinValues(t.keys,", ")}`;break;case se.invalid_union:r="Invalid input";break;case se.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ge.joinValues(t.options)}`;break;case se.invalid_enum_value:r=`Invalid enum value. Expected ${Ge.joinValues(t.options)}, received '${t.received}'`;break;case se.invalid_arguments:r="Invalid function arguments";break;case se.invalid_return_type:r="Invalid function return type";break;case se.invalid_date:r="Invalid date";break;case se.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ge.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case se.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case se.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case se.custom:r="Invalid input";break;case se.invalid_intersection_types:r="Intersection results could not be merged";break;case se.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case se.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ge.assertNever(t)}return{message:r}};let Zf=Ki;function Xg(t){Zf=t}function Qo(){return Zf}const es=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let c="";const s=n.filter(u=>!!u).slice().reverse();for(const u of s)c=u(o,{data:e,defaultError:c}).message;return{...i,path:a,message:c}},Qg=[];function de(t,e){const r=Qo(),n=es({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ki?void 0:Ki].filter(i=>!!i)});t.common.issues.push(n)}class Kt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return Ie;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r){const a=await i.key,o=await i.value;n.push({key:a,value:o})}return Kt.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Ie;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}}const Ie=Object.freeze({status:"aborted"}),Zi=t=>({status:"dirty",value:t}),Jt=t=>({status:"valid",value:t}),Ic=t=>t.status==="aborted",Oc=t=>t.status==="dirty",Ta=t=>t.status==="valid",Pa=t=>typeof Promise<"u"&&t instanceof Promise;function ts(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Wf(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}typeof SuppressedError=="function"&&SuppressedError;var _e;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_e||(_e={}));var Ra,Ma;class rr{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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 qf=(t,e)=>{if(Ta(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 r=new gn(t.common.issues);return this._error=r,this._error}}};function Pe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,c)=>{var s,u;const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:(s=l??n)!==null&&s!==void 0?s:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(u=l??r)!==null&&u!==void 0?u:c.defaultError}},description:i}}class Re{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Pr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Pr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Kt,ctx:{common:e.parent.common,data:e.data,parsedType:Pr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Pa(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pr(e)},a=this._parseSync({data:e,path:i.path,parent:i});return qf(i,a)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pr(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Pa(i)?i:Promise.resolve(i));return qf(n,a)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{const o=e(i),c=()=>a.addIssue({code:se.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(s=>s?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Gn({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ar.create(this,this._def)}nullable(){return jr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vn.create(this,this._def)}promise(){return Ji.create(this,this._def)}or(e){return Ua.create([this,e],this._def)}and(e){return Ha.create(this,e,this._def)}transform(e){return new Gn({...Pe(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Za({...Pe(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new Dc({typeName:Ce.ZodBranded,type:this,...Pe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Wa({...Pe(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qa.create(this,e)}readonly(){return Ya.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const e2=/^c[^\s-]{8,}$/i,t2=/^[0-9a-z]+$/,n2=/^[0-9A-HJKMNP-TV-Z]{26}$/,r2=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,i2=/^[a-z0-9_-]{21}$/i,a2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,o2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,s2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ac;const c2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u2=/^(([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})))$/,l2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Yf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",f2=new RegExp(`^${Yf}$`);function Jf(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function d2(t){return new RegExp(`^${Jf(t)}$`)}function Xf(t){let e=`${Yf}T${Jf(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function p2(t,e){return!!((e==="v4"||!e)&&c2.test(t)||(e==="v6"||!e)&&u2.test(t))}class Hn extends Re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){const a=this._getOrReturnCtx(e);return de(a,{code:se.invalid_type,expected:pe.string,received:a.parsedType}),Ie}const n=new Kt;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),de(i,{code:se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),de(i,{code:se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,c=e.data.length<a.value;(o||c)&&(i=this._getOrReturnCtx(e,i),o?de(i,{code:se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&de(i,{code:se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")o2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"email",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ac||(Ac=new RegExp(s2,"u")),Ac.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"emoji",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")r2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"uuid",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")i2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"nanoid",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")e2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"cuid",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")t2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"cuid2",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")n2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"ulid",code:se.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),de(i,{validation:"url",code:se.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"regex",code:se.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Xf(a).test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?f2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?d2(a).test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{code:se.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?a2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"duration",code:se.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?p2(e.data,a.version)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"ip",code:se.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?l2.test(e.data)||(i=this._getOrReturnCtx(e,i),de(i,{validation:"base64",code:se.invalid_string,message:a.message}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:se.invalid_string,..._e.errToObj(n)})}_addCheck(e){return new Hn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._e.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._e.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._e.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._e.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._e.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._e.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._e.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._e.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._e.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._e.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,..._e.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,..._e.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._e.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._e.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._e.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._e.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._e.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._e.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._e.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._e.errToObj(r)})}nonempty(e){return this.min(1,_e.errToObj(e))}trim(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Hn.create=t=>{var e;return new Hn({checks:[],typeName:Ce.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Pe(t)})};function h2(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}class Rr extends Re{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)!==pe.number){const a=this._getOrReturnCtx(e);return de(a,{code:se.invalid_type,expected:pe.number,received:a.parsedType}),Ie}let n;const i=new Kt;for(const a of this._def.checks)a.kind==="int"?Ge.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),de(n,{code:se.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?h2(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),de(n,{code:se.not_finite,message:a.message}),i.dirty()):Ge.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_e.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_e.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_e.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_e.toString(r))}setLimit(e,r,n,i){return new Rr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_e.toString(i)}]})}_addCheck(e){return new Rr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_e.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_e.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_e.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_e.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_e.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_e.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_e.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_e.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_e.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Rr.create=t=>new Rr({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Pe(t)});class Mr extends Re{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)!==pe.bigint){const a=this._getOrReturnCtx(e);return de(a,{code:se.invalid_type,expected:pe.bigint,received:a.parsedType}),Ie}let n;const i=new Kt;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),de(n,{code:se.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ge.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_e.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_e.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_e.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_e.toString(r))}setLimit(e,r,n,i){return new Mr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_e.toString(i)}]})}_addCheck(e){return new Mr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_e.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_e.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_e.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_e.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_e.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Mr.create=t=>{var e;return new Mr({checks:[],typeName:Ce.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Pe(t)})};class Na extends Re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){const n=this._getOrReturnCtx(e);return de(n,{code:se.invalid_type,expected:pe.boolean,received:n.parsedType}),Ie}return Jt(e.data)}}Na.create=t=>new Na({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Pe(t)});class ci extends Re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){const a=this._getOrReturnCtx(e);return de(a,{code:se.invalid_type,expected:pe.date,received:a.parsedType}),Ie}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return de(a,{code:se.invalid_date}),Ie}const n=new Kt;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),de(i,{code:se.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),de(i,{code:se.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ci({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_e.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_e.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ci.create=t=>new ci({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ce.ZodDate,...Pe(t)});class ns extends Re{_parse(e){if(this._getType(e)!==pe.symbol){const n=this._getOrReturnCtx(e);return de(n,{code:se.invalid_type,expected:pe.symbol,received:n.parsedType}),Ie}return Jt(e.data)}}ns.create=t=>new ns({typeName:Ce.ZodSymbol,...Pe(t)});class ja extends Re{_parse(e){if(this._getType(e)!==pe.undefined){const n=this._getOrReturnCtx(e);return de(n,{code:se.invalid_type,expected:pe.undefined,received:n.parsedType}),Ie}return Jt(e.data)}}ja.create=t=>new ja({typeName:Ce.ZodUndefined,...Pe(t)});class La extends Re{_parse(e){if(this._getType(e)!==pe.null