@shiftengineering/folio 0.0.76

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.
Files changed (30) hide show
  1. package/README.md +211 -0
  2. package/dist-embed-component/Folio Tutorial.pdf +0 -0
  3. package/dist-embed-component/apple-touch-icon-180x180.png +0 -0
  4. package/dist-embed-component/apple-touch-icon.png +0 -0
  5. package/dist-embed-component/favicon-96x96.png +0 -0
  6. package/dist-embed-component/favicon.ico +0 -0
  7. package/dist-embed-component/favicon.svg +15 -0
  8. package/dist-embed-component/folio-embed.js +2259 -0
  9. package/dist-embed-component/folio-embed.umd.cjs +34 -0
  10. package/dist-embed-component/folio-light.svg +11 -0
  11. package/dist-embed-component/folio.svg +11 -0
  12. package/dist-embed-component/logo-dev.svg +6 -0
  13. package/dist-embed-component/logo.svg +13 -0
  14. package/dist-embed-component/maskable-icon-512x512.png +0 -0
  15. package/dist-embed-component/nvidia-10k-2023.pdf +0 -0
  16. package/dist-embed-component/nvidia-10k-2024.pdf +0 -0
  17. package/dist-embed-component/pwa-192x192.png +0 -0
  18. package/dist-embed-component/pwa-512x512.png +0 -0
  19. package/dist-embed-component/pwa-64x64.png +0 -0
  20. package/dist-embed-component/shift-text-black.svg +3 -0
  21. package/dist-embed-component/shift-text-white.svg +3 -0
  22. package/dist-embed-component/site.webmanifest +21 -0
  23. package/dist-embed-component/staticwebapp.config.json +6 -0
  24. package/dist-embed-component/types/embed-component/FolioContext.d.ts +62 -0
  25. package/dist-embed-component/types/embed-component/FolioEmbed.component.d.ts +28 -0
  26. package/dist-embed-component/types/embed-component/index.d.ts +3 -0
  27. package/dist-embed-component/types/embed-component/useFolio.d.ts +32 -0
  28. package/dist-embed-component/web-app-manifest-192x192.png +0 -0
  29. package/dist-embed-component/web-app-manifest-512x512.png +0 -0
  30. package/package.json +204 -0
@@ -0,0 +1,2259 @@
1
+ import * as vr from "react";
2
+ import bt, { createContext as Er, useState as Ee, useEffect as Pr, useContext as Rr } from "react";
3
+ var Pe = { exports: {} }, Y = {};
4
+ /**
5
+ * @license React
6
+ * react-jsx-runtime.production.min.js
7
+ *
8
+ * Copyright (c) Facebook, Inc. and its affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ var et;
14
+ function Tr() {
15
+ if (et) return Y;
16
+ et = 1;
17
+ var e = bt, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function u(l, a, f) {
19
+ var m, p = {}, h = null, b = null;
20
+ f !== void 0 && (h = "" + f), a.key !== void 0 && (h = "" + a.key), a.ref !== void 0 && (b = a.ref);
21
+ for (m in a) n.call(a, m) && !s.hasOwnProperty(m) && (p[m] = a[m]);
22
+ if (l && l.defaultProps) for (m in a = l.defaultProps, a) p[m] === void 0 && (p[m] = a[m]);
23
+ return { $$typeof: t, type: l, key: h, ref: b, props: p, _owner: i.current };
24
+ }
25
+ return Y.Fragment = r, Y.jsx = u, Y.jsxs = u, Y;
26
+ }
27
+ var H = {};
28
+ /**
29
+ * @license React
30
+ * react-jsx-runtime.development.js
31
+ *
32
+ * Copyright (c) Facebook, Inc. and its affiliates.
33
+ *
34
+ * This source code is licensed under the MIT license found in the
35
+ * LICENSE file in the root directory of this source tree.
36
+ */
37
+ var tt;
38
+ function Or() {
39
+ return tt || (tt = 1, process.env.NODE_ENV !== "production" && function() {
40
+ var e = bt, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), x = Symbol.iterator, P = "@@iterator";
41
+ function U(o) {
42
+ if (o === null || typeof o != "object")
43
+ return null;
44
+ var c = x && o[x] || o[P];
45
+ return typeof c == "function" ? c : null;
46
+ }
47
+ var j = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
48
+ function S(o) {
49
+ {
50
+ for (var c = arguments.length, d = new Array(c > 1 ? c - 1 : 0), y = 1; y < c; y++)
51
+ d[y - 1] = arguments[y];
52
+ Ut("error", o, d);
53
+ }
54
+ }
55
+ function Ut(o, c, d) {
56
+ {
57
+ var y = j.ReactDebugCurrentFrame, E = y.getStackAddendum();
58
+ E !== "" && (c += "%s", d = d.concat([E]));
59
+ var R = d.map(function(v) {
60
+ return String(v);
61
+ });
62
+ R.unshift("Warning: " + c), Function.prototype.apply.call(console[o], console, R);
63
+ }
64
+ }
65
+ var Vt = !1, qt = !1, zt = !1, Mt = !1, Wt = !1, ke;
66
+ ke = Symbol.for("react.module.reference");
67
+ function Bt(o) {
68
+ return !!(typeof o == "string" || typeof o == "function" || o === n || o === s || Wt || o === i || o === f || o === m || Mt || o === b || Vt || qt || zt || typeof o == "object" && o !== null && (o.$$typeof === h || o.$$typeof === p || o.$$typeof === u || o.$$typeof === l || o.$$typeof === a || // This needs to include all possible module reference object
69
+ // types supported by any Flight configuration anywhere since
70
+ // we don't know which Flight build this will end up being used
71
+ // with.
72
+ o.$$typeof === ke || o.getModuleId !== void 0));
73
+ }
74
+ function Kt(o, c, d) {
75
+ var y = o.displayName;
76
+ if (y)
77
+ return y;
78
+ var E = c.displayName || c.name || "";
79
+ return E !== "" ? d + "(" + E + ")" : d;
80
+ }
81
+ function Ce(o) {
82
+ return o.displayName || "Context";
83
+ }
84
+ function I(o) {
85
+ if (o == null)
86
+ return null;
87
+ if (typeof o.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof o == "function")
88
+ return o.displayName || o.name || null;
89
+ if (typeof o == "string")
90
+ return o;
91
+ switch (o) {
92
+ case n:
93
+ return "Fragment";
94
+ case r:
95
+ return "Portal";
96
+ case s:
97
+ return "Profiler";
98
+ case i:
99
+ return "StrictMode";
100
+ case f:
101
+ return "Suspense";
102
+ case m:
103
+ return "SuspenseList";
104
+ }
105
+ if (typeof o == "object")
106
+ switch (o.$$typeof) {
107
+ case l:
108
+ var c = o;
109
+ return Ce(c) + ".Consumer";
110
+ case u:
111
+ var d = o;
112
+ return Ce(d._context) + ".Provider";
113
+ case a:
114
+ return Kt(o, o.render, "ForwardRef");
115
+ case p:
116
+ var y = o.displayName || null;
117
+ return y !== null ? y : I(o.type) || "Memo";
118
+ case h: {
119
+ var E = o, R = E._payload, v = E._init;
120
+ try {
121
+ return I(v(R));
122
+ } catch {
123
+ return null;
124
+ }
125
+ }
126
+ }
127
+ return null;
128
+ }
129
+ var $ = Object.assign, B = 0, je, Ae, Ie, Fe, De, $e, Ne;
130
+ function Le() {
131
+ }
132
+ Le.__reactDisabledLog = !0;
133
+ function Yt() {
134
+ {
135
+ if (B === 0) {
136
+ je = console.log, Ae = console.info, Ie = console.warn, Fe = console.error, De = console.group, $e = console.groupCollapsed, Ne = console.groupEnd;
137
+ var o = {
138
+ configurable: !0,
139
+ enumerable: !0,
140
+ value: Le,
141
+ writable: !0
142
+ };
143
+ Object.defineProperties(console, {
144
+ info: o,
145
+ log: o,
146
+ warn: o,
147
+ error: o,
148
+ group: o,
149
+ groupCollapsed: o,
150
+ groupEnd: o
151
+ });
152
+ }
153
+ B++;
154
+ }
155
+ }
156
+ function Ht() {
157
+ {
158
+ if (B--, B === 0) {
159
+ var o = {
160
+ configurable: !0,
161
+ enumerable: !0,
162
+ writable: !0
163
+ };
164
+ Object.defineProperties(console, {
165
+ log: $({}, o, {
166
+ value: je
167
+ }),
168
+ info: $({}, o, {
169
+ value: Ae
170
+ }),
171
+ warn: $({}, o, {
172
+ value: Ie
173
+ }),
174
+ error: $({}, o, {
175
+ value: Fe
176
+ }),
177
+ group: $({}, o, {
178
+ value: De
179
+ }),
180
+ groupCollapsed: $({}, o, {
181
+ value: $e
182
+ }),
183
+ groupEnd: $({}, o, {
184
+ value: Ne
185
+ })
186
+ });
187
+ }
188
+ B < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
+ }
190
+ }
191
+ var ue = j.ReactCurrentDispatcher, ce;
192
+ function ee(o, c, d) {
193
+ {
194
+ if (ce === void 0)
195
+ try {
196
+ throw Error();
197
+ } catch (E) {
198
+ var y = E.stack.trim().match(/\n( *(at )?)/);
199
+ ce = y && y[1] || "";
200
+ }
201
+ return `
202
+ ` + ce + o;
203
+ }
204
+ }
205
+ var le = !1, te;
206
+ {
207
+ var Gt = typeof WeakMap == "function" ? WeakMap : Map;
208
+ te = new Gt();
209
+ }
210
+ function Ue(o, c) {
211
+ if (!o || le)
212
+ return "";
213
+ {
214
+ var d = te.get(o);
215
+ if (d !== void 0)
216
+ return d;
217
+ }
218
+ var y;
219
+ le = !0;
220
+ var E = Error.prepareStackTrace;
221
+ Error.prepareStackTrace = void 0;
222
+ var R;
223
+ R = ue.current, ue.current = null, Yt();
224
+ try {
225
+ if (c) {
226
+ var v = function() {
227
+ throw Error();
228
+ };
229
+ if (Object.defineProperty(v.prototype, "props", {
230
+ set: function() {
231
+ throw Error();
232
+ }
233
+ }), typeof Reflect == "object" && Reflect.construct) {
234
+ try {
235
+ Reflect.construct(v, []);
236
+ } catch (k) {
237
+ y = k;
238
+ }
239
+ Reflect.construct(o, [], v);
240
+ } else {
241
+ try {
242
+ v.call();
243
+ } catch (k) {
244
+ y = k;
245
+ }
246
+ o.call(v.prototype);
247
+ }
248
+ } else {
249
+ try {
250
+ throw Error();
251
+ } catch (k) {
252
+ y = k;
253
+ }
254
+ o();
255
+ }
256
+ } catch (k) {
257
+ if (k && y && typeof k.stack == "string") {
258
+ for (var g = k.stack.split(`
259
+ `), _ = y.stack.split(`
260
+ `), T = g.length - 1, O = _.length - 1; T >= 1 && O >= 0 && g[T] !== _[O]; )
261
+ O--;
262
+ for (; T >= 1 && O >= 0; T--, O--)
263
+ if (g[T] !== _[O]) {
264
+ if (T !== 1 || O !== 1)
265
+ do
266
+ if (T--, O--, O < 0 || g[T] !== _[O]) {
267
+ var C = `
268
+ ` + g[T].replace(" at new ", " at ");
269
+ return o.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", o.displayName)), typeof o == "function" && te.set(o, C), C;
270
+ }
271
+ while (T >= 1 && O >= 0);
272
+ break;
273
+ }
274
+ }
275
+ } finally {
276
+ le = !1, ue.current = R, Ht(), Error.prepareStackTrace = E;
277
+ }
278
+ var q = o ? o.displayName || o.name : "", N = q ? ee(q) : "";
279
+ return typeof o == "function" && te.set(o, N), N;
280
+ }
281
+ function Xt(o, c, d) {
282
+ return Ue(o, !1);
283
+ }
284
+ function Jt(o) {
285
+ var c = o.prototype;
286
+ return !!(c && c.isReactComponent);
287
+ }
288
+ function re(o, c, d) {
289
+ if (o == null)
290
+ return "";
291
+ if (typeof o == "function")
292
+ return Ue(o, Jt(o));
293
+ if (typeof o == "string")
294
+ return ee(o);
295
+ switch (o) {
296
+ case f:
297
+ return ee("Suspense");
298
+ case m:
299
+ return ee("SuspenseList");
300
+ }
301
+ if (typeof o == "object")
302
+ switch (o.$$typeof) {
303
+ case a:
304
+ return Xt(o.render);
305
+ case p:
306
+ return re(o.type, c, d);
307
+ case h: {
308
+ var y = o, E = y._payload, R = y._init;
309
+ try {
310
+ return re(R(E), c, d);
311
+ } catch {
312
+ }
313
+ }
314
+ }
315
+ return "";
316
+ }
317
+ var K = Object.prototype.hasOwnProperty, Ve = {}, qe = j.ReactDebugCurrentFrame;
318
+ function ne(o) {
319
+ if (o) {
320
+ var c = o._owner, d = re(o.type, o._source, c ? c.type : null);
321
+ qe.setExtraStackFrame(d);
322
+ } else
323
+ qe.setExtraStackFrame(null);
324
+ }
325
+ function Zt(o, c, d, y, E) {
326
+ {
327
+ var R = Function.call.bind(K);
328
+ for (var v in o)
329
+ if (R(o, v)) {
330
+ var g = void 0;
331
+ try {
332
+ if (typeof o[v] != "function") {
333
+ var _ = Error((y || "React class") + ": " + d + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
+ throw _.name = "Invariant Violation", _;
335
+ }
336
+ g = o[v](c, v, y, d, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
337
+ } catch (T) {
338
+ g = T;
339
+ }
340
+ g && !(g instanceof Error) && (ne(E), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", y || "React class", d, v, typeof g), ne(null)), g instanceof Error && !(g.message in Ve) && (Ve[g.message] = !0, ne(E), S("Failed %s type: %s", d, g.message), ne(null));
341
+ }
342
+ }
343
+ }
344
+ var Qt = Array.isArray;
345
+ function fe(o) {
346
+ return Qt(o);
347
+ }
348
+ function er(o) {
349
+ {
350
+ var c = typeof Symbol == "function" && Symbol.toStringTag, d = c && o[Symbol.toStringTag] || o.constructor.name || "Object";
351
+ return d;
352
+ }
353
+ }
354
+ function tr(o) {
355
+ try {
356
+ return ze(o), !1;
357
+ } catch {
358
+ return !0;
359
+ }
360
+ }
361
+ function ze(o) {
362
+ return "" + o;
363
+ }
364
+ function Me(o) {
365
+ if (tr(o))
366
+ return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(o)), ze(o);
367
+ }
368
+ var We = j.ReactCurrentOwner, rr = {
369
+ key: !0,
370
+ ref: !0,
371
+ __self: !0,
372
+ __source: !0
373
+ }, Be, Ke;
374
+ function nr(o) {
375
+ if (K.call(o, "ref")) {
376
+ var c = Object.getOwnPropertyDescriptor(o, "ref").get;
377
+ if (c && c.isReactWarning)
378
+ return !1;
379
+ }
380
+ return o.ref !== void 0;
381
+ }
382
+ function or(o) {
383
+ if (K.call(o, "key")) {
384
+ var c = Object.getOwnPropertyDescriptor(o, "key").get;
385
+ if (c && c.isReactWarning)
386
+ return !1;
387
+ }
388
+ return o.key !== void 0;
389
+ }
390
+ function ir(o, c) {
391
+ typeof o.ref == "string" && We.current;
392
+ }
393
+ function sr(o, c) {
394
+ {
395
+ var d = function() {
396
+ Be || (Be = !0, S("%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://reactjs.org/link/special-props)", c));
397
+ };
398
+ d.isReactWarning = !0, Object.defineProperty(o, "key", {
399
+ get: d,
400
+ configurable: !0
401
+ });
402
+ }
403
+ }
404
+ function ar(o, c) {
405
+ {
406
+ var d = function() {
407
+ Ke || (Ke = !0, S("%s: `ref` 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://reactjs.org/link/special-props)", c));
408
+ };
409
+ d.isReactWarning = !0, Object.defineProperty(o, "ref", {
410
+ get: d,
411
+ configurable: !0
412
+ });
413
+ }
414
+ }
415
+ var ur = function(o, c, d, y, E, R, v) {
416
+ var g = {
417
+ // This tag allows us to uniquely identify this as a React Element
418
+ $$typeof: t,
419
+ // Built-in properties that belong on the element
420
+ type: o,
421
+ key: c,
422
+ ref: d,
423
+ props: v,
424
+ // Record the component responsible for creating this element.
425
+ _owner: R
426
+ };
427
+ return g._store = {}, Object.defineProperty(g._store, "validated", {
428
+ configurable: !1,
429
+ enumerable: !1,
430
+ writable: !0,
431
+ value: !1
432
+ }), Object.defineProperty(g, "_self", {
433
+ configurable: !1,
434
+ enumerable: !1,
435
+ writable: !1,
436
+ value: y
437
+ }), Object.defineProperty(g, "_source", {
438
+ configurable: !1,
439
+ enumerable: !1,
440
+ writable: !1,
441
+ value: E
442
+ }), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
443
+ };
444
+ function cr(o, c, d, y, E) {
445
+ {
446
+ var R, v = {}, g = null, _ = null;
447
+ d !== void 0 && (Me(d), g = "" + d), or(c) && (Me(c.key), g = "" + c.key), nr(c) && (_ = c.ref, ir(c, E));
448
+ for (R in c)
449
+ K.call(c, R) && !rr.hasOwnProperty(R) && (v[R] = c[R]);
450
+ if (o && o.defaultProps) {
451
+ var T = o.defaultProps;
452
+ for (R in T)
453
+ v[R] === void 0 && (v[R] = T[R]);
454
+ }
455
+ if (g || _) {
456
+ var O = typeof o == "function" ? o.displayName || o.name || "Unknown" : o;
457
+ g && sr(v, O), _ && ar(v, O);
458
+ }
459
+ return ur(o, g, _, E, y, We.current, v);
460
+ }
461
+ }
462
+ var de = j.ReactCurrentOwner, Ye = j.ReactDebugCurrentFrame;
463
+ function V(o) {
464
+ if (o) {
465
+ var c = o._owner, d = re(o.type, o._source, c ? c.type : null);
466
+ Ye.setExtraStackFrame(d);
467
+ } else
468
+ Ye.setExtraStackFrame(null);
469
+ }
470
+ var me;
471
+ me = !1;
472
+ function pe(o) {
473
+ return typeof o == "object" && o !== null && o.$$typeof === t;
474
+ }
475
+ function He() {
476
+ {
477
+ if (de.current) {
478
+ var o = I(de.current.type);
479
+ if (o)
480
+ return `
481
+
482
+ Check the render method of \`` + o + "`.";
483
+ }
484
+ return "";
485
+ }
486
+ }
487
+ function lr(o) {
488
+ return "";
489
+ }
490
+ var Ge = {};
491
+ function fr(o) {
492
+ {
493
+ var c = He();
494
+ if (!c) {
495
+ var d = typeof o == "string" ? o : o.displayName || o.name;
496
+ d && (c = `
497
+
498
+ Check the top-level render call using <` + d + ">.");
499
+ }
500
+ return c;
501
+ }
502
+ }
503
+ function Xe(o, c) {
504
+ {
505
+ if (!o._store || o._store.validated || o.key != null)
506
+ return;
507
+ o._store.validated = !0;
508
+ var d = fr(c);
509
+ if (Ge[d])
510
+ return;
511
+ Ge[d] = !0;
512
+ var y = "";
513
+ o && o._owner && o._owner !== de.current && (y = " It was passed a child from " + I(o._owner.type) + "."), V(o), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', d, y), V(null);
514
+ }
515
+ }
516
+ function Je(o, c) {
517
+ {
518
+ if (typeof o != "object")
519
+ return;
520
+ if (fe(o))
521
+ for (var d = 0; d < o.length; d++) {
522
+ var y = o[d];
523
+ pe(y) && Xe(y, c);
524
+ }
525
+ else if (pe(o))
526
+ o._store && (o._store.validated = !0);
527
+ else if (o) {
528
+ var E = U(o);
529
+ if (typeof E == "function" && E !== o.entries)
530
+ for (var R = E.call(o), v; !(v = R.next()).done; )
531
+ pe(v.value) && Xe(v.value, c);
532
+ }
533
+ }
534
+ }
535
+ function dr(o) {
536
+ {
537
+ var c = o.type;
538
+ if (c == null || typeof c == "string")
539
+ return;
540
+ var d;
541
+ if (typeof c == "function")
542
+ d = c.propTypes;
543
+ else if (typeof c == "object" && (c.$$typeof === a || // Note: Memo only checks outer props here.
544
+ // Inner props are checked in the reconciler.
545
+ c.$$typeof === p))
546
+ d = c.propTypes;
547
+ else
548
+ return;
549
+ if (d) {
550
+ var y = I(c);
551
+ Zt(d, o.props, "prop", y, o);
552
+ } else if (c.PropTypes !== void 0 && !me) {
553
+ me = !0;
554
+ var E = I(c);
555
+ S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
556
+ }
557
+ typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
558
+ }
559
+ }
560
+ function mr(o) {
561
+ {
562
+ for (var c = Object.keys(o.props), d = 0; d < c.length; d++) {
563
+ var y = c[d];
564
+ if (y !== "children" && y !== "key") {
565
+ V(o), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", y), V(null);
566
+ break;
567
+ }
568
+ }
569
+ o.ref !== null && (V(o), S("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
570
+ }
571
+ }
572
+ var Ze = {};
573
+ function Qe(o, c, d, y, E, R) {
574
+ {
575
+ var v = Bt(o);
576
+ if (!v) {
577
+ var g = "";
578
+ (o === void 0 || typeof o == "object" && o !== null && Object.keys(o).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
579
+ var _ = lr();
580
+ _ ? g += _ : g += He();
581
+ var T;
582
+ o === null ? T = "null" : fe(o) ? T = "array" : o !== void 0 && o.$$typeof === t ? (T = "<" + (I(o.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : T = typeof o, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, g);
583
+ }
584
+ var O = cr(o, c, d, E, R);
585
+ if (O == null)
586
+ return O;
587
+ if (v) {
588
+ var C = c.children;
589
+ if (C !== void 0)
590
+ if (y)
591
+ if (fe(C)) {
592
+ for (var q = 0; q < C.length; q++)
593
+ Je(C[q], o);
594
+ Object.freeze && Object.freeze(C);
595
+ } else
596
+ S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
597
+ else
598
+ Je(C, o);
599
+ }
600
+ if (K.call(c, "key")) {
601
+ var N = I(o), k = Object.keys(c).filter(function(wr) {
602
+ return wr !== "key";
603
+ }), ye = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
604
+ if (!Ze[N + ye]) {
605
+ var br = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
606
+ S(`A props object containing a "key" prop is being spread into JSX:
607
+ let props = %s;
608
+ <%s {...props} />
609
+ React keys must be passed directly to JSX without using spread:
610
+ let props = %s;
611
+ <%s key={someKey} {...props} />`, ye, N, br, N), Ze[N + ye] = !0;
612
+ }
613
+ }
614
+ return o === n ? mr(O) : dr(O), O;
615
+ }
616
+ }
617
+ function pr(o, c, d) {
618
+ return Qe(o, c, d, !0);
619
+ }
620
+ function yr(o, c, d) {
621
+ return Qe(o, c, d, !1);
622
+ }
623
+ var hr = yr, gr = pr;
624
+ H.Fragment = n, H.jsx = hr, H.jsxs = gr;
625
+ }()), H;
626
+ }
627
+ process.env.NODE_ENV === "production" ? Pe.exports = Tr() : Pe.exports = Or();
628
+ var Re = Pe.exports, _e = /* @__PURE__ */ ((e) => (e.PDF = "application/pdf", e.TXT = "text/plain", e.CSV = "text/csv", e))(_e || {});
629
+ const he = 4e3 * 1024 * 1024, Sr = [
630
+ ".txt",
631
+ ".json",
632
+ ".py",
633
+ ".ts",
634
+ ".tsx"
635
+ ], xr = {
636
+ "application/pdf": {
637
+ extensions: [".pdf"],
638
+ maxSize: he
639
+ },
640
+ "text/plain": {
641
+ extensions: Sr,
642
+ maxSize: he
643
+ },
644
+ "text/csv": {
645
+ extensions: [".csv"],
646
+ maxSize: he
647
+ }
648
+ };
649
+ Object.entries(xr).reduce(
650
+ (e, [t, r]) => ({
651
+ ...e,
652
+ [t]: r.extensions
653
+ }),
654
+ {}
655
+ );
656
+ new Set(Object.values(_e));
657
+ function W(e) {
658
+ const t = {
659
+ subscribe(r) {
660
+ let n = null, i = !1, s = !1, u = !1;
661
+ function l() {
662
+ if (n === null) {
663
+ u = !0;
664
+ return;
665
+ }
666
+ s || (s = !0, typeof n == "function" ? n() : n && n.unsubscribe());
667
+ }
668
+ return n = e({
669
+ next(a) {
670
+ var f;
671
+ i || (f = r.next) == null || f.call(r, a);
672
+ },
673
+ error(a) {
674
+ var f;
675
+ i || (i = !0, (f = r.error) == null || f.call(r, a), l());
676
+ },
677
+ complete() {
678
+ var a;
679
+ i || (i = !0, (a = r.complete) == null || a.call(r), l());
680
+ }
681
+ }), u && l(), {
682
+ unsubscribe: l
683
+ };
684
+ },
685
+ pipe(...r) {
686
+ return r.reduce(_r, t);
687
+ }
688
+ };
689
+ return t;
690
+ }
691
+ function _r(e, t) {
692
+ return t(e);
693
+ }
694
+ function kr(e) {
695
+ const t = new AbortController();
696
+ return new Promise((n, i) => {
697
+ let s = !1;
698
+ function u() {
699
+ s || (s = !0, l.unsubscribe());
700
+ }
701
+ t.signal.addEventListener("abort", () => {
702
+ i(t.signal.reason);
703
+ });
704
+ const l = e.subscribe({
705
+ next(a) {
706
+ s = !0, n(a), u();
707
+ },
708
+ error(a) {
709
+ i(a);
710
+ },
711
+ complete() {
712
+ t.abort(), u();
713
+ }
714
+ });
715
+ });
716
+ }
717
+ function Cr(e) {
718
+ return (t) => {
719
+ let r = 0, n = null;
720
+ const i = [];
721
+ function s() {
722
+ n || (n = t.subscribe({
723
+ next(l) {
724
+ var a;
725
+ for (const f of i)
726
+ (a = f.next) == null || a.call(f, l);
727
+ },
728
+ error(l) {
729
+ var a;
730
+ for (const f of i)
731
+ (a = f.error) == null || a.call(f, l);
732
+ },
733
+ complete() {
734
+ var l;
735
+ for (const a of i)
736
+ (l = a.complete) == null || l.call(a);
737
+ }
738
+ }));
739
+ }
740
+ function u() {
741
+ if (r === 0 && n) {
742
+ const l = n;
743
+ n = null, l.unsubscribe();
744
+ }
745
+ }
746
+ return W((l) => (r++, i.push(l), s(), {
747
+ unsubscribe() {
748
+ r--, u();
749
+ const a = i.findIndex((f) => f === l);
750
+ a > -1 && i.splice(a, 1);
751
+ }
752
+ }));
753
+ };
754
+ }
755
+ function jr(e) {
756
+ return (t) => W((r) => t.subscribe({
757
+ next(n) {
758
+ var i;
759
+ (i = e.next) == null || i.call(e, n), r.next(n);
760
+ },
761
+ error(n) {
762
+ var i;
763
+ (i = e.error) == null || i.call(e, n), r.error(n);
764
+ },
765
+ complete() {
766
+ var n;
767
+ (n = e.complete) == null || n.call(e), r.complete();
768
+ }
769
+ }));
770
+ }
771
+ function Ar(e) {
772
+ let t = e;
773
+ const r = [], n = (u) => {
774
+ t !== void 0 && u.next(t), r.push(u);
775
+ }, i = (u) => {
776
+ r.splice(r.indexOf(u), 1);
777
+ }, s = W((u) => (n(u), () => {
778
+ i(u);
779
+ }));
780
+ return s.next = (u) => {
781
+ if (t !== u) {
782
+ t = u;
783
+ for (const l of r)
784
+ l.next(u);
785
+ }
786
+ }, s.get = () => t, s;
787
+ }
788
+ function Ir(e) {
789
+ return W((t) => {
790
+ function r(i = 0, s = e.op) {
791
+ const u = e.links[i];
792
+ if (!u)
793
+ throw new Error("No more links to execute - did you forget to add an ending link?");
794
+ return u({
795
+ op: s,
796
+ next(a) {
797
+ return r(i + 1, a);
798
+ }
799
+ });
800
+ }
801
+ return r().subscribe(t);
802
+ });
803
+ }
804
+ const wt = () => {
805
+ }, rt = (e) => {
806
+ Object.freeze && Object.freeze(e);
807
+ };
808
+ function vt(e, t, r) {
809
+ var n, i;
810
+ const s = t.join(".");
811
+ return (n = r)[i = s] ?? (n[i] = new Proxy(wt, {
812
+ get(u, l) {
813
+ if (!(typeof l != "string" || l === "then"))
814
+ return vt(e, [
815
+ ...t,
816
+ l
817
+ ], r);
818
+ },
819
+ apply(u, l, a) {
820
+ const f = t[t.length - 1];
821
+ let m = {
822
+ args: a,
823
+ path: t
824
+ };
825
+ return f === "call" ? m = {
826
+ args: a.length >= 2 ? [
827
+ a[1]
828
+ ] : [],
829
+ path: t.slice(0, -1)
830
+ } : f === "apply" && (m = {
831
+ args: a.length >= 2 ? a[1] : [],
832
+ path: t.slice(0, -1)
833
+ }), rt(m.args), rt(m.path), e(m);
834
+ }
835
+ })), r[s];
836
+ }
837
+ const Fr = (e) => vt(e, [], /* @__PURE__ */ Object.create(null)), Dr = (e) => new Proxy(wt, {
838
+ get(t, r) {
839
+ if (r !== "then")
840
+ return e(r);
841
+ }
842
+ });
843
+ function X(e) {
844
+ return !!e && !Array.isArray(e) && typeof e == "object";
845
+ }
846
+ function $r(e, t) {
847
+ if ("error" in e) {
848
+ const n = t.deserialize(e.error);
849
+ return {
850
+ ok: !1,
851
+ error: {
852
+ ...e,
853
+ error: n
854
+ }
855
+ };
856
+ }
857
+ return {
858
+ ok: !0,
859
+ result: {
860
+ ...e.result,
861
+ ...(!e.result.type || e.result.type === "data") && {
862
+ type: "data",
863
+ data: t.deserialize(e.result.data)
864
+ }
865
+ }
866
+ };
867
+ }
868
+ class ge extends Error {
869
+ constructor() {
870
+ super("Unable to transform response from server");
871
+ }
872
+ }
873
+ function Nr(e, t) {
874
+ let r;
875
+ try {
876
+ r = $r(e, t);
877
+ } catch {
878
+ throw new ge();
879
+ }
880
+ if (!r.ok && (!X(r.error.error) || typeof r.error.error.code != "number"))
881
+ throw new ge();
882
+ if (r.ok && !X(r.result))
883
+ throw new ge();
884
+ return r;
885
+ }
886
+ var nt, ot;
887
+ (nt = Symbol).dispose ?? (nt.dispose = Symbol());
888
+ (ot = Symbol).asyncDispose ?? (ot.asyncDispose = Symbol());
889
+ var dt, mt, pt, yt, ht, gt;
890
+ typeof window > "u" || "Deno" in window || // eslint-disable-next-line @typescript-eslint/dot-notation
891
+ ((mt = (dt = globalThis.process) == null ? void 0 : dt.env) == null ? void 0 : mt.NODE_ENV) === "test" || (yt = (pt = globalThis.process) == null ? void 0 : pt.env) != null && yt.JEST_WORKER_ID || (gt = (ht = globalThis.process) == null ? void 0 : ht.env) != null && gt.VITEST_WORKER_ID;
892
+ function oe(e, t, r) {
893
+ return t in e ? Object.defineProperty(e, t, {
894
+ value: r,
895
+ enumerable: !0,
896
+ configurable: !0,
897
+ writable: !0
898
+ }) : e[t] = r, e;
899
+ }
900
+ function Lr(e) {
901
+ return e instanceof F || /**
902
+ * @deprecated
903
+ * Delete in next major
904
+ */
905
+ e instanceof Error && e.name === "TRPCClientError";
906
+ }
907
+ function Ur(e) {
908
+ return X(e) && X(e.error) && typeof e.error.code == "number" && typeof e.error.message == "string";
909
+ }
910
+ function Vr(e, t) {
911
+ return typeof e == "string" ? e : X(e) && typeof e.message == "string" ? e.message : t;
912
+ }
913
+ class F extends Error {
914
+ static from(t, r = {}) {
915
+ const n = t;
916
+ return Lr(n) ? (r.meta && (n.meta = {
917
+ ...n.meta,
918
+ ...r.meta
919
+ }), n) : Ur(n) ? new F(n.error.message, {
920
+ ...r,
921
+ result: n
922
+ }) : new F(Vr(n, "Unknown error"), {
923
+ ...r,
924
+ cause: n
925
+ });
926
+ }
927
+ constructor(t, r) {
928
+ var i, s;
929
+ const n = r == null ? void 0 : r.cause;
930
+ super(t, {
931
+ cause: n
932
+ }), // eslint-disable-next-line @typescript-eslint/ban-ts-comment
933
+ // @ts-ignore override doesn't work in all environments due to "This member cannot have an 'override' modifier because it is not declared in the base class 'Error'"
934
+ oe(this, "cause", void 0), oe(this, "shape", void 0), oe(this, "data", void 0), /**
935
+ * Additional meta data about the error
936
+ * In the case of HTTP-errors, we'll have `response` and potentially `responseJSON` here
937
+ */
938
+ oe(this, "meta", void 0), this.meta = r == null ? void 0 : r.meta, this.cause = n, this.shape = (i = r == null ? void 0 : r.result) == null ? void 0 : i.error, this.data = (s = r == null ? void 0 : r.result) == null ? void 0 : s.error.data, this.name = "TRPCClientError", Object.setPrototypeOf(this, F.prototype);
939
+ }
940
+ }
941
+ function be(e, t, r) {
942
+ return t in e ? Object.defineProperty(e, t, {
943
+ value: r,
944
+ enumerable: !0,
945
+ configurable: !0,
946
+ writable: !0
947
+ }) : e[t] = r, e;
948
+ }
949
+ class qr {
950
+ $request(t) {
951
+ return Ir({
952
+ links: this.links,
953
+ op: {
954
+ ...t,
955
+ context: t.context ?? {},
956
+ id: ++this.requestId
957
+ }
958
+ }).pipe(Cr());
959
+ }
960
+ async requestAsPromise(t) {
961
+ try {
962
+ const r = this.$request(t);
963
+ return (await kr(r)).result.data;
964
+ } catch (r) {
965
+ throw F.from(r);
966
+ }
967
+ }
968
+ query(t, r, n) {
969
+ return this.requestAsPromise({
970
+ type: "query",
971
+ path: t,
972
+ input: r,
973
+ context: n == null ? void 0 : n.context,
974
+ signal: n == null ? void 0 : n.signal
975
+ });
976
+ }
977
+ mutation(t, r, n) {
978
+ return this.requestAsPromise({
979
+ type: "mutation",
980
+ path: t,
981
+ input: r,
982
+ context: n == null ? void 0 : n.context,
983
+ signal: n == null ? void 0 : n.signal
984
+ });
985
+ }
986
+ subscription(t, r, n) {
987
+ return this.$request({
988
+ type: "subscription",
989
+ path: t,
990
+ input: r,
991
+ context: n.context,
992
+ signal: n.signal
993
+ }).subscribe({
994
+ next(s) {
995
+ var u, l, a, f;
996
+ switch (s.result.type) {
997
+ case "state": {
998
+ (u = n.onConnectionStateChange) == null || u.call(n, s.result);
999
+ break;
1000
+ }
1001
+ case "started": {
1002
+ (l = n.onStarted) == null || l.call(n, {
1003
+ context: s.context
1004
+ });
1005
+ break;
1006
+ }
1007
+ case "stopped": {
1008
+ (a = n.onStopped) == null || a.call(n);
1009
+ break;
1010
+ }
1011
+ case "data":
1012
+ case void 0: {
1013
+ (f = n.onData) == null || f.call(n, s.result.data);
1014
+ break;
1015
+ }
1016
+ }
1017
+ },
1018
+ error(s) {
1019
+ var u;
1020
+ (u = n.onError) == null || u.call(n, s);
1021
+ },
1022
+ complete() {
1023
+ var s;
1024
+ (s = n.onComplete) == null || s.call(n);
1025
+ }
1026
+ });
1027
+ }
1028
+ constructor(t) {
1029
+ be(this, "links", void 0), be(this, "runtime", void 0), be(this, "requestId", void 0), this.requestId = 0, this.runtime = {}, this.links = t.links.map((r) => r(this.runtime));
1030
+ }
1031
+ }
1032
+ const zr = Symbol.for("trpc_untypedClient"), Mr = {
1033
+ query: "query",
1034
+ mutate: "mutation",
1035
+ subscribe: "subscription"
1036
+ }, Wr = (e) => Mr[e];
1037
+ function Br(e) {
1038
+ const t = Fr(({ path: r, args: n }) => {
1039
+ const i = [
1040
+ ...r
1041
+ ], s = Wr(i.pop()), u = i.join(".");
1042
+ return e[s](u, ...n);
1043
+ });
1044
+ return Dr((r) => r === zr ? e : t[r]);
1045
+ }
1046
+ function Kr(e) {
1047
+ const t = new qr(e);
1048
+ return Br(t);
1049
+ }
1050
+ const it = (e) => typeof e == "function";
1051
+ function Yr(e) {
1052
+ if (e)
1053
+ return e;
1054
+ if (typeof window < "u" && it(window.fetch))
1055
+ return window.fetch;
1056
+ if (typeof globalThis < "u" && it(globalThis.fetch))
1057
+ return globalThis.fetch;
1058
+ throw new Error("No fetch implementation found");
1059
+ }
1060
+ const st = () => {
1061
+ throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
1062
+ };
1063
+ function at(e) {
1064
+ let t = null, r = null;
1065
+ const n = () => {
1066
+ clearTimeout(r), r = null, t = null;
1067
+ };
1068
+ function i(l) {
1069
+ var m, p;
1070
+ const a = [
1071
+ []
1072
+ ];
1073
+ let f = 0;
1074
+ for (; ; ) {
1075
+ const h = l[f];
1076
+ if (!h)
1077
+ break;
1078
+ const b = a[a.length - 1];
1079
+ if (h.aborted) {
1080
+ (m = h.reject) == null || m.call(h, new Error("Aborted")), f++;
1081
+ continue;
1082
+ }
1083
+ if (e.validate(b.concat(h).map((P) => P.key))) {
1084
+ b.push(h), f++;
1085
+ continue;
1086
+ }
1087
+ if (b.length === 0) {
1088
+ (p = h.reject) == null || p.call(h, new Error("Input is too big for a single dispatch")), f++;
1089
+ continue;
1090
+ }
1091
+ a.push([]);
1092
+ }
1093
+ return a;
1094
+ }
1095
+ function s() {
1096
+ const l = i(t);
1097
+ n();
1098
+ for (const a of l) {
1099
+ if (!a.length)
1100
+ continue;
1101
+ const f = {
1102
+ items: a
1103
+ };
1104
+ for (const p of a)
1105
+ p.batch = f;
1106
+ e.fetch(f.items.map((p) => p.key)).then(async (p) => {
1107
+ var h;
1108
+ await Promise.all(p.map(async (b, x) => {
1109
+ var U, j;
1110
+ const P = f.items[x];
1111
+ try {
1112
+ const S = await Promise.resolve(b);
1113
+ (U = P.resolve) == null || U.call(P, S);
1114
+ } catch (S) {
1115
+ (j = P.reject) == null || j.call(P, S);
1116
+ }
1117
+ P.batch = null, P.reject = null, P.resolve = null;
1118
+ }));
1119
+ for (const b of f.items)
1120
+ (h = b.reject) == null || h.call(b, new Error("Missing result")), b.batch = null;
1121
+ }).catch((p) => {
1122
+ var h;
1123
+ for (const b of f.items)
1124
+ (h = b.reject) == null || h.call(b, p), b.batch = null;
1125
+ });
1126
+ }
1127
+ }
1128
+ function u(l) {
1129
+ const a = {
1130
+ aborted: !1,
1131
+ key: l,
1132
+ batch: null,
1133
+ resolve: st,
1134
+ reject: st
1135
+ }, f = new Promise((m, p) => {
1136
+ a.reject = p, a.resolve = m, t || (t = []), t.push(a);
1137
+ });
1138
+ return r || (r = setTimeout(s)), f;
1139
+ }
1140
+ return {
1141
+ load: u
1142
+ };
1143
+ }
1144
+ function Hr(...e) {
1145
+ const t = new AbortController(), r = e.length;
1146
+ let n = 0;
1147
+ const i = () => {
1148
+ ++n === r && t.abort();
1149
+ };
1150
+ for (const s of e)
1151
+ s != null && s.aborted ? i() : s == null || s.addEventListener("abort", i, {
1152
+ once: !0
1153
+ });
1154
+ return t.signal;
1155
+ }
1156
+ function Gr(e) {
1157
+ const t = e;
1158
+ return t ? "input" in t ? t : {
1159
+ input: t,
1160
+ output: t
1161
+ } : {
1162
+ input: {
1163
+ serialize: (r) => r,
1164
+ deserialize: (r) => r
1165
+ },
1166
+ output: {
1167
+ serialize: (r) => r,
1168
+ deserialize: (r) => r
1169
+ }
1170
+ };
1171
+ }
1172
+ function Xr(e) {
1173
+ return {
1174
+ url: e.url.toString(),
1175
+ fetch: e.fetch,
1176
+ transformer: Gr(e.transformer),
1177
+ methodOverride: e.methodOverride
1178
+ };
1179
+ }
1180
+ function Jr(e) {
1181
+ const t = {};
1182
+ for (let r = 0; r < e.length; r++) {
1183
+ const n = e[r];
1184
+ t[r] = n;
1185
+ }
1186
+ return t;
1187
+ }
1188
+ const Zr = {
1189
+ query: "GET",
1190
+ mutation: "POST",
1191
+ subscription: "PATCH"
1192
+ };
1193
+ function Et(e) {
1194
+ return "input" in e ? e.transformer.input.serialize(e.input) : Jr(e.inputs.map((t) => e.transformer.input.serialize(t)));
1195
+ }
1196
+ const Pt = (e) => {
1197
+ const t = e.url.split("?");
1198
+ let n = t[0].replace(/\/$/, "") + "/" + e.path;
1199
+ const i = [];
1200
+ if (t[1] && i.push(t[1]), "inputs" in e && i.push("batch=1"), e.type === "query" || e.type === "subscription") {
1201
+ const s = Et(e);
1202
+ s !== void 0 && e.methodOverride !== "POST" && i.push(`input=${encodeURIComponent(JSON.stringify(s))}`);
1203
+ }
1204
+ return i.length && (n += "?" + i.join("&")), n;
1205
+ }, Qr = (e) => {
1206
+ if (e.type === "query" && e.methodOverride !== "POST")
1207
+ return;
1208
+ const t = Et(e);
1209
+ return t !== void 0 ? JSON.stringify(t) : void 0;
1210
+ }, en = (e) => on({
1211
+ ...e,
1212
+ contentTypeHeader: "application/json",
1213
+ getUrl: Pt,
1214
+ getBody: Qr
1215
+ });
1216
+ class tn extends Error {
1217
+ constructor() {
1218
+ const t = "AbortError";
1219
+ super(t), this.name = t, this.message = t;
1220
+ }
1221
+ }
1222
+ const rn = (e) => {
1223
+ var t;
1224
+ if (e != null && e.aborted)
1225
+ throw (t = e.throwIfAborted) == null || t.call(e), typeof DOMException < "u" ? new DOMException("AbortError", "AbortError") : new tn();
1226
+ };
1227
+ async function nn(e) {
1228
+ rn(e.signal);
1229
+ const t = e.getUrl(e), r = e.getBody(e), { type: n } = e, i = await (async () => {
1230
+ const u = await e.headers();
1231
+ return Symbol.iterator in u ? Object.fromEntries(u) : u;
1232
+ })(), s = {
1233
+ ...e.contentTypeHeader ? {
1234
+ "content-type": e.contentTypeHeader
1235
+ } : {},
1236
+ ...e.trpcAcceptHeader ? {
1237
+ "trpc-accept": e.trpcAcceptHeader
1238
+ } : void 0,
1239
+ ...i
1240
+ };
1241
+ return Yr(e.fetch)(t, {
1242
+ method: e.methodOverride ?? Zr[n],
1243
+ signal: e.signal,
1244
+ body: r,
1245
+ headers: s
1246
+ });
1247
+ }
1248
+ async function on(e) {
1249
+ const t = {}, r = await nn(e);
1250
+ t.response = r;
1251
+ const n = await r.json();
1252
+ return t.responseJSON = n, {
1253
+ json: n,
1254
+ meta: t
1255
+ };
1256
+ }
1257
+ function sn(e) {
1258
+ const t = Xr(e), r = e.maxURLLength ?? 1 / 0;
1259
+ return () => {
1260
+ const n = (l) => ({
1261
+ validate(a) {
1262
+ if (r === 1 / 0)
1263
+ return !0;
1264
+ const f = a.map((h) => h.path).join(","), m = a.map((h) => h.input);
1265
+ return Pt({
1266
+ ...t,
1267
+ type: l,
1268
+ path: f,
1269
+ inputs: m,
1270
+ signal: null
1271
+ }).length <= r;
1272
+ },
1273
+ async fetch(a) {
1274
+ const f = a.map((P) => P.path).join(","), m = a.map((P) => P.input), p = Hr(...a.map((P) => P.signal)), h = await en({
1275
+ ...t,
1276
+ path: f,
1277
+ inputs: m,
1278
+ type: l,
1279
+ headers() {
1280
+ return e.headers ? typeof e.headers == "function" ? e.headers({
1281
+ opList: a
1282
+ }) : e.headers : {};
1283
+ },
1284
+ signal: p
1285
+ });
1286
+ return (Array.isArray(h.json) ? h.json : a.map(() => h.json)).map((P) => ({
1287
+ meta: h.meta,
1288
+ json: P
1289
+ }));
1290
+ }
1291
+ }), i = at(n("query")), s = at(n("mutation")), u = {
1292
+ query: i,
1293
+ mutation: s
1294
+ };
1295
+ return ({ op: l }) => W((a) => {
1296
+ /* istanbul ignore if -- @preserve */
1297
+ if (l.type === "subscription")
1298
+ throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
1299
+ const m = u[l.type].load(l);
1300
+ let p;
1301
+ return m.then((h) => {
1302
+ p = h;
1303
+ const b = Nr(h.json, t.transformer.output);
1304
+ if (!b.ok) {
1305
+ a.error(F.from(b.error, {
1306
+ meta: h.meta
1307
+ }));
1308
+ return;
1309
+ }
1310
+ a.next({
1311
+ context: h.meta,
1312
+ result: b.result
1313
+ }), a.complete();
1314
+ }).catch((h) => {
1315
+ a.error(F.from(h, {
1316
+ meta: p == null ? void 0 : p.meta
1317
+ }));
1318
+ }), () => {
1319
+ };
1320
+ });
1321
+ };
1322
+ }
1323
+ function an(e) {
1324
+ return typeof FormData > "u" ? !1 : e instanceof FormData;
1325
+ }
1326
+ const we = {
1327
+ css: {
1328
+ query: [
1329
+ "72e3ff",
1330
+ "3fb0d8"
1331
+ ],
1332
+ mutation: [
1333
+ "c5a3fc",
1334
+ "904dfc"
1335
+ ],
1336
+ subscription: [
1337
+ "ff49e1",
1338
+ "d83fbe"
1339
+ ]
1340
+ },
1341
+ ansi: {
1342
+ regular: {
1343
+ // Cyan background, black and white text respectively
1344
+ query: [
1345
+ "\x1B[30;46m",
1346
+ "\x1B[97;46m"
1347
+ ],
1348
+ // Magenta background, black and white text respectively
1349
+ mutation: [
1350
+ "\x1B[30;45m",
1351
+ "\x1B[97;45m"
1352
+ ],
1353
+ // Green background, black and white text respectively
1354
+ subscription: [
1355
+ "\x1B[30;42m",
1356
+ "\x1B[97;42m"
1357
+ ]
1358
+ },
1359
+ bold: {
1360
+ query: [
1361
+ "\x1B[1;30;46m",
1362
+ "\x1B[1;97;46m"
1363
+ ],
1364
+ mutation: [
1365
+ "\x1B[1;30;45m",
1366
+ "\x1B[1;97;45m"
1367
+ ],
1368
+ subscription: [
1369
+ "\x1B[1;30;42m",
1370
+ "\x1B[1;97;42m"
1371
+ ]
1372
+ }
1373
+ }
1374
+ };
1375
+ function un(e) {
1376
+ const { direction: t, type: r, withContext: n, path: i, id: s, input: u } = e, l = [], a = [];
1377
+ if (e.colorMode === "none")
1378
+ l.push(t === "up" ? ">>" : "<<", r, `#${s}`, i);
1379
+ else if (e.colorMode === "ansi") {
1380
+ const [f, m] = we.ansi.regular[r], [p, h] = we.ansi.bold[r];
1381
+ l.push(t === "up" ? f : m, t === "up" ? ">>" : "<<", r, t === "up" ? p : h, `#${s}`, i, "\x1B[0m");
1382
+ } else {
1383
+ const [f, m] = we.css[r], p = `
1384
+ background-color: #${t === "up" ? f : m};
1385
+ color: ${t === "up" ? "black" : "white"};
1386
+ padding: 2px;
1387
+ `;
1388
+ l.push("%c", t === "up" ? ">>" : "<<", r, `#${s}`, `%c${i}%c`, "%O"), a.push(p, `${p}; font-weight: bold;`, `${p}; font-weight: normal;`);
1389
+ }
1390
+ return t === "up" ? a.push(n ? {
1391
+ input: u,
1392
+ context: e.context
1393
+ } : {
1394
+ input: u
1395
+ }) : a.push({
1396
+ input: u,
1397
+ result: e.result,
1398
+ elapsedMs: e.elapsedMs,
1399
+ ...n && {
1400
+ context: e.context
1401
+ }
1402
+ }), {
1403
+ parts: l,
1404
+ args: a
1405
+ };
1406
+ }
1407
+ const cn = ({ c: e = console, colorMode: t = "css", withContext: r }) => (n) => {
1408
+ const i = n.input, s = an(i) ? Object.fromEntries(i) : i, { parts: u, args: l } = un({
1409
+ ...n,
1410
+ colorMode: t,
1411
+ input: s,
1412
+ withContext: r
1413
+ }), a = n.direction === "down" && n.result && (n.result instanceof Error || "error" in n.result.result && n.result.result.error) ? "error" : "log";
1414
+ e[a].apply(null, [
1415
+ u.join(" ")
1416
+ ].concat(l));
1417
+ };
1418
+ function ln(e = {}) {
1419
+ const { enabled: t = () => !0 } = e, r = e.colorMode ?? (typeof window > "u" ? "ansi" : "css"), n = e.withContext ?? r === "css", { logger: i = cn({
1420
+ c: e.console,
1421
+ colorMode: r,
1422
+ withContext: n
1423
+ }) } = e;
1424
+ return () => ({ op: s, next: u }) => W((l) => {
1425
+ t({
1426
+ ...s,
1427
+ direction: "up"
1428
+ }) && i({
1429
+ ...s,
1430
+ direction: "up"
1431
+ });
1432
+ const a = Date.now();
1433
+ function f(m) {
1434
+ const p = Date.now() - a;
1435
+ t({
1436
+ ...s,
1437
+ direction: "down",
1438
+ result: m
1439
+ }) && i({
1440
+ ...s,
1441
+ direction: "down",
1442
+ elapsedMs: p,
1443
+ result: m
1444
+ });
1445
+ }
1446
+ return u(s).pipe(jr({
1447
+ next(m) {
1448
+ f(m);
1449
+ },
1450
+ error(m) {
1451
+ f(m);
1452
+ }
1453
+ })).subscribe(l);
1454
+ });
1455
+ }
1456
+ const fn = (e, ...t) => typeof e == "function" ? e(...t) : e;
1457
+ function dn() {
1458
+ let e, t;
1459
+ return {
1460
+ promise: new Promise((n, i) => {
1461
+ e = n, t = i;
1462
+ }),
1463
+ resolve: e,
1464
+ reject: t
1465
+ };
1466
+ }
1467
+ async function mn(e) {
1468
+ const t = await fn(e.url);
1469
+ if (!e.connectionParams) return t;
1470
+ const n = `${t.includes("?") ? "&" : "?"}connectionParams=1`;
1471
+ return t + n;
1472
+ }
1473
+ function L(e, t, r) {
1474
+ return t in e ? Object.defineProperty(e, t, {
1475
+ value: r,
1476
+ enumerable: !0,
1477
+ configurable: !0,
1478
+ writable: !0
1479
+ }) : e[t] = r, e;
1480
+ }
1481
+ function pn(e) {
1482
+ const { promise: t, resolve: r, reject: n } = dn();
1483
+ return e.addEventListener("open", () => {
1484
+ e.removeEventListener("error", n), r();
1485
+ }), e.addEventListener("error", n), t;
1486
+ }
1487
+ function yn(e, { intervalMs: t, pongTimeoutMs: r }) {
1488
+ let n, i;
1489
+ function s() {
1490
+ n = setTimeout(() => {
1491
+ e.send("PING"), i = setTimeout(() => {
1492
+ e.close();
1493
+ }, r);
1494
+ }, t);
1495
+ }
1496
+ function u() {
1497
+ clearTimeout(n), s();
1498
+ }
1499
+ function l() {
1500
+ clearTimeout(i), u();
1501
+ }
1502
+ e.addEventListener("open", s), e.addEventListener("message", ({ data: a }) => {
1503
+ clearTimeout(n), s(), a === "PONG" && l();
1504
+ }), e.addEventListener("close", () => {
1505
+ clearTimeout(n), clearTimeout(i);
1506
+ });
1507
+ }
1508
+ class se {
1509
+ get ws() {
1510
+ return this.wsObservable.get();
1511
+ }
1512
+ set ws(t) {
1513
+ this.wsObservable.next(t);
1514
+ }
1515
+ /**
1516
+ * Checks if the WebSocket connection is open and ready to communicate.
1517
+ */
1518
+ isOpen() {
1519
+ return !!this.ws && this.ws.readyState === this.WebSocketPonyfill.OPEN;
1520
+ }
1521
+ /**
1522
+ * Checks if the WebSocket connection is closed or in the process of closing.
1523
+ */
1524
+ isClosed() {
1525
+ return !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);
1526
+ }
1527
+ async open() {
1528
+ if (this.openPromise) return this.openPromise;
1529
+ this.id = ++se.connectCount;
1530
+ const t = mn(this.urlOptions).then((r) => new this.WebSocketPonyfill(r));
1531
+ this.openPromise = t.then(pn), this.ws = await t, this.ws.addEventListener("message", function({ data: r }) {
1532
+ r === "PING" && this.send("PONG");
1533
+ }), this.keepAliveOpts.enabled && yn(this.ws, this.keepAliveOpts), this.ws.addEventListener("close", () => {
1534
+ this.ws = null;
1535
+ });
1536
+ try {
1537
+ await this.openPromise;
1538
+ } finally {
1539
+ this.openPromise = null;
1540
+ }
1541
+ }
1542
+ /**
1543
+ * Closes the WebSocket connection gracefully.
1544
+ * Waits for any ongoing open operation to complete before closing.
1545
+ */
1546
+ async close() {
1547
+ var t;
1548
+ try {
1549
+ await this.openPromise;
1550
+ } finally {
1551
+ (t = this.ws) == null || t.close();
1552
+ }
1553
+ }
1554
+ constructor(t) {
1555
+ if (L(this, "id", ++se.connectCount), L(this, "WebSocketPonyfill", void 0), L(this, "urlOptions", void 0), L(this, "keepAliveOpts", void 0), L(this, "wsObservable", Ar(null)), L(this, "openPromise", null), this.WebSocketPonyfill = t.WebSocketPonyfill ?? WebSocket, !this.WebSocketPonyfill)
1556
+ throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
1557
+ this.urlOptions = t.urlOptions, this.keepAliveOpts = t.keepAlive;
1558
+ }
1559
+ }
1560
+ L(se, "connectCount", 0);
1561
+ class hn {
1562
+ constructor() {
1563
+ this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
1564
+ }
1565
+ set(t, r) {
1566
+ this.keyToValue.set(t, r), this.valueToKey.set(r, t);
1567
+ }
1568
+ getByKey(t) {
1569
+ return this.keyToValue.get(t);
1570
+ }
1571
+ getByValue(t) {
1572
+ return this.valueToKey.get(t);
1573
+ }
1574
+ clear() {
1575
+ this.keyToValue.clear(), this.valueToKey.clear();
1576
+ }
1577
+ }
1578
+ class Rt {
1579
+ constructor(t) {
1580
+ this.generateIdentifier = t, this.kv = new hn();
1581
+ }
1582
+ register(t, r) {
1583
+ this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
1584
+ }
1585
+ clear() {
1586
+ this.kv.clear();
1587
+ }
1588
+ getIdentifier(t) {
1589
+ return this.kv.getByValue(t);
1590
+ }
1591
+ getValue(t) {
1592
+ return this.kv.getByKey(t);
1593
+ }
1594
+ }
1595
+ class gn extends Rt {
1596
+ constructor() {
1597
+ super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
1598
+ }
1599
+ register(t, r) {
1600
+ typeof r == "object" ? (r.allowProps && this.classToAllowedProps.set(t, r.allowProps), super.register(t, r.identifier)) : super.register(t, r);
1601
+ }
1602
+ getAllowedProps(t) {
1603
+ return this.classToAllowedProps.get(t);
1604
+ }
1605
+ }
1606
+ function bn(e) {
1607
+ if ("values" in Object)
1608
+ return Object.values(e);
1609
+ const t = [];
1610
+ for (const r in e)
1611
+ e.hasOwnProperty(r) && t.push(e[r]);
1612
+ return t;
1613
+ }
1614
+ function wn(e, t) {
1615
+ const r = bn(e);
1616
+ if ("find" in r)
1617
+ return r.find(t);
1618
+ const n = r;
1619
+ for (let i = 0; i < n.length; i++) {
1620
+ const s = n[i];
1621
+ if (t(s))
1622
+ return s;
1623
+ }
1624
+ }
1625
+ function M(e, t) {
1626
+ Object.entries(e).forEach(([r, n]) => t(n, r));
1627
+ }
1628
+ function ie(e, t) {
1629
+ return e.indexOf(t) !== -1;
1630
+ }
1631
+ function ut(e, t) {
1632
+ for (let r = 0; r < e.length; r++) {
1633
+ const n = e[r];
1634
+ if (t(n))
1635
+ return n;
1636
+ }
1637
+ }
1638
+ class vn {
1639
+ constructor() {
1640
+ this.transfomers = {};
1641
+ }
1642
+ register(t) {
1643
+ this.transfomers[t.name] = t;
1644
+ }
1645
+ findApplicable(t) {
1646
+ return wn(this.transfomers, (r) => r.isApplicable(t));
1647
+ }
1648
+ findByName(t) {
1649
+ return this.transfomers[t];
1650
+ }
1651
+ }
1652
+ const En = (e) => Object.prototype.toString.call(e).slice(8, -1), Tt = (e) => typeof e > "u", Pn = (e) => e === null, J = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Te = (e) => J(e) && Object.keys(e).length === 0, D = (e) => Array.isArray(e), Rn = (e) => typeof e == "string", Tn = (e) => typeof e == "number" && !isNaN(e), On = (e) => typeof e == "boolean", Sn = (e) => e instanceof RegExp, Z = (e) => e instanceof Map, Q = (e) => e instanceof Set, Ot = (e) => En(e) === "Symbol", xn = (e) => e instanceof Date && !isNaN(e.valueOf()), _n = (e) => e instanceof Error, ct = (e) => typeof e == "number" && isNaN(e), kn = (e) => On(e) || Pn(e) || Tt(e) || Tn(e) || Rn(e) || Ot(e), Cn = (e) => typeof e == "bigint", jn = (e) => e === 1 / 0 || e === -1 / 0, An = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), In = (e) => e instanceof URL, St = (e) => e.replace(/\./g, "\\."), ve = (e) => e.map(String).map(St).join("."), G = (e) => {
1653
+ const t = [];
1654
+ let r = "";
1655
+ for (let i = 0; i < e.length; i++) {
1656
+ let s = e.charAt(i);
1657
+ if (s === "\\" && e.charAt(i + 1) === ".") {
1658
+ r += ".", i++;
1659
+ continue;
1660
+ }
1661
+ if (s === ".") {
1662
+ t.push(r), r = "";
1663
+ continue;
1664
+ }
1665
+ r += s;
1666
+ }
1667
+ const n = r;
1668
+ return t.push(n), t;
1669
+ };
1670
+ function A(e, t, r, n) {
1671
+ return {
1672
+ isApplicable: e,
1673
+ annotation: t,
1674
+ transform: r,
1675
+ untransform: n
1676
+ };
1677
+ }
1678
+ const xt = [
1679
+ A(Tt, "undefined", () => null, () => {
1680
+ }),
1681
+ A(Cn, "bigint", (e) => e.toString(), (e) => typeof BigInt < "u" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
1682
+ A(xn, "Date", (e) => e.toISOString(), (e) => new Date(e)),
1683
+ A(_n, "Error", (e, t) => {
1684
+ const r = {
1685
+ name: e.name,
1686
+ message: e.message
1687
+ };
1688
+ return t.allowedErrorProps.forEach((n) => {
1689
+ r[n] = e[n];
1690
+ }), r;
1691
+ }, (e, t) => {
1692
+ const r = new Error(e.message);
1693
+ return r.name = e.name, r.stack = e.stack, t.allowedErrorProps.forEach((n) => {
1694
+ r[n] = e[n];
1695
+ }), r;
1696
+ }),
1697
+ A(Sn, "regexp", (e) => "" + e, (e) => {
1698
+ const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
1699
+ return new RegExp(t, r);
1700
+ }),
1701
+ A(
1702
+ Q,
1703
+ "set",
1704
+ // (sets only exist in es6+)
1705
+ // eslint-disable-next-line es5/no-es6-methods
1706
+ (e) => [...e.values()],
1707
+ (e) => new Set(e)
1708
+ ),
1709
+ A(Z, "map", (e) => [...e.entries()], (e) => new Map(e)),
1710
+ A((e) => ct(e) || jn(e), "number", (e) => ct(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
1711
+ A((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
1712
+ A(In, "URL", (e) => e.toString(), (e) => new URL(e))
1713
+ ];
1714
+ function ae(e, t, r, n) {
1715
+ return {
1716
+ isApplicable: e,
1717
+ annotation: t,
1718
+ transform: r,
1719
+ untransform: n
1720
+ };
1721
+ }
1722
+ const _t = ae((e, t) => Ot(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
1723
+ const n = r.symbolRegistry.getValue(t[1]);
1724
+ if (!n)
1725
+ throw new Error("Trying to deserialize unknown symbol");
1726
+ return n;
1727
+ }), Fn = [
1728
+ Int8Array,
1729
+ Uint8Array,
1730
+ Int16Array,
1731
+ Uint16Array,
1732
+ Int32Array,
1733
+ Uint32Array,
1734
+ Float32Array,
1735
+ Float64Array,
1736
+ Uint8ClampedArray
1737
+ ].reduce((e, t) => (e[t.name] = t, e), {}), kt = ae(An, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
1738
+ const r = Fn[t[1]];
1739
+ if (!r)
1740
+ throw new Error("Trying to deserialize unknown typed array");
1741
+ return new r(e);
1742
+ });
1743
+ function Ct(e, t) {
1744
+ return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
1745
+ }
1746
+ const jt = ae(Ct, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
1747
+ const r = t.classRegistry.getAllowedProps(e.constructor);
1748
+ if (!r)
1749
+ return { ...e };
1750
+ const n = {};
1751
+ return r.forEach((i) => {
1752
+ n[i] = e[i];
1753
+ }), n;
1754
+ }, (e, t, r) => {
1755
+ const n = r.classRegistry.getValue(t[1]);
1756
+ if (!n)
1757
+ throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
1758
+ return Object.assign(Object.create(n.prototype), e);
1759
+ }), At = ae((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
1760
+ const n = r.customTransformerRegistry.findByName(t[1]);
1761
+ if (!n)
1762
+ throw new Error("Trying to deserialize unknown custom value");
1763
+ return n.deserialize(e);
1764
+ }), Dn = [jt, _t, At, kt], lt = (e, t) => {
1765
+ const r = ut(Dn, (i) => i.isApplicable(e, t));
1766
+ if (r)
1767
+ return {
1768
+ value: r.transform(e, t),
1769
+ type: r.annotation(e, t)
1770
+ };
1771
+ const n = ut(xt, (i) => i.isApplicable(e, t));
1772
+ if (n)
1773
+ return {
1774
+ value: n.transform(e, t),
1775
+ type: n.annotation
1776
+ };
1777
+ }, It = {};
1778
+ xt.forEach((e) => {
1779
+ It[e.annotation] = e;
1780
+ });
1781
+ const $n = (e, t, r) => {
1782
+ if (D(t))
1783
+ switch (t[0]) {
1784
+ case "symbol":
1785
+ return _t.untransform(e, t, r);
1786
+ case "class":
1787
+ return jt.untransform(e, t, r);
1788
+ case "custom":
1789
+ return At.untransform(e, t, r);
1790
+ case "typed-array":
1791
+ return kt.untransform(e, t, r);
1792
+ default:
1793
+ throw new Error("Unknown transformation: " + t);
1794
+ }
1795
+ else {
1796
+ const n = It[t];
1797
+ if (!n)
1798
+ throw new Error("Unknown transformation: " + t);
1799
+ return n.untransform(e, r);
1800
+ }
1801
+ }, z = (e, t) => {
1802
+ if (t > e.size)
1803
+ throw new Error("index out of bounds");
1804
+ const r = e.keys();
1805
+ for (; t > 0; )
1806
+ r.next(), t--;
1807
+ return r.next().value;
1808
+ };
1809
+ function Ft(e) {
1810
+ if (ie(e, "__proto__"))
1811
+ throw new Error("__proto__ is not allowed as a property");
1812
+ if (ie(e, "prototype"))
1813
+ throw new Error("prototype is not allowed as a property");
1814
+ if (ie(e, "constructor"))
1815
+ throw new Error("constructor is not allowed as a property");
1816
+ }
1817
+ const Nn = (e, t) => {
1818
+ Ft(t);
1819
+ for (let r = 0; r < t.length; r++) {
1820
+ const n = t[r];
1821
+ if (Q(e))
1822
+ e = z(e, +n);
1823
+ else if (Z(e)) {
1824
+ const i = +n, s = +t[++r] == 0 ? "key" : "value", u = z(e, i);
1825
+ switch (s) {
1826
+ case "key":
1827
+ e = u;
1828
+ break;
1829
+ case "value":
1830
+ e = e.get(u);
1831
+ break;
1832
+ }
1833
+ } else
1834
+ e = e[n];
1835
+ }
1836
+ return e;
1837
+ }, Oe = (e, t, r) => {
1838
+ if (Ft(t), t.length === 0)
1839
+ return r(e);
1840
+ let n = e;
1841
+ for (let s = 0; s < t.length - 1; s++) {
1842
+ const u = t[s];
1843
+ if (D(n)) {
1844
+ const l = +u;
1845
+ n = n[l];
1846
+ } else if (J(n))
1847
+ n = n[u];
1848
+ else if (Q(n)) {
1849
+ const l = +u;
1850
+ n = z(n, l);
1851
+ } else if (Z(n)) {
1852
+ if (s === t.length - 2)
1853
+ break;
1854
+ const a = +u, f = +t[++s] == 0 ? "key" : "value", m = z(n, a);
1855
+ switch (f) {
1856
+ case "key":
1857
+ n = m;
1858
+ break;
1859
+ case "value":
1860
+ n = n.get(m);
1861
+ break;
1862
+ }
1863
+ }
1864
+ }
1865
+ const i = t[t.length - 1];
1866
+ if (D(n) ? n[+i] = r(n[+i]) : J(n) && (n[i] = r(n[i])), Q(n)) {
1867
+ const s = z(n, +i), u = r(s);
1868
+ s !== u && (n.delete(s), n.add(u));
1869
+ }
1870
+ if (Z(n)) {
1871
+ const s = +t[t.length - 2], u = z(n, s);
1872
+ switch (+i == 0 ? "key" : "value") {
1873
+ case "key": {
1874
+ const a = r(u);
1875
+ n.set(a, n.get(u)), a !== u && n.delete(u);
1876
+ break;
1877
+ }
1878
+ case "value": {
1879
+ n.set(u, r(n.get(u)));
1880
+ break;
1881
+ }
1882
+ }
1883
+ }
1884
+ return e;
1885
+ };
1886
+ function Se(e, t, r = []) {
1887
+ if (!e)
1888
+ return;
1889
+ if (!D(e)) {
1890
+ M(e, (s, u) => Se(s, t, [...r, ...G(u)]));
1891
+ return;
1892
+ }
1893
+ const [n, i] = e;
1894
+ i && M(i, (s, u) => {
1895
+ Se(s, t, [...r, ...G(u)]);
1896
+ }), t(n, r);
1897
+ }
1898
+ function Ln(e, t, r) {
1899
+ return Se(t, (n, i) => {
1900
+ e = Oe(e, i, (s) => $n(s, n, r));
1901
+ }), e;
1902
+ }
1903
+ function Un(e, t) {
1904
+ function r(n, i) {
1905
+ const s = Nn(e, G(i));
1906
+ n.map(G).forEach((u) => {
1907
+ e = Oe(e, u, () => s);
1908
+ });
1909
+ }
1910
+ if (D(t)) {
1911
+ const [n, i] = t;
1912
+ n.forEach((s) => {
1913
+ e = Oe(e, G(s), () => e);
1914
+ }), i && M(i, r);
1915
+ } else
1916
+ M(t, r);
1917
+ return e;
1918
+ }
1919
+ const Vn = (e, t) => J(e) || D(e) || Z(e) || Q(e) || Ct(e, t);
1920
+ function qn(e, t, r) {
1921
+ const n = r.get(e);
1922
+ n ? n.push(t) : r.set(e, [t]);
1923
+ }
1924
+ function zn(e, t) {
1925
+ const r = {};
1926
+ let n;
1927
+ return e.forEach((i) => {
1928
+ if (i.length <= 1)
1929
+ return;
1930
+ t || (i = i.map((l) => l.map(String)).sort((l, a) => l.length - a.length));
1931
+ const [s, ...u] = i;
1932
+ s.length === 0 ? n = u.map(ve) : r[ve(s)] = u.map(ve);
1933
+ }), n ? Te(r) ? [n] : [n, r] : Te(r) ? void 0 : r;
1934
+ }
1935
+ const Dt = (e, t, r, n, i = [], s = [], u = /* @__PURE__ */ new Map()) => {
1936
+ const l = kn(e);
1937
+ if (!l) {
1938
+ qn(e, i, t);
1939
+ const b = u.get(e);
1940
+ if (b)
1941
+ return n ? {
1942
+ transformedValue: null
1943
+ } : b;
1944
+ }
1945
+ if (!Vn(e, r)) {
1946
+ const b = lt(e, r), x = b ? {
1947
+ transformedValue: b.value,
1948
+ annotations: [b.type]
1949
+ } : {
1950
+ transformedValue: e
1951
+ };
1952
+ return l || u.set(e, x), x;
1953
+ }
1954
+ if (ie(s, e))
1955
+ return {
1956
+ transformedValue: null
1957
+ };
1958
+ const a = lt(e, r), f = (a == null ? void 0 : a.value) ?? e, m = D(f) ? [] : {}, p = {};
1959
+ M(f, (b, x) => {
1960
+ if (x === "__proto__" || x === "constructor" || x === "prototype")
1961
+ throw new Error(`Detected property ${x}. This is a prototype pollution risk, please remove it from your object.`);
1962
+ const P = Dt(b, t, r, n, [...i, x], [...s, e], u);
1963
+ m[x] = P.transformedValue, D(P.annotations) ? p[x] = P.annotations : J(P.annotations) && M(P.annotations, (U, j) => {
1964
+ p[St(x) + "." + j] = U;
1965
+ });
1966
+ });
1967
+ const h = Te(p) ? {
1968
+ transformedValue: m,
1969
+ annotations: a ? [a.type] : void 0
1970
+ } : {
1971
+ transformedValue: m,
1972
+ annotations: a ? [a.type, p] : p
1973
+ };
1974
+ return l || u.set(e, h), h;
1975
+ };
1976
+ function $t(e) {
1977
+ return Object.prototype.toString.call(e).slice(8, -1);
1978
+ }
1979
+ function ft(e) {
1980
+ return $t(e) === "Array";
1981
+ }
1982
+ function Mn(e) {
1983
+ if ($t(e) !== "Object")
1984
+ return !1;
1985
+ const t = Object.getPrototypeOf(e);
1986
+ return !!t && t.constructor === Object && t === Object.prototype;
1987
+ }
1988
+ function Wn(e, t, r, n, i) {
1989
+ const s = {}.propertyIsEnumerable.call(n, t) ? "enumerable" : "nonenumerable";
1990
+ s === "enumerable" && (e[t] = r), i && s === "nonenumerable" && Object.defineProperty(e, t, {
1991
+ value: r,
1992
+ enumerable: !1,
1993
+ writable: !0,
1994
+ configurable: !0
1995
+ });
1996
+ }
1997
+ function xe(e, t = {}) {
1998
+ if (ft(e))
1999
+ return e.map((i) => xe(i, t));
2000
+ if (!Mn(e))
2001
+ return e;
2002
+ const r = Object.getOwnPropertyNames(e), n = Object.getOwnPropertySymbols(e);
2003
+ return [...r, ...n].reduce((i, s) => {
2004
+ if (ft(t.props) && !t.props.includes(s))
2005
+ return i;
2006
+ const u = e[s], l = xe(u, t);
2007
+ return Wn(i, s, l, e, t.nonenumerable), i;
2008
+ }, {});
2009
+ }
2010
+ class w {
2011
+ /**
2012
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
2013
+ */
2014
+ constructor({ dedupe: t = !1 } = {}) {
2015
+ this.classRegistry = new gn(), this.symbolRegistry = new Rt((r) => r.description ?? ""), this.customTransformerRegistry = new vn(), this.allowedErrorProps = [], this.dedupe = t;
2016
+ }
2017
+ serialize(t) {
2018
+ const r = /* @__PURE__ */ new Map(), n = Dt(t, r, this, this.dedupe), i = {
2019
+ json: n.transformedValue
2020
+ };
2021
+ n.annotations && (i.meta = {
2022
+ ...i.meta,
2023
+ values: n.annotations
2024
+ });
2025
+ const s = zn(r, this.dedupe);
2026
+ return s && (i.meta = {
2027
+ ...i.meta,
2028
+ referentialEqualities: s
2029
+ }), i;
2030
+ }
2031
+ deserialize(t) {
2032
+ const { json: r, meta: n } = t;
2033
+ let i = xe(r);
2034
+ return n != null && n.values && (i = Ln(i, n.values, this)), n != null && n.referentialEqualities && (i = Un(i, n.referentialEqualities)), i;
2035
+ }
2036
+ stringify(t) {
2037
+ return JSON.stringify(this.serialize(t));
2038
+ }
2039
+ parse(t) {
2040
+ return this.deserialize(JSON.parse(t));
2041
+ }
2042
+ registerClass(t, r) {
2043
+ this.classRegistry.register(t, r);
2044
+ }
2045
+ registerSymbol(t, r) {
2046
+ this.symbolRegistry.register(t, r);
2047
+ }
2048
+ registerCustom(t, r) {
2049
+ this.customTransformerRegistry.register({
2050
+ name: r,
2051
+ ...t
2052
+ });
2053
+ }
2054
+ allowErrorProps(...t) {
2055
+ this.allowedErrorProps.push(...t);
2056
+ }
2057
+ }
2058
+ w.defaultInstance = new w();
2059
+ w.serialize = w.defaultInstance.serialize.bind(w.defaultInstance);
2060
+ w.deserialize = w.defaultInstance.deserialize.bind(w.defaultInstance);
2061
+ w.stringify = w.defaultInstance.stringify.bind(w.defaultInstance);
2062
+ w.parse = w.defaultInstance.parse.bind(w.defaultInstance);
2063
+ w.registerClass = w.defaultInstance.registerClass.bind(w.defaultInstance);
2064
+ w.registerSymbol = w.defaultInstance.registerSymbol.bind(w.defaultInstance);
2065
+ w.registerCustom = w.defaultInstance.registerCustom.bind(w.defaultInstance);
2066
+ w.allowErrorProps = w.defaultInstance.allowErrorProps.bind(w.defaultInstance);
2067
+ w.serialize;
2068
+ w.deserialize;
2069
+ w.stringify;
2070
+ w.parse;
2071
+ w.registerClass;
2072
+ w.registerCustom;
2073
+ w.registerSymbol;
2074
+ w.allowErrorProps;
2075
+ const Bn = "dev-jwt-token-for-testing", Kn = async () => Bn, Nt = Er(null);
2076
+ function Yn(e, t) {
2077
+ const r = Kr({
2078
+ links: [
2079
+ ln({
2080
+ enabled: (n) => process.env.NODE_ENV === "development" && typeof window < "u" || n.direction === "down" && n.result instanceof Error
2081
+ }),
2082
+ sn({
2083
+ url: `${e}/trpc`,
2084
+ headers: async () => ({
2085
+ Authorization: `Bearer ${await t()}`
2086
+ }),
2087
+ transformer: w
2088
+ })
2089
+ ]
2090
+ });
2091
+ return {
2092
+ getProjectsForUser: async () => (await r.projectRouter.getAllProjects.query()).map((i) => ({
2093
+ name: i.name,
2094
+ id: i.id
2095
+ })),
2096
+ addProjectForUser: async (n) => {
2097
+ const i = await r.projectRouter.createProject.mutate({
2098
+ name: n
2099
+ });
2100
+ return {
2101
+ name: i.name,
2102
+ id: i.id
2103
+ };
2104
+ },
2105
+ addFilesToProject: async (n, i) => {
2106
+ const s = [];
2107
+ for (const u of i) {
2108
+ const l = await r.fileRouter.createFile.mutate({
2109
+ file: {
2110
+ projectId: n,
2111
+ mimeType: _e.PDF,
2112
+ // Adjust as needed
2113
+ path: u.path,
2114
+ name: u.name,
2115
+ size: 0,
2116
+ // You might need to calculate or pass size
2117
+ metadata: null,
2118
+ isArtifact: !1,
2119
+ summary: null
2120
+ }
2121
+ });
2122
+ s.push({
2123
+ path: l.path,
2124
+ name: l.name,
2125
+ id: l.id
2126
+ });
2127
+ }
2128
+ return s;
2129
+ },
2130
+ getFilesForProject: async (n) => (await r.fileRouter.getFilesByProject.query({
2131
+ projectId: n
2132
+ })).map((s) => ({
2133
+ path: s.path,
2134
+ name: s.name,
2135
+ id: s.id
2136
+ }))
2137
+ };
2138
+ }
2139
+ function Zn({
2140
+ children: e,
2141
+ host: t = "http://localhost",
2142
+ port: r = 5174,
2143
+ getToken: n = Kn
2144
+ }) {
2145
+ const [i, s] = Ee(null);
2146
+ return Pr(() => {
2147
+ const u = `${t}:${r}`, l = Yn(u, n);
2148
+ s(l);
2149
+ }, [t, r, n]), /* @__PURE__ */ Re.jsx(Nt.Provider, { value: { host: t, port: r, client: i }, children: e });
2150
+ }
2151
+ function Lt() {
2152
+ const e = Rr(Nt);
2153
+ if (!e)
2154
+ throw new Error("useFolioContext must be used within a FolioProvider");
2155
+ return e;
2156
+ }
2157
+ const { useEffect: Hn, useRef: Gn, useState: Xn } = vr;
2158
+ function Qn({
2159
+ width: e = "100%",
2160
+ height: t = "100vh",
2161
+ allow: r = "camera; microphone; clipboard-read; clipboard-write; fullscreen",
2162
+ style: n,
2163
+ className: i = "",
2164
+ iframeProps: s = {}
2165
+ }) {
2166
+ const { host: u, port: l } = Lt(), a = Gn(null), [f, m] = Xn();
2167
+ return Hn(() => {
2168
+ m(`${u}:${l}`);
2169
+ }, [u, l]), f ? /* @__PURE__ */ Re.jsx(
2170
+ "div",
2171
+ {
2172
+ className: `folio-embed-container ${i}`,
2173
+ style: {
2174
+ width: e,
2175
+ height: t,
2176
+ overflow: "hidden",
2177
+ ...n
2178
+ },
2179
+ children: /* @__PURE__ */ Re.jsx(
2180
+ "iframe",
2181
+ {
2182
+ ref: a,
2183
+ src: f,
2184
+ width: "100%",
2185
+ height: "100%",
2186
+ style: {
2187
+ border: "none",
2188
+ width: "100%",
2189
+ height: "100%",
2190
+ overflow: "auto"
2191
+ },
2192
+ allow: r,
2193
+ allowFullScreen: !0,
2194
+ ...s
2195
+ }
2196
+ )
2197
+ }
2198
+ ) : null;
2199
+ }
2200
+ function eo() {
2201
+ const { client: e } = Lt(), [t, r] = Ee(!1), [n, i] = Ee(null);
2202
+ return {
2203
+ isLoading: t,
2204
+ error: n,
2205
+ getProjectsForUser: async () => {
2206
+ for (; !e; )
2207
+ await new Promise((f) => setTimeout(f, 100));
2208
+ r(!0), i(null);
2209
+ try {
2210
+ return await e.getProjectsForUser();
2211
+ } catch (f) {
2212
+ return i(f instanceof Error ? f : new Error(String(f))), [];
2213
+ } finally {
2214
+ r(!1);
2215
+ }
2216
+ },
2217
+ addProjectForUser: async (f) => {
2218
+ for (; !e; )
2219
+ await new Promise((m) => setTimeout(m, 100));
2220
+ r(!0), i(null);
2221
+ try {
2222
+ return await e.addProjectForUser(f);
2223
+ } catch (m) {
2224
+ return i(m instanceof Error ? m : new Error(String(m))), null;
2225
+ } finally {
2226
+ r(!1);
2227
+ }
2228
+ },
2229
+ addFilesToProject: async (f, m) => {
2230
+ for (; !e; )
2231
+ await new Promise((p) => setTimeout(p, 100));
2232
+ r(!0), i(null);
2233
+ try {
2234
+ return await e.addFilesToProject(f, m);
2235
+ } catch (p) {
2236
+ return i(p instanceof Error ? p : new Error(String(p))), null;
2237
+ } finally {
2238
+ r(!1);
2239
+ }
2240
+ },
2241
+ getFilesForProject: async (f) => {
2242
+ for (; !e; )
2243
+ await new Promise((m) => setTimeout(m, 100));
2244
+ r(!0), i(null);
2245
+ try {
2246
+ return await e.getFilesForProject(f);
2247
+ } catch (m) {
2248
+ return i(m instanceof Error ? m : new Error(String(m))), [];
2249
+ } finally {
2250
+ r(!1);
2251
+ }
2252
+ }
2253
+ };
2254
+ }
2255
+ export {
2256
+ Qn as FolioEmbed,
2257
+ Zn as FolioProvider,
2258
+ eo as useFolio
2259
+ };