obi-sdk 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -65
- package/dist/{index-d9a81606.js → index-719ec57d.js} +792 -889
- package/dist/modular/chunks/{obi-widget-0d63936f.js → obi-widget-ff350828.js} +4 -4
- package/dist/modular/chunks/{obi-widget-0d63936f.js.map → obi-widget-ff350828.js.map} +1 -1
- package/dist/modular/chunks/{session-88fd0dca.js → session-c3b70ffb.js} +2 -2
- package/dist/modular/chunks/{session-88fd0dca.js.map → session-c3b70ffb.js.map} +1 -1
- package/dist/modular/core.js +5 -5
- package/dist/modular/index.js +220 -130
- package/dist/modular/index.js.map +1 -1
- package/dist/modular/ui.js +11 -11
- package/dist/obi-loader.js +5 -83
- package/dist/obi-sdk.es.js +5 -6
- package/dist/obi-sdk.standalone.iife.js +15 -15
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/obi-sdk.umd.js +41 -41
- package/dist/{session-c2549ff3.js → session-730ff76c.js} +1 -1
- package/package.json +2 -2
- package/dist/modular/chunks/assistant-5a47c1b4.js +0 -234
- package/dist/modular/chunks/assistant-5a47c1b4.js.map +0 -1
- package/dist/obi-loader.iife.js +0 -2
- package/dist/obi-loader.iife.js.map +0 -1
- package/dist/obi-loader.js.map +0 -1
- package/dist/obi-loader.umd.cjs +0 -2
- package/dist/obi-loader.umd.cjs.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as se, LitElement as ie, html as E, svg as lt, nothing as es } from "lit";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
const
|
|
8
|
-
let
|
|
7
|
+
const ft = globalThis, Kt = ft.ShadowRoot && (ft.ShadyCSS === void 0 || ft.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, gs = Symbol(), ts = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
let Ls = class {
|
|
9
9
|
constructor(e, t, i) {
|
|
10
|
-
if (this._$cssResult$ = !0, i !==
|
|
10
|
+
if (this._$cssResult$ = !0, i !== gs)
|
|
11
11
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
12
12
|
this.cssText = e, this.t = t;
|
|
13
13
|
}
|
|
14
14
|
get styleSheet() {
|
|
15
15
|
let e = this.o;
|
|
16
16
|
const t = this.t;
|
|
17
|
-
if (
|
|
17
|
+
if (Kt && e === void 0) {
|
|
18
18
|
const i = t !== void 0 && t.length === 1;
|
|
19
|
-
i && (e =
|
|
19
|
+
i && (e = ts.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ts.set(t, e));
|
|
20
20
|
}
|
|
21
21
|
return e;
|
|
22
22
|
}
|
|
@@ -24,29 +24,29 @@ let Ws = class {
|
|
|
24
24
|
return this.cssText;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
27
|
+
const zs = (s) => new Ls(typeof s == "string" ? s : s + "", void 0, gs), Vs = (s, e) => {
|
|
28
|
+
if (Kt)
|
|
29
29
|
s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
30
30
|
else
|
|
31
31
|
for (const t of e) {
|
|
32
|
-
const i = document.createElement("style"), r =
|
|
32
|
+
const i = document.createElement("style"), r = ft.litNonce;
|
|
33
33
|
r !== void 0 && i.setAttribute("nonce", r), i.textContent = t.cssText, s.appendChild(i);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, ss = Kt ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
|
|
36
36
|
let t = "";
|
|
37
37
|
for (const i of e.cssRules)
|
|
38
38
|
t += i.cssText;
|
|
39
|
-
return
|
|
39
|
+
return zs(t);
|
|
40
40
|
})(s) : s;
|
|
41
41
|
/**
|
|
42
42
|
* @license
|
|
43
43
|
* Copyright 2017 Google LLC
|
|
44
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
45
|
*/
|
|
46
|
-
const { is:
|
|
46
|
+
const { is: Bs, defineProperty: Fs, getOwnPropertyDescriptor: Hs, getOwnPropertyNames: Ws, getOwnPropertySymbols: Ks, getPrototypeOf: qs } = Object, pe = globalThis, is = pe.trustedTypes, Gs = is ? is.emptyScript : "", Pt = pe.reactiveElementPolyfillSupport, Be = (s, e) => s, gt = { toAttribute(s, e) {
|
|
47
47
|
switch (e) {
|
|
48
48
|
case Boolean:
|
|
49
|
-
s = s ?
|
|
49
|
+
s = s ? Gs : null;
|
|
50
50
|
break;
|
|
51
51
|
case Object:
|
|
52
52
|
case Array:
|
|
@@ -71,8 +71,8 @@ const { is: Ks, defineProperty: qs, getOwnPropertyDescriptor: Gs, getOwnProperty
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
return t;
|
|
74
|
-
} },
|
|
75
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
74
|
+
} }, qt = (s, e) => !Bs(s, e), rs = { attribute: !0, type: String, converter: gt, reflect: !1, useDefault: !1, hasChanged: qt };
|
|
75
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), pe.litPropertyMetadata ?? (pe.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
76
76
|
let Ue = class extends HTMLElement {
|
|
77
77
|
static addInitializer(e) {
|
|
78
78
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
@@ -80,14 +80,14 @@ let Ue = class extends HTMLElement {
|
|
|
80
80
|
static get observedAttributes() {
|
|
81
81
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
82
82
|
}
|
|
83
|
-
static createProperty(e, t =
|
|
83
|
+
static createProperty(e, t = rs) {
|
|
84
84
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
85
85
|
const i = Symbol(), r = this.getPropertyDescriptor(e, i, t);
|
|
86
|
-
r !== void 0 &&
|
|
86
|
+
r !== void 0 && Fs(this.prototype, e, r);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
static getPropertyDescriptor(e, t, i) {
|
|
90
|
-
const { get: r, set: n } =
|
|
90
|
+
const { get: r, set: n } = Hs(this.prototype, e) ?? { get() {
|
|
91
91
|
return this[t];
|
|
92
92
|
}, set(a) {
|
|
93
93
|
this[t] = a;
|
|
@@ -98,19 +98,19 @@ let Ue = class extends HTMLElement {
|
|
|
98
98
|
}, configurable: !0, enumerable: !0 };
|
|
99
99
|
}
|
|
100
100
|
static getPropertyOptions(e) {
|
|
101
|
-
return this.elementProperties.get(e) ??
|
|
101
|
+
return this.elementProperties.get(e) ?? rs;
|
|
102
102
|
}
|
|
103
103
|
static _$Ei() {
|
|
104
|
-
if (this.hasOwnProperty(
|
|
104
|
+
if (this.hasOwnProperty(Be("elementProperties")))
|
|
105
105
|
return;
|
|
106
|
-
const e =
|
|
106
|
+
const e = qs(this);
|
|
107
107
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
108
108
|
}
|
|
109
109
|
static finalize() {
|
|
110
|
-
if (this.hasOwnProperty(
|
|
110
|
+
if (this.hasOwnProperty(Be("finalized")))
|
|
111
111
|
return;
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
const t = this.properties, i = [...
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(Be("properties"))) {
|
|
113
|
+
const t = this.properties, i = [...Ws(t), ...Ks(t)];
|
|
114
114
|
for (const r of i)
|
|
115
115
|
this.createProperty(r, t[r]);
|
|
116
116
|
}
|
|
@@ -133,9 +133,9 @@ let Ue = class extends HTMLElement {
|
|
|
133
133
|
if (Array.isArray(e)) {
|
|
134
134
|
const i = new Set(e.flat(1 / 0).reverse());
|
|
135
135
|
for (const r of i)
|
|
136
|
-
t.unshift(
|
|
136
|
+
t.unshift(ss(r));
|
|
137
137
|
} else
|
|
138
|
-
e !== void 0 && t.push(
|
|
138
|
+
e !== void 0 && t.push(ss(e));
|
|
139
139
|
return t;
|
|
140
140
|
}
|
|
141
141
|
static _$Eu(e, t) {
|
|
@@ -165,7 +165,7 @@ let Ue = class extends HTMLElement {
|
|
|
165
165
|
}
|
|
166
166
|
createRenderRoot() {
|
|
167
167
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
168
|
-
return
|
|
168
|
+
return Vs(e, this.constructor.elementStyles), e;
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
var e;
|
|
@@ -190,7 +190,7 @@ let Ue = class extends HTMLElement {
|
|
|
190
190
|
var n;
|
|
191
191
|
const i = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, i);
|
|
192
192
|
if (r !== void 0 && i.reflect === !0) {
|
|
193
|
-
const a = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter :
|
|
193
|
+
const a = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : gt).toAttribute(t, i.type);
|
|
194
194
|
this._$Em = e, a == null ? this.removeAttribute(r) : this.setAttribute(r, a), this._$Em = null;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -198,7 +198,7 @@ let Ue = class extends HTMLElement {
|
|
|
198
198
|
var n, a;
|
|
199
199
|
const i = this.constructor, r = i._$Eh.get(e);
|
|
200
200
|
if (r !== void 0 && this._$Em !== r) {
|
|
201
|
-
const o = i.getPropertyOptions(r), c = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter :
|
|
201
|
+
const o = i.getPropertyOptions(r), c = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : gt;
|
|
202
202
|
this._$Em = r, this[r] = c.fromAttribute(t, o.type) ?? ((a = this._$Ej) == null ? void 0 : a.get(r)) ?? null, this._$Em = null;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -206,7 +206,7 @@ let Ue = class extends HTMLElement {
|
|
|
206
206
|
var r;
|
|
207
207
|
if (e !== void 0) {
|
|
208
208
|
const n = this.constructor, a = this[e];
|
|
209
|
-
if (i ?? (i = n.getPropertyOptions(e)), !((i.hasChanged ??
|
|
209
|
+
if (i ?? (i = n.getPropertyOptions(e)), !((i.hasChanged ?? qt)(a, t) || i.useDefault && i.reflect && a === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(n._$Eu(e, i))))
|
|
210
210
|
return;
|
|
211
211
|
this.C(e, t, i);
|
|
212
212
|
}
|
|
@@ -286,13 +286,13 @@ let Ue = class extends HTMLElement {
|
|
|
286
286
|
firstUpdated(e) {
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
|
-
Ue.elementStyles = [], Ue.shadowRootOptions = { mode: "open" }, Ue[
|
|
289
|
+
Ue.elementStyles = [], Ue.shadowRootOptions = { mode: "open" }, Ue[Be("elementProperties")] = /* @__PURE__ */ new Map(), Ue[Be("finalized")] = /* @__PURE__ */ new Map(), Pt == null || Pt({ ReactiveElement: Ue }), (pe.reactiveElementVersions ?? (pe.reactiveElementVersions = [])).push("2.1.0");
|
|
290
290
|
/**
|
|
291
291
|
* @license
|
|
292
292
|
* Copyright 2017 Google LLC
|
|
293
293
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
294
294
|
*/
|
|
295
|
-
const
|
|
295
|
+
const Ys = { attribute: !0, type: String, converter: gt, reflect: !1, hasChanged: qt }, Js = (s = Ys, e, t) => {
|
|
296
296
|
const { kind: i, metadata: r } = t;
|
|
297
297
|
let n = globalThis.litPropertyMetadata.get(r);
|
|
298
298
|
if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(t.name, s), i === "accessor") {
|
|
@@ -313,8 +313,8 @@ const ei = { attribute: !0, type: String, converter: yt, reflect: !1, hasChanged
|
|
|
313
313
|
}
|
|
314
314
|
throw Error("Unsupported decorator location: " + i);
|
|
315
315
|
};
|
|
316
|
-
function
|
|
317
|
-
return (e, t) => typeof t == "object" ?
|
|
316
|
+
function w(s) {
|
|
317
|
+
return (e, t) => typeof t == "object" ? Js(s, e, t) : ((i, r, n) => {
|
|
318
318
|
const a = r.hasOwnProperty(n);
|
|
319
319
|
return r.constructor.createProperty(n, i), a ? Object.getOwnPropertyDescriptor(r, n) : void 0;
|
|
320
320
|
})(s, e, t);
|
|
@@ -324,16 +324,16 @@ function x(s) {
|
|
|
324
324
|
* Copyright 2017 Google LLC
|
|
325
325
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
326
326
|
*/
|
|
327
|
-
function
|
|
328
|
-
return
|
|
327
|
+
function ye(s) {
|
|
328
|
+
return w({ ...s, state: !0, attribute: !1 });
|
|
329
329
|
}
|
|
330
|
-
const j = Symbol.for("@ts-pattern/matcher"),
|
|
331
|
-
if (
|
|
330
|
+
const j = Symbol.for("@ts-pattern/matcher"), vs = Symbol.for("@ts-pattern/isVariadic"), vt = "@ts-pattern/anonymous-select-key", Ut = (s) => !!(s && typeof s == "object"), mt = (s) => s && !!s[j], I = (s, e, t) => {
|
|
331
|
+
if (mt(s)) {
|
|
332
332
|
const i = s[j](), { matched: r, selections: n } = i.match(e);
|
|
333
333
|
return r && n && Object.keys(n).forEach((a) => t(a, n[a])), r;
|
|
334
334
|
}
|
|
335
|
-
if (
|
|
336
|
-
if (!
|
|
335
|
+
if (Ut(s)) {
|
|
336
|
+
if (!Ut(e))
|
|
337
337
|
return !1;
|
|
338
338
|
if (Array.isArray(s)) {
|
|
339
339
|
if (!Array.isArray(e))
|
|
@@ -341,7 +341,7 @@ const j = Symbol.for("@ts-pattern/matcher"), ws = Symbol.for("@ts-pattern/isVari
|
|
|
341
341
|
let i = [], r = [], n = [];
|
|
342
342
|
for (const a of s.keys()) {
|
|
343
343
|
const o = s[a];
|
|
344
|
-
|
|
344
|
+
mt(o) && o[vs] ? n.push(o) : n.length ? r.push(o) : i.push(o);
|
|
345
345
|
}
|
|
346
346
|
if (n.length) {
|
|
347
347
|
if (n.length > 1)
|
|
@@ -355,16 +355,16 @@ const j = Symbol.for("@ts-pattern/matcher"), ws = Symbol.for("@ts-pattern/isVari
|
|
|
355
355
|
}
|
|
356
356
|
return Reflect.ownKeys(s).every((i) => {
|
|
357
357
|
const r = s[i];
|
|
358
|
-
return (i in e ||
|
|
358
|
+
return (i in e || mt(n = r) && n[j]().matcherType === "optional") && I(r, e[i], t);
|
|
359
359
|
var n;
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
return Object.is(e, s);
|
|
363
|
-
},
|
|
363
|
+
}, U = (s) => {
|
|
364
364
|
var e, t, i;
|
|
365
|
-
return
|
|
366
|
-
},
|
|
367
|
-
function
|
|
365
|
+
return Ut(s) ? mt(s) ? (e = (t = (i = s[j]()).getSelectionKeys) == null ? void 0 : t.call(i)) != null ? e : [] : Array.isArray(s) ? We(s, U) : We(Object.values(s), U) : [];
|
|
366
|
+
}, We = (s, e) => s.reduce((t, i) => t.concat(e(i)), []);
|
|
367
|
+
function Qs(...s) {
|
|
368
368
|
if (s.length === 1) {
|
|
369
369
|
const [e] = s;
|
|
370
370
|
return (t) => I(e, t, () => {
|
|
@@ -378,102 +378,102 @@ function si(...s) {
|
|
|
378
378
|
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${s.length}.`);
|
|
379
379
|
}
|
|
380
380
|
function P(s) {
|
|
381
|
-
return Object.assign(s, { optional: () =>
|
|
381
|
+
return Object.assign(s, { optional: () => Gt(s), and: (e) => k(s, e), or: (e) => ys(s, e), select: (e) => e === void 0 ? Ke(s) : Ke(e, s) });
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Lt(s) {
|
|
384
384
|
return Object.assign(((e) => Object.assign(e, { [Symbol.iterator]() {
|
|
385
385
|
let t = 0;
|
|
386
|
-
const i = [{ value: Object.assign(e, { [
|
|
386
|
+
const i = [{ value: Object.assign(e, { [vs]: !0 }), done: !1 }, { done: !0, value: void 0 }];
|
|
387
387
|
return { next: () => {
|
|
388
388
|
var r;
|
|
389
389
|
return (r = i[t++]) != null ? r : i.at(-1);
|
|
390
390
|
} };
|
|
391
|
-
} }))(s), { optional: () =>
|
|
391
|
+
} }))(s), { optional: () => Lt(Gt(s)), select: (e) => Lt(e === void 0 ? Ke(s) : Ke(e, s)) });
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function Gt(s) {
|
|
394
394
|
return P({ [j]: () => ({ match: (e) => {
|
|
395
395
|
let t = {};
|
|
396
396
|
const i = (r, n) => {
|
|
397
397
|
t[r] = n;
|
|
398
398
|
};
|
|
399
|
-
return e === void 0 ? (
|
|
400
|
-
}, getSelectionKeys: () =>
|
|
399
|
+
return e === void 0 ? (U(s).forEach((r) => i(r, void 0)), { matched: !0, selections: t }) : { matched: I(s, e, i), selections: t };
|
|
400
|
+
}, getSelectionKeys: () => U(s), matcherType: "optional" }) });
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const Xs = (s, e) => {
|
|
403
403
|
for (const t of s)
|
|
404
404
|
if (!e(t))
|
|
405
405
|
return !1;
|
|
406
406
|
return !0;
|
|
407
|
-
},
|
|
407
|
+
}, ei = (s, e) => {
|
|
408
408
|
for (const [t, i] of s.entries())
|
|
409
409
|
if (!e(i, t))
|
|
410
410
|
return !1;
|
|
411
411
|
return !0;
|
|
412
412
|
};
|
|
413
|
-
function
|
|
413
|
+
function k(...s) {
|
|
414
414
|
return P({ [j]: () => ({ match: (e) => {
|
|
415
415
|
let t = {};
|
|
416
416
|
const i = (r, n) => {
|
|
417
417
|
t[r] = n;
|
|
418
418
|
};
|
|
419
419
|
return { matched: s.every((r) => I(r, e, i)), selections: t };
|
|
420
|
-
}, getSelectionKeys: () =>
|
|
420
|
+
}, getSelectionKeys: () => We(s, U), matcherType: "and" }) });
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function ys(...s) {
|
|
423
423
|
return P({ [j]: () => ({ match: (e) => {
|
|
424
424
|
let t = {};
|
|
425
425
|
const i = (r, n) => {
|
|
426
426
|
t[r] = n;
|
|
427
427
|
};
|
|
428
|
-
return
|
|
429
|
-
}, getSelectionKeys: () =>
|
|
428
|
+
return We(s, U).forEach((r) => i(r, void 0)), { matched: s.some((r) => I(r, e, i)), selections: t };
|
|
429
|
+
}, getSelectionKeys: () => We(s, U), matcherType: "or" }) });
|
|
430
430
|
}
|
|
431
431
|
function b(s) {
|
|
432
432
|
return { [j]: () => ({ match: (e) => ({ matched: !!s(e) }) }) };
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Ke(...s) {
|
|
435
435
|
const e = typeof s[0] == "string" ? s[0] : void 0, t = s.length === 2 ? s[1] : typeof s[0] == "string" ? void 0 : s[0];
|
|
436
436
|
return P({ [j]: () => ({ match: (i) => {
|
|
437
|
-
let r = { [e ??
|
|
437
|
+
let r = { [e ?? vt]: i };
|
|
438
438
|
return { matched: t === void 0 || I(t, i, (n, a) => {
|
|
439
439
|
r[n] = a;
|
|
440
440
|
}), selections: r };
|
|
441
|
-
}, getSelectionKeys: () => [e ??
|
|
441
|
+
}, getSelectionKeys: () => [e ?? vt].concat(t === void 0 ? [] : U(t)) }) });
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function W(s) {
|
|
444
444
|
return typeof s == "number";
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function oe(s) {
|
|
447
447
|
return typeof s == "string";
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function ce(s) {
|
|
450
450
|
return typeof s == "bigint";
|
|
451
451
|
}
|
|
452
|
-
const
|
|
452
|
+
const _s = P(b(function(s) {
|
|
453
453
|
return !0;
|
|
454
|
-
})),
|
|
455
|
-
return
|
|
454
|
+
})), ti = _s, de = (s) => Object.assign(P(s), { startsWith: (e) => {
|
|
455
|
+
return de(k(s, (t = e, b((i) => oe(i) && i.startsWith(t)))));
|
|
456
456
|
var t;
|
|
457
457
|
}, endsWith: (e) => {
|
|
458
|
-
return
|
|
458
|
+
return de(k(s, (t = e, b((i) => oe(i) && i.endsWith(t)))));
|
|
459
459
|
var t;
|
|
460
|
-
}, minLength: (e) =>
|
|
461
|
-
return
|
|
460
|
+
}, minLength: (e) => de(k(s, ((t) => b((i) => oe(i) && i.length >= t))(e))), length: (e) => de(k(s, ((t) => b((i) => oe(i) && i.length === t))(e))), maxLength: (e) => de(k(s, ((t) => b((i) => oe(i) && i.length <= t))(e))), includes: (e) => {
|
|
461
|
+
return de(k(s, (t = e, b((i) => oe(i) && i.includes(t)))));
|
|
462
462
|
var t;
|
|
463
463
|
}, regex: (e) => {
|
|
464
|
-
return
|
|
464
|
+
return de(k(s, (t = e, b((i) => oe(i) && !!i.match(t)))));
|
|
465
465
|
var t;
|
|
466
|
-
} }),
|
|
466
|
+
} }), si = de(b(oe)), K = (s) => Object.assign(P(s), { between: (e, t) => K(k(s, ((i, r) => b((n) => W(n) && i <= n && r >= n))(e, t))), lt: (e) => K(k(s, ((t) => b((i) => W(i) && i < t))(e))), gt: (e) => K(k(s, ((t) => b((i) => W(i) && i > t))(e))), lte: (e) => K(k(s, ((t) => b((i) => W(i) && i <= t))(e))), gte: (e) => K(k(s, ((t) => b((i) => W(i) && i >= t))(e))), int: () => K(k(s, b((e) => W(e) && Number.isInteger(e)))), finite: () => K(k(s, b((e) => W(e) && Number.isFinite(e)))), positive: () => K(k(s, b((e) => W(e) && e > 0))), negative: () => K(k(s, b((e) => W(e) && e < 0))) }), ii = K(b(W)), le = (s) => Object.assign(P(s), { between: (e, t) => le(k(s, ((i, r) => b((n) => ce(n) && i <= n && r >= n))(e, t))), lt: (e) => le(k(s, ((t) => b((i) => ce(i) && i < t))(e))), gt: (e) => le(k(s, ((t) => b((i) => ce(i) && i > t))(e))), lte: (e) => le(k(s, ((t) => b((i) => ce(i) && i <= t))(e))), gte: (e) => le(k(s, ((t) => b((i) => ce(i) && i >= t))(e))), positive: () => le(k(s, b((e) => ce(e) && e > 0))), negative: () => le(k(s, b((e) => ce(e) && e < 0))) }), ri = le(b(ce)), ni = P(b(function(s) {
|
|
467
467
|
return typeof s == "boolean";
|
|
468
|
-
})),
|
|
468
|
+
})), ai = P(b(function(s) {
|
|
469
469
|
return typeof s == "symbol";
|
|
470
|
-
})),
|
|
470
|
+
})), oi = P(b(function(s) {
|
|
471
471
|
return s == null;
|
|
472
|
-
})),
|
|
472
|
+
})), ci = P(b(function(s) {
|
|
473
473
|
return s != null;
|
|
474
474
|
}));
|
|
475
|
-
var
|
|
476
|
-
return
|
|
475
|
+
var di = { __proto__: null, matcher: j, optional: Gt, array: function(...s) {
|
|
476
|
+
return Lt({ [j]: () => ({ match: (e) => {
|
|
477
477
|
if (!Array.isArray(e))
|
|
478
478
|
return { matched: !1 };
|
|
479
479
|
if (s.length === 0)
|
|
@@ -481,14 +481,14 @@ var pi = { __proto__: null, matcher: j, optional: Jt, array: function(...s) {
|
|
|
481
481
|
const t = s[0];
|
|
482
482
|
let i = {};
|
|
483
483
|
if (e.length === 0)
|
|
484
|
-
return
|
|
484
|
+
return U(t).forEach((n) => {
|
|
485
485
|
i[n] = [];
|
|
486
486
|
}), { matched: !0, selections: i };
|
|
487
487
|
const r = (n, a) => {
|
|
488
488
|
i[n] = (i[n] || []).concat([a]);
|
|
489
489
|
};
|
|
490
490
|
return { matched: e.every((n) => I(t, n, r)), selections: i };
|
|
491
|
-
}, getSelectionKeys: () => s.length === 0 ? [] :
|
|
491
|
+
}, getSelectionKeys: () => s.length === 0 ? [] : U(s[0]) }) });
|
|
492
492
|
}, set: function(...s) {
|
|
493
493
|
return P({ [j]: () => ({ match: (e) => {
|
|
494
494
|
if (!(e instanceof Set))
|
|
@@ -501,8 +501,8 @@ var pi = { __proto__: null, matcher: j, optional: Jt, array: function(...s) {
|
|
|
501
501
|
const i = (n, a) => {
|
|
502
502
|
t[n] = (t[n] || []).concat([a]);
|
|
503
503
|
}, r = s[0];
|
|
504
|
-
return { matched:
|
|
505
|
-
}, getSelectionKeys: () => s.length === 0 ? [] :
|
|
504
|
+
return { matched: Xs(e, (n) => I(r, n, i)), selections: t };
|
|
505
|
+
}, getSelectionKeys: () => s.length === 0 ? [] : U(s[0]) }) });
|
|
506
506
|
}, map: function(...s) {
|
|
507
507
|
return P({ [j]: () => ({ match: (e) => {
|
|
508
508
|
if (!(e instanceof Map))
|
|
@@ -519,22 +519,22 @@ var pi = { __proto__: null, matcher: j, optional: Jt, array: function(...s) {
|
|
|
519
519
|
if (s.length === 1)
|
|
520
520
|
throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(r = s[0]) == null ? void 0 : r.toString()}`);
|
|
521
521
|
const [n, a] = s;
|
|
522
|
-
return { matched:
|
|
522
|
+
return { matched: ei(e, (o, c) => {
|
|
523
523
|
const d = I(n, c, i), u = I(a, o, i);
|
|
524
524
|
return d && u;
|
|
525
525
|
}), selections: t };
|
|
526
|
-
}, getSelectionKeys: () => s.length === 0 ? [] : [...
|
|
527
|
-
}, intersection:
|
|
526
|
+
}, getSelectionKeys: () => s.length === 0 ? [] : [...U(s[0]), ...U(s[1])] }) });
|
|
527
|
+
}, intersection: k, union: ys, not: function(s) {
|
|
528
528
|
return P({ [j]: () => ({ match: (e) => ({ matched: !I(s, e, () => {
|
|
529
529
|
}) }), getSelectionKeys: () => [], matcherType: "not" }) });
|
|
530
|
-
}, when: b, select:
|
|
530
|
+
}, when: b, select: Ke, any: _s, _: ti, string: si, number: ii, bigint: ri, boolean: ni, symbol: ai, nullish: oi, nonNullable: ci, instanceOf: function(s) {
|
|
531
531
|
return P(b(function(e) {
|
|
532
532
|
return (t) => t instanceof e;
|
|
533
533
|
}(s)));
|
|
534
534
|
}, shape: function(s) {
|
|
535
|
-
return P(b(
|
|
535
|
+
return P(b(Qs(s)));
|
|
536
536
|
} };
|
|
537
|
-
class
|
|
537
|
+
class li extends Error {
|
|
538
538
|
constructor(e) {
|
|
539
539
|
let t;
|
|
540
540
|
try {
|
|
@@ -545,11 +545,11 @@ class fi extends Error {
|
|
|
545
545
|
super(`Pattern matching error: no pattern matches value ${t}`), this.input = void 0, this.input = e;
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
const
|
|
549
|
-
function
|
|
550
|
-
return new
|
|
548
|
+
const zt = { matched: !1, value: void 0 };
|
|
549
|
+
function ns(s) {
|
|
550
|
+
return new ui(s, zt);
|
|
551
551
|
}
|
|
552
|
-
let
|
|
552
|
+
let ui = class Vt {
|
|
553
553
|
constructor(e, t) {
|
|
554
554
|
this.input = void 0, this.state = void 0, this.input = e, this.state = t;
|
|
555
555
|
}
|
|
@@ -562,19 +562,19 @@ let mi = class Wt {
|
|
|
562
562
|
let n = !1, a = {};
|
|
563
563
|
const o = (d, u) => {
|
|
564
564
|
n = !0, a[d] = u;
|
|
565
|
-
}, c = !i.some((d) => I(d, this.input, o)) || r && !r(this.input) ?
|
|
566
|
-
return new
|
|
565
|
+
}, c = !i.some((d) => I(d, this.input, o)) || r && !r(this.input) ? zt : { matched: !0, value: t(n ? vt in a ? a[vt] : a : this.input, this.input) };
|
|
566
|
+
return new Vt(this.input, c);
|
|
567
567
|
}
|
|
568
568
|
when(e, t) {
|
|
569
569
|
if (this.state.matched)
|
|
570
570
|
return this;
|
|
571
571
|
const i = !!e(this.input);
|
|
572
|
-
return new
|
|
572
|
+
return new Vt(this.input, i ? { matched: !0, value: t(this.input, this.input) } : zt);
|
|
573
573
|
}
|
|
574
574
|
otherwise(e) {
|
|
575
575
|
return this.state.matched ? this.state.value : e(this.input);
|
|
576
576
|
}
|
|
577
|
-
exhaustive(e =
|
|
577
|
+
exhaustive(e = hi) {
|
|
578
578
|
return this.state.matched ? this.state.value : e(this.input);
|
|
579
579
|
}
|
|
580
580
|
run() {
|
|
@@ -584,10 +584,10 @@ let mi = class Wt {
|
|
|
584
584
|
return this;
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
|
-
function
|
|
588
|
-
throw new
|
|
587
|
+
function hi(s) {
|
|
588
|
+
throw new li(s);
|
|
589
589
|
}
|
|
590
|
-
var
|
|
590
|
+
var x;
|
|
591
591
|
(function(s) {
|
|
592
592
|
s.assertEqual = (r) => r;
|
|
593
593
|
function e(r) {
|
|
@@ -622,16 +622,16 @@ var w;
|
|
|
622
622
|
return r.map((a) => typeof a == "string" ? `'${a}'` : a).join(n);
|
|
623
623
|
}
|
|
624
624
|
s.joinValues = i, s.jsonStringifyReplacer = (r, n) => typeof n == "bigint" ? n.toString() : n;
|
|
625
|
-
})(
|
|
626
|
-
var
|
|
625
|
+
})(x || (x = {}));
|
|
626
|
+
var Bt;
|
|
627
627
|
(function(s) {
|
|
628
628
|
s.mergeShapes = (e, t) => ({
|
|
629
629
|
...e,
|
|
630
630
|
...t
|
|
631
631
|
// second overwrites first
|
|
632
632
|
});
|
|
633
|
-
})(
|
|
634
|
-
const p =
|
|
633
|
+
})(Bt || (Bt = {}));
|
|
634
|
+
const p = x.arrayToEnum([
|
|
635
635
|
"string",
|
|
636
636
|
"nan",
|
|
637
637
|
"number",
|
|
@@ -652,7 +652,7 @@ const p = w.arrayToEnum([
|
|
|
652
652
|
"never",
|
|
653
653
|
"map",
|
|
654
654
|
"set"
|
|
655
|
-
]),
|
|
655
|
+
]), ee = (s) => {
|
|
656
656
|
switch (typeof s) {
|
|
657
657
|
case "undefined":
|
|
658
658
|
return p.undefined;
|
|
@@ -673,7 +673,7 @@ const p = w.arrayToEnum([
|
|
|
673
673
|
default:
|
|
674
674
|
return p.unknown;
|
|
675
675
|
}
|
|
676
|
-
}, l =
|
|
676
|
+
}, l = x.arrayToEnum([
|
|
677
677
|
"invalid_type",
|
|
678
678
|
"invalid_literal",
|
|
679
679
|
"custom",
|
|
@@ -690,8 +690,8 @@ const p = w.arrayToEnum([
|
|
|
690
690
|
"invalid_intersection_types",
|
|
691
691
|
"not_multiple_of",
|
|
692
692
|
"not_finite"
|
|
693
|
-
]),
|
|
694
|
-
class
|
|
693
|
+
]), pi = (s) => JSON.stringify(s, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
694
|
+
class L extends Error {
|
|
695
695
|
get errors() {
|
|
696
696
|
return this.issues;
|
|
697
697
|
}
|
|
@@ -728,14 +728,14 @@ class U extends Error {
|
|
|
728
728
|
return r(this), i;
|
|
729
729
|
}
|
|
730
730
|
static assert(e) {
|
|
731
|
-
if (!(e instanceof
|
|
731
|
+
if (!(e instanceof L))
|
|
732
732
|
throw new Error(`Not a ZodError: ${e}`);
|
|
733
733
|
}
|
|
734
734
|
toString() {
|
|
735
735
|
return this.message;
|
|
736
736
|
}
|
|
737
737
|
get message() {
|
|
738
|
-
return JSON.stringify(this.issues,
|
|
738
|
+
return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
|
|
739
739
|
}
|
|
740
740
|
get isEmpty() {
|
|
741
741
|
return this.issues.length === 0;
|
|
@@ -750,27 +750,27 @@ class U extends Error {
|
|
|
750
750
|
return this.flatten();
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
|
|
754
|
-
const
|
|
753
|
+
L.create = (s) => new L(s);
|
|
754
|
+
const Ne = (s, e) => {
|
|
755
755
|
let t;
|
|
756
756
|
switch (s.code) {
|
|
757
757
|
case l.invalid_type:
|
|
758
758
|
s.received === p.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
759
759
|
break;
|
|
760
760
|
case l.invalid_literal:
|
|
761
|
-
t = `Invalid literal value, expected ${JSON.stringify(s.expected,
|
|
761
|
+
t = `Invalid literal value, expected ${JSON.stringify(s.expected, x.jsonStringifyReplacer)}`;
|
|
762
762
|
break;
|
|
763
763
|
case l.unrecognized_keys:
|
|
764
|
-
t = `Unrecognized key(s) in object: ${
|
|
764
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(s.keys, ", ")}`;
|
|
765
765
|
break;
|
|
766
766
|
case l.invalid_union:
|
|
767
767
|
t = "Invalid input";
|
|
768
768
|
break;
|
|
769
769
|
case l.invalid_union_discriminator:
|
|
770
|
-
t = `Invalid discriminator value. Expected ${
|
|
770
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(s.options)}`;
|
|
771
771
|
break;
|
|
772
772
|
case l.invalid_enum_value:
|
|
773
|
-
t = `Invalid enum value. Expected ${
|
|
773
|
+
t = `Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;
|
|
774
774
|
break;
|
|
775
775
|
case l.invalid_arguments:
|
|
776
776
|
t = "Invalid function arguments";
|
|
@@ -782,7 +782,7 @@ const Ie = (s, e) => {
|
|
|
782
782
|
t = "Invalid date";
|
|
783
783
|
break;
|
|
784
784
|
case l.invalid_string:
|
|
785
|
-
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` :
|
|
785
|
+
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : x.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
786
786
|
break;
|
|
787
787
|
case l.too_small:
|
|
788
788
|
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
@@ -803,18 +803,18 @@ const Ie = (s, e) => {
|
|
|
803
803
|
t = "Number must be finite";
|
|
804
804
|
break;
|
|
805
805
|
default:
|
|
806
|
-
t = e.defaultError,
|
|
806
|
+
t = e.defaultError, x.assertNever(s);
|
|
807
807
|
}
|
|
808
808
|
return { message: t };
|
|
809
809
|
};
|
|
810
|
-
let
|
|
811
|
-
function
|
|
812
|
-
|
|
810
|
+
let bs = Ne;
|
|
811
|
+
function fi(s) {
|
|
812
|
+
bs = s;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
815
|
-
return
|
|
814
|
+
function yt() {
|
|
815
|
+
return bs;
|
|
816
816
|
}
|
|
817
|
-
const
|
|
817
|
+
const _t = (s) => {
|
|
818
818
|
const { data: e, path: t, errorMaps: i, issueData: r } = s, n = [...t, ...r.path || []], a = {
|
|
819
819
|
...r,
|
|
820
820
|
path: n
|
|
@@ -834,9 +834,9 @@ const wt = (s) => {
|
|
|
834
834
|
path: n,
|
|
835
835
|
message: o
|
|
836
836
|
};
|
|
837
|
-
},
|
|
837
|
+
}, mi = [];
|
|
838
838
|
function h(s, e) {
|
|
839
|
-
const t =
|
|
839
|
+
const t = yt(), i = _t({
|
|
840
840
|
issueData: e,
|
|
841
841
|
data: s.data,
|
|
842
842
|
path: s.path,
|
|
@@ -847,13 +847,13 @@ function h(s, e) {
|
|
|
847
847
|
// then schema-bound map if available
|
|
848
848
|
t,
|
|
849
849
|
// then global override map
|
|
850
|
-
t ===
|
|
850
|
+
t === Ne ? void 0 : Ne
|
|
851
851
|
// then global default map
|
|
852
852
|
].filter((r) => !!r)
|
|
853
853
|
});
|
|
854
854
|
s.common.issues.push(i);
|
|
855
855
|
}
|
|
856
|
-
class
|
|
856
|
+
class Z {
|
|
857
857
|
constructor() {
|
|
858
858
|
this.value = "valid";
|
|
859
859
|
}
|
|
@@ -881,7 +881,7 @@ class M {
|
|
|
881
881
|
value: a
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
|
-
return
|
|
884
|
+
return Z.mergeObjectSync(e, i);
|
|
885
885
|
}
|
|
886
886
|
static mergeObjectSync(e, t) {
|
|
887
887
|
const i = {};
|
|
@@ -896,15 +896,15 @@ class M {
|
|
|
896
896
|
}
|
|
897
897
|
const v = Object.freeze({
|
|
898
898
|
status: "aborted"
|
|
899
|
-
}),
|
|
900
|
-
function
|
|
899
|
+
}), Oe = (s) => ({ status: "dirty", value: s }), M = (s) => ({ status: "valid", value: s }), Ft = (s) => s.status === "aborted", Ht = (s) => s.status === "dirty", $e = (s) => s.status === "valid", qe = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
900
|
+
function bt(s, e, t, i) {
|
|
901
901
|
if (t === "a" && !i)
|
|
902
902
|
throw new TypeError("Private accessor was defined without a getter");
|
|
903
903
|
if (typeof e == "function" ? s !== e || !i : !e.has(s))
|
|
904
904
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
905
905
|
return t === "m" ? i : t === "a" ? i.call(s) : i ? i.value : e.get(s);
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function xs(s, e, t, i, r) {
|
|
908
908
|
if (i === "m")
|
|
909
909
|
throw new TypeError("Private method is not writable");
|
|
910
910
|
if (i === "a" && !r)
|
|
@@ -917,8 +917,8 @@ var f;
|
|
|
917
917
|
(function(s) {
|
|
918
918
|
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
919
919
|
})(f || (f = {}));
|
|
920
|
-
var
|
|
921
|
-
class
|
|
920
|
+
var ze, Ve;
|
|
921
|
+
class G {
|
|
922
922
|
constructor(e, t, i, r) {
|
|
923
923
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = i, this._key = r;
|
|
924
924
|
}
|
|
@@ -926,8 +926,8 @@ class Y {
|
|
|
926
926
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
929
|
+
const as = (s, e) => {
|
|
930
|
+
if ($e(e))
|
|
931
931
|
return { success: !0, data: e.value };
|
|
932
932
|
if (!s.common.issues.length)
|
|
933
933
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -936,7 +936,7 @@ const cs = (s, e) => {
|
|
|
936
936
|
get error() {
|
|
937
937
|
if (this._error)
|
|
938
938
|
return this._error;
|
|
939
|
-
const t = new
|
|
939
|
+
const t = new L(s.common.issues);
|
|
940
940
|
return this._error = t, this._error;
|
|
941
941
|
}
|
|
942
942
|
};
|
|
@@ -958,13 +958,13 @@ class _ {
|
|
|
958
958
|
return this._def.description;
|
|
959
959
|
}
|
|
960
960
|
_getType(e) {
|
|
961
|
-
return
|
|
961
|
+
return ee(e.data);
|
|
962
962
|
}
|
|
963
963
|
_getOrReturnCtx(e, t) {
|
|
964
964
|
return t || {
|
|
965
965
|
common: e.parent.common,
|
|
966
966
|
data: e.data,
|
|
967
|
-
parsedType:
|
|
967
|
+
parsedType: ee(e.data),
|
|
968
968
|
schemaErrorMap: this._def.errorMap,
|
|
969
969
|
path: e.path,
|
|
970
970
|
parent: e.parent
|
|
@@ -972,11 +972,11 @@ class _ {
|
|
|
972
972
|
}
|
|
973
973
|
_processInputParams(e) {
|
|
974
974
|
return {
|
|
975
|
-
status: new
|
|
975
|
+
status: new Z(),
|
|
976
976
|
ctx: {
|
|
977
977
|
common: e.parent.common,
|
|
978
978
|
data: e.data,
|
|
979
|
-
parsedType:
|
|
979
|
+
parsedType: ee(e.data),
|
|
980
980
|
schemaErrorMap: this._def.errorMap,
|
|
981
981
|
path: e.path,
|
|
982
982
|
parent: e.parent
|
|
@@ -985,7 +985,7 @@ class _ {
|
|
|
985
985
|
}
|
|
986
986
|
_parseSync(e) {
|
|
987
987
|
const t = this._parse(e);
|
|
988
|
-
if (
|
|
988
|
+
if (qe(t))
|
|
989
989
|
throw new Error("Synchronous parse encountered promise.");
|
|
990
990
|
return t;
|
|
991
991
|
}
|
|
@@ -1011,9 +1011,9 @@ class _ {
|
|
|
1011
1011
|
schemaErrorMap: this._def.errorMap,
|
|
1012
1012
|
parent: null,
|
|
1013
1013
|
data: e,
|
|
1014
|
-
parsedType:
|
|
1014
|
+
parsedType: ee(e)
|
|
1015
1015
|
}, n = this._parseSync({ data: e, path: r.path, parent: r });
|
|
1016
|
-
return
|
|
1016
|
+
return as(r, n);
|
|
1017
1017
|
}
|
|
1018
1018
|
"~validate"(e) {
|
|
1019
1019
|
var t, i;
|
|
@@ -1026,12 +1026,12 @@ class _ {
|
|
|
1026
1026
|
schemaErrorMap: this._def.errorMap,
|
|
1027
1027
|
parent: null,
|
|
1028
1028
|
data: e,
|
|
1029
|
-
parsedType:
|
|
1029
|
+
parsedType: ee(e)
|
|
1030
1030
|
};
|
|
1031
1031
|
if (!this["~standard"].async)
|
|
1032
1032
|
try {
|
|
1033
1033
|
const n = this._parseSync({ data: e, path: [], parent: r });
|
|
1034
|
-
return
|
|
1034
|
+
return $e(n) ? {
|
|
1035
1035
|
value: n.value
|
|
1036
1036
|
} : {
|
|
1037
1037
|
issues: r.common.issues
|
|
@@ -1042,7 +1042,7 @@ class _ {
|
|
|
1042
1042
|
async: !0
|
|
1043
1043
|
};
|
|
1044
1044
|
}
|
|
1045
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((n) =>
|
|
1045
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((n) => $e(n) ? {
|
|
1046
1046
|
value: n.value
|
|
1047
1047
|
} : {
|
|
1048
1048
|
issues: r.common.issues
|
|
@@ -1065,9 +1065,9 @@ class _ {
|
|
|
1065
1065
|
schemaErrorMap: this._def.errorMap,
|
|
1066
1066
|
parent: null,
|
|
1067
1067
|
data: e,
|
|
1068
|
-
parsedType:
|
|
1069
|
-
}, r = this._parse({ data: e, path: i.path, parent: i }), n = await (
|
|
1070
|
-
return
|
|
1068
|
+
parsedType: ee(e)
|
|
1069
|
+
}, r = this._parse({ data: e, path: i.path, parent: i }), n = await (qe(r) ? r : Promise.resolve(r));
|
|
1070
|
+
return as(i, n);
|
|
1071
1071
|
}
|
|
1072
1072
|
refine(e, t) {
|
|
1073
1073
|
const i = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
@@ -1100,25 +1100,25 @@ class _ {
|
|
|
1100
1100
|
};
|
|
1101
1101
|
}
|
|
1102
1102
|
optional() {
|
|
1103
|
-
return
|
|
1103
|
+
return q.create(this, this._def);
|
|
1104
1104
|
}
|
|
1105
1105
|
nullable() {
|
|
1106
|
-
return
|
|
1106
|
+
return ve.create(this, this._def);
|
|
1107
1107
|
}
|
|
1108
1108
|
nullish() {
|
|
1109
1109
|
return this.nullable().optional();
|
|
1110
1110
|
}
|
|
1111
1111
|
array() {
|
|
1112
|
-
return
|
|
1112
|
+
return B.create(this);
|
|
1113
1113
|
}
|
|
1114
1114
|
promise() {
|
|
1115
|
-
return
|
|
1115
|
+
return Pe.create(this, this._def);
|
|
1116
1116
|
}
|
|
1117
1117
|
or(e) {
|
|
1118
1118
|
return Qe.create([this, e], this._def);
|
|
1119
1119
|
}
|
|
1120
1120
|
and(e) {
|
|
1121
|
-
return
|
|
1121
|
+
return Xe.create(this, e, this._def);
|
|
1122
1122
|
}
|
|
1123
1123
|
transform(e) {
|
|
1124
1124
|
return new F({
|
|
@@ -1130,7 +1130,7 @@ class _ {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
default(e) {
|
|
1132
1132
|
const t = typeof e == "function" ? e : () => e;
|
|
1133
|
-
return new
|
|
1133
|
+
return new rt({
|
|
1134
1134
|
...y(this._def),
|
|
1135
1135
|
innerType: this,
|
|
1136
1136
|
defaultValue: t,
|
|
@@ -1138,7 +1138,7 @@ class _ {
|
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
1140
|
brand() {
|
|
1141
|
-
return new
|
|
1141
|
+
return new Yt({
|
|
1142
1142
|
typeName: g.ZodBranded,
|
|
1143
1143
|
type: this,
|
|
1144
1144
|
...y(this._def)
|
|
@@ -1146,7 +1146,7 @@ class _ {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
catch(e) {
|
|
1148
1148
|
const t = typeof e == "function" ? e : () => e;
|
|
1149
|
-
return new
|
|
1149
|
+
return new nt({
|
|
1150
1150
|
...y(this._def),
|
|
1151
1151
|
innerType: this,
|
|
1152
1152
|
catchValue: t,
|
|
@@ -1161,10 +1161,10 @@ class _ {
|
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
1163
|
pipe(e) {
|
|
1164
|
-
return
|
|
1164
|
+
return ut.create(this, e);
|
|
1165
1165
|
}
|
|
1166
1166
|
readonly() {
|
|
1167
|
-
return
|
|
1167
|
+
return at.create(this);
|
|
1168
1168
|
}
|
|
1169
1169
|
isOptional() {
|
|
1170
1170
|
return this.safeParse(void 0).success;
|
|
@@ -1173,26 +1173,26 @@ class _ {
|
|
|
1173
1173
|
return this.safeParse(null).success;
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
|
-
const
|
|
1177
|
-
let
|
|
1178
|
-
const
|
|
1179
|
-
function
|
|
1176
|
+
const gi = /^c[^\s-]{8,}$/i, vi = /^[0-9a-z]+$/, yi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, _i = /^[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, bi = /^[a-z0-9_-]{21}$/i, xi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, wi = /^[-+]?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)?)??$/, $i = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ai = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1177
|
+
let Zt;
|
|
1178
|
+
const ki = /^(?:(?: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])$/, Si = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, Ei = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ci = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ti = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Oi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ws = "((\\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])))", Ri = new RegExp(`^${ws}$`);
|
|
1179
|
+
function $s(s) {
|
|
1180
1180
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1181
1181
|
return s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1184
|
-
return new RegExp(`^${
|
|
1183
|
+
function Ni(s) {
|
|
1184
|
+
return new RegExp(`^${$s(s)}$`);
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1187
|
-
let e = `${
|
|
1186
|
+
function As(s) {
|
|
1187
|
+
let e = `${ws}T${$s(s)}`;
|
|
1188
1188
|
const t = [];
|
|
1189
1189
|
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return !!((e === "v4" || !e) &&
|
|
1191
|
+
function Ii(s, e) {
|
|
1192
|
+
return !!((e === "v4" || !e) && ki.test(s) || (e === "v6" || !e) && Ei.test(s));
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1195
|
-
if (!
|
|
1194
|
+
function Pi(s, e) {
|
|
1195
|
+
if (!xi.test(s))
|
|
1196
1196
|
return !1;
|
|
1197
1197
|
try {
|
|
1198
1198
|
const [t] = s.split("."), i = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(i));
|
|
@@ -1201,10 +1201,10 @@ function Di(s, e) {
|
|
|
1201
1201
|
return !1;
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return !!((e === "v4" || !e) &&
|
|
1204
|
+
function Zi(s, e) {
|
|
1205
|
+
return !!((e === "v4" || !e) && Si.test(s) || (e === "v6" || !e) && Ci.test(s));
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class V extends _ {
|
|
1208
1208
|
_parse(e) {
|
|
1209
1209
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
1210
1210
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1214,7 +1214,7 @@ class B extends _ {
|
|
|
1214
1214
|
received: n.parsedType
|
|
1215
1215
|
}), v;
|
|
1216
1216
|
}
|
|
1217
|
-
const i = new
|
|
1217
|
+
const i = new Z();
|
|
1218
1218
|
let r;
|
|
1219
1219
|
for (const n of this._def.checks)
|
|
1220
1220
|
if (n.kind === "min")
|
|
@@ -1253,43 +1253,43 @@ class B extends _ {
|
|
|
1253
1253
|
message: n.message
|
|
1254
1254
|
}), i.dirty());
|
|
1255
1255
|
} else if (n.kind === "email")
|
|
1256
|
-
|
|
1256
|
+
$i.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1257
1257
|
validation: "email",
|
|
1258
1258
|
code: l.invalid_string,
|
|
1259
1259
|
message: n.message
|
|
1260
1260
|
}), i.dirty());
|
|
1261
1261
|
else if (n.kind === "emoji")
|
|
1262
|
-
|
|
1262
|
+
Zt || (Zt = new RegExp(Ai, "u")), Zt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1263
1263
|
validation: "emoji",
|
|
1264
1264
|
code: l.invalid_string,
|
|
1265
1265
|
message: n.message
|
|
1266
1266
|
}), i.dirty());
|
|
1267
1267
|
else if (n.kind === "uuid")
|
|
1268
|
-
|
|
1268
|
+
_i.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1269
1269
|
validation: "uuid",
|
|
1270
1270
|
code: l.invalid_string,
|
|
1271
1271
|
message: n.message
|
|
1272
1272
|
}), i.dirty());
|
|
1273
1273
|
else if (n.kind === "nanoid")
|
|
1274
|
-
|
|
1274
|
+
bi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1275
1275
|
validation: "nanoid",
|
|
1276
1276
|
code: l.invalid_string,
|
|
1277
1277
|
message: n.message
|
|
1278
1278
|
}), i.dirty());
|
|
1279
1279
|
else if (n.kind === "cuid")
|
|
1280
|
-
|
|
1280
|
+
gi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1281
1281
|
validation: "cuid",
|
|
1282
1282
|
code: l.invalid_string,
|
|
1283
1283
|
message: n.message
|
|
1284
1284
|
}), i.dirty());
|
|
1285
1285
|
else if (n.kind === "cuid2")
|
|
1286
|
-
|
|
1286
|
+
vi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1287
1287
|
validation: "cuid2",
|
|
1288
1288
|
code: l.invalid_string,
|
|
1289
1289
|
message: n.message
|
|
1290
1290
|
}), i.dirty());
|
|
1291
1291
|
else if (n.kind === "ulid")
|
|
1292
|
-
|
|
1292
|
+
yi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1293
1293
|
validation: "ulid",
|
|
1294
1294
|
code: l.invalid_string,
|
|
1295
1295
|
message: n.message
|
|
@@ -1321,43 +1321,43 @@ class B extends _ {
|
|
|
1321
1321
|
code: l.invalid_string,
|
|
1322
1322
|
validation: { endsWith: n.value },
|
|
1323
1323
|
message: n.message
|
|
1324
|
-
}), i.dirty()) : n.kind === "datetime" ?
|
|
1324
|
+
}), i.dirty()) : n.kind === "datetime" ? As(n).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1325
1325
|
code: l.invalid_string,
|
|
1326
1326
|
validation: "datetime",
|
|
1327
1327
|
message: n.message
|
|
1328
|
-
}), i.dirty()) : n.kind === "date" ?
|
|
1328
|
+
}), i.dirty()) : n.kind === "date" ? Ri.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1329
1329
|
code: l.invalid_string,
|
|
1330
1330
|
validation: "date",
|
|
1331
1331
|
message: n.message
|
|
1332
|
-
}), i.dirty()) : n.kind === "time" ?
|
|
1332
|
+
}), i.dirty()) : n.kind === "time" ? Ni(n).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1333
1333
|
code: l.invalid_string,
|
|
1334
1334
|
validation: "time",
|
|
1335
1335
|
message: n.message
|
|
1336
|
-
}), i.dirty()) : n.kind === "duration" ?
|
|
1336
|
+
}), i.dirty()) : n.kind === "duration" ? wi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1337
1337
|
validation: "duration",
|
|
1338
1338
|
code: l.invalid_string,
|
|
1339
1339
|
message: n.message
|
|
1340
|
-
}), i.dirty()) : n.kind === "ip" ?
|
|
1340
|
+
}), i.dirty()) : n.kind === "ip" ? Ii(e.data, n.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1341
1341
|
validation: "ip",
|
|
1342
1342
|
code: l.invalid_string,
|
|
1343
1343
|
message: n.message
|
|
1344
|
-
}), i.dirty()) : n.kind === "jwt" ?
|
|
1344
|
+
}), i.dirty()) : n.kind === "jwt" ? Pi(e.data, n.alg) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1345
1345
|
validation: "jwt",
|
|
1346
1346
|
code: l.invalid_string,
|
|
1347
1347
|
message: n.message
|
|
1348
|
-
}), i.dirty()) : n.kind === "cidr" ?
|
|
1348
|
+
}), i.dirty()) : n.kind === "cidr" ? Zi(e.data, n.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1349
1349
|
validation: "cidr",
|
|
1350
1350
|
code: l.invalid_string,
|
|
1351
1351
|
message: n.message
|
|
1352
|
-
}), i.dirty()) : n.kind === "base64" ?
|
|
1352
|
+
}), i.dirty()) : n.kind === "base64" ? Ti.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1353
1353
|
validation: "base64",
|
|
1354
1354
|
code: l.invalid_string,
|
|
1355
1355
|
message: n.message
|
|
1356
|
-
}), i.dirty()) : n.kind === "base64url" ?
|
|
1356
|
+
}), i.dirty()) : n.kind === "base64url" ? Oi.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1357
1357
|
validation: "base64url",
|
|
1358
1358
|
code: l.invalid_string,
|
|
1359
1359
|
message: n.message
|
|
1360
|
-
}), i.dirty()) :
|
|
1360
|
+
}), i.dirty()) : x.assertNever(n);
|
|
1361
1361
|
return { status: i.value, value: e.data };
|
|
1362
1362
|
}
|
|
1363
1363
|
_regex(e, t, i) {
|
|
@@ -1368,7 +1368,7 @@ class B extends _ {
|
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
_addCheck(e) {
|
|
1371
|
-
return new
|
|
1371
|
+
return new V({
|
|
1372
1372
|
...this._def,
|
|
1373
1373
|
checks: [...this._def.checks, e]
|
|
1374
1374
|
});
|
|
@@ -1505,19 +1505,19 @@ class B extends _ {
|
|
|
1505
1505
|
return this.min(1, f.errToObj(e));
|
|
1506
1506
|
}
|
|
1507
1507
|
trim() {
|
|
1508
|
-
return new
|
|
1508
|
+
return new V({
|
|
1509
1509
|
...this._def,
|
|
1510
1510
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
1513
1513
|
toLowerCase() {
|
|
1514
|
-
return new
|
|
1514
|
+
return new V({
|
|
1515
1515
|
...this._def,
|
|
1516
1516
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1517
1517
|
});
|
|
1518
1518
|
}
|
|
1519
1519
|
toUpperCase() {
|
|
1520
|
-
return new
|
|
1520
|
+
return new V({
|
|
1521
1521
|
...this._def,
|
|
1522
1522
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1523
1523
|
});
|
|
@@ -1583,20 +1583,20 @@ class B extends _ {
|
|
|
1583
1583
|
return e;
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
V.create = (s) => {
|
|
1587
1587
|
var e;
|
|
1588
|
-
return new
|
|
1588
|
+
return new V({
|
|
1589
1589
|
checks: [],
|
|
1590
1590
|
typeName: g.ZodString,
|
|
1591
1591
|
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1,
|
|
1592
1592
|
...y(s)
|
|
1593
1593
|
});
|
|
1594
1594
|
};
|
|
1595
|
-
function
|
|
1595
|
+
function Mi(s, e) {
|
|
1596
1596
|
const t = (s.toString().split(".")[1] || "").length, i = (e.toString().split(".")[1] || "").length, r = t > i ? t : i, n = parseInt(s.toFixed(r).replace(".", "")), a = parseInt(e.toFixed(r).replace(".", ""));
|
|
1597
1597
|
return n % a / Math.pow(10, r);
|
|
1598
1598
|
}
|
|
1599
|
-
class
|
|
1599
|
+
class fe extends _ {
|
|
1600
1600
|
constructor() {
|
|
1601
1601
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1602
1602
|
}
|
|
@@ -1610,9 +1610,9 @@ class me extends _ {
|
|
|
1610
1610
|
}), v;
|
|
1611
1611
|
}
|
|
1612
1612
|
let i;
|
|
1613
|
-
const r = new
|
|
1613
|
+
const r = new Z();
|
|
1614
1614
|
for (const n of this._def.checks)
|
|
1615
|
-
n.kind === "int" ?
|
|
1615
|
+
n.kind === "int" ? x.isInteger(e.data) || (i = this._getOrReturnCtx(e, i), h(i, {
|
|
1616
1616
|
code: l.invalid_type,
|
|
1617
1617
|
expected: "integer",
|
|
1618
1618
|
received: "float",
|
|
@@ -1631,14 +1631,14 @@ class me extends _ {
|
|
|
1631
1631
|
inclusive: n.inclusive,
|
|
1632
1632
|
exact: !1,
|
|
1633
1633
|
message: n.message
|
|
1634
|
-
}), r.dirty()) : n.kind === "multipleOf" ?
|
|
1634
|
+
}), r.dirty()) : n.kind === "multipleOf" ? Mi(e.data, n.value) !== 0 && (i = this._getOrReturnCtx(e, i), h(i, {
|
|
1635
1635
|
code: l.not_multiple_of,
|
|
1636
1636
|
multipleOf: n.value,
|
|
1637
1637
|
message: n.message
|
|
1638
1638
|
}), r.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (i = this._getOrReturnCtx(e, i), h(i, {
|
|
1639
1639
|
code: l.not_finite,
|
|
1640
1640
|
message: n.message
|
|
1641
|
-
}), r.dirty()) :
|
|
1641
|
+
}), r.dirty()) : x.assertNever(n);
|
|
1642
1642
|
return { status: r.value, value: e.data };
|
|
1643
1643
|
}
|
|
1644
1644
|
gte(e, t) {
|
|
@@ -1654,7 +1654,7 @@ class me extends _ {
|
|
|
1654
1654
|
return this.setLimit("max", e, !1, f.toString(t));
|
|
1655
1655
|
}
|
|
1656
1656
|
setLimit(e, t, i, r) {
|
|
1657
|
-
return new
|
|
1657
|
+
return new fe({
|
|
1658
1658
|
...this._def,
|
|
1659
1659
|
checks: [
|
|
1660
1660
|
...this._def.checks,
|
|
@@ -1668,7 +1668,7 @@ class me extends _ {
|
|
|
1668
1668
|
});
|
|
1669
1669
|
}
|
|
1670
1670
|
_addCheck(e) {
|
|
1671
|
-
return new
|
|
1671
|
+
return new fe({
|
|
1672
1672
|
...this._def,
|
|
1673
1673
|
checks: [...this._def.checks, e]
|
|
1674
1674
|
});
|
|
@@ -1750,7 +1750,7 @@ class me extends _ {
|
|
|
1750
1750
|
return e;
|
|
1751
1751
|
}
|
|
1752
1752
|
get isInt() {
|
|
1753
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1753
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
|
|
1754
1754
|
}
|
|
1755
1755
|
get isFinite() {
|
|
1756
1756
|
let e = null, t = null;
|
|
@@ -1762,13 +1762,13 @@ class me extends _ {
|
|
|
1762
1762
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1763
1763
|
}
|
|
1764
1764
|
}
|
|
1765
|
-
|
|
1765
|
+
fe.create = (s) => new fe({
|
|
1766
1766
|
checks: [],
|
|
1767
1767
|
typeName: g.ZodNumber,
|
|
1768
1768
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1769
1769
|
...y(s)
|
|
1770
1770
|
});
|
|
1771
|
-
class
|
|
1771
|
+
class me extends _ {
|
|
1772
1772
|
constructor() {
|
|
1773
1773
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1774
1774
|
}
|
|
@@ -1782,7 +1782,7 @@ class ge extends _ {
|
|
|
1782
1782
|
if (this._getType(e) !== p.bigint)
|
|
1783
1783
|
return this._getInvalidInput(e);
|
|
1784
1784
|
let i;
|
|
1785
|
-
const r = new
|
|
1785
|
+
const r = new Z();
|
|
1786
1786
|
for (const n of this._def.checks)
|
|
1787
1787
|
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (i = this._getOrReturnCtx(e, i), h(i, {
|
|
1788
1788
|
code: l.too_small,
|
|
@@ -1800,7 +1800,7 @@ class ge extends _ {
|
|
|
1800
1800
|
code: l.not_multiple_of,
|
|
1801
1801
|
multipleOf: n.value,
|
|
1802
1802
|
message: n.message
|
|
1803
|
-
}), r.dirty()) :
|
|
1803
|
+
}), r.dirty()) : x.assertNever(n);
|
|
1804
1804
|
return { status: r.value, value: e.data };
|
|
1805
1805
|
}
|
|
1806
1806
|
_getInvalidInput(e) {
|
|
@@ -1824,7 +1824,7 @@ class ge extends _ {
|
|
|
1824
1824
|
return this.setLimit("max", e, !1, f.toString(t));
|
|
1825
1825
|
}
|
|
1826
1826
|
setLimit(e, t, i, r) {
|
|
1827
|
-
return new
|
|
1827
|
+
return new me({
|
|
1828
1828
|
...this._def,
|
|
1829
1829
|
checks: [
|
|
1830
1830
|
...this._def.checks,
|
|
@@ -1838,7 +1838,7 @@ class ge extends _ {
|
|
|
1838
1838
|
});
|
|
1839
1839
|
}
|
|
1840
1840
|
_addCheck(e) {
|
|
1841
|
-
return new
|
|
1841
|
+
return new me({
|
|
1842
1842
|
...this._def,
|
|
1843
1843
|
checks: [...this._def.checks, e]
|
|
1844
1844
|
});
|
|
@@ -1895,16 +1895,16 @@ class ge extends _ {
|
|
|
1895
1895
|
return e;
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
|
-
|
|
1898
|
+
me.create = (s) => {
|
|
1899
1899
|
var e;
|
|
1900
|
-
return new
|
|
1900
|
+
return new me({
|
|
1901
1901
|
checks: [],
|
|
1902
1902
|
typeName: g.ZodBigInt,
|
|
1903
1903
|
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1,
|
|
1904
1904
|
...y(s)
|
|
1905
1905
|
});
|
|
1906
1906
|
};
|
|
1907
|
-
class
|
|
1907
|
+
class Ge extends _ {
|
|
1908
1908
|
_parse(e) {
|
|
1909
1909
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1910
1910
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1914,15 +1914,15 @@ class Ye extends _ {
|
|
|
1914
1914
|
received: i.parsedType
|
|
1915
1915
|
}), v;
|
|
1916
1916
|
}
|
|
1917
|
-
return
|
|
1917
|
+
return M(e.data);
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
|
-
|
|
1920
|
+
Ge.create = (s) => new Ge({
|
|
1921
1921
|
typeName: g.ZodBoolean,
|
|
1922
1922
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1923
1923
|
...y(s)
|
|
1924
1924
|
});
|
|
1925
|
-
class
|
|
1925
|
+
class Ae extends _ {
|
|
1926
1926
|
_parse(e) {
|
|
1927
1927
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1928
1928
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1938,7 +1938,7 @@ class Se extends _ {
|
|
|
1938
1938
|
code: l.invalid_date
|
|
1939
1939
|
}), v;
|
|
1940
1940
|
}
|
|
1941
|
-
const i = new
|
|
1941
|
+
const i = new Z();
|
|
1942
1942
|
let r;
|
|
1943
1943
|
for (const n of this._def.checks)
|
|
1944
1944
|
n.kind === "min" ? e.data.getTime() < n.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
@@ -1955,14 +1955,14 @@ class Se extends _ {
|
|
|
1955
1955
|
exact: !1,
|
|
1956
1956
|
maximum: n.value,
|
|
1957
1957
|
type: "date"
|
|
1958
|
-
}), i.dirty()) :
|
|
1958
|
+
}), i.dirty()) : x.assertNever(n);
|
|
1959
1959
|
return {
|
|
1960
1960
|
status: i.value,
|
|
1961
1961
|
value: new Date(e.data.getTime())
|
|
1962
1962
|
};
|
|
1963
1963
|
}
|
|
1964
1964
|
_addCheck(e) {
|
|
1965
|
-
return new
|
|
1965
|
+
return new Ae({
|
|
1966
1966
|
...this._def,
|
|
1967
1967
|
checks: [...this._def.checks, e]
|
|
1968
1968
|
});
|
|
@@ -1994,13 +1994,13 @@ class Se extends _ {
|
|
|
1994
1994
|
return e != null ? new Date(e) : null;
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
|
-
|
|
1997
|
+
Ae.create = (s) => new Ae({
|
|
1998
1998
|
checks: [],
|
|
1999
1999
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2000
2000
|
typeName: g.ZodDate,
|
|
2001
2001
|
...y(s)
|
|
2002
2002
|
});
|
|
2003
|
-
class
|
|
2003
|
+
class xt extends _ {
|
|
2004
2004
|
_parse(e) {
|
|
2005
2005
|
if (this._getType(e) !== p.symbol) {
|
|
2006
2006
|
const i = this._getOrReturnCtx(e);
|
|
@@ -2010,14 +2010,14 @@ class $t extends _ {
|
|
|
2010
2010
|
received: i.parsedType
|
|
2011
2011
|
}), v;
|
|
2012
2012
|
}
|
|
2013
|
-
return
|
|
2013
|
+
return M(e.data);
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
|
|
2016
|
+
xt.create = (s) => new xt({
|
|
2017
2017
|
typeName: g.ZodSymbol,
|
|
2018
2018
|
...y(s)
|
|
2019
2019
|
});
|
|
2020
|
-
class
|
|
2020
|
+
class Ye extends _ {
|
|
2021
2021
|
_parse(e) {
|
|
2022
2022
|
if (this._getType(e) !== p.undefined) {
|
|
2023
2023
|
const i = this._getOrReturnCtx(e);
|
|
@@ -2027,14 +2027,14 @@ class Je extends _ {
|
|
|
2027
2027
|
received: i.parsedType
|
|
2028
2028
|
}), v;
|
|
2029
2029
|
}
|
|
2030
|
-
return
|
|
2030
|
+
return M(e.data);
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
|
-
|
|
2033
|
+
Ye.create = (s) => new Ye({
|
|
2034
2034
|
typeName: g.ZodUndefined,
|
|
2035
2035
|
...y(s)
|
|
2036
2036
|
});
|
|
2037
|
-
class
|
|
2037
|
+
class Je extends _ {
|
|
2038
2038
|
_parse(e) {
|
|
2039
2039
|
if (this._getType(e) !== p.null) {
|
|
2040
2040
|
const i = this._getOrReturnCtx(e);
|
|
@@ -2044,38 +2044,38 @@ class Xe extends _ {
|
|
|
2044
2044
|
received: i.parsedType
|
|
2045
2045
|
}), v;
|
|
2046
2046
|
}
|
|
2047
|
-
return
|
|
2047
|
+
return M(e.data);
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
|
|
2050
|
+
Je.create = (s) => new Je({
|
|
2051
2051
|
typeName: g.ZodNull,
|
|
2052
2052
|
...y(s)
|
|
2053
2053
|
});
|
|
2054
|
-
class
|
|
2054
|
+
class Ie extends _ {
|
|
2055
2055
|
constructor() {
|
|
2056
2056
|
super(...arguments), this._any = !0;
|
|
2057
2057
|
}
|
|
2058
2058
|
_parse(e) {
|
|
2059
|
-
return
|
|
2059
|
+
return M(e.data);
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
|
-
|
|
2062
|
+
Ie.create = (s) => new Ie({
|
|
2063
2063
|
typeName: g.ZodAny,
|
|
2064
2064
|
...y(s)
|
|
2065
2065
|
});
|
|
2066
|
-
class
|
|
2066
|
+
class we extends _ {
|
|
2067
2067
|
constructor() {
|
|
2068
2068
|
super(...arguments), this._unknown = !0;
|
|
2069
2069
|
}
|
|
2070
2070
|
_parse(e) {
|
|
2071
|
-
return
|
|
2071
|
+
return M(e.data);
|
|
2072
2072
|
}
|
|
2073
2073
|
}
|
|
2074
|
-
|
|
2074
|
+
we.create = (s) => new we({
|
|
2075
2075
|
typeName: g.ZodUnknown,
|
|
2076
2076
|
...y(s)
|
|
2077
2077
|
});
|
|
2078
|
-
class
|
|
2078
|
+
class te extends _ {
|
|
2079
2079
|
_parse(e) {
|
|
2080
2080
|
const t = this._getOrReturnCtx(e);
|
|
2081
2081
|
return h(t, {
|
|
@@ -2085,11 +2085,11 @@ class se extends _ {
|
|
|
2085
2085
|
}), v;
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
-
|
|
2088
|
+
te.create = (s) => new te({
|
|
2089
2089
|
typeName: g.ZodNever,
|
|
2090
2090
|
...y(s)
|
|
2091
2091
|
});
|
|
2092
|
-
class
|
|
2092
|
+
class wt extends _ {
|
|
2093
2093
|
_parse(e) {
|
|
2094
2094
|
if (this._getType(e) !== p.undefined) {
|
|
2095
2095
|
const i = this._getOrReturnCtx(e);
|
|
@@ -2099,14 +2099,14 @@ class At extends _ {
|
|
|
2099
2099
|
received: i.parsedType
|
|
2100
2100
|
}), v;
|
|
2101
2101
|
}
|
|
2102
|
-
return
|
|
2102
|
+
return M(e.data);
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
|
-
|
|
2105
|
+
wt.create = (s) => new wt({
|
|
2106
2106
|
typeName: g.ZodVoid,
|
|
2107
2107
|
...y(s)
|
|
2108
2108
|
});
|
|
2109
|
-
class
|
|
2109
|
+
class B extends _ {
|
|
2110
2110
|
_parse(e) {
|
|
2111
2111
|
const { ctx: t, status: i } = this._processInputParams(e), r = this._def;
|
|
2112
2112
|
if (t.parsedType !== p.array)
|
|
@@ -2142,27 +2142,27 @@ class W extends _ {
|
|
|
2142
2142
|
exact: !1,
|
|
2143
2143
|
message: r.maxLength.message
|
|
2144
2144
|
}), i.dirty()), t.common.async)
|
|
2145
|
-
return Promise.all([...t.data].map((a, o) => r.type._parseAsync(new
|
|
2146
|
-
const n = [...t.data].map((a, o) => r.type._parseSync(new
|
|
2147
|
-
return
|
|
2145
|
+
return Promise.all([...t.data].map((a, o) => r.type._parseAsync(new G(t, a, t.path, o)))).then((a) => Z.mergeArray(i, a));
|
|
2146
|
+
const n = [...t.data].map((a, o) => r.type._parseSync(new G(t, a, t.path, o)));
|
|
2147
|
+
return Z.mergeArray(i, n);
|
|
2148
2148
|
}
|
|
2149
2149
|
get element() {
|
|
2150
2150
|
return this._def.type;
|
|
2151
2151
|
}
|
|
2152
2152
|
min(e, t) {
|
|
2153
|
-
return new
|
|
2153
|
+
return new B({
|
|
2154
2154
|
...this._def,
|
|
2155
2155
|
minLength: { value: e, message: f.toString(t) }
|
|
2156
2156
|
});
|
|
2157
2157
|
}
|
|
2158
2158
|
max(e, t) {
|
|
2159
|
-
return new
|
|
2159
|
+
return new B({
|
|
2160
2160
|
...this._def,
|
|
2161
2161
|
maxLength: { value: e, message: f.toString(t) }
|
|
2162
2162
|
});
|
|
2163
2163
|
}
|
|
2164
2164
|
length(e, t) {
|
|
2165
|
-
return new
|
|
2165
|
+
return new B({
|
|
2166
2166
|
...this._def,
|
|
2167
2167
|
exactLength: { value: e, message: f.toString(t) }
|
|
2168
2168
|
});
|
|
@@ -2171,7 +2171,7 @@ class W extends _ {
|
|
|
2171
2171
|
return this.min(1, e);
|
|
2172
2172
|
}
|
|
2173
2173
|
}
|
|
2174
|
-
|
|
2174
|
+
B.create = (s, e) => new B({
|
|
2175
2175
|
type: s,
|
|
2176
2176
|
minLength: null,
|
|
2177
2177
|
maxLength: null,
|
|
@@ -2179,22 +2179,22 @@ W.create = (s, e) => new W({
|
|
|
2179
2179
|
typeName: g.ZodArray,
|
|
2180
2180
|
...y(e)
|
|
2181
2181
|
});
|
|
2182
|
-
function
|
|
2182
|
+
function Te(s) {
|
|
2183
2183
|
if (s instanceof T) {
|
|
2184
2184
|
const e = {};
|
|
2185
2185
|
for (const t in s.shape) {
|
|
2186
2186
|
const i = s.shape[t];
|
|
2187
|
-
e[t] =
|
|
2187
|
+
e[t] = q.create(Te(i));
|
|
2188
2188
|
}
|
|
2189
2189
|
return new T({
|
|
2190
2190
|
...s._def,
|
|
2191
2191
|
shape: () => e
|
|
2192
2192
|
});
|
|
2193
2193
|
} else
|
|
2194
|
-
return s instanceof
|
|
2194
|
+
return s instanceof B ? new B({
|
|
2195
2195
|
...s._def,
|
|
2196
|
-
type:
|
|
2197
|
-
}) : s instanceof
|
|
2196
|
+
type: Te(s.element)
|
|
2197
|
+
}) : s instanceof q ? q.create(Te(s.unwrap())) : s instanceof ve ? ve.create(Te(s.unwrap())) : s instanceof Y ? Y.create(s.items.map((e) => Te(e))) : s;
|
|
2198
2198
|
}
|
|
2199
2199
|
class T extends _ {
|
|
2200
2200
|
constructor() {
|
|
@@ -2203,7 +2203,7 @@ class T extends _ {
|
|
|
2203
2203
|
_getCached() {
|
|
2204
2204
|
if (this._cached !== null)
|
|
2205
2205
|
return this._cached;
|
|
2206
|
-
const e = this._def.shape(), t =
|
|
2206
|
+
const e = this._def.shape(), t = x.objectKeys(e);
|
|
2207
2207
|
return this._cached = { shape: e, keys: t };
|
|
2208
2208
|
}
|
|
2209
2209
|
_parse(e) {
|
|
@@ -2216,7 +2216,7 @@ class T extends _ {
|
|
|
2216
2216
|
}), v;
|
|
2217
2217
|
}
|
|
2218
2218
|
const { status: i, ctx: r } = this._processInputParams(e), { shape: n, keys: a } = this._getCached(), o = [];
|
|
2219
|
-
if (!(this._def.catchall instanceof
|
|
2219
|
+
if (!(this._def.catchall instanceof te && this._def.unknownKeys === "strip"))
|
|
2220
2220
|
for (const d in r.data)
|
|
2221
2221
|
a.includes(d) || o.push(d);
|
|
2222
2222
|
const c = [];
|
|
@@ -2224,11 +2224,11 @@ class T extends _ {
|
|
|
2224
2224
|
const u = n[d], m = r.data[d];
|
|
2225
2225
|
c.push({
|
|
2226
2226
|
key: { status: "valid", value: d },
|
|
2227
|
-
value: u._parse(new
|
|
2227
|
+
value: u._parse(new G(r, m, r.path, d)),
|
|
2228
2228
|
alwaysSet: d in r.data
|
|
2229
2229
|
});
|
|
2230
2230
|
}
|
|
2231
|
-
if (this._def.catchall instanceof
|
|
2231
|
+
if (this._def.catchall instanceof te) {
|
|
2232
2232
|
const d = this._def.unknownKeys;
|
|
2233
2233
|
if (d === "passthrough")
|
|
2234
2234
|
for (const u of o)
|
|
@@ -2250,7 +2250,7 @@ class T extends _ {
|
|
|
2250
2250
|
c.push({
|
|
2251
2251
|
key: { status: "valid", value: u },
|
|
2252
2252
|
value: d._parse(
|
|
2253
|
-
new
|
|
2253
|
+
new G(r, m, r.path, u)
|
|
2254
2254
|
//, ctx.child(key), value, getParsedType(value)
|
|
2255
2255
|
),
|
|
2256
2256
|
alwaysSet: u in r.data
|
|
@@ -2268,7 +2268,7 @@ class T extends _ {
|
|
|
2268
2268
|
});
|
|
2269
2269
|
}
|
|
2270
2270
|
return d;
|
|
2271
|
-
}).then((d) =>
|
|
2271
|
+
}).then((d) => Z.mergeObjectSync(i, d)) : Z.mergeObjectSync(i, c);
|
|
2272
2272
|
}
|
|
2273
2273
|
get shape() {
|
|
2274
2274
|
return this._def.shape();
|
|
@@ -2411,7 +2411,7 @@ class T extends _ {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
pick(e) {
|
|
2413
2413
|
const t = {};
|
|
2414
|
-
return
|
|
2414
|
+
return x.objectKeys(e).forEach((i) => {
|
|
2415
2415
|
e[i] && this.shape[i] && (t[i] = this.shape[i]);
|
|
2416
2416
|
}), new T({
|
|
2417
2417
|
...this._def,
|
|
@@ -2420,7 +2420,7 @@ class T extends _ {
|
|
|
2420
2420
|
}
|
|
2421
2421
|
omit(e) {
|
|
2422
2422
|
const t = {};
|
|
2423
|
-
return
|
|
2423
|
+
return x.objectKeys(this.shape).forEach((i) => {
|
|
2424
2424
|
e[i] || (t[i] = this.shape[i]);
|
|
2425
2425
|
}), new T({
|
|
2426
2426
|
...this._def,
|
|
@@ -2431,11 +2431,11 @@ class T extends _ {
|
|
|
2431
2431
|
* @deprecated
|
|
2432
2432
|
*/
|
|
2433
2433
|
deepPartial() {
|
|
2434
|
-
return
|
|
2434
|
+
return Te(this);
|
|
2435
2435
|
}
|
|
2436
2436
|
partial(e) {
|
|
2437
2437
|
const t = {};
|
|
2438
|
-
return
|
|
2438
|
+
return x.objectKeys(this.shape).forEach((i) => {
|
|
2439
2439
|
const r = this.shape[i];
|
|
2440
2440
|
e && !e[i] ? t[i] = r : t[i] = r.optional();
|
|
2441
2441
|
}), new T({
|
|
@@ -2445,12 +2445,12 @@ class T extends _ {
|
|
|
2445
2445
|
}
|
|
2446
2446
|
required(e) {
|
|
2447
2447
|
const t = {};
|
|
2448
|
-
return
|
|
2448
|
+
return x.objectKeys(this.shape).forEach((i) => {
|
|
2449
2449
|
if (e && !e[i])
|
|
2450
2450
|
t[i] = this.shape[i];
|
|
2451
2451
|
else {
|
|
2452
2452
|
let n = this.shape[i];
|
|
2453
|
-
for (; n instanceof
|
|
2453
|
+
for (; n instanceof q; )
|
|
2454
2454
|
n = n._def.innerType;
|
|
2455
2455
|
t[i] = n;
|
|
2456
2456
|
}
|
|
@@ -2460,27 +2460,27 @@ class T extends _ {
|
|
|
2460
2460
|
});
|
|
2461
2461
|
}
|
|
2462
2462
|
keyof() {
|
|
2463
|
-
return
|
|
2463
|
+
return ks(x.objectKeys(this.shape));
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
2466
|
T.create = (s, e) => new T({
|
|
2467
2467
|
shape: () => s,
|
|
2468
2468
|
unknownKeys: "strip",
|
|
2469
|
-
catchall:
|
|
2469
|
+
catchall: te.create(),
|
|
2470
2470
|
typeName: g.ZodObject,
|
|
2471
2471
|
...y(e)
|
|
2472
2472
|
});
|
|
2473
2473
|
T.strictCreate = (s, e) => new T({
|
|
2474
2474
|
shape: () => s,
|
|
2475
2475
|
unknownKeys: "strict",
|
|
2476
|
-
catchall:
|
|
2476
|
+
catchall: te.create(),
|
|
2477
2477
|
typeName: g.ZodObject,
|
|
2478
2478
|
...y(e)
|
|
2479
2479
|
});
|
|
2480
2480
|
T.lazycreate = (s, e) => new T({
|
|
2481
2481
|
shape: s,
|
|
2482
2482
|
unknownKeys: "strip",
|
|
2483
|
-
catchall:
|
|
2483
|
+
catchall: te.create(),
|
|
2484
2484
|
typeName: g.ZodObject,
|
|
2485
2485
|
...y(e)
|
|
2486
2486
|
});
|
|
@@ -2494,7 +2494,7 @@ class Qe extends _ {
|
|
|
2494
2494
|
for (const o of n)
|
|
2495
2495
|
if (o.result.status === "dirty")
|
|
2496
2496
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2497
|
-
const a = n.map((o) => new
|
|
2497
|
+
const a = n.map((o) => new L(o.ctx.common.issues));
|
|
2498
2498
|
return h(t, {
|
|
2499
2499
|
code: l.invalid_union,
|
|
2500
2500
|
unionErrors: a
|
|
@@ -2541,7 +2541,7 @@ class Qe extends _ {
|
|
|
2541
2541
|
}
|
|
2542
2542
|
if (n)
|
|
2543
2543
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2544
|
-
const o = a.map((c) => new
|
|
2544
|
+
const o = a.map((c) => new L(c));
|
|
2545
2545
|
return h(t, {
|
|
2546
2546
|
code: l.invalid_union,
|
|
2547
2547
|
unionErrors: o
|
|
@@ -2557,8 +2557,8 @@ Qe.create = (s, e) => new Qe({
|
|
|
2557
2557
|
typeName: g.ZodUnion,
|
|
2558
2558
|
...y(e)
|
|
2559
2559
|
});
|
|
2560
|
-
const
|
|
2561
|
-
class
|
|
2560
|
+
const X = (s) => s instanceof tt ? X(s.schema) : s instanceof F ? X(s.innerType()) : s instanceof st ? [s.value] : s instanceof ge ? s.options : s instanceof it ? x.objectValues(s.enum) : s instanceof rt ? X(s._def.innerType) : s instanceof Ye ? [void 0] : s instanceof Je ? [null] : s instanceof q ? [void 0, ...X(s.unwrap())] : s instanceof ve ? [null, ...X(s.unwrap())] : s instanceof Yt || s instanceof at ? X(s.unwrap()) : s instanceof nt ? X(s._def.innerType) : [];
|
|
2561
|
+
class Ct extends _ {
|
|
2562
2562
|
_parse(e) {
|
|
2563
2563
|
const { ctx: t } = this._processInputParams(e);
|
|
2564
2564
|
if (t.parsedType !== p.object)
|
|
@@ -2602,7 +2602,7 @@ class Ot extends _ {
|
|
|
2602
2602
|
static create(e, t, i) {
|
|
2603
2603
|
const r = /* @__PURE__ */ new Map();
|
|
2604
2604
|
for (const n of t) {
|
|
2605
|
-
const a =
|
|
2605
|
+
const a = X(n.shape[e]);
|
|
2606
2606
|
if (!a.length)
|
|
2607
2607
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2608
2608
|
for (const o of a) {
|
|
@@ -2611,7 +2611,7 @@ class Ot extends _ {
|
|
|
2611
2611
|
r.set(o, n);
|
|
2612
2612
|
}
|
|
2613
2613
|
}
|
|
2614
|
-
return new
|
|
2614
|
+
return new Ct({
|
|
2615
2615
|
typeName: g.ZodDiscriminatedUnion,
|
|
2616
2616
|
discriminator: e,
|
|
2617
2617
|
options: t,
|
|
@@ -2620,14 +2620,14 @@ class Ot extends _ {
|
|
|
2620
2620
|
});
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2624
|
-
const t =
|
|
2623
|
+
function Wt(s, e) {
|
|
2624
|
+
const t = ee(s), i = ee(e);
|
|
2625
2625
|
if (s === e)
|
|
2626
2626
|
return { valid: !0, data: s };
|
|
2627
2627
|
if (t === p.object && i === p.object) {
|
|
2628
|
-
const r =
|
|
2628
|
+
const r = x.objectKeys(e), n = x.objectKeys(s).filter((o) => r.indexOf(o) !== -1), a = { ...s, ...e };
|
|
2629
2629
|
for (const o of n) {
|
|
2630
|
-
const c =
|
|
2630
|
+
const c = Wt(s[o], e[o]);
|
|
2631
2631
|
if (!c.valid)
|
|
2632
2632
|
return { valid: !1 };
|
|
2633
2633
|
a[o] = c.data;
|
|
@@ -2638,7 +2638,7 @@ function qt(s, e) {
|
|
|
2638
2638
|
return { valid: !1 };
|
|
2639
2639
|
const r = [];
|
|
2640
2640
|
for (let n = 0; n < s.length; n++) {
|
|
2641
|
-
const a = s[n], o = e[n], c =
|
|
2641
|
+
const a = s[n], o = e[n], c = Wt(a, o);
|
|
2642
2642
|
if (!c.valid)
|
|
2643
2643
|
return { valid: !1 };
|
|
2644
2644
|
r.push(c.data);
|
|
@@ -2647,13 +2647,13 @@ function qt(s, e) {
|
|
|
2647
2647
|
} else
|
|
2648
2648
|
return t === p.date && i === p.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
2649
2649
|
}
|
|
2650
|
-
class
|
|
2650
|
+
class Xe extends _ {
|
|
2651
2651
|
_parse(e) {
|
|
2652
2652
|
const { status: t, ctx: i } = this._processInputParams(e), r = (n, a) => {
|
|
2653
|
-
if (
|
|
2653
|
+
if (Ft(n) || Ft(a))
|
|
2654
2654
|
return v;
|
|
2655
|
-
const o =
|
|
2656
|
-
return o.valid ? ((
|
|
2655
|
+
const o = Wt(n.value, a.value);
|
|
2656
|
+
return o.valid ? ((Ht(n) || Ht(a)) && t.dirty(), { status: t.value, value: o.data }) : (h(i, {
|
|
2657
2657
|
code: l.invalid_intersection_types
|
|
2658
2658
|
}), v);
|
|
2659
2659
|
};
|
|
@@ -2679,13 +2679,13 @@ class et extends _ {
|
|
|
2679
2679
|
}));
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
|
-
|
|
2682
|
+
Xe.create = (s, e, t) => new Xe({
|
|
2683
2683
|
left: s,
|
|
2684
2684
|
right: e,
|
|
2685
2685
|
typeName: g.ZodIntersection,
|
|
2686
2686
|
...y(t)
|
|
2687
2687
|
});
|
|
2688
|
-
class
|
|
2688
|
+
class Y extends _ {
|
|
2689
2689
|
_parse(e) {
|
|
2690
2690
|
const { status: t, ctx: i } = this._processInputParams(e);
|
|
2691
2691
|
if (i.parsedType !== p.array)
|
|
@@ -2711,31 +2711,31 @@ class J extends _ {
|
|
|
2711
2711
|
}), t.dirty());
|
|
2712
2712
|
const n = [...i.data].map((a, o) => {
|
|
2713
2713
|
const c = this._def.items[o] || this._def.rest;
|
|
2714
|
-
return c ? c._parse(new
|
|
2714
|
+
return c ? c._parse(new G(i, a, i.path, o)) : null;
|
|
2715
2715
|
}).filter((a) => !!a);
|
|
2716
|
-
return i.common.async ? Promise.all(n).then((a) =>
|
|
2716
|
+
return i.common.async ? Promise.all(n).then((a) => Z.mergeArray(t, a)) : Z.mergeArray(t, n);
|
|
2717
2717
|
}
|
|
2718
2718
|
get items() {
|
|
2719
2719
|
return this._def.items;
|
|
2720
2720
|
}
|
|
2721
2721
|
rest(e) {
|
|
2722
|
-
return new
|
|
2722
|
+
return new Y({
|
|
2723
2723
|
...this._def,
|
|
2724
2724
|
rest: e
|
|
2725
2725
|
});
|
|
2726
2726
|
}
|
|
2727
2727
|
}
|
|
2728
|
-
|
|
2728
|
+
Y.create = (s, e) => {
|
|
2729
2729
|
if (!Array.isArray(s))
|
|
2730
2730
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2731
|
-
return new
|
|
2731
|
+
return new Y({
|
|
2732
2732
|
items: s,
|
|
2733
2733
|
typeName: g.ZodTuple,
|
|
2734
2734
|
rest: null,
|
|
2735
2735
|
...y(e)
|
|
2736
2736
|
});
|
|
2737
2737
|
};
|
|
2738
|
-
class
|
|
2738
|
+
class et extends _ {
|
|
2739
2739
|
get keySchema() {
|
|
2740
2740
|
return this._def.keyType;
|
|
2741
2741
|
}
|
|
@@ -2753,30 +2753,30 @@ class tt extends _ {
|
|
|
2753
2753
|
const r = [], n = this._def.keyType, a = this._def.valueType;
|
|
2754
2754
|
for (const o in i.data)
|
|
2755
2755
|
r.push({
|
|
2756
|
-
key: n._parse(new
|
|
2757
|
-
value: a._parse(new
|
|
2756
|
+
key: n._parse(new G(i, o, i.path, o)),
|
|
2757
|
+
value: a._parse(new G(i, i.data[o], i.path, o)),
|
|
2758
2758
|
alwaysSet: o in i.data
|
|
2759
2759
|
});
|
|
2760
|
-
return i.common.async ?
|
|
2760
|
+
return i.common.async ? Z.mergeObjectAsync(t, r) : Z.mergeObjectSync(t, r);
|
|
2761
2761
|
}
|
|
2762
2762
|
get element() {
|
|
2763
2763
|
return this._def.valueType;
|
|
2764
2764
|
}
|
|
2765
2765
|
static create(e, t, i) {
|
|
2766
|
-
return t instanceof _ ? new
|
|
2766
|
+
return t instanceof _ ? new et({
|
|
2767
2767
|
keyType: e,
|
|
2768
2768
|
valueType: t,
|
|
2769
2769
|
typeName: g.ZodRecord,
|
|
2770
2770
|
...y(i)
|
|
2771
|
-
}) : new
|
|
2772
|
-
keyType:
|
|
2771
|
+
}) : new et({
|
|
2772
|
+
keyType: V.create(),
|
|
2773
2773
|
valueType: e,
|
|
2774
2774
|
typeName: g.ZodRecord,
|
|
2775
2775
|
...y(t)
|
|
2776
2776
|
});
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
2779
|
-
class
|
|
2779
|
+
class $t extends _ {
|
|
2780
2780
|
get keySchema() {
|
|
2781
2781
|
return this._def.keyType;
|
|
2782
2782
|
}
|
|
@@ -2792,8 +2792,8 @@ class St extends _ {
|
|
|
2792
2792
|
received: i.parsedType
|
|
2793
2793
|
}), v;
|
|
2794
2794
|
const r = this._def.keyType, n = this._def.valueType, a = [...i.data.entries()].map(([o, c], d) => ({
|
|
2795
|
-
key: r._parse(new
|
|
2796
|
-
value: n._parse(new
|
|
2795
|
+
key: r._parse(new G(i, o, i.path, [d, "key"])),
|
|
2796
|
+
value: n._parse(new G(i, c, i.path, [d, "value"]))
|
|
2797
2797
|
}));
|
|
2798
2798
|
if (i.common.async) {
|
|
2799
2799
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2818,7 +2818,7 @@ class St extends _ {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
|
-
|
|
2821
|
+
$t.create = (s, e, t) => new $t({
|
|
2822
2822
|
valueType: e,
|
|
2823
2823
|
keyType: s,
|
|
2824
2824
|
typeName: g.ZodMap,
|
|
@@ -2859,7 +2859,7 @@ class ke extends _ {
|
|
|
2859
2859
|
}
|
|
2860
2860
|
return { status: t.value, value: d };
|
|
2861
2861
|
}
|
|
2862
|
-
const o = [...i.data.values()].map((c, d) => n._parse(new
|
|
2862
|
+
const o = [...i.data.values()].map((c, d) => n._parse(new G(i, c, i.path, d)));
|
|
2863
2863
|
return i.common.async ? Promise.all(o).then((c) => a(c)) : a(o);
|
|
2864
2864
|
}
|
|
2865
2865
|
min(e, t) {
|
|
@@ -2888,7 +2888,7 @@ ke.create = (s, e) => new ke({
|
|
|
2888
2888
|
typeName: g.ZodSet,
|
|
2889
2889
|
...y(e)
|
|
2890
2890
|
});
|
|
2891
|
-
class
|
|
2891
|
+
class Re extends _ {
|
|
2892
2892
|
constructor() {
|
|
2893
2893
|
super(...arguments), this.validate = this.implement;
|
|
2894
2894
|
}
|
|
@@ -2901,14 +2901,14 @@ class Ne extends _ {
|
|
|
2901
2901
|
received: t.parsedType
|
|
2902
2902
|
}), v;
|
|
2903
2903
|
function i(o, c) {
|
|
2904
|
-
return
|
|
2904
|
+
return _t({
|
|
2905
2905
|
data: o,
|
|
2906
2906
|
path: t.path,
|
|
2907
2907
|
errorMaps: [
|
|
2908
2908
|
t.common.contextualErrorMap,
|
|
2909
2909
|
t.schemaErrorMap,
|
|
2910
|
-
|
|
2911
|
-
|
|
2910
|
+
yt(),
|
|
2911
|
+
Ne
|
|
2912
2912
|
].filter((d) => !!d),
|
|
2913
2913
|
issueData: {
|
|
2914
2914
|
code: l.invalid_arguments,
|
|
@@ -2917,14 +2917,14 @@ class Ne extends _ {
|
|
|
2917
2917
|
});
|
|
2918
2918
|
}
|
|
2919
2919
|
function r(o, c) {
|
|
2920
|
-
return
|
|
2920
|
+
return _t({
|
|
2921
2921
|
data: o,
|
|
2922
2922
|
path: t.path,
|
|
2923
2923
|
errorMaps: [
|
|
2924
2924
|
t.common.contextualErrorMap,
|
|
2925
2925
|
t.schemaErrorMap,
|
|
2926
|
-
|
|
2927
|
-
|
|
2926
|
+
yt(),
|
|
2927
|
+
Ne
|
|
2928
2928
|
].filter((d) => !!d),
|
|
2929
2929
|
issueData: {
|
|
2930
2930
|
code: l.invalid_return_type,
|
|
@@ -2933,10 +2933,10 @@ class Ne extends _ {
|
|
|
2933
2933
|
});
|
|
2934
2934
|
}
|
|
2935
2935
|
const n = { errorMap: t.common.contextualErrorMap }, a = t.data;
|
|
2936
|
-
if (this._def.returns instanceof
|
|
2936
|
+
if (this._def.returns instanceof Pe) {
|
|
2937
2937
|
const o = this;
|
|
2938
|
-
return
|
|
2939
|
-
const d = new
|
|
2938
|
+
return M(async function(...c) {
|
|
2939
|
+
const d = new L([]), u = await o._def.args.parseAsync(c, n).catch((O) => {
|
|
2940
2940
|
throw d.addIssue(i(c, O)), d;
|
|
2941
2941
|
}), m = await Reflect.apply(a, this, u);
|
|
2942
2942
|
return await o._def.returns._def.type.parseAsync(m, n).catch((O) => {
|
|
@@ -2945,13 +2945,13 @@ class Ne extends _ {
|
|
|
2945
2945
|
});
|
|
2946
2946
|
} else {
|
|
2947
2947
|
const o = this;
|
|
2948
|
-
return
|
|
2948
|
+
return M(function(...c) {
|
|
2949
2949
|
const d = o._def.args.safeParse(c, n);
|
|
2950
2950
|
if (!d.success)
|
|
2951
|
-
throw new
|
|
2951
|
+
throw new L([i(c, d.error)]);
|
|
2952
2952
|
const u = Reflect.apply(a, this, d.data), m = o._def.returns.safeParse(u, n);
|
|
2953
2953
|
if (!m.success)
|
|
2954
|
-
throw new
|
|
2954
|
+
throw new L([r(u, m.error)]);
|
|
2955
2955
|
return m.data;
|
|
2956
2956
|
});
|
|
2957
2957
|
}
|
|
@@ -2963,13 +2963,13 @@ class Ne extends _ {
|
|
|
2963
2963
|
return this._def.returns;
|
|
2964
2964
|
}
|
|
2965
2965
|
args(...e) {
|
|
2966
|
-
return new
|
|
2966
|
+
return new Re({
|
|
2967
2967
|
...this._def,
|
|
2968
|
-
args:
|
|
2968
|
+
args: Y.create(e).rest(we.create())
|
|
2969
2969
|
});
|
|
2970
2970
|
}
|
|
2971
2971
|
returns(e) {
|
|
2972
|
-
return new
|
|
2972
|
+
return new Re({
|
|
2973
2973
|
...this._def,
|
|
2974
2974
|
returns: e
|
|
2975
2975
|
});
|
|
@@ -2981,15 +2981,15 @@ class Ne extends _ {
|
|
|
2981
2981
|
return this.parse(e);
|
|
2982
2982
|
}
|
|
2983
2983
|
static create(e, t, i) {
|
|
2984
|
-
return new
|
|
2985
|
-
args: e ||
|
|
2986
|
-
returns: t ||
|
|
2984
|
+
return new Re({
|
|
2985
|
+
args: e || Y.create([]).rest(we.create()),
|
|
2986
|
+
returns: t || we.create(),
|
|
2987
2987
|
typeName: g.ZodFunction,
|
|
2988
2988
|
...y(i)
|
|
2989
2989
|
});
|
|
2990
2990
|
}
|
|
2991
2991
|
}
|
|
2992
|
-
class
|
|
2992
|
+
class tt extends _ {
|
|
2993
2993
|
get schema() {
|
|
2994
2994
|
return this._def.getter();
|
|
2995
2995
|
}
|
|
@@ -2998,12 +2998,12 @@ class st extends _ {
|
|
|
2998
2998
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
|
-
|
|
3001
|
+
tt.create = (s, e) => new tt({
|
|
3002
3002
|
getter: s,
|
|
3003
3003
|
typeName: g.ZodLazy,
|
|
3004
3004
|
...y(e)
|
|
3005
3005
|
});
|
|
3006
|
-
class
|
|
3006
|
+
class st extends _ {
|
|
3007
3007
|
_parse(e) {
|
|
3008
3008
|
if (e.data !== this._def.value) {
|
|
3009
3009
|
const t = this._getOrReturnCtx(e);
|
|
@@ -3019,32 +3019,32 @@ class it extends _ {
|
|
|
3019
3019
|
return this._def.value;
|
|
3020
3020
|
}
|
|
3021
3021
|
}
|
|
3022
|
-
|
|
3022
|
+
st.create = (s, e) => new st({
|
|
3023
3023
|
value: s,
|
|
3024
3024
|
typeName: g.ZodLiteral,
|
|
3025
3025
|
...y(e)
|
|
3026
3026
|
});
|
|
3027
|
-
function
|
|
3028
|
-
return new
|
|
3027
|
+
function ks(s, e) {
|
|
3028
|
+
return new ge({
|
|
3029
3029
|
values: s,
|
|
3030
3030
|
typeName: g.ZodEnum,
|
|
3031
3031
|
...y(e)
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
|
-
class
|
|
3034
|
+
class ge extends _ {
|
|
3035
3035
|
constructor() {
|
|
3036
|
-
super(...arguments),
|
|
3036
|
+
super(...arguments), ze.set(this, void 0);
|
|
3037
3037
|
}
|
|
3038
3038
|
_parse(e) {
|
|
3039
3039
|
if (typeof e.data != "string") {
|
|
3040
3040
|
const t = this._getOrReturnCtx(e), i = this._def.values;
|
|
3041
3041
|
return h(t, {
|
|
3042
|
-
expected:
|
|
3042
|
+
expected: x.joinValues(i),
|
|
3043
3043
|
received: t.parsedType,
|
|
3044
3044
|
code: l.invalid_type
|
|
3045
3045
|
}), v;
|
|
3046
3046
|
}
|
|
3047
|
-
if (
|
|
3047
|
+
if (bt(this, ze, "f") || xs(this, ze, new Set(this._def.values), "f"), !bt(this, ze, "f").has(e.data)) {
|
|
3048
3048
|
const t = this._getOrReturnCtx(e), i = this._def.values;
|
|
3049
3049
|
return h(t, {
|
|
3050
3050
|
received: t.data,
|
|
@@ -3052,7 +3052,7 @@ class ve extends _ {
|
|
|
3052
3052
|
options: i
|
|
3053
3053
|
}), v;
|
|
3054
3054
|
}
|
|
3055
|
-
return
|
|
3055
|
+
return M(e.data);
|
|
3056
3056
|
}
|
|
3057
3057
|
get options() {
|
|
3058
3058
|
return this._def.values;
|
|
@@ -3076,55 +3076,55 @@ class ve extends _ {
|
|
|
3076
3076
|
return e;
|
|
3077
3077
|
}
|
|
3078
3078
|
extract(e, t = this._def) {
|
|
3079
|
-
return
|
|
3079
|
+
return ge.create(e, {
|
|
3080
3080
|
...this._def,
|
|
3081
3081
|
...t
|
|
3082
3082
|
});
|
|
3083
3083
|
}
|
|
3084
3084
|
exclude(e, t = this._def) {
|
|
3085
|
-
return
|
|
3085
|
+
return ge.create(this.options.filter((i) => !e.includes(i)), {
|
|
3086
3086
|
...this._def,
|
|
3087
3087
|
...t
|
|
3088
3088
|
});
|
|
3089
3089
|
}
|
|
3090
3090
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
class
|
|
3091
|
+
ze = /* @__PURE__ */ new WeakMap();
|
|
3092
|
+
ge.create = ks;
|
|
3093
|
+
class it extends _ {
|
|
3094
3094
|
constructor() {
|
|
3095
|
-
super(...arguments),
|
|
3095
|
+
super(...arguments), Ve.set(this, void 0);
|
|
3096
3096
|
}
|
|
3097
3097
|
_parse(e) {
|
|
3098
|
-
const t =
|
|
3098
|
+
const t = x.getValidEnumValues(this._def.values), i = this._getOrReturnCtx(e);
|
|
3099
3099
|
if (i.parsedType !== p.string && i.parsedType !== p.number) {
|
|
3100
|
-
const r =
|
|
3100
|
+
const r = x.objectValues(t);
|
|
3101
3101
|
return h(i, {
|
|
3102
|
-
expected:
|
|
3102
|
+
expected: x.joinValues(r),
|
|
3103
3103
|
received: i.parsedType,
|
|
3104
3104
|
code: l.invalid_type
|
|
3105
3105
|
}), v;
|
|
3106
3106
|
}
|
|
3107
|
-
if (
|
|
3108
|
-
const r =
|
|
3107
|
+
if (bt(this, Ve, "f") || xs(this, Ve, new Set(x.getValidEnumValues(this._def.values)), "f"), !bt(this, Ve, "f").has(e.data)) {
|
|
3108
|
+
const r = x.objectValues(t);
|
|
3109
3109
|
return h(i, {
|
|
3110
3110
|
received: i.data,
|
|
3111
3111
|
code: l.invalid_enum_value,
|
|
3112
3112
|
options: r
|
|
3113
3113
|
}), v;
|
|
3114
3114
|
}
|
|
3115
|
-
return
|
|
3115
|
+
return M(e.data);
|
|
3116
3116
|
}
|
|
3117
3117
|
get enum() {
|
|
3118
3118
|
return this._def.values;
|
|
3119
3119
|
}
|
|
3120
3120
|
}
|
|
3121
|
-
|
|
3122
|
-
|
|
3121
|
+
Ve = /* @__PURE__ */ new WeakMap();
|
|
3122
|
+
it.create = (s, e) => new it({
|
|
3123
3123
|
values: s,
|
|
3124
3124
|
typeName: g.ZodNativeEnum,
|
|
3125
3125
|
...y(e)
|
|
3126
3126
|
});
|
|
3127
|
-
class
|
|
3127
|
+
class Pe extends _ {
|
|
3128
3128
|
unwrap() {
|
|
3129
3129
|
return this._def.type;
|
|
3130
3130
|
}
|
|
@@ -3137,13 +3137,13 @@ class Me extends _ {
|
|
|
3137
3137
|
received: t.parsedType
|
|
3138
3138
|
}), v;
|
|
3139
3139
|
const i = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
3140
|
-
return
|
|
3140
|
+
return M(i.then((r) => this._def.type.parseAsync(r, {
|
|
3141
3141
|
path: t.path,
|
|
3142
3142
|
errorMap: t.common.contextualErrorMap
|
|
3143
3143
|
})));
|
|
3144
3144
|
}
|
|
3145
3145
|
}
|
|
3146
|
-
|
|
3146
|
+
Pe.create = (s, e) => new Pe({
|
|
3147
3147
|
type: s,
|
|
3148
3148
|
typeName: g.ZodPromise,
|
|
3149
3149
|
...y(e)
|
|
@@ -3175,7 +3175,7 @@ class F extends _ {
|
|
|
3175
3175
|
path: i.path,
|
|
3176
3176
|
parent: i
|
|
3177
3177
|
});
|
|
3178
|
-
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ?
|
|
3178
|
+
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? Oe(c.value) : c;
|
|
3179
3179
|
});
|
|
3180
3180
|
{
|
|
3181
3181
|
if (t.value === "aborted")
|
|
@@ -3185,7 +3185,7 @@ class F extends _ {
|
|
|
3185
3185
|
path: i.path,
|
|
3186
3186
|
parent: i
|
|
3187
3187
|
});
|
|
3188
|
-
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ?
|
|
3188
|
+
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? Oe(o.value) : o;
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
3191
|
if (r.type === "refinement") {
|
|
@@ -3214,15 +3214,15 @@ class F extends _ {
|
|
|
3214
3214
|
path: i.path,
|
|
3215
3215
|
parent: i
|
|
3216
3216
|
});
|
|
3217
|
-
if (
|
|
3217
|
+
if (!$e(a))
|
|
3218
3218
|
return a;
|
|
3219
3219
|
const o = r.transform(a.value, n);
|
|
3220
3220
|
if (o instanceof Promise)
|
|
3221
3221
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3222
3222
|
return { status: t.value, value: o };
|
|
3223
3223
|
} else
|
|
3224
|
-
return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((a) =>
|
|
3225
|
-
|
|
3224
|
+
return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((a) => $e(a) ? Promise.resolve(r.transform(a.value, n)).then((o) => ({ status: t.value, value: o })) : a);
|
|
3225
|
+
x.assertNever(r);
|
|
3226
3226
|
}
|
|
3227
3227
|
}
|
|
3228
3228
|
F.create = (s, e, t) => new F({
|
|
@@ -3237,33 +3237,33 @@ F.createWithPreprocess = (s, e, t) => new F({
|
|
|
3237
3237
|
typeName: g.ZodEffects,
|
|
3238
3238
|
...y(t)
|
|
3239
3239
|
});
|
|
3240
|
-
class
|
|
3240
|
+
class q extends _ {
|
|
3241
3241
|
_parse(e) {
|
|
3242
|
-
return this._getType(e) === p.undefined ?
|
|
3242
|
+
return this._getType(e) === p.undefined ? M(void 0) : this._def.innerType._parse(e);
|
|
3243
3243
|
}
|
|
3244
3244
|
unwrap() {
|
|
3245
3245
|
return this._def.innerType;
|
|
3246
3246
|
}
|
|
3247
3247
|
}
|
|
3248
|
-
|
|
3248
|
+
q.create = (s, e) => new q({
|
|
3249
3249
|
innerType: s,
|
|
3250
3250
|
typeName: g.ZodOptional,
|
|
3251
3251
|
...y(e)
|
|
3252
3252
|
});
|
|
3253
|
-
class
|
|
3253
|
+
class ve extends _ {
|
|
3254
3254
|
_parse(e) {
|
|
3255
|
-
return this._getType(e) === p.null ?
|
|
3255
|
+
return this._getType(e) === p.null ? M(null) : this._def.innerType._parse(e);
|
|
3256
3256
|
}
|
|
3257
3257
|
unwrap() {
|
|
3258
3258
|
return this._def.innerType;
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
3261
|
-
|
|
3261
|
+
ve.create = (s, e) => new ve({
|
|
3262
3262
|
innerType: s,
|
|
3263
3263
|
typeName: g.ZodNullable,
|
|
3264
3264
|
...y(e)
|
|
3265
3265
|
});
|
|
3266
|
-
class
|
|
3266
|
+
class rt extends _ {
|
|
3267
3267
|
_parse(e) {
|
|
3268
3268
|
const { ctx: t } = this._processInputParams(e);
|
|
3269
3269
|
let i = t.data;
|
|
@@ -3277,13 +3277,13 @@ class nt extends _ {
|
|
|
3277
3277
|
return this._def.innerType;
|
|
3278
3278
|
}
|
|
3279
3279
|
}
|
|
3280
|
-
|
|
3280
|
+
rt.create = (s, e) => new rt({
|
|
3281
3281
|
innerType: s,
|
|
3282
3282
|
typeName: g.ZodDefault,
|
|
3283
3283
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3284
3284
|
...y(e)
|
|
3285
3285
|
});
|
|
3286
|
-
class
|
|
3286
|
+
class nt extends _ {
|
|
3287
3287
|
_parse(e) {
|
|
3288
3288
|
const { ctx: t } = this._processInputParams(e), i = {
|
|
3289
3289
|
...t,
|
|
@@ -3298,11 +3298,11 @@ class at extends _ {
|
|
|
3298
3298
|
...i
|
|
3299
3299
|
}
|
|
3300
3300
|
});
|
|
3301
|
-
return
|
|
3301
|
+
return qe(r) ? r.then((n) => ({
|
|
3302
3302
|
status: "valid",
|
|
3303
3303
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
3304
3304
|
get error() {
|
|
3305
|
-
return new
|
|
3305
|
+
return new L(i.common.issues);
|
|
3306
3306
|
},
|
|
3307
3307
|
input: i.data
|
|
3308
3308
|
})
|
|
@@ -3310,7 +3310,7 @@ class at extends _ {
|
|
|
3310
3310
|
status: "valid",
|
|
3311
3311
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3312
3312
|
get error() {
|
|
3313
|
-
return new
|
|
3313
|
+
return new L(i.common.issues);
|
|
3314
3314
|
},
|
|
3315
3315
|
input: i.data
|
|
3316
3316
|
})
|
|
@@ -3320,13 +3320,13 @@ class at extends _ {
|
|
|
3320
3320
|
return this._def.innerType;
|
|
3321
3321
|
}
|
|
3322
3322
|
}
|
|
3323
|
-
|
|
3323
|
+
nt.create = (s, e) => new nt({
|
|
3324
3324
|
innerType: s,
|
|
3325
3325
|
typeName: g.ZodCatch,
|
|
3326
3326
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3327
3327
|
...y(e)
|
|
3328
3328
|
});
|
|
3329
|
-
class
|
|
3329
|
+
class At extends _ {
|
|
3330
3330
|
_parse(e) {
|
|
3331
3331
|
if (this._getType(e) !== p.nan) {
|
|
3332
3332
|
const i = this._getOrReturnCtx(e);
|
|
@@ -3339,12 +3339,12 @@ class kt extends _ {
|
|
|
3339
3339
|
return { status: "valid", value: e.data };
|
|
3340
3340
|
}
|
|
3341
3341
|
}
|
|
3342
|
-
|
|
3342
|
+
At.create = (s) => new At({
|
|
3343
3343
|
typeName: g.ZodNaN,
|
|
3344
3344
|
...y(s)
|
|
3345
3345
|
});
|
|
3346
|
-
const
|
|
3347
|
-
class
|
|
3346
|
+
const ji = Symbol("zod_brand");
|
|
3347
|
+
class Yt extends _ {
|
|
3348
3348
|
_parse(e) {
|
|
3349
3349
|
const { ctx: t } = this._processInputParams(e), i = t.data;
|
|
3350
3350
|
return this._def.type._parse({
|
|
@@ -3357,7 +3357,7 @@ class Xt extends _ {
|
|
|
3357
3357
|
return this._def.type;
|
|
3358
3358
|
}
|
|
3359
3359
|
}
|
|
3360
|
-
class
|
|
3360
|
+
class ut extends _ {
|
|
3361
3361
|
_parse(e) {
|
|
3362
3362
|
const { status: t, ctx: i } = this._processInputParams(e);
|
|
3363
3363
|
if (i.common.async)
|
|
@@ -3367,7 +3367,7 @@ class ht extends _ {
|
|
|
3367
3367
|
path: i.path,
|
|
3368
3368
|
parent: i
|
|
3369
3369
|
});
|
|
3370
|
-
return n.status === "aborted" ? v : n.status === "dirty" ? (t.dirty(),
|
|
3370
|
+
return n.status === "aborted" ? v : n.status === "dirty" ? (t.dirty(), Oe(n.value)) : this._def.out._parseAsync({
|
|
3371
3371
|
data: n.value,
|
|
3372
3372
|
path: i.path,
|
|
3373
3373
|
parent: i
|
|
@@ -3390,185 +3390,185 @@ class ht extends _ {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
static create(e, t) {
|
|
3393
|
-
return new
|
|
3393
|
+
return new ut({
|
|
3394
3394
|
in: e,
|
|
3395
3395
|
out: t,
|
|
3396
3396
|
typeName: g.ZodPipeline
|
|
3397
3397
|
});
|
|
3398
3398
|
}
|
|
3399
3399
|
}
|
|
3400
|
-
class
|
|
3400
|
+
class at extends _ {
|
|
3401
3401
|
_parse(e) {
|
|
3402
|
-
const t = this._def.innerType._parse(e), i = (r) => (
|
|
3403
|
-
return
|
|
3402
|
+
const t = this._def.innerType._parse(e), i = (r) => ($e(r) && (r.value = Object.freeze(r.value)), r);
|
|
3403
|
+
return qe(t) ? t.then((r) => i(r)) : i(t);
|
|
3404
3404
|
}
|
|
3405
3405
|
unwrap() {
|
|
3406
3406
|
return this._def.innerType;
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
3409
|
-
|
|
3409
|
+
at.create = (s, e) => new at({
|
|
3410
3410
|
innerType: s,
|
|
3411
3411
|
typeName: g.ZodReadonly,
|
|
3412
3412
|
...y(e)
|
|
3413
3413
|
});
|
|
3414
|
-
function
|
|
3414
|
+
function os(s, e) {
|
|
3415
3415
|
const t = typeof s == "function" ? s(e) : typeof s == "string" ? { message: s } : s;
|
|
3416
3416
|
return typeof t == "string" ? { message: t } : t;
|
|
3417
3417
|
}
|
|
3418
|
-
function
|
|
3419
|
-
return s ?
|
|
3418
|
+
function Ss(s, e = {}, t) {
|
|
3419
|
+
return s ? Ie.create().superRefine((i, r) => {
|
|
3420
3420
|
var n, a;
|
|
3421
3421
|
const o = s(i);
|
|
3422
3422
|
if (o instanceof Promise)
|
|
3423
3423
|
return o.then((c) => {
|
|
3424
3424
|
var d, u;
|
|
3425
3425
|
if (!c) {
|
|
3426
|
-
const m =
|
|
3426
|
+
const m = os(e, i), $ = (u = (d = m.fatal) !== null && d !== void 0 ? d : t) !== null && u !== void 0 ? u : !0;
|
|
3427
3427
|
r.addIssue({ code: "custom", ...m, fatal: $ });
|
|
3428
3428
|
}
|
|
3429
3429
|
});
|
|
3430
3430
|
if (!o) {
|
|
3431
|
-
const c =
|
|
3431
|
+
const c = os(e, i), d = (a = (n = c.fatal) !== null && n !== void 0 ? n : t) !== null && a !== void 0 ? a : !0;
|
|
3432
3432
|
r.addIssue({ code: "custom", ...c, fatal: d });
|
|
3433
3433
|
}
|
|
3434
|
-
}) :
|
|
3434
|
+
}) : Ie.create();
|
|
3435
3435
|
}
|
|
3436
|
-
const
|
|
3436
|
+
const Di = {
|
|
3437
3437
|
object: T.lazycreate
|
|
3438
3438
|
};
|
|
3439
3439
|
var g;
|
|
3440
3440
|
(function(s) {
|
|
3441
3441
|
s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
|
|
3442
3442
|
})(g || (g = {}));
|
|
3443
|
-
const
|
|
3443
|
+
const Ui = (s, e = {
|
|
3444
3444
|
message: `Input not instance of ${s.name}`
|
|
3445
|
-
}) =>
|
|
3446
|
-
string: (s) =>
|
|
3447
|
-
number: (s) =>
|
|
3448
|
-
boolean: (s) =>
|
|
3445
|
+
}) => Ss((t) => t instanceof s, e), Es = V.create, Cs = fe.create, Li = At.create, zi = me.create, Ts = Ge.create, Vi = Ae.create, Bi = xt.create, Fi = Ye.create, Hi = Je.create, Wi = Ie.create, Ki = we.create, qi = te.create, Gi = wt.create, Yi = B.create, Ji = T.create, Qi = T.strictCreate, Xi = Qe.create, er = Ct.create, tr = Xe.create, sr = Y.create, ir = et.create, rr = $t.create, nr = ke.create, ar = Re.create, or = tt.create, cr = st.create, dr = ge.create, lr = it.create, ur = Pe.create, cs = F.create, hr = q.create, pr = ve.create, fr = F.createWithPreprocess, mr = ut.create, gr = () => Es().optional(), vr = () => Cs().optional(), yr = () => Ts().optional(), _r = {
|
|
3446
|
+
string: (s) => V.create({ ...s, coerce: !0 }),
|
|
3447
|
+
number: (s) => fe.create({ ...s, coerce: !0 }),
|
|
3448
|
+
boolean: (s) => Ge.create({
|
|
3449
3449
|
...s,
|
|
3450
3450
|
coerce: !0
|
|
3451
3451
|
}),
|
|
3452
|
-
bigint: (s) =>
|
|
3453
|
-
date: (s) =>
|
|
3454
|
-
},
|
|
3452
|
+
bigint: (s) => me.create({ ...s, coerce: !0 }),
|
|
3453
|
+
date: (s) => Ae.create({ ...s, coerce: !0 })
|
|
3454
|
+
}, br = v;
|
|
3455
3455
|
var Q = /* @__PURE__ */ Object.freeze({
|
|
3456
3456
|
__proto__: null,
|
|
3457
|
-
defaultErrorMap:
|
|
3458
|
-
setErrorMap:
|
|
3459
|
-
getErrorMap:
|
|
3460
|
-
makeIssue:
|
|
3461
|
-
EMPTY_PATH:
|
|
3457
|
+
defaultErrorMap: Ne,
|
|
3458
|
+
setErrorMap: fi,
|
|
3459
|
+
getErrorMap: yt,
|
|
3460
|
+
makeIssue: _t,
|
|
3461
|
+
EMPTY_PATH: mi,
|
|
3462
3462
|
addIssueToContext: h,
|
|
3463
|
-
ParseStatus:
|
|
3463
|
+
ParseStatus: Z,
|
|
3464
3464
|
INVALID: v,
|
|
3465
|
-
DIRTY:
|
|
3466
|
-
OK:
|
|
3467
|
-
isAborted:
|
|
3468
|
-
isDirty:
|
|
3469
|
-
isValid:
|
|
3470
|
-
isAsync:
|
|
3465
|
+
DIRTY: Oe,
|
|
3466
|
+
OK: M,
|
|
3467
|
+
isAborted: Ft,
|
|
3468
|
+
isDirty: Ht,
|
|
3469
|
+
isValid: $e,
|
|
3470
|
+
isAsync: qe,
|
|
3471
3471
|
get util() {
|
|
3472
|
-
return
|
|
3472
|
+
return x;
|
|
3473
3473
|
},
|
|
3474
3474
|
get objectUtil() {
|
|
3475
|
-
return
|
|
3475
|
+
return Bt;
|
|
3476
3476
|
},
|
|
3477
3477
|
ZodParsedType: p,
|
|
3478
|
-
getParsedType:
|
|
3478
|
+
getParsedType: ee,
|
|
3479
3479
|
ZodType: _,
|
|
3480
|
-
datetimeRegex:
|
|
3481
|
-
ZodString:
|
|
3482
|
-
ZodNumber:
|
|
3483
|
-
ZodBigInt:
|
|
3484
|
-
ZodBoolean:
|
|
3485
|
-
ZodDate:
|
|
3486
|
-
ZodSymbol:
|
|
3487
|
-
ZodUndefined:
|
|
3488
|
-
ZodNull:
|
|
3489
|
-
ZodAny:
|
|
3490
|
-
ZodUnknown:
|
|
3491
|
-
ZodNever:
|
|
3492
|
-
ZodVoid:
|
|
3493
|
-
ZodArray:
|
|
3480
|
+
datetimeRegex: As,
|
|
3481
|
+
ZodString: V,
|
|
3482
|
+
ZodNumber: fe,
|
|
3483
|
+
ZodBigInt: me,
|
|
3484
|
+
ZodBoolean: Ge,
|
|
3485
|
+
ZodDate: Ae,
|
|
3486
|
+
ZodSymbol: xt,
|
|
3487
|
+
ZodUndefined: Ye,
|
|
3488
|
+
ZodNull: Je,
|
|
3489
|
+
ZodAny: Ie,
|
|
3490
|
+
ZodUnknown: we,
|
|
3491
|
+
ZodNever: te,
|
|
3492
|
+
ZodVoid: wt,
|
|
3493
|
+
ZodArray: B,
|
|
3494
3494
|
ZodObject: T,
|
|
3495
3495
|
ZodUnion: Qe,
|
|
3496
|
-
ZodDiscriminatedUnion:
|
|
3497
|
-
ZodIntersection:
|
|
3498
|
-
ZodTuple:
|
|
3499
|
-
ZodRecord:
|
|
3500
|
-
ZodMap:
|
|
3496
|
+
ZodDiscriminatedUnion: Ct,
|
|
3497
|
+
ZodIntersection: Xe,
|
|
3498
|
+
ZodTuple: Y,
|
|
3499
|
+
ZodRecord: et,
|
|
3500
|
+
ZodMap: $t,
|
|
3501
3501
|
ZodSet: ke,
|
|
3502
|
-
ZodFunction:
|
|
3503
|
-
ZodLazy:
|
|
3504
|
-
ZodLiteral:
|
|
3505
|
-
ZodEnum:
|
|
3506
|
-
ZodNativeEnum:
|
|
3507
|
-
ZodPromise:
|
|
3502
|
+
ZodFunction: Re,
|
|
3503
|
+
ZodLazy: tt,
|
|
3504
|
+
ZodLiteral: st,
|
|
3505
|
+
ZodEnum: ge,
|
|
3506
|
+
ZodNativeEnum: it,
|
|
3507
|
+
ZodPromise: Pe,
|
|
3508
3508
|
ZodEffects: F,
|
|
3509
3509
|
ZodTransformer: F,
|
|
3510
|
-
ZodOptional:
|
|
3511
|
-
ZodNullable:
|
|
3512
|
-
ZodDefault:
|
|
3513
|
-
ZodCatch:
|
|
3514
|
-
ZodNaN:
|
|
3515
|
-
BRAND:
|
|
3516
|
-
ZodBranded:
|
|
3517
|
-
ZodPipeline:
|
|
3518
|
-
ZodReadonly:
|
|
3519
|
-
custom:
|
|
3510
|
+
ZodOptional: q,
|
|
3511
|
+
ZodNullable: ve,
|
|
3512
|
+
ZodDefault: rt,
|
|
3513
|
+
ZodCatch: nt,
|
|
3514
|
+
ZodNaN: At,
|
|
3515
|
+
BRAND: ji,
|
|
3516
|
+
ZodBranded: Yt,
|
|
3517
|
+
ZodPipeline: ut,
|
|
3518
|
+
ZodReadonly: at,
|
|
3519
|
+
custom: Ss,
|
|
3520
3520
|
Schema: _,
|
|
3521
3521
|
ZodSchema: _,
|
|
3522
|
-
late:
|
|
3522
|
+
late: Di,
|
|
3523
3523
|
get ZodFirstPartyTypeKind() {
|
|
3524
3524
|
return g;
|
|
3525
3525
|
},
|
|
3526
|
-
coerce:
|
|
3527
|
-
any:
|
|
3528
|
-
array:
|
|
3529
|
-
bigint:
|
|
3530
|
-
boolean:
|
|
3531
|
-
date:
|
|
3532
|
-
discriminatedUnion:
|
|
3533
|
-
effect:
|
|
3534
|
-
enum:
|
|
3535
|
-
function:
|
|
3536
|
-
instanceof:
|
|
3537
|
-
intersection:
|
|
3538
|
-
lazy:
|
|
3539
|
-
literal:
|
|
3540
|
-
map:
|
|
3541
|
-
nan:
|
|
3542
|
-
nativeEnum:
|
|
3543
|
-
never:
|
|
3544
|
-
null:
|
|
3545
|
-
nullable:
|
|
3546
|
-
number:
|
|
3547
|
-
object:
|
|
3548
|
-
oboolean:
|
|
3549
|
-
onumber:
|
|
3550
|
-
optional:
|
|
3551
|
-
ostring:
|
|
3552
|
-
pipeline:
|
|
3553
|
-
preprocess:
|
|
3554
|
-
promise:
|
|
3555
|
-
record:
|
|
3556
|
-
set:
|
|
3557
|
-
strictObject:
|
|
3558
|
-
string:
|
|
3559
|
-
symbol:
|
|
3560
|
-
transformer:
|
|
3561
|
-
tuple:
|
|
3562
|
-
undefined:
|
|
3563
|
-
union:
|
|
3564
|
-
unknown:
|
|
3565
|
-
void:
|
|
3566
|
-
NEVER:
|
|
3526
|
+
coerce: _r,
|
|
3527
|
+
any: Wi,
|
|
3528
|
+
array: Yi,
|
|
3529
|
+
bigint: zi,
|
|
3530
|
+
boolean: Ts,
|
|
3531
|
+
date: Vi,
|
|
3532
|
+
discriminatedUnion: er,
|
|
3533
|
+
effect: cs,
|
|
3534
|
+
enum: dr,
|
|
3535
|
+
function: ar,
|
|
3536
|
+
instanceof: Ui,
|
|
3537
|
+
intersection: tr,
|
|
3538
|
+
lazy: or,
|
|
3539
|
+
literal: cr,
|
|
3540
|
+
map: rr,
|
|
3541
|
+
nan: Li,
|
|
3542
|
+
nativeEnum: lr,
|
|
3543
|
+
never: qi,
|
|
3544
|
+
null: Hi,
|
|
3545
|
+
nullable: pr,
|
|
3546
|
+
number: Cs,
|
|
3547
|
+
object: Ji,
|
|
3548
|
+
oboolean: yr,
|
|
3549
|
+
onumber: vr,
|
|
3550
|
+
optional: hr,
|
|
3551
|
+
ostring: gr,
|
|
3552
|
+
pipeline: mr,
|
|
3553
|
+
preprocess: fr,
|
|
3554
|
+
promise: ur,
|
|
3555
|
+
record: ir,
|
|
3556
|
+
set: nr,
|
|
3557
|
+
strictObject: Qi,
|
|
3558
|
+
string: Es,
|
|
3559
|
+
symbol: Bi,
|
|
3560
|
+
transformer: cs,
|
|
3561
|
+
tuple: sr,
|
|
3562
|
+
undefined: Fi,
|
|
3563
|
+
union: Xi,
|
|
3564
|
+
unknown: Ki,
|
|
3565
|
+
void: Gi,
|
|
3566
|
+
NEVER: br,
|
|
3567
3567
|
ZodIssueCode: l,
|
|
3568
|
-
quotelessJson:
|
|
3569
|
-
ZodError:
|
|
3568
|
+
quotelessJson: pi,
|
|
3569
|
+
ZodError: L
|
|
3570
3570
|
});
|
|
3571
|
-
const
|
|
3571
|
+
const Os = "https://iamobi.ai/api", xr = Q.object({
|
|
3572
3572
|
apiKey: Q.string().optional(),
|
|
3573
3573
|
enableVoice: Q.boolean().default(!0),
|
|
3574
3574
|
enableScreenCapture: Q.boolean().default(!0),
|
|
@@ -3579,12 +3579,12 @@ const Ps = "https://iamobi.ai/api", Sr = Q.object({
|
|
|
3579
3579
|
metadata: Q.any().optional()
|
|
3580
3580
|
}).optional()
|
|
3581
3581
|
});
|
|
3582
|
-
var
|
|
3583
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
3582
|
+
var ue = /* @__PURE__ */ ((s) => (s.READY = "ready", s.ERROR = "error", s.VOICE_START = "voice:start", s.VOICE_STOP = "voice:stop", s.SCREEN_CAPTURE_START = "screen:start", s.SCREEN_CAPTURE_STOP = "screen:stop", s.STATE_CHANGE = "state:change", s))(ue || {}), A = /* @__PURE__ */ ((s) => (s.READY = "ready", s.ERROR = "error", s.PAUSED = "paused", s.LOADING = "loading", s.THINKING = "thinking", s.RESEARCHING = "researching", s.AGENT_SPEAKING = "agent_speaking", s.USER_SPEAKING = "user_speaking", s.AWAITING_USER_INPUT = "awaiting_user_input", s))(A || {}), wr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, Tt = (s, e, t, i) => {
|
|
3583
|
+
for (var r = i > 1 ? void 0 : i ? $r(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
3584
3584
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
3585
|
-
return i && r &&
|
|
3585
|
+
return i && r && wr(e, t, r), r;
|
|
3586
3586
|
};
|
|
3587
|
-
class
|
|
3587
|
+
class Me extends ie {
|
|
3588
3588
|
constructor() {
|
|
3589
3589
|
super(...arguments), this.id = "", this.isActive = !1, this.isSpecial = !1;
|
|
3590
3590
|
}
|
|
@@ -3614,7 +3614,7 @@ class je extends re {
|
|
|
3614
3614
|
`;
|
|
3615
3615
|
}
|
|
3616
3616
|
}
|
|
3617
|
-
|
|
3617
|
+
Me.styles = se`
|
|
3618
3618
|
:host {
|
|
3619
3619
|
display: block;
|
|
3620
3620
|
}
|
|
@@ -3667,20 +3667,20 @@ je.styles = ie`
|
|
|
3667
3667
|
height: 18px;
|
|
3668
3668
|
}
|
|
3669
3669
|
`;
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
],
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
],
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
],
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
],
|
|
3682
|
-
customElements.get("obi-nav-icon") || customElements.define("obi-nav-icon",
|
|
3683
|
-
const
|
|
3670
|
+
Tt([
|
|
3671
|
+
w({ type: String })
|
|
3672
|
+
], Me.prototype, "id", 2);
|
|
3673
|
+
Tt([
|
|
3674
|
+
w({ type: Boolean })
|
|
3675
|
+
], Me.prototype, "isActive", 2);
|
|
3676
|
+
Tt([
|
|
3677
|
+
w({ type: Boolean })
|
|
3678
|
+
], Me.prototype, "isSpecial", 2);
|
|
3679
|
+
Tt([
|
|
3680
|
+
w({ type: Function })
|
|
3681
|
+
], Me.prototype, "onClick", 2);
|
|
3682
|
+
customElements.get("obi-nav-icon") || customElements.define("obi-nav-icon", Me);
|
|
3683
|
+
const ht = (s) => E`
|
|
3684
3684
|
<svg
|
|
3685
3685
|
xmlns="http://www.w3.org/2000/svg"
|
|
3686
3686
|
width="24"
|
|
@@ -3696,18 +3696,18 @@ const pt = (s) => E`
|
|
|
3696
3696
|
>
|
|
3697
3697
|
${s}
|
|
3698
3698
|
</svg>
|
|
3699
|
-
`,
|
|
3699
|
+
`, Ar = ht(lt`
|
|
3700
3700
|
<rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>
|
|
3701
|
-
`),
|
|
3701
|
+
`), kr = ht(lt`<polygon points="6 3 20 12 6 21 6 3"/>`), Sr = ht(lt`
|
|
3702
3702
|
<path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>
|
|
3703
|
-
`),
|
|
3703
|
+
`), Er = ht(lt`
|
|
3704
3704
|
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
|
3705
|
-
`),
|
|
3705
|
+
`), Cr = ht(lt`
|
|
3706
3706
|
<path d="M12 7v14" />
|
|
3707
3707
|
<path
|
|
3708
3708
|
d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
|
|
3709
3709
|
/>
|
|
3710
|
-
`),
|
|
3710
|
+
`), ds = E`
|
|
3711
3711
|
<img
|
|
3712
3712
|
class="widget-icon"
|
|
3713
3713
|
src="data:image/svg+xml;base64,${btoa(`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -3729,12 +3729,12 @@ const pt = (s) => E`
|
|
|
3729
3729
|
alt="Obi Icon"
|
|
3730
3730
|
/>
|
|
3731
3731
|
`;
|
|
3732
|
-
var
|
|
3733
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
3732
|
+
var Tr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, je = (s, e, t, i) => {
|
|
3733
|
+
for (var r = i > 1 ? void 0 : i ? Or(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
3734
3734
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
3735
|
-
return i && r &&
|
|
3735
|
+
return i && r && Tr(e, t, r), r;
|
|
3736
3736
|
};
|
|
3737
|
-
class
|
|
3737
|
+
class _e extends ie {
|
|
3738
3738
|
constructor() {
|
|
3739
3739
|
super(), this.isActive = !1, this.isScreenActive = !1, this.position = { top: 0, left: 0 }, this.currentState = A.READY, this.direction = "up";
|
|
3740
3740
|
}
|
|
@@ -3752,7 +3752,7 @@ class be extends re {
|
|
|
3752
3752
|
?isActive=${this.currentState === A.PAUSED}
|
|
3753
3753
|
@click=${() => this.handleIconClick("pause", this.currentState !== A.PAUSED)}
|
|
3754
3754
|
>
|
|
3755
|
-
${this.currentState === A.PAUSED ?
|
|
3755
|
+
${this.currentState === A.PAUSED ? kr : Ar}
|
|
3756
3756
|
</obi-nav-icon>
|
|
3757
3757
|
<obi-nav-icon
|
|
3758
3758
|
id="activate"
|
|
@@ -3760,20 +3760,20 @@ class be extends re {
|
|
|
3760
3760
|
?isSpecial=${!0}
|
|
3761
3761
|
@click=${() => this.handleIconClick("activate", !this.isActive)}
|
|
3762
3762
|
>
|
|
3763
|
-
${this.isActive ?
|
|
3763
|
+
${this.isActive ? Er : Sr}
|
|
3764
3764
|
</obi-nav-icon>
|
|
3765
3765
|
` : E`
|
|
3766
3766
|
<obi-nav-icon
|
|
3767
3767
|
id="experiences"
|
|
3768
3768
|
@click=${() => this.handleIconClick("experiences", !0)}
|
|
3769
3769
|
>
|
|
3770
|
-
${
|
|
3770
|
+
${Cr}
|
|
3771
3771
|
</obi-nav-icon>
|
|
3772
3772
|
`}
|
|
3773
3773
|
`;
|
|
3774
3774
|
}
|
|
3775
3775
|
}
|
|
3776
|
-
|
|
3776
|
+
_e.styles = se`
|
|
3777
3777
|
:host {
|
|
3778
3778
|
display: flex;
|
|
3779
3779
|
position: absolute;
|
|
@@ -3798,31 +3798,31 @@ be.styles = ie`
|
|
|
3798
3798
|
flex-direction: column;
|
|
3799
3799
|
}
|
|
3800
3800
|
`;
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
],
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
],
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
],
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
],
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
],
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
],
|
|
3819
|
-
customElements.get("obi-navigation-bar") || customElements.define("obi-navigation-bar",
|
|
3820
|
-
var
|
|
3821
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
3801
|
+
je([
|
|
3802
|
+
w({ type: Boolean })
|
|
3803
|
+
], _e.prototype, "isActive", 2);
|
|
3804
|
+
je([
|
|
3805
|
+
w({ type: Boolean })
|
|
3806
|
+
], _e.prototype, "isScreenActive", 2);
|
|
3807
|
+
je([
|
|
3808
|
+
w({ type: Object })
|
|
3809
|
+
], _e.prototype, "position", 2);
|
|
3810
|
+
je([
|
|
3811
|
+
w({ type: String })
|
|
3812
|
+
], _e.prototype, "currentState", 2);
|
|
3813
|
+
je([
|
|
3814
|
+
w({ type: String })
|
|
3815
|
+
], _e.prototype, "direction", 2);
|
|
3816
|
+
je([
|
|
3817
|
+
w({ type: Function })
|
|
3818
|
+
], _e.prototype, "onItemSelect", 2);
|
|
3819
|
+
customElements.get("obi-navigation-bar") || customElements.define("obi-navigation-bar", _e);
|
|
3820
|
+
var Rr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, re = (s, e, t, i) => {
|
|
3821
|
+
for (var r = i > 1 ? void 0 : i ? Nr(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
3822
3822
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
3823
|
-
return i && r &&
|
|
3823
|
+
return i && r && Rr(e, t, r), r;
|
|
3824
3824
|
};
|
|
3825
|
-
class
|
|
3825
|
+
class Ee extends ie {
|
|
3826
3826
|
constructor() {
|
|
3827
3827
|
super(...arguments), this.id = "", this.name = "", this.description = "", this.imageSrc = "";
|
|
3828
3828
|
}
|
|
@@ -3845,7 +3845,7 @@ class Ce extends re {
|
|
|
3845
3845
|
`;
|
|
3846
3846
|
}
|
|
3847
3847
|
}
|
|
3848
|
-
|
|
3848
|
+
Ee.styles = se`
|
|
3849
3849
|
:host {
|
|
3850
3850
|
display: block;
|
|
3851
3851
|
}
|
|
@@ -3891,22 +3891,22 @@ Ce.styles = ie`
|
|
|
3891
3891
|
margin: 0;
|
|
3892
3892
|
}
|
|
3893
3893
|
`;
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
],
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
],
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
],
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
],
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
],
|
|
3909
|
-
class
|
|
3894
|
+
re([
|
|
3895
|
+
w({ type: String })
|
|
3896
|
+
], Ee.prototype, "id", 2);
|
|
3897
|
+
re([
|
|
3898
|
+
w({ type: String })
|
|
3899
|
+
], Ee.prototype, "name", 2);
|
|
3900
|
+
re([
|
|
3901
|
+
w({ type: String })
|
|
3902
|
+
], Ee.prototype, "description", 2);
|
|
3903
|
+
re([
|
|
3904
|
+
w({ type: String })
|
|
3905
|
+
], Ee.prototype, "imageSrc", 2);
|
|
3906
|
+
re([
|
|
3907
|
+
w({ type: Function })
|
|
3908
|
+
], Ee.prototype, "onSelect", 2);
|
|
3909
|
+
class De extends ie {
|
|
3910
3910
|
constructor() {
|
|
3911
3911
|
super(...arguments), this.courses = [], this.loading = !1, this.error = "";
|
|
3912
3912
|
}
|
|
@@ -3938,7 +3938,7 @@ class Le extends re {
|
|
|
3938
3938
|
`;
|
|
3939
3939
|
}
|
|
3940
3940
|
}
|
|
3941
|
-
|
|
3941
|
+
De.styles = se`
|
|
3942
3942
|
:host {
|
|
3943
3943
|
display: block;
|
|
3944
3944
|
}
|
|
@@ -3974,26 +3974,26 @@ Le.styles = ie`
|
|
|
3974
3974
|
color: #ef4444;
|
|
3975
3975
|
}
|
|
3976
3976
|
`;
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
],
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
],
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
],
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
],
|
|
3989
|
-
customElements.get("obi-course") || customElements.define("obi-course",
|
|
3990
|
-
customElements.get("obi-course-list") || customElements.define("obi-course-list",
|
|
3991
|
-
var
|
|
3992
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
3977
|
+
re([
|
|
3978
|
+
w({ type: Array })
|
|
3979
|
+
], De.prototype, "courses", 2);
|
|
3980
|
+
re([
|
|
3981
|
+
w({ type: Boolean })
|
|
3982
|
+
], De.prototype, "loading", 2);
|
|
3983
|
+
re([
|
|
3984
|
+
w({ type: String })
|
|
3985
|
+
], De.prototype, "error", 2);
|
|
3986
|
+
re([
|
|
3987
|
+
w({ type: Function })
|
|
3988
|
+
], De.prototype, "onCourseSelect", 2);
|
|
3989
|
+
customElements.get("obi-course") || customElements.define("obi-course", Ee);
|
|
3990
|
+
customElements.get("obi-course-list") || customElements.define("obi-course-list", De);
|
|
3991
|
+
var Ir = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, Ce = (s, e, t, i) => {
|
|
3992
|
+
for (var r = i > 1 ? void 0 : i ? Pr(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
3993
3993
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
3994
|
-
return i && r &&
|
|
3994
|
+
return i && r && Ir(e, t, r), r;
|
|
3995
3995
|
};
|
|
3996
|
-
class
|
|
3996
|
+
class ne extends ie {
|
|
3997
3997
|
constructor() {
|
|
3998
3998
|
super(...arguments), this.courses = [], this.loading = !0, this.error = "", this.apiBaseUrl = "", this.apiKey = "";
|
|
3999
3999
|
}
|
|
@@ -4021,7 +4021,7 @@ class ae extends re {
|
|
|
4021
4021
|
}
|
|
4022
4022
|
connectedCallback() {
|
|
4023
4023
|
var e;
|
|
4024
|
-
super.connectedCallback(), (e = window.obiWidgetConfig) != null && e.apiKey && (this.apiKey = window.obiWidgetConfig.apiKey), this.apiBaseUrl =
|
|
4024
|
+
super.connectedCallback(), (e = window.obiWidgetConfig) != null && e.apiKey && (this.apiKey = window.obiWidgetConfig.apiKey), this.apiBaseUrl = Os, this.apiBaseUrl && this.apiKey ? this.fetchCourses() : (this.loading = !1, this.error = "API base URL or API key is missing");
|
|
4025
4025
|
}
|
|
4026
4026
|
render() {
|
|
4027
4027
|
return E`
|
|
@@ -4043,7 +4043,7 @@ class ae extends re {
|
|
|
4043
4043
|
`;
|
|
4044
4044
|
}
|
|
4045
4045
|
}
|
|
4046
|
-
|
|
4046
|
+
ne.styles = se`
|
|
4047
4047
|
:host {
|
|
4048
4048
|
display: block;
|
|
4049
4049
|
font-family: "Syne", sans-serif;
|
|
@@ -4127,61 +4127,61 @@ ae.styles = ie`
|
|
|
4127
4127
|
color: #6b7280;
|
|
4128
4128
|
}
|
|
4129
4129
|
`;
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
],
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
],
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
],
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
],
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
],
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
],
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
],
|
|
4151
|
-
customElements.get("obi-course-modal") || customElements.define("obi-course-modal",
|
|
4130
|
+
Ce([
|
|
4131
|
+
w({ type: Array })
|
|
4132
|
+
], ne.prototype, "courses", 2);
|
|
4133
|
+
Ce([
|
|
4134
|
+
w({ type: Boolean })
|
|
4135
|
+
], ne.prototype, "loading", 2);
|
|
4136
|
+
Ce([
|
|
4137
|
+
w({ type: String })
|
|
4138
|
+
], ne.prototype, "error", 2);
|
|
4139
|
+
Ce([
|
|
4140
|
+
w({ type: String })
|
|
4141
|
+
], ne.prototype, "apiBaseUrl", 2);
|
|
4142
|
+
Ce([
|
|
4143
|
+
w({ type: String })
|
|
4144
|
+
], ne.prototype, "apiKey", 2);
|
|
4145
|
+
Ce([
|
|
4146
|
+
w({ type: Function })
|
|
4147
|
+
], ne.prototype, "onCourseSelect", 2);
|
|
4148
|
+
Ce([
|
|
4149
|
+
w({ type: Function })
|
|
4150
|
+
], ne.prototype, "onClose", 2);
|
|
4151
|
+
customElements.get("obi-course-modal") || customElements.define("obi-course-modal", ne);
|
|
4152
4152
|
/**
|
|
4153
4153
|
* @license
|
|
4154
4154
|
* Copyright 2017 Google LLC
|
|
4155
4155
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4156
4156
|
*/
|
|
4157
|
-
const Fe = globalThis,
|
|
4158
|
-
\f\r]`,
|
|
4159
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
4160
|
-
function
|
|
4161
|
-
if (!
|
|
4157
|
+
const Fe = globalThis, kt = Fe.trustedTypes, ls = kt ? kt.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, Rs = "$lit$", he = `lit$${Math.random().toFixed(9).slice(2)}$`, Ns = "?" + he, Zr = `<${Ns}>`, Se = document, St = () => Se.createComment(""), ot = (s) => s === null || typeof s != "object" && typeof s != "function", Jt = Array.isArray, Mr = (s) => Jt(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Mt = `[
|
|
4158
|
+
\f\r]`, Le = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, us = /-->/g, hs = />/g, be = RegExp(`>|${Mt}(?:([^\\s"'>=/]+)(${Mt}*=${Mt}*(?:[^
|
|
4159
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ps = /'/g, fs = /"/g, Is = /^(?:script|style|textarea|title)$/i, ct = Symbol.for("lit-noChange"), N = Symbol.for("lit-nothing"), ms = /* @__PURE__ */ new WeakMap(), xe = Se.createTreeWalker(Se, 129);
|
|
4160
|
+
function Ps(s, e) {
|
|
4161
|
+
if (!Jt(s) || !s.hasOwnProperty("raw"))
|
|
4162
4162
|
throw Error("invalid template strings array");
|
|
4163
|
-
return
|
|
4163
|
+
return ls !== void 0 ? ls.createHTML(e) : e;
|
|
4164
4164
|
}
|
|
4165
|
-
const
|
|
4165
|
+
const jr = (s, e) => {
|
|
4166
4166
|
const t = s.length - 1, i = [];
|
|
4167
|
-
let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a =
|
|
4167
|
+
let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = Le;
|
|
4168
4168
|
for (let o = 0; o < t; o++) {
|
|
4169
4169
|
const c = s[o];
|
|
4170
4170
|
let d, u, m = -1, $ = 0;
|
|
4171
4171
|
for (; $ < c.length && (a.lastIndex = $, u = a.exec(c), u !== null); )
|
|
4172
|
-
$ = a.lastIndex, a ===
|
|
4173
|
-
const O = a ===
|
|
4174
|
-
n += a ===
|
|
4172
|
+
$ = a.lastIndex, a === Le ? u[1] === "!--" ? a = us : u[1] !== void 0 ? a = hs : u[2] !== void 0 ? (Is.test(u[2]) && (r = RegExp("</" + u[2], "g")), a = be) : u[3] !== void 0 && (a = be) : a === be ? u[0] === ">" ? (a = r ?? Le, m = -1) : u[1] === void 0 ? m = -2 : (m = a.lastIndex - u[2].length, d = u[1], a = u[3] === void 0 ? be : u[3] === '"' ? fs : ps) : a === fs || a === ps ? a = be : a === us || a === hs ? a = Le : (a = be, r = void 0);
|
|
4173
|
+
const O = a === be && s[o + 1].startsWith("/>") ? " " : "";
|
|
4174
|
+
n += a === Le ? c + Zr : m >= 0 ? (i.push(d), c.slice(0, m) + Rs + c.slice(m) + he + O) : c + he + (m === -2 ? o : O);
|
|
4175
4175
|
}
|
|
4176
|
-
return [
|
|
4176
|
+
return [Ps(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
4177
4177
|
};
|
|
4178
|
-
class
|
|
4178
|
+
class dt {
|
|
4179
4179
|
constructor({ strings: e, _$litType$: t }, i) {
|
|
4180
4180
|
let r;
|
|
4181
4181
|
this.parts = [];
|
|
4182
4182
|
let n = 0, a = 0;
|
|
4183
|
-
const o = e.length - 1, c = this.parts, [d, u] =
|
|
4184
|
-
if (this.el =
|
|
4183
|
+
const o = e.length - 1, c = this.parts, [d, u] = jr(e, t);
|
|
4184
|
+
if (this.el = dt.createElement(d, i), xe.currentNode = this.el.content, t === 2 || t === 3) {
|
|
4185
4185
|
const m = this.el.content.firstChild;
|
|
4186
4186
|
m.replaceWith(...m.childNodes);
|
|
4187
4187
|
}
|
|
@@ -4189,45 +4189,45 @@ class lt {
|
|
|
4189
4189
|
if (r.nodeType === 1) {
|
|
4190
4190
|
if (r.hasAttributes())
|
|
4191
4191
|
for (const m of r.getAttributeNames())
|
|
4192
|
-
if (m.endsWith(
|
|
4193
|
-
const $ = u[a++], O = r.getAttribute(m).split(
|
|
4194
|
-
c.push({ type: 1, index: n, name:
|
|
4192
|
+
if (m.endsWith(Rs)) {
|
|
4193
|
+
const $ = u[a++], O = r.getAttribute(m).split(he), S = /([.?@])?(.*)/.exec($);
|
|
4194
|
+
c.push({ type: 1, index: n, name: S[2], strings: O, ctor: S[1] === "." ? Ur : S[1] === "?" ? Lr : S[1] === "@" ? zr : Rt }), r.removeAttribute(m);
|
|
4195
4195
|
} else
|
|
4196
|
-
m.startsWith(
|
|
4197
|
-
if (
|
|
4198
|
-
const m = r.textContent.split(
|
|
4196
|
+
m.startsWith(he) && (c.push({ type: 6, index: n }), r.removeAttribute(m));
|
|
4197
|
+
if (Is.test(r.tagName)) {
|
|
4198
|
+
const m = r.textContent.split(he), $ = m.length - 1;
|
|
4199
4199
|
if ($ > 0) {
|
|
4200
|
-
r.textContent =
|
|
4200
|
+
r.textContent = kt ? kt.emptyScript : "";
|
|
4201
4201
|
for (let O = 0; O < $; O++)
|
|
4202
|
-
r.append(m[O],
|
|
4203
|
-
r.append(m[$],
|
|
4202
|
+
r.append(m[O], St()), xe.nextNode(), c.push({ type: 2, index: ++n });
|
|
4203
|
+
r.append(m[$], St());
|
|
4204
4204
|
}
|
|
4205
4205
|
}
|
|
4206
4206
|
} else if (r.nodeType === 8)
|
|
4207
|
-
if (r.data ===
|
|
4207
|
+
if (r.data === Ns)
|
|
4208
4208
|
c.push({ type: 2, index: n });
|
|
4209
4209
|
else {
|
|
4210
4210
|
let m = -1;
|
|
4211
|
-
for (; (m = r.data.indexOf(
|
|
4212
|
-
c.push({ type: 7, index: n }), m +=
|
|
4211
|
+
for (; (m = r.data.indexOf(he, m + 1)) !== -1; )
|
|
4212
|
+
c.push({ type: 7, index: n }), m += he.length - 1;
|
|
4213
4213
|
}
|
|
4214
4214
|
n++;
|
|
4215
4215
|
}
|
|
4216
4216
|
}
|
|
4217
4217
|
static createElement(e, t) {
|
|
4218
|
-
const i =
|
|
4218
|
+
const i = Se.createElement("template");
|
|
4219
4219
|
return i.innerHTML = e, i;
|
|
4220
4220
|
}
|
|
4221
4221
|
}
|
|
4222
4222
|
function Ze(s, e, t = s, i) {
|
|
4223
4223
|
var a, o;
|
|
4224
|
-
if (e ===
|
|
4224
|
+
if (e === ct)
|
|
4225
4225
|
return e;
|
|
4226
4226
|
let r = i !== void 0 ? (a = t._$Co) == null ? void 0 : a[i] : t._$Cl;
|
|
4227
|
-
const n =
|
|
4227
|
+
const n = ot(e) ? void 0 : e._$litDirective$;
|
|
4228
4228
|
return (r == null ? void 0 : r.constructor) !== n && ((o = r == null ? void 0 : r._$AO) == null || o.call(r, !1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = r : t._$Cl = r), r !== void 0 && (e = Ze(s, r._$AS(s, e.values), r, i)), e;
|
|
4229
4229
|
}
|
|
4230
|
-
class
|
|
4230
|
+
class Dr {
|
|
4231
4231
|
constructor(e, t) {
|
|
4232
4232
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
4233
4233
|
}
|
|
@@ -4238,17 +4238,17 @@ class Vr {
|
|
|
4238
4238
|
return this._$AM._$AU;
|
|
4239
4239
|
}
|
|
4240
4240
|
u(e) {
|
|
4241
|
-
const { el: { content: t }, parts: i } = this._$AD, r = ((e == null ? void 0 : e.creationScope) ??
|
|
4241
|
+
const { el: { content: t }, parts: i } = this._$AD, r = ((e == null ? void 0 : e.creationScope) ?? Se).importNode(t, !0);
|
|
4242
4242
|
xe.currentNode = r;
|
|
4243
4243
|
let n = xe.nextNode(), a = 0, o = 0, c = i[0];
|
|
4244
4244
|
for (; c !== void 0; ) {
|
|
4245
4245
|
if (a === c.index) {
|
|
4246
4246
|
let d;
|
|
4247
|
-
c.type === 2 ? d = new
|
|
4247
|
+
c.type === 2 ? d = new Ot(n, n.nextSibling, this, e) : c.type === 1 ? d = new c.ctor(n, c.name, c.strings, this, e) : c.type === 6 && (d = new Vr(n, this, e)), this._$AV.push(d), c = i[++o];
|
|
4248
4248
|
}
|
|
4249
4249
|
a !== (c == null ? void 0 : c.index) && (n = xe.nextNode(), a++);
|
|
4250
4250
|
}
|
|
4251
|
-
return xe.currentNode =
|
|
4251
|
+
return xe.currentNode = Se, r;
|
|
4252
4252
|
}
|
|
4253
4253
|
p(e) {
|
|
4254
4254
|
let t = 0;
|
|
@@ -4256,7 +4256,7 @@ class Vr {
|
|
|
4256
4256
|
i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
|
-
class
|
|
4259
|
+
class Ot {
|
|
4260
4260
|
get _$AU() {
|
|
4261
4261
|
var e;
|
|
4262
4262
|
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
@@ -4276,7 +4276,7 @@ class Nt {
|
|
|
4276
4276
|
return this._$AB;
|
|
4277
4277
|
}
|
|
4278
4278
|
_$AI(e, t = this) {
|
|
4279
|
-
e = Ze(this, e, t),
|
|
4279
|
+
e = Ze(this, e, t), ot(e) ? e === N || e == null || e === "" ? (this._$AH !== N && this._$AR(), this._$AH = N) : e !== this._$AH && e !== ct && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Mr(e) ? this.k(e) : this._(e);
|
|
4280
4280
|
}
|
|
4281
4281
|
O(e) {
|
|
4282
4282
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -4285,28 +4285,28 @@ class Nt {
|
|
|
4285
4285
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
4286
4286
|
}
|
|
4287
4287
|
_(e) {
|
|
4288
|
-
this._$AH !== N &&
|
|
4288
|
+
this._$AH !== N && ot(this._$AH) ? this._$AA.nextSibling.data = e : this.T(Se.createTextNode(e)), this._$AH = e;
|
|
4289
4289
|
}
|
|
4290
4290
|
$(e) {
|
|
4291
4291
|
var n;
|
|
4292
|
-
const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el =
|
|
4292
|
+
const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = dt.createElement(Ps(i.h, i.h[0]), this.options)), i);
|
|
4293
4293
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === r)
|
|
4294
4294
|
this._$AH.p(t);
|
|
4295
4295
|
else {
|
|
4296
|
-
const a = new
|
|
4296
|
+
const a = new Dr(r, this), o = a.u(this.options);
|
|
4297
4297
|
a.p(t), this.T(o), this._$AH = a;
|
|
4298
4298
|
}
|
|
4299
4299
|
}
|
|
4300
4300
|
_$AC(e) {
|
|
4301
|
-
let t =
|
|
4302
|
-
return t === void 0 &&
|
|
4301
|
+
let t = ms.get(e.strings);
|
|
4302
|
+
return t === void 0 && ms.set(e.strings, t = new dt(e)), t;
|
|
4303
4303
|
}
|
|
4304
4304
|
k(e) {
|
|
4305
|
-
|
|
4305
|
+
Jt(this._$AH) || (this._$AH = [], this._$AR());
|
|
4306
4306
|
const t = this._$AH;
|
|
4307
4307
|
let i, r = 0;
|
|
4308
4308
|
for (const n of e)
|
|
4309
|
-
r === t.length ? t.push(i = new
|
|
4309
|
+
r === t.length ? t.push(i = new Ot(this.O(St()), this.O(St()), this, this.options)) : i = t[r], i._$AI(n), r++;
|
|
4310
4310
|
r < t.length && (this._$AR(i && i._$AB.nextSibling, r), t.length = r);
|
|
4311
4311
|
}
|
|
4312
4312
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
@@ -4321,7 +4321,7 @@ class Nt {
|
|
|
4321
4321
|
this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e));
|
|
4322
4322
|
}
|
|
4323
4323
|
}
|
|
4324
|
-
class
|
|
4324
|
+
class Rt {
|
|
4325
4325
|
get tagName() {
|
|
4326
4326
|
return this.element.tagName;
|
|
4327
4327
|
}
|
|
@@ -4335,12 +4335,12 @@ class It {
|
|
|
4335
4335
|
const n = this.strings;
|
|
4336
4336
|
let a = !1;
|
|
4337
4337
|
if (n === void 0)
|
|
4338
|
-
e = Ze(this, e, t, 0), a = !
|
|
4338
|
+
e = Ze(this, e, t, 0), a = !ot(e) || e !== this._$AH && e !== ct, a && (this._$AH = e);
|
|
4339
4339
|
else {
|
|
4340
4340
|
const o = e;
|
|
4341
4341
|
let c, d;
|
|
4342
4342
|
for (e = n[0], c = 0; c < n.length - 1; c++)
|
|
4343
|
-
d = Ze(this, o[i + c], t, c), d ===
|
|
4343
|
+
d = Ze(this, o[i + c], t, c), d === ct && (d = this._$AH[c]), a || (a = !ot(d) || d !== this._$AH[c]), d === N ? e = N : e !== N && (e += (d ?? "") + n[c + 1]), this._$AH[c] = d;
|
|
4344
4344
|
}
|
|
4345
4345
|
a && !r && this.j(e);
|
|
4346
4346
|
}
|
|
@@ -4348,7 +4348,7 @@ class It {
|
|
|
4348
4348
|
e === N ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
4349
4349
|
}
|
|
4350
4350
|
}
|
|
4351
|
-
class
|
|
4351
|
+
class Ur extends Rt {
|
|
4352
4352
|
constructor() {
|
|
4353
4353
|
super(...arguments), this.type = 3;
|
|
4354
4354
|
}
|
|
@@ -4356,7 +4356,7 @@ class Br extends It {
|
|
|
4356
4356
|
this.element[this.name] = e === N ? void 0 : e;
|
|
4357
4357
|
}
|
|
4358
4358
|
}
|
|
4359
|
-
class
|
|
4359
|
+
class Lr extends Rt {
|
|
4360
4360
|
constructor() {
|
|
4361
4361
|
super(...arguments), this.type = 4;
|
|
4362
4362
|
}
|
|
@@ -4364,12 +4364,12 @@ class Wr extends It {
|
|
|
4364
4364
|
this.element.toggleAttribute(this.name, !!e && e !== N);
|
|
4365
4365
|
}
|
|
4366
4366
|
}
|
|
4367
|
-
class
|
|
4367
|
+
class zr extends Rt {
|
|
4368
4368
|
constructor(e, t, i, r, n) {
|
|
4369
4369
|
super(e, t, i, r, n), this.type = 5;
|
|
4370
4370
|
}
|
|
4371
4371
|
_$AI(e, t = this) {
|
|
4372
|
-
if ((e = Ze(this, e, t, 0) ?? N) ===
|
|
4372
|
+
if ((e = Ze(this, e, t, 0) ?? N) === ct)
|
|
4373
4373
|
return;
|
|
4374
4374
|
const i = this._$AH, r = e === N && i !== N || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== N && (i === N || r);
|
|
4375
4375
|
r && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
@@ -4379,7 +4379,7 @@ class Fr extends It {
|
|
|
4379
4379
|
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
4380
4380
|
}
|
|
4381
4381
|
}
|
|
4382
|
-
class
|
|
4382
|
+
class Vr {
|
|
4383
4383
|
constructor(e, t, i) {
|
|
4384
4384
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i;
|
|
4385
4385
|
}
|
|
@@ -4390,21 +4390,21 @@ class Hr {
|
|
|
4390
4390
|
Ze(this, e);
|
|
4391
4391
|
}
|
|
4392
4392
|
}
|
|
4393
|
-
const
|
|
4394
|
-
|
|
4393
|
+
const jt = Fe.litHtmlPolyfillSupport;
|
|
4394
|
+
jt == null || jt(dt, Ot), (Fe.litHtmlVersions ?? (Fe.litHtmlVersions = [])).push("3.3.0");
|
|
4395
4395
|
/**
|
|
4396
4396
|
* @license
|
|
4397
4397
|
* Copyright 2020 Google LLC
|
|
4398
4398
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4399
4399
|
*/
|
|
4400
|
-
const
|
|
4400
|
+
const Br = (s) => s.strings === void 0;
|
|
4401
4401
|
/**
|
|
4402
4402
|
* @license
|
|
4403
4403
|
* Copyright 2017 Google LLC
|
|
4404
4404
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4405
4405
|
*/
|
|
4406
|
-
const
|
|
4407
|
-
class
|
|
4406
|
+
const Fr = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Hr = (s) => (...e) => ({ _$litDirective$: s, values: e });
|
|
4407
|
+
class Wr {
|
|
4408
4408
|
constructor(e) {
|
|
4409
4409
|
}
|
|
4410
4410
|
get _$AU() {
|
|
@@ -4433,54 +4433,54 @@ const He = (s, e) => {
|
|
|
4433
4433
|
for (const r of t)
|
|
4434
4434
|
(i = r._$AO) == null || i.call(r, e, !1), He(r, e);
|
|
4435
4435
|
return !0;
|
|
4436
|
-
},
|
|
4436
|
+
}, Et = (s) => {
|
|
4437
4437
|
let e, t;
|
|
4438
4438
|
do {
|
|
4439
4439
|
if ((e = s._$AM) === void 0)
|
|
4440
4440
|
break;
|
|
4441
4441
|
t = e._$AN, t.delete(s), s = e;
|
|
4442
4442
|
} while ((t == null ? void 0 : t.size) === 0);
|
|
4443
|
-
},
|
|
4443
|
+
}, Zs = (s) => {
|
|
4444
4444
|
for (let e; e = s._$AM; s = e) {
|
|
4445
4445
|
let t = e._$AN;
|
|
4446
4446
|
if (t === void 0)
|
|
4447
4447
|
e._$AN = t = /* @__PURE__ */ new Set();
|
|
4448
4448
|
else if (t.has(s))
|
|
4449
4449
|
break;
|
|
4450
|
-
t.add(s),
|
|
4450
|
+
t.add(s), Gr(e);
|
|
4451
4451
|
}
|
|
4452
4452
|
};
|
|
4453
|
-
function
|
|
4454
|
-
this._$AN !== void 0 ? (
|
|
4453
|
+
function Kr(s) {
|
|
4454
|
+
this._$AN !== void 0 ? (Et(this), this._$AM = s, Zs(this)) : this._$AM = s;
|
|
4455
4455
|
}
|
|
4456
|
-
function
|
|
4456
|
+
function qr(s, e = !1, t = 0) {
|
|
4457
4457
|
const i = this._$AH, r = this._$AN;
|
|
4458
4458
|
if (r !== void 0 && r.size !== 0)
|
|
4459
4459
|
if (e)
|
|
4460
4460
|
if (Array.isArray(i))
|
|
4461
4461
|
for (let n = t; n < i.length; n++)
|
|
4462
|
-
He(i[n], !1),
|
|
4462
|
+
He(i[n], !1), Et(i[n]);
|
|
4463
4463
|
else
|
|
4464
|
-
i != null && (He(i, !1),
|
|
4464
|
+
i != null && (He(i, !1), Et(i));
|
|
4465
4465
|
else
|
|
4466
4466
|
He(this, s);
|
|
4467
4467
|
}
|
|
4468
|
-
const
|
|
4469
|
-
s.type ==
|
|
4468
|
+
const Gr = (s) => {
|
|
4469
|
+
s.type == Fr.CHILD && (s._$AP ?? (s._$AP = qr), s._$AQ ?? (s._$AQ = Kr));
|
|
4470
4470
|
};
|
|
4471
|
-
class
|
|
4471
|
+
class Yr extends Wr {
|
|
4472
4472
|
constructor() {
|
|
4473
4473
|
super(...arguments), this._$AN = void 0;
|
|
4474
4474
|
}
|
|
4475
4475
|
_$AT(e, t, i) {
|
|
4476
|
-
super._$AT(e, t, i),
|
|
4476
|
+
super._$AT(e, t, i), Zs(this), this.isConnected = e._$AU;
|
|
4477
4477
|
}
|
|
4478
4478
|
_$AO(e, t = !0) {
|
|
4479
4479
|
var i, r;
|
|
4480
|
-
e !== this.isConnected && (this.isConnected = e, e ? (i = this.reconnected) == null || i.call(this) : (r = this.disconnected) == null || r.call(this)), t && (He(this, e),
|
|
4480
|
+
e !== this.isConnected && (this.isConnected = e, e ? (i = this.reconnected) == null || i.call(this) : (r = this.disconnected) == null || r.call(this)), t && (He(this, e), Et(this));
|
|
4481
4481
|
}
|
|
4482
4482
|
setValue(e) {
|
|
4483
|
-
if (
|
|
4483
|
+
if (Br(this._$Ct))
|
|
4484
4484
|
this._$Ct._$AI(e, this);
|
|
4485
4485
|
else {
|
|
4486
4486
|
const t = [...this._$Ct._$AH];
|
|
@@ -4497,10 +4497,10 @@ class en extends Yr {
|
|
|
4497
4497
|
* Copyright 2020 Google LLC
|
|
4498
4498
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4499
4499
|
*/
|
|
4500
|
-
const
|
|
4501
|
-
class
|
|
4500
|
+
const Jr = () => new Qr();
|
|
4501
|
+
class Qr {
|
|
4502
4502
|
}
|
|
4503
|
-
const
|
|
4503
|
+
const Dt = /* @__PURE__ */ new WeakMap(), Xr = Hr(class extends Yr {
|
|
4504
4504
|
render(s) {
|
|
4505
4505
|
return N;
|
|
4506
4506
|
}
|
|
@@ -4512,14 +4512,14 @@ const Ut = /* @__PURE__ */ new WeakMap(), rn = Gr(class extends en {
|
|
|
4512
4512
|
rt(s) {
|
|
4513
4513
|
if (this.isConnected || (s = void 0), typeof this.G == "function") {
|
|
4514
4514
|
const e = this.ht ?? globalThis;
|
|
4515
|
-
let t =
|
|
4516
|
-
t === void 0 && (t = /* @__PURE__ */ new WeakMap(),
|
|
4515
|
+
let t = Dt.get(e);
|
|
4516
|
+
t === void 0 && (t = /* @__PURE__ */ new WeakMap(), Dt.set(e, t)), t.get(this.G) !== void 0 && this.G.call(this.ht, void 0), t.set(this.G, s), s !== void 0 && this.G.call(this.ht, s);
|
|
4517
4517
|
} else
|
|
4518
4518
|
this.G.value = s;
|
|
4519
4519
|
}
|
|
4520
4520
|
get lt() {
|
|
4521
4521
|
var s, e;
|
|
4522
|
-
return typeof this.G == "function" ? (s =
|
|
4522
|
+
return typeof this.G == "function" ? (s = Dt.get(this.ht ?? globalThis)) == null ? void 0 : s.get(this.G) : (e = this.G) == null ? void 0 : e.value;
|
|
4523
4523
|
}
|
|
4524
4524
|
disconnected() {
|
|
4525
4525
|
this.lt === this.ct && this.rt(void 0);
|
|
@@ -4528,14 +4528,14 @@ const Ut = /* @__PURE__ */ new WeakMap(), rn = Gr(class extends en {
|
|
|
4528
4528
|
this.rt(this.ct);
|
|
4529
4529
|
}
|
|
4530
4530
|
});
|
|
4531
|
-
var
|
|
4532
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
4531
|
+
var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, Ms = (s, e, t, i) => {
|
|
4532
|
+
for (var r = i > 1 ? void 0 : i ? tn(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
4533
4533
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
4534
|
-
return i && r &&
|
|
4534
|
+
return i && r && en(e, t, r), r;
|
|
4535
4535
|
};
|
|
4536
|
-
class
|
|
4536
|
+
class Nt extends ie {
|
|
4537
4537
|
constructor() {
|
|
4538
|
-
super(...arguments), this.volume = { speaker: "ASSISTANT", volume: 0, spectrum: [] }, this.canvasRef =
|
|
4538
|
+
super(...arguments), this.volume = { speaker: "ASSISTANT", volume: 0, spectrum: [] }, this.canvasRef = Jr(), this.barCount = 8, this.animationFrame = null;
|
|
4539
4539
|
}
|
|
4540
4540
|
connectedCallback() {
|
|
4541
4541
|
super.connectedCallback(), this.startAnimation();
|
|
@@ -4567,68 +4567,68 @@ class Pt extends re {
|
|
|
4567
4567
|
let m = [];
|
|
4568
4568
|
if (u && u.length > 0) {
|
|
4569
4569
|
const $ = u.length, O = Math.ceil($ / 10);
|
|
4570
|
-
let
|
|
4570
|
+
let S = [];
|
|
4571
4571
|
for (let C = 0; C < 10; C++) {
|
|
4572
|
-
const H = C * O,
|
|
4573
|
-
let
|
|
4574
|
-
for (let
|
|
4575
|
-
|
|
4576
|
-
|
|
4572
|
+
const H = C * O, ae = Math.min((C + 1) * O, $);
|
|
4573
|
+
let pt = 0;
|
|
4574
|
+
for (let It = H; It < ae; It++)
|
|
4575
|
+
pt += u[It] || 0;
|
|
4576
|
+
S.push({ region: C, startIdx: H, endIdx: ae, energy: pt });
|
|
4577
4577
|
}
|
|
4578
|
-
|
|
4579
|
-
const R =
|
|
4580
|
-
if (
|
|
4578
|
+
S.sort((C, H) => H.energy - C.energy);
|
|
4579
|
+
const R = S.slice(0, 3), D = Math.min(...R.map((C) => C.startIdx)), Xt = Math.max(...R.map((C) => C.endIdx));
|
|
4580
|
+
if (Xt > D)
|
|
4581
4581
|
for (let C = 0; C < this.barCount; C++) {
|
|
4582
|
-
const H = D + C / (this.barCount - 1) * (
|
|
4583
|
-
m[C] = u[
|
|
4582
|
+
const H = D + C / (this.barCount - 1) * (Xt - D), ae = Math.min($ - 1, Math.floor(H));
|
|
4583
|
+
m[C] = u[ae] || 0;
|
|
4584
4584
|
}
|
|
4585
4585
|
else
|
|
4586
4586
|
for (let C = 0; C < this.barCount; C++) {
|
|
4587
|
-
const H = C / (this.barCount - 1) * ($ / 2),
|
|
4588
|
-
m[C] = u[
|
|
4587
|
+
const H = C / (this.barCount - 1) * ($ / 2), ae = Math.min($ - 1, Math.floor(H));
|
|
4588
|
+
m[C] = u[ae] || 0;
|
|
4589
4589
|
}
|
|
4590
|
-
const
|
|
4590
|
+
const Ds = Math.max(...m, 1), Us = this.volume.speaker === "USER" ? 0.7 : 0.6;
|
|
4591
4591
|
m = m.map((C, H) => {
|
|
4592
|
-
const
|
|
4593
|
-
return Math.min(1,
|
|
4592
|
+
const ae = C / Ds, pt = Us + H / (this.barCount - 1) * 0.3;
|
|
4593
|
+
return Math.min(1, ae * pt);
|
|
4594
4594
|
});
|
|
4595
4595
|
} else if (this.volume.speaker !== "USER")
|
|
4596
4596
|
for (let $ = 0; $ < this.barCount; $++) {
|
|
4597
|
-
const O = Date.now() * 2e-3,
|
|
4598
|
-
m[$] =
|
|
4597
|
+
const O = Date.now() * 2e-3, S = 0.3 + 0.2 * Math.sin(O + $ * 0.7);
|
|
4598
|
+
m[$] = S;
|
|
4599
4599
|
}
|
|
4600
4600
|
for (let $ = 0; $ < this.barCount; $++) {
|
|
4601
4601
|
const O = m.length > 0 && m[$] !== void 0 ? m[$] : d;
|
|
4602
4602
|
this.volume.speaker === "USER" ? t.fillStyle = `rgba(109, 40, 217, ${O * 0.5 + 0.5})` : t.fillStyle = `rgba(255, 255, 255, ${O * 0.5 + 0.5})`;
|
|
4603
|
-
const
|
|
4604
|
-
t.beginPath(), t.moveTo(R + D, n / 2 -
|
|
4603
|
+
const S = Math.max(2, O * 0.8 * c), R = r - (this.barCount - $) * (o + a), D = o / 2;
|
|
4604
|
+
t.beginPath(), t.moveTo(R + D, n / 2 - S), t.lineTo(R + o - D, n / 2 - S), t.quadraticCurveTo(
|
|
4605
4605
|
R + o,
|
|
4606
|
-
n / 2 -
|
|
4606
|
+
n / 2 - S,
|
|
4607
4607
|
R + o,
|
|
4608
|
-
n / 2 -
|
|
4609
|
-
), t.lineTo(R + o, n / 2), t.lineTo(R, n / 2), t.lineTo(R, n / 2 -
|
|
4608
|
+
n / 2 - S + D
|
|
4609
|
+
), t.lineTo(R + o, n / 2), t.lineTo(R, n / 2), t.lineTo(R, n / 2 - S + D), t.quadraticCurveTo(
|
|
4610
4610
|
R,
|
|
4611
|
-
n / 2 -
|
|
4611
|
+
n / 2 - S,
|
|
4612
4612
|
R + D,
|
|
4613
|
-
n / 2 -
|
|
4614
|
-
), t.fill(), t.beginPath(), t.moveTo(R, n / 2), t.lineTo(R + o, n / 2), t.lineTo(R + o, n / 2 +
|
|
4613
|
+
n / 2 - S
|
|
4614
|
+
), t.fill(), t.beginPath(), t.moveTo(R, n / 2), t.lineTo(R + o, n / 2), t.lineTo(R + o, n / 2 + S - D), t.quadraticCurveTo(
|
|
4615
4615
|
R + o,
|
|
4616
|
-
n / 2 +
|
|
4616
|
+
n / 2 + S,
|
|
4617
4617
|
R + o - D,
|
|
4618
|
-
n / 2 +
|
|
4619
|
-
), t.lineTo(R + D, n / 2 +
|
|
4618
|
+
n / 2 + S
|
|
4619
|
+
), t.lineTo(R + D, n / 2 + S), t.quadraticCurveTo(
|
|
4620
4620
|
R,
|
|
4621
|
-
n / 2 +
|
|
4621
|
+
n / 2 + S,
|
|
4622
4622
|
R,
|
|
4623
|
-
n / 2 +
|
|
4623
|
+
n / 2 + S - D
|
|
4624
4624
|
), t.lineTo(R, n / 2), t.fill();
|
|
4625
4625
|
}
|
|
4626
4626
|
}
|
|
4627
4627
|
render() {
|
|
4628
|
-
return E` <canvas ${
|
|
4628
|
+
return E` <canvas ${Xr(this.canvasRef)} width="52" height="52"></canvas> `;
|
|
4629
4629
|
}
|
|
4630
4630
|
}
|
|
4631
|
-
|
|
4631
|
+
Nt.styles = se`
|
|
4632
4632
|
:host {
|
|
4633
4633
|
display: block;
|
|
4634
4634
|
width: 40px;
|
|
@@ -4641,19 +4641,19 @@ Pt.styles = ie`
|
|
|
4641
4641
|
height: 100%;
|
|
4642
4642
|
}
|
|
4643
4643
|
`;
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
],
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
],
|
|
4650
|
-
customElements.get("obi-audio-equalizer") || customElements.define("obi-audio-equalizer",
|
|
4651
|
-
var
|
|
4652
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
4644
|
+
Ms([
|
|
4645
|
+
w({ type: Object })
|
|
4646
|
+
], Nt.prototype, "volume", 2);
|
|
4647
|
+
Ms([
|
|
4648
|
+
ye()
|
|
4649
|
+
], Nt.prototype, "canvasRef", 2);
|
|
4650
|
+
customElements.get("obi-audio-equalizer") || customElements.define("obi-audio-equalizer", Nt);
|
|
4651
|
+
var sn = Object.defineProperty, rn = Object.getOwnPropertyDescriptor, nn = (s, e, t, i) => {
|
|
4652
|
+
for (var r = i > 1 ? void 0 : i ? rn(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
4653
4653
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
4654
|
-
return i && r &&
|
|
4654
|
+
return i && r && sn(e, t, r), r;
|
|
4655
4655
|
};
|
|
4656
|
-
class
|
|
4656
|
+
class Qt extends ie {
|
|
4657
4657
|
constructor() {
|
|
4658
4658
|
super(...arguments), this.activeDots = Array(5).fill(!1), this.numDots = 5, this.containerWidth = 32, this.dotSize = 2, this.bounceHeight = 12, this.animationDuration = 200, this.pauseDuration = 300, this.overlapFactor = 0.7, this.color = "#FFF", this.timeoutIds = [];
|
|
4659
4659
|
}
|
|
@@ -4704,7 +4704,7 @@ class es extends re {
|
|
|
4704
4704
|
`;
|
|
4705
4705
|
}
|
|
4706
4706
|
}
|
|
4707
|
-
|
|
4707
|
+
Qt.styles = se`
|
|
4708
4708
|
:host {
|
|
4709
4709
|
display: block;
|
|
4710
4710
|
}
|
|
@@ -4732,11 +4732,11 @@ es.styles = ie`
|
|
|
4732
4732
|
opacity: 1;
|
|
4733
4733
|
}
|
|
4734
4734
|
`;
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
],
|
|
4738
|
-
customElements.get("obi-dot-loader") || customElements.define("obi-dot-loader",
|
|
4739
|
-
class
|
|
4735
|
+
nn([
|
|
4736
|
+
ye()
|
|
4737
|
+
], Qt.prototype, "activeDots", 2);
|
|
4738
|
+
customElements.get("obi-dot-loader") || customElements.define("obi-dot-loader", Qt);
|
|
4739
|
+
class js extends ie {
|
|
4740
4740
|
render() {
|
|
4741
4741
|
return E`
|
|
4742
4742
|
<obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
|
|
@@ -4744,7 +4744,7 @@ class zs extends re {
|
|
|
4744
4744
|
`;
|
|
4745
4745
|
}
|
|
4746
4746
|
}
|
|
4747
|
-
|
|
4747
|
+
js.styles = se`
|
|
4748
4748
|
:host {
|
|
4749
4749
|
display: flex;
|
|
4750
4750
|
align-items: center;
|
|
@@ -4760,15 +4760,15 @@ zs.styles = ie`
|
|
|
4760
4760
|
font-size: 14px;
|
|
4761
4761
|
}
|
|
4762
4762
|
`;
|
|
4763
|
-
customElements.get("obi-searching-loader") || customElements.define("obi-searching-loader",
|
|
4764
|
-
var
|
|
4765
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
4763
|
+
customElements.get("obi-searching-loader") || customElements.define("obi-searching-loader", js);
|
|
4764
|
+
var an = Object.defineProperty, on = Object.getOwnPropertyDescriptor, J = (s, e, t, i) => {
|
|
4765
|
+
for (var r = i > 1 ? void 0 : i ? on(e, t) : e, n = s.length - 1, a; n >= 0; n--)
|
|
4766
4766
|
(a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
|
|
4767
|
-
return i && r &&
|
|
4767
|
+
return i && r && an(e, t, r), r;
|
|
4768
4768
|
};
|
|
4769
|
-
class z extends
|
|
4769
|
+
class z extends ie {
|
|
4770
4770
|
constructor() {
|
|
4771
|
-
super(), this.apiBaseUrl =
|
|
4771
|
+
super(), this.apiBaseUrl = Os, this.apiKey = "", this.position = "bottom-right", this.user = null, this.state = A.READY, this.showCourseModal = !1, this.isHovering = !1, this.navVisible = !1, this.activeSession = null, this.volume = {
|
|
4772
4772
|
speaker: "ASSISTANT",
|
|
4773
4773
|
volume: 0,
|
|
4774
4774
|
spectrum: []
|
|
@@ -4795,7 +4795,7 @@ class z extends re {
|
|
|
4795
4795
|
this.showCourseModal = !0;
|
|
4796
4796
|
return;
|
|
4797
4797
|
}
|
|
4798
|
-
|
|
4798
|
+
ns([e, t]).with(["pause", !0], () => {
|
|
4799
4799
|
var i;
|
|
4800
4800
|
(i = this.activeSession) == null || i.pauseRecording();
|
|
4801
4801
|
}).with(["pause", !1], () => {
|
|
@@ -4810,7 +4810,7 @@ class z extends re {
|
|
|
4810
4810
|
async handleSessionStart(e) {
|
|
4811
4811
|
this.showCourseModal = !1, this.state = A.LOADING;
|
|
4812
4812
|
try {
|
|
4813
|
-
const { ObiSession: t } = await import("./session-
|
|
4813
|
+
const { ObiSession: t } = await import("./session-730ff76c.js"), i = new t({ token: e, apiBaseUrl: this.apiBaseUrl });
|
|
4814
4814
|
i.on("stateChanged", (r) => {
|
|
4815
4815
|
this.state = r.newState;
|
|
4816
4816
|
}), i.on("volume", (r) => {
|
|
@@ -4823,10 +4823,10 @@ class z extends re {
|
|
|
4823
4823
|
}
|
|
4824
4824
|
}
|
|
4825
4825
|
render() {
|
|
4826
|
-
const e =
|
|
4827
|
-
|
|
4826
|
+
const e = ns(this.state).with(A.LOADING, () => E`<obi-dot-loader></obi-dot-loader>`).with(A.RESEARCHING, () => E`<obi-searching-loader></obi-searching-loader>`).with(
|
|
4827
|
+
di.union(A.USER_SPEAKING, A.AGENT_SPEAKING),
|
|
4828
4828
|
() => E`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
|
|
4829
|
-
).with(A.PAUSED, () =>
|
|
4829
|
+
).with(A.PAUSED, () => ds).otherwise(() => ds);
|
|
4830
4830
|
return E`
|
|
4831
4831
|
<div
|
|
4832
4832
|
class="widget-container ${this.state === A.USER_SPEAKING || this.state === A.AGENT_SPEAKING ? "pulse" : ""} ${this.state !== A.READY || this.navVisible ? "rounded" : ""} ${this.state === A.RESEARCHING ? "researching" : ""} ${this.state === A.USER_SPEAKING ? "user-speaking" : ""}"
|
|
@@ -4842,18 +4842,18 @@ class z extends re {
|
|
|
4842
4842
|
.currentState=${this.state}
|
|
4843
4843
|
.onItemSelect=${this.handleItemSelect.bind(this)}
|
|
4844
4844
|
></obi-navigation-bar>
|
|
4845
|
-
` :
|
|
4845
|
+
` : es}
|
|
4846
4846
|
</div>
|
|
4847
4847
|
${this.showCourseModal ? E`<obi-course-modal
|
|
4848
4848
|
.onClose=${() => this.showCourseModal = !1}
|
|
4849
4849
|
.onCourseSelect=${this.handleSessionStart.bind(this)}
|
|
4850
4850
|
.apiBaseUrl=${this.apiBaseUrl}
|
|
4851
4851
|
.apiKey=${this.apiKey}
|
|
4852
|
-
></obi-course-modal>` :
|
|
4852
|
+
></obi-course-modal>` : es}
|
|
4853
4853
|
`;
|
|
4854
4854
|
}
|
|
4855
4855
|
}
|
|
4856
|
-
z.styles =
|
|
4856
|
+
z.styles = se`
|
|
4857
4857
|
:host {
|
|
4858
4858
|
display: block;
|
|
4859
4859
|
position: fixed;
|
|
@@ -4953,38 +4953,38 @@ z.styles = ie`
|
|
|
4953
4953
|
animation: pulse-shadow 2s ease-in-out infinite;
|
|
4954
4954
|
}
|
|
4955
4955
|
`;
|
|
4956
|
-
|
|
4957
|
-
|
|
4956
|
+
J([
|
|
4957
|
+
w({ type: String })
|
|
4958
4958
|
], z.prototype, "apiBaseUrl", 2);
|
|
4959
|
-
|
|
4960
|
-
|
|
4959
|
+
J([
|
|
4960
|
+
w({ type: String })
|
|
4961
4961
|
], z.prototype, "apiKey", 2);
|
|
4962
|
-
|
|
4963
|
-
|
|
4962
|
+
J([
|
|
4963
|
+
w({ type: String })
|
|
4964
4964
|
], z.prototype, "position", 2);
|
|
4965
|
-
|
|
4966
|
-
|
|
4965
|
+
J([
|
|
4966
|
+
w({ type: Object })
|
|
4967
4967
|
], z.prototype, "user", 2);
|
|
4968
|
-
|
|
4969
|
-
|
|
4968
|
+
J([
|
|
4969
|
+
ye()
|
|
4970
4970
|
], z.prototype, "state", 2);
|
|
4971
|
-
|
|
4972
|
-
|
|
4971
|
+
J([
|
|
4972
|
+
ye()
|
|
4973
4973
|
], z.prototype, "showCourseModal", 2);
|
|
4974
|
-
|
|
4975
|
-
|
|
4974
|
+
J([
|
|
4975
|
+
ye()
|
|
4976
4976
|
], z.prototype, "isHovering", 2);
|
|
4977
|
-
|
|
4978
|
-
|
|
4977
|
+
J([
|
|
4978
|
+
ye()
|
|
4979
4979
|
], z.prototype, "navVisible", 2);
|
|
4980
|
-
|
|
4981
|
-
|
|
4980
|
+
J([
|
|
4981
|
+
ye()
|
|
4982
4982
|
], z.prototype, "activeSession", 2);
|
|
4983
|
-
|
|
4984
|
-
|
|
4983
|
+
J([
|
|
4984
|
+
ye()
|
|
4985
4985
|
], z.prototype, "volume", 2);
|
|
4986
4986
|
customElements.get("obi-widget") || customElements.define("obi-widget", z);
|
|
4987
|
-
function
|
|
4987
|
+
function cn(s) {
|
|
4988
4988
|
return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
|
|
4989
4989
|
var i = s.get(e);
|
|
4990
4990
|
i ? i.push(t) : s.set(e, [t]);
|
|
@@ -5000,13 +5000,13 @@ function hn(s) {
|
|
|
5000
5000
|
});
|
|
5001
5001
|
} };
|
|
5002
5002
|
}
|
|
5003
|
-
class
|
|
5003
|
+
class pn {
|
|
5004
5004
|
constructor(e = {}) {
|
|
5005
|
-
this.state = A.READY, this.emitter =
|
|
5005
|
+
this.state = A.READY, this.emitter = cn(), this.voiceEnabled = !1, this.screenCaptureEnabled = !1, this.config = xr.parse(e), this.config.debug && console.log("ObiSDK initialized with config:", this.config);
|
|
5006
5006
|
}
|
|
5007
5007
|
async init() {
|
|
5008
5008
|
try {
|
|
5009
|
-
this.config.enableVoice && await this.initVoice(), this.config.enableScreenCapture && await this.initScreenCapture(), this.setState(A.READY), this.emitter.emit(
|
|
5009
|
+
this.config.enableVoice && await this.initVoice(), this.config.enableScreenCapture && await this.initScreenCapture(), this.setState(A.READY), this.emitter.emit(ue.READY), this.config.debug && console.log("ObiSDK ready");
|
|
5010
5010
|
} catch (e) {
|
|
5011
5011
|
const t = {
|
|
5012
5012
|
code: "init_failed",
|
|
@@ -5034,13 +5034,13 @@ class bn {
|
|
|
5034
5034
|
* Set the SDK state and emit state change event
|
|
5035
5035
|
*/
|
|
5036
5036
|
setState(e) {
|
|
5037
|
-
this.state = e, this.emitter.emit(
|
|
5037
|
+
this.state = e, this.emitter.emit(ue.STATE_CHANGE, e);
|
|
5038
5038
|
}
|
|
5039
5039
|
/**
|
|
5040
5040
|
* Handle SDK errors
|
|
5041
5041
|
*/
|
|
5042
5042
|
handleError(e) {
|
|
5043
|
-
this.setState(A.ERROR), this.emitter.emit(
|
|
5043
|
+
this.setState(A.ERROR), this.emitter.emit(ue.ERROR, e), this.config.debug && console.error("ObiSDK error:", e);
|
|
5044
5044
|
}
|
|
5045
5045
|
/**
|
|
5046
5046
|
* Start voice recording
|
|
@@ -5054,7 +5054,7 @@ class bn {
|
|
|
5054
5054
|
return;
|
|
5055
5055
|
}
|
|
5056
5056
|
try {
|
|
5057
|
-
this.setState(A.AGENT_SPEAKING), this.emitter.emit(
|
|
5057
|
+
this.setState(A.AGENT_SPEAKING), this.emitter.emit(ue.VOICE_START), this.config.debug && console.log("Voice recording started");
|
|
5058
5058
|
} catch (e) {
|
|
5059
5059
|
this.handleError({
|
|
5060
5060
|
code: "voice_start_failed",
|
|
@@ -5071,7 +5071,7 @@ class bn {
|
|
|
5071
5071
|
return { transcript: void 0 };
|
|
5072
5072
|
try {
|
|
5073
5073
|
const e = { transcript: "Sample transcript" };
|
|
5074
|
-
return this.setState(A.READY), this.emitter.emit(
|
|
5074
|
+
return this.setState(A.READY), this.emitter.emit(ue.VOICE_STOP, e), this.config.debug && console.log("Voice recording stopped:", e), e;
|
|
5075
5075
|
} catch (e) {
|
|
5076
5076
|
return this.handleError({
|
|
5077
5077
|
code: "voice_stop_failed",
|
|
@@ -5092,7 +5092,7 @@ class bn {
|
|
|
5092
5092
|
return;
|
|
5093
5093
|
}
|
|
5094
5094
|
try {
|
|
5095
|
-
this.setState(A.AGENT_SPEAKING), this.emitter.emit(
|
|
5095
|
+
this.setState(A.AGENT_SPEAKING), this.emitter.emit(ue.SCREEN_CAPTURE_START), this.config.debug && console.log("Screen capture started");
|
|
5096
5096
|
} catch (e) {
|
|
5097
5097
|
this.handleError({
|
|
5098
5098
|
code: "screen_capture_start_failed",
|
|
@@ -5109,7 +5109,7 @@ class bn {
|
|
|
5109
5109
|
return { screenshot: void 0 };
|
|
5110
5110
|
try {
|
|
5111
5111
|
const e = { screenshot: "data:image/png;base64,..." };
|
|
5112
|
-
return this.setState(A.READY), this.emitter.emit(
|
|
5112
|
+
return this.setState(A.READY), this.emitter.emit(ue.SCREEN_CAPTURE_STOP, e), this.config.debug && console.log("Screen capture stopped"), e;
|
|
5113
5113
|
} catch (e) {
|
|
5114
5114
|
return this.handleError({
|
|
5115
5115
|
code: "screen_capture_stop_failed",
|
|
@@ -5143,123 +5143,26 @@ class bn {
|
|
|
5143
5143
|
this.emitter.all.clear(), this.config.debug && console.log("ObiSDK disposed");
|
|
5144
5144
|
}
|
|
5145
5145
|
}
|
|
5146
|
-
const
|
|
5146
|
+
const dn = () => {
|
|
5147
5147
|
customElements.get("obi-widget") || customElements.define("obi-widget", z);
|
|
5148
5148
|
};
|
|
5149
|
-
class
|
|
5149
|
+
class fn {
|
|
5150
5150
|
/**
|
|
5151
5151
|
* Initialize the Obi Widget with the provided configuration
|
|
5152
5152
|
* This creates and mounts the widget to the page
|
|
5153
5153
|
*/
|
|
5154
5154
|
static init(e) {
|
|
5155
|
-
|
|
5155
|
+
dn();
|
|
5156
5156
|
const t = document.createElement("obi-widget");
|
|
5157
5157
|
return e.apiKey && (t.apiKey = e.apiKey), e.position && (t.position = e.position), e.user && (t.user = e.user), window.obiWidgetConfig = e, document.body.appendChild(t), console.log("Obi Widget initialized and mounted"), t;
|
|
5158
5158
|
}
|
|
5159
5159
|
}
|
|
5160
|
-
const fn = "https://registry.npmjs.org/obi-sdk/latest", ys = "https://unpkg.com/obi-sdk", V = window;
|
|
5161
|
-
V.__obiSDKLoading = V.__obiSDKLoading || !1;
|
|
5162
|
-
const xn = async (s) => (V.obiWidgetConfig = s, new Promise((e, t) => {
|
|
5163
|
-
if (V.ObiAssistant)
|
|
5164
|
-
try {
|
|
5165
|
-
const i = mt(s);
|
|
5166
|
-
e(i);
|
|
5167
|
-
return;
|
|
5168
|
-
} catch (i) {
|
|
5169
|
-
t(new Error(`Error creating widget: ${i}`));
|
|
5170
|
-
return;
|
|
5171
|
-
}
|
|
5172
|
-
if (V.__obiSDKLoading) {
|
|
5173
|
-
mn(() => {
|
|
5174
|
-
try {
|
|
5175
|
-
const i = mt(s);
|
|
5176
|
-
e(i);
|
|
5177
|
-
} catch (i) {
|
|
5178
|
-
t(new Error(`Error creating widget after waiting: ${i}`));
|
|
5179
|
-
}
|
|
5180
|
-
});
|
|
5181
|
-
return;
|
|
5182
|
-
}
|
|
5183
|
-
gn().then((i) => {
|
|
5184
|
-
_s(
|
|
5185
|
-
i,
|
|
5186
|
-
() => {
|
|
5187
|
-
V.__obiSDKLoading = !1;
|
|
5188
|
-
try {
|
|
5189
|
-
const r = mt(s);
|
|
5190
|
-
e(r);
|
|
5191
|
-
} catch (r) {
|
|
5192
|
-
t(new Error(`Error creating widget after loading SDK: ${r}`));
|
|
5193
|
-
}
|
|
5194
|
-
},
|
|
5195
|
-
t
|
|
5196
|
-
);
|
|
5197
|
-
}).catch(() => {
|
|
5198
|
-
_s(
|
|
5199
|
-
null,
|
|
5200
|
-
() => {
|
|
5201
|
-
V.__obiSDKLoading = !1;
|
|
5202
|
-
try {
|
|
5203
|
-
const i = mt(s);
|
|
5204
|
-
e(i);
|
|
5205
|
-
} catch (i) {
|
|
5206
|
-
t(new Error(`Error creating widget with latest version: ${i}`));
|
|
5207
|
-
}
|
|
5208
|
-
},
|
|
5209
|
-
t
|
|
5210
|
-
);
|
|
5211
|
-
});
|
|
5212
|
-
}));
|
|
5213
|
-
function mn(s) {
|
|
5214
|
-
const e = setInterval(() => {
|
|
5215
|
-
(typeof V.ObiAssistant == "function" || typeof V.ObiAssistant == "object") && (clearInterval(e), s());
|
|
5216
|
-
}, 100);
|
|
5217
|
-
}
|
|
5218
|
-
async function gn() {
|
|
5219
|
-
return new Promise((s) => {
|
|
5220
|
-
try {
|
|
5221
|
-
const e = new XMLHttpRequest();
|
|
5222
|
-
e.open("GET", fn), e.onload = () => {
|
|
5223
|
-
if (e.status === 200)
|
|
5224
|
-
try {
|
|
5225
|
-
const t = JSON.parse(e.responseText);
|
|
5226
|
-
s(t.version);
|
|
5227
|
-
} catch {
|
|
5228
|
-
s(null);
|
|
5229
|
-
}
|
|
5230
|
-
else
|
|
5231
|
-
s(null);
|
|
5232
|
-
}, e.onerror = () => s(null), e.send();
|
|
5233
|
-
} catch {
|
|
5234
|
-
s(null);
|
|
5235
|
-
}
|
|
5236
|
-
});
|
|
5237
|
-
}
|
|
5238
|
-
function _s(s, e, t) {
|
|
5239
|
-
V.__obiSDKLoading = !0;
|
|
5240
|
-
const i = document.createElement("script");
|
|
5241
|
-
i.type = "text/javascript", i.async = !0;
|
|
5242
|
-
const r = s || "latest";
|
|
5243
|
-
i.src = `${ys}@${r}/dist/obi-sdk.standalone.iife.js`, i.onload = e, i.onerror = () => {
|
|
5244
|
-
r !== "latest" ? (console.warn("Failed to load specific version, falling back to latest"), i.src = `${ys}@latest/dist/obi-sdk.standalone.iife.js`, i.onload = e) : (V.__obiSDKLoading = !1, t(new Error("Failed to load Obi SDK from CDN")));
|
|
5245
|
-
}, document.head.appendChild(i);
|
|
5246
|
-
}
|
|
5247
|
-
function mt(s) {
|
|
5248
|
-
const e = document, t = e.querySelector("obi-widget");
|
|
5249
|
-
if (t)
|
|
5250
|
-
return console.log("Obi Widget already exists on the page"), t;
|
|
5251
|
-
if (!customElements.get("obi-widget"))
|
|
5252
|
-
throw new Error("Obi Widget component not registered - SDK may not have loaded properly");
|
|
5253
|
-
const i = e.createElement("obi-widget");
|
|
5254
|
-
return s.apiKey && i.setAttribute("api-key", s.apiKey), s.position && i.setAttribute("position", s.position), s.user && i.setAttribute("user", JSON.stringify(s.user)), e.body.appendChild(i), console.log("Obi Widget added to page"), i;
|
|
5255
|
-
}
|
|
5256
5160
|
export {
|
|
5257
|
-
|
|
5161
|
+
ue as E,
|
|
5258
5162
|
z as O,
|
|
5259
5163
|
A as S,
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
os as z
|
|
5164
|
+
pn as a,
|
|
5165
|
+
fn as b,
|
|
5166
|
+
cn as m,
|
|
5167
|
+
ns as z
|
|
5265
5168
|
};
|