@animaapp/anima-sdk-react 0.7.3 → 0.9.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.js CHANGED
@@ -11,23 +11,23 @@ var Ct = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writ
11
11
  return e;
12
12
  }, At = (e, t) => fn(e, dn(t));
13
13
  var oe = (e, t, n) => new Promise((r, s) => {
14
- var c = (m) => {
14
+ var i = (d) => {
15
15
  try {
16
- a(n.next(m));
16
+ l(n.next(d));
17
17
  } catch (_) {
18
18
  s(_);
19
19
  }
20
- }, l = (m) => {
20
+ }, u = (d) => {
21
21
  try {
22
- a(n.throw(m));
22
+ l(n.throw(d));
23
23
  } catch (_) {
24
24
  s(_);
25
25
  }
26
- }, a = (m) => m.done ? r(m.value) : Promise.resolve(m.value).then(c, l);
27
- a((n = n.apply(e, t)).next());
26
+ }, l = (d) => d.done ? r(d.value) : Promise.resolve(d.value).then(i, u);
27
+ l((n = n.apply(e, t)).next());
28
28
  });
29
29
  import Oe, { createContext as Bt, useState as nt, useRef as le, useEffect as Ht, useContext as zt, useCallback as Ve, useLayoutEffect as En, useMemo as Kt, useDebugValue as mn } from "react";
30
- import { CodegenError as Ye, getFigmaFile as gn } from "@animaapp/anima-sdk";
30
+ import { CodegenError as Ye } from "@animaapp/anima-sdk";
31
31
  var Pe = { exports: {} }, Ce = {};
32
32
  /**
33
33
  * @license React
@@ -39,23 +39,23 @@ var Pe = { exports: {} }, Ce = {};
39
39
  * LICENSE file in the root directory of this source tree.
40
40
  */
41
41
  var Lt;
42
- function vn() {
42
+ function gn() {
43
43
  if (Lt) return Ce;
44
44
  Lt = 1;
45
45
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
46
- function n(r, s, c) {
47
- var l = null;
48
- if (c !== void 0 && (l = "" + c), s.key !== void 0 && (l = "" + s.key), "key" in s) {
49
- c = {};
50
- for (var a in s)
51
- a !== "key" && (c[a] = s[a]);
52
- } else c = s;
53
- return s = c.ref, {
46
+ function n(r, s, i) {
47
+ var u = null;
48
+ if (i !== void 0 && (u = "" + i), s.key !== void 0 && (u = "" + s.key), "key" in s) {
49
+ i = {};
50
+ for (var l in s)
51
+ l !== "key" && (i[l] = s[l]);
52
+ } else i = s;
53
+ return s = i.ref, {
54
54
  $$typeof: e,
55
55
  type: r,
56
- key: l,
56
+ key: u,
57
57
  ref: s !== void 0 ? s : null,
58
- props: c
58
+ props: i
59
59
  };
60
60
  }
61
61
  return Ce.Fragment = t, Ce.jsx = n, Ce.jsxs = n, Ce;
@@ -71,187 +71,187 @@ var Ae = {};
71
71
  * LICENSE file in the root directory of this source tree.
72
72
  */
73
73
  var xt;
74
- function _n() {
74
+ function vn() {
75
75
  return xt || (xt = 1, process.env.NODE_ENV !== "production" && (function() {
76
- function e(o) {
77
- if (o == null) return null;
78
- if (typeof o == "function")
79
- return o.$$typeof === U ? null : o.displayName || o.name || null;
80
- if (typeof o == "string") return o;
81
- switch (o) {
82
- case u:
76
+ function e(a) {
77
+ if (a == null) return null;
78
+ if (typeof a == "function")
79
+ return a.$$typeof === U ? null : a.displayName || a.name || null;
80
+ if (typeof a == "string") return a;
81
+ switch (a) {
82
+ case c:
83
83
  return "Fragment";
84
- case i:
84
+ case o:
85
85
  return "Profiler";
86
86
  case f:
87
87
  return "StrictMode";
88
88
  case T:
89
89
  return "Suspense";
90
- case W:
90
+ case F:
91
91
  return "SuspenseList";
92
92
  case K:
93
93
  return "Activity";
94
94
  }
95
- if (typeof o == "object")
96
- switch (typeof o.tag == "number" && console.error(
95
+ if (typeof a == "object")
96
+ switch (typeof a.tag == "number" && console.error(
97
97
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
98
- ), o.$$typeof) {
99
- case h:
98
+ ), a.$$typeof) {
99
+ case p:
100
100
  return "Portal";
101
- case I:
102
- return (o.displayName || "Context") + ".Provider";
103
- case g:
104
- return (o._context.displayName || "Context") + ".Consumer";
105
101
  case k:
106
- var v = o.render;
107
- return o = o.displayName, o || (o = v.displayName || v.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
102
+ return (a.displayName || "Context") + ".Provider";
103
+ case g:
104
+ return (a._context.displayName || "Context") + ".Consumer";
105
+ case N:
106
+ var v = a.render;
107
+ return a = a.displayName, a || (a = v.displayName || v.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
108
108
  case $:
109
- return v = o.displayName || null, v !== null ? v : e(o.type) || "Memo";
109
+ return v = a.displayName || null, v !== null ? v : e(a.type) || "Memo";
110
110
  case b:
111
- v = o._payload, o = o._init;
111
+ v = a._payload, a = a._init;
112
112
  try {
113
- return e(o(v));
113
+ return e(a(v));
114
114
  } catch (O) {
115
115
  }
116
116
  }
117
117
  return null;
118
118
  }
119
- function t(o) {
120
- return "" + o;
119
+ function t(a) {
120
+ return "" + a;
121
121
  }
122
- function n(o) {
122
+ function n(a) {
123
123
  try {
124
- t(o);
124
+ t(a);
125
125
  var v = !1;
126
126
  } catch (H) {
127
127
  v = !0;
128
128
  }
129
129
  if (v) {
130
130
  v = console;
131
- var O = v.error, N = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
131
+ var O = v.error, I = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
132
132
  return O.call(
133
133
  v,
134
134
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
135
- N
136
- ), t(o);
135
+ I
136
+ ), t(a);
137
137
  }
138
138
  }
139
- function r(o) {
140
- if (o === u) return "<>";
141
- if (typeof o == "object" && o !== null && o.$$typeof === b)
139
+ function r(a) {
140
+ if (a === c) return "<>";
141
+ if (typeof a == "object" && a !== null && a.$$typeof === b)
142
142
  return "<...>";
143
143
  try {
144
- var v = e(o);
144
+ var v = e(a);
145
145
  return v ? "<" + v + ">" : "<...>";
146
146
  } catch (O) {
147
147
  return "<...>";
148
148
  }
149
149
  }
150
150
  function s() {
151
- var o = B.A;
152
- return o === null ? null : o.getOwner();
151
+ var a = B.A;
152
+ return a === null ? null : a.getOwner();
153
153
  }
154
- function c() {
154
+ function i() {
155
155
  return Error("react-stack-top-frame");
156
156
  }
157
- function l(o) {
158
- if (Q.call(o, "key")) {
159
- var v = Object.getOwnPropertyDescriptor(o, "key").get;
157
+ function u(a) {
158
+ if (Q.call(a, "key")) {
159
+ var v = Object.getOwnPropertyDescriptor(a, "key").get;
160
160
  if (v && v.isReactWarning) return !1;
161
161
  }
162
- return o.key !== void 0;
162
+ return a.key !== void 0;
163
163
  }
164
- function a(o, v) {
164
+ function l(a, v) {
165
165
  function O() {
166
166
  ce || (ce = !0, console.error(
167
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
168
  v
169
169
  ));
170
170
  }
171
- O.isReactWarning = !0, Object.defineProperty(o, "key", {
171
+ O.isReactWarning = !0, Object.defineProperty(a, "key", {
172
172
  get: O,
173
173
  configurable: !0
174
174
  });
175
175
  }
176
- function m() {
177
- var o = e(this.type);
178
- return ye[o] || (ye[o] = !0, console.error(
176
+ function d() {
177
+ var a = e(this.type);
178
+ return ye[a] || (ye[a] = !0, console.error(
179
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
- )), o = this.props.ref, o !== void 0 ? o : null;
180
+ )), a = this.props.ref, a !== void 0 ? a : null;
181
181
  }
182
- function _(o, v, O, N, H, G, Ee, me) {
183
- return O = G.ref, o = {
184
- $$typeof: d,
185
- type: o,
182
+ function _(a, v, O, I, H, G, Ee, me) {
183
+ return O = G.ref, a = {
184
+ $$typeof: h,
185
+ type: a,
186
186
  key: v,
187
187
  props: G,
188
188
  _owner: H
189
- }, (O !== void 0 ? O : null) !== null ? Object.defineProperty(o, "ref", {
189
+ }, (O !== void 0 ? O : null) !== null ? Object.defineProperty(a, "ref", {
190
190
  enumerable: !1,
191
- get: m
192
- }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
191
+ get: d
192
+ }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
193
193
  configurable: !1,
194
194
  enumerable: !1,
195
195
  writable: !0,
196
196
  value: 0
197
- }), Object.defineProperty(o, "_debugInfo", {
197
+ }), Object.defineProperty(a, "_debugInfo", {
198
198
  configurable: !1,
199
199
  enumerable: !1,
200
200
  writable: !0,
201
201
  value: null
202
- }), Object.defineProperty(o, "_debugStack", {
202
+ }), Object.defineProperty(a, "_debugStack", {
203
203
  configurable: !1,
204
204
  enumerable: !1,
205
205
  writable: !0,
206
206
  value: Ee
207
- }), Object.defineProperty(o, "_debugTask", {
207
+ }), Object.defineProperty(a, "_debugTask", {
208
208
  configurable: !1,
209
209
  enumerable: !1,
210
210
  writable: !0,
211
211
  value: me
212
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
212
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
213
213
  }
214
- function w(o, v, O, N, H, G, Ee, me) {
214
+ function w(a, v, O, I, H, G, Ee, me) {
215
215
  var P = v.children;
216
216
  if (P !== void 0)
217
- if (N)
217
+ if (I)
218
218
  if (q(P)) {
219
- for (N = 0; N < P.length; N++)
220
- E(P[N]);
219
+ for (I = 0; I < P.length; I++)
220
+ m(P[I]);
221
221
  Object.freeze && Object.freeze(P);
222
222
  } else
223
223
  console.error(
224
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
225
  );
226
- else E(P);
226
+ else m(P);
227
227
  if (Q.call(v, "key")) {
228
- P = e(o);
228
+ P = e(a);
229
229
  var ue = Object.keys(v).filter(function(je) {
230
230
  return je !== "key";
231
231
  });
232
- N = 0 < ue.length ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}", Te[P + N] || (ue = 0 < ue.length ? "{" + ue.join(": ..., ") + ": ...}" : "{}", console.error(
232
+ I = 0 < ue.length ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}", Te[P + I] || (ue = 0 < ue.length ? "{" + ue.join(": ..., ") + ": ...}" : "{}", console.error(
233
233
  `A props object containing a "key" prop is being spread into JSX:
234
234
  let props = %s;
235
235
  <%s {...props} />
236
236
  React keys must be passed directly to JSX without using spread:
237
237
  let props = %s;
238
238
  <%s key={someKey} {...props} />`,
239
- N,
239
+ I,
240
240
  P,
241
241
  ue,
242
242
  P
243
- ), Te[P + N] = !0);
243
+ ), Te[P + I] = !0);
244
244
  }
245
- if (P = null, O !== void 0 && (n(O), P = "" + O), l(v) && (n(v.key), P = "" + v.key), "key" in v) {
245
+ if (P = null, O !== void 0 && (n(O), P = "" + O), u(v) && (n(v.key), P = "" + v.key), "key" in v) {
246
246
  O = {};
247
247
  for (var ne in v)
248
248
  ne !== "key" && (O[ne] = v[ne]);
249
249
  } else O = v;
250
- return P && a(
250
+ return P && l(
251
251
  O,
252
- typeof o == "function" ? o.displayName || o.name || "Unknown" : o
252
+ typeof a == "function" ? a.displayName || a.name || "Unknown" : a
253
253
  ), _(
254
- o,
254
+ a,
255
255
  P,
256
256
  G,
257
257
  H,
@@ -261,53 +261,53 @@ React keys must be passed directly to JSX without using spread:
261
261
  me
262
262
  );
263
263
  }
264
- function E(o) {
265
- typeof o == "object" && o !== null && o.$$typeof === d && o._store && (o._store.validated = 1);
264
+ function m(a) {
265
+ typeof a == "object" && a !== null && a.$$typeof === h && a._store && (a._store.validated = 1);
266
266
  }
267
- var p = Oe, d = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), I = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), B = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, q = Array.isArray, C = console.createTask ? console.createTask : function() {
267
+ var E = Oe, h = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), k = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), B = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, q = Array.isArray, C = console.createTask ? console.createTask : function() {
268
268
  return null;
269
269
  };
270
- p = {
271
- react_stack_bottom_frame: function(o) {
272
- return o();
270
+ E = {
271
+ react_stack_bottom_frame: function(a) {
272
+ return a();
273
273
  }
274
274
  };
275
- var ce, ye = {}, be = p.react_stack_bottom_frame.bind(
276
- p,
277
- c
278
- )(), te = C(r(c)), Te = {};
279
- Ae.Fragment = u, Ae.jsx = function(o, v, O, N, H) {
275
+ var ce, ye = {}, be = E.react_stack_bottom_frame.bind(
276
+ E,
277
+ i
278
+ )(), te = C(r(i)), Te = {};
279
+ Ae.Fragment = c, Ae.jsx = function(a, v, O, I, H) {
280
280
  var G = 1e4 > B.recentlyCreatedOwnerStacks++;
281
281
  return w(
282
- o,
282
+ a,
283
283
  v,
284
284
  O,
285
285
  !1,
286
- N,
286
+ I,
287
287
  H,
288
288
  G ? Error("react-stack-top-frame") : be,
289
- G ? C(r(o)) : te
289
+ G ? C(r(a)) : te
290
290
  );
291
- }, Ae.jsxs = function(o, v, O, N, H) {
291
+ }, Ae.jsxs = function(a, v, O, I, H) {
292
292
  var G = 1e4 > B.recentlyCreatedOwnerStacks++;
293
293
  return w(
294
- o,
294
+ a,
295
295
  v,
296
296
  O,
297
297
  !0,
298
- N,
298
+ I,
299
299
  H,
300
300
  G ? Error("react-stack-top-frame") : be,
301
- G ? C(r(o)) : te
301
+ G ? C(r(a)) : te
302
302
  );
303
303
  };
304
304
  })()), Ae;
305
305
  }
306
306
  var Nt;
307
- function Sn() {
308
- return Nt || (Nt = 1, process.env.NODE_ENV === "production" ? Pe.exports = vn() : Pe.exports = _n()), Pe.exports;
307
+ function _n() {
308
+ return Nt || (Nt = 1, process.env.NODE_ENV === "production" ? Pe.exports = gn() : Pe.exports = vn()), Pe.exports;
309
309
  }
310
- var wn = Sn();
310
+ var Sn = _n();
311
311
  class It extends Error {
312
312
  constructor(t, n) {
313
313
  super(t), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
@@ -315,95 +315,95 @@ class It extends Error {
315
315
  }
316
316
  function Be(e) {
317
317
  }
318
- function Rn(e) {
318
+ function wn(e) {
319
319
  if (typeof e == "function")
320
320
  throw new TypeError(
321
321
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
322
322
  );
323
323
  const { onEvent: t = Be, onError: n = Be, onRetry: r = Be, onComment: s } = e;
324
- let c = "", l = !0, a, m = "", _ = "";
325
- function w(u) {
326
- const f = l ? u.replace(/^\xEF\xBB\xBF/, "") : u, [i, g] = On(`${c}${f}`);
327
- for (const I of i)
328
- E(I);
329
- c = g, l = !1;
324
+ let i = "", u = !0, l, d = "", _ = "";
325
+ function w(c) {
326
+ const f = u ? c.replace(/^\xEF\xBB\xBF/, "") : c, [o, g] = Rn(`${i}${f}`);
327
+ for (const k of o)
328
+ m(k);
329
+ i = g, u = !1;
330
330
  }
331
- function E(u) {
332
- if (u === "") {
333
- d();
331
+ function m(c) {
332
+ if (c === "") {
333
+ h();
334
334
  return;
335
335
  }
336
- if (u.startsWith(":")) {
337
- s && s(u.slice(u.startsWith(": ") ? 2 : 1));
336
+ if (c.startsWith(":")) {
337
+ s && s(c.slice(c.startsWith(": ") ? 2 : 1));
338
338
  return;
339
339
  }
340
- const f = u.indexOf(":");
340
+ const f = c.indexOf(":");
341
341
  if (f !== -1) {
342
- const i = u.slice(0, f), g = u[f + 1] === " " ? 2 : 1, I = u.slice(f + g);
343
- p(i, I, u);
342
+ const o = c.slice(0, f), g = c[f + 1] === " " ? 2 : 1, k = c.slice(f + g);
343
+ E(o, k, c);
344
344
  return;
345
345
  }
346
- p(u, "", u);
346
+ E(c, "", c);
347
347
  }
348
- function p(u, f, i) {
349
- switch (u) {
348
+ function E(c, f, o) {
349
+ switch (c) {
350
350
  case "event":
351
351
  _ = f;
352
352
  break;
353
353
  case "data":
354
- m = `${m}${f}
354
+ d = `${d}${f}
355
355
  `;
356
356
  break;
357
357
  case "id":
358
- a = f.includes("\0") ? void 0 : f;
358
+ l = f.includes("\0") ? void 0 : f;
359
359
  break;
360
360
  case "retry":
361
361
  /^\d+$/.test(f) ? r(parseInt(f, 10)) : n(
362
362
  new It(`Invalid \`retry\` value: "${f}"`, {
363
363
  type: "invalid-retry",
364
364
  value: f,
365
- line: i
365
+ line: o
366
366
  })
367
367
  );
368
368
  break;
369
369
  default:
370
370
  n(
371
371
  new It(
372
- `Unknown field "${u.length > 20 ? `${u.slice(0, 20)}…` : u}"`,
373
- { type: "unknown-field", field: u, value: f, line: i }
372
+ `Unknown field "${c.length > 20 ? `${c.slice(0, 20)}…` : c}"`,
373
+ { type: "unknown-field", field: c, value: f, line: o }
374
374
  )
375
375
  );
376
376
  break;
377
377
  }
378
378
  }
379
- function d() {
380
- m.length > 0 && t({
381
- id: a,
379
+ function h() {
380
+ d.length > 0 && t({
381
+ id: l,
382
382
  event: _ || void 0,
383
383
  // If the data buffer's last character is a U+000A LINE FEED (LF) character,
384
384
  // then remove the last character from the data buffer.
385
- data: m.endsWith(`
386
- `) ? m.slice(0, -1) : m
387
- }), a = void 0, m = "", _ = "";
385
+ data: d.endsWith(`
386
+ `) ? d.slice(0, -1) : d
387
+ }), l = void 0, d = "", _ = "";
388
388
  }
389
- function h(u = {}) {
390
- c && u.consume && E(c), l = !0, a = void 0, m = "", _ = "", c = "";
389
+ function p(c = {}) {
390
+ i && c.consume && m(i), u = !0, l = void 0, d = "", _ = "", i = "";
391
391
  }
392
- return { feed: w, reset: h };
392
+ return { feed: w, reset: p };
393
393
  }
394
- function On(e) {
394
+ function Rn(e) {
395
395
  const t = [];
396
396
  let n = "", r = 0;
397
397
  for (; r < e.length; ) {
398
- const s = e.indexOf("\r", r), c = e.indexOf(`
398
+ const s = e.indexOf("\r", r), i = e.indexOf(`
399
399
  `, r);
400
- let l = -1;
401
- if (s !== -1 && c !== -1 ? l = Math.min(s, c) : s !== -1 ? s === e.length - 1 ? l = -1 : l = s : c !== -1 && (l = c), l === -1) {
400
+ let u = -1;
401
+ if (s !== -1 && i !== -1 ? u = Math.min(s, i) : s !== -1 ? s === e.length - 1 ? u = -1 : u = s : i !== -1 && (u = i), u === -1) {
402
402
  n = e.slice(r);
403
403
  break;
404
404
  } else {
405
- const a = e.slice(r, l);
406
- t.push(a), r = l + 1, e[r - 1] === "\r" && e[r] === `
405
+ const l = e.slice(r, u);
406
+ t.push(l), r = u + 1, e[r - 1] === "\r" && e[r] === `
407
407
  ` && r++;
408
408
  }
409
409
  }
@@ -451,7 +451,7 @@ class kt extends Event {
451
451
  return t(Dt(this), n);
452
452
  }
453
453
  }
454
- function yn(e) {
454
+ function On(e) {
455
455
  const t = globalThis.DOMException;
456
456
  return typeof t == "function" ? new t(e, "SyntaxError") : new SyntaxError(e);
457
457
  }
@@ -474,15 +474,15 @@ var Xt = (e) => {
474
474
  class Ue extends EventTarget {
475
475
  constructor(t, n) {
476
476
  var r, s;
477
- super(), j(this, Z), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, j(this, Y), j(this, pe), j(this, ve), j(this, $e), j(this, qe), j(this, Ne), j(this, we), j(this, Ie, null), j(this, fe), j(this, _e), j(this, Re, null), j(this, Se, null), j(this, Le, null), j(this, ot, (c) => oe(this, null, function* () {
478
- var l;
477
+ super(), j(this, Z), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, j(this, Y), j(this, pe), j(this, ve), j(this, $e), j(this, qe), j(this, Ne), j(this, we), j(this, Ie, null), j(this, fe), j(this, _e), j(this, Re, null), j(this, Se, null), j(this, Le, null), j(this, ot, (i) => oe(this, null, function* () {
478
+ var u;
479
479
  S(this, _e).reset();
480
- const { body: a, redirected: m, status: _, headers: w } = c;
480
+ const { body: l, redirected: d, status: _, headers: w } = i;
481
481
  if (_ === 204) {
482
482
  ae(this, Z, xe).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
483
483
  return;
484
484
  }
485
- if (m ? L(this, ve, new URL(c.url)) : L(this, ve, void 0), _ !== 200) {
485
+ if (d ? L(this, ve, new URL(i.url)) : L(this, ve, void 0), _ !== 200) {
486
486
  ae(this, Z, xe).call(this, `Non-200 status code (${_})`, _);
487
487
  return;
488
488
  }
@@ -493,29 +493,29 @@ class Ue extends EventTarget {
493
493
  if (S(this, Y) === this.CLOSED)
494
494
  return;
495
495
  L(this, Y, this.OPEN);
496
- const E = new Event("open");
497
- if ((l = S(this, Le)) == null || l.call(this, E), this.dispatchEvent(E), typeof a != "object" || !a || !("getReader" in a)) {
496
+ const m = new Event("open");
497
+ if ((u = S(this, Le)) == null || u.call(this, m), this.dispatchEvent(m), typeof l != "object" || !l || !("getReader" in l)) {
498
498
  ae(this, Z, xe).call(this, "Invalid response body, expected a web ReadableStream", _), this.close();
499
499
  return;
500
500
  }
501
- const p = new TextDecoder(), d = a.getReader();
502
- let h = !0;
501
+ const E = new TextDecoder(), h = l.getReader();
502
+ let p = !0;
503
503
  do {
504
- const { done: u, value: f } = yield d.read();
505
- f && S(this, _e).feed(p.decode(f, { stream: !u })), u && (h = !1, S(this, _e).reset(), ae(this, Z, ut).call(this));
506
- } while (h);
507
- })), j(this, at, (c) => {
508
- L(this, fe, void 0), !(c.name === "AbortError" || c.type === "aborted") && ae(this, Z, ut).call(this, st(c));
509
- }), j(this, it, (c) => {
510
- typeof c.id == "string" && L(this, Ie, c.id);
511
- const l = new MessageEvent(c.event || "message", {
512
- data: c.data,
504
+ const { done: c, value: f } = yield h.read();
505
+ f && S(this, _e).feed(E.decode(f, { stream: !c })), c && (p = !1, S(this, _e).reset(), ae(this, Z, ut).call(this));
506
+ } while (p);
507
+ })), j(this, at, (i) => {
508
+ L(this, fe, void 0), !(i.name === "AbortError" || i.type === "aborted") && ae(this, Z, ut).call(this, st(i));
509
+ }), j(this, it, (i) => {
510
+ typeof i.id == "string" && L(this, Ie, i.id);
511
+ const u = new MessageEvent(i.event || "message", {
512
+ data: i.data,
513
513
  origin: S(this, ve) ? S(this, ve).origin : S(this, pe).origin,
514
- lastEventId: c.id || ""
514
+ lastEventId: i.id || ""
515
515
  });
516
- S(this, Se) && (!c.event || c.event === "message") && S(this, Se).call(this, l), this.dispatchEvent(l);
517
- }), j(this, ct, (c) => {
518
- L(this, Ne, c);
516
+ S(this, Se) && (!i.event || i.event === "message") && S(this, Se).call(this, u), this.dispatchEvent(u);
517
+ }), j(this, ct, (i) => {
518
+ L(this, Ne, i);
519
519
  }), j(this, lt, () => {
520
520
  L(this, we, void 0), S(this, Y) === this.CONNECTING && ae(this, Z, rt).call(this);
521
521
  });
@@ -523,13 +523,13 @@ class Ue extends EventTarget {
523
523
  if (t instanceof URL)
524
524
  L(this, pe, t);
525
525
  else if (typeof t == "string")
526
- L(this, pe, new URL(t, bn()));
526
+ L(this, pe, new URL(t, yn()));
527
527
  else
528
528
  throw new Error("Invalid URL");
529
- } catch (c) {
530
- throw yn("An invalid or illegal string was specified");
529
+ } catch (i) {
530
+ throw On("An invalid or illegal string was specified");
531
531
  }
532
- L(this, _e, Rn({
532
+ L(this, _e, wn({
533
533
  onEvent: S(this, it),
534
534
  onRetry: S(this, ct)
535
535
  })), L(this, Y, this.CONNECTING), L(this, Ne, 3e3), L(this, qe, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), L(this, $e, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), ae(this, Z, rt).call(this);
@@ -672,11 +672,11 @@ Ue.OPEN = 1, /**
672
672
  * @public
673
673
  */
674
674
  Ue.CLOSED = 2;
675
- function bn() {
675
+ function yn() {
676
676
  const e = "document" in globalThis ? globalThis.document : void 0;
677
677
  return e && typeof e == "object" && "baseURI" in e && typeof e.baseURI == "string" ? e.baseURI : void 0;
678
678
  }
679
- const Tn = (e) => {
679
+ const bn = (e) => {
680
680
  let t = "";
681
681
  const n = new Uint8Array(e), r = n.byteLength;
682
682
  for (let s = 0; s < r; s++)
@@ -702,263 +702,264 @@ const Tn = (e) => {
702
702
  filePath: e.filePath.replace(/^\//, ""),
703
703
  referencePath: e.referencePath === "/" ? "" : e.referencePath
704
704
  }, Zt = (e, t, n, r) => oe(null, null, function* () {
705
- var _, w, E;
705
+ var _, w, m;
706
706
  const s = structuredClone(St);
707
707
  s.status = "pending", r(D({}, s));
708
- const c = structuredClone(n);
708
+ const i = structuredClone(n);
709
709
  if (((_ = n.assetsStorage) == null ? void 0 : _.strategy) === "local") {
710
- const { referencePath: p } = Mt(
710
+ const { referencePath: E } = Mt(
711
711
  n.assetsStorage
712
712
  );
713
713
  n.assetsStorage = {
714
714
  strategy: "external",
715
- url: p
715
+ url: E
716
716
  };
717
717
  }
718
- let l;
719
- const a = new Ue(e, {
720
- fetch: (p, d) => (l = fetch(p, At(D({}, d), {
718
+ let u;
719
+ const l = new Ue(e, {
720
+ fetch: (E, h) => (u = fetch(E, At(D({}, h), {
721
721
  method: t,
722
722
  body: JSON.stringify(n)
723
- })), l)
724
- }), m = new Promise((p, d) => {
725
- const h = {};
726
- a.addEventListener("start", (f) => {
727
- const i = JSON.parse(f.data);
728
- h.sessionId = i.sessionId, s.tasks.fetchDesign.status = "running", s.jobSessionId = i.sessionId, r(D({}, s));
729
- }), a.addEventListener("queueing", (f) => {
730
- const i = JSON.parse(f.data);
731
- s.jobSessionId = i.payload.sessionId, r(D({}, s));
732
- }), a.addEventListener("pre_codegen", (f) => {
723
+ })), u)
724
+ }), d = new Promise((E, h) => {
725
+ const p = {};
726
+ l.addEventListener("start", (f) => {
727
+ const o = JSON.parse(f.data);
728
+ p.sessionId = o.sessionId, s.tasks.fetchDesign.status = "running", s.jobSessionId = o.sessionId, r(D({}, s));
729
+ }), l.addEventListener("queueing", (f) => {
730
+ const o = JSON.parse(f.data);
731
+ s.jobSessionId = o.payload.sessionId, r(D({}, s));
732
+ }), l.addEventListener("pre_codegen", (f) => {
733
733
  JSON.parse(
734
734
  f.data
735
735
  ).message === "Anima model built" && (s.tasks.fetchDesign.status = "finished", s.tasks.codeGeneration.status = "running", s.tasks.uploadAssets.status = "running", r(D({}, s)));
736
- }), a.addEventListener("figma_metadata", (f) => {
737
- const i = JSON.parse(
736
+ }), l.addEventListener("figma_metadata", (f) => {
737
+ const o = JSON.parse(
738
738
  f.data
739
739
  );
740
- h.figmaFileName = i.figmaFileName, h.figmaSelectedFrameName = i.figmaSelectedFrameName;
741
- }), a.addEventListener("aborted", () => {
740
+ p.figmaFileName = o.figmaFileName, p.figmaSelectedFrameName = o.figmaSelectedFrameName;
741
+ }), l.addEventListener("aborted", () => {
742
742
  const f = new Ye({ name: "Aborted", reason: "Unknown" });
743
- s.status = "aborted", s.result = null, s.error = f, r(D({}, s)), p({
743
+ s.status = "aborted", s.result = null, s.error = f, r(D({}, s)), E({
744
744
  result: null,
745
745
  error: f
746
746
  });
747
- }), a.addEventListener("generating_code", (f) => {
748
- const i = JSON.parse(
747
+ }), l.addEventListener("generating_code", (f) => {
748
+ const o = JSON.parse(
749
749
  f.data
750
750
  );
751
- i.payload.status === "success" && (h.files = i.payload.files), s.tasks.codeGeneration.progress = i.payload.progress, s.tasks.codeGeneration.status = "running", r(D({}, s));
752
- }), a.addEventListener("progress_messages_updated", (f) => {
753
- const i = JSON.parse(
751
+ o.payload.status === "success" && (p.files = o.payload.files), s.tasks.codeGeneration.progress = o.payload.progress, s.tasks.codeGeneration.status = "running", r(D({}, s));
752
+ }), l.addEventListener("progress_messages_updated", (f) => {
753
+ const o = JSON.parse(
754
754
  f.data
755
755
  );
756
- s.progressMessages = i.payload.progressMessages, r(D({}, s));
757
- }), a.addEventListener("job_status_updated", (f) => {
758
- const i = JSON.parse(
756
+ s.progressMessages = o.payload.progressMessages, r(D({}, s));
757
+ }), l.addEventListener("job_status_updated", (f) => {
758
+ const o = JSON.parse(
759
759
  f.data
760
760
  );
761
- s.jobStatus = i.payload.jobStatus, r(D({}, s));
762
- }), a.addEventListener("codegen_completed", () => {
761
+ s.jobStatus = o.payload.jobStatus, r(D({}, s));
762
+ }), l.addEventListener("codegen_completed", () => {
763
763
  s.tasks.codeGeneration.status = "finished", r(D({}, s));
764
- }), a.addEventListener("generation_completed", () => {
764
+ }), l.addEventListener("generation_completed", () => {
765
765
  s.tasks.codeGeneration.status = "finished", r(D({}, s));
766
- }), a.addEventListener("assets_uploaded", () => {
766
+ }), l.addEventListener("assets_uploaded", () => {
767
767
  s.tasks.uploadAssets.status = "finished", r(D({}, s));
768
- }), a.addEventListener("assets_list", (f) => {
769
- const i = JSON.parse(
768
+ }), l.addEventListener("assets_list", (f) => {
769
+ const o = JSON.parse(
770
770
  f.data
771
771
  );
772
- h.assets = i.payload.assets;
772
+ p.assets = o.payload.assets;
773
773
  });
774
- let u = 0;
775
- a.addEventListener("error", (f) => oe(null, null, function* () {
776
- var W, $, b, K, U, B, Q;
777
- const i = yield l;
778
- if (!i.ok) {
774
+ let c = 0;
775
+ l.addEventListener("error", (f) => oe(null, null, function* () {
776
+ var F, $, b, K, U, B, Q;
777
+ const o = yield u;
778
+ if (!o.ok) {
779
779
  let q = "";
780
780
  try {
781
- q = yield i.text();
781
+ q = yield o.text();
782
782
  const C = JSON.parse(q);
783
- (W = C == null ? void 0 : C.payload) != null && W.message && (q = C.payload.message);
783
+ (F = C == null ? void 0 : C.payload) != null && F.message && (q = C.payload.message);
784
784
  } catch (C) {
785
785
  }
786
- d(
786
+ h(
787
787
  new Ye({
788
788
  name: "Request failed",
789
789
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
790
790
  reason: q,
791
- status: i.status
791
+ status: o.status
792
792
  })
793
- ), a.close();
793
+ ), l.close();
794
794
  return;
795
795
  }
796
796
  console.warn(
797
- `Experienced error during code generation (attempt ${u + 1} / ${Pt})`,
797
+ `Experienced error during code generation (attempt ${c + 1} / ${Pt})`,
798
798
  f
799
799
  );
800
- let g, I = !1;
800
+ let g, k = !1;
801
801
  if (f instanceof MessageEvent)
802
802
  try {
803
803
  g = JSON.parse(f.data);
804
804
  } catch (q) {
805
805
  }
806
- ((($ = g == null ? void 0 : g.payload) == null ? void 0 : $.name) === "Task Crashed" || ((b = g == null ? void 0 : g.payload) == null ? void 0 : b.name) === "TimeoutError" || ((K = g == null ? void 0 : g.payload) == null ? void 0 : K.name) === "Error" || ((U = g == null ? void 0 : g.payload) == null ? void 0 : U.name) === "Unknown error") && (I = !0);
807
- const k = new Ye({
806
+ ((($ = g == null ? void 0 : g.payload) == null ? void 0 : $.name) === "Task Crashed" || ((b = g == null ? void 0 : g.payload) == null ? void 0 : b.name) === "TimeoutError" || ((K = g == null ? void 0 : g.payload) == null ? void 0 : K.name) === "Error" || ((U = g == null ? void 0 : g.payload) == null ? void 0 : U.name) === "Unknown error") && (k = !0);
807
+ const N = new Ye({
808
808
  name: (B = g == null ? void 0 : g.payload.name) != null ? B : "Unknown error",
809
809
  reason: (Q = g == null ? void 0 : g.payload.message) != null ? Q : "Unknown",
810
810
  status: g == null ? void 0 : g.payload.status,
811
811
  detail: g == null ? void 0 : g.payload.detail
812
812
  });
813
- u++;
813
+ c++;
814
814
  let T = !1;
815
- u > Pt ? (console.error("Experienced too many errors, terminating request"), T = !0) : I && (console.error("Experienced unrecoverable error, terminating request"), T = !0), T && (s.status = "error", s.error = k, r(D({}, s)), p({
815
+ c > Pt ? (console.error("Experienced too many errors, terminating request"), T = !0) : k && (console.error("Experienced unrecoverable error, terminating request"), T = !0), T && (s.status = "error", s.error = N, r(D({}, s)), E({
816
816
  result: null,
817
- error: k
817
+ error: N
818
818
  }));
819
- })), a.addEventListener("done", (f) => {
820
- const i = JSON.parse(f.data);
821
- h.tokenUsage = i.payload.tokenUsage, h.sessionId = i.payload.sessionId, s.status = "success", s.result = h, r(D({}, s)), p({ result: h, error: null });
819
+ })), l.addEventListener("done", (f) => {
820
+ const o = JSON.parse(f.data);
821
+ p.tokenUsage = o.payload.tokenUsage, p.sessionId = o.payload.sessionId, s.status = "success", s.result = p, r(D({}, s)), E({ result: p, error: null });
822
822
  });
823
823
  });
824
824
  try {
825
- const { result: p, error: d } = yield m, h = structuredClone(p);
826
- if (((w = c.assetsStorage) == null ? void 0 : w.strategy) === "local" && ((E = h == null ? void 0 : h.assets) != null && E.length)) {
827
- const { filePath: u } = Mt(
828
- c.assetsStorage
829
- ), f = h.assets.map((g) => oe(null, null, function* () {
830
- const k = yield (yield fetch(g.url)).arrayBuffer();
825
+ const { result: E, error: h } = yield d, p = structuredClone(E);
826
+ if (((w = i.assetsStorage) == null ? void 0 : w.strategy) === "local" && ((m = p == null ? void 0 : p.assets) != null && m.length)) {
827
+ const { filePath: c } = Mt(
828
+ i.assetsStorage
829
+ ), f = p.assets.map((g) => oe(null, null, function* () {
830
+ const N = yield (yield fetch(g.url)).arrayBuffer();
831
831
  return {
832
832
  assetName: g.name,
833
- base64: Tn(k)
833
+ base64: bn(N)
834
834
  };
835
- })), i = yield Promise.allSettled(f);
836
- for (const g of i) {
837
- const I = {};
835
+ })), o = yield Promise.allSettled(f);
836
+ for (const g of o) {
837
+ const k = {};
838
838
  if (g.status === "fulfilled") {
839
- const { assetName: k, base64: T } = g.value;
840
- I[k] = T;
841
- const W = u ? `${u}/${k}` : k;
842
- h.files[W] = {
839
+ const { assetName: N, base64: T } = g.value;
840
+ k[N] = T;
841
+ const F = c ? `${c}/${N}` : N;
842
+ p.files[F] = {
843
843
  content: T,
844
844
  isBinary: !0
845
845
  };
846
846
  }
847
847
  }
848
848
  }
849
- return d ? { result: null, error: d } : { result: h, error: d };
849
+ return h ? { result: null, error: h } : { result: p, error: h };
850
850
  } finally {
851
- a.close();
851
+ l.close();
852
852
  }
853
853
  });
854
- class Cn extends Error {
854
+ class Tn extends Error {
855
855
  constructor(t, n) {
856
856
  super(t), this.name = "CreateJobError", this.cause = n;
857
857
  }
858
858
  }
859
- class An extends Error {
859
+ class Cn extends Error {
860
860
  constructor() {
861
861
  super(""), this.name = "UnknownCodegenError";
862
862
  }
863
863
  }
864
864
  const Qt = Bt(null);
865
- function hs({ f2cUrl: e, l2cUrl: t, p2cUrl: n, children: r }) {
866
- const [s, c] = nt({ status: "idle" }), l = le(null), [a, m] = nt(St), _ = {
867
- f2c: e,
868
- l2c: t,
869
- p2c: n
870
- }, w = (E, p) => oe(null, null, function* () {
871
- var d;
872
- if (s.status === "pending")
865
+ function hs({ figmaRestApi: e, f2cUrl: t, l2cUrl: n, p2cUrl: r, children: s }) {
866
+ const [i, u] = nt({ status: "idle" }), l = le(null), [d, _] = nt(St), w = {
867
+ f2c: t,
868
+ l2c: n,
869
+ p2c: r
870
+ }, m = (E, h) => oe(null, null, function* () {
871
+ var p;
872
+ if (i.status === "pending")
873
873
  throw new Error("A job is already in progress");
874
874
  l.current = E;
875
875
  try {
876
- const h = _[E], { result: u } = yield Zt(h, "POST", p, (f) => m(f));
877
- if (u) {
878
- const f = u.sessionId, i = u.files, g = u.assets;
879
- c((I) => ({
876
+ const c = w[E], { result: f } = yield Zt(c, "POST", h, (o) => _(o));
877
+ if (f) {
878
+ const o = f.sessionId, g = f.files, k = f.assets;
879
+ u((N) => ({
880
880
  status: "success",
881
881
  type: E,
882
- params: "params" in I ? I.params : {},
883
- sessionId: f,
884
- payload: a.jobStatus,
885
- assets: g,
886
- files: i,
887
- progressMessages: a.progressMessages
882
+ params: "params" in N ? N.params : {},
883
+ sessionId: o,
884
+ payload: d.jobStatus,
885
+ assets: k,
886
+ files: g,
887
+ progressMessages: d.progressMessages
888
888
  }));
889
889
  return;
890
890
  }
891
- } catch (h) {
891
+ } catch (c) {
892
892
  l.current = null;
893
- const u = h instanceof Error ? h.message : "Unknown error", f = new Cn(u, h);
894
- throw c({
893
+ const f = c instanceof Error ? c.message : "Unknown error", o = new Tn(f, c);
894
+ throw u({
895
895
  status: "error",
896
896
  type: E,
897
- params: p,
898
- error: f,
899
- sessionId: (d = a.jobSessionId) != null ? d : null,
900
- payload: a.jobStatus,
901
- progressMessages: a.progressMessages
902
- }), f;
897
+ params: h,
898
+ error: o,
899
+ sessionId: (p = d.jobSessionId) != null ? p : null,
900
+ payload: d.jobStatus,
901
+ progressMessages: d.progressMessages
902
+ }), o;
903
903
  }
904
904
  });
905
905
  return Ht(() => {
906
- var p;
906
+ var h;
907
907
  if (!l.current)
908
908
  return;
909
909
  const E = l.current;
910
- if (a.status === "error") {
911
- const d = (p = a.error) != null ? p : new An();
912
- c((h) => {
913
- var u;
910
+ if (d.status === "error") {
911
+ const p = (h = d.error) != null ? h : new Cn();
912
+ u((c) => {
913
+ var f;
914
914
  return {
915
915
  status: "error",
916
916
  type: E,
917
- params: "params" in h ? h.params : {},
918
- error: d,
919
- sessionId: (u = a.jobSessionId) != null ? u : null,
920
- payload: a.jobStatus,
921
- progressMessages: a.progressMessages
917
+ params: "params" in c ? c.params : {},
918
+ error: p,
919
+ sessionId: (f = d.jobSessionId) != null ? f : null,
920
+ payload: d.jobStatus,
921
+ progressMessages: d.progressMessages
922
922
  };
923
923
  });
924
924
  return;
925
925
  }
926
- if (a.status === "pending") {
927
- c((d) => ({
926
+ if (d.status === "pending") {
927
+ u((p) => ({
928
928
  status: "pending",
929
929
  type: E,
930
- params: "params" in d ? d.params : {},
931
- sessionId: a.jobSessionId,
932
- payload: a.jobStatus,
933
- progressMessages: a.progressMessages
930
+ params: "params" in p ? p.params : {},
931
+ sessionId: d.jobSessionId,
932
+ payload: d.jobStatus,
933
+ progressMessages: d.progressMessages
934
934
  }));
935
935
  return;
936
936
  }
937
- }, [a]), /* @__PURE__ */ wn.jsx(
937
+ }, [d]), /* @__PURE__ */ Sn.jsx(
938
938
  Qt.Provider,
939
939
  {
940
940
  value: {
941
- createJob: w,
942
- job: s
941
+ createJob: m,
942
+ job: i,
943
+ figmaRestApi: e
943
944
  },
944
- children: r
945
+ children: s
945
946
  }
946
947
  );
947
948
  }
948
- function ps() {
949
+ function An() {
949
950
  const e = zt(Qt);
950
951
  if (!e)
951
952
  throw new Error("useAnimaSDK must be used within AnimaSDKProvider");
952
953
  return e;
953
954
  }
954
- const Es = ({
955
+ const ps = ({
955
956
  url: e,
956
957
  method: t = "POST"
957
958
  }) => {
958
959
  const [n, r] = nt(St);
959
960
  return {
960
961
  getCode: Ve(
961
- (c) => Zt(e, t, c, r),
962
+ (i) => Zt(e, t, i, r),
962
963
  [e, t]
963
964
  ),
964
965
  status: n.status,
@@ -980,45 +981,45 @@ var Me = { exports: {} }, He = {};
980
981
  * This source code is licensed under the MIT license found in the
981
982
  * LICENSE file in the root directory of this source tree.
982
983
  */
983
- var Ft;
984
+ var Wt;
984
985
  function Ln() {
985
- if (Ft) return He;
986
- Ft = 1;
986
+ if (Wt) return He;
987
+ Wt = 1;
987
988
  var e = Oe;
988
- function t(E, p) {
989
- return E === p && (E !== 0 || 1 / E === 1 / p) || E !== E && p !== p;
989
+ function t(m, E) {
990
+ return m === E && (m !== 0 || 1 / m === 1 / E) || m !== m && E !== E;
990
991
  }
991
- var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, c = e.useLayoutEffect, l = e.useDebugValue;
992
- function a(E, p) {
993
- var d = p(), h = r({ inst: { value: d, getSnapshot: p } }), u = h[0].inst, f = h[1];
994
- return c(
992
+ var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, i = e.useLayoutEffect, u = e.useDebugValue;
993
+ function l(m, E) {
994
+ var h = E(), p = r({ inst: { value: h, getSnapshot: E } }), c = p[0].inst, f = p[1];
995
+ return i(
995
996
  function() {
996
- u.value = d, u.getSnapshot = p, m(u) && f({ inst: u });
997
+ c.value = h, c.getSnapshot = E, d(c) && f({ inst: c });
997
998
  },
998
- [E, d, p]
999
+ [m, h, E]
999
1000
  ), s(
1000
1001
  function() {
1001
- return m(u) && f({ inst: u }), E(function() {
1002
- m(u) && f({ inst: u });
1002
+ return d(c) && f({ inst: c }), m(function() {
1003
+ d(c) && f({ inst: c });
1003
1004
  });
1004
1005
  },
1005
- [E]
1006
- ), l(d), d;
1006
+ [m]
1007
+ ), u(h), h;
1007
1008
  }
1008
- function m(E) {
1009
- var p = E.getSnapshot;
1010
- E = E.value;
1009
+ function d(m) {
1010
+ var E = m.getSnapshot;
1011
+ m = m.value;
1011
1012
  try {
1012
- var d = p();
1013
- return !n(E, d);
1014
- } catch (h) {
1013
+ var h = E();
1014
+ return !n(m, h);
1015
+ } catch (p) {
1015
1016
  return !0;
1016
1017
  }
1017
1018
  }
1018
- function _(E, p) {
1019
- return p();
1019
+ function _(m, E) {
1020
+ return E();
1020
1021
  }
1021
- var w = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? _ : a;
1022
+ var w = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? _ : l;
1022
1023
  return He.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : w, He;
1023
1024
  }
1024
1025
  var ze = {};
@@ -1031,57 +1032,57 @@ var ze = {};
1031
1032
  * This source code is licensed under the MIT license found in the
1032
1033
  * LICENSE file in the root directory of this source tree.
1033
1034
  */
1034
- var Wt;
1035
+ var Ft;
1035
1036
  function xn() {
1036
- return Wt || (Wt = 1, process.env.NODE_ENV !== "production" && (function() {
1037
- function e(d, h) {
1038
- return d === h && (d !== 0 || 1 / d === 1 / h) || d !== d && h !== h;
1037
+ return Ft || (Ft = 1, process.env.NODE_ENV !== "production" && (function() {
1038
+ function e(h, p) {
1039
+ return h === p && (h !== 0 || 1 / h === 1 / p) || h !== h && p !== p;
1039
1040
  }
1040
- function t(d, h) {
1041
+ function t(h, p) {
1041
1042
  w || s.startTransition === void 0 || (w = !0, console.error(
1042
1043
  "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."
1043
1044
  ));
1044
- var u = h();
1045
- if (!E) {
1046
- var f = h();
1047
- c(u, f) || (console.error(
1045
+ var c = p();
1046
+ if (!m) {
1047
+ var f = p();
1048
+ i(c, f) || (console.error(
1048
1049
  "The result of getSnapshot should be cached to avoid an infinite loop"
1049
- ), E = !0);
1050
+ ), m = !0);
1050
1051
  }
1051
- f = l({
1052
- inst: { value: u, getSnapshot: h }
1052
+ f = u({
1053
+ inst: { value: c, getSnapshot: p }
1053
1054
  });
1054
- var i = f[0].inst, g = f[1];
1055
- return m(
1055
+ var o = f[0].inst, g = f[1];
1056
+ return d(
1056
1057
  function() {
1057
- i.value = u, i.getSnapshot = h, n(i) && g({ inst: i });
1058
+ o.value = c, o.getSnapshot = p, n(o) && g({ inst: o });
1058
1059
  },
1059
- [d, u, h]
1060
- ), a(
1060
+ [h, c, p]
1061
+ ), l(
1061
1062
  function() {
1062
- return n(i) && g({ inst: i }), d(function() {
1063
- n(i) && g({ inst: i });
1063
+ return n(o) && g({ inst: o }), h(function() {
1064
+ n(o) && g({ inst: o });
1064
1065
  });
1065
1066
  },
1066
- [d]
1067
- ), _(u), u;
1067
+ [h]
1068
+ ), _(c), c;
1068
1069
  }
1069
- function n(d) {
1070
- var h = d.getSnapshot;
1071
- d = d.value;
1070
+ function n(h) {
1071
+ var p = h.getSnapshot;
1072
+ h = h.value;
1072
1073
  try {
1073
- var u = h();
1074
- return !c(d, u);
1074
+ var c = p();
1075
+ return !i(h, c);
1075
1076
  } catch (f) {
1076
1077
  return !0;
1077
1078
  }
1078
1079
  }
1079
- function r(d, h) {
1080
- return h();
1080
+ function r(h, p) {
1081
+ return p();
1081
1082
  }
1082
1083
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1083
- var s = Oe, c = typeof Object.is == "function" ? Object.is : e, l = s.useState, a = s.useEffect, m = s.useLayoutEffect, _ = s.useDebugValue, w = !1, E = !1, p = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? r : t;
1084
- ze.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1084
+ var s = Oe, i = typeof Object.is == "function" ? Object.is : e, u = s.useState, l = s.useEffect, d = s.useLayoutEffect, _ = s.useDebugValue, w = !1, m = !1, E = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? r : t;
1085
+ ze.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : E, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1085
1086
  })()), ze;
1086
1087
  }
1087
1088
  var Vt;
@@ -1115,7 +1116,7 @@ const ie = /* @__PURE__ */ new WeakMap(), de = () => {
1115
1116
  }, V = (
1116
1117
  /*#__NOINLINE__*/
1117
1118
  de()
1118
- ), dt = Object, R = (e) => e === V, ee = (e) => typeof e == "function", he = (e, t) => D(D({}, e), t), sn = (e) => ee(e.then), Ke = {}, Fe = {}, wt = "undefined", De = typeof window != wt, ht = typeof document != wt, kn = De && "Deno" in window, Dn = () => De && typeof window.requestAnimationFrame != wt, rn = (e, t) => {
1119
+ ), dt = Object, R = (e) => e === V, ee = (e) => typeof e == "function", he = (e, t) => D(D({}, e), t), sn = (e) => ee(e.then), Ke = {}, We = {}, wt = "undefined", De = typeof window != wt, ht = typeof document != wt, kn = De && "Deno" in window, Dn = () => De && typeof window.requestAnimationFrame != wt, rn = (e, t) => {
1119
1120
  const n = ie.get(e);
1120
1121
  return [
1121
1122
  // Getter
@@ -1124,13 +1125,13 @@ const ie = /* @__PURE__ */ new WeakMap(), de = () => {
1124
1125
  (r) => {
1125
1126
  if (!R(t)) {
1126
1127
  const s = e.get(t);
1127
- t in Fe || (Fe[t] = s), n[5](t, he(s, r), s || Ke);
1128
+ t in We || (We[t] = s), n[5](t, he(s, r), s || Ke);
1128
1129
  }
1129
1130
  },
1130
1131
  // Subscriber
1131
1132
  n[6],
1132
1133
  // Get server cache snapshot
1133
- () => !R(t) && t in Fe ? Fe[t] : !R(t) && e.get(t) || Ke
1134
+ () => !R(t) && t in We ? We[t] : !R(t) && e.get(t) || Ke
1134
1135
  ];
1135
1136
  };
1136
1137
  let pt = !0;
@@ -1145,7 +1146,7 @@ const jn = () => pt, [Et, mt] = De && window.addEventListener ? [
1145
1146
  return R(e) || e !== "hidden";
1146
1147
  }, Mn = (e) => (ht && document.addEventListener("visibilitychange", e), Et("focus", e), () => {
1147
1148
  ht && document.removeEventListener("visibilitychange", e), mt("focus", e);
1148
- }), Fn = (e) => {
1149
+ }), Wn = (e) => {
1149
1150
  const t = () => {
1150
1151
  pt = !0, e();
1151
1152
  }, n = () => {
@@ -1154,37 +1155,37 @@ const jn = () => pt, [Et, mt] = De && window.addEventListener ? [
1154
1155
  return Et("online", t), Et("offline", n), () => {
1155
1156
  mt("online", t), mt("offline", n);
1156
1157
  };
1157
- }, Wn = {
1158
+ }, Fn = {
1158
1159
  isOnline: jn,
1159
1160
  isVisible: Pn
1160
1161
  }, Vn = {
1161
1162
  initFocus: Mn,
1162
- initReconnect: Fn
1163
+ initReconnect: Wn
1163
1164
  }, qt = !Oe.useId, ke = !De || kn, $n = (e) => Dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Xe = ke ? Ht : En, Ze = typeof navigator != "undefined" && navigator.connection, Gt = !ke && Ze && ([
1164
1165
  "slow-2g",
1165
1166
  "2g"
1166
- ].includes(Ze.effectiveType) || Ze.saveData), We = /* @__PURE__ */ new WeakMap(), Un = (e) => dt.prototype.toString.call(e), Qe = (e, t) => e === `[object ${t}]`;
1167
+ ].includes(Ze.effectiveType) || Ze.saveData), Fe = /* @__PURE__ */ new WeakMap(), Un = (e) => dt.prototype.toString.call(e), Qe = (e, t) => e === `[object ${t}]`;
1167
1168
  let qn = 0;
1168
1169
  const gt = (e) => {
1169
- const t = typeof e, n = Un(e), r = Qe(n, "Date"), s = Qe(n, "RegExp"), c = Qe(n, "Object");
1170
- let l, a;
1170
+ const t = typeof e, n = Un(e), r = Qe(n, "Date"), s = Qe(n, "RegExp"), i = Qe(n, "Object");
1171
+ let u, l;
1171
1172
  if (dt(e) === e && !r && !s) {
1172
- if (l = We.get(e), l) return l;
1173
- if (l = ++qn + "~", We.set(e, l), Array.isArray(e)) {
1174
- for (l = "@", a = 0; a < e.length; a++)
1175
- l += gt(e[a]) + ",";
1176
- We.set(e, l);
1173
+ if (u = Fe.get(e), u) return u;
1174
+ if (u = ++qn + "~", Fe.set(e, u), Array.isArray(e)) {
1175
+ for (u = "@", l = 0; l < e.length; l++)
1176
+ u += gt(e[l]) + ",";
1177
+ Fe.set(e, u);
1177
1178
  }
1178
- if (c) {
1179
- l = "#";
1180
- const m = dt.keys(e).sort();
1181
- for (; !R(a = m.pop()); )
1182
- R(e[a]) || (l += a + ":" + gt(e[a]) + ",");
1183
- We.set(e, l);
1179
+ if (i) {
1180
+ u = "#";
1181
+ const d = dt.keys(e).sort();
1182
+ for (; !R(l = d.pop()); )
1183
+ R(e[l]) || (u += l + ":" + gt(e[l]) + ",");
1184
+ Fe.set(e, u);
1184
1185
  }
1185
1186
  } else
1186
- l = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
1187
- return l;
1187
+ u = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
1188
+ return u;
1188
1189
  }, Rt = (e) => {
1189
1190
  if (ee(e))
1190
1191
  try {
@@ -1202,80 +1203,80 @@ let Gn = 0;
1202
1203
  const vt = () => ++Gn;
1203
1204
  function on(...e) {
1204
1205
  return oe(this, null, function* () {
1205
- const [t, n, r, s] = e, c = he({
1206
+ const [t, n, r, s] = e, i = he({
1206
1207
  populateCache: !0,
1207
1208
  throwOnError: !0
1208
1209
  }, typeof s == "boolean" ? {
1209
1210
  revalidate: s
1210
1211
  } : s || {});
1211
- let l = c.populateCache;
1212
- const a = c.rollbackOnError;
1213
- let m = c.optimisticData;
1214
- const _ = (p) => typeof a == "function" ? a(p) : a !== !1, w = c.throwOnError;
1212
+ let u = i.populateCache;
1213
+ const l = i.rollbackOnError;
1214
+ let d = i.optimisticData;
1215
+ const _ = (E) => typeof l == "function" ? l(E) : l !== !1, w = i.throwOnError;
1215
1216
  if (ee(n)) {
1216
- const p = n, d = [], h = t.keys();
1217
- for (const u of h)
1217
+ const E = n, h = [], p = t.keys();
1218
+ for (const c of p)
1218
1219
  // Skip the special useSWRInfinite and useSWRSubscription keys.
1219
- !/^\$(inf|sub)\$/.test(u) && p(t.get(u)._k) && d.push(u);
1220
- return Promise.all(d.map(E));
1220
+ !/^\$(inf|sub)\$/.test(c) && E(t.get(c)._k) && h.push(c);
1221
+ return Promise.all(h.map(m));
1221
1222
  }
1222
- return E(n);
1223
- function E(p) {
1223
+ return m(n);
1224
+ function m(E) {
1224
1225
  return oe(this, null, function* () {
1225
- const [d] = Rt(p);
1226
- if (!d) return;
1227
- const [h, u] = rn(t, d), [f, i, g, I] = ie.get(t), k = () => {
1228
- const C = f[d];
1229
- return (ee(c.revalidate) ? c.revalidate(h().data, p) : c.revalidate !== !1) && (delete g[d], delete I[d], C && C[0]) ? C[0](nn).then(() => h().data) : h().data;
1226
+ const [h] = Rt(E);
1227
+ if (!h) return;
1228
+ const [p, c] = rn(t, h), [f, o, g, k] = ie.get(t), N = () => {
1229
+ const C = f[h];
1230
+ return (ee(i.revalidate) ? i.revalidate(p().data, E) : i.revalidate !== !1) && (delete g[h], delete k[h], C && C[0]) ? C[0](nn).then(() => p().data) : p().data;
1230
1231
  };
1231
1232
  if (e.length < 3)
1232
- return k();
1233
- let T = r, W, $ = !1;
1233
+ return N();
1234
+ let T = r, F, $ = !1;
1234
1235
  const b = vt();
1235
- i[d] = [
1236
+ o[h] = [
1236
1237
  b,
1237
1238
  0
1238
1239
  ];
1239
- const K = !R(m), U = h(), B = U.data, Q = U._c, q = R(Q) ? B : Q;
1240
- if (K && (m = ee(m) ? m(q, B) : m, u({
1241
- data: m,
1240
+ const K = !R(d), U = p(), B = U.data, Q = U._c, q = R(Q) ? B : Q;
1241
+ if (K && (d = ee(d) ? d(q, B) : d, c({
1242
+ data: d,
1242
1243
  _c: q
1243
1244
  })), ee(T))
1244
1245
  try {
1245
1246
  T = T(q);
1246
1247
  } catch (C) {
1247
- W = C, $ = !0;
1248
+ F = C, $ = !0;
1248
1249
  }
1249
1250
  if (T && sn(T))
1250
1251
  if (T = yield T.catch((C) => {
1251
- W = C, $ = !0;
1252
- }), b !== i[d][0]) {
1253
- if ($) throw W;
1252
+ F = C, $ = !0;
1253
+ }), b !== o[h][0]) {
1254
+ if ($) throw F;
1254
1255
  return T;
1255
- } else $ && K && _(W) && (l = !0, u({
1256
+ } else $ && K && _(F) && (u = !0, c({
1256
1257
  data: q,
1257
1258
  _c: V
1258
1259
  }));
1259
- if (l && !$)
1260
- if (ee(l)) {
1261
- const C = l(T, q);
1262
- u({
1260
+ if (u && !$)
1261
+ if (ee(u)) {
1262
+ const C = u(T, q);
1263
+ c({
1263
1264
  data: C,
1264
1265
  error: V,
1265
1266
  _c: V
1266
1267
  });
1267
1268
  } else
1268
- u({
1269
+ c({
1269
1270
  data: T,
1270
1271
  error: V,
1271
1272
  _c: V
1272
1273
  });
1273
- if (i[d][1] = vt(), Promise.resolve(k()).then(() => {
1274
- u({
1274
+ if (o[h][1] = vt(), Promise.resolve(N()).then(() => {
1275
+ c({
1275
1276
  _c: V
1276
1277
  });
1277
1278
  }), $) {
1278
- if (w) throw W;
1279
+ if (w) throw F;
1279
1280
  return;
1280
1281
  }
1281
1282
  return T;
@@ -1289,16 +1290,16 @@ const Jt = (e, t) => {
1289
1290
  }, Jn = (e, t) => {
1290
1291
  if (!ie.has(e)) {
1291
1292
  const n = he(Vn, t), r = /* @__PURE__ */ Object.create(null), s = on.bind(V, e);
1292
- let c = de;
1293
- const l = /* @__PURE__ */ Object.create(null), a = (w, E) => {
1294
- const p = l[w] || [];
1295
- return l[w] = p, p.push(E), () => p.splice(p.indexOf(E), 1);
1296
- }, m = (w, E, p) => {
1297
- e.set(w, E);
1298
- const d = l[w];
1299
- if (d)
1300
- for (const h of d)
1301
- h(E, p);
1293
+ let i = de;
1294
+ const u = /* @__PURE__ */ Object.create(null), l = (w, m) => {
1295
+ const E = u[w] || [];
1296
+ return u[w] = E, E.push(m), () => E.splice(E.indexOf(m), 1);
1297
+ }, d = (w, m, E) => {
1298
+ e.set(w, m);
1299
+ const h = u[w];
1300
+ if (h)
1301
+ for (const p of h)
1302
+ p(m, E);
1302
1303
  }, _ = () => {
1303
1304
  if (!ie.has(e) && (ie.set(e, [
1304
1305
  r,
@@ -1306,12 +1307,12 @@ const Jt = (e, t) => {
1306
1307
  /* @__PURE__ */ Object.create(null),
1307
1308
  /* @__PURE__ */ Object.create(null),
1308
1309
  s,
1309
- m,
1310
- a
1310
+ d,
1311
+ l
1311
1312
  ]), !ke)) {
1312
- const w = n.initFocus(setTimeout.bind(V, Jt.bind(V, r, en))), E = n.initReconnect(setTimeout.bind(V, Jt.bind(V, r, tn)));
1313
- c = () => {
1314
- w && w(), E && E(), ie.delete(e);
1313
+ const w = n.initFocus(setTimeout.bind(V, Jt.bind(V, r, en))), m = n.initReconnect(setTimeout.bind(V, Jt.bind(V, r, tn)));
1314
+ i = () => {
1315
+ w && w(), m && m(), ie.delete(e);
1315
1316
  };
1316
1317
  }
1317
1318
  };
@@ -1319,7 +1320,7 @@ const Jt = (e, t) => {
1319
1320
  e,
1320
1321
  s,
1321
1322
  _,
1322
- c
1323
+ i
1323
1324
  ];
1324
1325
  }
1325
1326
  return [
@@ -1327,8 +1328,8 @@ const Jt = (e, t) => {
1327
1328
  ie.get(e)[4]
1328
1329
  ];
1329
1330
  }, Yn = (e, t, n, r, s) => {
1330
- const c = n.errorRetryCount, l = s.retryCount, a = ~~((Math.random() + 0.5) * (1 << (l < 8 ? l : 8))) * n.errorRetryInterval;
1331
- !R(c) && l > c || setTimeout(r, a, s);
1331
+ const i = n.errorRetryCount, u = s.retryCount, l = ~~((Math.random() + 0.5) * (1 << (u < 8 ? u : 8))) * n.errorRetryInterval;
1332
+ !R(i) && u > i || setTimeout(r, l, s);
1332
1333
  }, Bn = ft, [an, Hn] = Jn(/* @__PURE__ */ new Map()), zn = he(
1333
1334
  {
1334
1335
  // events
@@ -1355,12 +1356,12 @@ const Jt = (e, t) => {
1355
1356
  fallback: {}
1356
1357
  },
1357
1358
  // use web preset by default
1358
- Wn
1359
+ Fn
1359
1360
  ), Kn = (e, t) => {
1360
1361
  const n = he(e, t);
1361
1362
  if (t) {
1362
- const { use: r, fallback: s } = e, { use: c, fallback: l } = t;
1363
- r && c && (n.use = r.concat(c)), s && l && (n.fallback = he(s, l));
1363
+ const { use: r, fallback: s } = e, { use: i, fallback: u } = t;
1364
+ r && i && (n.use = r.concat(i)), s && u && (n.fallback = he(s, u));
1364
1365
  }
1365
1366
  return n;
1366
1367
  }, Xn = Bt({}), Zn = "$inf$", cn = De && window.__SWR_DEVTOOLS_USE__, Qn = cn ? window.__SWR_DEVTOOLS_USE__ : [], es = () => {
@@ -1378,19 +1379,19 @@ const Jt = (e, t) => {
1378
1379
  return Kt(() => he(zn, e), [
1379
1380
  e
1380
1381
  ]);
1381
- }, ss = (e) => (t, n, r) => e(t, n && ((...c) => {
1382
- const [l] = Rt(t), [, , , a] = ie.get(an);
1383
- if (l.startsWith(Zn))
1384
- return n(...c);
1385
- const m = a[l];
1386
- return R(m) ? n(...c) : (delete a[l], m);
1382
+ }, ss = (e) => (t, n, r) => e(t, n && ((...i) => {
1383
+ const [u] = Rt(t), [, , , l] = ie.get(an);
1384
+ if (u.startsWith(Zn))
1385
+ return n(...i);
1386
+ const d = l[u];
1387
+ return R(d) ? n(...i) : (delete l[u], d);
1387
1388
  }), r), rs = Qn.concat(ss), os = (e) => function(...n) {
1388
- const r = ns(), [s, c, l] = ts(n), a = Kn(r, l);
1389
- let m = e;
1390
- const { use: _ } = a, w = (_ || []).concat(rs);
1391
- for (let E = w.length; E--; )
1392
- m = w[E](m);
1393
- return m(s, c || a.fetcher || null, a);
1389
+ const r = ns(), [s, i, u] = ts(n), l = Kn(r, u);
1390
+ let d = e;
1391
+ const { use: _ } = l, w = (_ || []).concat(rs);
1392
+ for (let m = w.length; m--; )
1393
+ d = w[m](d);
1394
+ return d(s, i || l.fetcher || null, l);
1394
1395
  }, as = (e, t, n) => {
1395
1396
  const r = t[e] || (t[e] = []);
1396
1397
  return r.push(n), () => {
@@ -1421,7 +1422,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1421
1422
  }), tt = {
1422
1423
  dedupe: !0
1423
1424
  }, Yt = Promise.resolve(V), is = (e, t, n) => {
1424
- const { cache: r, compare: s, suspense: c, fallbackData: l, revalidateOnMount: a, revalidateIfStale: m, refreshInterval: _, refreshWhenHidden: w, refreshWhenOffline: E, keepPreviousData: p } = n, [d, h, u, f] = ie.get(r), [i, g] = Rt(e), I = le(!1), k = le(!1), T = le(i), W = le(t), $ = le(n), b = () => $.current, K = () => b().isVisible() && b().isOnline(), [U, B, Q, q] = rn(r, i), C = le({}).current, ce = R(l) ? R(n.fallback) ? V : n.fallback[i] : l, ye = (y, x) => {
1425
+ const { cache: r, compare: s, suspense: i, fallbackData: u, revalidateOnMount: l, revalidateIfStale: d, refreshInterval: _, refreshWhenHidden: w, refreshWhenOffline: m, keepPreviousData: E } = n, [h, p, c, f] = ie.get(r), [o, g] = Rt(e), k = le(!1), N = le(!1), T = le(o), F = le(t), $ = le(n), b = () => $.current, K = () => b().isVisible() && b().isOnline(), [U, B, Q, q] = rn(r, o), C = le({}).current, ce = R(u) ? R(n.fallback) ? V : n.fallback[o] : u, ye = (y, x) => {
1425
1426
  for (const M in C) {
1426
1427
  const A = M;
1427
1428
  if (A === "data") {
@@ -1432,73 +1433,73 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1432
1433
  }
1433
1434
  return !0;
1434
1435
  }, be = Kt(() => {
1435
- const y = !i || !t ? !1 : R(a) ? b().isPaused() || c ? !1 : m !== !1 : a, x = (J) => {
1436
+ const y = !o || !t ? !1 : R(l) ? b().isPaused() || i ? !1 : d !== !1 : l, x = (J) => {
1436
1437
  const se = he(J);
1437
1438
  return delete se._k, y ? D({
1438
1439
  isValidating: !0,
1439
1440
  isLoading: !0
1440
1441
  }, se) : se;
1441
1442
  }, M = U(), A = q(), X = x(M), ge = M === A ? X : x(A);
1442
- let F = X;
1443
+ let W = X;
1443
1444
  return [
1444
1445
  () => {
1445
1446
  const J = x(U());
1446
- return ye(J, F) ? (F.data = J.data, F.isLoading = J.isLoading, F.isValidating = J.isValidating, F.error = J.error, F) : (F = J, J);
1447
+ return ye(J, W) ? (W.data = J.data, W.isLoading = J.isLoading, W.isValidating = J.isValidating, W.error = J.error, W) : (W = J, J);
1447
1448
  },
1448
1449
  () => ge
1449
1450
  ];
1450
1451
  }, [
1451
1452
  r,
1452
- i
1453
+ o
1453
1454
  ]), te = In.useSyncExternalStore(Ve(
1454
- (y) => Q(i, (x, M) => {
1455
+ (y) => Q(o, (x, M) => {
1455
1456
  ye(M, x) || y();
1456
1457
  }),
1457
1458
  // eslint-disable-next-line react-hooks/exhaustive-deps
1458
1459
  [
1459
1460
  r,
1460
- i
1461
+ o
1461
1462
  ]
1462
- ), be[0], be[1]), Te = !I.current, o = d[i] && d[i].length > 0, v = te.data, O = R(v) ? ce && sn(ce) ? et(ce) : ce : v, N = te.error, H = le(O), G = p ? R(v) ? R(H.current) ? O : H.current : v : O, Ee = o && !R(N) ? !1 : Te && !R(a) ? a : b().isPaused() ? !1 : c ? R(O) ? !1 : m : R(O) || m, me = !!(i && t && Te && Ee), P = R(te.isValidating) ? me : te.isValidating, ue = R(te.isLoading) ? me : te.isLoading, ne = Ve(
1463
+ ), be[0], be[1]), Te = !k.current, a = h[o] && h[o].length > 0, v = te.data, O = R(v) ? ce && sn(ce) ? et(ce) : ce : v, I = te.error, H = le(O), G = E ? R(v) ? R(H.current) ? O : H.current : v : O, Ee = a && !R(I) ? !1 : Te && !R(l) ? l : b().isPaused() ? !1 : i ? R(O) ? !1 : d : R(O) || d, me = !!(o && t && Te && Ee), P = R(te.isValidating) ? me : te.isValidating, ue = R(te.isLoading) ? me : te.isLoading, ne = Ve(
1463
1464
  (y) => oe(null, null, function* () {
1464
- const x = W.current;
1465
- if (!i || !x || k.current || b().isPaused())
1465
+ const x = F.current;
1466
+ if (!o || !x || N.current || b().isPaused())
1466
1467
  return !1;
1467
1468
  let M, A, X = !0;
1468
- const ge = y || {}, F = !u[i] || !ge.dedupe, J = () => qt ? !k.current && i === T.current && I.current : i === T.current, se = {
1469
+ const ge = y || {}, W = !c[o] || !ge.dedupe, J = () => qt ? !N.current && o === T.current && k.current : o === T.current, se = {
1469
1470
  isValidating: !1,
1470
1471
  isLoading: !1
1471
1472
  }, Ot = () => {
1472
1473
  B(se);
1473
1474
  }, yt = () => {
1474
- const z = u[i];
1475
- z && z[1] === A && delete u[i];
1475
+ const z = c[o];
1476
+ z && z[1] === A && delete c[o];
1476
1477
  }, bt = {
1477
1478
  isValidating: !0
1478
1479
  };
1479
1480
  R(U().data) && (bt.isLoading = !0);
1480
1481
  try {
1481
- if (F && (B(bt), n.loadingTimeout && R(U().data) && setTimeout(() => {
1482
- X && J() && b().onLoadingSlow(i, n);
1483
- }, n.loadingTimeout), u[i] = [
1482
+ if (W && (B(bt), n.loadingTimeout && R(U().data) && setTimeout(() => {
1483
+ X && J() && b().onLoadingSlow(o, n);
1484
+ }, n.loadingTimeout), c[o] = [
1484
1485
  x(g),
1485
1486
  vt()
1486
- ]), [M, A] = u[i], M = yield M, F && setTimeout(yt, n.dedupingInterval), !u[i] || u[i][1] !== A)
1487
- return F && J() && b().onDiscarded(i), !1;
1487
+ ]), [M, A] = c[o], M = yield M, W && setTimeout(yt, n.dedupingInterval), !c[o] || c[o][1] !== A)
1488
+ return W && J() && b().onDiscarded(o), !1;
1488
1489
  se.error = V;
1489
- const z = h[i];
1490
+ const z = p[o];
1490
1491
  if (!R(z) && // case 1
1491
1492
  (A <= z[0] || // case 2
1492
1493
  A <= z[1] || // case 3
1493
1494
  z[1] === 0))
1494
- return Ot(), F && J() && b().onDiscarded(i), !1;
1495
+ return Ot(), W && J() && b().onDiscarded(o), !1;
1495
1496
  const re = U().data;
1496
- se.data = s(re, M) ? re : M, F && J() && b().onSuccess(M, i, n);
1497
+ se.data = s(re, M) ? re : M, W && J() && b().onSuccess(M, o, n);
1497
1498
  } catch (z) {
1498
1499
  yt();
1499
1500
  const re = b(), { shouldRetryOnError: Ge } = re;
1500
- re.isPaused() || (se.error = z, F && J() && (re.onError(z, i, re), (Ge === !0 || ee(Ge) && Ge(z)) && (!b().revalidateOnFocus || !b().revalidateOnReconnect || K()) && re.onErrorRetry(z, i, re, (un) => {
1501
- const Je = d[i];
1501
+ re.isPaused() || (se.error = z, W && J() && (re.onError(z, o, re), (Ge === !0 || ee(Ge) && Ge(z)) && (!b().revalidateOnFocus || !b().revalidateOnReconnect || K()) && re.onErrorRetry(z, o, re, (un) => {
1502
+ const Je = h[o];
1502
1503
  Je && Je[0] && Je[0]($t, un);
1503
1504
  }, {
1504
1505
  retryCount: (ge.retryCount || 0) + 1,
@@ -1519,7 +1520,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1519
1520
  // even though it might cause unexpected behaviors.
1520
1521
  // eslint-disable-next-line react-hooks/exhaustive-deps
1521
1522
  [
1522
- i,
1523
+ o,
1523
1524
  r
1524
1525
  ]
1525
1526
  ), je = Ve(
@@ -1529,16 +1530,16 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1529
1530
  []
1530
1531
  );
1531
1532
  if (Xe(() => {
1532
- W.current = t, $.current = n, R(v) || (H.current = v);
1533
+ F.current = t, $.current = n, R(v) || (H.current = v);
1533
1534
  }), Xe(() => {
1534
- if (!i) return;
1535
+ if (!o) return;
1535
1536
  const y = ne.bind(V, tt);
1536
1537
  let x = 0;
1537
1538
  b().revalidateOnFocus && (x = Date.now() + b().focusThrottleInterval);
1538
- const A = as(i, d, (X, ge = {}) => {
1539
+ const A = as(o, h, (X, ge = {}) => {
1539
1540
  if (X == en) {
1540
- const F = Date.now();
1541
- b().revalidateOnFocus && F > x && K() && (x = F + b().focusThrottleInterval, y());
1541
+ const W = Date.now();
1542
+ b().revalidateOnFocus && W > x && K() && (x = W + b().focusThrottleInterval, y());
1542
1543
  } else if (X == tn)
1543
1544
  b().revalidateOnReconnect && K() && y();
1544
1545
  else {
@@ -1548,13 +1549,13 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1548
1549
  return ne(ge);
1549
1550
  }
1550
1551
  });
1551
- return k.current = !1, T.current = i, I.current = !0, B({
1552
+ return N.current = !1, T.current = o, k.current = !0, B({
1552
1553
  _k: g
1553
- }), Ee && (u[i] || (R(O) || ke ? y() : $n(y))), () => {
1554
- k.current = !0, A();
1554
+ }), Ee && (c[o] || (R(O) || ke ? y() : $n(y))), () => {
1555
+ N.current = !0, A();
1555
1556
  };
1556
1557
  }, [
1557
- i
1558
+ o
1558
1559
  ]), Xe(() => {
1559
1560
  let y;
1560
1561
  function x() {
@@ -1562,7 +1563,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1562
1563
  A && y !== -1 && (y = setTimeout(M, A));
1563
1564
  }
1564
1565
  function M() {
1565
- !U().error && (w || b().isVisible()) && (E || b().isOnline()) ? ne(tt).then(x) : x();
1566
+ !U().error && (w || b().isVisible()) && (m || b().isOnline()) ? ne(tt).then(x) : x();
1566
1567
  }
1567
1568
  return x(), () => {
1568
1569
  y && (clearTimeout(y), y = -1);
@@ -1570,16 +1571,16 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1570
1571
  }, [
1571
1572
  _,
1572
1573
  w,
1573
- E,
1574
- i
1575
- ]), mn(G), c) {
1576
- const y = i && R(O);
1574
+ m,
1575
+ o
1576
+ ]), mn(G), i) {
1577
+ const y = o && R(O);
1577
1578
  if (!qt && ke && y)
1578
1579
  throw new Error("Fallback data is required when using Suspense in SSR.");
1579
- y && (W.current = t, $.current = n, k.current = !1);
1580
- const x = f[i], M = !R(x) && y ? je(x) : Yt;
1581
- if (et(M), !R(N) && y)
1582
- throw N;
1580
+ y && (F.current = t, $.current = n, N.current = !1);
1581
+ const x = f[o], M = !R(x) && y ? je(x) : Yt;
1582
+ if (et(M), !R(I) && y)
1583
+ throw I;
1583
1584
  const A = y ? ne(tt) : Yt;
1584
1585
  !R(G) && y && (A.status = "fulfilled", A.value = !0), et(A);
1585
1586
  }
@@ -1589,7 +1590,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1589
1590
  return C.data = !0, G;
1590
1591
  },
1591
1592
  get error() {
1592
- return C.error = !0, N;
1593
+ return C.error = !0, I;
1593
1594
  },
1594
1595
  get isValidating() {
1595
1596
  return C.isValidating = !0, P;
@@ -1598,18 +1599,17 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1598
1599
  return C.isLoading = !0, ue;
1599
1600
  }
1600
1601
  };
1601
- }, cs = os(is), ms = ({
1602
+ }, cs = os(is), Es = ({
1602
1603
  fileKey: e,
1603
1604
  authToken: t,
1604
1605
  enabled: n = !0,
1605
1606
  params: r = {}
1606
1607
  }) => {
1607
- const s = !!(n && e && t), { data: c, isLoading: l, error: a } = cs(
1608
+ const { figmaRestApi: s } = An(), i = !!(n && e && t), { data: u, isLoading: l, error: d } = cs(
1608
1609
  ["useFigmaFile", e, t, r],
1609
- () => s ? gn({
1610
+ () => i ? s.withOptions(t ? { token: t } : {}).getFile({
1610
1611
  fileKey: e,
1611
- authToken: t,
1612
- params: r
1612
+ depth: r.depth
1613
1613
  }) : null,
1614
1614
  {
1615
1615
  revalidateIfStale: !1,
@@ -1618,18 +1618,18 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
1618
1618
  }
1619
1619
  );
1620
1620
  return {
1621
- data: c != null ? c : null,
1621
+ data: u != null ? u : null,
1622
1622
  isLoading: l,
1623
- error: a
1623
+ error: d
1624
1624
  };
1625
1625
  };
1626
1626
  export {
1627
1627
  Qt as AnimaSdkContext,
1628
1628
  hs as AnimaSdkProvider,
1629
- Cn as CreateJobError,
1630
- An as UnknownCodegenError,
1631
- Es as useAnimaCodegen,
1632
- ps as useAnimaSDK,
1633
- ms as useFigmaFile
1629
+ Tn as CreateJobError,
1630
+ Cn as UnknownCodegenError,
1631
+ ps as useAnimaCodegen,
1632
+ An as useAnimaSDK,
1633
+ Es as useFigmaFile
1634
1634
  };
1635
1635
  //# sourceMappingURL=index.js.map