@exerp/odin-dropin
Version:
ODIN Payment Drop-in Facade
1,581 lines • 505 kB
JavaScript
var bE = Object.defineProperty;
var EE = (e, n, r) => n in e ? bE(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
var Ke = (e, n, r) => EE(e, typeof n != "symbol" ? n + "" : n, r);
const wE = "exerp-odin-dropin-core", bo = (
/* exerp-odin-dropin-core */
{ hydratedSelectorName: "hydrated", lazyLoad: !1, updatable: !0 }
);
var SE = Object.defineProperty, AE = (e, n) => {
for (var r in n)
SE(e, r, { get: n[r], enumerable: !0 });
}, OE = (e, n) => {
var r;
const a = n.$cmpMeta$;
Object.entries((r = a.$members$) != null ? r : {}).map(([u, [c]]) => {
if (c & 31 || c & 32) {
const f = e[u], d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), u);
Object.defineProperty(e, u, {
get() {
return d.get.call(this);
},
set(h) {
d.set.call(this, h);
},
configurable: !0,
enumerable: !0
}), e[u] = n.$instanceValues$.has(u) ? n.$instanceValues$.get(u) : f;
}
});
}, xr = (e) => {
if (e.__stencil__getHostRef)
return e.__stencil__getHostRef();
}, CE = (e, n) => {
const r = {
$flags$: 0,
$hostElement$: e,
$cmpMeta$: n,
$instanceValues$: /* @__PURE__ */ new Map()
};
r.$onReadyPromise$ = new Promise((o) => r.$onReadyResolve$ = o), e["s-p"] = [], e["s-rc"] = [];
const a = r;
return e.__stencil__getHostRef = () => a, OE(e, r), a;
}, bh = (e, n) => n in e, Eo = (e, n) => (0, console.error)(e, n), ao = /* @__PURE__ */ new Map(), TE = "sty-id", IE = "slot-fb{display:contents}slot-fb[hidden]{display:none}", Sn = typeof window < "u" ? window : {}, NE = Sn.HTMLElement || class {
}, Ur = {
$flags$: 0,
$resourcesUrl$: "",
jmp: (e) => e(),
raf: (e) => requestAnimationFrame(e),
ael: (e, n, r, a) => e.addEventListener(n, r, a),
rel: (e, n, r, a) => e.removeEventListener(n, r, a),
ce: (e, n) => new CustomEvent(e, n)
}, PE = (e) => Promise.resolve(e), Bp = /* @__PURE__ */ (() => {
try {
return new CSSStyleSheet(), typeof new CSSStyleSheet().replaceSync == "function";
} catch {
}
return !1;
})(), Ll = !1, Eh = [], jp = [], RE = (e, n) => (r) => {
e.push(r), Ll || (Ll = !0, Ur.raf(zp));
}, wh = (e) => {
for (let n = 0; n < e.length; n++)
try {
e[n](performance.now());
} catch (r) {
Eo(r);
}
e.length = 0;
}, zp = () => {
wh(Eh), wh(jp), (Ll = Eh.length > 0) && Ur.raf(zp);
}, rc = (e) => PE().then(e), DE = /* @__PURE__ */ RE(jp), ic = (e) => (e = typeof e, e === "object" || e === "function");
function FE(e) {
var n, r, a;
return (a = (r = (n = e.head) == null ? void 0 : n.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : r.getAttribute("content")) != null ? a : void 0;
}
var LE = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), kE = {};
AE(kE, {
err: () => Gp,
map: () => ME,
ok: () => kl,
unwrap: () => xE,
unwrapErr: () => UE
});
var kl = (e) => ({
isOk: !0,
isErr: !1,
value: e
}), Gp = (e) => ({
isOk: !1,
isErr: !0,
value: e
});
function ME(e, n) {
if (e.isOk) {
const r = n(e.value);
return r instanceof Promise ? r.then((a) => kl(a)) : kl(r);
}
if (e.isErr) {
const r = e.value;
return Gp(r);
}
throw "should never get here";
}
var xE = (e) => {
if (e.isOk)
return e.value;
throw e.value;
}, UE = (e) => {
if (e.isErr)
return e.value;
throw e.value;
}, Br = (e, n = "") => () => {
}, Le = (e, n, ...r) => {
let a = null, o = null, u = !1, c = !1;
const f = [], d = (m) => {
for (let _ = 0; _ < m.length; _++)
a = m[_], Array.isArray(a) ? d(a) : a != null && typeof a != "boolean" && ((u = typeof e != "function" && !ic(a)) && (a = String(a)), u && c ? f[f.length - 1].$text$ += a : f.push(u ? Ml(null, a) : a), c = u);
};
if (d(r), n) {
n.key && (o = n.key);
{
const m = n.className || n.class;
m && (n.class = typeof m != "object" ? m : Object.keys(m).filter((_) => m[_]).join(" "));
}
}
const h = Ml(e, null);
return h.$attrs$ = n, f.length > 0 && (h.$children$ = f), h.$key$ = o, h;
}, Ml = (e, n) => {
const r = {
$flags$: 0,
$tag$: e,
$text$: n,
$elm$: null,
$children$: null
};
return r.$attrs$ = null, r.$key$ = null, r;
}, BE = {}, jE = (e) => e && e.$tag$ === BE, ac = (e) => {
const n = LE(e);
return new RegExp(
// First capture group: match any context before the selector that's not inside @supports selector()
// Using negative lookahead to avoid matching inside @supports selector(...) condition
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${n}))(${n}\\b)`,
"g"
);
};
ac("::slotted");
ac(":host");
ac(":host-context");
var Vp = (e, n) => e != null && !ic(e) && n & 1 ? String(e) : e, zE = (e) => e, Sh = (e, n, r) => {
const a = zE(e);
return {
emit: (o) => qp(a, n, {
bubbles: !0,
composed: !0,
cancelable: !0,
detail: o
})
};
}, qp = (e, n, r) => {
const a = Ur.ce(n, r);
return e.dispatchEvent(a), a;
}, bi = /* @__PURE__ */ new WeakMap(), GE = (e, n, r) => {
let a = ao.get(e);
Bp && r ? (a = a || new CSSStyleSheet(), typeof a == "string" ? a = n : a.replaceSync(n)) : a = n, ao.set(e, a);
}, VE = (e, n, r) => {
var a;
const o = Kp(n), u = ao.get(o);
if (!Sn.document)
return o;
if (e = e.nodeType === 11 ? e : Sn.document, u)
if (typeof u == "string") {
e = e.head || e;
let c = bi.get(e), f;
if (c || bi.set(e, c = /* @__PURE__ */ new Set()), !c.has(o)) {
{
f = document.querySelector(`[${TE}="${o}"]`) || Sn.document.createElement("style"), f.innerHTML = u;
const d = (a = Ur.$nonce$) != null ? a : FE(Sn.document);
if (d != null && f.setAttribute("nonce", d), !(n.$flags$ & 1))
if (e.nodeName === "HEAD") {
const h = e.querySelectorAll("link[rel=preconnect]"), m = h.length > 0 ? h[h.length - 1].nextSibling : e.querySelector("style");
e.insertBefore(
f,
(m == null ? void 0 : m.parentNode) === e ? m : null
);
} else if ("host" in e)
if (Bp) {
const h = new CSSStyleSheet();
h.replaceSync(u), e.adoptedStyleSheets = [h, ...e.adoptedStyleSheets];
} else {
const h = e.querySelector("style");
h ? h.innerHTML = u + h.innerHTML : e.prepend(f);
}
else
e.append(f);
n.$flags$ & 1 && e.insertBefore(f, null);
}
n.$flags$ & 4 && (f.innerHTML += IE), c && c.add(o);
}
} else e.adoptedStyleSheets.includes(u) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, u]);
return o;
}, qE = (e) => {
const n = e.$cmpMeta$, r = e.$hostElement$, a = Br("attachStyles", n.$tagName$);
VE(
r.getRootNode(),
n
), a();
}, Kp = (e, n) => "sc-" + e.$tagName$, Ah = (e, n, r, a, o, u, c) => {
if (r === a)
return;
let f = bh(e, n), d = n.toLowerCase();
if (n === "class") {
const h = e.classList, m = Oh(r);
let _ = Oh(a);
h.remove(...m.filter((b) => b && !_.includes(b))), h.add(..._.filter((b) => b && !m.includes(b)));
} else if (n === "style") {
for (const h in r)
(!a || a[h] == null) && (h.includes("-") ? e.style.removeProperty(h) : e.style[h] = "");
for (const h in a)
(!r || a[h] !== r[h]) && (h.includes("-") ? e.style.setProperty(h, a[h]) : e.style[h] = a[h]);
} else if (n !== "key") if (!e.__lookupSetter__(n) && n[0] === "o" && n[1] === "n") {
if (n[2] === "-" ? n = n.slice(3) : bh(Sn, d) ? n = d.slice(2) : n = d[2] + n.slice(3), r || a) {
const h = n.endsWith(Hp);
n = n.replace(HE, ""), r && Ur.rel(e, n, r, h), a && Ur.ael(e, n, a, h);
}
} else {
const h = ic(a);
if (f || h && a !== null)
try {
if (e.tagName.includes("-"))
e[n] !== a && (e[n] = a);
else {
const m = a ?? "";
n === "list" ? f = !1 : (r == null || e[n] != m) && (typeof e.__lookupSetter__(n) == "function" ? e[n] = m : e.setAttribute(n, m));
}
} catch {
}
a == null || a === !1 ? (a !== !1 || e.getAttribute(n) === "") && e.removeAttribute(n) : (!f || u & 4 || o) && !h && e.nodeType === 1 && (a = a === !0 ? "" : a, e.setAttribute(n, a));
}
}, KE = /\s/, Oh = (e) => (typeof e == "object" && e && "baseVal" in e && (e = e.baseVal), !e || typeof e != "string" ? [] : e.split(KE)), Hp = "Capture", HE = new RegExp(Hp + "$"), Wp = (e, n, r, a) => {
const o = n.$elm$.nodeType === 11 && n.$elm$.host ? n.$elm$.host : n.$elm$, u = e && e.$attrs$ || {}, c = n.$attrs$ || {};
for (const f of Ch(Object.keys(u)))
f in c || Ah(
o,
f,
u[f],
void 0,
r,
n.$flags$
);
for (const f of Ch(Object.keys(c)))
Ah(
o,
f,
u[f],
c[f],
r,
n.$flags$
);
};
function Ch(e) {
return e.includes("ref") ? (
// we need to sort these to ensure that `'ref'` is the last attr
[...e.filter((n) => n !== "ref"), "ref"]
) : (
// no need to sort, return the original array
e
);
}
var Jp, Yp = !1, so = (e, n, r) => {
const a = n.$children$[r];
let o = 0, u, c;
if (a.$text$ !== null)
u = a.$elm$ = Sn.document.createTextNode(a.$text$);
else {
if (!Sn.document)
throw new Error(
"You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
);
if (u = a.$elm$ = Sn.document.createElement(
a.$tag$
), Wp(null, a, Yp), a.$children$)
for (o = 0; o < a.$children$.length; ++o)
c = so(e, a, o), c && u.appendChild(c);
}
return u["s-hn"] = Jp, u;
}, Zp = (e, n, r, a, o, u) => {
let c = e, f;
for (; o <= u; ++o)
a[o] && (f = so(null, r, o), f && (a[o].$elm$ = f, Ys(c, f, n)));
}, Xp = (e, n, r) => {
for (let a = n; a <= r; ++a) {
const o = e[a];
if (o) {
const u = o.$elm$;
u && u.remove();
}
}
}, WE = (e, n, r, a, o = !1) => {
let u = 0, c = 0, f = 0, d = 0, h = n.length - 1, m = n[0], _ = n[h], b = a.length - 1, w = a[0], A = a[b], N, C;
for (; u <= h && c <= b; )
if (m == null)
m = n[++u];
else if (_ == null)
_ = n[--h];
else if (w == null)
w = a[++c];
else if (A == null)
A = a[--b];
else if (Us(m, w, o))
vi(m, w, o), m = n[++u], w = a[++c];
else if (Us(_, A, o))
vi(_, A, o), _ = n[--h], A = a[--b];
else if (Us(m, A, o))
vi(m, A, o), Ys(e, m.$elm$, _.$elm$.nextSibling), m = n[++u], A = a[--b];
else if (Us(_, w, o))
vi(_, w, o), Ys(e, _.$elm$, m.$elm$), _ = n[--h], w = a[++c];
else {
for (f = -1, d = u; d <= h; ++d)
if (n[d] && n[d].$key$ !== null && n[d].$key$ === w.$key$) {
f = d;
break;
}
f >= 0 ? (C = n[f], C.$tag$ !== w.$tag$ ? N = so(n && n[c], r, f) : (vi(C, w, o), n[f] = void 0, N = C.$elm$), w = a[++c]) : (N = so(n && n[c], r, c), w = a[++c]), N && Ys(m.$elm$.parentNode, N, m.$elm$);
}
u > h ? Zp(
e,
a[b + 1] == null ? null : a[b + 1].$elm$,
r,
a,
c,
b
) : c > b && Xp(n, u, h);
}, Us = (e, n, r = !1) => e.$tag$ === n.$tag$ ? r ? (r && !e.$key$ && n.$key$ && (e.$key$ = n.$key$), !0) : e.$key$ === n.$key$ : !1, vi = (e, n, r = !1) => {
const a = n.$elm$ = e.$elm$, o = e.$children$, u = n.$children$, c = n.$text$;
c === null ? (Wp(e, n, Yp), o !== null && u !== null ? WE(a, o, n, u, r) : u !== null ? (e.$text$ !== null && (a.textContent = ""), Zp(a, null, n, u, 0, u.length - 1)) : (
// don't do this on initial render as it can cause non-hydrated content to be removed
!r && bo.updatable && o !== null && Xp(o, 0, o.length - 1)
)) : e.$text$ !== c && (a.data = c);
}, Ys = (e, n, r) => e == null ? void 0 : e.insertBefore(n, r), JE = (e, n, r = !1) => {
const a = e.$hostElement$, o = e.$vnode$ || Ml(null, null), c = jE(n) ? n : Le(null, null, n);
if (Jp = a.tagName, r && c.$attrs$)
for (const f of Object.keys(c.$attrs$))
a.hasAttribute(f) && !["key", "ref", "style", "class"].includes(f) && (c.$attrs$[f] = a[f]);
c.$tag$ = null, c.$flags$ |= 4, e.$vnode$ = c, c.$elm$ = o.$elm$ = a, vi(o, c, r);
}, Qp = (e, n) => {
if (n && !e.$onRenderResolve$ && n["s-p"]) {
const r = n["s-p"].push(
new Promise(
(a) => e.$onRenderResolve$ = () => {
n["s-p"].splice(r - 1, 1), a();
}
)
);
}
}, sc = (e, n) => {
if (e.$flags$ |= 16, e.$flags$ & 4) {
e.$flags$ |= 512;
return;
}
return Qp(e, e.$ancestorComponent$), DE(() => YE(e, n));
}, YE = (e, n) => {
const r = e.$hostElement$, a = Br("scheduleUpdate", e.$cmpMeta$.$tagName$), o = r;
if (!o)
throw new Error(
`Can't render component <${r.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
);
let u;
return n ? u = Si(o, "componentWillLoad", void 0, r) : u = Si(o, "componentWillUpdate", void 0, r), u = Th(u, () => Si(o, "componentWillRender", void 0, r)), a(), Th(u, () => XE(e, o, n));
}, Th = (e, n) => ZE(e) ? e.then(n).catch((r) => {
console.error(r), n();
}) : n(), ZE = (e) => e instanceof Promise || e && e.then && typeof e.then == "function", XE = async (e, n, r) => {
var a;
const o = e.$hostElement$, u = Br("update", e.$cmpMeta$.$tagName$), c = o["s-rc"];
r && qE(e);
const f = Br("render", e.$cmpMeta$.$tagName$);
QE(e, n, o, r), c && (c.map((d) => d()), o["s-rc"] = void 0), f(), u();
{
const d = (a = o["s-p"]) != null ? a : [], h = () => e1(e);
d.length === 0 ? h() : (Promise.all(d).then(h), e.$flags$ |= 4, d.length = 0);
}
}, QE = (e, n, r, a) => {
try {
n = n.render(), e.$flags$ &= -17, e.$flags$ |= 2, JE(e, n, a);
} catch (o) {
Eo(o, e.$hostElement$);
}
return null;
}, e1 = (e) => {
const n = e.$cmpMeta$.$tagName$, r = e.$hostElement$, a = Br("postUpdate", n), o = r, u = e.$ancestorComponent$;
Si(o, "componentDidRender", void 0, r), e.$flags$ & 64 ? (Si(o, "componentDidUpdate", void 0, r), a()) : (e.$flags$ |= 64, n1(r), Si(o, "componentDidLoad", void 0, r), a(), e.$onReadyResolve$(r), u || t1()), e.$onRenderResolve$ && (e.$onRenderResolve$(), e.$onRenderResolve$ = void 0), e.$flags$ & 512 && rc(() => sc(e, !1)), e.$flags$ &= -517;
}, t1 = (e) => {
rc(() => qp(Sn, "appload", { detail: { namespace: wE } }));
}, Si = (e, n, r, a) => {
if (e && e[n])
try {
return e[n](r);
} catch (o) {
Eo(o, a);
}
}, n1 = (e) => {
var n;
return e.classList.add((n = bo.hydratedSelectorName) != null ? n : "hydrated");
}, r1 = (e, n) => xr(e).$instanceValues$.get(n), Ih = (e, n, r, a) => {
const o = xr(e), u = e, c = o.$instanceValues$.get(n), f = o.$flags$, d = u;
r = Vp(r, a.$members$[n][0]);
const h = Number.isNaN(c) && Number.isNaN(r);
if (r !== c && !h) {
o.$instanceValues$.set(n, r);
{
if (a.$watchers$ && f & 128) {
const _ = a.$watchers$[n];
_ && _.map((b) => {
try {
d[b](r, c, n);
} catch (w) {
Eo(w, u);
}
});
}
if ((f & 18) === 2) {
if (d.componentShouldUpdate && d.componentShouldUpdate(r, c, n) === !1)
return;
sc(o, !1);
}
}
}
}, i1 = (e, n, r) => {
var a, o;
const u = e.prototype;
if (n.$members$ || n.$watchers$ || e.watchers) {
e.watchers && !n.$watchers$ && (n.$watchers$ = e.watchers);
const c = Object.entries((a = n.$members$) != null ? a : {});
c.map(([f, [d]]) => {
if (d & 31 || d & 32) {
const { get: h, set: m } = Object.getOwnPropertyDescriptor(u, f) || {};
h && (n.$members$[f][0] |= 2048), m && (n.$members$[f][0] |= 4096), Object.defineProperty(u, f, {
get() {
return h ? h.apply(this) : r1(this, f);
},
configurable: !0,
enumerable: !0
}), Object.defineProperty(u, f, {
set(_) {
const b = xr(this);
if (m) {
const w = d & 32 ? this[f] : b.$hostElement$[f];
typeof w > "u" && b.$instanceValues$.get(f) ? _ = b.$instanceValues$.get(f) : !b.$instanceValues$.get(f) && w && b.$instanceValues$.set(f, w), m.apply(this, [Vp(_, d)]), _ = d & 32 ? this[f] : b.$hostElement$[f], Ih(this, f, _, n);
return;
}
{
Ih(this, f, _, n);
return;
}
}
});
}
});
{
const f = /* @__PURE__ */ new Map();
u.attributeChangedCallback = function(d, h, m) {
Ur.jmp(() => {
var _;
const b = f.get(d);
if (!(this.hasOwnProperty(b) && bo.lazyLoad)) {
if (u.hasOwnProperty(b) && typeof this[b] == "number" && // cast type to number to avoid TS compiler issues
this[b] == m)
return;
if (b == null) {
const A = xr(this), N = A == null ? void 0 : A.$flags$;
if (N && !(N & 8) && N & 128 && m !== h) {
const S = this, I = (_ = n.$watchers$) == null ? void 0 : _[d];
I == null || I.forEach((k) => {
S[k] != null && S[k].call(S, m, h, d);
});
}
return;
}
}
const w = Object.getOwnPropertyDescriptor(u, b);
m = m === null && typeof this[b] == "boolean" ? !1 : m, m !== this[b] && (!w.get || w.set) && (this[b] = m);
});
}, e.observedAttributes = Array.from(
/* @__PURE__ */ new Set([
...Object.keys((o = n.$watchers$) != null ? o : {}),
...c.filter(
([d, h]) => h[0] & 15
/* HasAttribute */
).map(([d, h]) => {
const m = h[1] || d;
return f.set(m, d), m;
})
])
);
}
}
return e;
}, Nh = async (e, n, r, a) => {
let o;
if ((n.$flags$ & 32) === 0) {
n.$flags$ |= 32;
{
o = e.constructor;
const f = e.localName;
customElements.whenDefined(f).then(
() => n.$flags$ |= 128
/* isWatchReady */
);
}
if (o && o.style) {
let f;
typeof o.style == "string" && (f = o.style);
const d = Kp(r);
if (!ao.has(d)) {
const h = Br("registerStyles", r.$tagName$);
GE(d, f, !!(r.$flags$ & 1)), h();
}
}
}
const u = n.$ancestorComponent$, c = () => sc(n, !0);
u && u["s-rc"] ? u["s-rc"].push(c) : c();
}, a1 = (e, n) => {
}, s1 = (e) => {
{
const n = xr(e), r = n.$cmpMeta$, a = Br("connectedCallback", r.$tagName$);
if (n.$flags$ & 1)
n != null && n.$lazyInstance$ || n != null && n.$onReadyPromise$ && n.$onReadyPromise$.then(() => a1());
else {
n.$flags$ |= 1;
{
let o = e;
for (; o = o.parentNode || o.host; )
if (o["s-p"]) {
Qp(n, n.$ancestorComponent$ = o);
break;
}
}
r.$members$ && Object.entries(r.$members$).map(([o, [u]]) => {
if (u & 31 && e.hasOwnProperty(o)) {
const c = e[o];
delete e[o], e[o] = c;
}
}), bo.initializeNextTick ? rc(() => Nh(e, n, r)) : Nh(e, n, r);
}
a();
}
}, o1 = async (e) => {
xr(e), bi.has(e) && bi.delete(e), e.shadowRoot && bi.has(e.shadowRoot) && bi.delete(e.shadowRoot);
}, u1 = (e, n) => {
const r = {
$flags$: n[0],
$tagName$: n[1]
};
r.$members$ = n[2], r.$watchers$ = e.$watchers$;
const a = e.prototype.connectedCallback, o = e.prototype.disconnectedCallback;
return Object.assign(e.prototype, {
__hasHostListenerAttached: !1,
__registerHost() {
CE(this, r);
},
connectedCallback() {
this.__hasHostListenerAttached || (xr(this), this.__hasHostListenerAttached = !0), s1(this), a && a.call(this);
},
disconnectedCallback() {
o1(this), o && o.call(this);
},
__attachShadow() {
this.shadowRoot = this;
}
}), e.is = r.$tagName$, i1(e, r);
};
function it(e, n, r, a) {
Object.defineProperty(e, n, {
get: r,
set: a,
enumerable: !0,
configurable: !0
});
}
function sn(e, n) {
return Object.keys(n).forEach(function(r) {
r === "default" || r === "__esModule" || Object.prototype.hasOwnProperty.call(e, r) || Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return n[r];
}
});
}), e;
}
var l1 = {};
it(l1, "basistheory", () => oc);
const c1 = (e) => {
const n = document.querySelector(`script[src^="${e}"]`);
if (n) return n;
const r = document.head || document.body;
if (!r) throw new Error("No <head> or <body> elements found in the document.");
const a = Object.assign(document.createElement("script"), {
src: e
});
return r.append(a), a;
}, xl = "Tried to load BasisTheoryElements in a non-DOM environment.", f1 = "Basis Theory Elements did not load properly. Check network tab for more details.", ml = "Unable to load the Elements script. This may be due to network restrictions or browser extensions like ad blockers interfering with script loading. Check browser settings or network connection and try again.", Ph = "https://undefined", pr = /* @__PURE__ */ (() => {
const e = "pubb96b84a13912504f4354f2d794ea4fab";
let n = !0;
const r = async (o, u, c = {}) => {
if (!n) return;
let f;
Ph.includes("localhost") ? f = "local" : Ph.includes("dev") ? f = "dev" : f = "prod";
const d = {
level: (
// dd info
u
),
message: o,
// for basis theory tracking
service: "web-elements-loader",
env: f,
// browser information
referrer: document == null ? void 0 : document.referrer,
origin: window == null ? void 0 : window.location.origin,
url: window == null ? void 0 : window.location.href,
userAgent: navigator == null ? void 0 : navigator.userAgent,
// custom values
...c
};
try {
await fetch(`https://http-intake.logs.datadoghq.com/v1/input/${e}`, {
method: "POST",
body: JSON.stringify(d),
headers: {
"Content-Type": "application/json"
}
});
} catch {
console.warn("There was an error sending telemetry.");
}
};
return {
setTelemetryEnabled: (o) => {
n = o;
},
log: {
error: (o, u = {}) => r(o, "error", u),
info: (o, u = {}) => r(o, "info", u),
warn: (o, u = {}) => r(o, "warn", u)
}
};
})();
let gl;
const em = (e, n) => new Promise((r, a) => {
let o = c1(e), u = !1;
o.addEventListener("load", () => {
window.BasisTheoryElements ? r(window.BasisTheoryElements) : ((async () => await pr.log.error("Elements not found on window on load", {
logType: "elementsNotFoundOnWindow",
logOrigin: "loadScript",
retryCount: n
}))(), a(new Error(f1)));
}), o.addEventListener("error", async (c) => {
if (!u) {
u = !0, await pr.log.error("Elements script onError event", {
logType: "elementsScriptOnError",
logOrigin: "loadScript",
retryCount: n,
event: {
message: c == null ? void 0 : c.message,
source: c == null ? void 0 : c.filename,
lineno: c == null ? void 0 : c.lineno,
colno: c == null ? void 0 : c.colno,
error: c == null ? void 0 : c.error,
target: c == null ? void 0 : c.target
}
});
try {
o == null || o.remove();
} catch (f) {
await pr.log.error(`Error removing script from DOM on retry attempt ${n}`, {
logType: "scriptRemovalError",
logOrigin: "loadScript",
retryCount: n,
removalError: f
});
}
if (n === 0) {
em(e, n + 1).then(r).catch(a);
return;
}
try {
const f = await fetch(e);
f.ok ? (await pr.log.error("Second attempt to load elements script failed, fetch success", {
logType: "elementsScriptFetchFailure",
logOrigin: "loadScript",
retryCount: n,
fetchResult: "success",
fetchResponse: f
}), a(new Error(ml))) : (await pr.log.error(`Second attempt to load elements script failed, fetch failed with status: ${f.status}.`, {
logType: "elementsScriptFetchFailure",
logOrigin: "loadScript",
retryCount: n,
fetchResult: "error",
fetchResponse: f
}), a(new Error(xl)));
} catch (f) {
await pr.log.error("Second attempt failed to load elements script failed, fetch network error.", {
logType: "elementsScriptFetchError",
logOrigin: "loadScript",
retryCount: n,
fetchResult: "error",
fetchError: f
}), a(new Error(ml));
}
a((c == null ? void 0 : c.error) || (c == null ? void 0 : c.message) || new Error(ml));
}
});
}), d1 = (e) => (gl || (gl = new Promise((n, r) => {
if (typeof window != "object") {
(async () => (await pr.log.warn(xl, {
logType: "elementsNonDomError",
logOrigin: "loadElements"
}), r(new Error(xl))))();
return;
}
if (window.BasisTheoryElements) {
n(window.BasisTheoryElements);
return;
}
let a = "https://undefined/elements";
if (typeof e < "u") try {
a = new URL(e).toString().replace(/\/$/u, "");
} catch {
throw (async () => await pr.log.warn("Invalid format for the given Elements client url.", {
logType: "invalidClientUrlError",
logOrigin: "loadElements"
}))(), new Error("Invalid format for the given Elements client url.");
}
em(a, 0).then(n).catch((o) => {
r(o);
});
})), gl);
var Ul = {};
const h1 = "1.8.0";
Ul = {
version: h1
};
const p1 = "js.flock-dev.com", m1 = "js.basistheory.com", oc = async (e, n) => {
if (!e || e.length === 0) throw new Error("API key is required");
const r = n != null && n._devMode ? p1 : m1;
return (await d1(`https://${r}/web-elements/${Ul.version}/client/index.js`)).init(e, `https://${r}/web-elements/${Ul.version}/hosted-elements/`, !1, (n == null ? void 0 : n.disableTelemetry) ?? !1, (n == null ? void 0 : n.useSameOriginApi) ?? !1);
};
var g1 = {}, yr = {}, Ut = {};
it(Ut, "VISA", () => tm);
it(Ut, "MASTERCARD", () => nm);
it(Ut, "AMERICAN_EXPRESS", () => rm);
it(Ut, "DINERS_CLUB", () => im);
it(Ut, "DISCOVER", () => am);
it(Ut, "JCB", () => sm);
it(Ut, "UNION_PAY", () => om);
it(Ut, "MAESTRO", () => um);
it(Ut, "ELO", () => lm);
it(Ut, "MIR", () => cm);
it(Ut, "HIPER", () => fm);
it(Ut, "HIPERCARD", () => dm);
it(Ut, "DEFAULT_CARD_TYPES", () => y1);
const tm = {
niceType: "Visa",
type: "visa",
patterns: [4],
gaps: [4, 8, 12],
lengths: [16, 18, 19],
code: {
name: "CVV",
size: 3
}
}, nm = {
niceType: "Mastercard",
type: "mastercard",
patterns: [[51, 55], [2221, 2229], [223, 229], [23, 26], [270, 271], 2720],
gaps: [4, 8, 12],
lengths: [16],
code: {
name: "CVC",
size: 3
}
}, rm = {
niceType: "American Express",
type: "american-express",
patterns: [34, 37],
gaps: [4, 10],
lengths: [15],
code: {
name: "CID",
size: 4
}
}, im = {
niceType: "Diners Club",
type: "diners-club",
patterns: [[300, 305], 36, 38, 39],
gaps: [4, 10],
lengths: [14, 16, 19],
code: {
name: "CVV",
size: 3
}
}, am = {
niceType: "Discover",
type: "discover",
patterns: [6011, [644, 649], 65],
gaps: [4, 8, 12],
lengths: [16, 19],
code: {
name: "CID",
size: 3
}
}, sm = {
niceType: "JCB",
type: "jcb",
patterns: [2131, 1800, [3528, 3589]],
gaps: [4, 8, 12],
lengths: [16, 17, 18, 19],
code: {
name: "CVV",
size: 3
}
}, om = {
niceType: "UnionPay",
type: "unionpay",
patterns: [620, [62100, 62182], [62184, 62187], [62185, 62197], [62200, 62205], [622010, 622999], 622018, [62207, 62209], [623, 626], 6270, 6272, 6276, [627700, 627779], [627781, 627799], [6282, 6289], 6291, 6292, 810, [8110, 8131], [8132, 8151], [8152, 8163], [8164, 8171]],
gaps: [4, 8, 12],
lengths: [14, 15, 16, 17, 18, 19],
code: {
name: "CVN",
size: 3
}
}, um = {
niceType: "Maestro",
type: "maestro",
patterns: [493698, [5e5, 504174], [504176, 506698], [506779, 508999], [56, 59], 63, 67, 6],
gaps: [4, 8, 12],
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
code: {
name: "CVC",
size: 3
}
}, lm = {
niceType: "Elo",
type: "elo",
patterns: [401178, 401179, 438935, 457631, 457632, 431274, 451416, 457393, 504175, [506699, 506778], [509e3, 509999], 627780, 636297, 636368, [650031, 650033], [650035, 650051], [650405, 650439], [650485, 650538], [650541, 650598], [650700, 650718], [650720, 650727], [650901, 650978], [651652, 651679], [655e3, 655019], [655021, 655058]],
gaps: [4, 8, 12],
lengths: [16],
code: {
name: "CVE",
size: 3
}
}, cm = {
niceType: "Mir",
type: "mir",
patterns: [[2200, 2204]],
gaps: [4, 8, 12],
lengths: [16, 17, 18, 19],
code: {
name: "CVP2",
size: 3
}
}, fm = {
niceType: "Hiper",
type: "hiper",
patterns: [637095, 63737423, 63743358, 637568, 637599, 637609, 637612],
gaps: [4, 8, 12],
lengths: [16],
code: {
name: "CVC",
size: 3
}
}, dm = {
niceType: "Hipercard",
type: "hipercard",
patterns: [606282],
gaps: [4, 8, 12],
lengths: [16],
code: {
name: "CVC",
size: 3
}
}, y1 = [tm, nm, rm, im, am, sm, om, um, lm, cm, fm, dm];
var _1 = {}, v1 = {}, hm = {};
it(hm, "ELEMENTS_TYPES", () => $1);
const $1 = ["card", "cardExpirationDate", "cardNumber", "cardVerificationCode", "data", "text"];
var Aa = {}, b1 = {}, E1 = {}, w1 = {}, S1 = {};
sn(Aa, b1);
sn(Aa, E1);
sn(Aa, w1);
sn(Aa, S1);
var A1 = {}, qr = {};
it(qr, "SAFE_CSS_PROPERTIES", () => pm);
it(qr, "SAFE_CSS_PROPERTIES_ALTERNATES", () => mm);
it(qr, "SAFE_CSS_PROPERTIES_WITH_ALTERNATES", () => O1);
it(qr, "CARD_ELEMENT_STYLE_VARIANT_SELECTORS", () => C1);
it(qr, "CARD_ELEMENT_STYLE_VARIANTS", () => T1);
it(qr, "CARD_ELEMENT_STYLE_FONTS_ATTR", () => I1);
const pm = ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "padding", "textDecoration", "textShadow", "textTransform"], mm = {
fontSmooth: ["-webkit-font-smoothing", "-moz-osx-font-smoothing"]
}, O1 = Object.keys(mm), C1 = [":hover", ":focus", ":read-only", "::placeholder", "::selection", ":disabled"], T1 = ["base", "complete", "invalid", "empty"], I1 = "fonts";
sn(yr, Ut);
sn(yr, _1);
sn(yr, v1);
sn(yr, hm);
sn(yr, Aa);
sn(yr, A1);
sn(yr, qr);
sn(g1, yr);
typeof window < "u" && document.currentScript && !window.basistheory && (window.basistheory = oc);
const Bl = Object.freeze({
BANK_ACCOUNT: "BANK_ACCOUNT",
CREDIT_CARD: "CREDIT_CARD",
DEBIT_CARD: "DEBIT_CARD"
}), Rh = Object.freeze({
CHECKING: "CHECKING",
SAVINGS: "SAVINGS"
}), an = Object.freeze({
US: "US",
CA: "CA"
}), zn = Object.freeze({
VISA: "Visa",
MASTERCARD: "Mastercard",
AMERICAN_EXPRESS: "American Express",
DINERS_CLUB: "Diners Club",
DISCOVER: "Discover",
JCB: "JCB",
UNION_PAY: "UnionPay",
MAESTRO: "Maestro",
DEBIT: "Debit"
});
async function N1(e, n = "", r = {}) {
const a = new Headers();
a.append("Authorization", e);
const o = await fetch(n, {
method: "PUT",
headers: a,
referrerPolicy: "strict-origin-when-cross-origin",
body: JSON.stringify(r)
});
if (!o.ok) {
let u = await o.json();
throw u.statusCode || (u = {
...u,
statusCode: o.status
}), u;
}
return o.json();
}
const P1 = (e, n) => {
const r = e, a = n;
return {
/**
* @async
* @type {function} putPaymentMethod
* @param {paymentMethodPutPayload} payload
* @return {Promise<paymentMethodPutResponse>}
*/
putPaymentMethod: async (o) => N1(a, `${r}/payment-methods`, {
...o
})
};
}, oo = async (e) => {
try {
return [await e, null];
} catch (n) {
return [null, n];
}
};
var Ct = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Kr(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function R1(e) {
if (e.__esModule) return e;
var n = e.default;
if (typeof n == "function") {
var r = function a() {
return this instanceof a ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
};
r.prototype = n.prototype;
} else r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(a) {
var o = Object.getOwnPropertyDescriptor(e, a);
Object.defineProperty(r, a, o.get ? o : {
enumerable: !0,
get: function() {
return e[a];
}
});
}), r;
}
var jl = { exports: {} }, gm = {}, Gn = {}, Ir = {}, yl = {}, _l = {}, vl = {}, Dh;
function uo() {
return Dh || (Dh = 1, function(e) {
Object.defineProperty(e, "__esModule", {
value: !0
}), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
class n {
}
e._CodeOrName = n, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
class r extends n {
constructor(I) {
if (super(), !e.IDENTIFIER.test(I)) throw new Error("CodeGen: name must be a valid identifier");
this.str = I;
}
toString() {
return this.str;
}
emptyStr() {
return !1;
}
get names() {
return {
[this.str]: 1
};
}
}
e.Name = r;
class a extends n {
constructor(I) {
super(), this._items = typeof I == "string" ? [I] : I;
}
toString() {
return this.str;
}
emptyStr() {
if (this._items.length > 1) return !1;
const I = this._items[0];
return I === "" || I === '""';
}
get str() {
var I;
return (I = this._str) !== null && I !== void 0 ? I : this._str = this._items.reduce((k, z) => `${k}${z}`, "");
}
get names() {
var I;
return (I = this._names) !== null && I !== void 0 ? I : this._names = this._items.reduce((k, z) => (z instanceof r && (k[z.str] = (k[z.str] || 0) + 1), k), {});
}
}
e._Code = a, e.nil = new a("");
function o(S, ...I) {
const k = [S[0]];
let z = 0;
for (; z < I.length; )
f(k, I[z]), k.push(S[++z]);
return new a(k);
}
e._ = o;
const u = new a("+");
function c(S, ...I) {
const k = [w(S[0])];
let z = 0;
for (; z < I.length; )
k.push(u), f(k, I[z]), k.push(u, w(S[++z]));
return d(k), new a(k);
}
e.str = c;
function f(S, I) {
I instanceof a ? S.push(...I._items) : I instanceof r ? S.push(I) : S.push(_(I));
}
e.addCodeArg = f;
function d(S) {
let I = 1;
for (; I < S.length - 1; ) {
if (S[I] === u) {
const k = h(S[I - 1], S[I + 1]);
if (k !== void 0) {
S.splice(I - 1, 3, k);
continue;
}
S[I++] = "+";
}
I++;
}
}
function h(S, I) {
if (I === '""') return S;
if (S === '""') return I;
if (typeof S == "string")
return I instanceof r || S[S.length - 1] !== '"' ? void 0 : typeof I != "string" ? `${S.slice(0, -1)}${I}"` : I[0] === '"' ? S.slice(0, -1) + I.slice(1) : void 0;
if (typeof I == "string" && I[0] === '"' && !(S instanceof r)) return `"${S}${I.slice(1)}`;
}
function m(S, I) {
return I.emptyStr() ? S : S.emptyStr() ? I : c`${S}${I}`;
}
e.strConcat = m;
function _(S) {
return typeof S == "number" || typeof S == "boolean" || S === null ? S : w(Array.isArray(S) ? S.join(",") : S);
}
function b(S) {
return new a(w(S));
}
e.stringify = b;
function w(S) {
return JSON.stringify(S).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
}
e.safeStringify = w;
function A(S) {
return typeof S == "string" && e.IDENTIFIER.test(S) ? new a(`.${S}`) : o`[${S}]`;
}
e.getProperty = A;
function N(S) {
if (typeof S == "string" && e.IDENTIFIER.test(S))
return new a(`${S}`);
throw new Error(`CodeGen: invalid export name: ${S}, use explicit $id name mapping`);
}
e.getEsmExportName = N;
function C(S) {
return new a(S.toString());
}
e.regexpCode = C;
}(vl)), vl;
}
var $l = {}, Fh;
function Lh() {
return Fh || (Fh = 1, function(e) {
Object.defineProperty(e, "__esModule", {
value: !0
}), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
const n = uo();
class r extends Error {
constructor(h) {
super(`CodeGen: "code" for ${h} not defined`), this.value = h.value;
}
}
var a;
(function(d) {
d[d.Started = 0] = "Started", d[d.Completed = 1] = "Completed";
})(a || (e.UsedValueState = a = {})), e.varKinds = {
const: new n.Name("const"),
let: new n.Name("let"),
var: new n.Name("var")
};
class o {
constructor({
prefixes: h,
parent: m
} = {}) {
this._names = {}, this._prefixes = h, this._parent = m;
}
toName(h) {
return h instanceof n.Name ? h : this.name(h);
}
name(h) {
return new n.Name(this._newName(h));
}
_newName(h) {
const m = this._names[h] || this._nameGroup(h);
return `${h}${m.index++}`;
}
_nameGroup(h) {
var m, _;
if (!((_ = (m = this._parent) === null || m === void 0 ? void 0 : m._prefixes) === null || _ === void 0) && _.has(h) || this._prefixes && !this._prefixes.has(h))
throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);
return this._names[h] = {
prefix: h,
index: 0
};
}
}
e.Scope = o;
class u extends n.Name {
constructor(h, m) {
super(m), this.prefix = h;
}
setValue(h, {
property: m,
itemIndex: _
}) {
this.value = h, this.scopePath = (0, n._)`.${new n.Name(m)}[${_}]`;
}
}
e.ValueScopeName = u;
const c = (0, n._)`\n`;
class f extends o {
constructor(h) {
super(h), this._values = {}, this._scope = h.scope, this.opts = {
...h,
_n: h.lines ? c : n.nil
};
}
get() {
return this._scope;
}
name(h) {
return new u(h, this._newName(h));
}
value(h, m) {
var _;
if (m.ref === void 0) throw new Error("CodeGen: ref must be passed in value");
const b = this.toName(h), {
prefix: w
} = b, A = (_ = m.key) !== null && _ !== void 0 ? _ : m.ref;
let N = this._values[w];
if (N) {
const I = N.get(A);
if (I) return I;
} else
N = this._values[w] = /* @__PURE__ */ new Map();
N.set(A, b);
const C = this._scope[w] || (this._scope[w] = []), S = C.length;
return C[S] = m.ref, b.setValue(m, {
property: w,
itemIndex: S
}), b;
}
getValue(h, m) {
const _ = this._values[h];
if (_)
return _.get(m);
}
scopeRefs(h, m = this._values) {
return this._reduceValues(m, (_) => {
if (_.scopePath === void 0) throw new Error(`CodeGen: name "${_}" has no value`);
return (0, n._)`${h}${_.scopePath}`;
});
}
scopeCode(h = this._values, m, _) {
return this._reduceValues(h, (b) => {
if (b.value === void 0) throw new Error(`CodeGen: name "${b}" has no value`);
return b.value.code;
}, m, _);
}
_reduceValues(h, m, _ = {}, b) {
let w = n.nil;
for (const A in h) {
const N = h[A];
if (!N) continue;
const C = _[A] = _[A] || /* @__PURE__ */ new Map();
N.forEach((S) => {
if (C.has(S)) return;
C.set(S, a.Started);
let I = m(S);
if (I) {
const k = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
w = (0, n._)`${w}${k} ${S} = ${I};${this.opts._n}`;
} else if (I = b == null ? void 0 : b(S))
w = (0, n._)`${w}${I}${this.opts._n}`;
else
throw new r(S);
C.set(S, a.Completed);
});
}
return w;
}
}
e.ValueScope = f;
}($l)), $l;
}
var kh;
function Ce() {
return kh || (kh = 1, function(e) {
Object.defineProperty(e, "__esModule", {
value: !0
}), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0;
const n = uo(), r = Lh();
var a = uo();
Object.defineProperty(e, "_", {
enumerable: !0,
get: function() {
return a._;
}
}), Object.defineProperty(e, "str", {
enumerable: !0,
get: function() {
return a.str;
}
}), Object.defineProperty(e, "strConcat", {
enumerable: !0,
get: function() {
return a.strConcat;
}
}), Object.defineProperty(e, "nil", {
enumerable: !0,
get: function() {
return a.nil;
}
}), Object.defineProperty(e, "getProperty", {
enumerable: !0,
get: function() {
return a.getProperty;
}
}), Object.defineProperty(e, "stringify", {
enumerable: !0,
get: function() {
return a.stringify;
}
}), Object.defineProperty(e, "regexpCode", {
enumerable: !0,
get: function() {
return a.regexpCode;
}
}), Object.defineProperty(e, "Name", {
enumerable: !0,
get: function() {
return a.Name;
}
});
var o = Lh();
Object.defineProperty(e, "Scope", {
enumerable: !0,
get: function() {
return o.Scope;
}
}), Object.defineProperty(e, "ValueScope", {
enumerable: !0,
get: function() {
return o.ValueScope;
}
}), Object.defineProperty(e, "ValueScopeName", {
enumerable: !0,
get: function() {
return o.ValueScopeName;
}
}), Object.defineProperty(e, "varKinds", {
enumerable: !0,
get: function() {
return o.varKinds;
}
}), e.operators = {
GT: new n._Code(">"),
GTE: new n._Code(">="),
LT: new n._Code("<"),
LTE: new n._Code("<="),
EQ: new n._Code("==="),
NEQ: new n._Code("!=="),
NOT: new n._Code("!"),
OR: new n._Code("||"),
AND: new n._Code("&&"),
ADD: new n._Code("+")
};
class u {
optimizeNodes() {
return this;
}
optimizeNames(v, O) {
return this;
}
}
class c extends u {
constructor(v, O, j) {
super(), this.varKind = v, this.name = O, this.rhs = j;
}
render({
es5: v,
_n: O
}) {
const j = v ? r.varKinds.var : this.varKind, ie = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
return `${j} ${this.name}${ie};` + O;
}
optimizeNames(v, O) {
if (v[this.name.str])
return this.rhs && (this.rhs = le(this.rhs, v, O)), this;
}
get names() {
return this.rhs instanceof n._CodeOrName ? this.rhs.names : {};
}
}
class f extends u {
constructor(v, O, j) {
super(), this.lhs = v, this.rhs = O, this.sideEffects = j;
}
render({
_n: v
}) {
return `${this.lhs} = ${this.rhs};` + v;
}
optimizeNames(v, O) {
if (!(this.lhs instanceof n.Name && !v[this.lhs.str] && !this.sideEffects))
return this.rhs = le(this.rhs, v, O), this;
}
get names() {
const v = this.lhs instanceof n.Name ? {} : {
...this.lhs.names
};
return fe(v, this.rhs);
}
}
class d extends f {
constructor(v, O, j, ie) {
super(v, j, ie), this.op = O;
}
render({
_n: v
}) {
return `${this.lhs} ${this.op}= ${this.rhs};` + v;
}
}
class h extends u {
constructor(v) {
super(), this.label = v, this.names = {};
}
render({
_n: v
}) {
return `${this.label}:` + v;
}
}
class m extends u {
constructor(v) {
super(), this.label = v, this.names = {};
}
render({
_n: v
}) {
return `break${this.label ? ` ${this.label}` : ""};` + v;
}
}
class _ extends u {
constructor(v) {
super(), this.error = v;
}
render({
_n: v
}) {
return `throw ${this.error};` + v;
}
get names() {
return this.error.names;
}
}
class b extends u {
constructor(v) {
super(), this.code = v;
}
render({
_n: v
}) {
return `${this.code};` + v;
}
optimizeNodes() {
return `${this.code}` ? this : void 0;
}
optimizeNames(v, O) {
return this.code = le(this.code, v, O), this;
}
get names() {
return this.code instanceof n._CodeOrName ? this.code.names : {};
}
}
class w extends u {
constructor(v = []) {
super(), this.nodes = v;
}
render(v) {
return this.nodes.reduce((O, j) => O + j.render(v), "");
}
optimizeNodes() {
const {
nodes: v
} = this;
let O = v.length;
for (; O--; ) {
const j = v[O].optimizeNodes();
Array.isArray(j) ? v.splice(O, 1, ...j) : j ? v[O] = j : v.splice(O, 1);
}
return v.length > 0 ? this : void 0;
}
optimizeNames(v, O) {
const {
nodes: j
} = this;
let ie = j.length;
for (; ie--; ) {
const ne = j[ie];
ne.optimizeNames(v, O) || (Ye(v, ne.names), j.splice(ie, 1));
}
return j.length > 0 ? this : void 0;
}
get names() {
return this.nodes.reduce((v, O) => se(v, O.names), {});
}
}
class A extends w {
render(v) {
return "{" + v._n + super.render(v) + "}" + v._n;
}
}
class N extends w {
}
class C extends A {
}
C.kind = "else";
class S extends A {
constructor(v, O) {
super(O), this.condition = v;
}
render(v) {
let O = `if(${this.condition})` + super.render(v);
return this.else && (O += "else " + this.else.render(v)), O;
}
optimizeNodes() {
super.optimizeNodes();
const v = this.condition;
if (v === !0) return this.nodes;
let O = this.else;
if (O) {
const j = O.optimizeNodes();
O = this.else = Array.isArray(j) ? new C(j) : j;
}
if (O)
return v === !1 ? O instanceof S ? O : O.nodes : this.nodes.length ? this : new S(gt(v), O instanceof S ? [O] : O.nodes);
if (!(v === !1 || !this.nodes.length))
return this;
}
optimizeNames(v, O) {
var j;
if (this.else = (j = this.else) === null || j === void 0 ? void 0 : j.optimizeNames(v, O), !!(super.optimizeNames(v, O) || this.else))
return this.condition = le(this.condition, v, O), this;
}
get names() {
const v = super.names;
return fe(v, this.condition), this.else && se(v, this.else.names), v;
}
}
S.kind = "if";
class I extends A {
}
I.kind = "for";
class k extends I {
constructor(v) {
super(), this.iteration = v;
}
render(v) {
return `for(${this.iteration})` + super.render(v);
}
optimizeNames(v, O) {
if (super.optimizeNames(v, O))
return this.iteration = le(this.iteration, v, O), this;
}
get names() {
return se(super.names, this.iteration.names);
}
}
class z extends I {
constructor(v, O, j, ie) {
super(), this.varKind = v, this.name = O, this.from = j, this.to = ie;
}
render(v) {
const O = v.es5 ? r.varKinds.var : this.varKind, {
name: j,
from: ie,
to: ne
} = this;
return `for(${O} ${j}=${ie}; ${j}<${ne}; ${j}++)` + super.render(v);
}
get names() {
const v = fe(super.names, this.from);
return fe(v, this.to);
}
}
class H extends I {
constructor(v, O, j, ie) {
super(), this.loop = v, this.varKind = O, this.name = j, this.iterable = ie;
}
render(v) {
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(v);
}
optimizeNames(v, O) {
if (super.optimizeNames(v, O))
return this.iterable = le(this.iterable, v, O), this;
}
get names() {
return se(super.names, this.iterable.names);
}
}
class ee extends A {
constructor(v, O, j) {
super(), this.name = v, this.args = O, this.async = j;
}
render(v) {
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(v);
}
}
ee.kind = "func";
class ue extends w {
render(v) {
return "return " + super.render(v);
}
}
ue.kind = "return";
class _e extends A {
render(v) {
let O = "try" + sup