@animaapp/anima-sdk-react 0.6.10 → 0.6.12-beta.0
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.js +240 -239
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var Ks = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
da.call(e, n) && Ks(t, n, e[n]);
|
|
11
11
|
return t;
|
|
12
12
|
}, Bs = (t, e) => oa(t, ca(e));
|
|
13
|
-
var
|
|
13
|
+
var je = (t, e, n) => new Promise((s, r) => {
|
|
14
14
|
var a = (c) => {
|
|
15
15
|
try {
|
|
16
16
|
o(n.next(c));
|
|
@@ -83,10 +83,10 @@ class Ta extends Error {
|
|
|
83
83
|
super(Oa), this.fileKey = e, this.cause = n;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
class
|
|
86
|
+
const Aa = "Request Too Large";
|
|
87
|
+
class Ca extends Error {
|
|
88
88
|
constructor({ fileKey: e, cause: n }) {
|
|
89
|
-
super(
|
|
89
|
+
super(Aa), this.fileKey = e, this.cause = n;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
const Na = "Not Found";
|
|
@@ -96,12 +96,12 @@ class Ra extends Error {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
const Pa = "Unknown Figma API Exception";
|
|
99
|
-
class
|
|
99
|
+
class ja extends Error {
|
|
100
100
|
constructor({ fileKey: e, cause: n }) {
|
|
101
101
|
super(Pa), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = n;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const Ia = (t, e) => {
|
|
105
105
|
var n;
|
|
106
106
|
if (((n = t == null ? void 0 : t.cause) == null ? void 0 : n.message) === "Fetch Error") {
|
|
107
107
|
const { err: s, status: r } = t.cause.body;
|
|
@@ -116,9 +116,9 @@ const ja = (t, e) => {
|
|
|
116
116
|
if (r === 404)
|
|
117
117
|
return new Ra({ fileKey: e, cause: t });
|
|
118
118
|
if (r === 400 && s.includes("Request too large"))
|
|
119
|
-
return new
|
|
119
|
+
return new Ca({ fileKey: e, cause: t });
|
|
120
120
|
}
|
|
121
|
-
return new
|
|
121
|
+
return new ja({ fileKey: e, cause: t });
|
|
122
122
|
};
|
|
123
123
|
var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwnPropertyDescriptors, Js = Object.getOwnPropertySymbols, La = Object.prototype.hasOwnProperty, $a = Object.prototype.propertyIsEnumerable, Xs = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), Tr = (t) => {
|
|
124
124
|
throw TypeError(t);
|
|
@@ -129,7 +129,7 @@ var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwn
|
|
|
129
129
|
for (var n of Js(e))
|
|
130
130
|
$a.call(e, n) && Ys(t, n, e[n]);
|
|
131
131
|
return t;
|
|
132
|
-
}, Ts = (t, e) => Da(t, Ma(e)),
|
|
132
|
+
}, Ts = (t, e) => Da(t, Ma(e)), As = (t, e, n) => e.has(t) || Tr("Cannot " + n), Z = (t, e, n) => (As(t, e, "read from private field"), n ? n.call(t) : e.get(t)), de = (t, e, n) => e.has(t) ? Tr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), J = (t, e, n, s) => (As(t, e, "write to private field"), e.set(t, n), n), _e = (t, e, n) => (As(t, e, "access private method"), n), B = (t, e, n) => new Promise((s, r) => {
|
|
133
133
|
var a = (c) => {
|
|
134
134
|
try {
|
|
135
135
|
o(n.next(c));
|
|
@@ -154,49 +154,49 @@ function za() {
|
|
|
154
154
|
(function(n, s) {
|
|
155
155
|
t.exports = s();
|
|
156
156
|
})(Va, function() {
|
|
157
|
-
var n = typeof Promise == "function", s = typeof self == "object" ? self : Wa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", g = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), _ = h && typeof Array.prototype[Symbol.iterator] == "function", l = _ && Object.getPrototypeOf([][Symbol.iterator]()),
|
|
158
|
-
function z(
|
|
159
|
-
var P = typeof
|
|
157
|
+
var n = typeof Promise == "function", s = typeof self == "object" ? self : Wa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", g = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), _ = h && typeof Array.prototype[Symbol.iterator] == "function", l = _ && Object.getPrototypeOf([][Symbol.iterator]()), C = h && typeof String.prototype[Symbol.iterator] == "function", j = C && Object.getPrototypeOf(""[Symbol.iterator]()), V = 8, M = -1;
|
|
158
|
+
function z(D) {
|
|
159
|
+
var P = typeof D;
|
|
160
160
|
if (P !== "object")
|
|
161
161
|
return P;
|
|
162
|
-
if (
|
|
162
|
+
if (D === null)
|
|
163
163
|
return "null";
|
|
164
|
-
if (
|
|
164
|
+
if (D === s)
|
|
165
165
|
return "global";
|
|
166
|
-
if (Array.isArray(
|
|
166
|
+
if (Array.isArray(D) && (p === !1 || !(Symbol.toStringTag in D)))
|
|
167
167
|
return "Array";
|
|
168
168
|
if (typeof window == "object" && window !== null) {
|
|
169
|
-
if (typeof window.location == "object" &&
|
|
169
|
+
if (typeof window.location == "object" && D === window.location)
|
|
170
170
|
return "Location";
|
|
171
|
-
if (typeof window.document == "object" &&
|
|
171
|
+
if (typeof window.document == "object" && D === window.document)
|
|
172
172
|
return "Document";
|
|
173
173
|
if (typeof window.navigator == "object") {
|
|
174
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
174
|
+
if (typeof window.navigator.mimeTypes == "object" && D === window.navigator.mimeTypes)
|
|
175
175
|
return "MimeTypeArray";
|
|
176
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
176
|
+
if (typeof window.navigator.plugins == "object" && D === window.navigator.plugins)
|
|
177
177
|
return "PluginArray";
|
|
178
178
|
}
|
|
179
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
180
|
-
if (
|
|
179
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && D instanceof window.HTMLElement) {
|
|
180
|
+
if (D.tagName === "BLOCKQUOTE")
|
|
181
181
|
return "HTMLQuoteElement";
|
|
182
|
-
if (
|
|
182
|
+
if (D.tagName === "TD")
|
|
183
183
|
return "HTMLTableDataCellElement";
|
|
184
|
-
if (
|
|
184
|
+
if (D.tagName === "TH")
|
|
185
185
|
return "HTMLTableHeaderCellElement";
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
var Se = p &&
|
|
188
|
+
var Se = p && D[Symbol.toStringTag];
|
|
189
189
|
if (typeof Se == "string")
|
|
190
190
|
return Se;
|
|
191
|
-
var F = Object.getPrototypeOf(
|
|
192
|
-
return F === RegExp.prototype ? "RegExp" : F === Date.prototype ? "Date" : n && F === Promise.prototype ? "Promise" : i && F === Set.prototype ? "Set" : a && F === Map.prototype ? "Map" : c && F === WeakSet.prototype ? "WeakSet" : o && F === WeakMap.prototype ? "WeakMap" : u && F === DataView.prototype ? "DataView" : a && F === m ? "Map Iterator" : i && F === b ? "Set Iterator" : _ && F === l ? "Array Iterator" :
|
|
191
|
+
var F = Object.getPrototypeOf(D);
|
|
192
|
+
return F === RegExp.prototype ? "RegExp" : F === Date.prototype ? "Date" : n && F === Promise.prototype ? "Promise" : i && F === Set.prototype ? "Set" : a && F === Map.prototype ? "Map" : c && F === WeakSet.prototype ? "WeakSet" : o && F === WeakMap.prototype ? "WeakMap" : u && F === DataView.prototype ? "DataView" : a && F === m ? "Map Iterator" : i && F === b ? "Set Iterator" : _ && F === l ? "Array Iterator" : C && F === j ? "String Iterator" : F === null ? "Object" : Object.prototype.toString.call(D).slice(V, M);
|
|
193
193
|
}
|
|
194
194
|
return z;
|
|
195
195
|
});
|
|
196
196
|
}(Bn)), Bn.exports;
|
|
197
197
|
}
|
|
198
198
|
var Ka = za();
|
|
199
|
-
const Ba = /* @__PURE__ */ Ua(Ka),
|
|
199
|
+
const Ba = /* @__PURE__ */ Ua(Ka), Cs = typeof Buffer != "undefined", qa = Cs && typeof Buffer.from != "undefined", Ha = Cs ? (
|
|
200
200
|
/**
|
|
201
201
|
* is value is Buffer?
|
|
202
202
|
*
|
|
@@ -227,7 +227,7 @@ const Ba = /* @__PURE__ */ Ua(Ka), As = typeof Buffer != "undefined", qa = As &&
|
|
|
227
227
|
function(t) {
|
|
228
228
|
return Buffer.from(t);
|
|
229
229
|
}
|
|
230
|
-
) :
|
|
230
|
+
) : Cs ? (
|
|
231
231
|
/**
|
|
232
232
|
* copy Buffer
|
|
233
233
|
*
|
|
@@ -318,7 +318,7 @@ function oi(t) {
|
|
|
318
318
|
function ci(t) {
|
|
319
319
|
return new String(t);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ae(t, e) {
|
|
322
322
|
return Rn[e].from ? Rn[e].from(t) : new Rn[e](t);
|
|
323
323
|
}
|
|
324
324
|
function Q(t) {
|
|
@@ -348,15 +348,15 @@ const fi = /* @__PURE__ */ new Map([
|
|
|
348
348
|
["String", ci],
|
|
349
349
|
// typed arrays
|
|
350
350
|
// TODO: pass bound function
|
|
351
|
-
["Float32Array",
|
|
352
|
-
["Float64Array",
|
|
353
|
-
["Int16Array",
|
|
354
|
-
["Int32Array",
|
|
355
|
-
["Int8Array",
|
|
356
|
-
["Uint16Array",
|
|
357
|
-
["Uint32Array",
|
|
358
|
-
["Uint8Array",
|
|
359
|
-
["Uint8ClampedArray",
|
|
351
|
+
["Float32Array", Ae],
|
|
352
|
+
["Float64Array", Ae],
|
|
353
|
+
["Int16Array", Ae],
|
|
354
|
+
["Int32Array", Ae],
|
|
355
|
+
["Int8Array", Ae],
|
|
356
|
+
["Uint16Array", Ae],
|
|
357
|
+
["Uint32Array", Ae],
|
|
358
|
+
["Uint8Array", Ae],
|
|
359
|
+
["Uint8ClampedArray", Ae],
|
|
360
360
|
// shallow copy
|
|
361
361
|
["Array Iterator", Q],
|
|
362
362
|
["Map Iterator", Q],
|
|
@@ -460,7 +460,7 @@ function Gn(t, e, n, s, r) {
|
|
|
460
460
|
return e;
|
|
461
461
|
}
|
|
462
462
|
const pi = (t) => new Promise((e) => setTimeout(e, t));
|
|
463
|
-
var an, He, on, Jn,
|
|
463
|
+
var an, He, on, Jn, Ar;
|
|
464
464
|
class mi {
|
|
465
465
|
constructor({ maxAttempts: e = 3, func: n }) {
|
|
466
466
|
de(this, Jn), de(this, an), de(this, He), de(this, on), J(this, an, e), J(this, on, n), J(this, He, 0);
|
|
@@ -468,18 +468,18 @@ class mi {
|
|
|
468
468
|
run() {
|
|
469
469
|
return B(this, null, function* () {
|
|
470
470
|
try {
|
|
471
|
-
return yield
|
|
471
|
+
return yield Z(this, on).call(this);
|
|
472
472
|
} catch (e) {
|
|
473
|
-
if (J(this, He,
|
|
473
|
+
if (J(this, He, Z(this, He) + 1), Z(this, He) > Z(this, an))
|
|
474
474
|
throw console.error("Max attempts reached"), e;
|
|
475
|
-
const n = _e(this, Jn,
|
|
475
|
+
const n = _e(this, Jn, Ar).call(this);
|
|
476
476
|
return yield pi(n), yield this.run();
|
|
477
477
|
}
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
an = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(),
|
|
482
|
-
return
|
|
481
|
+
an = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(), Ar = function() {
|
|
482
|
+
return Z(this, He) * 1e3 * 1.5;
|
|
483
483
|
};
|
|
484
484
|
function yi() {
|
|
485
485
|
return typeof CompressionStream != "undefined";
|
|
@@ -560,7 +560,7 @@ class Pn extends Error {
|
|
|
560
560
|
super(e), this.name = "Request Validation Error";
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Cr() {
|
|
564
564
|
return Array.from(
|
|
565
565
|
{ length: 32 },
|
|
566
566
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -591,31 +591,31 @@ class Ei {
|
|
|
591
591
|
return B(this, arguments, function* (n, s = {}) {
|
|
592
592
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
593
593
|
let o = a != null ? a : this.headers;
|
|
594
|
-
const c = kt(
|
|
595
|
-
return J(this, ne, {}), c.extraHeaders && (o = ae(ae({}, o), c.extraHeaders)), c.requestValidation && (o = Ts(ae({}, o), { "X-Request-Nonce":
|
|
594
|
+
const c = kt(Z(this, ne));
|
|
595
|
+
return J(this, ne, {}), c.extraHeaders && (o = ae(ae({}, o), c.extraHeaders)), c.requestValidation && (o = Ts(ae({}, o), { "X-Request-Nonce": Cr(), "X-Request-Timestamp": Xn() })), c.async ? yield _e(this, ge, Qn).call(this, `${i}${n}`, c.async, { headers: o }) : yield _e(this, ge, Yn).call(this, `${i}${n}`, c, { headers: o });
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
post(e, n) {
|
|
599
599
|
return B(this, arguments, function* (s, r, a = {}) {
|
|
600
|
-
const i = kt(
|
|
600
|
+
const i = kt(Z(this, ne));
|
|
601
601
|
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "POST", r, a, i);
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
put(e, n) {
|
|
605
605
|
return B(this, arguments, function* (s, r, a = {}) {
|
|
606
|
-
const i = kt(
|
|
606
|
+
const i = kt(Z(this, ne));
|
|
607
607
|
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "PUT", r, a, i);
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
delete(e, n) {
|
|
611
611
|
return B(this, arguments, function* (s, r, a = {}) {
|
|
612
|
-
const i = kt(
|
|
612
|
+
const i = kt(Z(this, ne));
|
|
613
613
|
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "DELETE", r, a, i);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
patch(e, n) {
|
|
617
617
|
return B(this, arguments, function* (s, r, a = {}) {
|
|
618
|
-
const i = kt(
|
|
618
|
+
const i = kt(Z(this, ne));
|
|
619
619
|
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "PATCH", r, a, i);
|
|
620
620
|
});
|
|
621
621
|
}
|
|
@@ -625,7 +625,7 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
625
625
|
const s = () => B(this, null, function* () {
|
|
626
626
|
var c, u;
|
|
627
627
|
try {
|
|
628
|
-
return yield
|
|
628
|
+
return yield Z(this, Ge).call(this, t, ae(ae({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
629
629
|
} catch (h) {
|
|
630
630
|
throw h instanceof Error && h.name === "AbortError" ? new Et({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
|
|
631
631
|
}
|
|
@@ -685,7 +685,7 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
685
685
|
} = e, u = `${t}/async`, h = `${t}/async/job`;
|
|
686
686
|
let p;
|
|
687
687
|
try {
|
|
688
|
-
p = yield
|
|
688
|
+
p = yield Z(this, Ge).call(this, u, ae(ae({}, n), i && { signal: i }));
|
|
689
689
|
} catch (b) {
|
|
690
690
|
throw b instanceof Error && b.name === "AbortError" ? new Et({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : b;
|
|
691
691
|
}
|
|
@@ -706,30 +706,30 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
706
706
|
return new Promise((b, m) => B(this, null, function* () {
|
|
707
707
|
const _ = setTimeout(() => {
|
|
708
708
|
m(new Error("Job timed out"));
|
|
709
|
-
}, c), l = (
|
|
709
|
+
}, c), l = (C = 0) => B(this, null, function* () {
|
|
710
710
|
if (i != null && i.aborted) {
|
|
711
|
-
clearTimeout(_),
|
|
711
|
+
clearTimeout(_), Z(this, Ge).call(this, `${h}/${g}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
712
712
|
m(new Et({ canceled: !0 }));
|
|
713
|
-
}).catch((
|
|
713
|
+
}).catch((j) => {
|
|
714
714
|
m(new Et({ canceled: !1 }));
|
|
715
715
|
});
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
try {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
719
|
+
const j = yield (yield Z(this, Ge).call(this, `${h}/${g}`, { headers: this.headers })).json();
|
|
720
|
+
if (j.status === "success") {
|
|
721
721
|
clearTimeout(_);
|
|
722
|
-
const V =
|
|
722
|
+
const V = j.response_json;
|
|
723
723
|
b(V);
|
|
724
|
-
} else if (
|
|
725
|
-
clearTimeout(_), m(new bi(
|
|
724
|
+
} else if (j.status === "failed")
|
|
725
|
+
clearTimeout(_), m(new bi(j.response_json));
|
|
726
726
|
else {
|
|
727
|
-
a && a(
|
|
728
|
-
const V = o(
|
|
729
|
-
setTimeout(() => l(
|
|
727
|
+
a && a(j.response_json);
|
|
728
|
+
const V = o(C);
|
|
729
|
+
setTimeout(() => l(C + 1), V);
|
|
730
730
|
}
|
|
731
|
-
} catch (
|
|
732
|
-
m(
|
|
731
|
+
} catch (j) {
|
|
732
|
+
m(j);
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
l();
|
|
@@ -739,7 +739,7 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
739
739
|
return B(this, null, function* () {
|
|
740
740
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
741
741
|
let c = i != null ? i : this.headers;
|
|
742
|
-
r.extraHeaders && (c = ae(ae({}, c), r.extraHeaders)), r.requestValidation && (c = Ts(ae({}, c), { "X-Request-Nonce":
|
|
742
|
+
r.extraHeaders && (c = ae(ae({}, c), r.extraHeaders)), r.requestValidation && (c = Ts(ae({}, c), { "X-Request-Nonce": Cr(), "X-Request-Timestamp": Xn() }));
|
|
743
743
|
let u = n;
|
|
744
744
|
return typeof FormData != "undefined" && n instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? n : JSON.stringify(n), r.compress && yi() && (c["Content-Encoding"] = "gzip", u = yield gi(u))), r.async ? yield _e(this, ge, Qn).call(this, `${o}${t}`, r.async, {
|
|
745
745
|
method: e,
|
|
@@ -748,7 +748,7 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
748
748
|
}) : yield _e(this, ge, Yn).call(this, `${o}${t}`, r, { method: e, headers: c, body: u });
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
|
-
const sr = (t, e, n, s) => t instanceof Et ? t : new _i({ resource: e, api: String(n), args: s, cause: t }),
|
|
751
|
+
const sr = (t, e, n, s) => t instanceof Et ? t : new _i({ resource: e, api: String(n), args: s, cause: t }), jn = (t, e) => new Proxy(e, {
|
|
752
752
|
get(n, s) {
|
|
753
753
|
return (...r) => {
|
|
754
754
|
var a;
|
|
@@ -779,14 +779,14 @@ class xi {
|
|
|
779
779
|
const r = new URLSearchParams(ae({
|
|
780
780
|
plugin_data: "857346721138427857"
|
|
781
781
|
}, s)).toString(), a = `v1/files/${n}?${r}`;
|
|
782
|
-
return yield
|
|
782
|
+
return yield Z(this, St).get(a);
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
getImageFills(e) {
|
|
786
786
|
return B(this, arguments, function* ({ fileKey: n }) {
|
|
787
787
|
var s, r;
|
|
788
788
|
const a = `v1/files/${n}/images`;
|
|
789
|
-
return (r = (s = (yield
|
|
789
|
+
return (r = (s = (yield Z(this, St).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
}
|
|
@@ -806,36 +806,36 @@ class Ti {
|
|
|
806
806
|
*/
|
|
807
807
|
get(e) {
|
|
808
808
|
return B(this, arguments, function* ({ fileKey: n, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
809
|
-
const i = Si(n, s, r), o =
|
|
809
|
+
const i = Si(n, s, r), o = Z(this, ve).cache.images.entries.get(i);
|
|
810
810
|
if (Oi(o))
|
|
811
811
|
return o.result;
|
|
812
|
-
o &&
|
|
813
|
-
const c =
|
|
812
|
+
o && Z(this, ve).cache.images.entries.delete(i);
|
|
813
|
+
const c = Z(this, ve).cache.images.pendingRequests.get(i);
|
|
814
814
|
if (c)
|
|
815
815
|
return c;
|
|
816
816
|
const u = _e(this, es, Nr).call(this, i, n, s, r, a);
|
|
817
|
-
|
|
817
|
+
Z(this, ve).cache.images.pendingRequests.set(i, u);
|
|
818
818
|
try {
|
|
819
819
|
return yield u;
|
|
820
820
|
} finally {
|
|
821
|
-
|
|
821
|
+
Z(this, ve).cache.images.pendingRequests.delete(i);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
ve = /* @__PURE__ */ new WeakMap(), es = /* @__PURE__ */ new WeakSet(), Nr = function(t, e, n, s, r) {
|
|
827
827
|
return B(this, null, function* () {
|
|
828
|
-
const a = yield
|
|
828
|
+
const a = yield Z(this, ve).get(
|
|
829
829
|
`v1/images/${e}?ids=${n}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
830
830
|
);
|
|
831
|
-
return
|
|
831
|
+
return Z(this, ve).cache.images.entries.set(t, {
|
|
832
832
|
result: a,
|
|
833
833
|
ts: Date.now()
|
|
834
834
|
}), a;
|
|
835
835
|
});
|
|
836
836
|
};
|
|
837
837
|
var cn;
|
|
838
|
-
class
|
|
838
|
+
class Ai {
|
|
839
839
|
constructor(e) {
|
|
840
840
|
de(this, cn), this.resourceName = "Nodes", J(this, cn, e);
|
|
841
841
|
}
|
|
@@ -846,44 +846,44 @@ class Ci {
|
|
|
846
846
|
}), i = new URLSearchParams(ae({
|
|
847
847
|
plugin_data: "857346721138427857"
|
|
848
848
|
}, a)).toString(), o = `v1/files/${n}/nodes?${i}`;
|
|
849
|
-
return yield
|
|
849
|
+
return yield Z(this, cn).get(o);
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
cn = /* @__PURE__ */ new WeakMap();
|
|
854
|
-
var
|
|
855
|
-
class
|
|
854
|
+
var Ie;
|
|
855
|
+
class Ci extends Ei {
|
|
856
856
|
constructor({
|
|
857
857
|
baseAddress: e = "https://api.figma.com/",
|
|
858
858
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
859
859
|
} = {}) {
|
|
860
|
-
super({ fetch: n, baseAddress: e }), de(this,
|
|
860
|
+
super({ fetch: n, baseAddress: e }), de(this, Ie, ""), this.cache = {
|
|
861
861
|
images: {
|
|
862
862
|
entries: /* @__PURE__ */ new Map(),
|
|
863
863
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
864
864
|
}
|
|
865
|
-
}, this.files =
|
|
865
|
+
}, this.files = jn(this, new xi(this)), this.nodes = jn(this, new Ai(this)), this.images = jn(this, new Ti(this));
|
|
866
866
|
}
|
|
867
867
|
set token(e) {
|
|
868
868
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
869
869
|
throw new Error("Invalid Figma access token");
|
|
870
|
-
J(this,
|
|
870
|
+
J(this, Ie, e);
|
|
871
871
|
}
|
|
872
872
|
get token() {
|
|
873
|
-
return
|
|
873
|
+
return Z(this, Ie);
|
|
874
874
|
}
|
|
875
875
|
get headers() {
|
|
876
876
|
const e = {
|
|
877
877
|
"Content-Type": "application/json"
|
|
878
878
|
};
|
|
879
|
-
return
|
|
879
|
+
return Z(this, Ie).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = Z(this, Ie) : Z(this, Ie).startsWith("figu_") && (e.Authorization = `Bearer ${Z(this, Ie)}`), e;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
883
883
|
const Ni = (t) => ke(void 0, [t], function* ({
|
|
884
884
|
fileKey: e,
|
|
885
885
|
authToken: n,
|
|
886
|
-
figmaRestApi: s = new
|
|
886
|
+
figmaRestApi: s = new Ci(),
|
|
887
887
|
params: r = {},
|
|
888
888
|
signal: a
|
|
889
889
|
}) {
|
|
@@ -896,7 +896,7 @@ const Ni = (t) => ke(void 0, [t], function* ({
|
|
|
896
896
|
params: r
|
|
897
897
|
});
|
|
898
898
|
} catch (i) {
|
|
899
|
-
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i),
|
|
899
|
+
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), Ia(i, e));
|
|
900
900
|
}
|
|
901
901
|
});
|
|
902
902
|
var N;
|
|
@@ -1139,7 +1139,7 @@ const fn = (t) => {
|
|
|
1139
1139
|
path: a,
|
|
1140
1140
|
message: o
|
|
1141
1141
|
});
|
|
1142
|
-
},
|
|
1142
|
+
}, ji = [];
|
|
1143
1143
|
function y(t, e) {
|
|
1144
1144
|
const n = ln(), s = fn({
|
|
1145
1145
|
issueData: e,
|
|
@@ -1470,18 +1470,18 @@ class T {
|
|
|
1470
1470
|
return this.safeParse(null).success;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const
|
|
1474
|
-
let
|
|
1475
|
-
const Vi = /^(?:(?: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])$/, zi = /^(?:(?: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])$/, Ki = /^(([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]))$/, Bi = /^(([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])$/, qi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
1476
|
-
function
|
|
1473
|
+
const Ii = /^c[^\s-]{8,}$/i, Zi = /^[0-9a-z]+$/, Di = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Mi = /^[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, Li = /^[a-z0-9_-]{21}$/i, $i = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fi = /^[-+]?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)?)??$/, Wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ui = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1474
|
+
let In;
|
|
1475
|
+
const Vi = /^(?:(?: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])$/, zi = /^(?:(?: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])$/, Ki = /^(([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]))$/, Bi = /^(([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])$/, qi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, jr = "((\\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])))", Gi = new RegExp(`^${jr}$`);
|
|
1476
|
+
function Ir(t) {
|
|
1477
1477
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1478
1478
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1479
1479
|
}
|
|
1480
1480
|
function Ji(t) {
|
|
1481
|
-
return new RegExp(`^${
|
|
1481
|
+
return new RegExp(`^${Ir(t)}$`);
|
|
1482
1482
|
}
|
|
1483
1483
|
function Zr(t) {
|
|
1484
|
-
let e = `${
|
|
1484
|
+
let e = `${jr}T${Ir(t)}`;
|
|
1485
1485
|
const n = [];
|
|
1486
1486
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
1487
1487
|
}
|
|
@@ -1556,7 +1556,7 @@ class pe extends T {
|
|
|
1556
1556
|
message: r.message
|
|
1557
1557
|
}), n.dirty());
|
|
1558
1558
|
else if (r.kind === "emoji")
|
|
1559
|
-
|
|
1559
|
+
In || (In = new RegExp(Ui, "u")), In.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1560
1560
|
validation: "emoji",
|
|
1561
1561
|
code: f.invalid_string,
|
|
1562
1562
|
message: r.message
|
|
@@ -1574,7 +1574,7 @@ class pe extends T {
|
|
|
1574
1574
|
message: r.message
|
|
1575
1575
|
}), n.dirty());
|
|
1576
1576
|
else if (r.kind === "cuid")
|
|
1577
|
-
|
|
1577
|
+
Ii.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1578
1578
|
validation: "cuid",
|
|
1579
1579
|
code: f.invalid_string,
|
|
1580
1580
|
message: r.message
|
|
@@ -2178,7 +2178,7 @@ $e.create = (t) => {
|
|
|
2178
2178
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
2179
2179
|
}, O(t)));
|
|
2180
2180
|
};
|
|
2181
|
-
class
|
|
2181
|
+
class jt extends T {
|
|
2182
2182
|
_parse(e) {
|
|
2183
2183
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== v.boolean) {
|
|
2184
2184
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2191,7 +2191,7 @@ class It extends T {
|
|
|
2191
2191
|
return te(e.data);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
|
-
|
|
2194
|
+
jt.create = (t) => new jt(d({
|
|
2195
2195
|
typeName: E.ZodBoolean,
|
|
2196
2196
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2197
2197
|
}, O(t)));
|
|
@@ -2287,7 +2287,7 @@ class mn extends T {
|
|
|
2287
2287
|
mn.create = (t) => new mn(d({
|
|
2288
2288
|
typeName: E.ZodSymbol
|
|
2289
2289
|
}, O(t)));
|
|
2290
|
-
class
|
|
2290
|
+
class It extends T {
|
|
2291
2291
|
_parse(e) {
|
|
2292
2292
|
if (this._getType(e) !== v.undefined) {
|
|
2293
2293
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2300,7 +2300,7 @@ class jt extends T {
|
|
|
2300
2300
|
return te(e.data);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
|
-
|
|
2303
|
+
It.create = (t) => new It(d({
|
|
2304
2304
|
typeName: E.ZodUndefined
|
|
2305
2305
|
}, O(t)));
|
|
2306
2306
|
class Zt extends T {
|
|
@@ -2789,7 +2789,7 @@ Dt.create = (t, e) => new Dt(d({
|
|
|
2789
2789
|
options: t,
|
|
2790
2790
|
typeName: E.ZodUnion
|
|
2791
2791
|
}, O(e)));
|
|
2792
|
-
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ye ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof Ut ? Ze(t._def.innerType) : t instanceof
|
|
2792
|
+
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ye ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof Ut ? Ze(t._def.innerType) : t instanceof It ? [void 0] : t instanceof Zt ? [null] : t instanceof we ? [void 0, ...Ze(t.unwrap())] : t instanceof We ? [null, ...Ze(t.unwrap())] : t instanceof Ns || t instanceof zt ? Ze(t.unwrap()) : t instanceof Vt ? Ze(t._def.innerType) : [];
|
|
2793
2793
|
class En extends T {
|
|
2794
2794
|
_parse(e) {
|
|
2795
2795
|
const { ctx: n } = this._processInputParams(e);
|
|
@@ -3639,22 +3639,22 @@ var E;
|
|
|
3639
3639
|
})(E || (E = {}));
|
|
3640
3640
|
const so = (t, e = {
|
|
3641
3641
|
message: `Input not instance of ${t.name}`
|
|
3642
|
-
}) => Mr((n) => n instanceof t, e), Lr = pe.create, $r = Le.create, ro = vn.create, ao = $e.create, Fr =
|
|
3642
|
+
}) => Mr((n) => n instanceof t, e), Lr = pe.create, $r = Le.create, ro = vn.create, ao = $e.create, Fr = jt.create, io = Qe.create, oo = mn.create, co = It.create, uo = Zt.create, lo = gt.create, fo = Xe.create, ho = Pe.create, po = yn.create, mo = me.create, yo = U.create, go = U.strictCreate, vo = Dt.create, _o = En.create, bo = Mt.create, wo = xe.create, ko = Lt.create, Eo = gn.create, xo = et.create, So = ht.create, Oo = $t.create, To = Ft.create, Ao = Fe.create, Co = Wt.create, No = vt.create, ir = ye.create, Ro = we.create, Po = We.create, jo = ye.createWithPreprocess, Io = Jt.create, Zo = () => Lr().optional(), Do = () => $r().optional(), Mo = () => Fr().optional(), Lo = {
|
|
3643
3643
|
string: (t) => pe.create(x(d({}, t), { coerce: !0 })),
|
|
3644
3644
|
number: (t) => Le.create(x(d({}, t), { coerce: !0 })),
|
|
3645
|
-
boolean: (t) =>
|
|
3645
|
+
boolean: (t) => jt.create(x(d({}, t), {
|
|
3646
3646
|
coerce: !0
|
|
3647
3647
|
})),
|
|
3648
3648
|
bigint: (t) => $e.create(x(d({}, t), { coerce: !0 })),
|
|
3649
3649
|
date: (t) => Qe.create(x(d({}, t), { coerce: !0 }))
|
|
3650
3650
|
}, $o = S;
|
|
3651
|
-
var
|
|
3651
|
+
var I = /* @__PURE__ */ Object.freeze({
|
|
3652
3652
|
__proto__: null,
|
|
3653
3653
|
defaultErrorMap: yt,
|
|
3654
3654
|
setErrorMap: Pi,
|
|
3655
3655
|
getErrorMap: ln,
|
|
3656
3656
|
makeIssue: fn,
|
|
3657
|
-
EMPTY_PATH:
|
|
3657
|
+
EMPTY_PATH: ji,
|
|
3658
3658
|
addIssueToContext: y,
|
|
3659
3659
|
ParseStatus: X,
|
|
3660
3660
|
INVALID: S,
|
|
@@ -3677,10 +3677,10 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
3677
3677
|
ZodString: pe,
|
|
3678
3678
|
ZodNumber: Le,
|
|
3679
3679
|
ZodBigInt: $e,
|
|
3680
|
-
ZodBoolean:
|
|
3680
|
+
ZodBoolean: jt,
|
|
3681
3681
|
ZodDate: Qe,
|
|
3682
3682
|
ZodSymbol: mn,
|
|
3683
|
-
ZodUndefined:
|
|
3683
|
+
ZodUndefined: It,
|
|
3684
3684
|
ZodNull: Zt,
|
|
3685
3685
|
ZodAny: gt,
|
|
3686
3686
|
ZodUnknown: Xe,
|
|
@@ -3727,7 +3727,7 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
3727
3727
|
date: io,
|
|
3728
3728
|
discriminatedUnion: _o,
|
|
3729
3729
|
effect: ir,
|
|
3730
|
-
enum:
|
|
3730
|
+
enum: Ao,
|
|
3731
3731
|
function: So,
|
|
3732
3732
|
instanceof: so,
|
|
3733
3733
|
intersection: bo,
|
|
@@ -3735,7 +3735,7 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
3735
3735
|
literal: To,
|
|
3736
3736
|
map: Eo,
|
|
3737
3737
|
nan: ro,
|
|
3738
|
-
nativeEnum:
|
|
3738
|
+
nativeEnum: Co,
|
|
3739
3739
|
never: ho,
|
|
3740
3740
|
null: uo,
|
|
3741
3741
|
nullable: Po,
|
|
@@ -3745,8 +3745,8 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
3745
3745
|
onumber: Do,
|
|
3746
3746
|
optional: Ro,
|
|
3747
3747
|
ostring: Zo,
|
|
3748
|
-
pipeline:
|
|
3749
|
-
preprocess:
|
|
3748
|
+
pipeline: Io,
|
|
3749
|
+
preprocess: jo,
|
|
3750
3750
|
promise: No,
|
|
3751
3751
|
record: ko,
|
|
3752
3752
|
set: xo,
|
|
@@ -3764,16 +3764,16 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
3764
3764
|
quotelessJson: Ri,
|
|
3765
3765
|
ZodError: ie
|
|
3766
3766
|
});
|
|
3767
|
-
|
|
3768
|
-
language:
|
|
3769
|
-
disableMarkedForExport:
|
|
3770
|
-
allowAutoSelectFirstNode:
|
|
3767
|
+
I.object({
|
|
3768
|
+
language: I.enum(["typescript", "javascript"]).optional(),
|
|
3769
|
+
disableMarkedForExport: I.boolean().optional(),
|
|
3770
|
+
allowAutoSelectFirstNode: I.boolean().optional().default(!0)
|
|
3771
3771
|
}).and(
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
framework:
|
|
3775
|
-
model:
|
|
3776
|
-
styling:
|
|
3772
|
+
I.union([
|
|
3773
|
+
I.object({
|
|
3774
|
+
framework: I.literal("react"),
|
|
3775
|
+
model: I.string().optional(),
|
|
3776
|
+
styling: I.enum([
|
|
3777
3777
|
"plain_css",
|
|
3778
3778
|
"css_modules",
|
|
3779
3779
|
"styled_components",
|
|
@@ -3782,26 +3782,27 @@ D.object({
|
|
|
3782
3782
|
"scss",
|
|
3783
3783
|
"inline_styles"
|
|
3784
3784
|
]),
|
|
3785
|
-
uiLibrary:
|
|
3786
|
-
responsivePages:
|
|
3787
|
-
|
|
3788
|
-
name:
|
|
3789
|
-
framesId:
|
|
3785
|
+
uiLibrary: I.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
|
|
3786
|
+
responsivePages: I.array(
|
|
3787
|
+
I.object({
|
|
3788
|
+
name: I.string(),
|
|
3789
|
+
framesId: I.array(I.string())
|
|
3790
3790
|
})
|
|
3791
3791
|
).optional(),
|
|
3792
|
-
enableUILibraryTheming:
|
|
3793
|
-
enableCompactStructure:
|
|
3794
|
-
enableDisplayScreenModelId:
|
|
3795
|
-
enableGeneratePackageLock:
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3792
|
+
enableUILibraryTheming: I.boolean().optional(),
|
|
3793
|
+
enableCompactStructure: I.boolean().optional(),
|
|
3794
|
+
enableDisplayScreenModelId: I.boolean().optional(),
|
|
3795
|
+
enableGeneratePackageLock: I.boolean().optional(),
|
|
3796
|
+
enableAnimationsPreset: I.boolean().optional(),
|
|
3797
|
+
enableAutoSplit: I.boolean().optional(),
|
|
3798
|
+
autoSplitThreshold: I.number().optional(),
|
|
3799
|
+
url: I.string().url().optional(),
|
|
3800
|
+
codegenSettings: I.record(I.unknown()).optional()
|
|
3800
3801
|
}),
|
|
3801
|
-
|
|
3802
|
-
framework:
|
|
3803
|
-
styling:
|
|
3804
|
-
enableTranslation:
|
|
3802
|
+
I.object({
|
|
3803
|
+
framework: I.literal("html"),
|
|
3804
|
+
styling: I.enum(["plain_css", "inline_styles", "tailwind"]),
|
|
3805
|
+
enableTranslation: I.boolean().optional()
|
|
3805
3806
|
})
|
|
3806
3807
|
])
|
|
3807
3808
|
);
|
|
@@ -3820,10 +3821,10 @@ function Fo(t) {
|
|
|
3820
3821
|
const { onEvent: e = Zn, onError: n = Zn, onRetry: s = Zn, onComment: r } = t;
|
|
3821
3822
|
let a = "", i = !0, o, c = "", u = "";
|
|
3822
3823
|
function h(m) {
|
|
3823
|
-
const _ = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l,
|
|
3824
|
-
for (const
|
|
3825
|
-
p(
|
|
3826
|
-
a =
|
|
3824
|
+
const _ = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l, C] = Wo(`${a}${_}`);
|
|
3825
|
+
for (const j of l)
|
|
3826
|
+
p(j);
|
|
3827
|
+
a = C, i = !1;
|
|
3827
3828
|
}
|
|
3828
3829
|
function p(m) {
|
|
3829
3830
|
if (m === "") {
|
|
@@ -3836,8 +3837,8 @@ function Fo(t) {
|
|
|
3836
3837
|
}
|
|
3837
3838
|
const _ = m.indexOf(":");
|
|
3838
3839
|
if (_ !== -1) {
|
|
3839
|
-
const l = m.slice(0, _),
|
|
3840
|
-
k(l,
|
|
3840
|
+
const l = m.slice(0, _), C = m[_ + 1] === " " ? 2 : 1, j = m.slice(_ + C);
|
|
3841
|
+
k(l, j, m);
|
|
3841
3842
|
return;
|
|
3842
3843
|
}
|
|
3843
3844
|
k(m, "", m);
|
|
@@ -3967,54 +3968,54 @@ function ur(t) {
|
|
|
3967
3968
|
}
|
|
3968
3969
|
var Wr = (t) => {
|
|
3969
3970
|
throw TypeError(t);
|
|
3970
|
-
}, Rs = (t, e, n) => e.has(t) || Wr("Cannot " + n),
|
|
3971
|
+
}, Rs = (t, e, n) => e.has(t) || Wr("Cannot " + n), A = (t, e, n) => (Rs(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Wr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), W = (t, e, n, s) => (Rs(t, e, "write to private field"), e.set(t, n), n), Ce = (t, e, n) => (Rs(t, e, "access private method"), n), se, Je, ut, un, _n, Nt, ft, Rt, De, dt, pt, lt, At, he, is, os, cs, dr, us, ds, Ct, ls, fs;
|
|
3971
3972
|
class dn extends EventTarget {
|
|
3972
3973
|
constructor(e, n) {
|
|
3973
3974
|
var s, r;
|
|
3974
|
-
super(), q(this, he), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, se), q(this, Je), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this,
|
|
3975
|
+
super(), q(this, he), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, se), q(this, Je), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, At, null), q(this, os, (a) => je(this, null, function* () {
|
|
3975
3976
|
var i;
|
|
3976
|
-
|
|
3977
|
+
A(this, dt).reset();
|
|
3977
3978
|
const { body: o, redirected: c, status: u, headers: h } = a;
|
|
3978
3979
|
if (u === 204) {
|
|
3979
|
-
|
|
3980
|
+
Ce(this, he, Ct).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
3980
3981
|
return;
|
|
3981
3982
|
}
|
|
3982
3983
|
if (c ? W(this, ut, new URL(a.url)) : W(this, ut, void 0), u !== 200) {
|
|
3983
|
-
|
|
3984
|
+
Ce(this, he, Ct).call(this, `Non-200 status code (${u})`, u);
|
|
3984
3985
|
return;
|
|
3985
3986
|
}
|
|
3986
3987
|
if (!(h.get("content-type") || "").startsWith("text/event-stream")) {
|
|
3987
|
-
|
|
3988
|
+
Ce(this, he, Ct).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
3988
3989
|
return;
|
|
3989
3990
|
}
|
|
3990
|
-
if (
|
|
3991
|
+
if (A(this, se) === this.CLOSED)
|
|
3991
3992
|
return;
|
|
3992
3993
|
W(this, se, this.OPEN);
|
|
3993
3994
|
const p = new Event("open");
|
|
3994
|
-
if ((i =
|
|
3995
|
-
|
|
3995
|
+
if ((i = A(this, At)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
3996
|
+
Ce(this, he, Ct).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
3996
3997
|
return;
|
|
3997
3998
|
}
|
|
3998
3999
|
const k = new TextDecoder(), g = o.getReader();
|
|
3999
4000
|
let b = !0;
|
|
4000
4001
|
do {
|
|
4001
4002
|
const { done: m, value: _ } = yield g.read();
|
|
4002
|
-
_ &&
|
|
4003
|
+
_ && A(this, dt).feed(k.decode(_, { stream: !m })), m && (b = !1, A(this, dt).reset(), Ce(this, he, ls).call(this));
|
|
4003
4004
|
} while (b);
|
|
4004
4005
|
})), q(this, cs, (a) => {
|
|
4005
|
-
W(this, De, void 0), !(a.name === "AbortError" || a.type === "aborted") &&
|
|
4006
|
+
W(this, De, void 0), !(a.name === "AbortError" || a.type === "aborted") && Ce(this, he, ls).call(this, as(a));
|
|
4006
4007
|
}), q(this, us, (a) => {
|
|
4007
4008
|
typeof a.id == "string" && W(this, Rt, a.id);
|
|
4008
4009
|
const i = new MessageEvent(a.event || "message", {
|
|
4009
4010
|
data: a.data,
|
|
4010
|
-
origin:
|
|
4011
|
+
origin: A(this, ut) ? A(this, ut).origin : A(this, Je).origin,
|
|
4011
4012
|
lastEventId: a.id || ""
|
|
4012
4013
|
});
|
|
4013
|
-
|
|
4014
|
+
A(this, lt) && (!a.event || a.event === "message") && A(this, lt).call(this, i), this.dispatchEvent(i);
|
|
4014
4015
|
}), q(this, ds, (a) => {
|
|
4015
4016
|
W(this, Nt, a);
|
|
4016
4017
|
}), q(this, fs, () => {
|
|
4017
|
-
W(this, ft, void 0),
|
|
4018
|
+
W(this, ft, void 0), A(this, se) === this.CONNECTING && Ce(this, he, is).call(this);
|
|
4018
4019
|
});
|
|
4019
4020
|
try {
|
|
4020
4021
|
if (e instanceof URL)
|
|
@@ -4027,9 +4028,9 @@ class dn extends EventTarget {
|
|
|
4027
4028
|
throw Uo("An invalid or illegal string was specified");
|
|
4028
4029
|
}
|
|
4029
4030
|
W(this, dt, Fo({
|
|
4030
|
-
onEvent:
|
|
4031
|
-
onRetry:
|
|
4032
|
-
})), W(this, se, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (s = n == null ? void 0 : n.fetch) != null ? s : globalThis.fetch), W(this, un, (r = n == null ? void 0 : n.withCredentials) != null ? r : !1),
|
|
4031
|
+
onEvent: A(this, us),
|
|
4032
|
+
onRetry: A(this, ds)
|
|
4033
|
+
})), W(this, se, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (s = n == null ? void 0 : n.fetch) != null ? s : globalThis.fetch), W(this, un, (r = n == null ? void 0 : n.withCredentials) != null ? r : !1), Ce(this, he, is).call(this);
|
|
4033
4034
|
}
|
|
4034
4035
|
/**
|
|
4035
4036
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -4042,7 +4043,7 @@ class dn extends EventTarget {
|
|
|
4042
4043
|
* @public
|
|
4043
4044
|
*/
|
|
4044
4045
|
get readyState() {
|
|
4045
|
-
return
|
|
4046
|
+
return A(this, se);
|
|
4046
4047
|
}
|
|
4047
4048
|
/**
|
|
4048
4049
|
* Returns the URL providing the event stream.
|
|
@@ -4052,7 +4053,7 @@ class dn extends EventTarget {
|
|
|
4052
4053
|
* @public
|
|
4053
4054
|
*/
|
|
4054
4055
|
get url() {
|
|
4055
|
-
return
|
|
4056
|
+
return A(this, Je).href;
|
|
4056
4057
|
}
|
|
4057
4058
|
/**
|
|
4058
4059
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -4060,28 +4061,28 @@ class dn extends EventTarget {
|
|
|
4060
4061
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
4061
4062
|
*/
|
|
4062
4063
|
get withCredentials() {
|
|
4063
|
-
return
|
|
4064
|
+
return A(this, un);
|
|
4064
4065
|
}
|
|
4065
4066
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
4066
4067
|
get onerror() {
|
|
4067
|
-
return
|
|
4068
|
+
return A(this, pt);
|
|
4068
4069
|
}
|
|
4069
4070
|
set onerror(e) {
|
|
4070
4071
|
W(this, pt, e);
|
|
4071
4072
|
}
|
|
4072
4073
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
4073
4074
|
get onmessage() {
|
|
4074
|
-
return
|
|
4075
|
+
return A(this, lt);
|
|
4075
4076
|
}
|
|
4076
4077
|
set onmessage(e) {
|
|
4077
4078
|
W(this, lt, e);
|
|
4078
4079
|
}
|
|
4079
4080
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
4080
4081
|
get onopen() {
|
|
4081
|
-
return
|
|
4082
|
+
return A(this, At);
|
|
4082
4083
|
}
|
|
4083
4084
|
set onopen(e) {
|
|
4084
|
-
W(this,
|
|
4085
|
+
W(this, At, e);
|
|
4085
4086
|
}
|
|
4086
4087
|
addEventListener(e, n, s) {
|
|
4087
4088
|
const r = n;
|
|
@@ -4099,16 +4100,16 @@ class dn extends EventTarget {
|
|
|
4099
4100
|
* @public
|
|
4100
4101
|
*/
|
|
4101
4102
|
close() {
|
|
4102
|
-
|
|
4103
|
+
A(this, ft) && clearTimeout(A(this, ft)), A(this, se) !== this.CLOSED && (A(this, De) && A(this, De).abort(), W(this, se, this.CLOSED), W(this, De, void 0));
|
|
4103
4104
|
}
|
|
4104
4105
|
}
|
|
4105
|
-
se = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(),
|
|
4106
|
+
se = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakSet(), /**
|
|
4106
4107
|
* Connect to the given URL and start receiving events
|
|
4107
4108
|
*
|
|
4108
4109
|
* @internal
|
|
4109
4110
|
*/
|
|
4110
4111
|
is = function() {
|
|
4111
|
-
W(this, se, this.CONNECTING), W(this, De, new AbortController()),
|
|
4112
|
+
W(this, se, this.CONNECTING), W(this, De, new AbortController()), A(this, _n)(A(this, Je), Ce(this, he, dr).call(this)).then(A(this, os)).catch(A(this, cs));
|
|
4112
4113
|
}, os = /* @__PURE__ */ new WeakMap(), cs = /* @__PURE__ */ new WeakMap(), /**
|
|
4113
4114
|
* Get request options for the `fetch()` request
|
|
4114
4115
|
*
|
|
@@ -4122,9 +4123,9 @@ dr = function() {
|
|
|
4122
4123
|
// [spec] …will have their mode set to "cors"…
|
|
4123
4124
|
mode: "cors",
|
|
4124
4125
|
redirect: "follow",
|
|
4125
|
-
headers: Ke({ Accept: "text/event-stream" },
|
|
4126
|
+
headers: Ke({ Accept: "text/event-stream" }, A(this, Rt) ? { "Last-Event-ID": A(this, Rt) } : void 0),
|
|
4126
4127
|
cache: "no-store",
|
|
4127
|
-
signal: (t =
|
|
4128
|
+
signal: (t = A(this, De)) == null ? void 0 : t.signal
|
|
4128
4129
|
};
|
|
4129
4130
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
4130
4131
|
}, us = /* @__PURE__ */ new WeakMap(), ds = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -4134,11 +4135,11 @@ dr = function() {
|
|
|
4134
4135
|
* @param code - The HTTP status code, if available
|
|
4135
4136
|
* @internal
|
|
4136
4137
|
*/
|
|
4137
|
-
|
|
4138
|
+
Ct = function(t, e) {
|
|
4138
4139
|
var n;
|
|
4139
|
-
|
|
4140
|
+
A(this, se) !== this.CLOSED && W(this, se, this.CLOSED);
|
|
4140
4141
|
const s = new cr("error", { code: e, message: t });
|
|
4141
|
-
(n =
|
|
4142
|
+
(n = A(this, pt)) == null || n.call(this, s), this.dispatchEvent(s);
|
|
4142
4143
|
}, /**
|
|
4143
4144
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
4144
4145
|
*
|
|
@@ -4148,11 +4149,11 @@ At = function(t, e) {
|
|
|
4148
4149
|
*/
|
|
4149
4150
|
ls = function(t, e) {
|
|
4150
4151
|
var n;
|
|
4151
|
-
if (
|
|
4152
|
+
if (A(this, se) === this.CLOSED)
|
|
4152
4153
|
return;
|
|
4153
4154
|
W(this, se, this.CONNECTING);
|
|
4154
4155
|
const s = new cr("error", { code: e, message: t });
|
|
4155
|
-
(n =
|
|
4156
|
+
(n = A(this, pt)) == null || n.call(this, s), this.dispatchEvent(s), W(this, ft, setTimeout(A(this, fs), A(this, Nt)));
|
|
4156
4157
|
}, fs = /* @__PURE__ */ new WeakMap(), /**
|
|
4157
4158
|
* ReadyState representing an EventSource currently trying to connect
|
|
4158
4159
|
*
|
|
@@ -4665,7 +4666,7 @@ const yr = 10, gr = {
|
|
|
4665
4666
|
}) => {
|
|
4666
4667
|
const [n, s] = nc(gr);
|
|
4667
4668
|
return {
|
|
4668
|
-
getCode: (a) =>
|
|
4669
|
+
getCode: (a) => je(void 0, null, function* () {
|
|
4669
4670
|
var h, p, k;
|
|
4670
4671
|
s((g) => {
|
|
4671
4672
|
g.status = "pending", g.error = null, g.result = null, g.tasks = gr.tasks;
|
|
@@ -4690,14 +4691,14 @@ const yr = 10, gr = {
|
|
|
4690
4691
|
const b = {};
|
|
4691
4692
|
c.addEventListener("start", (_) => {
|
|
4692
4693
|
const l = JSON.parse(_.data);
|
|
4693
|
-
b.sessionId = l.sessionId, s((
|
|
4694
|
-
|
|
4694
|
+
b.sessionId = l.sessionId, s((C) => {
|
|
4695
|
+
C.tasks.fetchDesign.status = "running";
|
|
4695
4696
|
});
|
|
4696
4697
|
}), c.addEventListener("pre_codegen", (_) => {
|
|
4697
4698
|
JSON.parse(
|
|
4698
4699
|
_.data
|
|
4699
|
-
).message === "Anima model built" && s((
|
|
4700
|
-
|
|
4700
|
+
).message === "Anima model built" && s((C) => {
|
|
4701
|
+
C.tasks.fetchDesign.status = "finished", C.tasks.codeGeneration.status = "running", C.tasks.uploadAssets.status = "running";
|
|
4701
4702
|
});
|
|
4702
4703
|
}), c.addEventListener("figma_metadata", (_) => {
|
|
4703
4704
|
const l = JSON.parse(
|
|
@@ -4716,8 +4717,8 @@ const yr = 10, gr = {
|
|
|
4716
4717
|
const l = JSON.parse(
|
|
4717
4718
|
_.data
|
|
4718
4719
|
);
|
|
4719
|
-
l.payload.status === "success" && (b.files = l.payload.files), s((
|
|
4720
|
-
|
|
4720
|
+
l.payload.status === "success" && (b.files = l.payload.files), s((C) => {
|
|
4721
|
+
C.tasks.codeGeneration.progress = l.payload.progress, C.tasks.codeGeneration.status = "running";
|
|
4721
4722
|
});
|
|
4722
4723
|
}), c.addEventListener("codegen_completed", () => {
|
|
4723
4724
|
s((_) => {
|
|
@@ -4738,35 +4739,35 @@ const yr = 10, gr = {
|
|
|
4738
4739
|
b.assets = l.payload.assets;
|
|
4739
4740
|
});
|
|
4740
4741
|
let m = 0;
|
|
4741
|
-
c.addEventListener("error", (_) =>
|
|
4742
|
-
var M, z,
|
|
4742
|
+
c.addEventListener("error", (_) => je(void 0, null, function* () {
|
|
4743
|
+
var M, z, D;
|
|
4743
4744
|
console.warn(
|
|
4744
4745
|
`Experienced error during code generation (attempt ${m + 1} / ${yr})`,
|
|
4745
4746
|
_
|
|
4746
4747
|
);
|
|
4747
|
-
let l,
|
|
4748
|
+
let l, C = !1;
|
|
4748
4749
|
try {
|
|
4749
|
-
_ instanceof MessageEvent ? l = JSON.parse(_.data) : l = yield (yield o).json(), ((M = l == null ? void 0 : l.payload) == null ? void 0 : M.name) === "Task Crashed" && (
|
|
4750
|
+
_ instanceof MessageEvent ? l = JSON.parse(_.data) : l = yield (yield o).json(), ((M = l == null ? void 0 : l.payload) == null ? void 0 : M.name) === "Task Crashed" && (C = !0);
|
|
4750
4751
|
} catch (P) {
|
|
4751
4752
|
}
|
|
4752
|
-
const
|
|
4753
|
+
const j = new Gs({
|
|
4753
4754
|
name: (z = l == null ? void 0 : l.payload.name) != null ? z : "Unknown error",
|
|
4754
|
-
reason: (
|
|
4755
|
+
reason: (D = l == null ? void 0 : l.payload.message) != null ? D : "Unknown",
|
|
4755
4756
|
status: l == null ? void 0 : l.payload.status,
|
|
4756
4757
|
detail: l == null ? void 0 : l.payload.detail
|
|
4757
4758
|
});
|
|
4758
4759
|
m++;
|
|
4759
4760
|
let V = !1;
|
|
4760
|
-
m > yr ? (console.error("Experienced too many errors, terminating request"), V = !0) :
|
|
4761
|
-
P.status = "error", P.error =
|
|
4761
|
+
m > yr ? (console.error("Experienced too many errors, terminating request"), V = !0) : C && (console.error("Experienced unrecoverable error, terminating request"), V = !0), V && (s((P) => {
|
|
4762
|
+
P.status = "error", P.error = j;
|
|
4762
4763
|
}), g({
|
|
4763
4764
|
result: null,
|
|
4764
|
-
error:
|
|
4765
|
+
error: j
|
|
4765
4766
|
}));
|
|
4766
4767
|
})), c.addEventListener("done", (_) => {
|
|
4767
4768
|
const l = JSON.parse(_.data);
|
|
4768
|
-
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, s((
|
|
4769
|
-
|
|
4769
|
+
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, s((C) => {
|
|
4770
|
+
C.status = "success", C.result = b;
|
|
4770
4771
|
}), g({ result: b, error: null });
|
|
4771
4772
|
});
|
|
4772
4773
|
});
|
|
@@ -4775,20 +4776,20 @@ const yr = 10, gr = {
|
|
|
4775
4776
|
if (((p = i.assetsStorage) == null ? void 0 : p.strategy) === "local" && ((k = m == null ? void 0 : m.assets) != null && k.length)) {
|
|
4776
4777
|
const { filePath: _ } = vr(
|
|
4777
4778
|
i.assetsStorage
|
|
4778
|
-
), l = m.assets.map((
|
|
4779
|
-
const M = yield (yield fetch(
|
|
4779
|
+
), l = m.assets.map((j) => je(void 0, null, function* () {
|
|
4780
|
+
const M = yield (yield fetch(j.url)).arrayBuffer();
|
|
4780
4781
|
return {
|
|
4781
|
-
assetName:
|
|
4782
|
+
assetName: j.name,
|
|
4782
4783
|
base64: va(M)
|
|
4783
4784
|
};
|
|
4784
|
-
})),
|
|
4785
|
-
for (const
|
|
4785
|
+
})), C = yield Promise.allSettled(l);
|
|
4786
|
+
for (const j of C) {
|
|
4786
4787
|
const V = {};
|
|
4787
|
-
if (
|
|
4788
|
-
const { assetName: M, base64: z } =
|
|
4788
|
+
if (j.status === "fulfilled") {
|
|
4789
|
+
const { assetName: M, base64: z } = j.value;
|
|
4789
4790
|
V[M] = z;
|
|
4790
|
-
const
|
|
4791
|
-
m.files[
|
|
4791
|
+
const D = _ ? `${_}/${M}` : M;
|
|
4792
|
+
m.files[D] = {
|
|
4792
4793
|
content: z,
|
|
4793
4794
|
isBinary: !0
|
|
4794
4795
|
};
|
|
@@ -4887,16 +4888,16 @@ function rc() {
|
|
|
4887
4888
|
_ = i({
|
|
4888
4889
|
inst: { value: m, getSnapshot: b }
|
|
4889
4890
|
});
|
|
4890
|
-
var l = _[0].inst,
|
|
4891
|
+
var l = _[0].inst, C = _[1];
|
|
4891
4892
|
return c(
|
|
4892
4893
|
function() {
|
|
4893
|
-
l.value = m, l.getSnapshot = b, n(l) &&
|
|
4894
|
+
l.value = m, l.getSnapshot = b, n(l) && C({ inst: l });
|
|
4894
4895
|
},
|
|
4895
4896
|
[g, m, b]
|
|
4896
4897
|
), o(
|
|
4897
4898
|
function() {
|
|
4898
|
-
return n(l) &&
|
|
4899
|
-
n(l) &&
|
|
4899
|
+
return n(l) && C({ inst: l }), g(function() {
|
|
4900
|
+
n(l) && C({ inst: l });
|
|
4900
4901
|
});
|
|
4901
4902
|
},
|
|
4902
4903
|
[g]
|
|
@@ -4951,7 +4952,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4951
4952
|
}, ee = (
|
|
4952
4953
|
/*#__NOINLINE__*/
|
|
4953
4954
|
Me()
|
|
4954
|
-
), bs = Object, R = (t) => t === ee, be = (t) => typeof t == "function", Ue = (t, e) => Ke(Ke({}, t), e), Xr = (t) => be(t.then), Fn = {}, nn = {},
|
|
4955
|
+
), bs = Object, R = (t) => t === ee, be = (t) => typeof t == "function", Ue = (t, e) => Ke(Ke({}, t), e), Xr = (t) => be(t.then), Fn = {}, nn = {}, js = "undefined", Xt = typeof window != js, ws = typeof document != js, oc = Xt && "Deno" in window, cc = () => Xt && typeof window.requestAnimationFrame != js, Yr = (t, e) => {
|
|
4955
4956
|
const n = Re.get(t);
|
|
4956
4957
|
return [
|
|
4957
4958
|
// Getter
|
|
@@ -5021,7 +5022,7 @@ const Ss = (t) => {
|
|
|
5021
5022
|
} else
|
|
5022
5023
|
a = n ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
|
|
5023
5024
|
return a;
|
|
5024
|
-
},
|
|
5025
|
+
}, Is = (t) => {
|
|
5025
5026
|
if (be(t))
|
|
5026
5027
|
try {
|
|
5027
5028
|
t = t();
|
|
@@ -5037,7 +5038,7 @@ const Ss = (t) => {
|
|
|
5037
5038
|
let gc = 0;
|
|
5038
5039
|
const Os = () => ++gc;
|
|
5039
5040
|
function Qr(...t) {
|
|
5040
|
-
return
|
|
5041
|
+
return je(this, null, function* () {
|
|
5041
5042
|
const [e, n, s, r] = t, a = Ue({
|
|
5042
5043
|
populateCache: !0,
|
|
5043
5044
|
throwOnError: !0
|
|
@@ -5057,19 +5058,19 @@ function Qr(...t) {
|
|
|
5057
5058
|
}
|
|
5058
5059
|
return p(n);
|
|
5059
5060
|
function p(k) {
|
|
5060
|
-
return
|
|
5061
|
-
const [g] =
|
|
5061
|
+
return je(this, null, function* () {
|
|
5062
|
+
const [g] = Is(k);
|
|
5062
5063
|
if (!g) return;
|
|
5063
|
-
const [b, m] = Yr(e, g), [_, l,
|
|
5064
|
+
const [b, m] = Yr(e, g), [_, l, C, j] = Re.get(e), V = () => {
|
|
5064
5065
|
const le = _[g];
|
|
5065
|
-
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete
|
|
5066
|
+
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete C[g], delete j[g], le && le[0]) ? le[0](Jr).then(() => b().data) : b().data;
|
|
5066
5067
|
};
|
|
5067
5068
|
if (t.length < 3)
|
|
5068
5069
|
return V();
|
|
5069
5070
|
let M = s, z;
|
|
5070
|
-
const
|
|
5071
|
+
const D = Os();
|
|
5071
5072
|
l[g] = [
|
|
5072
|
-
|
|
5073
|
+
D,
|
|
5073
5074
|
0
|
|
5074
5075
|
];
|
|
5075
5076
|
const P = !R(c), Se = b(), F = Se.data, st = Se._c, Ve = R(st) ? F : st;
|
|
@@ -5085,7 +5086,7 @@ function Qr(...t) {
|
|
|
5085
5086
|
if (M && Xr(M))
|
|
5086
5087
|
if (M = yield M.catch((le) => {
|
|
5087
5088
|
z = le;
|
|
5088
|
-
}),
|
|
5089
|
+
}), D !== l[g][0]) {
|
|
5089
5090
|
if (z) throw z;
|
|
5090
5091
|
return M;
|
|
5091
5092
|
} else z && P && u(z) && (i = !0, m({
|
|
@@ -5201,7 +5202,7 @@ const Or = (t, e) => {
|
|
|
5201
5202
|
return n;
|
|
5202
5203
|
}, xc = fa({}), Sc = "$inf$", ta = Xt && window.__SWR_DEVTOOLS_USE__, Oc = ta ? window.__SWR_DEVTOOLS_USE__ : [], Tc = () => {
|
|
5203
5204
|
ta && (window.__SWR_DEVTOOLS_REACT__ = Gt);
|
|
5204
|
-
},
|
|
5205
|
+
}, Ac = (t) => be(t[1]) ? [
|
|
5205
5206
|
t[0],
|
|
5206
5207
|
t[1],
|
|
5207
5208
|
t[2] || {}
|
|
@@ -5209,20 +5210,20 @@ const Or = (t, e) => {
|
|
|
5209
5210
|
t[0],
|
|
5210
5211
|
null,
|
|
5211
5212
|
(t[1] === null ? t[2] : t[1]) || {}
|
|
5212
|
-
],
|
|
5213
|
-
const [i] =
|
|
5213
|
+
], Cc = () => Ue(kc, ma(xc)), Nc = (t) => (e, n, s) => t(e, n && ((...a) => {
|
|
5214
|
+
const [i] = Is(e), [, , , o] = Re.get(ea);
|
|
5214
5215
|
if (i.startsWith(Sc))
|
|
5215
5216
|
return n(...a);
|
|
5216
5217
|
const c = o[i];
|
|
5217
5218
|
return R(c) ? n(...a) : (delete o[i], c);
|
|
5218
5219
|
}), s), Rc = Oc.concat(Nc), Pc = (t) => function(...n) {
|
|
5219
|
-
const s =
|
|
5220
|
+
const s = Cc(), [r, a, i] = Ac(n), o = Ec(s, i);
|
|
5220
5221
|
let c = t;
|
|
5221
5222
|
const { use: u } = o, h = (u || []).concat(Rc);
|
|
5222
5223
|
for (let p = h.length; p--; )
|
|
5223
5224
|
c = h[p](c);
|
|
5224
5225
|
return c(r, a || o.fetcher || null, o);
|
|
5225
|
-
},
|
|
5226
|
+
}, jc = (t, e, n) => {
|
|
5226
5227
|
const s = e[t] || (e[t] = []);
|
|
5227
5228
|
return s.push(n), () => {
|
|
5228
5229
|
const r = s.indexOf(n);
|
|
@@ -5251,8 +5252,8 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5251
5252
|
}
|
|
5252
5253
|
}), Kn = {
|
|
5253
5254
|
dedupe: !0
|
|
5254
|
-
},
|
|
5255
|
-
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, m, _] = Re.get(s), [l,
|
|
5255
|
+
}, Ic = (t, e, n) => {
|
|
5256
|
+
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, m, _] = Re.get(s), [l, C] = Is(t), j = Be(!1), V = Be(!1), M = Be(l), z = Be(e), D = Be(n), P = () => D.current, Se = () => P().isVisible() && P().isOnline(), [F, st, Ve, le] = Yr(s, l), rt = Be({}).current, Yt = R(i) ? R(n.fallback) ? ee : n.fallback[l] : i, Zs = ($, L) => {
|
|
5256
5257
|
for (const G in rt) {
|
|
5257
5258
|
const K = G;
|
|
5258
5259
|
if (K === "data") {
|
|
@@ -5290,13 +5291,13 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5290
5291
|
s,
|
|
5291
5292
|
l
|
|
5292
5293
|
]
|
|
5293
|
-
), Ds[0], Ds[1]), Ms = !
|
|
5294
|
-
($) =>
|
|
5294
|
+
), Ds[0], Ds[1]), Ms = !j.current, na = g[l] && g[l].length > 0, it = at.data, ze = R(it) ? Yt && Xr(Yt) ? zn(Yt) : Yt : it, Qt = at.error, An = Be(ze), en = k ? R(it) ? R(An.current) ? ze : An.current : it : ze, Ls = na && !R(Qt) ? !1 : Ms && !R(o) ? o : P().isPaused() ? !1 : a ? R(ze) ? !1 : c : R(ze) || c, $s = !!(l && e && Ms && Ls), sa = R(at.isValidating) ? $s : at.isValidating, ra = R(at.isLoading) ? $s : at.isLoading, wt = rn(
|
|
5295
|
+
($) => je(void 0, null, function* () {
|
|
5295
5296
|
const L = z.current;
|
|
5296
5297
|
if (!l || !L || V.current || P().isPaused())
|
|
5297
5298
|
return !1;
|
|
5298
5299
|
let G, K, fe = !0;
|
|
5299
|
-
const ot = $ || {}, H = !m[l] || !ot.dedupe, Y = () => xr ? !V.current && l === M.current &&
|
|
5300
|
+
const ot = $ || {}, H = !m[l] || !ot.dedupe, Y = () => xr ? !V.current && l === M.current && j.current : l === M.current, Oe = {
|
|
5300
5301
|
isValidating: !1,
|
|
5301
5302
|
isLoading: !1
|
|
5302
5303
|
}, Ws = () => {
|
|
@@ -5312,7 +5313,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5312
5313
|
if (H && (st(Vs), n.loadingTimeout && R(F().data) && setTimeout(() => {
|
|
5313
5314
|
fe && Y() && P().onLoadingSlow(l, n);
|
|
5314
5315
|
}, n.loadingTimeout), m[l] = [
|
|
5315
|
-
L(
|
|
5316
|
+
L(C),
|
|
5316
5317
|
Os()
|
|
5317
5318
|
]), [G, K] = m[l], G = yield G, H && setTimeout(Us, n.dedupingInterval), !m[l] || m[l][1] !== K)
|
|
5318
5319
|
return H && Y() && P().onDiscarded(l), !1;
|
|
@@ -5327,8 +5328,8 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5327
5328
|
Oe.data = r(Te, G) ? Te : G, H && Y() && P().onSuccess(G, l, n);
|
|
5328
5329
|
} catch (ue) {
|
|
5329
5330
|
Us();
|
|
5330
|
-
const Te = P(), { shouldRetryOnError:
|
|
5331
|
-
Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue, l, Te), (
|
|
5331
|
+
const Te = P(), { shouldRetryOnError: Cn } = Te;
|
|
5332
|
+
Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue, l, Te), (Cn === !0 || be(Cn) && Cn(ue)) && (!P().revalidateOnFocus || !P().revalidateOnReconnect || Se()) && Te.onErrorRetry(ue, l, Te, (aa) => {
|
|
5332
5333
|
const Nn = g[l];
|
|
5333
5334
|
Nn && Nn[0] && Nn[0](kr, aa);
|
|
5334
5335
|
}, {
|
|
@@ -5360,13 +5361,13 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5360
5361
|
[]
|
|
5361
5362
|
);
|
|
5362
5363
|
if (Wn(() => {
|
|
5363
|
-
z.current = e,
|
|
5364
|
+
z.current = e, D.current = n, R(it) || (An.current = it);
|
|
5364
5365
|
}), Wn(() => {
|
|
5365
5366
|
if (!l) return;
|
|
5366
5367
|
const $ = wt.bind(ee, Kn);
|
|
5367
5368
|
let L = 0;
|
|
5368
5369
|
P().revalidateOnFocus && (L = Date.now() + P().focusThrottleInterval);
|
|
5369
|
-
const K =
|
|
5370
|
+
const K = jc(l, g, (fe, ot = {}) => {
|
|
5370
5371
|
if (fe == Hr) {
|
|
5371
5372
|
const H = Date.now();
|
|
5372
5373
|
P().revalidateOnFocus && H > L && Se() && (L = H + P().focusThrottleInterval, $());
|
|
@@ -5379,8 +5380,8 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5379
5380
|
return wt(ot);
|
|
5380
5381
|
}
|
|
5381
5382
|
});
|
|
5382
|
-
return V.current = !1, M.current = l,
|
|
5383
|
-
_k:
|
|
5383
|
+
return V.current = !1, M.current = l, j.current = !0, st({
|
|
5384
|
+
_k: C
|
|
5384
5385
|
}), Ls && (R(ze) || Ht ? $() : mc($)), () => {
|
|
5385
5386
|
V.current = !0, K();
|
|
5386
5387
|
};
|
|
@@ -5406,7 +5407,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5406
5407
|
]), ga(en), a && R(ze) && l) {
|
|
5407
5408
|
if (!xr && Ht)
|
|
5408
5409
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
5409
|
-
z.current = e,
|
|
5410
|
+
z.current = e, D.current = n, V.current = !1;
|
|
5410
5411
|
const $ = _[l];
|
|
5411
5412
|
if (!R($)) {
|
|
5412
5413
|
const L = Fs($);
|
|
@@ -5433,7 +5434,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5433
5434
|
return rt.isLoading = !0, ra;
|
|
5434
5435
|
}
|
|
5435
5436
|
};
|
|
5436
|
-
}, Zc = Pc(
|
|
5437
|
+
}, Zc = Pc(Ic), Fc = ({
|
|
5437
5438
|
fileKey: t,
|
|
5438
5439
|
authToken: e,
|
|
5439
5440
|
enabled: n = !0,
|