@animaapp/anima-sdk-react 0.22.0 → 0.23.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.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var on = Object.defineProperty, an = Object.defineProperties;
2
2
  var cn = Object.getOwnPropertyDescriptors;
3
- var _t = Object.getOwnPropertySymbols;
3
+ var yt = Object.getOwnPropertySymbols;
4
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) => {
5
+ var _t = (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
- 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]);
7
+ un.call(n, t) && _t(e, t, n[t]);
8
+ if (yt)
9
+ for (var t of yt(n))
10
+ ln.call(n, t) && _t(e, t, n[t]);
11
11
  return e;
12
- }, Me = (e, n) => an(e, cn(n));
12
+ }, ke = (e, n) => an(e, cn(n));
13
13
  var V = (e, n, t) => new Promise((s, i) => {
14
14
  var c = (r) => {
15
15
  try {
@@ -27,8 +27,8 @@ var V = (e, n, t) => new Promise((s, i) => {
27
27
  l((t = t.apply(e, n)).next());
28
28
  });
29
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";
30
+ import we, { createContext as Wt, useState as Ge, useRef as z, useEffect as Ft, useContext as Vt, useCallback as Ie, useLayoutEffect as fn, useMemo as Pt, useDebugValue as hn } from "react";
31
+ import { CodegenError as Re } from "@animaapp/anima-sdk";
32
32
  class Ot extends Error {
33
33
  constructor(n, t) {
34
34
  super(n), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
@@ -44,12 +44,12 @@ function pn(e) {
44
44
  const { onEvent: n = je, onError: t = je, onRetry: s = je, onComment: i } = e;
45
45
  let c = "", a = !0, l, r = "", o = "";
46
46
  function f(d) {
47
- const g = a ? d.replace(/^\xEF\xBB\xBF/, "") : d, [u, w] = gn(`${c}${g}`);
47
+ const E = a ? d.replace(/^\xEF\xBB\xBF/, "") : d, [u, w] = gn(`${c}${E}`);
48
48
  for (const O of u)
49
- E(O);
49
+ p(O);
50
50
  c = w, a = !1;
51
51
  }
52
- function E(d) {
52
+ function p(d) {
53
53
  if (d === "") {
54
54
  h();
55
55
  return;
@@ -58,31 +58,31 @@ function pn(e) {
58
58
  i && i(d.slice(d.startsWith(": ") ? 2 : 1));
59
59
  return;
60
60
  }
61
- const g = d.indexOf(":");
62
- if (g !== -1) {
63
- const u = d.slice(0, g), w = d[g + 1] === " " ? 2 : 1, O = d.slice(g + w);
61
+ const E = d.indexOf(":");
62
+ if (E !== -1) {
63
+ const u = d.slice(0, E), w = d[E + 1] === " " ? 2 : 1, O = d.slice(E + w);
64
64
  m(u, O, d);
65
65
  return;
66
66
  }
67
67
  m(d, "", d);
68
68
  }
69
- function m(d, g, u) {
69
+ function m(d, E, u) {
70
70
  switch (d) {
71
71
  case "event":
72
- o = g;
72
+ o = E;
73
73
  break;
74
74
  case "data":
75
- r = `${r}${g}
75
+ r = `${r}${E}
76
76
  `;
77
77
  break;
78
78
  case "id":
79
- l = g.includes("\0") ? void 0 : g;
79
+ l = E.includes("\0") ? void 0 : E;
80
80
  break;
81
81
  case "retry":
82
- /^\d+$/.test(g) ? s(parseInt(g, 10)) : t(
83
- new Ot(`Invalid \`retry\` value: "${g}"`, {
82
+ /^\d+$/.test(E) ? s(parseInt(E, 10)) : t(
83
+ new Ot(`Invalid \`retry\` value: "${E}"`, {
84
84
  type: "invalid-retry",
85
- value: g,
85
+ value: E,
86
86
  line: u
87
87
  })
88
88
  );
@@ -91,7 +91,7 @@ function pn(e) {
91
91
  t(
92
92
  new Ot(
93
93
  `Unknown field "${d.length > 20 ? `${d.slice(0, 20)}…` : d}"`,
94
- { type: "unknown-field", field: d, value: g, line: u }
94
+ { type: "unknown-field", field: d, value: E, line: u }
95
95
  )
96
96
  );
97
97
  break;
@@ -107,10 +107,10 @@ function pn(e) {
107
107
  `) ? r.slice(0, -1) : r
108
108
  }), l = void 0, r = "", o = "";
109
109
  }
110
- function p(d = {}) {
111
- c && d.consume && E(c), a = !0, l = void 0, r = "", o = "", c = "";
110
+ function g(d = {}) {
111
+ c && d.consume && p(c), a = !0, l = void 0, r = "", o = "", c = "";
112
112
  }
113
- return { feed: f, reset: p };
113
+ return { feed: f, reset: g };
114
114
  }
115
115
  function gn(e) {
116
116
  const n = [];
@@ -191,11 +191,11 @@ function Rt(e) {
191
191
  }
192
192
  var $t = (e) => {
193
193
  throw TypeError(e);
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;
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, De, Ne, Ee, le, me, Y, ce, de, ue, pe, $, He, Ke, ze, Ct, Ye, Xe, ge, Qe, Ze;
195
195
  class Se extends EventTarget {
196
196
  constructor(n, t) {
197
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* () {
198
+ super(), I(this, $), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, I(this, W), I(this, te), I(this, ie), I(this, De), I(this, Ne), 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* () {
199
199
  var a;
200
200
  S(this, ce).reset();
201
201
  const { body: l, redirected: r, status: o, headers: f } = c;
@@ -214,17 +214,17 @@ class Se extends EventTarget {
214
214
  if (S(this, W) === this.CLOSED)
215
215
  return;
216
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)) {
217
+ const p = new Event("open");
218
+ if ((a = S(this, pe)) == null || a.call(this, p), this.dispatchEvent(p), typeof l != "object" || !l || !("getReader" in l)) {
219
219
  H(this, $, ge).call(this, "Invalid response body, expected a web ReadableStream", o), this.close();
220
220
  return;
221
221
  }
222
222
  const m = new TextDecoder(), h = l.getReader();
223
- let p = !0;
223
+ let g = !0;
224
224
  do {
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);
225
+ const { done: d, value: E } = yield h.read();
226
+ E && S(this, ce).feed(m.decode(E, { stream: !d })), d && (g = !1, S(this, ce).reset(), H(this, $, Qe).call(this));
227
+ } while (g);
228
228
  })), I(this, ze, (c) => {
229
229
  R(this, Y, void 0), !(c.name === "AbortError" || c.type === "aborted") && H(this, $, Qe).call(this, Be(c));
230
230
  }), I(this, Ye, (c) => {
@@ -253,7 +253,7 @@ class Se extends EventTarget {
253
253
  R(this, ce, pn({
254
254
  onEvent: S(this, Ye),
255
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);
256
+ })), R(this, W, this.CONNECTING), R(this, Ee, 3e3), R(this, Ne, (s = t == null ? void 0 : t.fetch) != null ? s : globalThis.fetch), R(this, De, (i = t == null ? void 0 : t.withCredentials) != null ? i : !1), H(this, $, He).call(this);
257
257
  }
258
258
  /**
259
259
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -284,7 +284,7 @@ class Se extends EventTarget {
284
284
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
285
285
  */
286
286
  get withCredentials() {
287
- return S(this, Ie);
287
+ return S(this, De);
288
288
  }
289
289
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
290
290
  get onerror() {
@@ -326,20 +326,20 @@ class Se extends EventTarget {
326
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));
327
327
  }
328
328
  }
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(), /**
329
+ W = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ne = /* @__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(), /**
330
330
  * Connect to the given URL and start receiving events
331
331
  *
332
332
  * @internal
333
333
  */
334
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));
335
+ R(this, W, this.CONNECTING), R(this, Y, new AbortController()), S(this, Ne)(S(this, te), H(this, $, Ct).call(this)).then(S(this, Ke)).catch(S(this, ze));
336
336
  }, Ke = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), /**
337
337
  * Get request options for the `fetch()` request
338
338
  *
339
339
  * @returns The request options
340
340
  * @internal
341
341
  */
342
- Tt = function() {
342
+ Ct = function() {
343
343
  var e;
344
344
  const n = {
345
345
  // [spec] Let `corsAttributeState` be `Anonymous`…
@@ -416,14 +416,14 @@ const Sn = (e) => {
416
416
  jobSessionId: null,
417
417
  jobStatus: {},
418
418
  jobType: null
419
- }, Ct = 10, Ut = (e) => "path" in e ? {
419
+ }, Tt = 10, Jt = (e) => "path" in e ? {
420
420
  filePath: e.path.replace(/^\//, ""),
421
421
  referencePath: e.path === "/" ? "" : e.path
422
422
  // Workaround to avoid duplicated slashes in the URL. Ideally, the fix should be done in Codegen.
423
423
  } : {
424
424
  filePath: e.filePath.replace(/^\//, ""),
425
425
  referencePath: e.referencePath === "/" ? "" : e.referencePath
426
- }, Jt = ({
426
+ }, Ut = ({
427
427
  es: e,
428
428
  lastFetchResponse: n,
429
429
  stateUpdated: t
@@ -452,16 +452,29 @@ const Sn = (e) => {
452
452
  );
453
453
  a.figmaFileName = o.figmaFileName, a.figmaSelectedFrameName = o.figmaSelectedFrameName;
454
454
  }), e.addEventListener("aborted", () => {
455
- const r = new ke({ name: "Aborted", reason: "Unknown" });
455
+ const r = new Re({ name: "Aborted", reason: "Unknown" });
456
456
  s.status = "aborted", s.result = null, s.error = r, t(L({}, s)), i({
457
457
  result: null,
458
458
  error: r
459
459
  });
460
460
  }), e.addEventListener("generating_code", (r) => {
461
+ var f, p;
461
462
  const o = JSON.parse(
462
463
  r.data
463
464
  );
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
+ if (o.payload.status === "success" && (a.files = o.payload.files), o.payload.status === "failure") {
466
+ const m = (p = (f = o.payload.files) == null ? void 0 : f.error) == null ? void 0 : p.content, h = new Re({
467
+ name: "Generation failed",
468
+ reason: "Code generation failed",
469
+ detail: m
470
+ });
471
+ s.status = "error", s.error = h, t(L({}, s)), i({
472
+ result: null,
473
+ error: h
474
+ });
475
+ return;
476
+ }
477
+ s.tasks.codeGeneration.progress = o.payload.progress, s.tasks.codeGeneration.status = "running", t(L({}, s));
465
478
  }), e.addEventListener("progress_messages_updated", (r) => {
466
479
  const o = JSON.parse(
467
480
  r.data
@@ -486,7 +499,7 @@ const Sn = (e) => {
486
499
  });
487
500
  let l = 0;
488
501
  e.addEventListener("error", (r) => V(null, null, function* () {
489
- var p, d, g, u, w, O, x;
502
+ var g, d, E, u, w, O, x;
490
503
  if (!n)
491
504
  return;
492
505
  const o = yield n;
@@ -495,11 +508,11 @@ const Sn = (e) => {
495
508
  try {
496
509
  b = yield o.text();
497
510
  const D = JSON.parse(b);
498
- (p = D == null ? void 0 : D.payload) != null && p.message && (b = D.payload.message);
511
+ (g = D == null ? void 0 : D.payload) != null && g.message && (b = D.payload.message);
499
512
  } catch (D) {
500
513
  }
501
514
  c(
502
- new ke({
515
+ new Re({
503
516
  name: "Request failed",
504
517
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
505
518
  reason: b,
@@ -509,17 +522,17 @@ const Sn = (e) => {
509
522
  return;
510
523
  }
511
524
  console.warn(
512
- `Experienced error during code generation (attempt ${l + 1} / ${Ct})`,
525
+ `Experienced error during code generation (attempt ${l + 1} / ${Tt})`,
513
526
  r
514
527
  );
515
- let f, E = !1;
528
+ let f, p = !1;
516
529
  if (r instanceof MessageEvent)
517
530
  try {
518
531
  f = JSON.parse(r.data);
519
532
  } catch (b) {
520
533
  }
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({
534
+ (((d = f == null ? void 0 : f.payload) == null ? void 0 : d.name) === "Task Crashed" || ((E = f == null ? void 0 : f.payload) == null ? void 0 : E.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") && (p = !0);
535
+ const m = new Re({
523
536
  name: (O = f == null ? void 0 : f.payload.name) != null ? O : "Unknown error",
524
537
  reason: (x = f == null ? void 0 : f.payload.message) != null ? x : "Unknown",
525
538
  status: f == null ? void 0 : f.payload.status,
@@ -527,7 +540,7 @@ const Sn = (e) => {
527
540
  });
528
541
  l++;
529
542
  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({
543
+ l > Tt ? (console.error("Experienced too many errors, terminating request"), h = !0) : p && (console.error("Experienced unrecoverable error, terminating request"), h = !0), h && (s.status = "error", s.error = m, t(L({}, s)), i({
531
544
  result: null,
532
545
  error: m
533
546
  }));
@@ -540,20 +553,20 @@ const Sn = (e) => {
540
553
  var l;
541
554
  const i = structuredClone(t);
542
555
  if (((l = t.assetsStorage) == null ? void 0 : l.strategy) === "local") {
543
- const { referencePath: r } = Ut(
556
+ const { referencePath: r } = Jt(
544
557
  t.assetsStorage
545
558
  );
546
559
  t.assetsStorage = { strategy: "external", url: r };
547
560
  }
548
561
  let c;
549
562
  const a = new Se(e, {
550
- fetch: (r, o) => (c = fetch(r, Me(L({}, o), {
563
+ fetch: (r, o) => (c = fetch(r, ke(L({}, o), {
551
564
  method: n,
552
565
  body: JSON.stringify(t)
553
566
  })), c)
554
567
  });
555
568
  try {
556
- const { result: r, error: o } = yield Jt({
569
+ const { result: r, error: o } = yield Ut({
557
570
  es: a,
558
571
  lastFetchResponse: c,
559
572
  stateUpdated: s
@@ -569,13 +582,13 @@ const Sn = (e) => {
569
582
  const s = structuredClone(n);
570
583
  let i;
571
584
  const c = new Se(e, {
572
- fetch: (a, l) => (i = fetch(a, Me(L({}, l), {
585
+ fetch: (a, l) => (i = fetch(a, ke(L({}, l), {
573
586
  method: "POST",
574
587
  body: JSON.stringify(n)
575
588
  })), i)
576
589
  });
577
590
  try {
578
- const { result: a, error: l } = yield Jt({
591
+ const { result: a, error: l } = yield Ut({
579
592
  es: c,
580
593
  lastFetchResponse: i,
581
594
  stateUpdated: t
@@ -590,7 +603,7 @@ const Sn = (e) => {
590
603
  }), Gt = (e, n) => V(null, null, function* () {
591
604
  var t, s;
592
605
  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(
606
+ const { filePath: i } = Jt(n.assetsStorage), c = e.assets.map(
594
607
  (l) => V(null, null, function* () {
595
608
  const o = yield (yield fetch(l.url)).arrayBuffer();
596
609
  return {
@@ -614,34 +627,34 @@ class wn extends Error {
614
627
  super(n), this.name = "CreateJobError", this.cause = t;
615
628
  }
616
629
  }
617
- class _n extends Error {
630
+ class yn extends Error {
618
631
  constructor(n, t) {
619
632
  super(n), this.name = "AttachJobError", this.cause = t;
620
633
  }
621
634
  }
622
- class yn extends Error {
635
+ class _n extends Error {
623
636
  constructor() {
624
637
  super(""), this.name = "UnknownCodegenError";
625
638
  }
626
639
  }
627
640
  const Bt = Wt(null);
628
641
  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 = {
642
+ const [a, l] = Ge({ status: "idle" }), r = z(null), [o, f] = Ge(ut), p = {
630
643
  f2c: n,
631
644
  l2c: t,
632
645
  p2c: s
633
- }, m = (p, d) => V(null, null, function* () {
634
- var g;
646
+ }, m = (g, d) => V(null, null, function* () {
647
+ var E;
635
648
  if (a.status === "pending")
636
649
  throw new Error("A job is already in progress");
637
- r.current = p;
650
+ r.current = g;
638
651
  try {
639
- const u = E[p], { result: w } = yield qt(u, "POST", d, (O) => f(O));
652
+ const u = p[g], { result: w } = yield qt(u, "POST", d, (O) => f(O));
640
653
  if (w) {
641
654
  const O = w.sessionId, x = w.files, b = w.assets;
642
655
  l((D) => ({
643
656
  status: "success",
644
- type: p,
657
+ type: g,
645
658
  params: "params" in D ? D.params : {},
646
659
  sessionId: O,
647
660
  payload: o.jobStatus,
@@ -656,20 +669,20 @@ function us({ figmaRestApi: e, f2cUrl: n, l2cUrl: t, p2cUrl: s, jobsUrl: i, chil
656
669
  const w = u instanceof Error ? u.message : "Unknown error", O = new wn(w, u);
657
670
  throw l({
658
671
  status: "error",
659
- type: p,
672
+ type: g,
660
673
  params: d,
661
674
  error: O,
662
- sessionId: (g = o.jobSessionId) != null ? g : null,
675
+ sessionId: (E = o.jobSessionId) != null ? E : null,
663
676
  payload: o.jobStatus,
664
677
  progressMessages: o.progressMessages
665
678
  }), O;
666
679
  }
667
- }), h = (p, d) => V(null, null, function* () {
680
+ }), h = (g, d) => V(null, null, function* () {
668
681
  if (!i)
669
682
  throw new Error("jobsUrl is required in order to attach to a job");
670
683
  try {
671
- const g = `${i}/${p}`, { result: u } = yield vn(
672
- g,
684
+ const E = `${i}/${g}`, { result: u } = yield vn(
685
+ E,
673
686
  d,
674
687
  (w) => f(w)
675
688
  );
@@ -679,37 +692,37 @@ function us({ figmaRestApi: e, f2cUrl: n, l2cUrl: t, p2cUrl: s, jobsUrl: i, chil
679
692
  status: "success",
680
693
  type: o.jobType,
681
694
  params: "params" in x ? x.params : {},
682
- sessionId: p,
695
+ sessionId: g,
683
696
  payload: o.jobStatus,
684
697
  assets: O,
685
698
  files: w,
686
699
  progressMessages: o.progressMessages
687
700
  }));
688
701
  }
689
- } catch (g) {
690
- const u = g instanceof Error ? g.message : "Unknown error", w = new _n(u, g);
702
+ } catch (E) {
703
+ const u = E instanceof Error ? E.message : "Unknown error", w = new yn(u, E);
691
704
  throw l({
692
705
  status: "error",
693
706
  type: r.current,
694
707
  params: {},
695
708
  error: w,
696
- sessionId: p,
709
+ sessionId: g,
697
710
  payload: o.jobStatus,
698
711
  progressMessages: o.progressMessages
699
712
  }), w;
700
713
  }
701
714
  });
702
715
  return Ft(() => {
703
- var d, g;
704
- const p = (d = r.current) != null ? d : o.jobType;
705
- if (p) {
716
+ var d, E;
717
+ const g = (d = r.current) != null ? d : o.jobType;
718
+ if (g) {
706
719
  if (o.status === "error") {
707
- const u = (g = o.error) != null ? g : new yn();
720
+ const u = (E = o.error) != null ? E : new _n();
708
721
  l((w) => {
709
722
  var O;
710
723
  return {
711
724
  status: "error",
712
- type: p,
725
+ type: g,
713
726
  params: "params" in w ? w.params : {},
714
727
  error: u,
715
728
  sessionId: (O = o.jobSessionId) != null ? O : null,
@@ -722,7 +735,7 @@ function us({ figmaRestApi: e, f2cUrl: n, l2cUrl: t, p2cUrl: s, jobsUrl: i, chil
722
735
  if (o.status === "pending") {
723
736
  l((u) => ({
724
737
  status: "pending",
725
- type: p,
738
+ type: g,
726
739
  params: "params" in u ? u.params : {},
727
740
  sessionId: o.jobSessionId,
728
741
  payload: o.jobStatus,
@@ -756,7 +769,7 @@ const ls = ({
756
769
  }) => {
757
770
  const [t, s] = Ge(ut);
758
771
  return {
759
- getCode: Le(
772
+ getCode: Ie(
760
773
  (c) => qt(e, n, c, s),
761
774
  [e, n]
762
775
  ),
@@ -769,7 +782,7 @@ const ls = ({
769
782
  result: t.result
770
783
  };
771
784
  };
772
- var Re = { exports: {} }, We = {};
785
+ var Ce = { exports: {} }, We = {};
773
786
  /**
774
787
  * @license React
775
788
  * use-sync-external-store-shim.production.js
@@ -784,37 +797,37 @@ function bn() {
784
797
  if (Lt) return We;
785
798
  Lt = 1;
786
799
  var e = we;
787
- function n(E, m) {
788
- return E === m && (E !== 0 || 1 / E === 1 / m) || E !== E && m !== m;
800
+ function n(p, m) {
801
+ return p === m && (p !== 0 || 1 / p === 1 / m) || p !== p && m !== m;
789
802
  }
790
803
  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];
804
+ function l(p, m) {
805
+ var h = m(), g = s({ inst: { value: h, getSnapshot: m } }), d = g[0].inst, E = g[1];
793
806
  return c(
794
807
  function() {
795
- d.value = h, d.getSnapshot = m, r(d) && g({ inst: d });
808
+ d.value = h, d.getSnapshot = m, r(d) && E({ inst: d });
796
809
  },
797
- [E, h, m]
810
+ [p, h, m]
798
811
  ), i(
799
812
  function() {
800
- return r(d) && g({ inst: d }), E(function() {
801
- r(d) && g({ inst: d });
813
+ return r(d) && E({ inst: d }), p(function() {
814
+ r(d) && E({ inst: d });
802
815
  });
803
816
  },
804
- [E]
817
+ [p]
805
818
  ), a(h), h;
806
819
  }
807
- function r(E) {
808
- var m = E.getSnapshot;
809
- E = E.value;
820
+ function r(p) {
821
+ var m = p.getSnapshot;
822
+ p = p.value;
810
823
  try {
811
824
  var h = m();
812
- return !t(E, h);
813
- } catch (p) {
825
+ return !t(p, h);
826
+ } catch (g) {
814
827
  return !0;
815
828
  }
816
829
  }
817
- function o(E, m) {
830
+ function o(p, m) {
818
831
  return m();
819
832
  }
820
833
  var f = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? o : l;
@@ -833,29 +846,29 @@ var Fe = {};
833
846
  var It;
834
847
  function Rn() {
835
848
  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;
849
+ function e(h, g) {
850
+ return h === g && (h !== 0 || 1 / h === 1 / g) || h !== h && g !== g;
838
851
  }
839
- function n(h, p) {
852
+ function n(h, g) {
840
853
  f || i.startTransition === void 0 || (f = !0, console.error(
841
854
  "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."
842
855
  ));
843
- var d = p();
844
- if (!E) {
845
- var g = p();
846
- c(d, g) || (console.error(
856
+ var d = g();
857
+ if (!p) {
858
+ var E = g();
859
+ c(d, E) || (console.error(
847
860
  "The result of getSnapshot should be cached to avoid an infinite loop"
848
- ), E = !0);
861
+ ), p = !0);
849
862
  }
850
- g = a({
851
- inst: { value: d, getSnapshot: p }
863
+ E = a({
864
+ inst: { value: d, getSnapshot: g }
852
865
  });
853
- var u = g[0].inst, w = g[1];
866
+ var u = E[0].inst, w = E[1];
854
867
  return r(
855
868
  function() {
856
- u.value = d, u.getSnapshot = p, t(u) && w({ inst: u });
869
+ u.value = d, u.getSnapshot = g, t(u) && w({ inst: u });
857
870
  },
858
- [h, d, p]
871
+ [h, d, g]
859
872
  ), l(
860
873
  function() {
861
874
  return t(u) && w({ inst: u }), h(function() {
@@ -866,28 +879,28 @@ function Rn() {
866
879
  ), o(d), d;
867
880
  }
868
881
  function t(h) {
869
- var p = h.getSnapshot;
882
+ var g = h.getSnapshot;
870
883
  h = h.value;
871
884
  try {
872
- var d = p();
885
+ var d = g();
873
886
  return !c(h, d);
874
- } catch (g) {
887
+ } catch (E) {
875
888
  return !0;
876
889
  }
877
890
  }
878
- function s(h, p) {
879
- return p();
891
+ function s(h, g) {
892
+ return g();
880
893
  }
881
894
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
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;
895
+ 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, p = !1, m = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? s : n;
883
896
  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
897
  })()), Fe;
885
898
  }
886
899
  var Dt;
887
- function Tn() {
888
- return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? Re.exports = bn() : Re.exports = Rn()), Re.exports;
900
+ function Cn() {
901
+ return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? Ce.exports = bn() : Ce.exports = Rn()), Ce.exports;
889
902
  }
890
- var Cn = Tn();
903
+ var Tn = Cn();
891
904
  const Ht = 0, Kt = 1, zt = 2, Nt = 3;
892
905
  var At = Object.prototype.hasOwnProperty;
893
906
  function et(e, n) {
@@ -914,7 +927,7 @@ const K = /* @__PURE__ */ new WeakMap(), X = () => {
914
927
  }, M = (
915
928
  /*#__NOINLINE__*/
916
929
  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) => {
930
+ ), 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", ye = typeof window != lt, nt = typeof document != lt, Ln = ye && "Deno" in window, In = () => ye && typeof window.requestAnimationFrame != lt, Xt = (e, n) => {
918
931
  const t = K.get(e);
919
932
  return [
920
933
  // Getter
@@ -933,7 +946,7 @@ const K = /* @__PURE__ */ new WeakMap(), X = () => {
933
946
  ];
934
947
  };
935
948
  let st = !0;
936
- const Dn = () => st, [rt, ot] = _e && window.addEventListener ? [
949
+ const Dn = () => st, [rt, ot] = ye && window.addEventListener ? [
937
950
  window.addEventListener.bind(window),
938
951
  window.removeEventListener.bind(window)
939
952
  ] : [
@@ -959,27 +972,27 @@ const Dn = () => st, [rt, ot] = _e && window.addEventListener ? [
959
972
  }, kn = {
960
973
  initFocus: An,
961
974
  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 && ([
975
+ }, xt = !we.useId, ve = !ye || Ln, jn = (e) => In() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Pe = ve ? Ft : fn, $e = typeof navigator != "undefined" && navigator.connection, Mt = !ve && $e && ([
963
976
  "slow-2g",
964
977
  "2g"
965
- ].includes($e.effectiveType) || $e.saveData), Ce = /* @__PURE__ */ new WeakMap(), Wn = (e) => tt.prototype.toString.call(e), Ue = (e, n) => e === `[object ${n}]`;
978
+ ].includes($e.effectiveType) || $e.saveData), Le = /* @__PURE__ */ new WeakMap(), Wn = (e) => tt.prototype.toString.call(e), Je = (e, n) => e === `[object ${n}]`;
966
979
  let Fn = 0;
967
980
  const at = (e) => {
968
- const n = typeof e, t = Wn(e), s = Ue(t, "Date"), i = Ue(t, "RegExp"), c = Ue(t, "Object");
981
+ const n = typeof e, t = Wn(e), s = Je(t, "Date"), i = Je(t, "RegExp"), c = Je(t, "Object");
969
982
  let a, l;
970
983
  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)) {
984
+ if (a = Le.get(e), a) return a;
985
+ if (a = ++Fn + "~", Le.set(e, a), Array.isArray(e)) {
973
986
  for (a = "@", l = 0; l < e.length; l++)
974
987
  a += at(e[l]) + ",";
975
- Ce.set(e, a);
988
+ Le.set(e, a);
976
989
  }
977
990
  if (c) {
978
991
  a = "#";
979
992
  const r = tt.keys(e).sort();
980
993
  for (; !v(l = r.pop()); )
981
994
  v(e[l]) || (a += l + ":" + at(e[l]) + ",");
982
- Ce.set(e, a);
995
+ Le.set(e, a);
983
996
  }
984
997
  } else
985
998
  a = s ? e.toJSON() : n == "symbol" ? e.toString() : n == "string" ? JSON.stringify(e) : "" + e;
@@ -1012,30 +1025,30 @@ function Qt(...e) {
1012
1025
  let r = c.optimisticData;
1013
1026
  const o = (m) => typeof l == "function" ? l(m) : l !== !1, f = c.throwOnError;
1014
1027
  if (q(t)) {
1015
- const m = t, h = [], p = n.keys();
1016
- for (const d of p)
1028
+ const m = t, h = [], g = n.keys();
1029
+ for (const d of g)
1017
1030
  // Skip the special useSWRInfinite and useSWRSubscription keys.
1018
1031
  !/^\$(inf|sub)\$/.test(d) && m(n.get(d)._k) && h.push(d);
1019
- return Promise.all(h.map(E));
1032
+ return Promise.all(h.map(p));
1020
1033
  }
1021
- return E(t);
1022
- function E(m) {
1034
+ return p(t);
1035
+ function p(m) {
1023
1036
  return V(this, null, function* () {
1024
1037
  const [h] = dt(m);
1025
1038
  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;
1039
+ const [g, d] = Xt(n, h), [E, u, w, O] = K.get(n), x = () => {
1040
+ const k = E[h];
1041
+ return (q(c.revalidate) ? c.revalidate(g().data, m) : c.revalidate !== !1) && (delete w[h], delete O[h], k && k[0]) ? k[0](zt).then(() => g().data) : g().data;
1029
1042
  };
1030
1043
  if (e.length < 3)
1031
1044
  return x();
1032
- let b = s, D, U = !1;
1033
- const C = it();
1045
+ let b = s, D, J = !1;
1046
+ const T = it();
1034
1047
  u[h] = [
1035
- C,
1048
+ T,
1036
1049
  0
1037
1050
  ];
1038
- const ne = !v(r), J = p(), se = J.data, ye = J._c, Z = v(ye) ? se : ye;
1051
+ const ne = !v(r), U = g(), se = U.data, _e = U._c, Z = v(_e) ? se : _e;
1039
1052
  if (ne && (r = q(r) ? r(Z, se) : r, d({
1040
1053
  data: r,
1041
1054
  _c: Z
@@ -1043,19 +1056,19 @@ function Qt(...e) {
1043
1056
  try {
1044
1057
  b = b(Z);
1045
1058
  } catch (k) {
1046
- D = k, U = !0;
1059
+ D = k, J = !0;
1047
1060
  }
1048
1061
  if (b && Yt(b))
1049
1062
  if (b = yield b.catch((k) => {
1050
- D = k, U = !0;
1051
- }), C !== u[h][0]) {
1052
- if (U) throw D;
1063
+ D = k, J = !0;
1064
+ }), T !== u[h][0]) {
1065
+ if (J) throw D;
1053
1066
  return b;
1054
- } else U && ne && o(D) && (a = !0, d({
1067
+ } else J && ne && o(D) && (a = !0, d({
1055
1068
  data: Z,
1056
1069
  _c: M
1057
1070
  }));
1058
- if (a && !U)
1071
+ if (a && !J)
1059
1072
  if (q(a)) {
1060
1073
  const k = a(b, Z);
1061
1074
  d({
@@ -1073,7 +1086,7 @@ function Qt(...e) {
1073
1086
  d({
1074
1087
  _c: M
1075
1088
  });
1076
- }), U) {
1089
+ }), J) {
1077
1090
  if (f) throw D;
1078
1091
  return;
1079
1092
  }
@@ -1089,15 +1102,15 @@ const kt = (e, n) => {
1089
1102
  if (!K.has(e)) {
1090
1103
  const t = Q(kn, n), s = /* @__PURE__ */ Object.create(null), i = Qt.bind(M, e);
1091
1104
  let c = X;
1092
- const a = /* @__PURE__ */ Object.create(null), l = (f, E) => {
1105
+ const a = /* @__PURE__ */ Object.create(null), l = (f, p) => {
1093
1106
  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);
1107
+ return a[f] = m, m.push(p), () => m.splice(m.indexOf(p), 1);
1108
+ }, r = (f, p, m) => {
1109
+ e.set(f, p);
1097
1110
  const h = a[f];
1098
1111
  if (h)
1099
- for (const p of h)
1100
- p(E, m);
1112
+ for (const g of h)
1113
+ g(p, m);
1101
1114
  }, o = () => {
1102
1115
  if (!K.has(e) && (K.set(e, [
1103
1116
  s,
@@ -1108,9 +1121,9 @@ const kt = (e, n) => {
1108
1121
  r,
1109
1122
  l
1110
1123
  ]), !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)));
1124
+ const f = t.initFocus(setTimeout.bind(M, kt.bind(M, s, Ht))), p = t.initReconnect(setTimeout.bind(M, kt.bind(M, s, Kt)));
1112
1125
  c = () => {
1113
- f && f(), E && E(), K.delete(e);
1126
+ f && f(), p && p(), K.delete(e);
1114
1127
  };
1115
1128
  }
1116
1129
  };
@@ -1128,7 +1141,7 @@ const kt = (e, n) => {
1128
1141
  }, $n = (e, n, t, s, i) => {
1129
1142
  const c = t.errorRetryCount, a = i.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * t.errorRetryInterval;
1130
1143
  !v(c) && a > c || setTimeout(s, l, i);
1131
- }, Un = et, [Zt, Jn] = Pn(/* @__PURE__ */ new Map()), qn = Q(
1144
+ }, Jn = et, [Zt, Un] = Pn(/* @__PURE__ */ new Map()), qn = Q(
1132
1145
  {
1133
1146
  // events
1134
1147
  onLoadingSlow: X,
@@ -1147,10 +1160,10 @@ const kt = (e, n) => {
1147
1160
  dedupingInterval: 2 * 1e3,
1148
1161
  loadingTimeout: Mt ? 5e3 : 3e3,
1149
1162
  // providers
1150
- compare: Un,
1163
+ compare: Jn,
1151
1164
  isPaused: () => !1,
1152
1165
  cache: Zt,
1153
- mutate: Jn,
1166
+ mutate: Un,
1154
1167
  fallback: {}
1155
1168
  },
1156
1169
  // use web preset by default
@@ -1162,7 +1175,7 @@ const kt = (e, n) => {
1162
1175
  s && c && (t.use = s.concat(c)), i && a && (t.fallback = Q(i, a));
1163
1176
  }
1164
1177
  return t;
1165
- }, Bn = Wt({}), Hn = "$inf$", en = _e && window.__SWR_DEVTOOLS_USE__, Kn = en ? window.__SWR_DEVTOOLS_USE__ : [], zn = () => {
1178
+ }, Bn = Wt({}), Hn = "$inf$", en = ye && window.__SWR_DEVTOOLS_USE__, Kn = en ? window.__SWR_DEVTOOLS_USE__ : [], zn = () => {
1166
1179
  en && (window.__SWR_DEVTOOLS_REACT__ = we);
1167
1180
  }, Yn = (e) => q(e[1]) ? [
1168
1181
  e[0],
@@ -1187,8 +1200,8 @@ const kt = (e, n) => {
1187
1200
  const s = Xn(), [i, c, a] = Yn(t), l = Gn(s, a);
1188
1201
  let r = e;
1189
1202
  const { use: o } = l, f = (o || []).concat(Zn);
1190
- for (let E = f.length; E--; )
1191
- r = f[E](r);
1203
+ for (let p = f.length; p--; )
1204
+ r = f[p](r);
1192
1205
  return r(i, c || l.fetcher || null, l);
1193
1206
  }, ts = (e, n, t) => {
1194
1207
  const s = n[e] || (n[e] = []);
@@ -1198,7 +1211,7 @@ const kt = (e, n) => {
1198
1211
  };
1199
1212
  };
1200
1213
  zn();
1201
- const Je = we.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
1214
+ const Ue = we.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
1202
1215
  // and emitting an error.
1203
1216
  // We assume that this is only for the `use(thenable)` case, not `use(context)`.
1204
1217
  // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
@@ -1220,28 +1233,28 @@ const Je = we.use || // This extra generic is to avoid TypeScript mixing up the
1220
1233
  }), qe = {
1221
1234
  dedupe: !0
1222
1235
  }, 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) => {
1236
+ const { cache: s, compare: i, suspense: c, fallbackData: a, revalidateOnMount: l, revalidateIfStale: r, refreshInterval: o, refreshWhenHidden: f, refreshWhenOffline: p, keepPreviousData: m } = t, [h, g, d, E] = K.get(s), [u, w] = dt(e), O = z(!1), x = z(!1), b = z(u), D = z(n), J = z(t), T = () => J.current, ne = () => T().isVisible() && T().isOnline(), [U, se, _e, Z] = Xt(s, u), k = z({}).current, fe = v(a) ? v(t.fallback) ? M : t.fallback[u] : a, ft = (y, C) => {
1224
1237
  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])))
1238
+ const _ = N;
1239
+ if (_ === "data") {
1240
+ if (!i(y[_], C[_]) && (!v(y[_]) || !i(be, C[_])))
1228
1241
  return !1;
1229
- } else if (T[y] !== _[y])
1242
+ } else if (C[_] !== y[_])
1230
1243
  return !1;
1231
1244
  }
1232
1245
  return !0;
1233
1246
  }, ht = Pt(() => {
1234
- const _ = !u || !n ? !1 : v(l) ? C().isPaused() || c ? !1 : r !== !1 : l, T = (j) => {
1247
+ const y = !u || !n ? !1 : v(l) ? T().isPaused() || c ? !1 : r !== !1 : l, C = (j) => {
1235
1248
  const G = Q(j);
1236
- return delete G._k, _ ? L({
1249
+ return delete G._k, y ? L({
1237
1250
  isValidating: !0,
1238
1251
  isLoading: !0
1239
1252
  }, G) : G;
1240
- }, N = J(), y = Z(), P = T(N), ae = N === y ? P : T(y);
1253
+ }, N = U(), _ = Z(), P = C(N), ae = N === _ ? P : C(_);
1241
1254
  let A = P;
1242
1255
  return [
1243
1256
  () => {
1244
- const j = T(J());
1257
+ const j = C(U());
1245
1258
  return ft(j, A) ? (A.data = j.data, A.isLoading = j.isLoading, A.isValidating = j.isValidating, A.error = j.error, A) : (A = j, j);
1246
1259
  },
1247
1260
  () => ae
@@ -1249,56 +1262,56 @@ const Je = we.use || // This extra generic is to avoid TypeScript mixing up the
1249
1262
  }, [
1250
1263
  s,
1251
1264
  u
1252
- ]), re = Cn.useSyncExternalStore(Le(
1253
- (_) => ye(u, (T, N) => {
1254
- ft(N, T) || _();
1265
+ ]), re = Tn.useSyncExternalStore(Ie(
1266
+ (y) => _e(u, (C, N) => {
1267
+ ft(N, C) || y();
1255
1268
  }),
1256
1269
  // eslint-disable-next-line react-hooks/exhaustive-deps
1257
1270
  [
1258
1271
  s,
1259
1272
  u
1260
1273
  ]
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())
1274
+ ), ht[0], ht[1]), pt = !O.current, tn = h[u] && h[u].length > 0, oe = re.data, ee = v(oe) ? fe && Yt(fe) ? Ue(fe) : fe : oe, Oe = re.error, Ae = z(ee), be = m ? v(oe) ? v(Ae.current) ? ee : Ae.current : oe : ee, gt = tn && !v(Oe) ? !1 : pt && !v(l) ? l : T().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 = Ie(
1275
+ (y) => V(null, null, function* () {
1276
+ const C = D.current;
1277
+ if (!u || !C || x.current || T().isPaused())
1265
1278
  return !1;
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 = {
1279
+ let N, _, P = !0;
1280
+ const ae = y || {}, A = !d[u] || !ae.dedupe, j = () => xt ? !x.current && u === b.current && O.current : u === b.current, G = {
1268
1281
  isValidating: !1,
1269
1282
  isLoading: !1
1270
1283
  }, St = () => {
1271
1284
  se(G);
1272
1285
  }, vt = () => {
1273
1286
  const F = d[u];
1274
- F && F[1] === y && delete d[u];
1287
+ F && F[1] === _ && delete d[u];
1275
1288
  }, wt = {
1276
1289
  isValidating: !0
1277
1290
  };
1278
- v(J().data) && (wt.isLoading = !0);
1291
+ v(U().data) && (wt.isLoading = !0);
1279
1292
  try {
1280
- if (A && (se(wt), t.loadingTimeout && v(J().data) && setTimeout(() => {
1281
- P && j() && C().onLoadingSlow(u, t);
1293
+ if (A && (se(wt), t.loadingTimeout && v(U().data) && setTimeout(() => {
1294
+ P && j() && T().onLoadingSlow(u, t);
1282
1295
  }, t.loadingTimeout), d[u] = [
1283
- T(w),
1296
+ C(w),
1284
1297
  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;
1298
+ ]), [N, _] = d[u], N = yield N, A && setTimeout(vt, t.dedupingInterval), !d[u] || d[u][1] !== _)
1299
+ return A && j() && T().onDiscarded(u), !1;
1287
1300
  G.error = M;
1288
- const F = p[u];
1301
+ const F = g[u];
1289
1302
  if (!v(F) && // case 1
1290
- (y <= F[0] || // case 2
1291
- y <= F[1] || // case 3
1303
+ (_ <= F[0] || // case 2
1304
+ _ <= F[1] || // case 3
1292
1305
  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);
1306
+ return St(), A && j() && T().onDiscarded(u), !1;
1307
+ const B = U().data;
1308
+ G.data = i(B, N) ? B : N, A && j() && T().onSuccess(N, u, t);
1296
1309
  } catch (F) {
1297
1310
  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);
1311
+ const B = T(), { shouldRetryOnError: xe } = B;
1312
+ B.isPaused() || (G.error = F, A && j() && (B.onError(F, u, B), (xe === !0 || q(xe) && xe(F)) && (!T().revalidateOnFocus || !T().revalidateOnReconnect || ne()) && B.onErrorRetry(F, u, B, (rn) => {
1313
+ const Me = h[u];
1314
+ Me && Me[0] && Me[0](Nt, rn);
1302
1315
  }, {
1303
1316
  retryCount: (ae.retryCount || 0) + 1,
1304
1317
  dedupe: !0
@@ -1321,25 +1334,25 @@ const Je = we.use || // This extra generic is to avoid TypeScript mixing up the
1321
1334
  u,
1322
1335
  s
1323
1336
  ]
1324
- ), mt = Le(
1337
+ ), mt = Ie(
1325
1338
  // Use callback to make sure `keyRef.current` returns latest result every time
1326
- (..._) => Qt(s, b.current, ..._),
1339
+ (...y) => Qt(s, b.current, ...y),
1327
1340
  // eslint-disable-next-line react-hooks/exhaustive-deps
1328
1341
  []
1329
1342
  );
1330
1343
  if (Pe(() => {
1331
- D.current = n, U.current = t, v(oe) || (Ne.current = oe);
1344
+ D.current = n, J.current = t, v(oe) || (Ae.current = oe);
1332
1345
  }), Pe(() => {
1333
1346
  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 = {}) => {
1347
+ const y = he.bind(M, qe);
1348
+ let C = 0;
1349
+ T().revalidateOnFocus && (C = Date.now() + T().focusThrottleInterval);
1350
+ const _ = ts(u, h, (P, ae = {}) => {
1338
1351
  if (P == Ht) {
1339
1352
  const A = Date.now();
1340
- C().revalidateOnFocus && A > T && ne() && (T = A + C().focusThrottleInterval, _());
1353
+ T().revalidateOnFocus && A > C && ne() && (C = A + T().focusThrottleInterval, y());
1341
1354
  } else if (P == Kt)
1342
- C().revalidateOnReconnect && ne() && _();
1355
+ T().revalidateOnReconnect && ne() && y();
1343
1356
  else {
1344
1357
  if (P == zt)
1345
1358
  return he();
@@ -1349,38 +1362,38 @@ const Je = we.use || // This extra generic is to avoid TypeScript mixing up the
1349
1362
  });
1350
1363
  return x.current = !1, b.current = u, O.current = !0, se({
1351
1364
  _k: w
1352
- }), gt && (d[u] || (v(ee) || ve ? _() : jn(_))), () => {
1353
- x.current = !0, y();
1365
+ }), gt && (d[u] || (v(ee) || ve ? y() : jn(y))), () => {
1366
+ x.current = !0, _();
1354
1367
  };
1355
1368
  }, [
1356
1369
  u
1357
1370
  ]), Pe(() => {
1358
- let _;
1359
- function T() {
1360
- const y = q(o) ? o(J().data) : o;
1361
- y && _ !== -1 && (_ = setTimeout(N, y));
1371
+ let y;
1372
+ function C() {
1373
+ const _ = q(o) ? o(U().data) : o;
1374
+ _ && y !== -1 && (y = setTimeout(N, _));
1362
1375
  }
1363
1376
  function N() {
1364
- !J().error && (f || C().isVisible()) && (E || C().isOnline()) ? he(qe).then(T) : T();
1377
+ !U().error && (f || T().isVisible()) && (p || T().isOnline()) ? he(qe).then(C) : C();
1365
1378
  }
1366
- return T(), () => {
1367
- _ && (clearTimeout(_), _ = -1);
1379
+ return C(), () => {
1380
+ y && (clearTimeout(y), y = -1);
1368
1381
  };
1369
1382
  }, [
1370
1383
  o,
1371
1384
  f,
1372
- E,
1385
+ p,
1373
1386
  u
1374
1387
  ]), hn(be), c) {
1375
- const _ = u && v(ee);
1376
- if (!xt && ve && _)
1388
+ const y = u && v(ee);
1389
+ if (!xt && ve && y)
1377
1390
  throw new Error("Fallback data is required when using Suspense in SSR.");
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) && _)
1391
+ y && (D.current = n, J.current = t, x.current = !1);
1392
+ const C = E[u], N = !v(C) && y ? mt(C) : jt;
1393
+ if (Ue(N), !v(Oe) && y)
1381
1394
  throw Oe;
1382
- const y = _ ? he(qe) : jt;
1383
- !v(be) && _ && (y.status = "fulfilled", y.value = !0), Je(y);
1395
+ const _ = y ? he(qe) : jt;
1396
+ !v(be) && y && (_.status = "fulfilled", _.value = !0), Ue(_);
1384
1397
  }
1385
1398
  return {
1386
1399
  mutate: mt,
@@ -1424,9 +1437,9 @@ const Je = we.use || // This extra generic is to avoid TypeScript mixing up the
1424
1437
  export {
1425
1438
  Bt as AnimaSdkContext,
1426
1439
  us as AnimaSdkProvider,
1427
- _n as AttachJobError,
1440
+ yn as AttachJobError,
1428
1441
  wn as CreateJobError,
1429
- yn as UnknownCodegenError,
1442
+ _n as UnknownCodegenError,
1430
1443
  ls as useAnimaCodegen,
1431
1444
  On as useAnimaSDK,
1432
1445
  ds as useFigmaFile