@figma-vars/hooks 1.1.0 → 1.2.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/contexts/FigmaTokenContext.d.ts +39 -1
- package/dist/figma-vars-hooks.js +661 -775
- package/dist/figma-vars-hooks.umd.cjs +6 -6
- package/dist/hooks/useFigmaToken.d.ts +11 -0
- package/dist/hooks/useVariableCollections.d.ts +20 -7
- package/dist/hooks/useVariableModes.d.ts +12 -4
- package/dist/hooks/useVariables.d.ts +18 -7
- package/dist/index.d.ts +4 -6
- package/dist/mutations/bulkUpdateVariables.d.ts +25 -7
- package/dist/mutations/createVariable.d.ts +26 -7
- package/dist/mutations/deleteVariable.d.ts +19 -7
- package/dist/mutations/updateVariable.d.ts +26 -7
- package/dist/types/figma.d.ts +63 -0
- package/dist/types/hooks.d.ts +6 -13
- package/dist/types/mutations.d.ts +54 -16
- package/dist/utils/fetcher.d.ts +13 -0
- package/dist/utils/filterVariables.d.ts +26 -0
- package/package.json +1 -1
- package/dist/utils/authHelpers.d.ts +0 -4
- package/dist/utils/fetchHelpers.d.ts +0 -10
package/dist/figma-vars-hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import ce, { createContext as rt, useContext as ot, useEffect as ht, useLayoutEffect as _t, useRef as oe, useMemo as Re, useCallback as ge, useDebugValue as St } from "react";
|
|
2
|
+
var he = { exports: {} }, de = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -9,29 +9,29 @@ var Se = { exports: {} }, pe = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var e = Symbol.for("react.transitional.element"),
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (a !== void 0 && (
|
|
12
|
+
var He;
|
|
13
|
+
function Ot() {
|
|
14
|
+
if (He) return de;
|
|
15
|
+
He = 1;
|
|
16
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
17
|
+
function n(o, s, a) {
|
|
18
|
+
var u = null;
|
|
19
|
+
if (a !== void 0 && (u = "" + a), s.key !== void 0 && (u = "" + s.key), "key" in s) {
|
|
20
20
|
a = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else a =
|
|
24
|
-
return
|
|
21
|
+
for (var p in s)
|
|
22
|
+
p !== "key" && (a[p] = s[p]);
|
|
23
|
+
} else a = s;
|
|
24
|
+
return s = a.ref, {
|
|
25
25
|
$$typeof: e,
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
26
|
+
type: o,
|
|
27
|
+
key: u,
|
|
28
|
+
ref: s !== void 0 ? s : null,
|
|
29
29
|
props: a
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return de.Fragment = t, de.jsx = n, de.jsxs = n, de;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var me = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -41,166 +41,166 @@ var ve = {};
|
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
function e(
|
|
48
|
-
if (
|
|
49
|
-
if (typeof
|
|
50
|
-
return
|
|
51
|
-
if (typeof
|
|
52
|
-
switch (
|
|
53
|
-
case
|
|
44
|
+
var Be;
|
|
45
|
+
function Rt() {
|
|
46
|
+
return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
+
function e(r) {
|
|
48
|
+
if (r == null) return null;
|
|
49
|
+
if (typeof r == "function")
|
|
50
|
+
return r.$$typeof === N ? null : r.displayName || r.name || null;
|
|
51
|
+
if (typeof r == "string") return r;
|
|
52
|
+
switch (r) {
|
|
53
|
+
case d:
|
|
54
54
|
return "Fragment";
|
|
55
|
-
case
|
|
55
|
+
case i:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case I:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case b:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case
|
|
61
|
+
case j:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case Z:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
|
-
if (typeof
|
|
67
|
-
switch (typeof
|
|
66
|
+
if (typeof r == "object")
|
|
67
|
+
switch (typeof r.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
),
|
|
70
|
-
case
|
|
69
|
+
), r.$$typeof) {
|
|
70
|
+
case v:
|
|
71
71
|
return "Portal";
|
|
72
72
|
case ne:
|
|
73
|
-
return (
|
|
74
|
-
case
|
|
75
|
-
return (
|
|
76
|
-
case
|
|
77
|
-
var l =
|
|
78
|
-
return
|
|
79
|
-
case
|
|
80
|
-
return l =
|
|
73
|
+
return (r.displayName || "Context") + ".Provider";
|
|
74
|
+
case q:
|
|
75
|
+
return (r._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case U:
|
|
77
|
+
var l = r.render;
|
|
78
|
+
return r = r.displayName, r || (r = l.displayName || l.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
79
|
+
case z:
|
|
80
|
+
return l = r.displayName || null, l !== null ? l : e(r.type) || "Memo";
|
|
81
81
|
case O:
|
|
82
|
-
l =
|
|
82
|
+
l = r._payload, r = r._init;
|
|
83
83
|
try {
|
|
84
|
-
return e(
|
|
84
|
+
return e(r(l));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function r
|
|
91
|
-
return "" +
|
|
90
|
+
function t(r) {
|
|
91
|
+
return "" + r;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function n(r) {
|
|
94
94
|
try {
|
|
95
|
-
r
|
|
95
|
+
t(r);
|
|
96
96
|
var l = !1;
|
|
97
97
|
} catch {
|
|
98
98
|
l = !0;
|
|
99
99
|
}
|
|
100
100
|
if (l) {
|
|
101
101
|
l = console;
|
|
102
|
-
var
|
|
103
|
-
return
|
|
102
|
+
var h = l.error, T = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
103
|
+
return h.call(
|
|
104
104
|
l,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
106
|
T
|
|
107
|
-
), r
|
|
107
|
+
), t(r);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (
|
|
112
|
-
if (typeof
|
|
110
|
+
function o(r) {
|
|
111
|
+
if (r === d) return "<>";
|
|
112
|
+
if (typeof r == "object" && r !== null && r.$$typeof === O)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var l = e(
|
|
115
|
+
var l = e(r);
|
|
116
116
|
return l ? "<" + l + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var
|
|
123
|
-
return
|
|
121
|
+
function s() {
|
|
122
|
+
var r = W.A;
|
|
123
|
+
return r === null ? null : r.getOwner();
|
|
124
124
|
}
|
|
125
125
|
function a() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
130
|
-
var l = Object.getOwnPropertyDescriptor(
|
|
128
|
+
function u(r) {
|
|
129
|
+
if ($.call(r, "key")) {
|
|
130
|
+
var l = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
131
131
|
if (l && l.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
|
-
return
|
|
133
|
+
return r.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
function
|
|
137
|
-
|
|
135
|
+
function p(r, l) {
|
|
136
|
+
function h() {
|
|
137
|
+
re || (re = !0, console.error(
|
|
138
138
|
"%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)",
|
|
139
139
|
l
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
h.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
143
|
+
get: h,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var
|
|
149
|
-
return
|
|
147
|
+
function _() {
|
|
148
|
+
var r = e(this.type);
|
|
149
|
+
return ue[r] || (ue[r] = !0, console.error(
|
|
150
150
|
"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."
|
|
151
|
-
)),
|
|
151
|
+
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
155
|
-
$$typeof:
|
|
156
|
-
type:
|
|
153
|
+
function A(r, l, h, T, F, x, se, ae) {
|
|
154
|
+
return h = x.ref, r = {
|
|
155
|
+
$$typeof: c,
|
|
156
|
+
type: r,
|
|
157
157
|
key: l,
|
|
158
|
-
props:
|
|
158
|
+
props: x,
|
|
159
159
|
_owner: F
|
|
160
|
-
}, (
|
|
160
|
+
}, (h !== void 0 ? h : null) !== null ? Object.defineProperty(r, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
|
-
get:
|
|
163
|
-
}) : Object.defineProperty(
|
|
162
|
+
get: _
|
|
163
|
+
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
writable: !0,
|
|
167
167
|
value: 0
|
|
168
|
-
}), Object.defineProperty(
|
|
168
|
+
}), Object.defineProperty(r, "_debugInfo", {
|
|
169
169
|
configurable: !1,
|
|
170
170
|
enumerable: !1,
|
|
171
171
|
writable: !0,
|
|
172
172
|
value: null
|
|
173
|
-
}), Object.defineProperty(
|
|
173
|
+
}), Object.defineProperty(r, "_debugStack", {
|
|
174
174
|
configurable: !1,
|
|
175
175
|
enumerable: !1,
|
|
176
176
|
writable: !0,
|
|
177
|
-
value:
|
|
178
|
-
}), Object.defineProperty(
|
|
177
|
+
value: se
|
|
178
|
+
}), Object.defineProperty(r, "_debugTask", {
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
183
|
-
}), Object.freeze && (Object.freeze(
|
|
182
|
+
value: ae
|
|
183
|
+
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
185
|
+
function w(r, l, h, T, F, x, se, ae) {
|
|
186
|
+
var y = l.children;
|
|
187
|
+
if (y !== void 0)
|
|
188
188
|
if (T)
|
|
189
|
-
if (
|
|
190
|
-
for (T = 0; T <
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
189
|
+
if (k(y)) {
|
|
190
|
+
for (T = 0; T < y.length; T++)
|
|
191
|
+
f(y[T]);
|
|
192
|
+
Object.freeze && Object.freeze(y);
|
|
193
193
|
} else
|
|
194
194
|
console.error(
|
|
195
195
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
196
|
);
|
|
197
|
-
else
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
return
|
|
197
|
+
else f(y);
|
|
198
|
+
if ($.call(l, "key")) {
|
|
199
|
+
y = e(r);
|
|
200
|
+
var Q = Object.keys(l).filter(function(ve) {
|
|
201
|
+
return ve !== "key";
|
|
202
202
|
});
|
|
203
|
-
T = 0 <
|
|
203
|
+
T = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", fe[y + T] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
@@ -208,94 +208,95 @@ React keys must be passed directly to JSX without using spread:
|
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
210
|
T,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
),
|
|
211
|
+
y,
|
|
212
|
+
Q,
|
|
213
|
+
y
|
|
214
|
+
), fe[y + T] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
for (var
|
|
219
|
-
|
|
220
|
-
} else
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
typeof
|
|
224
|
-
),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
216
|
+
if (y = null, h !== void 0 && (n(h), y = "" + h), u(l) && (n(l.key), y = "" + l.key), "key" in l) {
|
|
217
|
+
h = {};
|
|
218
|
+
for (var B in l)
|
|
219
|
+
B !== "key" && (h[B] = l[B]);
|
|
220
|
+
} else h = l;
|
|
221
|
+
return y && p(
|
|
222
|
+
h,
|
|
223
|
+
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
224
|
+
), A(
|
|
225
|
+
r,
|
|
226
|
+
y,
|
|
227
|
+
x,
|
|
228
228
|
F,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
s(),
|
|
230
|
+
h,
|
|
231
|
+
se,
|
|
232
|
+
ae
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
typeof
|
|
235
|
+
function f(r) {
|
|
236
|
+
typeof r == "object" && r !== null && r.$$typeof === c && r._store && (r._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var m = ce, c = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), q = Symbol.for("react.consumer"), ne = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), W = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, k = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
242
|
-
"react-stack-bottom-frame": function(
|
|
243
|
-
return
|
|
241
|
+
m = {
|
|
242
|
+
"react-stack-bottom-frame": function(r) {
|
|
243
|
+
return r();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
|
|
246
|
+
var re, ue = {}, le = m["react-stack-bottom-frame"].bind(
|
|
247
|
+
m,
|
|
248
248
|
a
|
|
249
|
-
)(), H = Y(
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
return
|
|
253
|
-
|
|
249
|
+
)(), H = Y(o(a)), fe = {};
|
|
250
|
+
me.Fragment = d, me.jsx = function(r, l, h, T, F) {
|
|
251
|
+
var x = 1e4 > W.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return w(
|
|
253
|
+
r,
|
|
254
254
|
l,
|
|
255
|
-
|
|
255
|
+
h,
|
|
256
256
|
!1,
|
|
257
257
|
T,
|
|
258
258
|
F,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
x ? Error("react-stack-top-frame") : le,
|
|
260
|
+
x ? Y(o(r)) : H
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
265
|
-
|
|
262
|
+
}, me.jsxs = function(r, l, h, T, F) {
|
|
263
|
+
var x = 1e4 > W.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return w(
|
|
265
|
+
r,
|
|
266
266
|
l,
|
|
267
|
-
|
|
267
|
+
h,
|
|
268
268
|
!0,
|
|
269
269
|
T,
|
|
270
270
|
F,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
x ? Error("react-stack-top-frame") : le,
|
|
272
|
+
x ? Y(o(r)) : H
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
}()),
|
|
275
|
+
}()), me;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var Je;
|
|
278
278
|
function wt() {
|
|
279
|
-
return
|
|
279
|
+
return Je || (Je = 1, process.env.NODE_ENV === "production" ? he.exports = Ot() : he.exports = Rt()), he.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
const
|
|
281
|
+
var Tt = wt();
|
|
282
|
+
const st = rt(
|
|
283
283
|
void 0
|
|
284
|
-
),
|
|
284
|
+
), an = ({
|
|
285
285
|
children: e,
|
|
286
|
-
token:
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
token: t,
|
|
287
|
+
fileKey: n
|
|
288
|
+
}) => /* @__PURE__ */ Tt.jsx(st.Provider, { value: { token: t, fileKey: n }, children: e }), at = () => {
|
|
289
|
+
const e = ot(st);
|
|
289
290
|
if (e === void 0)
|
|
290
291
|
throw new Error(
|
|
291
292
|
"useFigmaTokenContext must be used within a FigmaVarsProvider"
|
|
292
293
|
);
|
|
293
294
|
return e;
|
|
294
|
-
},
|
|
295
|
-
const { token: e } =
|
|
295
|
+
}, cn = () => {
|
|
296
|
+
const { token: e } = at();
|
|
296
297
|
return e;
|
|
297
298
|
};
|
|
298
|
-
var
|
|
299
|
+
var _e = { exports: {} }, be = {};
|
|
299
300
|
/**
|
|
300
301
|
* @license React
|
|
301
302
|
* use-sync-external-store-shim.production.js
|
|
@@ -305,48 +306,48 @@ var be = { exports: {} }, ye = {};
|
|
|
305
306
|
* This source code is licensed under the MIT license found in the
|
|
306
307
|
* LICENSE file in the root directory of this source tree.
|
|
307
308
|
*/
|
|
308
|
-
var
|
|
309
|
-
function
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
var e =
|
|
313
|
-
function
|
|
314
|
-
return
|
|
309
|
+
var Ke;
|
|
310
|
+
function gt() {
|
|
311
|
+
if (Ke) return be;
|
|
312
|
+
Ke = 1;
|
|
313
|
+
var e = ce;
|
|
314
|
+
function t(f, m) {
|
|
315
|
+
return f === m && (f !== 0 || 1 / f === 1 / m) || f !== f && m !== m;
|
|
315
316
|
}
|
|
316
|
-
var
|
|
317
|
-
function f
|
|
318
|
-
var
|
|
317
|
+
var n = typeof Object.is == "function" ? Object.is : t, o = e.useState, s = e.useEffect, a = e.useLayoutEffect, u = e.useDebugValue;
|
|
318
|
+
function p(f, m) {
|
|
319
|
+
var c = m(), v = o({ inst: { value: c, getSnapshot: m } }), d = v[0].inst, I = v[1];
|
|
319
320
|
return a(
|
|
320
321
|
function() {
|
|
321
|
-
|
|
322
|
+
d.value = c, d.getSnapshot = m, _(d) && I({ inst: d });
|
|
322
323
|
},
|
|
323
|
-
[
|
|
324
|
-
),
|
|
324
|
+
[f, c, m]
|
|
325
|
+
), s(
|
|
325
326
|
function() {
|
|
326
|
-
return
|
|
327
|
-
|
|
327
|
+
return _(d) && I({ inst: d }), f(function() {
|
|
328
|
+
_(d) && I({ inst: d });
|
|
328
329
|
});
|
|
329
330
|
},
|
|
330
|
-
[
|
|
331
|
-
),
|
|
331
|
+
[f]
|
|
332
|
+
), u(c), c;
|
|
332
333
|
}
|
|
333
|
-
function
|
|
334
|
-
var
|
|
335
|
-
|
|
334
|
+
function _(f) {
|
|
335
|
+
var m = f.getSnapshot;
|
|
336
|
+
f = f.value;
|
|
336
337
|
try {
|
|
337
|
-
var
|
|
338
|
-
return !
|
|
338
|
+
var c = m();
|
|
339
|
+
return !n(f, c);
|
|
339
340
|
} catch {
|
|
340
341
|
return !0;
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
344
|
+
function A(f, m) {
|
|
345
|
+
return m();
|
|
345
346
|
}
|
|
346
|
-
var
|
|
347
|
-
return
|
|
347
|
+
var w = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? A : p;
|
|
348
|
+
return be.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : w, be;
|
|
348
349
|
}
|
|
349
|
-
var
|
|
350
|
+
var ye = {};
|
|
350
351
|
/**
|
|
351
352
|
* @license React
|
|
352
353
|
* use-sync-external-store-shim.development.js
|
|
@@ -356,293 +357,293 @@ var Ae = {};
|
|
|
356
357
|
* This source code is licensed under the MIT license found in the
|
|
357
358
|
* LICENSE file in the root directory of this source tree.
|
|
358
359
|
*/
|
|
359
|
-
var
|
|
360
|
-
function
|
|
361
|
-
return
|
|
362
|
-
function e(
|
|
363
|
-
return
|
|
360
|
+
var Xe;
|
|
361
|
+
function bt() {
|
|
362
|
+
return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
363
|
+
function e(c, v) {
|
|
364
|
+
return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
-
|
|
366
|
+
function t(c, v) {
|
|
367
|
+
w || s.startTransition === void 0 || (w = !0, console.error(
|
|
367
368
|
"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."
|
|
368
369
|
));
|
|
369
|
-
var
|
|
370
|
-
if (!
|
|
371
|
-
var
|
|
372
|
-
a(
|
|
370
|
+
var d = v();
|
|
371
|
+
if (!f) {
|
|
372
|
+
var I = v();
|
|
373
|
+
a(d, I) || (console.error(
|
|
373
374
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
374
|
-
),
|
|
375
|
+
), f = !0);
|
|
375
376
|
}
|
|
376
|
-
|
|
377
|
-
inst: { value:
|
|
377
|
+
I = u({
|
|
378
|
+
inst: { value: d, getSnapshot: v }
|
|
378
379
|
});
|
|
379
|
-
var
|
|
380
|
-
return
|
|
380
|
+
var i = I[0].inst, q = I[1];
|
|
381
|
+
return _(
|
|
381
382
|
function() {
|
|
382
|
-
|
|
383
|
+
i.value = d, i.getSnapshot = v, n(i) && q({ inst: i });
|
|
383
384
|
},
|
|
384
|
-
[
|
|
385
|
-
),
|
|
385
|
+
[c, d, v]
|
|
386
|
+
), p(
|
|
386
387
|
function() {
|
|
387
|
-
return
|
|
388
|
-
|
|
388
|
+
return n(i) && q({ inst: i }), c(function() {
|
|
389
|
+
n(i) && q({ inst: i });
|
|
389
390
|
});
|
|
390
391
|
},
|
|
391
|
-
[
|
|
392
|
-
),
|
|
392
|
+
[c]
|
|
393
|
+
), A(d), d;
|
|
393
394
|
}
|
|
394
|
-
function
|
|
395
|
-
var
|
|
396
|
-
|
|
395
|
+
function n(c) {
|
|
396
|
+
var v = c.getSnapshot;
|
|
397
|
+
c = c.value;
|
|
397
398
|
try {
|
|
398
|
-
var
|
|
399
|
-
return !a(
|
|
399
|
+
var d = v();
|
|
400
|
+
return !a(c, d);
|
|
400
401
|
} catch {
|
|
401
402
|
return !0;
|
|
402
403
|
}
|
|
403
404
|
}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
405
|
+
function o(c, v) {
|
|
406
|
+
return v();
|
|
406
407
|
}
|
|
407
408
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
}()),
|
|
409
|
+
var s = ce, a = typeof Object.is == "function" ? Object.is : e, u = s.useState, p = s.useEffect, _ = s.useLayoutEffect, A = s.useDebugValue, w = !1, f = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : t;
|
|
410
|
+
ye.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
411
|
+
}()), ye;
|
|
411
412
|
}
|
|
412
|
-
var
|
|
413
|
-
function
|
|
414
|
-
return
|
|
413
|
+
var ze;
|
|
414
|
+
function yt() {
|
|
415
|
+
return ze || (ze = 1, process.env.NODE_ENV === "production" ? _e.exports = gt() : _e.exports = bt()), _e.exports;
|
|
415
416
|
}
|
|
416
|
-
var
|
|
417
|
-
const
|
|
418
|
-
var
|
|
419
|
-
function
|
|
420
|
-
var
|
|
421
|
-
if (e ===
|
|
422
|
-
if (e &&
|
|
423
|
-
if (
|
|
424
|
-
if (
|
|
425
|
-
if (
|
|
426
|
-
if ((
|
|
427
|
-
for (;
|
|
428
|
-
return
|
|
417
|
+
var At = yt();
|
|
418
|
+
const it = 0, ct = 1, ut = 2, Ze = 3;
|
|
419
|
+
var Qe = Object.prototype.hasOwnProperty;
|
|
420
|
+
function Le(e, t) {
|
|
421
|
+
var n, o;
|
|
422
|
+
if (e === t) return !0;
|
|
423
|
+
if (e && t && (n = e.constructor) === t.constructor) {
|
|
424
|
+
if (n === Date) return e.getTime() === t.getTime();
|
|
425
|
+
if (n === RegExp) return e.toString() === t.toString();
|
|
426
|
+
if (n === Array) {
|
|
427
|
+
if ((o = e.length) === t.length)
|
|
428
|
+
for (; o-- && Le(e[o], t[o]); ) ;
|
|
429
|
+
return o === -1;
|
|
429
430
|
}
|
|
430
|
-
if (!
|
|
431
|
-
|
|
432
|
-
for (
|
|
433
|
-
if (
|
|
434
|
-
return Object.keys(
|
|
431
|
+
if (!n || typeof e == "object") {
|
|
432
|
+
o = 0;
|
|
433
|
+
for (n in e)
|
|
434
|
+
if (Qe.call(e, n) && ++o && !Qe.call(t, n) || !(n in t) || !Le(e[n], t[n])) return !1;
|
|
435
|
+
return Object.keys(t).length === o;
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
|
-
return e !== e &&
|
|
438
|
+
return e !== e && t !== t;
|
|
438
439
|
}
|
|
439
|
-
const X = /* @__PURE__ */ new WeakMap(),
|
|
440
|
-
},
|
|
440
|
+
const X = /* @__PURE__ */ new WeakMap(), ee = () => {
|
|
441
|
+
}, P = (
|
|
441
442
|
/*#__NOINLINE__*/
|
|
442
|
-
|
|
443
|
-
), Pe = Object,
|
|
443
|
+
ee()
|
|
444
|
+
), Pe = Object, E = (e) => e === P, G = (e) => typeof e == "function", te = (e, t) => ({
|
|
444
445
|
...e,
|
|
445
|
-
...
|
|
446
|
-
}),
|
|
447
|
-
const
|
|
446
|
+
...t
|
|
447
|
+
}), lt = (e) => G(e.then), Ae = {}, Se = {}, Ue = "undefined", pe = typeof window != Ue, ke = typeof document != Ue, Ct = pe && "Deno" in window, Dt = () => pe && typeof window.requestAnimationFrame != Ue, ft = (e, t) => {
|
|
448
|
+
const n = X.get(e);
|
|
448
449
|
return [
|
|
449
450
|
// Getter
|
|
450
|
-
() => !
|
|
451
|
+
() => !E(t) && e.get(t) || Ae,
|
|
451
452
|
// Setter
|
|
452
|
-
(
|
|
453
|
-
if (!
|
|
454
|
-
const
|
|
455
|
-
|
|
453
|
+
(o) => {
|
|
454
|
+
if (!E(t)) {
|
|
455
|
+
const s = e.get(t);
|
|
456
|
+
t in Se || (Se[t] = s), n[5](t, te(s, o), s || Ae);
|
|
456
457
|
}
|
|
457
458
|
},
|
|
458
459
|
// Subscriber
|
|
459
|
-
|
|
460
|
+
n[6],
|
|
460
461
|
// Get server cache snapshot
|
|
461
|
-
() => !
|
|
462
|
+
() => !E(t) && t in Se ? Se[t] : !E(t) && e.get(t) || Ae
|
|
462
463
|
];
|
|
463
464
|
};
|
|
464
|
-
let
|
|
465
|
-
const
|
|
465
|
+
let Ne = !0;
|
|
466
|
+
const It = () => Ne, [Fe, Ve] = pe && window.addEventListener ? [
|
|
466
467
|
window.addEventListener.bind(window),
|
|
467
468
|
window.removeEventListener.bind(window)
|
|
468
469
|
] : [
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
],
|
|
472
|
-
const e =
|
|
473
|
-
return
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
}),
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
|
|
470
|
+
ee,
|
|
471
|
+
ee
|
|
472
|
+
], jt = () => {
|
|
473
|
+
const e = ke && document.visibilityState;
|
|
474
|
+
return E(e) || e !== "hidden";
|
|
475
|
+
}, xt = (e) => (ke && document.addEventListener("visibilitychange", e), Fe("focus", e), () => {
|
|
476
|
+
ke && document.removeEventListener("visibilitychange", e), Ve("focus", e);
|
|
477
|
+
}), Lt = (e) => {
|
|
478
|
+
const t = () => {
|
|
479
|
+
Ne = !0, e();
|
|
480
|
+
}, n = () => {
|
|
481
|
+
Ne = !1;
|
|
481
482
|
};
|
|
482
|
-
return
|
|
483
|
-
|
|
483
|
+
return Fe("online", t), Fe("offline", n), () => {
|
|
484
|
+
Ve("online", t), Ve("offline", n);
|
|
484
485
|
};
|
|
485
|
-
},
|
|
486
|
-
isOnline:
|
|
487
|
-
isVisible:
|
|
488
|
-
},
|
|
489
|
-
initFocus:
|
|
490
|
-
initReconnect:
|
|
491
|
-
},
|
|
486
|
+
}, Pt = {
|
|
487
|
+
isOnline: It,
|
|
488
|
+
isVisible: jt
|
|
489
|
+
}, kt = {
|
|
490
|
+
initFocus: xt,
|
|
491
|
+
initReconnect: Lt
|
|
492
|
+
}, et = !ce.useId, Ee = !pe || Ct, Nt = (e) => Dt() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ce = Ee ? ht : _t, De = typeof navigator < "u" && navigator.connection, tt = !Ee && De && ([
|
|
492
493
|
"slow-2g",
|
|
493
494
|
"2g"
|
|
494
|
-
].includes(
|
|
495
|
-
let
|
|
496
|
-
const
|
|
497
|
-
const
|
|
498
|
-
let a,
|
|
499
|
-
if (Pe(e) === e && !
|
|
500
|
-
if (a =
|
|
501
|
-
if (a = ++
|
|
502
|
-
for (a = "@",
|
|
503
|
-
a +=
|
|
504
|
-
|
|
495
|
+
].includes(De.effectiveType) || De.saveData), Oe = /* @__PURE__ */ new WeakMap(), Ie = (e, t) => Pe.prototype.toString.call(e) === `[object ${t}]`;
|
|
496
|
+
let Ft = 0;
|
|
497
|
+
const Me = (e) => {
|
|
498
|
+
const t = typeof e, n = Ie(e, "Date"), o = Ie(e, "RegExp"), s = Ie(e, "Object");
|
|
499
|
+
let a, u;
|
|
500
|
+
if (Pe(e) === e && !n && !o) {
|
|
501
|
+
if (a = Oe.get(e), a) return a;
|
|
502
|
+
if (a = ++Ft + "~", Oe.set(e, a), Array.isArray(e)) {
|
|
503
|
+
for (a = "@", u = 0; u < e.length; u++)
|
|
504
|
+
a += Me(e[u]) + ",";
|
|
505
|
+
Oe.set(e, a);
|
|
505
506
|
}
|
|
506
|
-
if (
|
|
507
|
+
if (s) {
|
|
507
508
|
a = "#";
|
|
508
|
-
const
|
|
509
|
-
for (; !
|
|
510
|
-
|
|
511
|
-
|
|
509
|
+
const p = Pe.keys(e).sort();
|
|
510
|
+
for (; !E(u = p.pop()); )
|
|
511
|
+
E(e[u]) || (a += u + ":" + Me(e[u]) + ",");
|
|
512
|
+
Oe.set(e, a);
|
|
512
513
|
}
|
|
513
514
|
} else
|
|
514
|
-
a =
|
|
515
|
+
a = n ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
515
516
|
return a;
|
|
516
|
-
},
|
|
517
|
-
if (
|
|
517
|
+
}, We = (e) => {
|
|
518
|
+
if (G(e))
|
|
518
519
|
try {
|
|
519
520
|
e = e();
|
|
520
521
|
} catch {
|
|
521
522
|
e = "";
|
|
522
523
|
}
|
|
523
|
-
const
|
|
524
|
-
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ?
|
|
524
|
+
const t = e;
|
|
525
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? Me(e) : "", [
|
|
525
526
|
e,
|
|
526
|
-
|
|
527
|
+
t
|
|
527
528
|
];
|
|
528
529
|
};
|
|
529
|
-
let
|
|
530
|
-
const
|
|
531
|
-
async function
|
|
532
|
-
const [
|
|
530
|
+
let Vt = 0;
|
|
531
|
+
const qe = () => ++Vt;
|
|
532
|
+
async function dt(...e) {
|
|
533
|
+
const [t, n, o, s] = e, a = te({
|
|
533
534
|
populateCache: !0,
|
|
534
535
|
throwOnError: !0
|
|
535
|
-
}, typeof
|
|
536
|
-
revalidate:
|
|
537
|
-
} :
|
|
538
|
-
let
|
|
539
|
-
const
|
|
540
|
-
let
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
const
|
|
544
|
-
for (const
|
|
536
|
+
}, typeof s == "boolean" ? {
|
|
537
|
+
revalidate: s
|
|
538
|
+
} : s || {});
|
|
539
|
+
let u = a.populateCache;
|
|
540
|
+
const p = a.rollbackOnError;
|
|
541
|
+
let _ = a.optimisticData;
|
|
542
|
+
const A = (m) => typeof p == "function" ? p(m) : p !== !1, w = a.throwOnError;
|
|
543
|
+
if (G(n)) {
|
|
544
|
+
const m = n, c = [], v = t.keys();
|
|
545
|
+
for (const d of v)
|
|
545
546
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
546
|
-
!/^\$(inf|sub)\$/.test(
|
|
547
|
-
return Promise.all(
|
|
547
|
+
!/^\$(inf|sub)\$/.test(d) && m(t.get(d)._k) && c.push(d);
|
|
548
|
+
return Promise.all(c.map(f));
|
|
548
549
|
}
|
|
549
|
-
return
|
|
550
|
-
async function
|
|
551
|
-
const [
|
|
552
|
-
if (!
|
|
553
|
-
const [
|
|
554
|
-
const
|
|
555
|
-
return (
|
|
550
|
+
return f(n);
|
|
551
|
+
async function f(m) {
|
|
552
|
+
const [c] = We(m);
|
|
553
|
+
if (!c) return;
|
|
554
|
+
const [v, d] = ft(t, c), [I, i, q, ne] = X.get(t), U = () => {
|
|
555
|
+
const k = I[c];
|
|
556
|
+
return (G(a.revalidate) ? a.revalidate(v().data, m) : a.revalidate !== !1) && (delete q[c], delete ne[c], k && k[0]) ? k[0](ut).then(() => v().data) : v().data;
|
|
556
557
|
};
|
|
557
558
|
if (e.length < 3)
|
|
558
|
-
return
|
|
559
|
-
let
|
|
560
|
-
const
|
|
561
|
-
c
|
|
562
|
-
|
|
559
|
+
return U();
|
|
560
|
+
let b = o, j;
|
|
561
|
+
const z = qe();
|
|
562
|
+
i[c] = [
|
|
563
|
+
z,
|
|
563
564
|
0
|
|
564
565
|
];
|
|
565
|
-
const O = !_
|
|
566
|
-
if (O && (
|
|
567
|
-
data:
|
|
568
|
-
_c:
|
|
569
|
-
})),
|
|
566
|
+
const O = !E(_), Z = v(), N = Z.data, W = Z._c, $ = E(W) ? N : W;
|
|
567
|
+
if (O && (_ = G(_) ? _($, N) : _, d({
|
|
568
|
+
data: _,
|
|
569
|
+
_c: $
|
|
570
|
+
})), G(b))
|
|
570
571
|
try {
|
|
571
|
-
|
|
572
|
-
} catch (
|
|
573
|
-
|
|
572
|
+
b = b($);
|
|
573
|
+
} catch (k) {
|
|
574
|
+
j = k;
|
|
574
575
|
}
|
|
575
|
-
if (
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
}),
|
|
579
|
-
if (
|
|
580
|
-
return
|
|
581
|
-
} else
|
|
582
|
-
data:
|
|
583
|
-
_c:
|
|
576
|
+
if (b && lt(b))
|
|
577
|
+
if (b = await b.catch((k) => {
|
|
578
|
+
j = k;
|
|
579
|
+
}), z !== i[c][0]) {
|
|
580
|
+
if (j) throw j;
|
|
581
|
+
return b;
|
|
582
|
+
} else j && O && A(j) && (u = !0, d({
|
|
583
|
+
data: $,
|
|
584
|
+
_c: P
|
|
584
585
|
}));
|
|
585
|
-
if (
|
|
586
|
-
if (
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
data:
|
|
590
|
-
error:
|
|
591
|
-
_c:
|
|
586
|
+
if (u && !j)
|
|
587
|
+
if (G(u)) {
|
|
588
|
+
const k = u(b, $);
|
|
589
|
+
d({
|
|
590
|
+
data: k,
|
|
591
|
+
error: P,
|
|
592
|
+
_c: P
|
|
592
593
|
});
|
|
593
594
|
} else
|
|
594
|
-
|
|
595
|
-
data:
|
|
596
|
-
error:
|
|
597
|
-
_c:
|
|
595
|
+
d({
|
|
596
|
+
data: b,
|
|
597
|
+
error: P,
|
|
598
|
+
_c: P
|
|
598
599
|
});
|
|
599
|
-
if (c
|
|
600
|
-
|
|
601
|
-
_c:
|
|
600
|
+
if (i[c][1] = qe(), Promise.resolve(U()).then(() => {
|
|
601
|
+
d({
|
|
602
|
+
_c: P
|
|
602
603
|
});
|
|
603
|
-
}),
|
|
604
|
-
if (
|
|
604
|
+
}), j) {
|
|
605
|
+
if (w) throw j;
|
|
605
606
|
return;
|
|
606
607
|
}
|
|
607
|
-
return
|
|
608
|
+
return b;
|
|
608
609
|
}
|
|
609
610
|
}
|
|
610
|
-
const
|
|
611
|
-
for (const
|
|
612
|
-
e[
|
|
613
|
-
},
|
|
611
|
+
const nt = (e, t) => {
|
|
612
|
+
for (const n in e)
|
|
613
|
+
e[n][0] && e[n][0](t);
|
|
614
|
+
}, Mt = (e, t) => {
|
|
614
615
|
if (!X.has(e)) {
|
|
615
|
-
const
|
|
616
|
-
let a =
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
return
|
|
620
|
-
},
|
|
621
|
-
e.set(
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
for (const
|
|
625
|
-
|
|
626
|
-
},
|
|
616
|
+
const n = te(kt, t), o = /* @__PURE__ */ Object.create(null), s = dt.bind(P, e);
|
|
617
|
+
let a = ee;
|
|
618
|
+
const u = /* @__PURE__ */ Object.create(null), p = (w, f) => {
|
|
619
|
+
const m = u[w] || [];
|
|
620
|
+
return u[w] = m, m.push(f), () => m.splice(m.indexOf(f), 1);
|
|
621
|
+
}, _ = (w, f, m) => {
|
|
622
|
+
e.set(w, f);
|
|
623
|
+
const c = u[w];
|
|
624
|
+
if (c)
|
|
625
|
+
for (const v of c)
|
|
626
|
+
v(f, m);
|
|
627
|
+
}, A = () => {
|
|
627
628
|
if (!X.has(e) && (X.set(e, [
|
|
628
|
-
|
|
629
|
+
o,
|
|
629
630
|
/* @__PURE__ */ Object.create(null),
|
|
630
631
|
/* @__PURE__ */ Object.create(null),
|
|
631
632
|
/* @__PURE__ */ Object.create(null),
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
]), !
|
|
636
|
-
const
|
|
633
|
+
s,
|
|
634
|
+
_,
|
|
635
|
+
p
|
|
636
|
+
]), !Ee)) {
|
|
637
|
+
const w = n.initFocus(setTimeout.bind(P, nt.bind(P, o, it))), f = n.initReconnect(setTimeout.bind(P, nt.bind(P, o, ct)));
|
|
637
638
|
a = () => {
|
|
638
|
-
|
|
639
|
+
w && w(), f && f(), X.delete(e);
|
|
639
640
|
};
|
|
640
641
|
}
|
|
641
642
|
};
|
|
642
|
-
return
|
|
643
|
+
return A(), [
|
|
643
644
|
e,
|
|
644
|
-
|
|
645
|
-
|
|
645
|
+
s,
|
|
646
|
+
A,
|
|
646
647
|
a
|
|
647
648
|
];
|
|
648
649
|
}
|
|
@@ -650,46 +651,46 @@ const at = (e, r) => {
|
|
|
650
651
|
e,
|
|
651
652
|
X.get(e)[4]
|
|
652
653
|
];
|
|
653
|
-
},
|
|
654
|
-
const a =
|
|
655
|
-
!
|
|
656
|
-
},
|
|
654
|
+
}, qt = (e, t, n, o, s) => {
|
|
655
|
+
const a = n.errorRetryCount, u = s.retryCount, p = ~~((Math.random() + 0.5) * (1 << (u < 8 ? u : 8))) * n.errorRetryInterval;
|
|
656
|
+
!E(a) && u > a || setTimeout(o, p, s);
|
|
657
|
+
}, Ut = Le, [mt, Wt] = Mt(/* @__PURE__ */ new Map()), $t = te(
|
|
657
658
|
{
|
|
658
659
|
// events
|
|
659
|
-
onLoadingSlow:
|
|
660
|
-
onSuccess:
|
|
661
|
-
onError:
|
|
662
|
-
onErrorRetry:
|
|
663
|
-
onDiscarded:
|
|
660
|
+
onLoadingSlow: ee,
|
|
661
|
+
onSuccess: ee,
|
|
662
|
+
onError: ee,
|
|
663
|
+
onErrorRetry: qt,
|
|
664
|
+
onDiscarded: ee,
|
|
664
665
|
// switches
|
|
665
666
|
revalidateOnFocus: !0,
|
|
666
667
|
revalidateOnReconnect: !0,
|
|
667
668
|
revalidateIfStale: !0,
|
|
668
669
|
shouldRetryOnError: !0,
|
|
669
670
|
// timeouts
|
|
670
|
-
errorRetryInterval:
|
|
671
|
+
errorRetryInterval: tt ? 1e4 : 5e3,
|
|
671
672
|
focusThrottleInterval: 5 * 1e3,
|
|
672
673
|
dedupingInterval: 2 * 1e3,
|
|
673
|
-
loadingTimeout:
|
|
674
|
+
loadingTimeout: tt ? 5e3 : 3e3,
|
|
674
675
|
// providers
|
|
675
|
-
compare:
|
|
676
|
+
compare: Ut,
|
|
676
677
|
isPaused: () => !1,
|
|
677
|
-
cache:
|
|
678
|
-
mutate:
|
|
678
|
+
cache: mt,
|
|
679
|
+
mutate: Wt,
|
|
679
680
|
fallback: {}
|
|
680
681
|
},
|
|
681
682
|
// use web preset by default
|
|
682
|
-
|
|
683
|
-
),
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
686
|
-
const { use:
|
|
687
|
-
|
|
683
|
+
Pt
|
|
684
|
+
), Yt = (e, t) => {
|
|
685
|
+
const n = te(e, t);
|
|
686
|
+
if (t) {
|
|
687
|
+
const { use: o, fallback: s } = e, { use: a, fallback: u } = t;
|
|
688
|
+
o && a && (n.use = o.concat(a)), s && u && (n.fallback = te(s, u));
|
|
688
689
|
}
|
|
689
|
-
return
|
|
690
|
-
},
|
|
691
|
-
|
|
692
|
-
},
|
|
690
|
+
return n;
|
|
691
|
+
}, Gt = rt({}), Ht = "$inf$", Et = pe && window.__SWR_DEVTOOLS_USE__, Bt = Et ? window.__SWR_DEVTOOLS_USE__ : [], Jt = () => {
|
|
692
|
+
Et && (window.__SWR_DEVTOOLS_REACT__ = ce);
|
|
693
|
+
}, Kt = (e) => G(e[1]) ? [
|
|
693
694
|
e[0],
|
|
694
695
|
e[1],
|
|
695
696
|
e[2] || {}
|
|
@@ -697,28 +698,28 @@ const at = (e, r) => {
|
|
|
697
698
|
e[0],
|
|
698
699
|
null,
|
|
699
700
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
700
|
-
],
|
|
701
|
-
const [
|
|
702
|
-
if (
|
|
703
|
-
return
|
|
704
|
-
const
|
|
705
|
-
return _
|
|
706
|
-
}),
|
|
707
|
-
const
|
|
708
|
-
let
|
|
709
|
-
const { use:
|
|
710
|
-
for (let
|
|
711
|
-
|
|
712
|
-
return
|
|
713
|
-
},
|
|
714
|
-
const
|
|
715
|
-
return
|
|
716
|
-
const
|
|
717
|
-
|
|
701
|
+
], Xt = () => te($t, ot(Gt)), zt = (e) => (t, n, o) => e(t, n && ((...a) => {
|
|
702
|
+
const [u] = We(t), [, , , p] = X.get(mt);
|
|
703
|
+
if (u.startsWith(Ht))
|
|
704
|
+
return n(...a);
|
|
705
|
+
const _ = p[u];
|
|
706
|
+
return E(_) ? n(...a) : (delete p[u], _);
|
|
707
|
+
}), o), Zt = Bt.concat(zt), Qt = (e) => function(...n) {
|
|
708
|
+
const o = Xt(), [s, a, u] = Kt(n), p = Yt(o, u);
|
|
709
|
+
let _ = e;
|
|
710
|
+
const { use: A } = p, w = (A || []).concat(Zt);
|
|
711
|
+
for (let f = w.length; f--; )
|
|
712
|
+
_ = w[f](_);
|
|
713
|
+
return _(s, a || p.fetcher || null, p);
|
|
714
|
+
}, en = (e, t, n) => {
|
|
715
|
+
const o = t[e] || (t[e] = []);
|
|
716
|
+
return o.push(n), () => {
|
|
717
|
+
const s = o.indexOf(n);
|
|
718
|
+
s >= 0 && (o[s] = o[o.length - 1], o.pop());
|
|
718
719
|
};
|
|
719
720
|
};
|
|
720
|
-
|
|
721
|
-
const
|
|
721
|
+
Jt();
|
|
722
|
+
const je = ce.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
722
723
|
// and emitting an error.
|
|
723
724
|
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
724
725
|
// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
|
|
@@ -731,101 +732,101 @@ const Le = fe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
731
732
|
case "rejected":
|
|
732
733
|
throw e.reason;
|
|
733
734
|
default:
|
|
734
|
-
throw e.status = "pending", e.then((
|
|
735
|
-
e.status = "fulfilled", e.value =
|
|
736
|
-
}, (
|
|
737
|
-
e.status = "rejected", e.reason =
|
|
735
|
+
throw e.status = "pending", e.then((t) => {
|
|
736
|
+
e.status = "fulfilled", e.value = t;
|
|
737
|
+
}, (t) => {
|
|
738
|
+
e.status = "rejected", e.reason = t;
|
|
738
739
|
}), e;
|
|
739
740
|
}
|
|
740
741
|
}), xe = {
|
|
741
742
|
dedupe: !0
|
|
742
|
-
},
|
|
743
|
-
const { cache:
|
|
744
|
-
for (const
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
if (!
|
|
743
|
+
}, tn = (e, t, n) => {
|
|
744
|
+
const { cache: o, compare: s, suspense: a, fallbackData: u, revalidateOnMount: p, revalidateIfStale: _, refreshInterval: A, refreshWhenHidden: w, refreshWhenOffline: f, keepPreviousData: m } = n, [c, v, d, I] = X.get(o), [i, q] = We(e), ne = oe(!1), U = oe(!1), b = oe(i), j = oe(t), z = oe(n), O = () => z.current, Z = () => O().isVisible() && O().isOnline(), [N, W, $, k] = ft(o, i), Y = oe({}).current, re = E(u) ? E(n.fallback) ? P : n.fallback[i] : u, ue = (R, S) => {
|
|
745
|
+
for (const D in Y) {
|
|
746
|
+
const g = D;
|
|
747
|
+
if (g === "data") {
|
|
748
|
+
if (!s(R[g], S[g]) && (!E(R[g]) || !s(x, S[g])))
|
|
748
749
|
return !1;
|
|
749
|
-
} else if (
|
|
750
|
+
} else if (S[g] !== R[g])
|
|
750
751
|
return !1;
|
|
751
752
|
}
|
|
752
753
|
return !0;
|
|
753
|
-
},
|
|
754
|
-
const R = !
|
|
755
|
-
const
|
|
756
|
-
return delete
|
|
754
|
+
}, le = Re(() => {
|
|
755
|
+
const R = !i || !t ? !1 : E(p) ? O().isPaused() || a ? !1 : _ !== !1 : p, S = (L) => {
|
|
756
|
+
const J = te(L);
|
|
757
|
+
return delete J._k, R ? {
|
|
757
758
|
isValidating: !0,
|
|
758
759
|
isLoading: !0,
|
|
759
|
-
...
|
|
760
|
-
} :
|
|
761
|
-
},
|
|
762
|
-
let
|
|
760
|
+
...J
|
|
761
|
+
} : J;
|
|
762
|
+
}, D = N(), g = k(), M = S(D), ie = D === g ? M : S(g);
|
|
763
|
+
let C = M;
|
|
763
764
|
return [
|
|
764
765
|
() => {
|
|
765
|
-
const
|
|
766
|
-
return
|
|
766
|
+
const L = S(N());
|
|
767
|
+
return ue(L, C) ? (C.data = L.data, C.isLoading = L.isLoading, C.isValidating = L.isValidating, C.error = L.error, C) : (C = L, L);
|
|
767
768
|
},
|
|
768
|
-
() =>
|
|
769
|
+
() => ie
|
|
769
770
|
];
|
|
770
771
|
}, [
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
]), H =
|
|
774
|
-
(R) =>
|
|
775
|
-
|
|
772
|
+
o,
|
|
773
|
+
i
|
|
774
|
+
]), H = At.useSyncExternalStore(ge(
|
|
775
|
+
(R) => $(i, (S, D) => {
|
|
776
|
+
ue(D, S) || R();
|
|
776
777
|
}),
|
|
777
778
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
778
779
|
[
|
|
779
|
-
|
|
780
|
-
|
|
780
|
+
o,
|
|
781
|
+
i
|
|
781
782
|
]
|
|
782
|
-
),
|
|
783
|
+
), le[0], le[1]), fe = !ne.current, r = c[i] && c[i].length > 0, l = H.data, h = E(l) ? re && lt(re) ? je(re) : re : l, T = H.error, F = oe(h), x = m ? E(l) ? E(F.current) ? h : F.current : l : h, se = r && !E(T) ? !1 : fe && !E(p) ? p : O().isPaused() ? !1 : a ? E(h) ? !1 : _ : E(h) || _, ae = !!(i && t && fe && se), y = E(H.isValidating) ? ae : H.isValidating, Q = E(H.isLoading) ? ae : H.isLoading, B = ge(
|
|
783
784
|
async (R) => {
|
|
784
|
-
const
|
|
785
|
-
if (!
|
|
785
|
+
const S = j.current;
|
|
786
|
+
if (!i || !S || U.current || O().isPaused())
|
|
786
787
|
return !1;
|
|
787
|
-
let
|
|
788
|
-
const
|
|
788
|
+
let D, g, M = !0;
|
|
789
|
+
const ie = R || {}, C = !d[i] || !ie.dedupe, L = () => et ? !U.current && i === b.current && ne.current : i === b.current, J = {
|
|
789
790
|
isValidating: !1,
|
|
790
791
|
isLoading: !1
|
|
791
|
-
},
|
|
792
|
-
|
|
793
|
-
},
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
},
|
|
792
|
+
}, $e = () => {
|
|
793
|
+
W(J);
|
|
794
|
+
}, Ye = () => {
|
|
795
|
+
const V = d[i];
|
|
796
|
+
V && V[1] === g && delete d[i];
|
|
797
|
+
}, Ge = {
|
|
797
798
|
isValidating: !0
|
|
798
799
|
};
|
|
799
|
-
|
|
800
|
+
E(N().data) && (Ge.isLoading = !0);
|
|
800
801
|
try {
|
|
801
|
-
if (
|
|
802
|
-
|
|
803
|
-
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
]), [
|
|
807
|
-
return
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
if (!
|
|
811
|
-
(
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
} catch (
|
|
818
|
-
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
802
|
+
if (C && (W(Ge), n.loadingTimeout && E(N().data) && setTimeout(() => {
|
|
803
|
+
M && L() && O().onLoadingSlow(i, n);
|
|
804
|
+
}, n.loadingTimeout), d[i] = [
|
|
805
|
+
S(q),
|
|
806
|
+
qe()
|
|
807
|
+
]), [D, g] = d[i], D = await D, C && setTimeout(Ye, n.dedupingInterval), !d[i] || d[i][1] !== g)
|
|
808
|
+
return C && L() && O().onDiscarded(i), !1;
|
|
809
|
+
J.error = P;
|
|
810
|
+
const V = v[i];
|
|
811
|
+
if (!E(V) && // case 1
|
|
812
|
+
(g <= V[0] || // case 2
|
|
813
|
+
g <= V[1] || // case 3
|
|
814
|
+
V[1] === 0))
|
|
815
|
+
return $e(), C && L() && O().onDiscarded(i), !1;
|
|
816
|
+
const K = N().data;
|
|
817
|
+
J.data = s(K, D) ? K : D, C && L() && O().onSuccess(D, i, n);
|
|
818
|
+
} catch (V) {
|
|
819
|
+
Ye();
|
|
820
|
+
const K = O(), { shouldRetryOnError: we } = K;
|
|
821
|
+
K.isPaused() || (J.error = V, C && L() && (K.onError(V, i, K), (we === !0 || G(we) && we(V)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || Z()) && K.onErrorRetry(V, i, K, (vt) => {
|
|
822
|
+
const Te = c[i];
|
|
823
|
+
Te && Te[0] && Te[0](Ze, vt);
|
|
823
824
|
}, {
|
|
824
|
-
retryCount: (
|
|
825
|
+
retryCount: (ie.retryCount || 0) + 1,
|
|
825
826
|
dedupe: !0
|
|
826
827
|
})));
|
|
827
828
|
}
|
|
828
|
-
return
|
|
829
|
+
return M = !1, $e(), !0;
|
|
829
830
|
},
|
|
830
831
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
831
832
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -839,336 +840,221 @@ const Le = fe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
839
840
|
// even though it might cause unexpected behaviors.
|
|
840
841
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
841
842
|
[
|
|
842
|
-
|
|
843
|
-
|
|
843
|
+
i,
|
|
844
|
+
o
|
|
844
845
|
]
|
|
845
|
-
),
|
|
846
|
+
), ve = ge(
|
|
846
847
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
847
|
-
(...R) =>
|
|
848
|
+
(...R) => dt(o, b.current, ...R),
|
|
848
849
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
849
850
|
[]
|
|
850
851
|
);
|
|
851
852
|
if (Ce(() => {
|
|
852
|
-
|
|
853
|
+
j.current = t, z.current = n, E(l) || (F.current = l);
|
|
853
854
|
}), Ce(() => {
|
|
854
|
-
if (!
|
|
855
|
-
const R =
|
|
856
|
-
let
|
|
857
|
-
O().revalidateOnFocus && (
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
860
|
-
const
|
|
861
|
-
O().revalidateOnFocus &&
|
|
862
|
-
} else if (
|
|
863
|
-
O().revalidateOnReconnect &&
|
|
855
|
+
if (!i) return;
|
|
856
|
+
const R = B.bind(P, xe);
|
|
857
|
+
let S = 0;
|
|
858
|
+
O().revalidateOnFocus && (S = Date.now() + O().focusThrottleInterval);
|
|
859
|
+
const g = en(i, c, (M, ie = {}) => {
|
|
860
|
+
if (M == it) {
|
|
861
|
+
const C = Date.now();
|
|
862
|
+
O().revalidateOnFocus && C > S && Z() && (S = C + O().focusThrottleInterval, R());
|
|
863
|
+
} else if (M == ct)
|
|
864
|
+
O().revalidateOnReconnect && Z() && R();
|
|
864
865
|
else {
|
|
865
|
-
if (
|
|
866
|
-
return
|
|
867
|
-
if (
|
|
868
|
-
return
|
|
866
|
+
if (M == ut)
|
|
867
|
+
return B();
|
|
868
|
+
if (M == Ze)
|
|
869
|
+
return B(ie);
|
|
869
870
|
}
|
|
870
871
|
});
|
|
871
|
-
return
|
|
872
|
-
_k:
|
|
873
|
-
}),
|
|
874
|
-
|
|
872
|
+
return U.current = !1, b.current = i, ne.current = !0, W({
|
|
873
|
+
_k: q
|
|
874
|
+
}), se && (E(h) || Ee ? R() : Nt(R)), () => {
|
|
875
|
+
U.current = !0, g();
|
|
875
876
|
};
|
|
876
877
|
}, [
|
|
877
|
-
|
|
878
|
+
i
|
|
878
879
|
]), Ce(() => {
|
|
879
880
|
let R;
|
|
880
|
-
function
|
|
881
|
-
const
|
|
882
|
-
|
|
881
|
+
function S() {
|
|
882
|
+
const g = G(A) ? A(N().data) : A;
|
|
883
|
+
g && R !== -1 && (R = setTimeout(D, g));
|
|
883
884
|
}
|
|
884
|
-
function
|
|
885
|
-
!
|
|
885
|
+
function D() {
|
|
886
|
+
!N().error && (w || O().isVisible()) && (f || O().isOnline()) ? B(xe).then(S) : S();
|
|
886
887
|
}
|
|
887
|
-
return
|
|
888
|
+
return S(), () => {
|
|
888
889
|
R && (clearTimeout(R), R = -1);
|
|
889
890
|
};
|
|
890
891
|
}, [
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
]),
|
|
896
|
-
if (!
|
|
892
|
+
A,
|
|
893
|
+
w,
|
|
894
|
+
f,
|
|
895
|
+
i
|
|
896
|
+
]), St(x), a && E(h) && i) {
|
|
897
|
+
if (!et && Ee)
|
|
897
898
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
898
|
-
|
|
899
|
-
const R =
|
|
900
|
-
if (!
|
|
901
|
-
const
|
|
902
|
-
|
|
899
|
+
j.current = t, z.current = n, U.current = !1;
|
|
900
|
+
const R = I[i];
|
|
901
|
+
if (!E(R)) {
|
|
902
|
+
const S = ve(R);
|
|
903
|
+
je(S);
|
|
903
904
|
}
|
|
904
|
-
if (
|
|
905
|
-
const
|
|
906
|
-
|
|
905
|
+
if (E(T)) {
|
|
906
|
+
const S = B(xe);
|
|
907
|
+
E(x) || (S.status = "fulfilled", S.value = !0), je(S);
|
|
907
908
|
} else
|
|
908
909
|
throw T;
|
|
909
910
|
}
|
|
910
911
|
return {
|
|
911
|
-
mutate:
|
|
912
|
+
mutate: ve,
|
|
912
913
|
get data() {
|
|
913
|
-
return Y.data = !0,
|
|
914
|
+
return Y.data = !0, x;
|
|
914
915
|
},
|
|
915
916
|
get error() {
|
|
916
917
|
return Y.error = !0, T;
|
|
917
918
|
},
|
|
918
919
|
get isValidating() {
|
|
919
|
-
return Y.isValidating = !0,
|
|
920
|
+
return Y.isValidating = !0, y;
|
|
920
921
|
},
|
|
921
922
|
get isLoading() {
|
|
922
|
-
return Y.isLoading = !0,
|
|
923
|
+
return Y.isLoading = !0, Q;
|
|
923
924
|
}
|
|
924
925
|
};
|
|
925
|
-
},
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
926
|
+
}, nn = Qt(tn), rn = async (e, t) => {
|
|
927
|
+
if (!t)
|
|
928
|
+
throw new Error("A Figma API token is required to make this request.");
|
|
929
|
+
const n = await fetch(e, {
|
|
930
|
+
headers: {
|
|
931
|
+
"X-FIGMA-TOKEN": t,
|
|
932
|
+
"Content-Type": "application/json"
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
if (!n.ok) {
|
|
936
|
+
const o = await n.json();
|
|
937
|
+
throw new Error(
|
|
938
|
+
o.message || "An error occurred while fetching data from the Figma API."
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
return n.json();
|
|
942
|
+
}, pt = () => {
|
|
943
|
+
const { token: e, fileKey: t } = at(), n = t ? `https://api.figma.com/v1/files/${t}/variables/local` : null, { data: o, error: s, isLoading: a, isValidating: u } = nn(
|
|
944
|
+
e && n ? [n, e] : null,
|
|
945
|
+
rn
|
|
946
|
+
);
|
|
944
947
|
return {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
error: n ?? (t && "message" in t ? new Error(t.message) : null)
|
|
948
|
+
data: o,
|
|
949
|
+
isLoading: a,
|
|
950
|
+
isValidating: u,
|
|
951
|
+
error: s
|
|
950
952
|
};
|
|
951
|
-
},
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
),
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
)) {
|
|
960
|
-
i.push(...g.modes), f[g.id] = g.modes;
|
|
961
|
-
for (const v of g.modes)
|
|
962
|
-
E[v.modeId] = v;
|
|
963
|
-
}
|
|
953
|
+
}, un = () => {
|
|
954
|
+
const { data: e } = pt(), t = Re(
|
|
955
|
+
() => e != null && e.meta ? Object.values(e.meta.variableCollections) : [],
|
|
956
|
+
[e]
|
|
957
|
+
), n = Re(
|
|
958
|
+
() => e != null && e.meta ? e.meta.variableCollections : {},
|
|
959
|
+
[e]
|
|
960
|
+
);
|
|
964
961
|
return {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
modesById: E,
|
|
968
|
-
isLoading: o,
|
|
969
|
-
isValidating: a,
|
|
970
|
-
error: n ?? (t && "message" in t ? new Error(t.message) : null)
|
|
962
|
+
collections: t,
|
|
963
|
+
collectionsById: n
|
|
971
964
|
};
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
return o.ok ? {
|
|
985
|
-
error: !1,
|
|
986
|
-
status: o.status,
|
|
987
|
-
meta: a.meta
|
|
988
|
-
} : {
|
|
989
|
-
error: !0,
|
|
990
|
-
status: o.status,
|
|
991
|
-
message: a.message || "Failed to perform bulk update."
|
|
992
|
-
};
|
|
993
|
-
} catch (o) {
|
|
965
|
+
}, ln = () => {
|
|
966
|
+
const { data: e } = pt();
|
|
967
|
+
return Re(() => {
|
|
968
|
+
const t = [], n = {}, o = {};
|
|
969
|
+
if (e != null && e.meta)
|
|
970
|
+
for (const s of Object.values(
|
|
971
|
+
e.meta.variableCollections
|
|
972
|
+
)) {
|
|
973
|
+
t.push(...s.modes), n[s.id] = s.modes;
|
|
974
|
+
for (const a of s.modes)
|
|
975
|
+
o[a.modeId] = a;
|
|
976
|
+
}
|
|
994
977
|
return {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
978
|
+
modes: t,
|
|
979
|
+
modesByCollectionId: n,
|
|
980
|
+
modesById: o
|
|
998
981
|
};
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
}
|
|
1009
|
-
t(!0), o(null);
|
|
1010
|
-
const v = await cr(e, E, g);
|
|
1011
|
-
i(v), v.error && o(v.message || "An error occurred during the bulk update."), t(!1);
|
|
982
|
+
}, [e]);
|
|
983
|
+
}, fn = async (e, t, n) => {
|
|
984
|
+
if (!e || !t)
|
|
985
|
+
throw new Error("A Figma API token and file key are required.");
|
|
986
|
+
const o = `https://api.figma.com/v1/files/${t}/variables`, s = await fetch(o, {
|
|
987
|
+
method: "POST",
|
|
988
|
+
headers: {
|
|
989
|
+
"Content-Type": "application/json",
|
|
990
|
+
"X-FIGMA-TOKEN": e
|
|
1012
991
|
},
|
|
1013
|
-
|
|
1014
|
-
),
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
error: !0,
|
|
1031
|
-
status: n.status,
|
|
1032
|
-
message: a.message || "Failed to create Figma variable"
|
|
1033
|
-
};
|
|
1034
|
-
}
|
|
992
|
+
body: JSON.stringify(n)
|
|
993
|
+
}), a = await s.json();
|
|
994
|
+
if (!s.ok)
|
|
995
|
+
throw new Error(a.message || "Failed to perform bulk update.");
|
|
996
|
+
return a;
|
|
997
|
+
}, dn = async (e, t) => {
|
|
998
|
+
if (!e)
|
|
999
|
+
throw new Error("A Figma API token is required.");
|
|
1000
|
+
const n = await fetch("https://api.figma.com/v1/variables", {
|
|
1001
|
+
method: "POST",
|
|
1002
|
+
headers: {
|
|
1003
|
+
"Content-Type": "application/json",
|
|
1004
|
+
"X-FIGMA-TOKEN": e
|
|
1005
|
+
},
|
|
1006
|
+
body: JSON.stringify(t)
|
|
1007
|
+
});
|
|
1008
|
+
if (!n.ok) {
|
|
1035
1009
|
const o = await n.json();
|
|
1036
|
-
|
|
1037
|
-
error: !1,
|
|
1038
|
-
status: n.status,
|
|
1039
|
-
variable: o
|
|
1040
|
-
};
|
|
1041
|
-
} catch (n) {
|
|
1042
|
-
return {
|
|
1043
|
-
error: !0,
|
|
1044
|
-
status: 500,
|
|
1045
|
-
message: n instanceof Error ? n.message : "An unknown error occurred"
|
|
1046
|
-
};
|
|
1010
|
+
throw new Error(o.message || "Failed to create Figma variable.");
|
|
1047
1011
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
t(!0), o(null);
|
|
1058
|
-
const g = await ur(e, E);
|
|
1059
|
-
i(g), g.error && o(g.message || "An error occurred."), t(!1);
|
|
1060
|
-
},
|
|
1061
|
-
[e]
|
|
1062
|
-
), loading: r, error: n, data: a };
|
|
1063
|
-
};
|
|
1064
|
-
async function lr(e, r) {
|
|
1065
|
-
const t = `https://api.figma.com/v1/variables/${r}`;
|
|
1066
|
-
try {
|
|
1067
|
-
const n = await fetch(t, {
|
|
1068
|
-
method: "DELETE",
|
|
1069
|
-
headers: {
|
|
1070
|
-
"Content-Type": "application/json",
|
|
1071
|
-
"X-FIGMA-TOKEN": e
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1074
|
-
if (!n.ok) {
|
|
1075
|
-
const o = await n.json();
|
|
1076
|
-
return {
|
|
1077
|
-
error: !0,
|
|
1078
|
-
status: n.status,
|
|
1079
|
-
message: o.message || "Failed to delete Figma variable"
|
|
1080
|
-
};
|
|
1012
|
+
return n.json();
|
|
1013
|
+
}, mn = async (e, t) => {
|
|
1014
|
+
if (!e)
|
|
1015
|
+
throw new Error("A Figma API token is required.");
|
|
1016
|
+
const n = `https://api.figma.com/v1/variables/${t}`, o = await fetch(n, {
|
|
1017
|
+
method: "DELETE",
|
|
1018
|
+
headers: {
|
|
1019
|
+
"Content-Type": "application/json",
|
|
1020
|
+
"X-FIGMA-TOKEN": e
|
|
1081
1021
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
} catch (n) {
|
|
1087
|
-
return {
|
|
1088
|
-
error: !0,
|
|
1089
|
-
status: 500,
|
|
1090
|
-
message: n instanceof Error ? n.message : "An unknown error occurred"
|
|
1091
|
-
};
|
|
1022
|
+
});
|
|
1023
|
+
if (!o.ok) {
|
|
1024
|
+
const s = await o.json();
|
|
1025
|
+
throw new Error(s.message || "Failed to delete Figma variable.");
|
|
1092
1026
|
}
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
t(!0), o(null);
|
|
1103
|
-
const g = await lr(e, E);
|
|
1104
|
-
i(g), g.error && o(g.message || "An error occurred."), t(!1);
|
|
1027
|
+
}, En = async (e, t, n) => {
|
|
1028
|
+
if (!e)
|
|
1029
|
+
throw new Error("A Figma API token is required.");
|
|
1030
|
+
const o = `https://api.figma.com/v1/variables/${t}`, s = await fetch(o, {
|
|
1031
|
+
method: "PUT",
|
|
1032
|
+
headers: {
|
|
1033
|
+
"Content-Type": "application/json",
|
|
1034
|
+
"X-FIGMA-TOKEN": e
|
|
1105
1035
|
},
|
|
1106
|
-
|
|
1107
|
-
)
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
try {
|
|
1112
|
-
const o = await fetch(n, {
|
|
1113
|
-
method: "PUT",
|
|
1114
|
-
headers: {
|
|
1115
|
-
"Content-Type": "application/json",
|
|
1116
|
-
"X-FIGMA-TOKEN": e
|
|
1117
|
-
},
|
|
1118
|
-
body: JSON.stringify(t)
|
|
1119
|
-
});
|
|
1120
|
-
if (!o.ok) {
|
|
1121
|
-
const a = await o.json();
|
|
1122
|
-
return {
|
|
1123
|
-
error: !0,
|
|
1124
|
-
status: o.status,
|
|
1125
|
-
message: a.message || "Failed to update Figma variable"
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
return {
|
|
1129
|
-
error: !1,
|
|
1130
|
-
status: o.status
|
|
1131
|
-
};
|
|
1132
|
-
} catch (o) {
|
|
1133
|
-
return {
|
|
1134
|
-
error: !0,
|
|
1135
|
-
status: 500,
|
|
1136
|
-
message: o instanceof Error ? o.message : "An unknown error occurred"
|
|
1137
|
-
};
|
|
1036
|
+
body: JSON.stringify(n)
|
|
1037
|
+
});
|
|
1038
|
+
if (!s.ok) {
|
|
1039
|
+
const a = await s.json();
|
|
1040
|
+
throw new Error(a.message || "Failed to update Figma variable.");
|
|
1138
1041
|
}
|
|
1139
|
-
}
|
|
1140
|
-
const Or = () => {
|
|
1141
|
-
const e = ie(), [r, t] = M(!1), [n, o] = M(null), [a, i] = M(null);
|
|
1142
|
-
return { updateVariable: ae(
|
|
1143
|
-
async (E, g) => {
|
|
1144
|
-
if (!e) {
|
|
1145
|
-
o("Figma API token is not provided.");
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
t(!0), o(null);
|
|
1149
|
-
const v = await fr(e, E, g);
|
|
1150
|
-
i(v), v.error && o(v.message || "An error occurred."), t(!1);
|
|
1151
|
-
},
|
|
1152
|
-
[e]
|
|
1153
|
-
), loading: r, error: n, data: a };
|
|
1154
1042
|
};
|
|
1155
|
-
function
|
|
1156
|
-
return e.filter((
|
|
1157
|
-
let
|
|
1158
|
-
return
|
|
1043
|
+
function pn(e, t) {
|
|
1044
|
+
return e.filter((n) => {
|
|
1045
|
+
let o = !0;
|
|
1046
|
+
return t.resolvedType && (o = o && n.resolvedType === t.resolvedType), t.name && (o = o && n.name.includes(t.name)), o;
|
|
1159
1047
|
});
|
|
1160
1048
|
}
|
|
1161
1049
|
export {
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
_r as useVariableModes,
|
|
1173
|
-
vr as useVariables
|
|
1050
|
+
an as FigmaVarsProvider,
|
|
1051
|
+
fn as bulkUpdateVariables,
|
|
1052
|
+
dn as createVariable,
|
|
1053
|
+
mn as deleteVariable,
|
|
1054
|
+
pn as filterVariables,
|
|
1055
|
+
En as updateVariable,
|
|
1056
|
+
cn as useFigmaToken,
|
|
1057
|
+
un as useVariableCollections,
|
|
1058
|
+
ln as useVariableModes,
|
|
1059
|
+
pt as useVariables
|
|
1174
1060
|
};
|