@animaapp/anima-sdk 0.6.12-beta.0 → 0.6.16
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/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -140
- package/dist/index.js +313 -371
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/example.env +0 -2
- package/tsconfig.json +0 -6
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var xr = Object.defineProperty, kr = Object.defineProperties;
|
|
2
2
|
var Tr = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Ft = Object.getOwnPropertySymbols;
|
|
4
|
-
var Sr = Object.prototype.hasOwnProperty,
|
|
4
|
+
var Sr = Object.prototype.hasOwnProperty, Ar = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Vt = (r) => {
|
|
6
6
|
throw TypeError(r);
|
|
7
7
|
};
|
|
@@ -10,11 +10,11 @@ var Lt = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
Sr.call(e, t) && Lt(r, t, e[t]);
|
|
11
11
|
if (Ft)
|
|
12
12
|
for (var t of Ft(e))
|
|
13
|
-
|
|
13
|
+
Ar.call(e, t) && Lt(r, t, e[t]);
|
|
14
14
|
return r;
|
|
15
15
|
}, g = (r, e) => kr(r, Tr(e));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var ht = (r, e, t) => e.has(r) || Vt("Cannot " + t);
|
|
17
|
+
var N = (r, e, t) => (ht(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Qe = (r, e, t) => e.has(r) ? Vt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), pt = (r, e, t, s) => (ht(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), Ne = (r, e, t) => (ht(r, e, "access private method"), t);
|
|
18
18
|
var C = (r, e, t) => new Promise((s, n) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
@@ -31,7 +31,7 @@ var C = (r, e, t) => new Promise((s, n) => {
|
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(r, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class de extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
@@ -42,7 +42,7 @@ class ue extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Qt = "Figma Token Issue";
|
|
45
|
-
class
|
|
45
|
+
class Er extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
@@ -58,13 +58,13 @@ class Cr extends Error {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const tr = "Request Too Large";
|
|
61
|
-
class
|
|
61
|
+
class Or extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
63
|
super(tr), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
const rr = "Not Found";
|
|
67
|
-
class
|
|
67
|
+
class Ir extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
69
|
super(rr), this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
@@ -75,7 +75,7 @@ class jr extends Error {
|
|
|
75
75
|
super(sr), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const Kn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Qt, ...[
|
|
79
79
|
"Invalid Figma token",
|
|
80
80
|
"Figma token expired"
|
|
81
81
|
]].includes(
|
|
@@ -85,7 +85,7 @@ const Xn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Q
|
|
|
85
85
|
if (((s = r == null ? void 0 : r.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
86
86
|
const { err: n, status: a } = r.cause.body;
|
|
87
87
|
if (a === 403)
|
|
88
|
-
return new
|
|
88
|
+
return new Er({
|
|
89
89
|
fileKey: e,
|
|
90
90
|
reason: n,
|
|
91
91
|
cause: r
|
|
@@ -93,12 +93,12 @@ const Xn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Q
|
|
|
93
93
|
if (a === 429)
|
|
94
94
|
return new Cr({ fileKey: e, cause: r });
|
|
95
95
|
if (a === 404)
|
|
96
|
-
return new Or({ fileKey: e, cause: r });
|
|
97
|
-
if (a === 400 && n.includes("Request too large"))
|
|
98
96
|
return new Ir({ fileKey: e, cause: r });
|
|
97
|
+
if (a === 400 && n.includes("Request too large"))
|
|
98
|
+
return new Or({ fileKey: e, cause: r });
|
|
99
99
|
}
|
|
100
100
|
return new jr({ fileKey: e, cause: r });
|
|
101
|
-
},
|
|
101
|
+
}, Xn = (r) => Nr(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
102
102
|
var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Dt = Object.getOwnPropertySymbols, Lr = Object.prototype.hasOwnProperty, Vr = Object.prototype.propertyIsEnumerable, Ut = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), ar = (r) => {
|
|
103
103
|
throw TypeError(r);
|
|
104
104
|
}, Wt = (r, e, t) => e in r ? Pr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
|
|
@@ -108,7 +108,7 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
108
108
|
for (var t of Dt(e))
|
|
109
109
|
Vr.call(e, t) && Wt(r, t, e[t]);
|
|
110
110
|
return r;
|
|
111
|
-
},
|
|
111
|
+
}, jt = (r, e) => $r(r, Fr(e)), Rt = (r, e, t) => e.has(r) || ar("Cannot " + t), S = (r, e, t) => (Rt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? ar("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), R = (r, e, t, s) => (Rt(r, e, "write to private field"), e.set(r, t), t), Q = (r, e, t) => (Rt(r, e, "access private method"), t), I = (r, e, t) => new Promise((s, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
@@ -127,55 +127,55 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
127
127
|
function Wr(r) {
|
|
128
128
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var _t = { exports: {} }, zr = _t.exports, zt;
|
|
131
131
|
function Br() {
|
|
132
132
|
return zt || (zt = 1, function(r, e) {
|
|
133
133
|
(function(t, s) {
|
|
134
134
|
r.exports = s();
|
|
135
135
|
})(zr, function() {
|
|
136
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), se = f && typeof Array.prototype[Symbol.iterator] == "function", ge = se && Object.getPrototypeOf([][Symbol.iterator]()),
|
|
137
|
-
function
|
|
138
|
-
var k = typeof
|
|
136
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), se = f && typeof Array.prototype[Symbol.iterator] == "function", ge = se && Object.getPrototypeOf([][Symbol.iterator]()), ce = f && typeof String.prototype[Symbol.iterator] == "function", V = ce && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, q = -1;
|
|
137
|
+
function Ie(E) {
|
|
138
|
+
var k = typeof E;
|
|
139
139
|
if (k !== "object")
|
|
140
140
|
return k;
|
|
141
|
-
if (
|
|
141
|
+
if (E === null)
|
|
142
142
|
return "null";
|
|
143
|
-
if (
|
|
143
|
+
if (E === s)
|
|
144
144
|
return "global";
|
|
145
|
-
if (Array.isArray(
|
|
145
|
+
if (Array.isArray(E) && (v === !1 || !(Symbol.toStringTag in E)))
|
|
146
146
|
return "Array";
|
|
147
147
|
if (typeof window == "object" && window !== null) {
|
|
148
|
-
if (typeof window.location == "object" &&
|
|
148
|
+
if (typeof window.location == "object" && E === window.location)
|
|
149
149
|
return "Location";
|
|
150
|
-
if (typeof window.document == "object" &&
|
|
150
|
+
if (typeof window.document == "object" && E === window.document)
|
|
151
151
|
return "Document";
|
|
152
152
|
if (typeof window.navigator == "object") {
|
|
153
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
153
|
+
if (typeof window.navigator.mimeTypes == "object" && E === window.navigator.mimeTypes)
|
|
154
154
|
return "MimeTypeArray";
|
|
155
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
155
|
+
if (typeof window.navigator.plugins == "object" && E === window.navigator.plugins)
|
|
156
156
|
return "PluginArray";
|
|
157
157
|
}
|
|
158
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
159
|
-
if (
|
|
158
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && E instanceof window.HTMLElement) {
|
|
159
|
+
if (E.tagName === "BLOCKQUOTE")
|
|
160
160
|
return "HTMLQuoteElement";
|
|
161
|
-
if (
|
|
161
|
+
if (E.tagName === "TD")
|
|
162
162
|
return "HTMLTableDataCellElement";
|
|
163
|
-
if (
|
|
163
|
+
if (E.tagName === "TH")
|
|
164
164
|
return "HTMLTableHeaderCellElement";
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
var
|
|
168
|
-
if (typeof
|
|
169
|
-
return
|
|
170
|
-
var D = Object.getPrototypeOf(
|
|
171
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === z ? "Map Iterator" : i && D === F ? "Set Iterator" : se && D === ge ? "Array Iterator" :
|
|
167
|
+
var ft = v && E[Symbol.toStringTag];
|
|
168
|
+
if (typeof ft == "string")
|
|
169
|
+
return ft;
|
|
170
|
+
var D = Object.getPrototypeOf(E);
|
|
171
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === z ? "Map Iterator" : i && D === F ? "Set Iterator" : se && D === ge ? "Array Iterator" : ce && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(E).slice(K, q);
|
|
172
172
|
}
|
|
173
|
-
return
|
|
173
|
+
return Ie;
|
|
174
174
|
});
|
|
175
|
-
}(
|
|
175
|
+
}(_t)), _t.exports;
|
|
176
176
|
}
|
|
177
177
|
var qr = Br();
|
|
178
|
-
const Hr = /* @__PURE__ */ Wr(qr),
|
|
178
|
+
const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt && typeof Buffer.from != "undefined", Gr = Zt ? (
|
|
179
179
|
/**
|
|
180
180
|
* is value is Buffer?
|
|
181
181
|
*
|
|
@@ -206,7 +206,7 @@ const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt &&
|
|
|
206
206
|
function(r) {
|
|
207
207
|
return Buffer.from(r);
|
|
208
208
|
}
|
|
209
|
-
) :
|
|
209
|
+
) : Zt ? (
|
|
210
210
|
/**
|
|
211
211
|
* copy Buffer
|
|
212
212
|
*
|
|
@@ -253,7 +253,7 @@ function Yr(r, e, t = null) {
|
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function bt(r) {
|
|
257
257
|
return Xr.has(r);
|
|
258
258
|
}
|
|
259
259
|
function Bt(r, e, t, s = null) {
|
|
@@ -272,7 +272,7 @@ function Bt(r, e, t, s = null) {
|
|
|
272
272
|
}
|
|
273
273
|
return r;
|
|
274
274
|
}
|
|
275
|
-
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self,
|
|
275
|
+
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, mt = Qr || es || ts || Function("return this")();
|
|
276
276
|
function rs(r) {
|
|
277
277
|
return r.slice(0);
|
|
278
278
|
}
|
|
@@ -298,7 +298,7 @@ function ds(r) {
|
|
|
298
298
|
return new String(r);
|
|
299
299
|
}
|
|
300
300
|
function ne(r, e) {
|
|
301
|
-
return
|
|
301
|
+
return mt[e].from ? mt[e].from(r) : new mt[e](r);
|
|
302
302
|
}
|
|
303
303
|
function P(r) {
|
|
304
304
|
return r;
|
|
@@ -374,7 +374,7 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
374
374
|
]);
|
|
375
375
|
function ps() {
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function wt(r, e = null, t = ps) {
|
|
378
378
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
379
379
|
const s = e || Ae(r), n = hs.get(s);
|
|
380
380
|
if (s === "Object") {
|
|
@@ -394,14 +394,14 @@ function je(r, e = {}) {
|
|
|
394
394
|
// TODO: max depth
|
|
395
395
|
// depth = Infinity,
|
|
396
396
|
} = e, s = Ae(r);
|
|
397
|
-
if (!
|
|
398
|
-
return
|
|
399
|
-
const n =
|
|
400
|
-
return
|
|
397
|
+
if (!bt(s))
|
|
398
|
+
return xt(r, null, null, null);
|
|
399
|
+
const n = wt(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
|
|
400
|
+
return xt(r, n, a, i);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const a = Ae(r), i =
|
|
404
|
-
if (!
|
|
402
|
+
function xt(r, e, t, s, n) {
|
|
403
|
+
const a = Ae(r), i = wt(r, a);
|
|
404
|
+
if (!bt(a))
|
|
405
405
|
return i;
|
|
406
406
|
let o;
|
|
407
407
|
switch (a) {
|
|
@@ -422,11 +422,11 @@ function Tt(r, e, t, s, n) {
|
|
|
422
422
|
if (s.has(d))
|
|
423
423
|
Bt(e, c, t.get(d), a);
|
|
424
424
|
else {
|
|
425
|
-
const f = Ae(d), v =
|
|
426
|
-
|
|
425
|
+
const f = Ae(d), v = wt(d, f);
|
|
426
|
+
bt(f) && (t.set(d, v), s.add(d)), Bt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
|
-
|
|
429
|
+
xt(
|
|
430
430
|
d,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
@@ -439,32 +439,32 @@ function Tt(r, e, t, s, n) {
|
|
|
439
439
|
return e;
|
|
440
440
|
}
|
|
441
441
|
const ms = (r) => new Promise((e) => setTimeout(e, r));
|
|
442
|
-
var
|
|
442
|
+
var et, ye, tt, kt, ir;
|
|
443
443
|
class gs {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
|
-
B(this,
|
|
445
|
+
B(this, kt), B(this, et), B(this, ye), B(this, tt), R(this, et, e), R(this, tt, t), R(this, ye, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
|
-
return
|
|
448
|
+
return I(this, null, function* () {
|
|
449
449
|
try {
|
|
450
|
-
return yield S(this,
|
|
450
|
+
return yield S(this, tt).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
|
-
if (R(this, ye, S(this, ye) + 1), S(this, ye) > S(this,
|
|
452
|
+
if (R(this, ye, S(this, ye) + 1), S(this, ye) > S(this, et))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
|
-
const t = Q(this,
|
|
454
|
+
const t = Q(this, kt, ir).call(this);
|
|
455
455
|
return yield ms(t), yield this.run();
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
|
|
460
|
+
et = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakSet(), ir = function() {
|
|
461
461
|
return S(this, ye) * 1e3 * 1.5;
|
|
462
462
|
};
|
|
463
463
|
function ys() {
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
466
|
function vs(r) {
|
|
467
|
-
return
|
|
467
|
+
return I(this, null, function* () {
|
|
468
468
|
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
470
|
for (var s = Dr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
@@ -485,7 +485,7 @@ function vs(r) {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
function _s(r) {
|
|
488
|
-
return
|
|
488
|
+
return I(this, null, function* () {
|
|
489
489
|
const e = yield new Blob(r).arrayBuffer();
|
|
490
490
|
return new Uint8Array(e);
|
|
491
491
|
});
|
|
@@ -534,7 +534,7 @@ class ws extends Error {
|
|
|
534
534
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
class
|
|
537
|
+
class gt extends Error {
|
|
538
538
|
constructor(e) {
|
|
539
539
|
super(e), this.name = "Request Validation Error";
|
|
540
540
|
}
|
|
@@ -545,11 +545,11 @@ function or() {
|
|
|
545
545
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
546
546
|
).join("");
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Tt() {
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
551
|
const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
|
|
552
|
-
var ve, L, X,
|
|
552
|
+
var ve, L, X, St, At, Ze;
|
|
553
553
|
class Ts {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
555
|
B(this, X), B(this, ve), B(this, L), this.baseAddress = t, R(this, ve, e), R(this, L, {}), this.plugins = [];
|
|
@@ -567,41 +567,41 @@ class Ts {
|
|
|
567
567
|
return R(this, L, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return
|
|
570
|
+
return I(this, arguments, function* (t, s = {}) {
|
|
571
571
|
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
573
|
const c = je(S(this, L));
|
|
574
|
-
return R(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o =
|
|
574
|
+
return R(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = jt(U({}, o), { "X-Request-Nonce": or(), "X-Request-Timestamp": Tt() })), c.async ? yield Q(this, X, At).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, St).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return
|
|
578
|
+
return I(this, arguments, function* (s, n, a = {}) {
|
|
579
579
|
const i = je(S(this, L));
|
|
580
580
|
return R(this, L, {}), Q(this, X, Ze).call(this, s, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return
|
|
584
|
+
return I(this, arguments, function* (s, n, a = {}) {
|
|
585
585
|
const i = je(S(this, L));
|
|
586
586
|
return R(this, L, {}), Q(this, X, Ze).call(this, s, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return
|
|
590
|
+
return I(this, arguments, function* (s, n, a = {}) {
|
|
591
591
|
const i = je(S(this, L));
|
|
592
592
|
return R(this, L, {}), Q(this, X, Ze).call(this, s, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return
|
|
596
|
+
return I(this, arguments, function* (s, n, a = {}) {
|
|
597
597
|
const i = je(S(this, L));
|
|
598
598
|
return R(this, L, {}), Q(this, X, Ze).call(this, s, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(),
|
|
603
|
-
return
|
|
604
|
-
const s = () =>
|
|
602
|
+
ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), St = function(r, e, t) {
|
|
603
|
+
return I(this, null, function* () {
|
|
604
|
+
const s = () => I(this, null, function* () {
|
|
605
605
|
var c, d;
|
|
606
606
|
try {
|
|
607
607
|
return yield S(this, ve).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
@@ -611,7 +611,7 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
611
611
|
}), { headers: n } = t != null ? t : {}, a = (c, d) => {
|
|
612
612
|
var f, v;
|
|
613
613
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[d]) || "";
|
|
614
|
-
}, i = (c) =>
|
|
614
|
+
}, i = (c) => I(this, null, function* () {
|
|
615
615
|
var d;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
@@ -628,13 +628,13 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
628
628
|
try {
|
|
629
629
|
const v = a(c, "x-response-nonce"), j = n == null ? void 0 : n["X-Request-Nonce"];
|
|
630
630
|
if (!v || v !== j)
|
|
631
|
-
throw new
|
|
632
|
-
const M = Number(a(c, "x-response-timestamp")), F = Number(
|
|
631
|
+
throw new gt("Response nonce mismatch");
|
|
632
|
+
const M = Number(a(c, "x-response-timestamp")), F = Number(Tt()), z = 60 * 60 * 24;
|
|
633
633
|
if (isNaN(M) || Math.abs(F - M) > z)
|
|
634
|
-
throw new
|
|
634
|
+
throw new gt("Invalid response timestamp");
|
|
635
635
|
} catch (v) {
|
|
636
636
|
const j = v instanceof Error ? v.message : "Request validation failed";
|
|
637
|
-
throw new
|
|
637
|
+
throw new gt(j);
|
|
638
638
|
}
|
|
639
639
|
let f = yield c.text();
|
|
640
640
|
try {
|
|
@@ -653,8 +653,8 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
653
653
|
const o = yield s();
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
|
-
},
|
|
657
|
-
return
|
|
656
|
+
}, At = function(r, e, t) {
|
|
657
|
+
return I(this, null, function* () {
|
|
658
658
|
var s, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
@@ -682,10 +682,10 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
682
682
|
const j = yield v.json(), { job_id: M } = j;
|
|
683
683
|
if (!M)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((F, z) =>
|
|
685
|
+
return new Promise((F, z) => I(this, null, function* () {
|
|
686
686
|
const se = setTimeout(() => {
|
|
687
687
|
z(new Error("Job timed out"));
|
|
688
|
-
}, c), ge = (
|
|
688
|
+
}, c), ge = (ce = 0) => I(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
690
|
clearTimeout(se), S(this, ve).call(this, `${f}/${M}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
691
|
z(new Re({ canceled: !0 }));
|
|
@@ -704,8 +704,8 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
704
704
|
clearTimeout(se), z(new ws(V.response_json));
|
|
705
705
|
else {
|
|
706
706
|
a && a(V.response_json);
|
|
707
|
-
const K = o(
|
|
708
|
-
setTimeout(() => ge(
|
|
707
|
+
const K = o(ce);
|
|
708
|
+
setTimeout(() => ge(ce + 1), K);
|
|
709
709
|
}
|
|
710
710
|
} catch (V) {
|
|
711
711
|
z(V);
|
|
@@ -715,19 +715,19 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
717
|
}, Ze = function(r, e, t, s, n) {
|
|
718
|
-
return
|
|
718
|
+
return I(this, null, function* () {
|
|
719
719
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c =
|
|
721
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = jt(U({}, c), { "X-Request-Nonce": or(), "X-Request-Timestamp": Tt() }));
|
|
722
722
|
let d = t;
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Q(this, X,
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Q(this, X, At).call(this, `${o}${r}`, n.async, {
|
|
724
724
|
method: e,
|
|
725
725
|
headers: c,
|
|
726
726
|
body: d
|
|
727
|
-
}) : yield Q(this, X,
|
|
727
|
+
}) : yield Q(this, X, St).call(this, `${o}${r}`, n, { method: e, headers: c, body: d });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const Jt = (r, e, t, s) => r instanceof Re ? r : new bs({ resource: e, api: String(t), args: s, cause: r }),
|
|
730
|
+
const Jt = (r, e, t, s) => r instanceof Re ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), yt = (r, e) => new Proxy(e, {
|
|
731
731
|
get(t, s) {
|
|
732
732
|
return (...n) => {
|
|
733
733
|
var a;
|
|
@@ -754,7 +754,7 @@ class Ss {
|
|
|
754
754
|
B(this, Me), this.resourceName = "Files", R(this, Me, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return
|
|
757
|
+
return I(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
758
758
|
const n = new URLSearchParams(U({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
760
|
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
@@ -762,7 +762,7 @@ class Ss {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
|
-
return
|
|
765
|
+
return I(this, arguments, function* ({ fileKey: t }) {
|
|
766
766
|
var s, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
768
|
return (n = (s = (yield S(this, Me).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
@@ -770,29 +770,29 @@ class Ss {
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
Me = /* @__PURE__ */ new WeakMap();
|
|
773
|
-
const
|
|
773
|
+
const As = (r, e, t) => {
|
|
774
774
|
const s = e.sort();
|
|
775
775
|
return `${r}-${s.join("-")}-${t}`;
|
|
776
|
-
},
|
|
777
|
-
var Y,
|
|
776
|
+
}, Es = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
|
+
var Y, Et, cr;
|
|
778
778
|
class Cs {
|
|
779
779
|
constructor(e) {
|
|
780
|
-
B(this,
|
|
780
|
+
B(this, Et), B(this, Y), this.resourceName = "Images", R(this, Y, e);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Return the URL for the _layer_ images for the given nodes.
|
|
784
784
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
785
785
|
*/
|
|
786
786
|
get(e) {
|
|
787
|
-
return
|
|
788
|
-
const i =
|
|
789
|
-
if (
|
|
787
|
+
return I(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = As(t, s, n), o = S(this, Y).cache.images.entries.get(i);
|
|
789
|
+
if (Es(o))
|
|
790
790
|
return o.result;
|
|
791
791
|
o && S(this, Y).cache.images.entries.delete(i);
|
|
792
792
|
const c = S(this, Y).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const d = Q(this,
|
|
795
|
+
const d = Q(this, Et, cr).call(this, i, t, s, n, a);
|
|
796
796
|
S(this, Y).cache.images.pendingRequests.set(i, d);
|
|
797
797
|
try {
|
|
798
798
|
return yield d;
|
|
@@ -802,8 +802,8 @@ class Cs {
|
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
Y = /* @__PURE__ */ new WeakMap(),
|
|
806
|
-
return
|
|
805
|
+
Y = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), cr = function(r, e, t, s, n) {
|
|
806
|
+
return I(this, null, function* () {
|
|
807
807
|
const a = yield S(this, Y).get(
|
|
808
808
|
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
@@ -813,53 +813,53 @@ Y = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakSet(), cr = func
|
|
|
813
813
|
}), a;
|
|
814
814
|
});
|
|
815
815
|
};
|
|
816
|
-
var
|
|
817
|
-
class
|
|
816
|
+
var rt;
|
|
817
|
+
class Os {
|
|
818
818
|
constructor(e) {
|
|
819
|
-
B(this,
|
|
819
|
+
B(this, rt), this.resourceName = "Nodes", R(this, rt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return
|
|
823
|
-
const a =
|
|
822
|
+
return I(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
823
|
+
const a = jt(U({}, n), {
|
|
824
824
|
ids: s.join(",")
|
|
825
825
|
}), i = new URLSearchParams(U({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
827
827
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
828
|
-
return yield S(this,
|
|
828
|
+
return yield S(this, rt).get(o);
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
|
|
833
|
-
var
|
|
832
|
+
rt = /* @__PURE__ */ new WeakMap();
|
|
833
|
+
var ue;
|
|
834
834
|
class dr extends Ts {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
838
838
|
} = {}) {
|
|
839
|
-
super({ fetch: t, baseAddress: e }), B(this,
|
|
839
|
+
super({ fetch: t, baseAddress: e }), B(this, ue, ""), this.cache = {
|
|
840
840
|
images: {
|
|
841
841
|
entries: /* @__PURE__ */ new Map(),
|
|
842
842
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
843
843
|
}
|
|
844
|
-
}, this.files =
|
|
844
|
+
}, this.files = yt(this, new Ss(this)), this.nodes = yt(this, new Os(this)), this.images = yt(this, new Cs(this));
|
|
845
845
|
}
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
848
848
|
throw new Error("Invalid Figma access token");
|
|
849
|
-
R(this,
|
|
849
|
+
R(this, ue, e);
|
|
850
850
|
}
|
|
851
851
|
get token() {
|
|
852
|
-
return S(this,
|
|
852
|
+
return S(this, ue);
|
|
853
853
|
}
|
|
854
854
|
get headers() {
|
|
855
855
|
const e = {
|
|
856
856
|
"Content-Type": "application/json"
|
|
857
857
|
};
|
|
858
|
-
return S(this,
|
|
858
|
+
return S(this, ue).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = S(this, ue) : S(this, ue).startsWith("figu_") && (e.Authorization = `Bearer ${S(this, ue)}`), e;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
const
|
|
861
|
+
ue = /* @__PURE__ */ new WeakMap();
|
|
862
|
+
const Is = (a) => C(void 0, [a], function* ({
|
|
863
863
|
fileKey: r,
|
|
864
864
|
authToken: e,
|
|
865
865
|
figmaRestApi: t = new dr(),
|
|
@@ -877,7 +877,7 @@ const Os = (a) => C(void 0, [a], function* ({
|
|
|
877
877
|
} catch (i) {
|
|
878
878
|
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), nr(i, r));
|
|
879
879
|
}
|
|
880
|
-
}),
|
|
880
|
+
}), Yn = (i) => C(void 0, [i], function* ({
|
|
881
881
|
fileKey: r,
|
|
882
882
|
authToken: e,
|
|
883
883
|
nodeIds: t,
|
|
@@ -944,10 +944,10 @@ var x;
|
|
|
944
944
|
}
|
|
945
945
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
946
946
|
})(x || (x = {}));
|
|
947
|
-
var
|
|
947
|
+
var Ct;
|
|
948
948
|
(function(r) {
|
|
949
949
|
r.mergeShapes = (e, t) => u(u({}, e), t);
|
|
950
|
-
})(
|
|
950
|
+
})(Ct || (Ct = {}));
|
|
951
951
|
const p = x.arrayToEnum([
|
|
952
952
|
"string",
|
|
953
953
|
"nan",
|
|
@@ -1068,7 +1068,7 @@ class W extends Error {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
W.create = (r) => new W(r);
|
|
1071
|
-
const
|
|
1071
|
+
const Ee = (r, e) => {
|
|
1072
1072
|
let t;
|
|
1073
1073
|
switch (r.code) {
|
|
1074
1074
|
case l.invalid_type:
|
|
@@ -1124,7 +1124,7 @@ const Ce = (r, e) => {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
return { message: t };
|
|
1126
1126
|
};
|
|
1127
|
-
let lr =
|
|
1127
|
+
let lr = Ee;
|
|
1128
1128
|
function js(r) {
|
|
1129
1129
|
lr = r;
|
|
1130
1130
|
}
|
|
@@ -1161,7 +1161,7 @@ function h(r, e) {
|
|
|
1161
1161
|
// then schema-bound map if available
|
|
1162
1162
|
t,
|
|
1163
1163
|
// then global override map
|
|
1164
|
-
t ===
|
|
1164
|
+
t === Ee ? void 0 : Ee
|
|
1165
1165
|
// then global default map
|
|
1166
1166
|
].filter((n) => !!n)
|
|
1167
1167
|
});
|
|
@@ -1212,7 +1212,7 @@ class Z {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
const _ = Object.freeze({
|
|
1214
1214
|
status: "aborted"
|
|
1215
|
-
}),
|
|
1215
|
+
}), Te = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), Ot = (r) => r.status === "aborted", It = (r) => r.status === "dirty", be = (r) => r.status === "valid", Fe = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1216
1216
|
function it(r, e, t, s) {
|
|
1217
1217
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1218
1218
|
return e.get(r);
|
|
@@ -1293,7 +1293,7 @@ class w {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
_parseSync(e) {
|
|
1295
1295
|
const t = this._parse(e);
|
|
1296
|
-
if (
|
|
1296
|
+
if (Fe(t))
|
|
1297
1297
|
throw new Error("Synchronous parse encountered promise.");
|
|
1298
1298
|
return t;
|
|
1299
1299
|
}
|
|
@@ -1377,7 +1377,7 @@ class w {
|
|
|
1377
1377
|
parent: null,
|
|
1378
1378
|
data: e,
|
|
1379
1379
|
parsedType: ie(e)
|
|
1380
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield
|
|
1380
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Fe(n) ? n : Promise.resolve(n);
|
|
1381
1381
|
return Gt(s, a);
|
|
1382
1382
|
});
|
|
1383
1383
|
}
|
|
@@ -1426,10 +1426,10 @@ class w {
|
|
|
1426
1426
|
return Oe.create(this, this._def);
|
|
1427
1427
|
}
|
|
1428
1428
|
or(e) {
|
|
1429
|
-
return
|
|
1429
|
+
return Ue.create([this, e], this._def);
|
|
1430
1430
|
}
|
|
1431
1431
|
and(e) {
|
|
1432
|
-
return
|
|
1432
|
+
return We.create(this, e, this._def);
|
|
1433
1433
|
}
|
|
1434
1434
|
transform(e) {
|
|
1435
1435
|
return new G(g(u({}, b(this._def)), {
|
|
@@ -1440,21 +1440,21 @@ class w {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
default(e) {
|
|
1442
1442
|
const t = typeof e == "function" ? e : () => e;
|
|
1443
|
-
return new
|
|
1443
|
+
return new Je(g(u({}, b(this._def)), {
|
|
1444
1444
|
innerType: this,
|
|
1445
1445
|
defaultValue: t,
|
|
1446
1446
|
typeName: y.ZodDefault
|
|
1447
1447
|
}));
|
|
1448
1448
|
}
|
|
1449
1449
|
brand() {
|
|
1450
|
-
return new
|
|
1450
|
+
return new Mt(u({
|
|
1451
1451
|
typeName: y.ZodBranded,
|
|
1452
1452
|
type: this
|
|
1453
1453
|
}, b(this._def)));
|
|
1454
1454
|
}
|
|
1455
1455
|
catch(e) {
|
|
1456
1456
|
const t = typeof e == "function" ? e : () => e;
|
|
1457
|
-
return new
|
|
1457
|
+
return new Ge(g(u({}, b(this._def)), {
|
|
1458
1458
|
innerType: this,
|
|
1459
1459
|
catchValue: t,
|
|
1460
1460
|
typeName: y.ZodCatch
|
|
@@ -1467,10 +1467,10 @@ class w {
|
|
|
1467
1467
|
}));
|
|
1468
1468
|
}
|
|
1469
1469
|
pipe(e) {
|
|
1470
|
-
return
|
|
1470
|
+
return Ye.create(this, e);
|
|
1471
1471
|
}
|
|
1472
1472
|
readonly() {
|
|
1473
|
-
return
|
|
1473
|
+
return Ke.create(this);
|
|
1474
1474
|
}
|
|
1475
1475
|
isOptional() {
|
|
1476
1476
|
return this.safeParse(void 0).success;
|
|
@@ -1480,7 +1480,7 @@ class w {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
1482
|
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[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, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Vs = /^[-+]?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)?)??$/, Ds = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1483
|
-
let
|
|
1483
|
+
let vt;
|
|
1484
1484
|
const Ws = /^(?:(?: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])$/, zs = /^(?:(?: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])$/, Bs = /^(([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]))$/, qs = /^(([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])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, hr = "((\\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])))", Gs = new RegExp(`^${hr}$`);
|
|
1485
1485
|
function pr(r) {
|
|
1486
1486
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -1565,7 +1565,7 @@ class H extends w {
|
|
|
1565
1565
|
message: a.message
|
|
1566
1566
|
}), s.dirty());
|
|
1567
1567
|
else if (a.kind === "emoji")
|
|
1568
|
-
|
|
1568
|
+
vt || (vt = new RegExp(Us, "u")), vt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1569
1569
|
validation: "emoji",
|
|
1570
1570
|
code: l.invalid_string,
|
|
1571
1571
|
message: a.message
|
|
@@ -2187,7 +2187,7 @@ he.create = (r) => {
|
|
|
2187
2187
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
2188
2188
|
}, b(r)));
|
|
2189
2189
|
};
|
|
2190
|
-
class
|
|
2190
|
+
class Le extends w {
|
|
2191
2191
|
_parse(e) {
|
|
2192
2192
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
2193
2193
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2200,7 +2200,7 @@ class Ve extends w {
|
|
|
2200
2200
|
return $(e.data);
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
|
-
|
|
2203
|
+
Le.create = (r) => new Le(u({
|
|
2204
2204
|
typeName: y.ZodBoolean,
|
|
2205
2205
|
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2206
2206
|
}, b(r)));
|
|
@@ -2296,7 +2296,7 @@ class ot extends w {
|
|
|
2296
2296
|
ot.create = (r) => new ot(u({
|
|
2297
2297
|
typeName: y.ZodSymbol
|
|
2298
2298
|
}, b(r)));
|
|
2299
|
-
class
|
|
2299
|
+
class Ve extends w {
|
|
2300
2300
|
_parse(e) {
|
|
2301
2301
|
if (this._getType(e) !== p.undefined) {
|
|
2302
2302
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2309,10 +2309,10 @@ class De extends w {
|
|
|
2309
2309
|
return $(e.data);
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
|
|
2312
|
+
Ve.create = (r) => new Ve(u({
|
|
2313
2313
|
typeName: y.ZodUndefined
|
|
2314
2314
|
}, b(r)));
|
|
2315
|
-
class
|
|
2315
|
+
class De extends w {
|
|
2316
2316
|
_parse(e) {
|
|
2317
2317
|
if (this._getType(e) !== p.null) {
|
|
2318
2318
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2325,10 +2325,10 @@ class Ue extends w {
|
|
|
2325
2325
|
return $(e.data);
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
De.create = (r) => new De(u({
|
|
2329
2329
|
typeName: y.ZodNull
|
|
2330
2330
|
}, b(r)));
|
|
2331
|
-
class
|
|
2331
|
+
class Ce extends w {
|
|
2332
2332
|
constructor() {
|
|
2333
2333
|
super(...arguments), this._any = !0;
|
|
2334
2334
|
}
|
|
@@ -2336,7 +2336,7 @@ class Ie extends w {
|
|
|
2336
2336
|
return $(e.data);
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
Ce.create = (r) => new Ce(u({
|
|
2340
2340
|
typeName: y.ZodAny
|
|
2341
2341
|
}, b(r)));
|
|
2342
2342
|
class _e extends w {
|
|
@@ -2350,7 +2350,7 @@ class _e extends w {
|
|
|
2350
2350
|
_e.create = (r) => new _e(u({
|
|
2351
2351
|
typeName: y.ZodUnknown
|
|
2352
2352
|
}, b(r)));
|
|
2353
|
-
class
|
|
2353
|
+
class oe extends w {
|
|
2354
2354
|
_parse(e) {
|
|
2355
2355
|
const t = this._getOrReturnCtx(e);
|
|
2356
2356
|
return h(t, {
|
|
@@ -2360,7 +2360,7 @@ class ce extends w {
|
|
|
2360
2360
|
}), _;
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
|
|
2363
|
+
oe.create = (r) => new oe(u({
|
|
2364
2364
|
typeName: y.ZodNever
|
|
2365
2365
|
}, b(r)));
|
|
2366
2366
|
class ct extends w {
|
|
@@ -2448,21 +2448,21 @@ J.create = (r, e) => new J(u({
|
|
|
2448
2448
|
exactLength: null,
|
|
2449
2449
|
typeName: y.ZodArray
|
|
2450
2450
|
}, b(e)));
|
|
2451
|
-
function
|
|
2452
|
-
if (r instanceof
|
|
2451
|
+
function ke(r) {
|
|
2452
|
+
if (r instanceof A) {
|
|
2453
2453
|
const e = {};
|
|
2454
2454
|
for (const t in r.shape) {
|
|
2455
2455
|
const s = r.shape[t];
|
|
2456
|
-
e[t] = ee.create(
|
|
2456
|
+
e[t] = ee.create(ke(s));
|
|
2457
2457
|
}
|
|
2458
|
-
return new
|
|
2458
|
+
return new A(g(u({}, r._def), {
|
|
2459
2459
|
shape: () => e
|
|
2460
2460
|
}));
|
|
2461
2461
|
} else return r instanceof J ? new J(g(u({}, r._def), {
|
|
2462
|
-
type:
|
|
2463
|
-
})) : r instanceof ee ? ee.create(
|
|
2462
|
+
type: ke(r.element)
|
|
2463
|
+
})) : r instanceof ee ? ee.create(ke(r.unwrap())) : r instanceof me ? me.create(ke(r.unwrap())) : r instanceof re ? re.create(r.items.map((e) => ke(e))) : r;
|
|
2464
2464
|
}
|
|
2465
|
-
class
|
|
2465
|
+
class A extends w {
|
|
2466
2466
|
constructor() {
|
|
2467
2467
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2468
2468
|
}
|
|
@@ -2482,7 +2482,7 @@ class I extends w {
|
|
|
2482
2482
|
}), _;
|
|
2483
2483
|
}
|
|
2484
2484
|
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2485
|
-
if (!(this._def.catchall instanceof
|
|
2485
|
+
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
2486
2486
|
for (const d in n.data)
|
|
2487
2487
|
i.includes(d) || o.push(d);
|
|
2488
2488
|
const c = [];
|
|
@@ -2494,7 +2494,7 @@ class I extends w {
|
|
|
2494
2494
|
alwaysSet: d in n.data
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
if (this._def.catchall instanceof
|
|
2497
|
+
if (this._def.catchall instanceof oe) {
|
|
2498
2498
|
const d = this._def.unknownKeys;
|
|
2499
2499
|
if (d === "passthrough")
|
|
2500
2500
|
for (const f of o)
|
|
@@ -2539,7 +2539,7 @@ class I extends w {
|
|
|
2539
2539
|
return this._def.shape();
|
|
2540
2540
|
}
|
|
2541
2541
|
strict(e) {
|
|
2542
|
-
return m.errToObj, new
|
|
2542
|
+
return m.errToObj, new A(u(g(u({}, this._def), {
|
|
2543
2543
|
unknownKeys: "strict"
|
|
2544
2544
|
}), e !== void 0 ? {
|
|
2545
2545
|
errorMap: (t, s) => {
|
|
@@ -2554,12 +2554,12 @@ class I extends w {
|
|
|
2554
2554
|
} : {}));
|
|
2555
2555
|
}
|
|
2556
2556
|
strip() {
|
|
2557
|
-
return new
|
|
2557
|
+
return new A(g(u({}, this._def), {
|
|
2558
2558
|
unknownKeys: "strip"
|
|
2559
2559
|
}));
|
|
2560
2560
|
}
|
|
2561
2561
|
passthrough() {
|
|
2562
|
-
return new
|
|
2562
|
+
return new A(g(u({}, this._def), {
|
|
2563
2563
|
unknownKeys: "passthrough"
|
|
2564
2564
|
}));
|
|
2565
2565
|
}
|
|
@@ -2581,7 +2581,7 @@ class I extends w {
|
|
|
2581
2581
|
// }) as any;
|
|
2582
2582
|
// };
|
|
2583
2583
|
extend(e) {
|
|
2584
|
-
return new
|
|
2584
|
+
return new A(g(u({}, this._def), {
|
|
2585
2585
|
shape: () => u(u({}, this._def.shape()), e)
|
|
2586
2586
|
}));
|
|
2587
2587
|
}
|
|
@@ -2591,7 +2591,7 @@ class I extends w {
|
|
|
2591
2591
|
* upgrade if you are experiencing issues.
|
|
2592
2592
|
*/
|
|
2593
2593
|
merge(e) {
|
|
2594
|
-
return new
|
|
2594
|
+
return new A({
|
|
2595
2595
|
unknownKeys: e._def.unknownKeys,
|
|
2596
2596
|
catchall: e._def.catchall,
|
|
2597
2597
|
shape: () => u(u({}, this._def.shape()), e._def.shape()),
|
|
@@ -2658,7 +2658,7 @@ class I extends w {
|
|
|
2658
2658
|
// return merged;
|
|
2659
2659
|
// }
|
|
2660
2660
|
catchall(e) {
|
|
2661
|
-
return new
|
|
2661
|
+
return new A(g(u({}, this._def), {
|
|
2662
2662
|
catchall: e
|
|
2663
2663
|
}));
|
|
2664
2664
|
}
|
|
@@ -2666,7 +2666,7 @@ class I extends w {
|
|
|
2666
2666
|
const t = {};
|
|
2667
2667
|
return x.objectKeys(e).forEach((s) => {
|
|
2668
2668
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2669
|
-
}), new
|
|
2669
|
+
}), new A(g(u({}, this._def), {
|
|
2670
2670
|
shape: () => t
|
|
2671
2671
|
}));
|
|
2672
2672
|
}
|
|
@@ -2674,7 +2674,7 @@ class I extends w {
|
|
|
2674
2674
|
const t = {};
|
|
2675
2675
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
2676
2676
|
e[s] || (t[s] = this.shape[s]);
|
|
2677
|
-
}), new
|
|
2677
|
+
}), new A(g(u({}, this._def), {
|
|
2678
2678
|
shape: () => t
|
|
2679
2679
|
}));
|
|
2680
2680
|
}
|
|
@@ -2682,14 +2682,14 @@ class I extends w {
|
|
|
2682
2682
|
* @deprecated
|
|
2683
2683
|
*/
|
|
2684
2684
|
deepPartial() {
|
|
2685
|
-
return
|
|
2685
|
+
return ke(this);
|
|
2686
2686
|
}
|
|
2687
2687
|
partial(e) {
|
|
2688
2688
|
const t = {};
|
|
2689
2689
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
2690
2690
|
const n = this.shape[s];
|
|
2691
2691
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2692
|
-
}), new
|
|
2692
|
+
}), new A(g(u({}, this._def), {
|
|
2693
2693
|
shape: () => t
|
|
2694
2694
|
}));
|
|
2695
2695
|
}
|
|
@@ -2704,7 +2704,7 @@ class I extends w {
|
|
|
2704
2704
|
a = a._def.innerType;
|
|
2705
2705
|
t[s] = a;
|
|
2706
2706
|
}
|
|
2707
|
-
}), new
|
|
2707
|
+
}), new A(g(u({}, this._def), {
|
|
2708
2708
|
shape: () => t
|
|
2709
2709
|
}));
|
|
2710
2710
|
}
|
|
@@ -2712,25 +2712,25 @@ class I extends w {
|
|
|
2712
2712
|
return gr(x.objectKeys(this.shape));
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
|
|
2715
|
+
A.create = (r, e) => new A(u({
|
|
2716
2716
|
shape: () => r,
|
|
2717
2717
|
unknownKeys: "strip",
|
|
2718
|
-
catchall:
|
|
2718
|
+
catchall: oe.create(),
|
|
2719
2719
|
typeName: y.ZodObject
|
|
2720
2720
|
}, b(e)));
|
|
2721
|
-
|
|
2721
|
+
A.strictCreate = (r, e) => new A(u({
|
|
2722
2722
|
shape: () => r,
|
|
2723
2723
|
unknownKeys: "strict",
|
|
2724
|
-
catchall:
|
|
2724
|
+
catchall: oe.create(),
|
|
2725
2725
|
typeName: y.ZodObject
|
|
2726
2726
|
}, b(e)));
|
|
2727
|
-
|
|
2727
|
+
A.lazycreate = (r, e) => new A(u({
|
|
2728
2728
|
shape: r,
|
|
2729
2729
|
unknownKeys: "strip",
|
|
2730
|
-
catchall:
|
|
2730
|
+
catchall: oe.create(),
|
|
2731
2731
|
typeName: y.ZodObject
|
|
2732
2732
|
}, b(e)));
|
|
2733
|
-
class
|
|
2733
|
+
class Ue extends w {
|
|
2734
2734
|
_parse(e) {
|
|
2735
2735
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2736
2736
|
function n(a) {
|
|
@@ -2794,11 +2794,11 @@ class We extends w {
|
|
|
2794
2794
|
return this._def.options;
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
|
|
2797
|
+
Ue.create = (r, e) => new Ue(u({
|
|
2798
2798
|
options: r,
|
|
2799
2799
|
typeName: y.ZodUnion
|
|
2800
2800
|
}, b(e)));
|
|
2801
|
-
const ae = (r) => r instanceof
|
|
2801
|
+
const ae = (r) => r instanceof Be ? ae(r.schema) : r instanceof G ? ae(r.innerType()) : r instanceof qe ? [r.value] : r instanceof pe ? r.options : r instanceof He ? x.objectValues(r.enum) : r instanceof Je ? ae(r._def.innerType) : r instanceof Ve ? [void 0] : r instanceof De ? [null] : r instanceof ee ? [void 0, ...ae(r.unwrap())] : r instanceof me ? [null, ...ae(r.unwrap())] : r instanceof Mt || r instanceof Ke ? ae(r.unwrap()) : r instanceof Ge ? ae(r._def.innerType) : [];
|
|
2802
2802
|
class lt extends w {
|
|
2803
2803
|
_parse(e) {
|
|
2804
2804
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2860,14 +2860,14 @@ class lt extends w {
|
|
|
2860
2860
|
}, b(s)));
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2863
|
+
function Nt(r, e) {
|
|
2864
2864
|
const t = ie(r), s = ie(e);
|
|
2865
2865
|
if (r === e)
|
|
2866
2866
|
return { valid: !0, data: r };
|
|
2867
2867
|
if (t === p.object && s === p.object) {
|
|
2868
2868
|
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = u(u({}, r), e);
|
|
2869
2869
|
for (const o of a) {
|
|
2870
|
-
const c =
|
|
2870
|
+
const c = Nt(r[o], e[o]);
|
|
2871
2871
|
if (!c.valid)
|
|
2872
2872
|
return { valid: !1 };
|
|
2873
2873
|
i[o] = c.data;
|
|
@@ -2878,7 +2878,7 @@ function Rt(r, e) {
|
|
|
2878
2878
|
return { valid: !1 };
|
|
2879
2879
|
const n = [];
|
|
2880
2880
|
for (let a = 0; a < r.length; a++) {
|
|
2881
|
-
const i = r[a], o = e[a], c =
|
|
2881
|
+
const i = r[a], o = e[a], c = Nt(i, o);
|
|
2882
2882
|
if (!c.valid)
|
|
2883
2883
|
return { valid: !1 };
|
|
2884
2884
|
n.push(c.data);
|
|
@@ -2886,13 +2886,13 @@ function Rt(r, e) {
|
|
|
2886
2886
|
return { valid: !0, data: n };
|
|
2887
2887
|
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2888
2888
|
}
|
|
2889
|
-
class
|
|
2889
|
+
class We extends w {
|
|
2890
2890
|
_parse(e) {
|
|
2891
2891
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2892
|
-
if (
|
|
2892
|
+
if (Ot(a) || Ot(i))
|
|
2893
2893
|
return _;
|
|
2894
|
-
const o =
|
|
2895
|
-
return o.valid ? ((
|
|
2894
|
+
const o = Nt(a.value, i.value);
|
|
2895
|
+
return o.valid ? ((It(a) || It(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2896
2896
|
code: l.invalid_intersection_types
|
|
2897
2897
|
}), _);
|
|
2898
2898
|
};
|
|
@@ -2918,7 +2918,7 @@ class ze extends w {
|
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
2920
|
}
|
|
2921
|
-
|
|
2921
|
+
We.create = (r, e, t) => new We(u({
|
|
2922
2922
|
left: r,
|
|
2923
2923
|
right: e,
|
|
2924
2924
|
typeName: y.ZodIntersection
|
|
@@ -2971,7 +2971,7 @@ re.create = (r, e) => {
|
|
|
2971
2971
|
rest: null
|
|
2972
2972
|
}, b(e)));
|
|
2973
2973
|
};
|
|
2974
|
-
class
|
|
2974
|
+
class ze extends w {
|
|
2975
2975
|
get keySchema() {
|
|
2976
2976
|
return this._def.keyType;
|
|
2977
2977
|
}
|
|
@@ -2999,11 +2999,11 @@ class Be extends w {
|
|
|
2999
2999
|
return this._def.valueType;
|
|
3000
3000
|
}
|
|
3001
3001
|
static create(e, t, s) {
|
|
3002
|
-
return t instanceof w ? new
|
|
3002
|
+
return t instanceof w ? new ze(u({
|
|
3003
3003
|
keyType: e,
|
|
3004
3004
|
valueType: t,
|
|
3005
3005
|
typeName: y.ZodRecord
|
|
3006
|
-
}, b(s))) : new
|
|
3006
|
+
}, b(s))) : new ze(u({
|
|
3007
3007
|
keyType: H.create(),
|
|
3008
3008
|
valueType: e,
|
|
3009
3009
|
typeName: y.ZodRecord
|
|
@@ -3118,7 +3118,7 @@ xe.create = (r, e) => new xe(u({
|
|
|
3118
3118
|
maxSize: null,
|
|
3119
3119
|
typeName: y.ZodSet
|
|
3120
3120
|
}, b(e)));
|
|
3121
|
-
class
|
|
3121
|
+
class Se extends w {
|
|
3122
3122
|
constructor() {
|
|
3123
3123
|
super(...arguments), this.validate = this.implement;
|
|
3124
3124
|
}
|
|
@@ -3138,7 +3138,7 @@ class Ee extends w {
|
|
|
3138
3138
|
t.common.contextualErrorMap,
|
|
3139
3139
|
t.schemaErrorMap,
|
|
3140
3140
|
nt(),
|
|
3141
|
-
|
|
3141
|
+
Ee
|
|
3142
3142
|
].filter((d) => !!d),
|
|
3143
3143
|
issueData: {
|
|
3144
3144
|
code: l.invalid_arguments,
|
|
@@ -3154,7 +3154,7 @@ class Ee extends w {
|
|
|
3154
3154
|
t.common.contextualErrorMap,
|
|
3155
3155
|
t.schemaErrorMap,
|
|
3156
3156
|
nt(),
|
|
3157
|
-
|
|
3157
|
+
Ee
|
|
3158
3158
|
].filter((d) => !!d),
|
|
3159
3159
|
issueData: {
|
|
3160
3160
|
code: l.invalid_return_type,
|
|
@@ -3195,12 +3195,12 @@ class Ee extends w {
|
|
|
3195
3195
|
return this._def.returns;
|
|
3196
3196
|
}
|
|
3197
3197
|
args(...e) {
|
|
3198
|
-
return new
|
|
3198
|
+
return new Se(g(u({}, this._def), {
|
|
3199
3199
|
args: re.create(e).rest(_e.create())
|
|
3200
3200
|
}));
|
|
3201
3201
|
}
|
|
3202
3202
|
returns(e) {
|
|
3203
|
-
return new
|
|
3203
|
+
return new Se(g(u({}, this._def), {
|
|
3204
3204
|
returns: e
|
|
3205
3205
|
}));
|
|
3206
3206
|
}
|
|
@@ -3211,14 +3211,14 @@ class Ee extends w {
|
|
|
3211
3211
|
return this.parse(e);
|
|
3212
3212
|
}
|
|
3213
3213
|
static create(e, t, s) {
|
|
3214
|
-
return new
|
|
3214
|
+
return new Se(u({
|
|
3215
3215
|
args: e || re.create([]).rest(_e.create()),
|
|
3216
3216
|
returns: t || _e.create(),
|
|
3217
3217
|
typeName: y.ZodFunction
|
|
3218
3218
|
}, b(s)));
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
3221
|
-
class
|
|
3221
|
+
class Be extends w {
|
|
3222
3222
|
get schema() {
|
|
3223
3223
|
return this._def.getter();
|
|
3224
3224
|
}
|
|
@@ -3227,11 +3227,11 @@ class qe extends w {
|
|
|
3227
3227
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
|
|
3230
|
+
Be.create = (r, e) => new Be(u({
|
|
3231
3231
|
getter: r,
|
|
3232
3232
|
typeName: y.ZodLazy
|
|
3233
3233
|
}, b(e)));
|
|
3234
|
-
class
|
|
3234
|
+
class qe extends w {
|
|
3235
3235
|
_parse(e) {
|
|
3236
3236
|
if (e.data !== this._def.value) {
|
|
3237
3237
|
const t = this._getOrReturnCtx(e);
|
|
@@ -3247,7 +3247,7 @@ class He extends w {
|
|
|
3247
3247
|
return this._def.value;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
|
|
3250
|
+
qe.create = (r, e) => new qe(u({
|
|
3251
3251
|
value: r,
|
|
3252
3252
|
typeName: y.ZodLiteral
|
|
3253
3253
|
}, b(e)));
|
|
@@ -3310,7 +3310,7 @@ class pe extends w {
|
|
|
3310
3310
|
}
|
|
3311
3311
|
Pe = /* @__PURE__ */ new WeakMap();
|
|
3312
3312
|
pe.create = gr;
|
|
3313
|
-
class
|
|
3313
|
+
class He extends w {
|
|
3314
3314
|
constructor() {
|
|
3315
3315
|
super(...arguments), $e.set(this, void 0);
|
|
3316
3316
|
}
|
|
@@ -3339,7 +3339,7 @@ class Je extends w {
|
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
3341
|
$e = /* @__PURE__ */ new WeakMap();
|
|
3342
|
-
|
|
3342
|
+
He.create = (r, e) => new He(u({
|
|
3343
3343
|
values: r,
|
|
3344
3344
|
typeName: y.ZodNativeEnum
|
|
3345
3345
|
}, b(e)));
|
|
@@ -3393,7 +3393,7 @@ class G extends w {
|
|
|
3393
3393
|
path: s.path,
|
|
3394
3394
|
parent: s
|
|
3395
3395
|
});
|
|
3396
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ?
|
|
3396
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Te(c.value) : c;
|
|
3397
3397
|
}));
|
|
3398
3398
|
{
|
|
3399
3399
|
if (t.value === "aborted")
|
|
@@ -3403,7 +3403,7 @@ class G extends w {
|
|
|
3403
3403
|
path: s.path,
|
|
3404
3404
|
parent: s
|
|
3405
3405
|
});
|
|
3406
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ?
|
|
3406
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Te(o.value) : o;
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
3409
3409
|
if (n.type === "refinement") {
|
|
@@ -3477,7 +3477,7 @@ me.create = (r, e) => new me(u({
|
|
|
3477
3477
|
innerType: r,
|
|
3478
3478
|
typeName: y.ZodNullable
|
|
3479
3479
|
}, b(e)));
|
|
3480
|
-
class
|
|
3480
|
+
class Je extends w {
|
|
3481
3481
|
_parse(e) {
|
|
3482
3482
|
const { ctx: t } = this._processInputParams(e);
|
|
3483
3483
|
let s = t.data;
|
|
@@ -3491,12 +3491,12 @@ class Ge extends w {
|
|
|
3491
3491
|
return this._def.innerType;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
|
|
3494
|
+
Je.create = (r, e) => new Je(u({
|
|
3495
3495
|
innerType: r,
|
|
3496
3496
|
typeName: y.ZodDefault,
|
|
3497
3497
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3498
3498
|
}, b(e)));
|
|
3499
|
-
class
|
|
3499
|
+
class Ge extends w {
|
|
3500
3500
|
_parse(e) {
|
|
3501
3501
|
const { ctx: t } = this._processInputParams(e), s = g(u({}, t), {
|
|
3502
3502
|
common: g(u({}, t.common), {
|
|
@@ -3507,7 +3507,7 @@ class Ke extends w {
|
|
|
3507
3507
|
path: s.path,
|
|
3508
3508
|
parent: u({}, s)
|
|
3509
3509
|
});
|
|
3510
|
-
return
|
|
3510
|
+
return Fe(n) ? n.then((a) => ({
|
|
3511
3511
|
status: "valid",
|
|
3512
3512
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3513
3513
|
get error() {
|
|
@@ -3529,7 +3529,7 @@ class Ke extends w {
|
|
|
3529
3529
|
return this._def.innerType;
|
|
3530
3530
|
}
|
|
3531
3531
|
}
|
|
3532
|
-
|
|
3532
|
+
Ge.create = (r, e) => new Ge(u({
|
|
3533
3533
|
innerType: r,
|
|
3534
3534
|
typeName: y.ZodCatch,
|
|
3535
3535
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
@@ -3551,7 +3551,7 @@ ut.create = (r) => new ut(u({
|
|
|
3551
3551
|
typeName: y.ZodNaN
|
|
3552
3552
|
}, b(r)));
|
|
3553
3553
|
const tn = Symbol("zod_brand");
|
|
3554
|
-
class
|
|
3554
|
+
class Mt extends w {
|
|
3555
3555
|
_parse(e) {
|
|
3556
3556
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3557
3557
|
return this._def.type._parse({
|
|
@@ -3564,7 +3564,7 @@ class $t extends w {
|
|
|
3564
3564
|
return this._def.type;
|
|
3565
3565
|
}
|
|
3566
3566
|
}
|
|
3567
|
-
class
|
|
3567
|
+
class Ye extends w {
|
|
3568
3568
|
_parse(e) {
|
|
3569
3569
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3570
3570
|
if (s.common.async)
|
|
@@ -3574,7 +3574,7 @@ class Qe extends w {
|
|
|
3574
3574
|
path: s.path,
|
|
3575
3575
|
parent: s
|
|
3576
3576
|
});
|
|
3577
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(),
|
|
3577
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Te(a.value)) : this._def.out._parseAsync({
|
|
3578
3578
|
data: a.value,
|
|
3579
3579
|
path: s.path,
|
|
3580
3580
|
parent: s
|
|
@@ -3597,23 +3597,23 @@ class Qe extends w {
|
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
3599
|
static create(e, t) {
|
|
3600
|
-
return new
|
|
3600
|
+
return new Ye({
|
|
3601
3601
|
in: e,
|
|
3602
3602
|
out: t,
|
|
3603
3603
|
typeName: y.ZodPipeline
|
|
3604
3604
|
});
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
|
-
class
|
|
3607
|
+
class Ke extends w {
|
|
3608
3608
|
_parse(e) {
|
|
3609
3609
|
const t = this._def.innerType._parse(e), s = (n) => (be(n) && (n.value = Object.freeze(n.value)), n);
|
|
3610
|
-
return
|
|
3610
|
+
return Fe(t) ? t.then((n) => s(n)) : s(t);
|
|
3611
3611
|
}
|
|
3612
3612
|
unwrap() {
|
|
3613
3613
|
return this._def.innerType;
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
|
-
|
|
3616
|
+
Ke.create = (r, e) => new Ke(u({
|
|
3617
3617
|
innerType: r,
|
|
3618
3618
|
typeName: y.ZodReadonly
|
|
3619
3619
|
}, b(e)));
|
|
@@ -3622,7 +3622,7 @@ function Kt(r, e) {
|
|
|
3622
3622
|
return typeof t == "string" ? { message: t } : t;
|
|
3623
3623
|
}
|
|
3624
3624
|
function yr(r, e = {}, t) {
|
|
3625
|
-
return r ?
|
|
3625
|
+
return r ? Ce.create().superRefine((s, n) => {
|
|
3626
3626
|
var a, i;
|
|
3627
3627
|
const o = r(s);
|
|
3628
3628
|
if (o instanceof Promise)
|
|
@@ -3637,10 +3637,10 @@ function yr(r, e = {}, t) {
|
|
|
3637
3637
|
const c = Kt(e, s), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3638
3638
|
n.addIssue(g(u({ code: "custom" }, c), { fatal: d }));
|
|
3639
3639
|
}
|
|
3640
|
-
}) :
|
|
3640
|
+
}) : Ce.create();
|
|
3641
3641
|
}
|
|
3642
3642
|
const rn = {
|
|
3643
|
-
object:
|
|
3643
|
+
object: A.lazycreate
|
|
3644
3644
|
};
|
|
3645
3645
|
var y;
|
|
3646
3646
|
(function(r) {
|
|
@@ -3648,10 +3648,10 @@ var y;
|
|
|
3648
3648
|
})(y || (y = {}));
|
|
3649
3649
|
const sn = (r, e = {
|
|
3650
3650
|
message: `Input not instance of ${r.name}`
|
|
3651
|
-
}) => yr((t) => t instanceof r, e), vr = H.create, _r = fe.create, nn = ut.create, an = he.create, br =
|
|
3651
|
+
}) => yr((t) => t instanceof r, e), vr = H.create, _r = fe.create, nn = ut.create, an = he.create, br = Le.create, on = we.create, cn = ot.create, dn = Ve.create, un = De.create, ln = Ce.create, fn = _e.create, hn = oe.create, pn = ct.create, mn = J.create, gn = A.create, yn = A.strictCreate, vn = Ue.create, _n = lt.create, bn = We.create, wn = re.create, xn = ze.create, kn = dt.create, Tn = xe.create, Sn = Se.create, An = Be.create, En = qe.create, Cn = pe.create, On = He.create, In = Oe.create, Xt = G.create, Nn = ee.create, jn = me.create, Rn = G.createWithPreprocess, Zn = Ye.create, Mn = () => vr().optional(), Pn = () => _r().optional(), $n = () => br().optional(), Fn = {
|
|
3652
3652
|
string: (r) => H.create(g(u({}, r), { coerce: !0 })),
|
|
3653
3653
|
number: (r) => fe.create(g(u({}, r), { coerce: !0 })),
|
|
3654
|
-
boolean: (r) =>
|
|
3654
|
+
boolean: (r) => Le.create(g(u({}, r), {
|
|
3655
3655
|
coerce: !0
|
|
3656
3656
|
})),
|
|
3657
3657
|
bigint: (r) => he.create(g(u({}, r), { coerce: !0 })),
|
|
@@ -3659,7 +3659,7 @@ const sn = (r, e = {
|
|
|
3659
3659
|
}, Ln = _;
|
|
3660
3660
|
var T = /* @__PURE__ */ Object.freeze({
|
|
3661
3661
|
__proto__: null,
|
|
3662
|
-
defaultErrorMap:
|
|
3662
|
+
defaultErrorMap: Ee,
|
|
3663
3663
|
setErrorMap: js,
|
|
3664
3664
|
getErrorMap: nt,
|
|
3665
3665
|
makeIssue: at,
|
|
@@ -3667,17 +3667,17 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3667
3667
|
addIssueToContext: h,
|
|
3668
3668
|
ParseStatus: Z,
|
|
3669
3669
|
INVALID: _,
|
|
3670
|
-
DIRTY:
|
|
3670
|
+
DIRTY: Te,
|
|
3671
3671
|
OK: $,
|
|
3672
|
-
isAborted:
|
|
3673
|
-
isDirty:
|
|
3672
|
+
isAborted: Ot,
|
|
3673
|
+
isDirty: It,
|
|
3674
3674
|
isValid: be,
|
|
3675
|
-
isAsync:
|
|
3675
|
+
isAsync: Fe,
|
|
3676
3676
|
get util() {
|
|
3677
3677
|
return x;
|
|
3678
3678
|
},
|
|
3679
3679
|
get objectUtil() {
|
|
3680
|
-
return
|
|
3680
|
+
return Ct;
|
|
3681
3681
|
},
|
|
3682
3682
|
ZodParsedType: p,
|
|
3683
3683
|
getParsedType: ie,
|
|
@@ -3686,41 +3686,41 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3686
3686
|
ZodString: H,
|
|
3687
3687
|
ZodNumber: fe,
|
|
3688
3688
|
ZodBigInt: he,
|
|
3689
|
-
ZodBoolean:
|
|
3689
|
+
ZodBoolean: Le,
|
|
3690
3690
|
ZodDate: we,
|
|
3691
3691
|
ZodSymbol: ot,
|
|
3692
|
-
ZodUndefined:
|
|
3693
|
-
ZodNull:
|
|
3694
|
-
ZodAny:
|
|
3692
|
+
ZodUndefined: Ve,
|
|
3693
|
+
ZodNull: De,
|
|
3694
|
+
ZodAny: Ce,
|
|
3695
3695
|
ZodUnknown: _e,
|
|
3696
|
-
ZodNever:
|
|
3696
|
+
ZodNever: oe,
|
|
3697
3697
|
ZodVoid: ct,
|
|
3698
3698
|
ZodArray: J,
|
|
3699
|
-
ZodObject:
|
|
3700
|
-
ZodUnion:
|
|
3699
|
+
ZodObject: A,
|
|
3700
|
+
ZodUnion: Ue,
|
|
3701
3701
|
ZodDiscriminatedUnion: lt,
|
|
3702
|
-
ZodIntersection:
|
|
3702
|
+
ZodIntersection: We,
|
|
3703
3703
|
ZodTuple: re,
|
|
3704
|
-
ZodRecord:
|
|
3704
|
+
ZodRecord: ze,
|
|
3705
3705
|
ZodMap: dt,
|
|
3706
3706
|
ZodSet: xe,
|
|
3707
|
-
ZodFunction:
|
|
3708
|
-
ZodLazy:
|
|
3709
|
-
ZodLiteral:
|
|
3707
|
+
ZodFunction: Se,
|
|
3708
|
+
ZodLazy: Be,
|
|
3709
|
+
ZodLiteral: qe,
|
|
3710
3710
|
ZodEnum: pe,
|
|
3711
|
-
ZodNativeEnum:
|
|
3711
|
+
ZodNativeEnum: He,
|
|
3712
3712
|
ZodPromise: Oe,
|
|
3713
3713
|
ZodEffects: G,
|
|
3714
3714
|
ZodTransformer: G,
|
|
3715
3715
|
ZodOptional: ee,
|
|
3716
3716
|
ZodNullable: me,
|
|
3717
|
-
ZodDefault:
|
|
3718
|
-
ZodCatch:
|
|
3717
|
+
ZodDefault: Je,
|
|
3718
|
+
ZodCatch: Ge,
|
|
3719
3719
|
ZodNaN: ut,
|
|
3720
3720
|
BRAND: tn,
|
|
3721
|
-
ZodBranded:
|
|
3722
|
-
ZodPipeline:
|
|
3723
|
-
ZodReadonly:
|
|
3721
|
+
ZodBranded: Mt,
|
|
3722
|
+
ZodPipeline: Ye,
|
|
3723
|
+
ZodReadonly: Ke,
|
|
3724
3724
|
custom: yr,
|
|
3725
3725
|
Schema: w,
|
|
3726
3726
|
ZodSchema: w,
|
|
@@ -3740,11 +3740,11 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3740
3740
|
function: Sn,
|
|
3741
3741
|
instanceof: sn,
|
|
3742
3742
|
intersection: bn,
|
|
3743
|
-
lazy:
|
|
3744
|
-
literal:
|
|
3743
|
+
lazy: An,
|
|
3744
|
+
literal: En,
|
|
3745
3745
|
map: kn,
|
|
3746
3746
|
nan: nn,
|
|
3747
|
-
nativeEnum:
|
|
3747
|
+
nativeEnum: On,
|
|
3748
3748
|
never: hn,
|
|
3749
3749
|
null: un,
|
|
3750
3750
|
nullable: jn,
|
|
@@ -3756,7 +3756,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3756
3756
|
ostring: Mn,
|
|
3757
3757
|
pipeline: Zn,
|
|
3758
3758
|
preprocess: Rn,
|
|
3759
|
-
promise:
|
|
3759
|
+
promise: In,
|
|
3760
3760
|
record: xn,
|
|
3761
3761
|
set: Tn,
|
|
3762
3762
|
strictObject: yn,
|
|
@@ -3859,36 +3859,36 @@ const Vn = T.object({
|
|
|
3859
3859
|
reason: "Selected node type is not supported"
|
|
3860
3860
|
};
|
|
3861
3861
|
};
|
|
3862
|
-
var
|
|
3863
|
-
class
|
|
3862
|
+
var O, Xe, le, wr, st;
|
|
3863
|
+
class Qn {
|
|
3864
3864
|
constructor({
|
|
3865
3865
|
auth: e,
|
|
3866
3866
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
3867
3867
|
} = {}) {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3868
|
+
Qe(this, le);
|
|
3869
|
+
Qe(this, O);
|
|
3870
|
+
Qe(this, Xe);
|
|
3871
|
+
pt(this, Xe, t), e && (this.auth = e);
|
|
3872
3872
|
}
|
|
3873
3873
|
hasAuth() {
|
|
3874
|
-
return !!
|
|
3874
|
+
return !!N(this, O);
|
|
3875
3875
|
}
|
|
3876
3876
|
set auth(e) {
|
|
3877
|
-
|
|
3877
|
+
pt(this, O, e);
|
|
3878
3878
|
}
|
|
3879
3879
|
get headers() {
|
|
3880
3880
|
const e = {
|
|
3881
3881
|
"Content-Type": "application/json"
|
|
3882
3882
|
};
|
|
3883
|
-
return
|
|
3883
|
+
return N(this, O) && (e.Authorization = `Bearer ${N(this, O).token}`, "teamId" in N(this, O) && (e["X-Team-Id"] = N(this, O).teamId)), e;
|
|
3884
3884
|
}
|
|
3885
3885
|
generateCode(n) {
|
|
3886
3886
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3887
3887
|
var c;
|
|
3888
3888
|
const a = Dn(e.settings);
|
|
3889
|
-
e.figmaToken && (yield
|
|
3889
|
+
e.figmaToken && (yield Ne(this, le, wr).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, s));
|
|
3890
3890
|
let i = e.tracking;
|
|
3891
|
-
|
|
3891
|
+
N(this, O) && "userId" in N(this, O) && N(this, O).userId && (i != null && i.externalId || (i = { externalId: N(this, O).userId }));
|
|
3892
3892
|
const o = {
|
|
3893
3893
|
tracking: i,
|
|
3894
3894
|
fileKey: e.fileKey,
|
|
@@ -3913,13 +3913,13 @@ class ea {
|
|
|
3913
3913
|
codegenSettings: a.codegenSettings,
|
|
3914
3914
|
webhookUrl: e.webhookUrl
|
|
3915
3915
|
};
|
|
3916
|
-
return
|
|
3916
|
+
return Ne(this, le, st).call(this, "/v1/codegen", o, t, "codegen", s);
|
|
3917
3917
|
});
|
|
3918
3918
|
}
|
|
3919
3919
|
generateCodeFromWebsite(n) {
|
|
3920
3920
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3921
3921
|
let a = e.tracking;
|
|
3922
|
-
|
|
3922
|
+
N(this, O) && "userId" in N(this, O) && N(this, O).userId && (a != null && a.externalId || (a = { externalId: N(this, O).userId }));
|
|
3923
3923
|
const i = {
|
|
3924
3924
|
tracking: a,
|
|
3925
3925
|
assetsStorage: e.assetsStorage,
|
|
@@ -3938,56 +3938,7 @@ class ea {
|
|
|
3938
3938
|
}
|
|
3939
3939
|
}
|
|
3940
3940
|
};
|
|
3941
|
-
return
|
|
3942
|
-
});
|
|
3943
|
-
}
|
|
3944
|
-
/**
|
|
3945
|
-
* Generates code from a text prompt using AI.
|
|
3946
|
-
*
|
|
3947
|
-
* This method sends a prompt to the Anima API and generates code based on the description provided.
|
|
3948
|
-
* It supports real-time streaming of the generation process through Server-Sent Events (SSE).
|
|
3949
|
-
*
|
|
3950
|
-
* @param params - The parameters for code generation
|
|
3951
|
-
* @param params.prompt - The text prompt describing what code to generate
|
|
3952
|
-
* @param params.settings - Code generation settings (framework, language, styling, etc.)
|
|
3953
|
-
* @param params.assetsStorage - Optional asset storage configuration
|
|
3954
|
-
* @param params.tracking - Optional tracking information
|
|
3955
|
-
* @param params.webhookUrl - Optional webhook URL for completion notification
|
|
3956
|
-
* @param handler - Event handler for processing SSE messages during generation
|
|
3957
|
-
* @param signal - Optional AbortSignal to cancel the request
|
|
3958
|
-
* @returns Promise resolving to AnimaSDKResult with generated files and metadata
|
|
3959
|
-
*
|
|
3960
|
-
* @example
|
|
3961
|
-
* ```typescript
|
|
3962
|
-
* const result = await anima.generateCodeFromPrompt({
|
|
3963
|
-
* prompt: "Create a login form with email and password fields",
|
|
3964
|
-
* settings: {
|
|
3965
|
-
* framework: "react",
|
|
3966
|
-
* language: "typescript",
|
|
3967
|
-
* styling: "tailwind"
|
|
3968
|
-
* }
|
|
3969
|
-
* }, {
|
|
3970
|
-
* onStart: ({ sessionId }) => console.log("Started:", sessionId),
|
|
3971
|
-
* onGeneratingCode: ({ progress }) => console.log("Progress:", progress),
|
|
3972
|
-
* onCodegenCompleted: () => console.log("Generation completed!")
|
|
3973
|
-
* });
|
|
3974
|
-
* ```
|
|
3975
|
-
*/
|
|
3976
|
-
generateCodeFromPrompt(n) {
|
|
3977
|
-
return C(this, arguments, function* (e, t = {}, s) {
|
|
3978
|
-
let a = e.tracking;
|
|
3979
|
-
A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
|
|
3980
|
-
const i = {
|
|
3981
|
-
tracking: a,
|
|
3982
|
-
assetsStorage: e.assetsStorage,
|
|
3983
|
-
prompt: e.prompt,
|
|
3984
|
-
language: e.settings.language,
|
|
3985
|
-
framework: e.settings.framework,
|
|
3986
|
-
styling: e.settings.styling,
|
|
3987
|
-
uiLibrary: e.settings.uiLibrary,
|
|
3988
|
-
webhookUrl: e.webhookUrl
|
|
3989
|
-
};
|
|
3990
|
-
return ke(this, oe, Fe).call(this, "/v1/p2c", i, t, "p2c", s);
|
|
3941
|
+
return Ne(this, le, st).call(this, "/v1/l2c", i, t, "l2c", s);
|
|
3991
3942
|
});
|
|
3992
3943
|
}
|
|
3993
3944
|
/**
|
|
@@ -3996,21 +3947,21 @@ class ea {
|
|
|
3996
3947
|
generateLink2Code(n) {
|
|
3997
3948
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3998
3949
|
let a = e.tracking;
|
|
3999
|
-
|
|
3950
|
+
N(this, O) && "userId" in N(this, O) && N(this, O).userId && (a != null && a.externalId || (a = { externalId: N(this, O).userId }));
|
|
4000
3951
|
const i = {
|
|
4001
3952
|
tracking: a,
|
|
4002
3953
|
assetsStorage: e.assetsStorage,
|
|
4003
3954
|
params: e.params
|
|
4004
3955
|
};
|
|
4005
|
-
return
|
|
3956
|
+
return Ne(this, le, st).call(this, "/v1/l2c", i, t, "l2c", s);
|
|
4006
3957
|
});
|
|
4007
3958
|
}
|
|
4008
3959
|
}
|
|
4009
|
-
|
|
3960
|
+
O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s, n, a) {
|
|
4010
3961
|
return C(this, null, function* () {
|
|
4011
3962
|
let i;
|
|
4012
3963
|
try {
|
|
4013
|
-
i = yield
|
|
3964
|
+
i = yield Is({
|
|
4014
3965
|
fileKey: e,
|
|
4015
3966
|
authToken: t,
|
|
4016
3967
|
params: {
|
|
@@ -4029,17 +3980,17 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4029
3980
|
(d) => !d.isValid
|
|
4030
3981
|
);
|
|
4031
3982
|
if (c)
|
|
4032
|
-
throw new
|
|
3983
|
+
throw new de({
|
|
4033
3984
|
name: "Task Crashed",
|
|
4034
3985
|
reason: c.reason
|
|
4035
3986
|
});
|
|
4036
3987
|
});
|
|
4037
|
-
},
|
|
3988
|
+
}, st = function(e, t, s, n, a) {
|
|
4038
3989
|
return C(this, null, function* () {
|
|
4039
|
-
var v, j, M, F, z, se, ge,
|
|
3990
|
+
var v, j, M, F, z, se, ge, ce, V;
|
|
4040
3991
|
if (this.hasAuth() === !1)
|
|
4041
3992
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
4042
|
-
const i = {}, o = yield fetch(`${
|
|
3993
|
+
const i = {}, o = yield fetch(`${N(this, Xe)}${e}`, {
|
|
4043
3994
|
method: "POST",
|
|
4044
3995
|
headers: g(u({}, this.headers), {
|
|
4045
3996
|
Accept: "text/event-stream"
|
|
@@ -4052,25 +4003,25 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4052
4003
|
let q;
|
|
4053
4004
|
try {
|
|
4054
4005
|
q = JSON.parse(K);
|
|
4055
|
-
} catch (
|
|
4006
|
+
} catch (Ie) {
|
|
4056
4007
|
}
|
|
4057
|
-
throw ((v = q == null ? void 0 : q.error) == null ? void 0 : v.name) === "ZodError" ? new
|
|
4008
|
+
throw ((v = q == null ? void 0 : q.error) == null ? void 0 : v.name) === "ZodError" ? new de({
|
|
4058
4009
|
name: "HTTP error from Anima API",
|
|
4059
4010
|
reason: "Invalid body payload",
|
|
4060
4011
|
detail: q.error.issues,
|
|
4061
4012
|
status: o.status
|
|
4062
|
-
}) : typeof q == "object" ? new
|
|
4013
|
+
}) : typeof q == "object" ? new de({
|
|
4063
4014
|
name: `Error "${q}"`,
|
|
4064
4015
|
reason: "Unknown",
|
|
4065
4016
|
status: o.status
|
|
4066
|
-
}) : new
|
|
4017
|
+
}) : new de({
|
|
4067
4018
|
name: "HTTP error from Anima API",
|
|
4068
4019
|
reason: K,
|
|
4069
4020
|
status: o.status
|
|
4070
4021
|
});
|
|
4071
4022
|
}
|
|
4072
4023
|
if (!o.body)
|
|
4073
|
-
throw new
|
|
4024
|
+
throw new de({
|
|
4074
4025
|
name: "Stream Error",
|
|
4075
4026
|
reason: "Response body is null",
|
|
4076
4027
|
status: o.status
|
|
@@ -4083,15 +4034,15 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4083
4034
|
if (K)
|
|
4084
4035
|
break;
|
|
4085
4036
|
f += d.decode(q, { stream: !0 });
|
|
4086
|
-
const
|
|
4037
|
+
const Ie = f.split(`
|
|
4087
4038
|
`);
|
|
4088
|
-
f =
|
|
4089
|
-
for (const
|
|
4090
|
-
if (!(!
|
|
4039
|
+
f = Ie.pop() || "";
|
|
4040
|
+
for (const E of Ie)
|
|
4041
|
+
if (!(!E.trim() || E.startsWith(":")) && E.startsWith("data: ")) {
|
|
4091
4042
|
let k;
|
|
4092
4043
|
try {
|
|
4093
|
-
k = JSON.parse(
|
|
4094
|
-
} catch (
|
|
4044
|
+
k = JSON.parse(E.slice(6));
|
|
4045
|
+
} catch (ft) {
|
|
4095
4046
|
continue;
|
|
4096
4047
|
}
|
|
4097
4048
|
switch (k.type) {
|
|
@@ -4125,7 +4076,7 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4125
4076
|
break;
|
|
4126
4077
|
}
|
|
4127
4078
|
case "generating_code": {
|
|
4128
|
-
k.payload.status === "success" && (i.files = k.payload.files), typeof s == "function" ? s(k) : (
|
|
4079
|
+
k.payload.status === "success" && (i.files = k.payload.files), typeof s == "function" ? s(k) : (ce = s.onGeneratingCode) == null || ce.call(s, {
|
|
4129
4080
|
status: k.payload.status,
|
|
4130
4081
|
progress: k.payload.progress,
|
|
4131
4082
|
files: k.payload.files
|
|
@@ -4138,13 +4089,13 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4138
4089
|
break;
|
|
4139
4090
|
}
|
|
4140
4091
|
case "error":
|
|
4141
|
-
throw new
|
|
4092
|
+
throw new de({
|
|
4142
4093
|
name: k.payload.errorName,
|
|
4143
4094
|
reason: k.payload.reason
|
|
4144
4095
|
});
|
|
4145
4096
|
case "done": {
|
|
4146
4097
|
if (!i.files)
|
|
4147
|
-
throw new
|
|
4098
|
+
throw new de({
|
|
4148
4099
|
name: "Invalid response",
|
|
4149
4100
|
reason: "No code generated"
|
|
4150
4101
|
});
|
|
@@ -4156,14 +4107,14 @@ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s
|
|
|
4156
4107
|
} finally {
|
|
4157
4108
|
c.cancel();
|
|
4158
4109
|
}
|
|
4159
|
-
throw new
|
|
4110
|
+
throw new de({
|
|
4160
4111
|
name: "Connection",
|
|
4161
4112
|
reason: "Connection closed before the 'done' message",
|
|
4162
4113
|
status: 500
|
|
4163
4114
|
});
|
|
4164
4115
|
});
|
|
4165
4116
|
};
|
|
4166
|
-
const
|
|
4117
|
+
const ea = (r) => {
|
|
4167
4118
|
var e;
|
|
4168
4119
|
if (!r)
|
|
4169
4120
|
return [!1, "", ""];
|
|
@@ -4179,7 +4130,7 @@ const ta = (r) => {
|
|
|
4179
4130
|
} catch (t) {
|
|
4180
4131
|
return [!1, "", ""];
|
|
4181
4132
|
}
|
|
4182
|
-
},
|
|
4133
|
+
}, ta = ({
|
|
4183
4134
|
fileKey: r,
|
|
4184
4135
|
nodeId: e,
|
|
4185
4136
|
duplicate: t
|
|
@@ -4187,12 +4138,12 @@ const ta = (r) => {
|
|
|
4187
4138
|
const s = new URL("https://www.figma.com");
|
|
4188
4139
|
return s.pathname = `design/${r}`, t && (s.pathname = `${s.pathname}/dummy/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
|
|
4189
4140
|
};
|
|
4190
|
-
class
|
|
4141
|
+
class ra extends Error {
|
|
4191
4142
|
constructor(e, t) {
|
|
4192
4143
|
super(e), this.response = t;
|
|
4193
4144
|
}
|
|
4194
4145
|
}
|
|
4195
|
-
const
|
|
4146
|
+
const sa = ({
|
|
4196
4147
|
files: r,
|
|
4197
4148
|
screenPath: e = "src/screens"
|
|
4198
4149
|
}) => {
|
|
@@ -4241,7 +4192,7 @@ function zn(r, e) {
|
|
|
4241
4192
|
function Bn(r, e) {
|
|
4242
4193
|
return Object.keys(r).filter((t) => t.startsWith(e));
|
|
4243
4194
|
}
|
|
4244
|
-
function
|
|
4195
|
+
function Pt(r, e, t) {
|
|
4245
4196
|
return new ReadableStream({
|
|
4246
4197
|
start(s) {
|
|
4247
4198
|
t.call(r, e, (n) => {
|
|
@@ -4269,12 +4220,12 @@ function ft(r, e, t) {
|
|
|
4269
4220
|
}
|
|
4270
4221
|
});
|
|
4271
4222
|
}
|
|
4272
|
-
const qn = (r, e) =>
|
|
4223
|
+
const qn = (r, e) => Pt(
|
|
4273
4224
|
r,
|
|
4274
4225
|
e,
|
|
4275
4226
|
r.generateCode
|
|
4276
4227
|
);
|
|
4277
|
-
function
|
|
4228
|
+
function $t(r) {
|
|
4278
4229
|
return C(this, null, function* () {
|
|
4279
4230
|
var i, o, c, d;
|
|
4280
4231
|
const [e, t] = r.tee(), s = yield e.getReader().read();
|
|
@@ -4308,61 +4259,52 @@ data: ${JSON.stringify(
|
|
|
4308
4259
|
});
|
|
4309
4260
|
});
|
|
4310
4261
|
}
|
|
4311
|
-
const
|
|
4262
|
+
const na = (r, e) => C(void 0, null, function* () {
|
|
4312
4263
|
const t = qn(r, e);
|
|
4313
|
-
return
|
|
4314
|
-
}), Hn = (r, e) =>
|
|
4264
|
+
return $t(t);
|
|
4265
|
+
}), Hn = (r, e) => Pt(
|
|
4315
4266
|
r,
|
|
4316
4267
|
e,
|
|
4317
4268
|
r.generateCodeFromWebsite
|
|
4318
|
-
),
|
|
4269
|
+
), aa = (r, e) => C(void 0, null, function* () {
|
|
4319
4270
|
const t = Hn(r, e);
|
|
4320
|
-
return
|
|
4321
|
-
}), Jn = (r, e) =>
|
|
4322
|
-
r,
|
|
4323
|
-
e,
|
|
4324
|
-
r.generateCodeFromPrompt
|
|
4325
|
-
), oa = (r, e) => C(void 0, null, function* () {
|
|
4326
|
-
const t = Jn(r, e);
|
|
4327
|
-
return ht(t);
|
|
4328
|
-
}), Gn = (r, e) => ft(
|
|
4271
|
+
return $t(t);
|
|
4272
|
+
}), Jn = (r, e) => Pt(
|
|
4329
4273
|
r,
|
|
4330
4274
|
e,
|
|
4331
4275
|
r.generateLink2Code
|
|
4332
|
-
),
|
|
4333
|
-
const t =
|
|
4334
|
-
return
|
|
4276
|
+
), ia = (r, e) => C(void 0, null, function* () {
|
|
4277
|
+
const t = Jn(r, e);
|
|
4278
|
+
return $t(t);
|
|
4335
4279
|
});
|
|
4336
4280
|
export {
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4281
|
+
Qn as Anima,
|
|
4282
|
+
de as CodegenError,
|
|
4283
|
+
Er as FigmaTokenIssue,
|
|
4284
|
+
Ir as NotFound,
|
|
4341
4285
|
Cr as RateLimitExceeded,
|
|
4342
|
-
|
|
4343
|
-
|
|
4286
|
+
Or as RequestTooLarge,
|
|
4287
|
+
ra as ResponseError,
|
|
4344
4288
|
jr as UnknownFigmaApiException,
|
|
4345
|
-
|
|
4346
|
-
Jn as createCodeFromPromptStream,
|
|
4347
|
-
ia as createCodeFromWebsiteResponseEventStream,
|
|
4289
|
+
aa as createCodeFromWebsiteResponseEventStream,
|
|
4348
4290
|
Hn as createCodeFromWebsiteStream,
|
|
4349
|
-
|
|
4291
|
+
na as createCodegenResponseEventStream,
|
|
4350
4292
|
qn as createCodegenStream,
|
|
4351
|
-
|
|
4352
|
-
|
|
4293
|
+
ia as createLink2CodeResponseEventStream,
|
|
4294
|
+
Jn as createLink2CodeStream,
|
|
4353
4295
|
ur as findChildrenNode,
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4296
|
+
ta as formatToFigmaLink,
|
|
4297
|
+
Xn as getFigmaApiErrorType,
|
|
4298
|
+
Is as getFigmaFile,
|
|
4299
|
+
Yn as getFileNodes,
|
|
4300
|
+
sa as getRelatedScreenFiles,
|
|
4359
4301
|
Zr as isFigmaTokenIssue,
|
|
4360
4302
|
Un as isNodeCodegenCompatible,
|
|
4361
4303
|
Nr as isNotFound,
|
|
4362
4304
|
Rr as isRateLimitExceeded,
|
|
4363
4305
|
Mr as isRequestTooLarge,
|
|
4364
|
-
|
|
4365
|
-
|
|
4306
|
+
Kn as isUnknownFigmaApiException,
|
|
4307
|
+
ea as isValidFigmaUrl,
|
|
4366
4308
|
Dn as validateSettings,
|
|
4367
4309
|
nr as wrapFigmaApiError
|
|
4368
4310
|
};
|