@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.
1,673 lines • 1.07 MB
JavaScript
var Rg = Object.defineProperty;
var Mg = (t, e, r) => e in t ? Rg(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
var Uo = (t, e, r) => (Mg(t, typeof e != "symbol" ? e + "" : e, r), r);
/*! Ballerine SDK - v1.0.2 - production-build */
const ae = {
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 la = (t) => t;
function ds(t, e) {
for (const r in e)
t[r] = e[r];
return t;
}
function Wp(t) {
return t();
}
function Mf() {
return /* @__PURE__ */ Object.create(null);
}
function Tn(t) {
t.forEach(Wp);
}
function fa(t) {
return typeof t == "function";
}
function xe(t, e) {
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
let Ho;
function pi(t, e) {
return Ho || (Ho = document.createElement("a")), Ho.href = e, t === Ho.href;
}
function Ng(t) {
return Object.keys(t).length === 0;
}
function ju(t, ...e) {
if (t == null)
return K;
const r = t.subscribe(...e);
return r.unsubscribe ? () => r.unsubscribe() : r;
}
function Si(t) {
let e;
return ju(t, (r) => e = r)(), e;
}
function re(t, e, r) {
t.$$.on_destroy.push(ju(e, r));
}
function Cr(t, e, r, n) {
if (t) {
const i = qp(t, e, r, n);
return t[0](i);
}
}
function qp(t, e, r, n) {
return t[1] && n ? ds(r.ctx.slice(), t[1](n(e))) : r.ctx;
}
function Ir(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 Or(t, e, r, n, i, a) {
if (i) {
const o = qp(e, r, n, a);
t.p(o, i);
}
}
function Ar(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 Nf(t) {
return t ?? "";
}
function ot(t, e, r) {
return t.set(r), e;
}
function jf(t) {
const e = typeof t == "string" && t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
return e ? [parseFloat(e[1]), e[2] || "px"] : [t, "px"];
}
const Yp = typeof window < "u";
let Ms = Yp ? () => window.performance.now() : () => Date.now(), Lu = Yp ? (t) => requestAnimationFrame(t) : K;
const Ki = /* @__PURE__ */ new Set();
function Jp(t) {
Ki.forEach((e) => {
e.c(t) || (Ki.delete(e), e.f());
}), Ki.size !== 0 && Lu(Jp);
}
function Ns(t) {
let e;
return Ki.size === 0 && Lu(Jp), {
promise: new Promise((r) => {
Ki.add(e = { c: t, f: r });
}),
abort() {
Ki.delete(e);
}
};
}
function de(t, e) {
t.appendChild(e);
}
function De(t, e, r) {
const n = Uu(t);
if (!n.getElementById(e)) {
const i = ce("style");
i.id = e, i.textContent = r, Xp(n, i);
}
}
function Uu(t) {
if (!t)
return document;
const e = t.getRootNode ? t.getRootNode() : t.ownerDocument;
return e && e.host ? e : t.ownerDocument;
}
function jg(t) {
const e = ce("style");
return Xp(Uu(t), e), e.sheet;
}
function Xp(t, e) {
return de(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 gt(t) {
return document.createElementNS("http://www.w3.org/2000/svg", t);
}
function $i(t) {
return document.createTextNode(t);
}
function ne() {
return $i(" ");
}
function Ue() {
return $i("");
}
function bt(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 Lg(t) {
return Array.from(t.childNodes);
}
function Qp(t, e) {
e = "" + e, t.data !== e && (t.data = e);
}
function Rt(t, e, r, n) {
r == null ? t.style.removeProperty(e) : t.style.setProperty(e, r, n ? "important" : "");
}
function st(t, e, r) {
t.classList[r ? "add" : "remove"](e);
}
function eh(t, e, { bubbles: r = !1, cancelable: n = !1 } = {}) {
const i = document.createEvent("CustomEvent");
return i.initCustomEvent(t, r, n, e), i;
}
class Ug {
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 = gt(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 Xi(t, e) {
return new t(e);
}
const ps = /* @__PURE__ */ new Map();
let hs = 0;
function Hg(t) {
let e = 5381, r = t.length;
for (; r--; )
e = (e << 5) - e ^ t.charCodeAt(r);
return e >>> 0;
}
function Vg(t, e) {
const r = { stylesheet: jg(e), rules: {} };
return ps.set(t, r), r;
}
function Hu(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_${Hg(l)}_${c}`, d = Uu(t), { stylesheet: g, rules: f } = ps.get(d) || Vg(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`, hs += 1, p;
}
function ms(t, e) {
const r = (t.style.animation || "").split(", "), n = r.filter(
e ? (a) => a.indexOf(e) < 0 : (a) => a.indexOf("__svelte") === -1
// remove all Svelte animations
), i = r.length - n.length;
i && (t.style.animation = n.join(", "), hs -= i, hs || Gg());
}
function Gg() {
Lu(() => {
hs || (ps.forEach((t) => {
const { ownerNode: e } = t.stylesheet;
e && j(e);
}), ps.clear());
});
}
function zg(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 = la,
// @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?
start: s = Ms() + a,
// @ts-ignore todo:
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 = Hu(t, 0, 1, o, a, c, p)), a || (g = !0);
}
function v() {
p && ms(t, f), d = !1;
}
return Ns((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 Kg(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, th(t, i);
}
}
function th(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 Wa;
function Ua(t) {
Wa = t;
}
function js() {
if (!Wa)
throw new Error("Function called outside component initialization");
return Wa;
}
function da(t) {
js().$$.on_mount.push(t);
}
function lr(t) {
js().$$.on_destroy.push(t);
}
function Zg() {
const t = js();
return (e, r, { cancelable: n = !1 } = {}) => {
const i = t.$$.callbacks[e];
if (i) {
const a = eh(e, r, { cancelable: n });
return i.slice().forEach((o) => {
o.call(t, a);
}), !a.defaultPrevented;
}
return !0;
};
}
function Wg(t, e) {
return js().$$.context.set(t, e), e;
}
function $o(t, e) {
const r = t.$$.callbacks[e.type];
r && r.slice().forEach((n) => n.call(this, e));
}
const Hi = [], Qi = [];
let Zi = [];
const Lf = [], qg = /* @__PURE__ */ Promise.resolve();
let uu = !1;
function Yg() {
uu || (uu = !0, qg.then(nh));
}
function Vr(t) {
Zi.push(t);
}
const gc = /* @__PURE__ */ new Set();
let Pi = 0;
function nh() {
if (Pi !== 0)
return;
const t = Wa;
do {
try {
for (; Pi < Hi.length; ) {
const e = Hi[Pi];
Pi++, Ua(e), Jg(e.$$);
}
} catch (e) {
throw Hi.length = 0, Pi = 0, e;
}
for (Ua(null), Hi.length = 0, Pi = 0; Qi.length; )
Qi.pop()();
for (let e = 0; e < Zi.length; e += 1) {
const r = Zi[e];
gc.has(r) || (gc.add(r), r());
}
Zi.length = 0;
} while (Hi.length);
for (; Lf.length; )
Lf.pop()();
uu = !1, gc.clear(), Ua(t);
}
function Jg(t) {
if (t.fragment !== null) {
t.update(), Tn(t.before_update);
const e = t.dirty;
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Vr);
}
}
function Xg(t) {
const e = [], r = [];
Zi.forEach((n) => t.indexOf(n) === -1 ? e.push(n) : r.push(n)), r.forEach((n) => n()), Zi = e;
}
let Ia;
function rh() {
return Ia || (Ia = Promise.resolve(), Ia.then(() => {
Ia = null;
})), Ia;
}
function gs(t, e, r) {
t.dispatchEvent(eh(`${e ? "intro" : "outro"}${r}`));
}
const rs = /* @__PURE__ */ new Set();
let Mr;
function Fe() {
Mr = {
r: 0,
c: [],
p: Mr
// parent group
};
}
function Te() {
Mr.r || Tn(Mr.c), Mr = Mr.p;
}
function S(t, e) {
t && t.i && (rs.delete(t), t.i(e));
}
function E(t, e, r, n) {
if (t && t.o) {
if (rs.has(t))
return;
rs.add(t), Mr.c.push(() => {
rs.delete(t), n && (r && t.d(1), n());
}), t.o(e);
} else
n && n();
}
const ih = { duration: 0 };
function Vu(t, e, r) {
const n = { direction: "in" };
let i = e(t, r, n), a = !1, o, c, s = 0;
function u() {
o && ms(t, o);
}
function l() {
const { delay: d = 0, duration: g = 300, easing: f = la, tick: m = K, css: v } = i || ih;
v && (o = Hu(t, 0, 1, g, d, f, v, s++)), m(0, 1);
const y = Ms() + d, b = y + g;
c && c.abort(), a = !0, Vr(() => gs(t, !0, "start")), c = Ns((_) => {
if (a) {
if (_ >= b)
return m(1, 0), gs(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, ms(t), fa(i) ? (i = i(n), rh().then(l)) : l());
},
invalidate() {
p = !1;
},
end() {
a && (u(), a = !1);
}
};
}
function Gu(t, e, r) {
const n = { direction: "out" };
let i = e(t, r, n), a = !0, o;
const c = Mr;
c.r += 1;
function s() {
const { delay: u = 0, duration: l = 300, easing: p = la, tick: d = K, css: g } = i || ih;
g && (o = Hu(t, 1, 0, l, u, p, g));
const f = Ms() + u, m = f + l;
Vr(() => gs(t, !1, "start")), Ns((v) => {
if (a) {
if (v >= m)
return d(0, 1), gs(t, !1, "end"), --c.r || Tn(c.c), !1;
if (v >= f) {
const y = p((v - f) / l);
d(1 - y, y);
}
}
return a;
});
}
return fa(i) ? rh().then(() => {
i = i(n), s();
}) : s(), {
end(u) {
u && i.tick && i.tick(1, 0), a && (o && ms(t, o), a = !1);
}
};
}
function Qg(t, e) {
E(t, 1, 1, () => {
e.delete(t.key);
});
}
function e2(t, e) {
t.f(), Qg(t, e);
}
function t2(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 = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ 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 = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ 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 Tn(_), v;
}
function n2(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 r2(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 || Vr(() => {
const o = t.$$.on_mount.map(Wp).filter(fa);
t.$$.on_destroy ? t.$$.on_destroy.push(...o) : Tn(o), t.$$.on_mount = [];
}), a.forEach(Vr);
}
function G(t, e) {
const r = t.$$;
r.fragment !== null && (Xg(r.after_update), Tn(r.on_destroy), r.fragment && r.fragment.d(e), r.on_destroy = r.fragment = null, r.ctx = []);
}
function i2(t, e) {
t.$$.dirty[0] === -1 && (Hi.push(t), Yg(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
}
function $e(t, e, r, n, i, a, o, c = [-1]) {
const s = Wa;
Ua(t);
const u = t.$$ = {
fragment: null,
ctx: [],
// state
props: a,
update: K,
not_equal: i,
bound: Mf(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(e.context || (s ? s.$$.context : [])),
// everything else
callbacks: Mf(),
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 && i2(t, p)), d;
}) : [], u.update(), l = !0, Tn(u.before_update), u.fragment = n ? n(u.ctx) : !1, e.target) {
if (e.hydrate) {
const p = Lg(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), nh();
}
Ua(s);
}
class Ee {
$destroy() {
G(this, 1), this.$destroy = K;
}
$on(e, r) {
if (!fa(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 && !Ng(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
}
}
const Ri = [];
function a2(t, e) {
return {
subscribe: dn(t, e).subscribe
};
}
function dn(t, e = K) {
let r;
const n = /* @__PURE__ */ new Set();
function i(c) {
if (xe(t, c) && (t = c, r)) {
const s = !Ri.length;
for (const u of n)
u[1](), Ri.push(u, t);
if (s) {
for (let u = 0; u < Ri.length; u += 2)
Ri[u][0](Ri[u + 1]);
Ri.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 o2(t, e, r) {
const n = !Array.isArray(t), i = n ? [t] : t, a = e.length < 2;
return a2(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 = fa(g) ? g : K;
}, d = i.map((g, f) => ju(g, (m) => {
s[f] = m, u &= ~(1 << f), c && p();
}, () => {
u |= 1 << f;
}));
return c = !0, p(), function() {
Tn(d), l(), c = !1;
};
});
}
const s2 = [
ae.Welcome,
ae.DocumentSelection,
ae.DocumentPhoto,
ae.CheckDocument,
ae.DocumentPhotoBackStart,
ae.DocumentPhotoBack,
ae.CheckDocumentPhotoBack,
ae.SelfieStart,
ae.Selfie,
ae.CheckSelfie,
ae.QRcode,
ae.Loading
], ah = {
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: s2,
syncFlow: !0,
useFinalQueryParams: !0
}
},
metricsConfig: {
enabled: !0
}
}, me = dn(ah);
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 Uf(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 zn(t) {
return function() {
var e = this, r = arguments;
return new Promise(function(n, i) {
var a = t.apply(e, r);
function o(s) {
Uf(a, n, i, o, c, "next", s);
}
function c(s) {
Uf(a, n, i, o, c, "throw", s);
}
o(void 0);
});
};
}
function c2(t, e, r) {
if (oh())
return Reflect.construct.apply(null, arguments);
var n = [null];
n.push.apply(n, e);
var i = new (t.bind.apply(t, n))();
return r && qa(i, r.prototype), i;
}
function lu() {
return lu = 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;
}, lu.apply(null, arguments);
}
function fu(t) {
return fu = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, fu(t);
}
function yt(t, e) {
t.prototype = Object.create(e.prototype), t.prototype.constructor = t, qa(t, e);
}
function u2(t) {
try {
return Function.toString.call(t).indexOf("[native code]") !== -1;
} catch {
return typeof t == "function";
}
}
function oh() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (oh = function() {
return !!t;
})();
}
function ut() {
/*! 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 vn(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]())) : (vn(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, vn(g, i, "GeneratorFunction")), g.prototype = Object.create(p), g;
}
return s.prototype = u, vn(p, "constructor", u), vn(u, "constructor", s), s.displayName = "GeneratorFunction", vn(u, i, "GeneratorFunction"), vn(p), vn(p, i, "Generator"), vn(p, n, function() {
return this;
}), vn(p, "toString", function() {
return "[object Generator]";
}), (ut = function() {
return {
w: a,
m: d
};
})();
}
function vn(t, e, r, n) {
var i = Object.defineProperty;
try {
i({}, "", {});
} catch {
i = 0;
}
vn = 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) {
vn(a, l, function(d) {
return this._invoke(l, p, d);
});
};
u("next", 0), u("throw", 1), u("return", 2);
}
}, vn(t, e, r, n);
}
function qa(t, e) {
return qa = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, n) {
return r.__proto__ = n, r;
}, qa(t, e);
}
function ys(t) {
var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
return ys = function(r) {
if (r === null || !u2(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 c2(r, arguments, fu(this).constructor);
}
return n.prototype = Object.create(r.prototype, {
constructor: {
value: n,
enumerable: !1,
writable: !0,
configurable: !0
}
}), qa(n, r);
}, ys(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 Ya = /* @__PURE__ */ 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 yt(e, t), e;
}(/* @__PURE__ */ ys(Error)), Kn = /* @__PURE__ */ 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 yt(e, t), e;
}(/* @__PURE__ */ ys(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 du;
(function(t) {
t.mergeShapes = (e, r) => ({
...e,
...r
// second overwrites first
});
})(du || (du = {}));
const he = 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 he.undefined;
case "string":
return he.string;
case "number":
return isNaN(t) ? he.nan : he.number;
case "boolean":
return he.boolean;
case "function":
return he.function;
case "bigint":
return he.bigint;
case "symbol":
return he.symbol;
case "object":
return Array.isArray(t) ? he.array : t === null ? he.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? he.promise : typeof Map < "u" && t instanceof Map ? he.map : typeof Set < "u" && t instanceof Set ? he.set : typeof Date < "u" && t instanceof Date ? he.date : he.object;
default:
return he.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"
]), l2 = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
class _n 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 _n))
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();
}
}
_n.create = (t) => new _n(t);
const ea = (t, e) => {
let r;
switch (t.code) {
case se.invalid_type:
t.received === he.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 sh = ea;
function f2(t) {
sh = t;
}
function vs() {
return sh;
}
const _s = (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
};
}, d2 = [];
function fe(t, e) {
const r = vs(), n = _s({
issueData: e,
data: t.data,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
t.schemaErrorMap,
r,
r === ea ? void 0 : ea
// then global default map
].filter((i) => !!i)
});
t.common.issues.push(n);
}
class Zt {
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 Zt.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 }), en = (t) => ({ status: "valid", value: t }), pu = (t) => t.status === "aborted", hu = (t) => t.status === "dirty", Ja = (t) => t.status === "valid", Xa = (t) => typeof Promise < "u" && t instanceof Promise;
function bs(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 ch(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;
}
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 Ma, Na;
class or {
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 Hf = (t, e) => {
if (Ja(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 _n(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 Me {
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 Zt(),
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 (Xa(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 Hf(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 (Xa(i) ? i : Promise.resolve(i));
return Hf(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 qn({
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 Zr.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return Zn.create(this, this._def);
}
promise() {
return na.create(this, this._def);
}
or(e) {
return no.create([this, e], this._def);
}
and(e) {
return ro.create(this, e, this._def);
}
transform(e) {
return new qn({
...Pe(this._def),
schema: this,
typeName: Ce.ZodEffects,
effect: { type: "transform", transform: e }
});
}
default(e) {
const r = typeof e == "function" ? e : () => e;
return new co({
...Pe(this._def),
innerType: this,
defaultValue: r,
typeName: Ce.ZodDefault
});
}
brand() {
return new zu({
typeName: Ce.ZodBranded,
type: this,
...Pe(this._def)
});
}
catch(e) {
const r = typeof e == "function" ? e : () => e;
return new uo({
...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 Eo.create(this, e);
}
readonly() {
return lo.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
}
const p2 = /^c[^\s-]{8,}$/i, h2 = /^[0-9a-z]+$/, m2 = /^[0-9A-HJKMNP-TV-Z]{26}$/, g2 = /^[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, y2 = /^[a-z0-9_-]{21}$/i, v2 = /^[-+]?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)?)??$/, _2 = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, b2 = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
let yc;
const x2 = /^(?:(?: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])$/, S2 = /^(([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})))$/, $2 = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, uh = "((\\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])))", E2 = new RegExp(`^${uh}$`);
function lh(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 w2(t) {
return new RegExp(`^${lh(t)}$`);
}
function fh(t) {
let e = `${uh}T${lh(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 k2(t, e) {
return !!((e === "v4" || !e) && x2.test(t) || (e === "v6" || !e) && S2.test(t));
}
class Gn extends Me {
_parse(e) {
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== he.string) {
const a = this._getOrReturnCtx(e);
return fe(a, {
code: se.invalid_type,
expected: he.string,
received: a.parsedType
}), Ie;
}
const n = new Zt();
let i;
for (const a of this._def.checks)
if (a.kind === "min")
e.data.length < a.value && (i = this._getOrReturnCtx(e, i), fe(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), fe(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 ? fe(i, {
code: se.too_big,
maximum: a.value,
type: "string",
inclusive: !0,
exact: !0,
message: a.message
}) : c && fe(i, {
code: se.too_small,
minimum: a.value,
type: "string",
inclusive: !0,
exact: !0,
message: a.message
}), n.dirty());
} else if (a.kind === "email")
_2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "email",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "emoji")
yc || (yc = new RegExp(b2, "u")), yc.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "emoji",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "uuid")
g2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "uuid",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "nanoid")
y2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "nanoid",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "cuid")
p2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "cuid",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "cuid2")
h2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(i, {
validation: "cuid2",
code: se.invalid_string,
message: a.message
}), n.dirty());
else if (a.kind === "ulid")
m2.test(e.data) || (i = this._getOrReturnCtx(e, i), fe(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), fe(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), fe(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), fe(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), fe(i, {
code: se.invalid_string,
validation: