@animaapp/anima-sdk-react 0.16.0 → 0.16.1
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 +7 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +731 -1010
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,415 +1,136 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var on = Object.defineProperty, an = Object.defineProperties;
|
|
2
|
+
var cn = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var _t = Object.getOwnPropertySymbols;
|
|
4
|
+
var un = Object.prototype.hasOwnProperty, ln = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var yt = (e, n, t) => n in e ? on(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, L = (e, n) => {
|
|
6
6
|
for (var t in n || (n = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
7
|
+
un.call(n, t) && yt(e, t, n[t]);
|
|
8
|
+
if (_t)
|
|
9
|
+
for (var t of _t(n))
|
|
10
|
+
ln.call(n, t) && yt(e, t, n[t]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
}, Me = (e, n) => an(e, cn(n));
|
|
13
|
+
var V = (e, n, t) => new Promise((s, i) => {
|
|
14
|
+
var c = (r) => {
|
|
15
15
|
try {
|
|
16
|
-
l(t.next(
|
|
17
|
-
} catch (
|
|
18
|
-
o
|
|
16
|
+
l(t.next(r));
|
|
17
|
+
} catch (o) {
|
|
18
|
+
i(o);
|
|
19
19
|
}
|
|
20
|
-
}, a = (
|
|
20
|
+
}, a = (r) => {
|
|
21
21
|
try {
|
|
22
|
-
l(t.throw(
|
|
23
|
-
} catch (
|
|
24
|
-
o
|
|
22
|
+
l(t.throw(r));
|
|
23
|
+
} catch (o) {
|
|
24
|
+
i(o);
|
|
25
25
|
}
|
|
26
|
-
}, l = (
|
|
26
|
+
}, l = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(c, a);
|
|
27
27
|
l((t = t.apply(e, n)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* @license React
|
|
34
|
-
* react-jsx-runtime.production.js
|
|
35
|
-
*
|
|
36
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the MIT license found in the
|
|
39
|
-
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/
|
|
41
|
-
var Lt;
|
|
42
|
-
function _n() {
|
|
43
|
-
if (Lt) return Ce;
|
|
44
|
-
Lt = 1;
|
|
45
|
-
var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
46
|
-
function t(r, o, u) {
|
|
47
|
-
var a = null;
|
|
48
|
-
if (u !== void 0 && (a = "" + u), o.key !== void 0 && (a = "" + o.key), "key" in o) {
|
|
49
|
-
u = {};
|
|
50
|
-
for (var l in o)
|
|
51
|
-
l !== "key" && (u[l] = o[l]);
|
|
52
|
-
} else u = o;
|
|
53
|
-
return o = u.ref, {
|
|
54
|
-
$$typeof: e,
|
|
55
|
-
type: r,
|
|
56
|
-
key: a,
|
|
57
|
-
ref: o !== void 0 ? o : null,
|
|
58
|
-
props: u
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return Ce.Fragment = n, Ce.jsx = t, Ce.jsxs = t, Ce;
|
|
62
|
-
}
|
|
63
|
-
var Ae = {};
|
|
64
|
-
/**
|
|
65
|
-
* @license React
|
|
66
|
-
* react-jsx-runtime.development.js
|
|
67
|
-
*
|
|
68
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the MIT license found in the
|
|
71
|
-
* LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/
|
|
73
|
-
var Nt;
|
|
74
|
-
function Sn() {
|
|
75
|
-
return Nt || (Nt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
76
|
-
function e(c) {
|
|
77
|
-
if (c == null) return null;
|
|
78
|
-
if (typeof c == "function")
|
|
79
|
-
return c.$$typeof === G ? null : c.displayName || c.name || null;
|
|
80
|
-
if (typeof c == "string") return c;
|
|
81
|
-
switch (c) {
|
|
82
|
-
case d:
|
|
83
|
-
return "Fragment";
|
|
84
|
-
case f:
|
|
85
|
-
return "Profiler";
|
|
86
|
-
case g:
|
|
87
|
-
return "StrictMode";
|
|
88
|
-
case T:
|
|
89
|
-
return "Suspense";
|
|
90
|
-
case I:
|
|
91
|
-
return "SuspenseList";
|
|
92
|
-
case ae:
|
|
93
|
-
return "Activity";
|
|
94
|
-
}
|
|
95
|
-
if (typeof c == "object")
|
|
96
|
-
switch (typeof c.tag == "number" && console.error(
|
|
97
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
98
|
-
), c.$$typeof) {
|
|
99
|
-
case E:
|
|
100
|
-
return "Portal";
|
|
101
|
-
case O:
|
|
102
|
-
return (c.displayName || "Context") + ".Provider";
|
|
103
|
-
case w:
|
|
104
|
-
return (c._context.displayName || "Context") + ".Consumer";
|
|
105
|
-
case M:
|
|
106
|
-
var _ = c.render;
|
|
107
|
-
return c = c.displayName, c || (c = _.displayName || _.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
|
|
108
|
-
case q:
|
|
109
|
-
return _ = c.displayName || null, _ !== null ? _ : e(c.type) || "Memo";
|
|
110
|
-
case C:
|
|
111
|
-
_ = c._payload, c = c._init;
|
|
112
|
-
try {
|
|
113
|
-
return e(c(_));
|
|
114
|
-
} catch (b) {
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
function n(c) {
|
|
120
|
-
return "" + c;
|
|
121
|
-
}
|
|
122
|
-
function t(c) {
|
|
123
|
-
try {
|
|
124
|
-
n(c);
|
|
125
|
-
var _ = !1;
|
|
126
|
-
} catch (Y) {
|
|
127
|
-
_ = !0;
|
|
128
|
-
}
|
|
129
|
-
if (_) {
|
|
130
|
-
_ = console;
|
|
131
|
-
var b = _.error, x = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
132
|
-
return b.call(
|
|
133
|
-
_,
|
|
134
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
135
|
-
x
|
|
136
|
-
), n(c);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function r(c) {
|
|
140
|
-
if (c === d) return "<>";
|
|
141
|
-
if (typeof c == "object" && c !== null && c.$$typeof === C)
|
|
142
|
-
return "<...>";
|
|
143
|
-
try {
|
|
144
|
-
var _ = e(c);
|
|
145
|
-
return _ ? "<" + _ + ">" : "<...>";
|
|
146
|
-
} catch (b) {
|
|
147
|
-
return "<...>";
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function o() {
|
|
151
|
-
var c = X.A;
|
|
152
|
-
return c === null ? null : c.getOwner();
|
|
153
|
-
}
|
|
154
|
-
function u() {
|
|
155
|
-
return Error("react-stack-top-frame");
|
|
156
|
-
}
|
|
157
|
-
function a(c) {
|
|
158
|
-
if (he.call(c, "key")) {
|
|
159
|
-
var _ = Object.getOwnPropertyDescriptor(c, "key").get;
|
|
160
|
-
if (_ && _.isReactWarning) return !1;
|
|
161
|
-
}
|
|
162
|
-
return c.key !== void 0;
|
|
163
|
-
}
|
|
164
|
-
function l(c, _) {
|
|
165
|
-
function b() {
|
|
166
|
-
ie || (ie = !0, console.error(
|
|
167
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
168
|
-
_
|
|
169
|
-
));
|
|
170
|
-
}
|
|
171
|
-
b.isReactWarning = !0, Object.defineProperty(c, "key", {
|
|
172
|
-
get: b,
|
|
173
|
-
configurable: !0
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
function s() {
|
|
177
|
-
var c = e(this.type);
|
|
178
|
-
return Re[c] || (Re[c] = !0, console.error(
|
|
179
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
180
|
-
)), c = this.props.ref, c !== void 0 ? c : null;
|
|
181
|
-
}
|
|
182
|
-
function i(c, _, b, x, Y, $, Ee, me) {
|
|
183
|
-
return b = $.ref, c = {
|
|
184
|
-
$$typeof: p,
|
|
185
|
-
type: c,
|
|
186
|
-
key: _,
|
|
187
|
-
props: $,
|
|
188
|
-
_owner: Y
|
|
189
|
-
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(c, "ref", {
|
|
190
|
-
enumerable: !1,
|
|
191
|
-
get: s
|
|
192
|
-
}) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
|
|
193
|
-
configurable: !1,
|
|
194
|
-
enumerable: !1,
|
|
195
|
-
writable: !0,
|
|
196
|
-
value: 0
|
|
197
|
-
}), Object.defineProperty(c, "_debugInfo", {
|
|
198
|
-
configurable: !1,
|
|
199
|
-
enumerable: !1,
|
|
200
|
-
writable: !0,
|
|
201
|
-
value: null
|
|
202
|
-
}), Object.defineProperty(c, "_debugStack", {
|
|
203
|
-
configurable: !1,
|
|
204
|
-
enumerable: !1,
|
|
205
|
-
writable: !0,
|
|
206
|
-
value: Ee
|
|
207
|
-
}), Object.defineProperty(c, "_debugTask", {
|
|
208
|
-
configurable: !1,
|
|
209
|
-
enumerable: !1,
|
|
210
|
-
writable: !0,
|
|
211
|
-
value: me
|
|
212
|
-
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
213
|
-
}
|
|
214
|
-
function h(c, _, b, x, Y, $, Ee, me) {
|
|
215
|
-
var P = _.children;
|
|
216
|
-
if (P !== void 0)
|
|
217
|
-
if (x)
|
|
218
|
-
if (Q(P)) {
|
|
219
|
-
for (x = 0; x < P.length; x++)
|
|
220
|
-
m(P[x]);
|
|
221
|
-
Object.freeze && Object.freeze(P);
|
|
222
|
-
} else
|
|
223
|
-
console.error(
|
|
224
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
225
|
-
);
|
|
226
|
-
else m(P);
|
|
227
|
-
if (he.call(_, "key")) {
|
|
228
|
-
P = e(c);
|
|
229
|
-
var ce = Object.keys(_).filter(function(Me) {
|
|
230
|
-
return Me !== "key";
|
|
231
|
-
});
|
|
232
|
-
x = 0 < ce.length ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}", Te[P + x] || (ce = 0 < ce.length ? "{" + ce.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
233
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
234
|
-
let props = %s;
|
|
235
|
-
<%s {...props} />
|
|
236
|
-
React keys must be passed directly to JSX without using spread:
|
|
237
|
-
let props = %s;
|
|
238
|
-
<%s key={someKey} {...props} />`,
|
|
239
|
-
x,
|
|
240
|
-
P,
|
|
241
|
-
ce,
|
|
242
|
-
P
|
|
243
|
-
), Te[P + x] = !0);
|
|
244
|
-
}
|
|
245
|
-
if (P = null, b !== void 0 && (t(b), P = "" + b), a(_) && (t(_.key), P = "" + _.key), "key" in _) {
|
|
246
|
-
b = {};
|
|
247
|
-
for (var te in _)
|
|
248
|
-
te !== "key" && (b[te] = _[te]);
|
|
249
|
-
} else b = _;
|
|
250
|
-
return P && l(
|
|
251
|
-
b,
|
|
252
|
-
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
253
|
-
), i(
|
|
254
|
-
c,
|
|
255
|
-
P,
|
|
256
|
-
$,
|
|
257
|
-
Y,
|
|
258
|
-
o(),
|
|
259
|
-
b,
|
|
260
|
-
Ee,
|
|
261
|
-
me
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
function m(c) {
|
|
265
|
-
typeof c == "object" && c !== null && c.$$typeof === p && c._store && (c._store.validated = 1);
|
|
266
|
-
}
|
|
267
|
-
var v = be, p = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), O = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), q = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), ae = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), X = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, he = Object.prototype.hasOwnProperty, Q = Array.isArray, D = console.createTask ? console.createTask : function() {
|
|
268
|
-
return null;
|
|
269
|
-
};
|
|
270
|
-
v = {
|
|
271
|
-
react_stack_bottom_frame: function(c) {
|
|
272
|
-
return c();
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
var ie, Re = {}, Oe = v.react_stack_bottom_frame.bind(
|
|
276
|
-
v,
|
|
277
|
-
u
|
|
278
|
-
)(), ee = D(r(u)), Te = {};
|
|
279
|
-
Ae.Fragment = d, Ae.jsx = function(c, _, b, x, Y) {
|
|
280
|
-
var $ = 1e4 > X.recentlyCreatedOwnerStacks++;
|
|
281
|
-
return h(
|
|
282
|
-
c,
|
|
283
|
-
_,
|
|
284
|
-
b,
|
|
285
|
-
!1,
|
|
286
|
-
x,
|
|
287
|
-
Y,
|
|
288
|
-
$ ? Error("react-stack-top-frame") : Oe,
|
|
289
|
-
$ ? D(r(c)) : ee
|
|
290
|
-
);
|
|
291
|
-
}, Ae.jsxs = function(c, _, b, x, Y) {
|
|
292
|
-
var $ = 1e4 > X.recentlyCreatedOwnerStacks++;
|
|
293
|
-
return h(
|
|
294
|
-
c,
|
|
295
|
-
_,
|
|
296
|
-
b,
|
|
297
|
-
!0,
|
|
298
|
-
x,
|
|
299
|
-
Y,
|
|
300
|
-
$ ? Error("react-stack-top-frame") : Oe,
|
|
301
|
-
$ ? D(r(c)) : ee
|
|
302
|
-
);
|
|
303
|
-
};
|
|
304
|
-
})()), Ae;
|
|
305
|
-
}
|
|
306
|
-
var xt;
|
|
307
|
-
function wn() {
|
|
308
|
-
return xt || (xt = 1, process.env.NODE_ENV === "production" ? Pe.exports = _n() : Pe.exports = Sn()), Pe.exports;
|
|
309
|
-
}
|
|
310
|
-
var yn = wn();
|
|
311
|
-
class kt extends Error {
|
|
29
|
+
import { jsx as dn } from "react/jsx-runtime";
|
|
30
|
+
import we, { createContext as Wt, useState as Ge, useRef as z, useEffect as Ft, useContext as Vt, useCallback as Le, useLayoutEffect as fn, useMemo as Pt, useDebugValue as hn } from "react";
|
|
31
|
+
import { CodegenError as ke } from "@animaapp/anima-sdk";
|
|
32
|
+
class Ot extends Error {
|
|
312
33
|
constructor(n, t) {
|
|
313
34
|
super(n), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
314
35
|
}
|
|
315
36
|
}
|
|
316
|
-
function
|
|
37
|
+
function je(e) {
|
|
317
38
|
}
|
|
318
|
-
function
|
|
39
|
+
function pn(e) {
|
|
319
40
|
if (typeof e == "function")
|
|
320
41
|
throw new TypeError(
|
|
321
42
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
322
43
|
);
|
|
323
|
-
const { onEvent: n =
|
|
324
|
-
let
|
|
325
|
-
function
|
|
326
|
-
const g = a ? d.replace(/^\xEF\xBB\xBF/, "") : d, [
|
|
327
|
-
for (const O of
|
|
328
|
-
|
|
329
|
-
|
|
44
|
+
const { onEvent: n = je, onError: t = je, onRetry: s = je, onComment: i } = e;
|
|
45
|
+
let c = "", a = !0, l, r = "", o = "";
|
|
46
|
+
function f(d) {
|
|
47
|
+
const g = a ? d.replace(/^\xEF\xBB\xBF/, "") : d, [u, w] = gn(`${c}${g}`);
|
|
48
|
+
for (const O of u)
|
|
49
|
+
E(O);
|
|
50
|
+
c = w, a = !1;
|
|
330
51
|
}
|
|
331
|
-
function
|
|
52
|
+
function E(d) {
|
|
332
53
|
if (d === "") {
|
|
333
|
-
|
|
54
|
+
h();
|
|
334
55
|
return;
|
|
335
56
|
}
|
|
336
57
|
if (d.startsWith(":")) {
|
|
337
|
-
|
|
58
|
+
i && i(d.slice(d.startsWith(": ") ? 2 : 1));
|
|
338
59
|
return;
|
|
339
60
|
}
|
|
340
61
|
const g = d.indexOf(":");
|
|
341
62
|
if (g !== -1) {
|
|
342
|
-
const
|
|
343
|
-
|
|
63
|
+
const u = d.slice(0, g), w = d[g + 1] === " " ? 2 : 1, O = d.slice(g + w);
|
|
64
|
+
m(u, O, d);
|
|
344
65
|
return;
|
|
345
66
|
}
|
|
346
|
-
|
|
67
|
+
m(d, "", d);
|
|
347
68
|
}
|
|
348
|
-
function
|
|
69
|
+
function m(d, g, u) {
|
|
349
70
|
switch (d) {
|
|
350
71
|
case "event":
|
|
351
|
-
|
|
72
|
+
o = g;
|
|
352
73
|
break;
|
|
353
74
|
case "data":
|
|
354
|
-
|
|
75
|
+
r = `${r}${g}
|
|
355
76
|
`;
|
|
356
77
|
break;
|
|
357
78
|
case "id":
|
|
358
79
|
l = g.includes("\0") ? void 0 : g;
|
|
359
80
|
break;
|
|
360
81
|
case "retry":
|
|
361
|
-
/^\d+$/.test(g) ?
|
|
362
|
-
new
|
|
82
|
+
/^\d+$/.test(g) ? s(parseInt(g, 10)) : t(
|
|
83
|
+
new Ot(`Invalid \`retry\` value: "${g}"`, {
|
|
363
84
|
type: "invalid-retry",
|
|
364
85
|
value: g,
|
|
365
|
-
line:
|
|
86
|
+
line: u
|
|
366
87
|
})
|
|
367
88
|
);
|
|
368
89
|
break;
|
|
369
90
|
default:
|
|
370
91
|
t(
|
|
371
|
-
new
|
|
92
|
+
new Ot(
|
|
372
93
|
`Unknown field "${d.length > 20 ? `${d.slice(0, 20)}…` : d}"`,
|
|
373
|
-
{ type: "unknown-field", field: d, value: g, line:
|
|
94
|
+
{ type: "unknown-field", field: d, value: g, line: u }
|
|
374
95
|
)
|
|
375
96
|
);
|
|
376
97
|
break;
|
|
377
98
|
}
|
|
378
99
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
100
|
+
function h() {
|
|
101
|
+
r.length > 0 && n({
|
|
381
102
|
id: l,
|
|
382
|
-
event:
|
|
103
|
+
event: o || void 0,
|
|
383
104
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
384
105
|
// then remove the last character from the data buffer.
|
|
385
|
-
data:
|
|
386
|
-
`) ?
|
|
387
|
-
}), l = void 0,
|
|
106
|
+
data: r.endsWith(`
|
|
107
|
+
`) ? r.slice(0, -1) : r
|
|
108
|
+
}), l = void 0, r = "", o = "";
|
|
388
109
|
}
|
|
389
|
-
function
|
|
390
|
-
|
|
110
|
+
function p(d = {}) {
|
|
111
|
+
c && d.consume && E(c), a = !0, l = void 0, r = "", o = "", c = "";
|
|
391
112
|
}
|
|
392
|
-
return { feed:
|
|
113
|
+
return { feed: f, reset: p };
|
|
393
114
|
}
|
|
394
|
-
function
|
|
115
|
+
function gn(e) {
|
|
395
116
|
const n = [];
|
|
396
|
-
let t = "",
|
|
397
|
-
for (;
|
|
398
|
-
const
|
|
399
|
-
`,
|
|
117
|
+
let t = "", s = 0;
|
|
118
|
+
for (; s < e.length; ) {
|
|
119
|
+
const i = e.indexOf("\r", s), c = e.indexOf(`
|
|
120
|
+
`, s);
|
|
400
121
|
let a = -1;
|
|
401
|
-
if (
|
|
402
|
-
t = e.slice(
|
|
122
|
+
if (i !== -1 && c !== -1 ? a = Math.min(i, c) : i !== -1 ? i === e.length - 1 ? a = -1 : a = i : c !== -1 && (a = c), a === -1) {
|
|
123
|
+
t = e.slice(s);
|
|
403
124
|
break;
|
|
404
125
|
} else {
|
|
405
|
-
const l = e.slice(
|
|
406
|
-
n.push(l),
|
|
407
|
-
` &&
|
|
126
|
+
const l = e.slice(s, a);
|
|
127
|
+
n.push(l), s = a + 1, e[s - 1] === "\r" && e[s] === `
|
|
128
|
+
` && s++;
|
|
408
129
|
}
|
|
409
130
|
}
|
|
410
131
|
return [n, t];
|
|
411
132
|
}
|
|
412
|
-
class
|
|
133
|
+
class bt extends Event {
|
|
413
134
|
/**
|
|
414
135
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
415
136
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -418,8 +139,8 @@ class It extends Event {
|
|
|
418
139
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
419
140
|
*/
|
|
420
141
|
constructor(n, t) {
|
|
421
|
-
var
|
|
422
|
-
super(n), this.code = (
|
|
142
|
+
var s, i;
|
|
143
|
+
super(n), this.code = (s = t == null ? void 0 : t.code) != null ? s : void 0, this.message = (i = t == null ? void 0 : t.message) != null ? i : void 0;
|
|
423
144
|
}
|
|
424
145
|
/**
|
|
425
146
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -433,8 +154,8 @@ class It extends Event {
|
|
|
433
154
|
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
434
155
|
* @returns A string representation of the error
|
|
435
156
|
*/
|
|
436
|
-
[Symbol.for("nodejs.util.inspect.custom")](n, t,
|
|
437
|
-
return
|
|
157
|
+
[Symbol.for("nodejs.util.inspect.custom")](n, t, s) {
|
|
158
|
+
return s(Rt(this), t);
|
|
438
159
|
}
|
|
439
160
|
/**
|
|
440
161
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -448,17 +169,17 @@ class It extends Event {
|
|
|
448
169
|
* @returns A string representation of the error
|
|
449
170
|
*/
|
|
450
171
|
[Symbol.for("Deno.customInspect")](n, t) {
|
|
451
|
-
return n(
|
|
172
|
+
return n(Rt(this), t);
|
|
452
173
|
}
|
|
453
174
|
}
|
|
454
|
-
function
|
|
175
|
+
function En(e) {
|
|
455
176
|
const n = globalThis.DOMException;
|
|
456
177
|
return typeof n == "function" ? new n(e, "SyntaxError") : new SyntaxError(e);
|
|
457
178
|
}
|
|
458
|
-
function
|
|
459
|
-
return e instanceof Error ? "errors" in e && Array.isArray(e.errors) ? e.errors.map(
|
|
179
|
+
function Be(e) {
|
|
180
|
+
return e instanceof Error ? "errors" in e && Array.isArray(e.errors) ? e.errors.map(Be).join(", ") : "cause" in e && e.cause instanceof Error ? `${e}: ${Be(e.cause)}` : e.message : `${e}`;
|
|
460
181
|
}
|
|
461
|
-
function
|
|
182
|
+
function Rt(e) {
|
|
462
183
|
return {
|
|
463
184
|
type: e.type,
|
|
464
185
|
message: e.message,
|
|
@@ -468,71 +189,71 @@ function Dt(e) {
|
|
|
468
189
|
timeStamp: e.timeStamp
|
|
469
190
|
};
|
|
470
191
|
}
|
|
471
|
-
var
|
|
192
|
+
var $t = (e) => {
|
|
472
193
|
throw TypeError(e);
|
|
473
|
-
},
|
|
474
|
-
class
|
|
194
|
+
}, ct = (e, n, t) => n.has(e) || $t("Cannot " + t), S = (e, n, t) => (ct(e, n, "read from private field"), t ? t.call(e) : n.get(e)), I = (e, n, t) => n.has(e) ? $t("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), R = (e, n, t, s) => (ct(e, n, "write to private field"), n.set(e, t), t), H = (e, n, t) => (ct(e, n, "access private method"), t), W, te, ie, Ie, De, Ee, le, me, Y, ce, de, ue, pe, $, He, Ke, ze, Tt, Ye, Xe, ge, Qe, Ze;
|
|
195
|
+
class Se extends EventTarget {
|
|
475
196
|
constructor(n, t) {
|
|
476
|
-
var
|
|
477
|
-
super(),
|
|
197
|
+
var s, i;
|
|
198
|
+
super(), I(this, $), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, I(this, W), I(this, te), I(this, ie), I(this, Ie), I(this, De), I(this, Ee), I(this, le), I(this, me, null), I(this, Y), I(this, ce), I(this, de, null), I(this, ue, null), I(this, pe, null), I(this, Ke, (c) => V(this, null, function* () {
|
|
478
199
|
var a;
|
|
479
|
-
S(this,
|
|
480
|
-
const { body: l, redirected:
|
|
481
|
-
if (
|
|
482
|
-
|
|
200
|
+
S(this, ce).reset();
|
|
201
|
+
const { body: l, redirected: r, status: o, headers: f } = c;
|
|
202
|
+
if (o === 204) {
|
|
203
|
+
H(this, $, ge).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
483
204
|
return;
|
|
484
205
|
}
|
|
485
|
-
if (
|
|
486
|
-
|
|
206
|
+
if (r ? R(this, ie, new URL(c.url)) : R(this, ie, void 0), o !== 200) {
|
|
207
|
+
H(this, $, ge).call(this, `Non-200 status code (${o})`, o);
|
|
487
208
|
return;
|
|
488
209
|
}
|
|
489
|
-
if (!(
|
|
490
|
-
|
|
210
|
+
if (!(f.get("content-type") || "").startsWith("text/event-stream")) {
|
|
211
|
+
H(this, $, ge).call(this, 'Invalid content type, expected "text/event-stream"', o);
|
|
491
212
|
return;
|
|
492
213
|
}
|
|
493
|
-
if (S(this,
|
|
214
|
+
if (S(this, W) === this.CLOSED)
|
|
494
215
|
return;
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
if ((a = S(this,
|
|
498
|
-
|
|
216
|
+
R(this, W, this.OPEN);
|
|
217
|
+
const E = new Event("open");
|
|
218
|
+
if ((a = S(this, pe)) == null || a.call(this, E), this.dispatchEvent(E), typeof l != "object" || !l || !("getReader" in l)) {
|
|
219
|
+
H(this, $, ge).call(this, "Invalid response body, expected a web ReadableStream", o), this.close();
|
|
499
220
|
return;
|
|
500
221
|
}
|
|
501
|
-
const
|
|
502
|
-
let
|
|
222
|
+
const m = new TextDecoder(), h = l.getReader();
|
|
223
|
+
let p = !0;
|
|
503
224
|
do {
|
|
504
|
-
const { done: d, value: g } = yield
|
|
505
|
-
g && S(this,
|
|
506
|
-
} while (
|
|
507
|
-
})),
|
|
508
|
-
|
|
509
|
-
}),
|
|
510
|
-
typeof
|
|
511
|
-
const a = new MessageEvent(
|
|
512
|
-
data:
|
|
513
|
-
origin: S(this,
|
|
514
|
-
lastEventId:
|
|
225
|
+
const { done: d, value: g } = yield h.read();
|
|
226
|
+
g && S(this, ce).feed(m.decode(g, { stream: !d })), d && (p = !1, S(this, ce).reset(), H(this, $, Qe).call(this));
|
|
227
|
+
} while (p);
|
|
228
|
+
})), I(this, ze, (c) => {
|
|
229
|
+
R(this, Y, void 0), !(c.name === "AbortError" || c.type === "aborted") && H(this, $, Qe).call(this, Be(c));
|
|
230
|
+
}), I(this, Ye, (c) => {
|
|
231
|
+
typeof c.id == "string" && R(this, me, c.id);
|
|
232
|
+
const a = new MessageEvent(c.event || "message", {
|
|
233
|
+
data: c.data,
|
|
234
|
+
origin: S(this, ie) ? S(this, ie).origin : S(this, te).origin,
|
|
235
|
+
lastEventId: c.id || ""
|
|
515
236
|
});
|
|
516
|
-
S(this,
|
|
517
|
-
}),
|
|
518
|
-
|
|
519
|
-
}),
|
|
520
|
-
|
|
237
|
+
S(this, ue) && (!c.event || c.event === "message") && S(this, ue).call(this, a), this.dispatchEvent(a);
|
|
238
|
+
}), I(this, Xe, (c) => {
|
|
239
|
+
R(this, Ee, c);
|
|
240
|
+
}), I(this, Ze, () => {
|
|
241
|
+
R(this, le, void 0), S(this, W) === this.CONNECTING && H(this, $, He).call(this);
|
|
521
242
|
});
|
|
522
243
|
try {
|
|
523
244
|
if (n instanceof URL)
|
|
524
|
-
|
|
245
|
+
R(this, te, n);
|
|
525
246
|
else if (typeof n == "string")
|
|
526
|
-
|
|
247
|
+
R(this, te, new URL(n, mn()));
|
|
527
248
|
else
|
|
528
249
|
throw new Error("Invalid URL");
|
|
529
|
-
} catch (
|
|
530
|
-
throw
|
|
250
|
+
} catch (c) {
|
|
251
|
+
throw En("An invalid or illegal string was specified");
|
|
531
252
|
}
|
|
532
|
-
|
|
533
|
-
onEvent: S(this,
|
|
534
|
-
onRetry: S(this,
|
|
535
|
-
})),
|
|
253
|
+
R(this, ce, pn({
|
|
254
|
+
onEvent: S(this, Ye),
|
|
255
|
+
onRetry: S(this, Xe)
|
|
256
|
+
})), R(this, W, this.CONNECTING), R(this, Ee, 3e3), R(this, De, (s = t == null ? void 0 : t.fetch) != null ? s : globalThis.fetch), R(this, Ie, (i = t == null ? void 0 : t.withCredentials) != null ? i : !1), H(this, $, He).call(this);
|
|
536
257
|
}
|
|
537
258
|
/**
|
|
538
259
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -545,7 +266,7 @@ class Ie extends EventTarget {
|
|
|
545
266
|
* @public
|
|
546
267
|
*/
|
|
547
268
|
get readyState() {
|
|
548
|
-
return S(this,
|
|
269
|
+
return S(this, W);
|
|
549
270
|
}
|
|
550
271
|
/**
|
|
551
272
|
* Returns the URL providing the event stream.
|
|
@@ -555,7 +276,7 @@ class Ie extends EventTarget {
|
|
|
555
276
|
* @public
|
|
556
277
|
*/
|
|
557
278
|
get url() {
|
|
558
|
-
return S(this,
|
|
279
|
+
return S(this, te).href;
|
|
559
280
|
}
|
|
560
281
|
/**
|
|
561
282
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -563,36 +284,36 @@ class Ie extends EventTarget {
|
|
|
563
284
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
564
285
|
*/
|
|
565
286
|
get withCredentials() {
|
|
566
|
-
return S(this,
|
|
287
|
+
return S(this, Ie);
|
|
567
288
|
}
|
|
568
289
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
569
290
|
get onerror() {
|
|
570
|
-
return S(this,
|
|
291
|
+
return S(this, de);
|
|
571
292
|
}
|
|
572
293
|
set onerror(n) {
|
|
573
|
-
|
|
294
|
+
R(this, de, n);
|
|
574
295
|
}
|
|
575
296
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
576
297
|
get onmessage() {
|
|
577
|
-
return S(this,
|
|
298
|
+
return S(this, ue);
|
|
578
299
|
}
|
|
579
300
|
set onmessage(n) {
|
|
580
|
-
|
|
301
|
+
R(this, ue, n);
|
|
581
302
|
}
|
|
582
303
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
583
304
|
get onopen() {
|
|
584
|
-
return S(this,
|
|
305
|
+
return S(this, pe);
|
|
585
306
|
}
|
|
586
307
|
set onopen(n) {
|
|
587
|
-
|
|
308
|
+
R(this, pe, n);
|
|
588
309
|
}
|
|
589
|
-
addEventListener(n, t,
|
|
590
|
-
const
|
|
591
|
-
super.addEventListener(n,
|
|
310
|
+
addEventListener(n, t, s) {
|
|
311
|
+
const i = t;
|
|
312
|
+
super.addEventListener(n, i, s);
|
|
592
313
|
}
|
|
593
|
-
removeEventListener(n, t,
|
|
594
|
-
const
|
|
595
|
-
super.removeEventListener(n,
|
|
314
|
+
removeEventListener(n, t, s) {
|
|
315
|
+
const i = t;
|
|
316
|
+
super.removeEventListener(n, i, s);
|
|
596
317
|
}
|
|
597
318
|
/**
|
|
598
319
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -602,46 +323,46 @@ class Ie extends EventTarget {
|
|
|
602
323
|
* @public
|
|
603
324
|
*/
|
|
604
325
|
close() {
|
|
605
|
-
S(this,
|
|
326
|
+
S(this, le) && clearTimeout(S(this, le)), S(this, W) !== this.CLOSED && (S(this, Y) && S(this, Y).abort(), R(this, W, this.CLOSED), R(this, Y, void 0));
|
|
606
327
|
}
|
|
607
328
|
}
|
|
608
|
-
|
|
329
|
+
W = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), /**
|
|
609
330
|
* Connect to the given URL and start receiving events
|
|
610
331
|
*
|
|
611
332
|
* @internal
|
|
612
333
|
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
},
|
|
334
|
+
He = function() {
|
|
335
|
+
R(this, W, this.CONNECTING), R(this, Y, new AbortController()), S(this, De)(S(this, te), H(this, $, Tt).call(this)).then(S(this, Ke)).catch(S(this, ze));
|
|
336
|
+
}, Ke = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), /**
|
|
616
337
|
* Get request options for the `fetch()` request
|
|
617
338
|
*
|
|
618
339
|
* @returns The request options
|
|
619
340
|
* @internal
|
|
620
341
|
*/
|
|
621
|
-
|
|
342
|
+
Tt = function() {
|
|
622
343
|
var e;
|
|
623
344
|
const n = {
|
|
624
345
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
625
346
|
// [spec] …will have their mode set to "cors"…
|
|
626
347
|
mode: "cors",
|
|
627
348
|
redirect: "follow",
|
|
628
|
-
headers:
|
|
349
|
+
headers: L({ Accept: "text/event-stream" }, S(this, me) ? { "Last-Event-ID": S(this, me) } : void 0),
|
|
629
350
|
cache: "no-store",
|
|
630
|
-
signal: (e = S(this,
|
|
351
|
+
signal: (e = S(this, Y)) == null ? void 0 : e.signal
|
|
631
352
|
};
|
|
632
353
|
return "window" in globalThis && (n.credentials = this.withCredentials ? "include" : "same-origin"), n;
|
|
633
|
-
},
|
|
354
|
+
}, Ye = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), /**
|
|
634
355
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
635
356
|
*
|
|
636
357
|
* @param error - The error causing the connection to fail
|
|
637
358
|
* @param code - The HTTP status code, if available
|
|
638
359
|
* @internal
|
|
639
360
|
*/
|
|
640
|
-
|
|
361
|
+
ge = function(e, n) {
|
|
641
362
|
var t;
|
|
642
|
-
S(this,
|
|
643
|
-
const
|
|
644
|
-
(t = S(this,
|
|
363
|
+
S(this, W) !== this.CLOSED && R(this, W, this.CLOSED);
|
|
364
|
+
const s = new bt("error", { code: n, message: e });
|
|
365
|
+
(t = S(this, de)) == null || t.call(this, s), this.dispatchEvent(s);
|
|
645
366
|
}, /**
|
|
646
367
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
647
368
|
*
|
|
@@ -649,40 +370,40 @@ Ne = function(e, n) {
|
|
|
649
370
|
* @param code - The HTTP status code, if available
|
|
650
371
|
* @internal
|
|
651
372
|
*/
|
|
652
|
-
|
|
373
|
+
Qe = function(e, n) {
|
|
653
374
|
var t;
|
|
654
|
-
if (S(this,
|
|
375
|
+
if (S(this, W) === this.CLOSED)
|
|
655
376
|
return;
|
|
656
|
-
|
|
657
|
-
const
|
|
658
|
-
(t = S(this,
|
|
659
|
-
},
|
|
377
|
+
R(this, W, this.CONNECTING);
|
|
378
|
+
const s = new bt("error", { code: n, message: e });
|
|
379
|
+
(t = S(this, de)) == null || t.call(this, s), this.dispatchEvent(s), R(this, le, setTimeout(S(this, Ze), S(this, Ee)));
|
|
380
|
+
}, Ze = /* @__PURE__ */ new WeakMap(), /**
|
|
660
381
|
* ReadyState representing an EventSource currently trying to connect
|
|
661
382
|
*
|
|
662
383
|
* @public
|
|
663
384
|
*/
|
|
664
|
-
|
|
385
|
+
Se.CONNECTING = 0, /**
|
|
665
386
|
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
666
387
|
*
|
|
667
388
|
* @public
|
|
668
389
|
*/
|
|
669
|
-
|
|
390
|
+
Se.OPEN = 1, /**
|
|
670
391
|
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
671
392
|
*
|
|
672
393
|
* @public
|
|
673
394
|
*/
|
|
674
|
-
|
|
675
|
-
function
|
|
395
|
+
Se.CLOSED = 2;
|
|
396
|
+
function mn() {
|
|
676
397
|
const e = "document" in globalThis ? globalThis.document : void 0;
|
|
677
398
|
return e && typeof e == "object" && "baseURI" in e && typeof e.baseURI == "string" ? e.baseURI : void 0;
|
|
678
399
|
}
|
|
679
|
-
const
|
|
400
|
+
const Sn = (e) => {
|
|
680
401
|
let n = "";
|
|
681
|
-
const t = new Uint8Array(e),
|
|
682
|
-
for (let
|
|
683
|
-
n += String.fromCharCode(t[
|
|
402
|
+
const t = new Uint8Array(e), s = t.byteLength;
|
|
403
|
+
for (let i = 0; i < s; i++)
|
|
404
|
+
n += String.fromCharCode(t[i]);
|
|
684
405
|
return btoa(n);
|
|
685
|
-
},
|
|
406
|
+
}, ut = {
|
|
686
407
|
status: "idle",
|
|
687
408
|
error: null,
|
|
688
409
|
result: null,
|
|
@@ -695,348 +416,348 @@ const Cn = (e) => {
|
|
|
695
416
|
jobSessionId: null,
|
|
696
417
|
jobStatus: {},
|
|
697
418
|
jobType: null
|
|
698
|
-
},
|
|
419
|
+
}, Ct = 10, Ut = (e) => "path" in e ? {
|
|
699
420
|
filePath: e.path.replace(/^\//, ""),
|
|
700
421
|
referencePath: e.path === "/" ? "" : e.path
|
|
701
422
|
// Workaround to avoid duplicated slashes in the URL. Ideally, the fix should be done in Codegen.
|
|
702
423
|
} : {
|
|
703
424
|
filePath: e.filePath.replace(/^\//, ""),
|
|
704
425
|
referencePath: e.referencePath === "/" ? "" : e.referencePath
|
|
705
|
-
},
|
|
426
|
+
}, Jt = ({
|
|
706
427
|
es: e,
|
|
707
428
|
lastFetchResponse: n,
|
|
708
429
|
stateUpdated: t
|
|
709
430
|
}) => {
|
|
710
|
-
const
|
|
711
|
-
return
|
|
431
|
+
const s = structuredClone(ut);
|
|
432
|
+
return s.status = "pending", t(L({}, s)), new Promise((i, c) => {
|
|
712
433
|
const a = {};
|
|
713
|
-
e.addEventListener("set_job_type", (
|
|
714
|
-
const
|
|
715
|
-
|
|
434
|
+
e.addEventListener("set_job_type", (r) => {
|
|
435
|
+
const o = JSON.parse(
|
|
436
|
+
r.data
|
|
716
437
|
);
|
|
717
|
-
|
|
718
|
-
}), e.addEventListener("start", (
|
|
719
|
-
const
|
|
720
|
-
a.sessionId =
|
|
721
|
-
}), e.addEventListener("queueing", (
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
}), e.addEventListener("pre_codegen", (
|
|
438
|
+
s.jobType = o.payload.jobType, t(L({}, s));
|
|
439
|
+
}), e.addEventListener("start", (r) => {
|
|
440
|
+
const o = JSON.parse(r.data);
|
|
441
|
+
a.sessionId = o.sessionId, s.tasks.fetchDesign.status = "running", s.jobSessionId = o.sessionId, t(L({}, s));
|
|
442
|
+
}), e.addEventListener("queueing", (r) => {
|
|
443
|
+
const o = JSON.parse(r.data);
|
|
444
|
+
s.jobSessionId = o.payload.sessionId, t(L({}, s));
|
|
445
|
+
}), e.addEventListener("pre_codegen", (r) => {
|
|
725
446
|
JSON.parse(
|
|
726
|
-
|
|
727
|
-
).message === "Anima model built" && (
|
|
728
|
-
}), e.addEventListener("figma_metadata", (
|
|
729
|
-
const
|
|
730
|
-
|
|
447
|
+
r.data
|
|
448
|
+
).message === "Anima model built" && (s.tasks.fetchDesign.status = "finished", s.tasks.codeGeneration.status = "running", s.tasks.uploadAssets.status = "running", t(L({}, s)));
|
|
449
|
+
}), e.addEventListener("figma_metadata", (r) => {
|
|
450
|
+
const o = JSON.parse(
|
|
451
|
+
r.data
|
|
731
452
|
);
|
|
732
|
-
a.figmaFileName =
|
|
453
|
+
a.figmaFileName = o.figmaFileName, a.figmaSelectedFrameName = o.figmaSelectedFrameName;
|
|
733
454
|
}), e.addEventListener("aborted", () => {
|
|
734
|
-
const
|
|
735
|
-
|
|
455
|
+
const r = new ke({ name: "Aborted", reason: "Unknown" });
|
|
456
|
+
s.status = "aborted", s.result = null, s.error = r, t(L({}, s)), i({
|
|
736
457
|
result: null,
|
|
737
|
-
error:
|
|
458
|
+
error: r
|
|
738
459
|
});
|
|
739
|
-
}), e.addEventListener("generating_code", (
|
|
740
|
-
const
|
|
741
|
-
|
|
460
|
+
}), e.addEventListener("generating_code", (r) => {
|
|
461
|
+
const o = JSON.parse(
|
|
462
|
+
r.data
|
|
742
463
|
);
|
|
743
|
-
|
|
744
|
-
}), e.addEventListener("progress_messages_updated", (
|
|
745
|
-
const
|
|
746
|
-
|
|
464
|
+
o.payload.status === "success" && (a.files = o.payload.files), s.tasks.codeGeneration.progress = o.payload.progress, s.tasks.codeGeneration.status = "running", t(L({}, s));
|
|
465
|
+
}), e.addEventListener("progress_messages_updated", (r) => {
|
|
466
|
+
const o = JSON.parse(
|
|
467
|
+
r.data
|
|
747
468
|
);
|
|
748
|
-
|
|
749
|
-
}), e.addEventListener("job_status_updated", (
|
|
750
|
-
const
|
|
751
|
-
|
|
469
|
+
s.progressMessages = o.payload.progressMessages, t(L({}, s));
|
|
470
|
+
}), e.addEventListener("job_status_updated", (r) => {
|
|
471
|
+
const o = JSON.parse(
|
|
472
|
+
r.data
|
|
752
473
|
);
|
|
753
|
-
|
|
474
|
+
s.jobStatus = o.payload.jobStatus, t(L({}, s));
|
|
754
475
|
}), e.addEventListener("codegen_completed", () => {
|
|
755
|
-
|
|
476
|
+
s.tasks.codeGeneration.status = "finished", t(L({}, s));
|
|
756
477
|
}), e.addEventListener("generation_completed", () => {
|
|
757
|
-
|
|
478
|
+
s.tasks.codeGeneration.status = "finished", t(L({}, s));
|
|
758
479
|
}), e.addEventListener("assets_uploaded", () => {
|
|
759
|
-
|
|
760
|
-
}), e.addEventListener("assets_list", (
|
|
761
|
-
const
|
|
762
|
-
|
|
480
|
+
s.tasks.uploadAssets.status = "finished", t(L({}, s));
|
|
481
|
+
}), e.addEventListener("assets_list", (r) => {
|
|
482
|
+
const o = JSON.parse(
|
|
483
|
+
r.data
|
|
763
484
|
);
|
|
764
|
-
a.assets =
|
|
485
|
+
a.assets = o.payload.assets;
|
|
765
486
|
});
|
|
766
487
|
let l = 0;
|
|
767
|
-
e.addEventListener("error", (
|
|
768
|
-
var
|
|
488
|
+
e.addEventListener("error", (r) => V(null, null, function* () {
|
|
489
|
+
var p, d, g, u, w, O, x;
|
|
769
490
|
if (!n)
|
|
770
491
|
return;
|
|
771
|
-
const
|
|
772
|
-
if (!
|
|
773
|
-
let
|
|
492
|
+
const o = yield n;
|
|
493
|
+
if (!o.ok) {
|
|
494
|
+
let b = "";
|
|
774
495
|
try {
|
|
775
|
-
|
|
776
|
-
const
|
|
777
|
-
(
|
|
778
|
-
} catch (
|
|
496
|
+
b = yield o.text();
|
|
497
|
+
const D = JSON.parse(b);
|
|
498
|
+
(p = D == null ? void 0 : D.payload) != null && p.message && (b = D.payload.message);
|
|
499
|
+
} catch (D) {
|
|
779
500
|
}
|
|
780
|
-
|
|
781
|
-
new
|
|
501
|
+
c(
|
|
502
|
+
new ke({
|
|
782
503
|
name: "Request failed",
|
|
783
504
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
784
|
-
reason:
|
|
785
|
-
status:
|
|
505
|
+
reason: b,
|
|
506
|
+
status: o.status
|
|
786
507
|
})
|
|
787
508
|
), e.close();
|
|
788
509
|
return;
|
|
789
510
|
}
|
|
790
511
|
console.warn(
|
|
791
|
-
`Experienced error during code generation (attempt ${l + 1} / ${
|
|
792
|
-
|
|
512
|
+
`Experienced error during code generation (attempt ${l + 1} / ${Ct})`,
|
|
513
|
+
r
|
|
793
514
|
);
|
|
794
|
-
let
|
|
795
|
-
if (
|
|
515
|
+
let f, E = !1;
|
|
516
|
+
if (r instanceof MessageEvent)
|
|
796
517
|
try {
|
|
797
|
-
|
|
798
|
-
} catch (
|
|
518
|
+
f = JSON.parse(r.data);
|
|
519
|
+
} catch (b) {
|
|
799
520
|
}
|
|
800
|
-
(((d =
|
|
801
|
-
const
|
|
802
|
-
name: (O =
|
|
803
|
-
reason: (
|
|
804
|
-
status:
|
|
805
|
-
detail:
|
|
521
|
+
(((d = f == null ? void 0 : f.payload) == null ? void 0 : d.name) === "Task Crashed" || ((g = f == null ? void 0 : f.payload) == null ? void 0 : g.name) === "TimeoutError" || ((u = f == null ? void 0 : f.payload) == null ? void 0 : u.name) === "Error" || ((w = f == null ? void 0 : f.payload) == null ? void 0 : w.name) === "Unknown error") && (E = !0);
|
|
522
|
+
const m = new ke({
|
|
523
|
+
name: (O = f == null ? void 0 : f.payload.name) != null ? O : "Unknown error",
|
|
524
|
+
reason: (x = f == null ? void 0 : f.payload.message) != null ? x : "Unknown",
|
|
525
|
+
status: f == null ? void 0 : f.payload.status,
|
|
526
|
+
detail: f == null ? void 0 : f.payload.detail
|
|
806
527
|
});
|
|
807
528
|
l++;
|
|
808
|
-
let
|
|
809
|
-
l >
|
|
529
|
+
let h = !1;
|
|
530
|
+
l > Ct ? (console.error("Experienced too many errors, terminating request"), h = !0) : E && (console.error("Experienced unrecoverable error, terminating request"), h = !0), h && (s.status = "error", s.error = m, t(L({}, s)), i({
|
|
810
531
|
result: null,
|
|
811
|
-
error:
|
|
532
|
+
error: m
|
|
812
533
|
}));
|
|
813
|
-
})), e.addEventListener("done", (
|
|
814
|
-
const
|
|
815
|
-
a.tokenUsage =
|
|
534
|
+
})), e.addEventListener("done", (r) => {
|
|
535
|
+
const o = JSON.parse(r.data);
|
|
536
|
+
a.tokenUsage = o.payload.tokenUsage, a.sessionId = o.payload.sessionId, s.status = "success", s.result = a, t(L({}, s)), i({ result: a, error: null });
|
|
816
537
|
});
|
|
817
538
|
});
|
|
818
|
-
},
|
|
539
|
+
}, qt = (e, n, t, s) => V(null, null, function* () {
|
|
819
540
|
var l;
|
|
820
|
-
const
|
|
541
|
+
const i = structuredClone(t);
|
|
821
542
|
if (((l = t.assetsStorage) == null ? void 0 : l.strategy) === "local") {
|
|
822
|
-
const { referencePath:
|
|
543
|
+
const { referencePath: r } = Ut(
|
|
823
544
|
t.assetsStorage
|
|
824
545
|
);
|
|
825
|
-
t.assetsStorage = { strategy: "external", url:
|
|
546
|
+
t.assetsStorage = { strategy: "external", url: r };
|
|
826
547
|
}
|
|
827
|
-
let
|
|
828
|
-
const a = new
|
|
829
|
-
fetch: (
|
|
548
|
+
let c;
|
|
549
|
+
const a = new Se(e, {
|
|
550
|
+
fetch: (r, o) => (c = fetch(r, Me(L({}, o), {
|
|
830
551
|
method: n,
|
|
831
552
|
body: JSON.stringify(t)
|
|
832
|
-
})),
|
|
553
|
+
})), c)
|
|
833
554
|
});
|
|
834
555
|
try {
|
|
835
|
-
const { result:
|
|
556
|
+
const { result: r, error: o } = yield Jt({
|
|
836
557
|
es: a,
|
|
837
|
-
lastFetchResponse:
|
|
838
|
-
stateUpdated:
|
|
558
|
+
lastFetchResponse: c,
|
|
559
|
+
stateUpdated: s
|
|
839
560
|
});
|
|
840
|
-
if (
|
|
841
|
-
return { result: null, error:
|
|
842
|
-
const
|
|
843
|
-
return
|
|
561
|
+
if (o || !r)
|
|
562
|
+
return { result: null, error: o };
|
|
563
|
+
const f = structuredClone(r);
|
|
564
|
+
return Gt(f, i), { result: f, error: null };
|
|
844
565
|
} finally {
|
|
845
566
|
a.close();
|
|
846
567
|
}
|
|
847
|
-
}),
|
|
848
|
-
const
|
|
849
|
-
let
|
|
850
|
-
const
|
|
851
|
-
fetch: (a, l) => (
|
|
568
|
+
}), vn = (e, n, t) => V(null, null, function* () {
|
|
569
|
+
const s = structuredClone(n);
|
|
570
|
+
let i;
|
|
571
|
+
const c = new Se(e, {
|
|
572
|
+
fetch: (a, l) => (i = fetch(a, Me(L({}, l), {
|
|
852
573
|
method: "POST",
|
|
853
574
|
body: JSON.stringify(n)
|
|
854
|
-
})),
|
|
575
|
+
})), i)
|
|
855
576
|
});
|
|
856
577
|
try {
|
|
857
|
-
const { result: a, error: l } = yield
|
|
858
|
-
es:
|
|
859
|
-
lastFetchResponse:
|
|
578
|
+
const { result: a, error: l } = yield Jt({
|
|
579
|
+
es: c,
|
|
580
|
+
lastFetchResponse: i,
|
|
860
581
|
stateUpdated: t
|
|
861
582
|
});
|
|
862
583
|
if (l || !a)
|
|
863
584
|
return { result: null, error: l };
|
|
864
|
-
const
|
|
865
|
-
return
|
|
585
|
+
const r = structuredClone(a);
|
|
586
|
+
return Gt(r, s), { result: r, error: null };
|
|
866
587
|
} finally {
|
|
867
|
-
|
|
588
|
+
c.close();
|
|
868
589
|
}
|
|
869
|
-
}),
|
|
870
|
-
var t,
|
|
871
|
-
if (((t = n.assetsStorage) == null ? void 0 : t.strategy) === "local" && ((
|
|
872
|
-
const { filePath:
|
|
873
|
-
(l) =>
|
|
874
|
-
const
|
|
590
|
+
}), Gt = (e, n) => V(null, null, function* () {
|
|
591
|
+
var t, s;
|
|
592
|
+
if (((t = n.assetsStorage) == null ? void 0 : t.strategy) === "local" && ((s = e.assets) != null && s.length)) {
|
|
593
|
+
const { filePath: i } = Ut(n.assetsStorage), c = e.assets.map(
|
|
594
|
+
(l) => V(null, null, function* () {
|
|
595
|
+
const o = yield (yield fetch(l.url)).arrayBuffer();
|
|
875
596
|
return {
|
|
876
597
|
assetName: l.name,
|
|
877
|
-
base64:
|
|
598
|
+
base64: Sn(o)
|
|
878
599
|
};
|
|
879
600
|
})
|
|
880
|
-
), a = yield Promise.allSettled(
|
|
601
|
+
), a = yield Promise.allSettled(c);
|
|
881
602
|
for (const l of a)
|
|
882
603
|
if (l.status === "fulfilled") {
|
|
883
|
-
const { assetName:
|
|
884
|
-
e.files[
|
|
885
|
-
content:
|
|
604
|
+
const { assetName: r, base64: o } = l.value, f = i ? `${i}/${r}` : r;
|
|
605
|
+
e.files[f] = {
|
|
606
|
+
content: o,
|
|
886
607
|
isBinary: !0
|
|
887
608
|
};
|
|
888
609
|
}
|
|
889
610
|
}
|
|
890
611
|
});
|
|
891
|
-
class
|
|
612
|
+
class wn extends Error {
|
|
892
613
|
constructor(n, t) {
|
|
893
614
|
super(n), this.name = "CreateJobError", this.cause = t;
|
|
894
615
|
}
|
|
895
616
|
}
|
|
896
|
-
class
|
|
617
|
+
class _n extends Error {
|
|
897
618
|
constructor(n, t) {
|
|
898
619
|
super(n), this.name = "AttachJobError", this.cause = t;
|
|
899
620
|
}
|
|
900
621
|
}
|
|
901
|
-
class
|
|
622
|
+
class yn extends Error {
|
|
902
623
|
constructor() {
|
|
903
624
|
super(""), this.name = "UnknownCodegenError";
|
|
904
625
|
}
|
|
905
626
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
-
const [a, l] =
|
|
627
|
+
const Bt = Wt(null);
|
|
628
|
+
function us({ figmaRestApi: e, f2cUrl: n, l2cUrl: t, p2cUrl: s, jobsUrl: i, children: c }) {
|
|
629
|
+
const [a, l] = Ge({ status: "idle" }), r = z(null), [o, f] = Ge(ut), E = {
|
|
909
630
|
f2c: n,
|
|
910
631
|
l2c: t,
|
|
911
|
-
p2c:
|
|
912
|
-
},
|
|
632
|
+
p2c: s
|
|
633
|
+
}, m = (p, d) => V(null, null, function* () {
|
|
913
634
|
var g;
|
|
914
635
|
if (a.status === "pending")
|
|
915
636
|
throw new Error("A job is already in progress");
|
|
916
|
-
|
|
637
|
+
r.current = p;
|
|
917
638
|
try {
|
|
918
|
-
const
|
|
639
|
+
const u = E[p], { result: w } = yield qt(u, "POST", d, (O) => f(O));
|
|
919
640
|
if (w) {
|
|
920
|
-
const O = w.sessionId,
|
|
921
|
-
l((
|
|
641
|
+
const O = w.sessionId, x = w.files, b = w.assets;
|
|
642
|
+
l((D) => ({
|
|
922
643
|
status: "success",
|
|
923
|
-
type:
|
|
924
|
-
params: "params" in
|
|
644
|
+
type: p,
|
|
645
|
+
params: "params" in D ? D.params : {},
|
|
925
646
|
sessionId: O,
|
|
926
|
-
payload:
|
|
927
|
-
assets:
|
|
928
|
-
files:
|
|
929
|
-
progressMessages:
|
|
647
|
+
payload: o.jobStatus,
|
|
648
|
+
assets: b,
|
|
649
|
+
files: x,
|
|
650
|
+
progressMessages: o.progressMessages
|
|
930
651
|
}));
|
|
931
652
|
return;
|
|
932
653
|
}
|
|
933
|
-
} catch (
|
|
934
|
-
|
|
935
|
-
const w =
|
|
654
|
+
} catch (u) {
|
|
655
|
+
r.current = null;
|
|
656
|
+
const w = u instanceof Error ? u.message : "Unknown error", O = new wn(w, u);
|
|
936
657
|
throw l({
|
|
937
658
|
status: "error",
|
|
938
|
-
type:
|
|
659
|
+
type: p,
|
|
939
660
|
params: d,
|
|
940
661
|
error: O,
|
|
941
|
-
sessionId: (g =
|
|
942
|
-
payload:
|
|
943
|
-
progressMessages:
|
|
662
|
+
sessionId: (g = o.jobSessionId) != null ? g : null,
|
|
663
|
+
payload: o.jobStatus,
|
|
664
|
+
progressMessages: o.progressMessages
|
|
944
665
|
}), O;
|
|
945
666
|
}
|
|
946
|
-
}),
|
|
947
|
-
if (!
|
|
667
|
+
}), h = (p, d) => V(null, null, function* () {
|
|
668
|
+
if (!i)
|
|
948
669
|
throw new Error("jobsUrl is required in order to attach to a job");
|
|
949
670
|
try {
|
|
950
|
-
const g = `${
|
|
671
|
+
const g = `${i}/${p}`, { result: u } = yield vn(
|
|
951
672
|
g,
|
|
952
673
|
d,
|
|
953
|
-
(w) =>
|
|
674
|
+
(w) => f(w)
|
|
954
675
|
);
|
|
955
|
-
if (
|
|
956
|
-
const w =
|
|
957
|
-
l((
|
|
676
|
+
if (u) {
|
|
677
|
+
const w = u.files, O = u.assets;
|
|
678
|
+
l((x) => ({
|
|
958
679
|
status: "success",
|
|
959
|
-
type:
|
|
960
|
-
params: "params" in
|
|
961
|
-
sessionId:
|
|
962
|
-
payload:
|
|
680
|
+
type: o.jobType,
|
|
681
|
+
params: "params" in x ? x.params : {},
|
|
682
|
+
sessionId: p,
|
|
683
|
+
payload: o.jobStatus,
|
|
963
684
|
assets: O,
|
|
964
685
|
files: w,
|
|
965
|
-
progressMessages:
|
|
686
|
+
progressMessages: o.progressMessages
|
|
966
687
|
}));
|
|
967
688
|
}
|
|
968
689
|
} catch (g) {
|
|
969
|
-
const
|
|
690
|
+
const u = g instanceof Error ? g.message : "Unknown error", w = new _n(u, g);
|
|
970
691
|
throw l({
|
|
971
692
|
status: "error",
|
|
972
|
-
type:
|
|
693
|
+
type: r.current,
|
|
973
694
|
params: {},
|
|
974
695
|
error: w,
|
|
975
|
-
sessionId:
|
|
976
|
-
payload:
|
|
977
|
-
progressMessages:
|
|
696
|
+
sessionId: p,
|
|
697
|
+
payload: o.jobStatus,
|
|
698
|
+
progressMessages: o.progressMessages
|
|
978
699
|
}), w;
|
|
979
700
|
}
|
|
980
701
|
});
|
|
981
|
-
return
|
|
702
|
+
return Ft(() => {
|
|
982
703
|
var d, g;
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
if (
|
|
986
|
-
const
|
|
704
|
+
const p = (d = r.current) != null ? d : o.jobType;
|
|
705
|
+
if (p) {
|
|
706
|
+
if (o.status === "error") {
|
|
707
|
+
const u = (g = o.error) != null ? g : new yn();
|
|
987
708
|
l((w) => {
|
|
988
709
|
var O;
|
|
989
710
|
return {
|
|
990
711
|
status: "error",
|
|
991
|
-
type:
|
|
712
|
+
type: p,
|
|
992
713
|
params: "params" in w ? w.params : {},
|
|
993
|
-
error:
|
|
994
|
-
sessionId: (O =
|
|
995
|
-
payload:
|
|
996
|
-
progressMessages:
|
|
714
|
+
error: u,
|
|
715
|
+
sessionId: (O = o.jobSessionId) != null ? O : null,
|
|
716
|
+
payload: o.jobStatus,
|
|
717
|
+
progressMessages: o.progressMessages
|
|
997
718
|
};
|
|
998
719
|
});
|
|
999
720
|
return;
|
|
1000
721
|
}
|
|
1001
|
-
if (
|
|
1002
|
-
l((
|
|
722
|
+
if (o.status === "pending") {
|
|
723
|
+
l((u) => ({
|
|
1003
724
|
status: "pending",
|
|
1004
|
-
type:
|
|
1005
|
-
params: "params" in
|
|
1006
|
-
sessionId:
|
|
1007
|
-
payload:
|
|
1008
|
-
progressMessages:
|
|
725
|
+
type: p,
|
|
726
|
+
params: "params" in u ? u.params : {},
|
|
727
|
+
sessionId: o.jobSessionId,
|
|
728
|
+
payload: o.jobStatus,
|
|
729
|
+
progressMessages: o.progressMessages
|
|
1009
730
|
}));
|
|
1010
731
|
return;
|
|
1011
732
|
}
|
|
1012
733
|
}
|
|
1013
|
-
}, [
|
|
1014
|
-
|
|
734
|
+
}, [o]), /* @__PURE__ */ dn(
|
|
735
|
+
Bt.Provider,
|
|
1015
736
|
{
|
|
1016
737
|
value: {
|
|
1017
|
-
createJob:
|
|
1018
|
-
attachJob:
|
|
738
|
+
createJob: m,
|
|
739
|
+
attachJob: h,
|
|
1019
740
|
job: a,
|
|
1020
741
|
figmaRestApi: e
|
|
1021
742
|
},
|
|
1022
|
-
children:
|
|
743
|
+
children: c
|
|
1023
744
|
}
|
|
1024
745
|
);
|
|
1025
746
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const e =
|
|
747
|
+
function On() {
|
|
748
|
+
const e = Vt(Bt);
|
|
1028
749
|
if (!e)
|
|
1029
750
|
throw new Error("useAnimaSDK must be used within AnimaSDKProvider");
|
|
1030
751
|
return e;
|
|
1031
752
|
}
|
|
1032
|
-
const
|
|
753
|
+
const ls = ({
|
|
1033
754
|
url: e,
|
|
1034
755
|
method: n = "POST"
|
|
1035
756
|
}) => {
|
|
1036
|
-
const [t,
|
|
757
|
+
const [t, s] = Ge(ut);
|
|
1037
758
|
return {
|
|
1038
|
-
getCode:
|
|
1039
|
-
(
|
|
759
|
+
getCode: Le(
|
|
760
|
+
(c) => qt(e, n, c, s),
|
|
1040
761
|
[e, n]
|
|
1041
762
|
),
|
|
1042
763
|
status: t.status,
|
|
@@ -1048,7 +769,7 @@ const vr = ({
|
|
|
1048
769
|
result: t.result
|
|
1049
770
|
};
|
|
1050
771
|
};
|
|
1051
|
-
var
|
|
772
|
+
var Re = { exports: {} }, We = {};
|
|
1052
773
|
/**
|
|
1053
774
|
* @license React
|
|
1054
775
|
* use-sync-external-store-shim.production.js
|
|
@@ -1058,48 +779,48 @@ var We = { exports: {} }, ze = {};
|
|
|
1058
779
|
* This source code is licensed under the MIT license found in the
|
|
1059
780
|
* LICENSE file in the root directory of this source tree.
|
|
1060
781
|
*/
|
|
1061
|
-
var
|
|
1062
|
-
function
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1065
|
-
var e =
|
|
1066
|
-
function n(
|
|
1067
|
-
return
|
|
782
|
+
var Lt;
|
|
783
|
+
function bn() {
|
|
784
|
+
if (Lt) return We;
|
|
785
|
+
Lt = 1;
|
|
786
|
+
var e = we;
|
|
787
|
+
function n(E, m) {
|
|
788
|
+
return E === m && (E !== 0 || 1 / E === 1 / m) || E !== E && m !== m;
|
|
1068
789
|
}
|
|
1069
|
-
var t = typeof Object.is == "function" ? Object.is : n,
|
|
1070
|
-
function l(
|
|
1071
|
-
var
|
|
1072
|
-
return
|
|
790
|
+
var t = typeof Object.is == "function" ? Object.is : n, s = e.useState, i = e.useEffect, c = e.useLayoutEffect, a = e.useDebugValue;
|
|
791
|
+
function l(E, m) {
|
|
792
|
+
var h = m(), p = s({ inst: { value: h, getSnapshot: m } }), d = p[0].inst, g = p[1];
|
|
793
|
+
return c(
|
|
1073
794
|
function() {
|
|
1074
|
-
d.value =
|
|
795
|
+
d.value = h, d.getSnapshot = m, r(d) && g({ inst: d });
|
|
1075
796
|
},
|
|
1076
|
-
[
|
|
1077
|
-
),
|
|
797
|
+
[E, h, m]
|
|
798
|
+
), i(
|
|
1078
799
|
function() {
|
|
1079
|
-
return
|
|
1080
|
-
|
|
800
|
+
return r(d) && g({ inst: d }), E(function() {
|
|
801
|
+
r(d) && g({ inst: d });
|
|
1081
802
|
});
|
|
1082
803
|
},
|
|
1083
|
-
[
|
|
1084
|
-
), a(
|
|
804
|
+
[E]
|
|
805
|
+
), a(h), h;
|
|
1085
806
|
}
|
|
1086
|
-
function
|
|
1087
|
-
var
|
|
1088
|
-
|
|
807
|
+
function r(E) {
|
|
808
|
+
var m = E.getSnapshot;
|
|
809
|
+
E = E.value;
|
|
1089
810
|
try {
|
|
1090
|
-
var
|
|
1091
|
-
return !t(
|
|
1092
|
-
} catch (
|
|
811
|
+
var h = m();
|
|
812
|
+
return !t(E, h);
|
|
813
|
+
} catch (p) {
|
|
1093
814
|
return !0;
|
|
1094
815
|
}
|
|
1095
816
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return
|
|
817
|
+
function o(E, m) {
|
|
818
|
+
return m();
|
|
1098
819
|
}
|
|
1099
|
-
var
|
|
1100
|
-
return
|
|
820
|
+
var f = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? o : l;
|
|
821
|
+
return We.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, We;
|
|
1101
822
|
}
|
|
1102
|
-
var
|
|
823
|
+
var Fe = {};
|
|
1103
824
|
/**
|
|
1104
825
|
* @license React
|
|
1105
826
|
* use-sync-external-store-shim.development.js
|
|
@@ -1109,341 +830,341 @@ var Ke = {};
|
|
|
1109
830
|
* This source code is licensed under the MIT license found in the
|
|
1110
831
|
* LICENSE file in the root directory of this source tree.
|
|
1111
832
|
*/
|
|
1112
|
-
var
|
|
1113
|
-
function
|
|
1114
|
-
return
|
|
1115
|
-
function e(
|
|
1116
|
-
return
|
|
833
|
+
var It;
|
|
834
|
+
function Rn() {
|
|
835
|
+
return It || (It = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
836
|
+
function e(h, p) {
|
|
837
|
+
return h === p && (h !== 0 || 1 / h === 1 / p) || h !== h && p !== p;
|
|
1117
838
|
}
|
|
1118
|
-
function n(
|
|
1119
|
-
|
|
839
|
+
function n(h, p) {
|
|
840
|
+
f || i.startTransition === void 0 || (f = !0, console.error(
|
|
1120
841
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
1121
842
|
));
|
|
1122
|
-
var d =
|
|
1123
|
-
if (!
|
|
1124
|
-
var g =
|
|
1125
|
-
|
|
843
|
+
var d = p();
|
|
844
|
+
if (!E) {
|
|
845
|
+
var g = p();
|
|
846
|
+
c(d, g) || (console.error(
|
|
1126
847
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
1127
|
-
),
|
|
848
|
+
), E = !0);
|
|
1128
849
|
}
|
|
1129
850
|
g = a({
|
|
1130
|
-
inst: { value: d, getSnapshot:
|
|
851
|
+
inst: { value: d, getSnapshot: p }
|
|
1131
852
|
});
|
|
1132
|
-
var
|
|
1133
|
-
return
|
|
853
|
+
var u = g[0].inst, w = g[1];
|
|
854
|
+
return r(
|
|
1134
855
|
function() {
|
|
1135
|
-
|
|
856
|
+
u.value = d, u.getSnapshot = p, t(u) && w({ inst: u });
|
|
1136
857
|
},
|
|
1137
|
-
[
|
|
858
|
+
[h, d, p]
|
|
1138
859
|
), l(
|
|
1139
860
|
function() {
|
|
1140
|
-
return t(
|
|
1141
|
-
t(
|
|
861
|
+
return t(u) && w({ inst: u }), h(function() {
|
|
862
|
+
t(u) && w({ inst: u });
|
|
1142
863
|
});
|
|
1143
864
|
},
|
|
1144
|
-
[
|
|
1145
|
-
),
|
|
865
|
+
[h]
|
|
866
|
+
), o(d), d;
|
|
1146
867
|
}
|
|
1147
|
-
function t(
|
|
1148
|
-
var
|
|
1149
|
-
|
|
868
|
+
function t(h) {
|
|
869
|
+
var p = h.getSnapshot;
|
|
870
|
+
h = h.value;
|
|
1150
871
|
try {
|
|
1151
|
-
var d =
|
|
1152
|
-
return !
|
|
872
|
+
var d = p();
|
|
873
|
+
return !c(h, d);
|
|
1153
874
|
} catch (g) {
|
|
1154
875
|
return !0;
|
|
1155
876
|
}
|
|
1156
877
|
}
|
|
1157
|
-
function
|
|
1158
|
-
return
|
|
878
|
+
function s(h, p) {
|
|
879
|
+
return p();
|
|
1159
880
|
}
|
|
1160
881
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1163
|
-
})()),
|
|
882
|
+
var i = we, c = typeof Object.is == "function" ? Object.is : e, a = i.useState, l = i.useEffect, r = i.useLayoutEffect, o = i.useDebugValue, f = !1, E = !1, m = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? s : n;
|
|
883
|
+
Fe.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
884
|
+
})()), Fe;
|
|
1164
885
|
}
|
|
1165
|
-
var
|
|
1166
|
-
function
|
|
1167
|
-
return
|
|
886
|
+
var Dt;
|
|
887
|
+
function Tn() {
|
|
888
|
+
return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? Re.exports = bn() : Re.exports = Rn()), Re.exports;
|
|
1168
889
|
}
|
|
1169
|
-
var
|
|
1170
|
-
const
|
|
1171
|
-
var
|
|
1172
|
-
function
|
|
1173
|
-
var t,
|
|
890
|
+
var Cn = Tn();
|
|
891
|
+
const Ht = 0, Kt = 1, zt = 2, Nt = 3;
|
|
892
|
+
var At = Object.prototype.hasOwnProperty;
|
|
893
|
+
function et(e, n) {
|
|
894
|
+
var t, s;
|
|
1174
895
|
if (e === n) return !0;
|
|
1175
896
|
if (e && n && (t = e.constructor) === n.constructor) {
|
|
1176
897
|
if (t === Date) return e.getTime() === n.getTime();
|
|
1177
898
|
if (t === RegExp) return e.toString() === n.toString();
|
|
1178
899
|
if (t === Array) {
|
|
1179
|
-
if ((
|
|
1180
|
-
for (;
|
|
1181
|
-
return
|
|
900
|
+
if ((s = e.length) === n.length)
|
|
901
|
+
for (; s-- && et(e[s], n[s]); ) ;
|
|
902
|
+
return s === -1;
|
|
1182
903
|
}
|
|
1183
904
|
if (!t || typeof e == "object") {
|
|
1184
|
-
|
|
905
|
+
s = 0;
|
|
1185
906
|
for (t in e)
|
|
1186
|
-
if (
|
|
1187
|
-
return Object.keys(n).length ===
|
|
907
|
+
if (At.call(e, t) && ++s && !At.call(n, t) || !(t in n) || !et(e[t], n[t])) return !1;
|
|
908
|
+
return Object.keys(n).length === s;
|
|
1188
909
|
}
|
|
1189
910
|
}
|
|
1190
911
|
return e !== e && n !== n;
|
|
1191
912
|
}
|
|
1192
|
-
const
|
|
1193
|
-
},
|
|
913
|
+
const K = /* @__PURE__ */ new WeakMap(), X = () => {
|
|
914
|
+
}, M = (
|
|
1194
915
|
/*#__NOINLINE__*/
|
|
1195
|
-
|
|
1196
|
-
),
|
|
1197
|
-
const t =
|
|
916
|
+
X()
|
|
917
|
+
), tt = Object, v = (e) => e === M, q = (e) => typeof e == "function", Q = (e, n) => L(L({}, e), n), Yt = (e) => q(e.then), Ve = {}, Te = {}, lt = "undefined", _e = typeof window != lt, nt = typeof document != lt, Ln = _e && "Deno" in window, In = () => _e && typeof window.requestAnimationFrame != lt, Xt = (e, n) => {
|
|
918
|
+
const t = K.get(e);
|
|
1198
919
|
return [
|
|
1199
920
|
// Getter
|
|
1200
|
-
() => !
|
|
921
|
+
() => !v(n) && e.get(n) || Ve,
|
|
1201
922
|
// Setter
|
|
1202
|
-
(
|
|
1203
|
-
if (!
|
|
1204
|
-
const
|
|
1205
|
-
n in
|
|
923
|
+
(s) => {
|
|
924
|
+
if (!v(n)) {
|
|
925
|
+
const i = e.get(n);
|
|
926
|
+
n in Te || (Te[n] = i), t[5](n, Q(i, s), i || Ve);
|
|
1206
927
|
}
|
|
1207
928
|
},
|
|
1208
929
|
// Subscriber
|
|
1209
930
|
t[6],
|
|
1210
931
|
// Get server cache snapshot
|
|
1211
|
-
() => !
|
|
932
|
+
() => !v(n) && n in Te ? Te[n] : !v(n) && e.get(n) || Ve
|
|
1212
933
|
];
|
|
1213
934
|
};
|
|
1214
|
-
let
|
|
1215
|
-
const
|
|
935
|
+
let st = !0;
|
|
936
|
+
const Dn = () => st, [rt, ot] = _e && window.addEventListener ? [
|
|
1216
937
|
window.addEventListener.bind(window),
|
|
1217
938
|
window.removeEventListener.bind(window)
|
|
1218
939
|
] : [
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
],
|
|
1222
|
-
const e =
|
|
1223
|
-
return
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1226
|
-
}),
|
|
940
|
+
X,
|
|
941
|
+
X
|
|
942
|
+
], Nn = () => {
|
|
943
|
+
const e = nt && document.visibilityState;
|
|
944
|
+
return v(e) || e !== "hidden";
|
|
945
|
+
}, An = (e) => (nt && document.addEventListener("visibilitychange", e), rt("focus", e), () => {
|
|
946
|
+
nt && document.removeEventListener("visibilitychange", e), ot("focus", e);
|
|
947
|
+
}), xn = (e) => {
|
|
1227
948
|
const n = () => {
|
|
1228
|
-
|
|
949
|
+
st = !0, e();
|
|
1229
950
|
}, t = () => {
|
|
1230
|
-
|
|
951
|
+
st = !1;
|
|
1231
952
|
};
|
|
1232
|
-
return
|
|
1233
|
-
|
|
953
|
+
return rt("online", n), rt("offline", t), () => {
|
|
954
|
+
ot("online", n), ot("offline", t);
|
|
1234
955
|
};
|
|
1235
|
-
},
|
|
1236
|
-
isOnline:
|
|
1237
|
-
isVisible:
|
|
1238
|
-
},
|
|
1239
|
-
initFocus:
|
|
1240
|
-
initReconnect:
|
|
1241
|
-
},
|
|
956
|
+
}, Mn = {
|
|
957
|
+
isOnline: Dn,
|
|
958
|
+
isVisible: Nn
|
|
959
|
+
}, kn = {
|
|
960
|
+
initFocus: An,
|
|
961
|
+
initReconnect: xn
|
|
962
|
+
}, xt = !we.useId, ve = !_e || Ln, jn = (e) => In() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Pe = ve ? Ft : fn, $e = typeof navigator != "undefined" && navigator.connection, Mt = !ve && $e && ([
|
|
1242
963
|
"slow-2g",
|
|
1243
964
|
"2g"
|
|
1244
|
-
].includes(
|
|
1245
|
-
let
|
|
1246
|
-
const
|
|
1247
|
-
const n = typeof e, t =
|
|
965
|
+
].includes($e.effectiveType) || $e.saveData), Ce = /* @__PURE__ */ new WeakMap(), Wn = (e) => tt.prototype.toString.call(e), Ue = (e, n) => e === `[object ${n}]`;
|
|
966
|
+
let Fn = 0;
|
|
967
|
+
const at = (e) => {
|
|
968
|
+
const n = typeof e, t = Wn(e), s = Ue(t, "Date"), i = Ue(t, "RegExp"), c = Ue(t, "Object");
|
|
1248
969
|
let a, l;
|
|
1249
|
-
if (
|
|
1250
|
-
if (a =
|
|
1251
|
-
if (a = ++
|
|
970
|
+
if (tt(e) === e && !s && !i) {
|
|
971
|
+
if (a = Ce.get(e), a) return a;
|
|
972
|
+
if (a = ++Fn + "~", Ce.set(e, a), Array.isArray(e)) {
|
|
1252
973
|
for (a = "@", l = 0; l < e.length; l++)
|
|
1253
|
-
a +=
|
|
1254
|
-
|
|
974
|
+
a += at(e[l]) + ",";
|
|
975
|
+
Ce.set(e, a);
|
|
1255
976
|
}
|
|
1256
|
-
if (
|
|
977
|
+
if (c) {
|
|
1257
978
|
a = "#";
|
|
1258
|
-
const
|
|
1259
|
-
for (; !
|
|
1260
|
-
|
|
1261
|
-
|
|
979
|
+
const r = tt.keys(e).sort();
|
|
980
|
+
for (; !v(l = r.pop()); )
|
|
981
|
+
v(e[l]) || (a += l + ":" + at(e[l]) + ",");
|
|
982
|
+
Ce.set(e, a);
|
|
1262
983
|
}
|
|
1263
984
|
} else
|
|
1264
|
-
a =
|
|
985
|
+
a = s ? e.toJSON() : n == "symbol" ? e.toString() : n == "string" ? JSON.stringify(e) : "" + e;
|
|
1265
986
|
return a;
|
|
1266
|
-
},
|
|
1267
|
-
if (
|
|
987
|
+
}, dt = (e) => {
|
|
988
|
+
if (q(e))
|
|
1268
989
|
try {
|
|
1269
990
|
e = e();
|
|
1270
991
|
} catch (t) {
|
|
1271
992
|
e = "";
|
|
1272
993
|
}
|
|
1273
994
|
const n = e;
|
|
1274
|
-
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ?
|
|
995
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? at(e) : "", [
|
|
1275
996
|
e,
|
|
1276
997
|
n
|
|
1277
998
|
];
|
|
1278
999
|
};
|
|
1279
|
-
let
|
|
1280
|
-
const
|
|
1281
|
-
function
|
|
1282
|
-
return
|
|
1283
|
-
const [n, t,
|
|
1000
|
+
let Vn = 0;
|
|
1001
|
+
const it = () => ++Vn;
|
|
1002
|
+
function Qt(...e) {
|
|
1003
|
+
return V(this, null, function* () {
|
|
1004
|
+
const [n, t, s, i] = e, c = Q({
|
|
1284
1005
|
populateCache: !0,
|
|
1285
1006
|
throwOnError: !0
|
|
1286
|
-
}, typeof
|
|
1287
|
-
revalidate:
|
|
1288
|
-
} :
|
|
1289
|
-
let a =
|
|
1290
|
-
const l =
|
|
1291
|
-
let
|
|
1292
|
-
const
|
|
1293
|
-
if (
|
|
1294
|
-
const
|
|
1295
|
-
for (const d of
|
|
1007
|
+
}, typeof i == "boolean" ? {
|
|
1008
|
+
revalidate: i
|
|
1009
|
+
} : i || {});
|
|
1010
|
+
let a = c.populateCache;
|
|
1011
|
+
const l = c.rollbackOnError;
|
|
1012
|
+
let r = c.optimisticData;
|
|
1013
|
+
const o = (m) => typeof l == "function" ? l(m) : l !== !1, f = c.throwOnError;
|
|
1014
|
+
if (q(t)) {
|
|
1015
|
+
const m = t, h = [], p = n.keys();
|
|
1016
|
+
for (const d of p)
|
|
1296
1017
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
1297
|
-
!/^\$(inf|sub)\$/.test(d) &&
|
|
1298
|
-
return Promise.all(
|
|
1018
|
+
!/^\$(inf|sub)\$/.test(d) && m(n.get(d)._k) && h.push(d);
|
|
1019
|
+
return Promise.all(h.map(E));
|
|
1299
1020
|
}
|
|
1300
|
-
return
|
|
1301
|
-
function m
|
|
1302
|
-
return
|
|
1303
|
-
const [
|
|
1304
|
-
if (!
|
|
1305
|
-
const [
|
|
1306
|
-
const
|
|
1307
|
-
return (
|
|
1021
|
+
return E(t);
|
|
1022
|
+
function E(m) {
|
|
1023
|
+
return V(this, null, function* () {
|
|
1024
|
+
const [h] = dt(m);
|
|
1025
|
+
if (!h) return;
|
|
1026
|
+
const [p, d] = Xt(n, h), [g, u, w, O] = K.get(n), x = () => {
|
|
1027
|
+
const k = g[h];
|
|
1028
|
+
return (q(c.revalidate) ? c.revalidate(p().data, m) : c.revalidate !== !1) && (delete w[h], delete O[h], k && k[0]) ? k[0](zt).then(() => p().data) : p().data;
|
|
1308
1029
|
};
|
|
1309
1030
|
if (e.length < 3)
|
|
1310
|
-
return
|
|
1311
|
-
let
|
|
1312
|
-
const C =
|
|
1313
|
-
|
|
1031
|
+
return x();
|
|
1032
|
+
let b = s, D, U = !1;
|
|
1033
|
+
const C = it();
|
|
1034
|
+
u[h] = [
|
|
1314
1035
|
C,
|
|
1315
1036
|
0
|
|
1316
1037
|
];
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1319
|
-
data:
|
|
1320
|
-
_c:
|
|
1321
|
-
})),
|
|
1038
|
+
const ne = !v(r), J = p(), se = J.data, ye = J._c, Z = v(ye) ? se : ye;
|
|
1039
|
+
if (ne && (r = q(r) ? r(Z, se) : r, d({
|
|
1040
|
+
data: r,
|
|
1041
|
+
_c: Z
|
|
1042
|
+
})), q(b))
|
|
1322
1043
|
try {
|
|
1323
|
-
|
|
1324
|
-
} catch (
|
|
1325
|
-
|
|
1044
|
+
b = b(Z);
|
|
1045
|
+
} catch (k) {
|
|
1046
|
+
D = k, U = !0;
|
|
1326
1047
|
}
|
|
1327
|
-
if (
|
|
1328
|
-
if (
|
|
1329
|
-
|
|
1330
|
-
}), C !==
|
|
1331
|
-
if (
|
|
1332
|
-
return
|
|
1333
|
-
} else
|
|
1334
|
-
data:
|
|
1335
|
-
_c:
|
|
1048
|
+
if (b && Yt(b))
|
|
1049
|
+
if (b = yield b.catch((k) => {
|
|
1050
|
+
D = k, U = !0;
|
|
1051
|
+
}), C !== u[h][0]) {
|
|
1052
|
+
if (U) throw D;
|
|
1053
|
+
return b;
|
|
1054
|
+
} else U && ne && o(D) && (a = !0, d({
|
|
1055
|
+
data: Z,
|
|
1056
|
+
_c: M
|
|
1336
1057
|
}));
|
|
1337
|
-
if (a && !
|
|
1338
|
-
if (
|
|
1339
|
-
const
|
|
1058
|
+
if (a && !U)
|
|
1059
|
+
if (q(a)) {
|
|
1060
|
+
const k = a(b, Z);
|
|
1340
1061
|
d({
|
|
1341
|
-
data:
|
|
1342
|
-
error:
|
|
1343
|
-
_c:
|
|
1062
|
+
data: k,
|
|
1063
|
+
error: M,
|
|
1064
|
+
_c: M
|
|
1344
1065
|
});
|
|
1345
1066
|
} else
|
|
1346
1067
|
d({
|
|
1347
|
-
data:
|
|
1348
|
-
error:
|
|
1349
|
-
_c:
|
|
1068
|
+
data: b,
|
|
1069
|
+
error: M,
|
|
1070
|
+
_c: M
|
|
1350
1071
|
});
|
|
1351
|
-
if (
|
|
1072
|
+
if (u[h][1] = it(), Promise.resolve(x()).then(() => {
|
|
1352
1073
|
d({
|
|
1353
|
-
_c:
|
|
1074
|
+
_c: M
|
|
1354
1075
|
});
|
|
1355
|
-
}),
|
|
1356
|
-
if (
|
|
1076
|
+
}), U) {
|
|
1077
|
+
if (f) throw D;
|
|
1357
1078
|
return;
|
|
1358
1079
|
}
|
|
1359
|
-
return
|
|
1080
|
+
return b;
|
|
1360
1081
|
});
|
|
1361
1082
|
}
|
|
1362
1083
|
});
|
|
1363
1084
|
}
|
|
1364
|
-
const
|
|
1085
|
+
const kt = (e, n) => {
|
|
1365
1086
|
for (const t in e)
|
|
1366
1087
|
e[t][0] && e[t][0](n);
|
|
1367
|
-
},
|
|
1368
|
-
if (!
|
|
1369
|
-
const t =
|
|
1370
|
-
let
|
|
1371
|
-
const a = /* @__PURE__ */ Object.create(null), l = (
|
|
1372
|
-
const
|
|
1373
|
-
return a[
|
|
1374
|
-
},
|
|
1375
|
-
e.set(
|
|
1376
|
-
const
|
|
1377
|
-
if (
|
|
1378
|
-
for (const
|
|
1379
|
-
E
|
|
1380
|
-
},
|
|
1381
|
-
if (!
|
|
1382
|
-
|
|
1088
|
+
}, Pn = (e, n) => {
|
|
1089
|
+
if (!K.has(e)) {
|
|
1090
|
+
const t = Q(kn, n), s = /* @__PURE__ */ Object.create(null), i = Qt.bind(M, e);
|
|
1091
|
+
let c = X;
|
|
1092
|
+
const a = /* @__PURE__ */ Object.create(null), l = (f, E) => {
|
|
1093
|
+
const m = a[f] || [];
|
|
1094
|
+
return a[f] = m, m.push(E), () => m.splice(m.indexOf(E), 1);
|
|
1095
|
+
}, r = (f, E, m) => {
|
|
1096
|
+
e.set(f, E);
|
|
1097
|
+
const h = a[f];
|
|
1098
|
+
if (h)
|
|
1099
|
+
for (const p of h)
|
|
1100
|
+
p(E, m);
|
|
1101
|
+
}, o = () => {
|
|
1102
|
+
if (!K.has(e) && (K.set(e, [
|
|
1103
|
+
s,
|
|
1383
1104
|
/* @__PURE__ */ Object.create(null),
|
|
1384
1105
|
/* @__PURE__ */ Object.create(null),
|
|
1385
1106
|
/* @__PURE__ */ Object.create(null),
|
|
1386
|
-
|
|
1387
|
-
|
|
1107
|
+
i,
|
|
1108
|
+
r,
|
|
1388
1109
|
l
|
|
1389
|
-
]), !
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1110
|
+
]), !ve)) {
|
|
1111
|
+
const f = t.initFocus(setTimeout.bind(M, kt.bind(M, s, Ht))), E = t.initReconnect(setTimeout.bind(M, kt.bind(M, s, Kt)));
|
|
1112
|
+
c = () => {
|
|
1113
|
+
f && f(), E && E(), K.delete(e);
|
|
1393
1114
|
};
|
|
1394
1115
|
}
|
|
1395
1116
|
};
|
|
1396
|
-
return
|
|
1117
|
+
return o(), [
|
|
1397
1118
|
e,
|
|
1398
|
-
o,
|
|
1399
1119
|
i,
|
|
1400
|
-
|
|
1120
|
+
o,
|
|
1121
|
+
c
|
|
1401
1122
|
];
|
|
1402
1123
|
}
|
|
1403
1124
|
return [
|
|
1404
1125
|
e,
|
|
1405
|
-
|
|
1126
|
+
K.get(e)[4]
|
|
1406
1127
|
];
|
|
1407
|
-
},
|
|
1408
|
-
const
|
|
1409
|
-
!
|
|
1410
|
-
},
|
|
1128
|
+
}, $n = (e, n, t, s, i) => {
|
|
1129
|
+
const c = t.errorRetryCount, a = i.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * t.errorRetryInterval;
|
|
1130
|
+
!v(c) && a > c || setTimeout(s, l, i);
|
|
1131
|
+
}, Un = et, [Zt, Jn] = Pn(/* @__PURE__ */ new Map()), qn = Q(
|
|
1411
1132
|
{
|
|
1412
1133
|
// events
|
|
1413
|
-
onLoadingSlow:
|
|
1414
|
-
onSuccess:
|
|
1415
|
-
onError:
|
|
1416
|
-
onErrorRetry:
|
|
1417
|
-
onDiscarded:
|
|
1134
|
+
onLoadingSlow: X,
|
|
1135
|
+
onSuccess: X,
|
|
1136
|
+
onError: X,
|
|
1137
|
+
onErrorRetry: $n,
|
|
1138
|
+
onDiscarded: X,
|
|
1418
1139
|
// switches
|
|
1419
1140
|
revalidateOnFocus: !0,
|
|
1420
1141
|
revalidateOnReconnect: !0,
|
|
1421
1142
|
revalidateIfStale: !0,
|
|
1422
1143
|
shouldRetryOnError: !0,
|
|
1423
1144
|
// timeouts
|
|
1424
|
-
errorRetryInterval:
|
|
1145
|
+
errorRetryInterval: Mt ? 1e4 : 5e3,
|
|
1425
1146
|
focusThrottleInterval: 5 * 1e3,
|
|
1426
1147
|
dedupingInterval: 2 * 1e3,
|
|
1427
|
-
loadingTimeout:
|
|
1148
|
+
loadingTimeout: Mt ? 5e3 : 3e3,
|
|
1428
1149
|
// providers
|
|
1429
|
-
compare:
|
|
1150
|
+
compare: Un,
|
|
1430
1151
|
isPaused: () => !1,
|
|
1431
|
-
cache:
|
|
1432
|
-
mutate:
|
|
1152
|
+
cache: Zt,
|
|
1153
|
+
mutate: Jn,
|
|
1433
1154
|
fallback: {}
|
|
1434
1155
|
},
|
|
1435
1156
|
// use web preset by default
|
|
1436
|
-
|
|
1437
|
-
),
|
|
1438
|
-
const t =
|
|
1157
|
+
Mn
|
|
1158
|
+
), Gn = (e, n) => {
|
|
1159
|
+
const t = Q(e, n);
|
|
1439
1160
|
if (n) {
|
|
1440
|
-
const { use:
|
|
1441
|
-
|
|
1161
|
+
const { use: s, fallback: i } = e, { use: c, fallback: a } = n;
|
|
1162
|
+
s && c && (t.use = s.concat(c)), i && a && (t.fallback = Q(i, a));
|
|
1442
1163
|
}
|
|
1443
1164
|
return t;
|
|
1444
|
-
},
|
|
1445
|
-
|
|
1446
|
-
},
|
|
1165
|
+
}, Bn = Wt({}), Hn = "$inf$", en = _e && window.__SWR_DEVTOOLS_USE__, Kn = en ? window.__SWR_DEVTOOLS_USE__ : [], zn = () => {
|
|
1166
|
+
en && (window.__SWR_DEVTOOLS_REACT__ = we);
|
|
1167
|
+
}, Yn = (e) => q(e[1]) ? [
|
|
1447
1168
|
e[0],
|
|
1448
1169
|
e[1],
|
|
1449
1170
|
e[2] || {}
|
|
@@ -1451,33 +1172,33 @@ const qt = (e, n) => {
|
|
|
1451
1172
|
e[0],
|
|
1452
1173
|
null,
|
|
1453
1174
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
1454
|
-
],
|
|
1455
|
-
const e =
|
|
1456
|
-
return
|
|
1175
|
+
], Xn = () => {
|
|
1176
|
+
const e = Vt(Bn);
|
|
1177
|
+
return Pt(() => Q(qn, e), [
|
|
1457
1178
|
e
|
|
1458
1179
|
]);
|
|
1459
|
-
},
|
|
1460
|
-
const [a] =
|
|
1461
|
-
if (a.startsWith(
|
|
1462
|
-
return t(...
|
|
1463
|
-
const
|
|
1464
|
-
return
|
|
1465
|
-
}),
|
|
1466
|
-
const
|
|
1467
|
-
let
|
|
1468
|
-
const { use:
|
|
1469
|
-
for (let
|
|
1470
|
-
|
|
1471
|
-
return
|
|
1472
|
-
},
|
|
1473
|
-
const
|
|
1474
|
-
return
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1180
|
+
}, Qn = (e) => (n, t, s) => e(n, t && ((...c) => {
|
|
1181
|
+
const [a] = dt(n), [, , , l] = K.get(Zt);
|
|
1182
|
+
if (a.startsWith(Hn))
|
|
1183
|
+
return t(...c);
|
|
1184
|
+
const r = l[a];
|
|
1185
|
+
return v(r) ? t(...c) : (delete l[a], r);
|
|
1186
|
+
}), s), Zn = Kn.concat(Qn), es = (e) => function(...t) {
|
|
1187
|
+
const s = Xn(), [i, c, a] = Yn(t), l = Gn(s, a);
|
|
1188
|
+
let r = e;
|
|
1189
|
+
const { use: o } = l, f = (o || []).concat(Zn);
|
|
1190
|
+
for (let E = f.length; E--; )
|
|
1191
|
+
r = f[E](r);
|
|
1192
|
+
return r(i, c || l.fetcher || null, l);
|
|
1193
|
+
}, ts = (e, n, t) => {
|
|
1194
|
+
const s = n[e] || (n[e] = []);
|
|
1195
|
+
return s.push(t), () => {
|
|
1196
|
+
const i = s.indexOf(t);
|
|
1197
|
+
i >= 0 && (s[i] = s[s.length - 1], s.pop());
|
|
1477
1198
|
};
|
|
1478
1199
|
};
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1200
|
+
zn();
|
|
1201
|
+
const Je = we.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
1481
1202
|
// and emitting an error.
|
|
1482
1203
|
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
1483
1204
|
// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
|
|
@@ -1496,94 +1217,94 @@ const tt = be.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1496
1217
|
e.status = "rejected", e.reason = n;
|
|
1497
1218
|
}), e;
|
|
1498
1219
|
}
|
|
1499
|
-
}),
|
|
1220
|
+
}), qe = {
|
|
1500
1221
|
dedupe: !0
|
|
1501
|
-
},
|
|
1502
|
-
const { cache:
|
|
1503
|
-
for (const
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1506
|
-
if (!
|
|
1222
|
+
}, jt = Promise.resolve(M), ns = (e, n, t) => {
|
|
1223
|
+
const { cache: s, compare: i, suspense: c, fallbackData: a, revalidateOnMount: l, revalidateIfStale: r, refreshInterval: o, refreshWhenHidden: f, refreshWhenOffline: E, keepPreviousData: m } = t, [h, p, d, g] = K.get(s), [u, w] = dt(e), O = z(!1), x = z(!1), b = z(u), D = z(n), U = z(t), C = () => U.current, ne = () => C().isVisible() && C().isOnline(), [J, se, ye, Z] = Xt(s, u), k = z({}).current, fe = v(a) ? v(t.fallback) ? M : t.fallback[u] : a, ft = (_, T) => {
|
|
1224
|
+
for (const N in k) {
|
|
1225
|
+
const y = N;
|
|
1226
|
+
if (y === "data") {
|
|
1227
|
+
if (!i(_[y], T[y]) && (!v(_[y]) || !i(be, T[y])))
|
|
1507
1228
|
return !1;
|
|
1508
|
-
} else if (
|
|
1229
|
+
} else if (T[y] !== _[y])
|
|
1509
1230
|
return !1;
|
|
1510
1231
|
}
|
|
1511
1232
|
return !0;
|
|
1512
|
-
},
|
|
1513
|
-
const
|
|
1514
|
-
const
|
|
1515
|
-
return delete
|
|
1233
|
+
}, ht = Pt(() => {
|
|
1234
|
+
const _ = !u || !n ? !1 : v(l) ? C().isPaused() || c ? !1 : r !== !1 : l, T = (j) => {
|
|
1235
|
+
const G = Q(j);
|
|
1236
|
+
return delete G._k, _ ? L({
|
|
1516
1237
|
isValidating: !0,
|
|
1517
1238
|
isLoading: !0
|
|
1518
|
-
},
|
|
1519
|
-
},
|
|
1520
|
-
let
|
|
1239
|
+
}, G) : G;
|
|
1240
|
+
}, N = J(), y = Z(), P = T(N), ae = N === y ? P : T(y);
|
|
1241
|
+
let A = P;
|
|
1521
1242
|
return [
|
|
1522
1243
|
() => {
|
|
1523
|
-
const
|
|
1524
|
-
return
|
|
1244
|
+
const j = T(J());
|
|
1245
|
+
return ft(j, A) ? (A.data = j.data, A.isLoading = j.isLoading, A.isValidating = j.isValidating, A.error = j.error, A) : (A = j, j);
|
|
1525
1246
|
},
|
|
1526
|
-
() =>
|
|
1247
|
+
() => ae
|
|
1527
1248
|
];
|
|
1528
1249
|
}, [
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
]),
|
|
1532
|
-
(
|
|
1533
|
-
|
|
1250
|
+
s,
|
|
1251
|
+
u
|
|
1252
|
+
]), re = Cn.useSyncExternalStore(Le(
|
|
1253
|
+
(_) => ye(u, (T, N) => {
|
|
1254
|
+
ft(N, T) || _();
|
|
1534
1255
|
}),
|
|
1535
1256
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1536
1257
|
[
|
|
1537
|
-
|
|
1538
|
-
|
|
1258
|
+
s,
|
|
1259
|
+
u
|
|
1539
1260
|
]
|
|
1540
|
-
),
|
|
1541
|
-
(
|
|
1542
|
-
const
|
|
1543
|
-
if (!
|
|
1261
|
+
), ht[0], ht[1]), pt = !O.current, tn = h[u] && h[u].length > 0, oe = re.data, ee = v(oe) ? fe && Yt(fe) ? Je(fe) : fe : oe, Oe = re.error, Ne = z(ee), be = m ? v(oe) ? v(Ne.current) ? ee : Ne.current : oe : ee, gt = tn && !v(Oe) ? !1 : pt && !v(l) ? l : C().isPaused() ? !1 : c ? v(ee) ? !1 : r : v(ee) || r, Et = !!(u && n && pt && gt), nn = v(re.isValidating) ? Et : re.isValidating, sn = v(re.isLoading) ? Et : re.isLoading, he = Le(
|
|
1262
|
+
(_) => V(null, null, function* () {
|
|
1263
|
+
const T = D.current;
|
|
1264
|
+
if (!u || !T || x.current || C().isPaused())
|
|
1544
1265
|
return !1;
|
|
1545
|
-
let
|
|
1546
|
-
const
|
|
1266
|
+
let N, y, P = !0;
|
|
1267
|
+
const ae = _ || {}, A = !d[u] || !ae.dedupe, j = () => xt ? !x.current && u === b.current && O.current : u === b.current, G = {
|
|
1547
1268
|
isValidating: !1,
|
|
1548
1269
|
isLoading: !1
|
|
1549
|
-
},
|
|
1550
|
-
|
|
1551
|
-
},
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
},
|
|
1270
|
+
}, St = () => {
|
|
1271
|
+
se(G);
|
|
1272
|
+
}, vt = () => {
|
|
1273
|
+
const F = d[u];
|
|
1274
|
+
F && F[1] === y && delete d[u];
|
|
1275
|
+
}, wt = {
|
|
1555
1276
|
isValidating: !0
|
|
1556
1277
|
};
|
|
1557
|
-
|
|
1278
|
+
v(J().data) && (wt.isLoading = !0);
|
|
1558
1279
|
try {
|
|
1559
|
-
if (
|
|
1560
|
-
|
|
1561
|
-
}, t.loadingTimeout), d[
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
]), [
|
|
1565
|
-
return
|
|
1566
|
-
|
|
1567
|
-
const
|
|
1568
|
-
if (!
|
|
1569
|
-
(
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
return
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
} catch (
|
|
1576
|
-
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1280
|
+
if (A && (se(wt), t.loadingTimeout && v(J().data) && setTimeout(() => {
|
|
1281
|
+
P && j() && C().onLoadingSlow(u, t);
|
|
1282
|
+
}, t.loadingTimeout), d[u] = [
|
|
1283
|
+
T(w),
|
|
1284
|
+
it()
|
|
1285
|
+
]), [N, y] = d[u], N = yield N, A && setTimeout(vt, t.dedupingInterval), !d[u] || d[u][1] !== y)
|
|
1286
|
+
return A && j() && C().onDiscarded(u), !1;
|
|
1287
|
+
G.error = M;
|
|
1288
|
+
const F = p[u];
|
|
1289
|
+
if (!v(F) && // case 1
|
|
1290
|
+
(y <= F[0] || // case 2
|
|
1291
|
+
y <= F[1] || // case 3
|
|
1292
|
+
F[1] === 0))
|
|
1293
|
+
return St(), A && j() && C().onDiscarded(u), !1;
|
|
1294
|
+
const B = J().data;
|
|
1295
|
+
G.data = i(B, N) ? B : N, A && j() && C().onSuccess(N, u, t);
|
|
1296
|
+
} catch (F) {
|
|
1297
|
+
vt();
|
|
1298
|
+
const B = C(), { shouldRetryOnError: Ae } = B;
|
|
1299
|
+
B.isPaused() || (G.error = F, A && j() && (B.onError(F, u, B), (Ae === !0 || q(Ae) && Ae(F)) && (!C().revalidateOnFocus || !C().revalidateOnReconnect || ne()) && B.onErrorRetry(F, u, B, (rn) => {
|
|
1300
|
+
const xe = h[u];
|
|
1301
|
+
xe && xe[0] && xe[0](Nt, rn);
|
|
1581
1302
|
}, {
|
|
1582
|
-
retryCount: (
|
|
1303
|
+
retryCount: (ae.retryCount || 0) + 1,
|
|
1583
1304
|
dedupe: !0
|
|
1584
1305
|
})));
|
|
1585
1306
|
}
|
|
1586
|
-
return
|
|
1307
|
+
return P = !1, St(), !0;
|
|
1587
1308
|
}),
|
|
1588
1309
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
1589
1310
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -1597,96 +1318,96 @@ const tt = be.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1597
1318
|
// even though it might cause unexpected behaviors.
|
|
1598
1319
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1599
1320
|
[
|
|
1600
|
-
|
|
1601
|
-
|
|
1321
|
+
u,
|
|
1322
|
+
s
|
|
1602
1323
|
]
|
|
1603
|
-
),
|
|
1324
|
+
), mt = Le(
|
|
1604
1325
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
1605
|
-
(...
|
|
1326
|
+
(..._) => Qt(s, b.current, ..._),
|
|
1606
1327
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1607
1328
|
[]
|
|
1608
1329
|
);
|
|
1609
|
-
if (
|
|
1610
|
-
|
|
1611
|
-
}),
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1614
|
-
let
|
|
1615
|
-
C().revalidateOnFocus && (
|
|
1616
|
-
const
|
|
1617
|
-
if (
|
|
1618
|
-
const
|
|
1619
|
-
C().revalidateOnFocus &&
|
|
1620
|
-
} else if (
|
|
1621
|
-
C().revalidateOnReconnect &&
|
|
1330
|
+
if (Pe(() => {
|
|
1331
|
+
D.current = n, U.current = t, v(oe) || (Ne.current = oe);
|
|
1332
|
+
}), Pe(() => {
|
|
1333
|
+
if (!u) return;
|
|
1334
|
+
const _ = he.bind(M, qe);
|
|
1335
|
+
let T = 0;
|
|
1336
|
+
C().revalidateOnFocus && (T = Date.now() + C().focusThrottleInterval);
|
|
1337
|
+
const y = ts(u, h, (P, ae = {}) => {
|
|
1338
|
+
if (P == Ht) {
|
|
1339
|
+
const A = Date.now();
|
|
1340
|
+
C().revalidateOnFocus && A > T && ne() && (T = A + C().focusThrottleInterval, _());
|
|
1341
|
+
} else if (P == Kt)
|
|
1342
|
+
C().revalidateOnReconnect && ne() && _();
|
|
1622
1343
|
else {
|
|
1623
|
-
if (
|
|
1624
|
-
return
|
|
1625
|
-
if (
|
|
1626
|
-
return
|
|
1344
|
+
if (P == zt)
|
|
1345
|
+
return he();
|
|
1346
|
+
if (P == Nt)
|
|
1347
|
+
return he(ae);
|
|
1627
1348
|
}
|
|
1628
1349
|
});
|
|
1629
|
-
return
|
|
1350
|
+
return x.current = !1, b.current = u, O.current = !0, se({
|
|
1630
1351
|
_k: w
|
|
1631
|
-
}),
|
|
1632
|
-
|
|
1352
|
+
}), gt && (d[u] || (v(ee) || ve ? _() : jn(_))), () => {
|
|
1353
|
+
x.current = !0, y();
|
|
1633
1354
|
};
|
|
1634
1355
|
}, [
|
|
1635
|
-
|
|
1636
|
-
]),
|
|
1637
|
-
let
|
|
1638
|
-
function
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1356
|
+
u
|
|
1357
|
+
]), Pe(() => {
|
|
1358
|
+
let _;
|
|
1359
|
+
function T() {
|
|
1360
|
+
const y = q(o) ? o(J().data) : o;
|
|
1361
|
+
y && _ !== -1 && (_ = setTimeout(N, y));
|
|
1641
1362
|
}
|
|
1642
|
-
function
|
|
1643
|
-
!
|
|
1363
|
+
function N() {
|
|
1364
|
+
!J().error && (f || C().isVisible()) && (E || C().isOnline()) ? he(qe).then(T) : T();
|
|
1644
1365
|
}
|
|
1645
|
-
return
|
|
1646
|
-
|
|
1366
|
+
return T(), () => {
|
|
1367
|
+
_ && (clearTimeout(_), _ = -1);
|
|
1647
1368
|
};
|
|
1648
1369
|
}, [
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
]),
|
|
1654
|
-
const
|
|
1655
|
-
if (!
|
|
1370
|
+
o,
|
|
1371
|
+
f,
|
|
1372
|
+
E,
|
|
1373
|
+
u
|
|
1374
|
+
]), hn(be), c) {
|
|
1375
|
+
const _ = u && v(ee);
|
|
1376
|
+
if (!xt && ve && _)
|
|
1656
1377
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
1657
|
-
|
|
1658
|
-
const
|
|
1659
|
-
if (
|
|
1660
|
-
throw
|
|
1661
|
-
const
|
|
1662
|
-
!
|
|
1378
|
+
_ && (D.current = n, U.current = t, x.current = !1);
|
|
1379
|
+
const T = g[u], N = !v(T) && _ ? mt(T) : jt;
|
|
1380
|
+
if (Je(N), !v(Oe) && _)
|
|
1381
|
+
throw Oe;
|
|
1382
|
+
const y = _ ? he(qe) : jt;
|
|
1383
|
+
!v(be) && _ && (y.status = "fulfilled", y.value = !0), Je(y);
|
|
1663
1384
|
}
|
|
1664
1385
|
return {
|
|
1665
|
-
mutate:
|
|
1386
|
+
mutate: mt,
|
|
1666
1387
|
get data() {
|
|
1667
|
-
return
|
|
1388
|
+
return k.data = !0, be;
|
|
1668
1389
|
},
|
|
1669
1390
|
get error() {
|
|
1670
|
-
return
|
|
1391
|
+
return k.error = !0, Oe;
|
|
1671
1392
|
},
|
|
1672
1393
|
get isValidating() {
|
|
1673
|
-
return
|
|
1394
|
+
return k.isValidating = !0, nn;
|
|
1674
1395
|
},
|
|
1675
1396
|
get isLoading() {
|
|
1676
|
-
return
|
|
1397
|
+
return k.isLoading = !0, sn;
|
|
1677
1398
|
}
|
|
1678
1399
|
};
|
|
1679
|
-
},
|
|
1400
|
+
}, ss = es(ns), ds = ({
|
|
1680
1401
|
fileKey: e,
|
|
1681
1402
|
authToken: n,
|
|
1682
1403
|
enabled: t = !0,
|
|
1683
|
-
params:
|
|
1404
|
+
params: s = {}
|
|
1684
1405
|
}) => {
|
|
1685
|
-
const { figmaRestApi:
|
|
1686
|
-
["useFigmaFile", e, n,
|
|
1687
|
-
() =>
|
|
1406
|
+
const { figmaRestApi: i } = On(), c = !!(t && e && n), { data: a, isLoading: l, error: r } = ss(
|
|
1407
|
+
["useFigmaFile", e, n, s],
|
|
1408
|
+
() => c ? i.withOptions(n ? { token: n } : {}).getFile({
|
|
1688
1409
|
fileKey: e,
|
|
1689
|
-
depth:
|
|
1410
|
+
depth: s.depth
|
|
1690
1411
|
}) : null,
|
|
1691
1412
|
{
|
|
1692
1413
|
revalidateIfStale: !1,
|
|
@@ -1697,17 +1418,17 @@ const tt = be.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1697
1418
|
return {
|
|
1698
1419
|
data: a != null ? a : null,
|
|
1699
1420
|
isLoading: l,
|
|
1700
|
-
error:
|
|
1421
|
+
error: r
|
|
1701
1422
|
};
|
|
1702
1423
|
};
|
|
1703
1424
|
export {
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1425
|
+
Bt as AnimaSdkContext,
|
|
1426
|
+
us as AnimaSdkProvider,
|
|
1427
|
+
_n as AttachJobError,
|
|
1428
|
+
wn as CreateJobError,
|
|
1429
|
+
yn as UnknownCodegenError,
|
|
1430
|
+
ls as useAnimaCodegen,
|
|
1431
|
+
On as useAnimaSDK,
|
|
1432
|
+
ds as useFigmaFile
|
|
1712
1433
|
};
|
|
1713
1434
|
//# sourceMappingURL=index.js.map
|