@pismo/marola 2.1.73 → 2.1.74

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.
@@ -1,526 +0,0 @@
1
- import F, { useRef as tt, createElement as z, createContext as nt, useReducer as et, useEffect as ot, useDebugValue as st, useCallback as it, useContext as ct } from "react";
2
- const w = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
3
- function j(t) {
4
- return "init" in t;
5
- }
6
- function P(t) {
7
- return !!t.write;
8
- }
9
- function H(t) {
10
- return "v" in t || "e" in t;
11
- }
12
- function C(t) {
13
- if ("e" in t)
14
- throw t.e;
15
- if ((w ? "production" : void 0) !== "production" && !("v" in t))
16
- throw new Error("[Bug] atom state is not initialized");
17
- return t.v;
18
- }
19
- const O = /* @__PURE__ */ new WeakMap();
20
- function J(t) {
21
- var n;
22
- return E(t) && !!((n = O.get(t)) != null && n[0]);
23
- }
24
- function rt(t) {
25
- const n = O.get(t);
26
- n != null && n[0] && (n[0] = !1, n[1].forEach((o) => o()));
27
- }
28
- function R(t, n) {
29
- let o = O.get(t);
30
- if (!o) {
31
- o = [!0, /* @__PURE__ */ new Set()], O.set(t, o);
32
- const e = () => {
33
- o[0] = !1;
34
- };
35
- t.then(e, e);
36
- }
37
- o[1].add(n);
38
- }
39
- function E(t) {
40
- return typeof (t == null ? void 0 : t.then) == "function";
41
- }
42
- function $(t, n, o) {
43
- if (!o.p.has(t)) {
44
- o.p.add(t);
45
- const e = () => o.p.delete(t);
46
- n.then(e, e);
47
- }
48
- }
49
- function q(t, n, o) {
50
- var e;
51
- const s = /* @__PURE__ */ new Set();
52
- for (const i of ((e = o.get(t)) == null ? void 0 : e.t) || [])
53
- s.add(i);
54
- for (const i of n.p)
55
- s.add(i);
56
- return s;
57
- }
58
- const ut = (t, n, ...o) => n.read(...o), at = (t, n, ...o) => n.write(...o), lt = (t, n) => {
59
- if (n.INTERNAL_onInit)
60
- return n.INTERNAL_onInit(t);
61
- if (n.unstable_onInit)
62
- return console.warn(
63
- "[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."
64
- ), n.unstable_onInit(t);
65
- }, dt = (t, n, o) => {
66
- var e;
67
- return (e = n.onMount) == null ? void 0 : e.call(n, o);
68
- }, ft = (t, n) => {
69
- var o;
70
- const e = g(t), s = e[0], i = e[6], u = e[9];
71
- if ((w ? "production" : void 0) !== "production" && !n)
72
- throw new Error("Atom is undefined or null");
73
- let f = s.get(n);
74
- return f || (f = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, s.set(n, f), (o = i.i) == null || o.call(i, n), u == null || u(t, n)), f;
75
- }, _t = (t) => {
76
- const n = g(t), o = n[1], e = n[3], s = n[4], i = n[5], u = n[6], f = n[13], d = [], c = (a) => {
77
- try {
78
- a();
79
- } catch (r) {
80
- d.push(r);
81
- }
82
- };
83
- do {
84
- u.f && c(u.f);
85
- const a = /* @__PURE__ */ new Set(), r = a.add.bind(a);
86
- e.forEach((_) => {
87
- var l;
88
- return (l = o.get(_)) == null ? void 0 : l.l.forEach(r);
89
- }), e.clear(), i.forEach(r), i.clear(), s.forEach(r), s.clear(), a.forEach(c), e.size && f(t);
90
- } while (e.size || i.size || s.size);
91
- if (d.length)
92
- throw new AggregateError(d);
93
- }, vt = (t) => {
94
- const n = g(t), o = n[1], e = n[2], s = n[3], i = n[11], u = n[14], f = n[17], d = [], c = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new WeakSet(), r = Array.from(s);
95
- for (; r.length; ) {
96
- const _ = r[r.length - 1], l = i(t, _);
97
- if (a.has(_)) {
98
- r.pop();
99
- continue;
100
- }
101
- if (c.has(_)) {
102
- if (e.get(_) === l.n)
103
- d.push([_, l]);
104
- else if ((w ? "production" : void 0) !== "production" && e.has(_))
105
- throw new Error("[Bug] invalidated atom exists");
106
- a.add(_), r.pop();
107
- continue;
108
- }
109
- c.add(_);
110
- for (const p of q(_, l, o))
111
- c.has(p) || r.push(p);
112
- }
113
- for (let _ = d.length - 1; _ >= 0; --_) {
114
- const [l, p] = d[_];
115
- let b = !1;
116
- for (const m of p.d.keys())
117
- if (m !== l && s.has(m)) {
118
- b = !0;
119
- break;
120
- }
121
- b && (u(t, l), f(t, l)), e.delete(l);
122
- }
123
- }, U = /* @__PURE__ */ new WeakSet(), ht = (t, n) => {
124
- var o, e;
125
- const s = g(t), i = s[1], u = s[2], f = s[3], d = s[6], c = s[7], a = s[11], r = s[12], _ = s[13], l = s[14], p = s[16], b = s[17], m = s[20], v = a(t, n);
126
- if (H(v)) {
127
- if (i.has(n) && u.get(n) !== v.n)
128
- return v;
129
- let h = !1;
130
- for (const [D, B] of v.d)
131
- if (l(t, D).n !== B) {
132
- h = !0;
133
- break;
134
- }
135
- if (!h)
136
- return v;
137
- }
138
- v.d.clear();
139
- let S = !0;
140
- function A() {
141
- i.has(n) && (b(t, n), _(t), r(t));
142
- }
143
- function y(h) {
144
- var D;
145
- if (h === n) {
146
- const V = a(t, h);
147
- if (!H(V))
148
- if (j(h))
149
- m(t, h, h.init);
150
- else
151
- throw new Error("no atom init");
152
- return C(V);
153
- }
154
- const B = l(t, h);
155
- try {
156
- return C(B);
157
- } finally {
158
- v.d.set(h, B.n), J(v.v) && $(n, v.v, B), i.has(n) && ((D = i.get(h)) == null || D.t.add(n)), S || A();
159
- }
160
- }
161
- let I, k;
162
- const M = {
163
- get signal() {
164
- return I || (I = new AbortController()), I.signal;
165
- },
166
- get setSelf() {
167
- return (w ? "production" : void 0) !== "production" && !P(n) && console.warn("setSelf function cannot be used with read-only atom"), !k && P(n) && (k = (...h) => {
168
- if ((w ? "production" : void 0) !== "production" && S && console.warn("setSelf function cannot be called in sync"), !S)
169
- try {
170
- return p(t, n, ...h);
171
- } finally {
172
- _(t), r(t);
173
- }
174
- }), k;
175
- }
176
- }, W = v.n;
177
- try {
178
- (w ? "production" : void 0) !== "production" && U.delete(t);
179
- const h = c(t, n, y, M);
180
- return (w ? "production" : void 0) !== "production" && U.has(t) && console.warn(
181
- "Detected store mutation during atom read. This is not supported."
182
- ), m(t, n, h), E(h) && (R(h, () => I == null ? void 0 : I.abort()), h.then(A, A)), (o = d.r) == null || o.call(d, n), v;
183
- } catch (h) {
184
- return delete v.v, v.e = h, ++v.n, v;
185
- } finally {
186
- S = !1, W !== v.n && u.get(n) === W && (u.set(n, v.n), f.add(n), (e = d.c) == null || e.call(d, n));
187
- }
188
- }, pt = (t, n) => {
189
- const o = g(t), e = o[1], s = o[2], i = o[11], u = [n];
190
- for (; u.length; ) {
191
- const f = u.pop(), d = i(t, f);
192
- for (const c of q(f, d, e)) {
193
- const a = i(t, c);
194
- s.set(c, a.n), u.push(c);
195
- }
196
- }
197
- }, St = (t, n, ...o) => {
198
- const e = g(t), s = e[3], i = e[6], u = e[8], f = e[11], d = e[12], c = e[13], a = e[14], r = e[15], _ = e[16], l = e[17], p = e[20];
199
- let b = !0;
200
- const m = (S) => C(a(t, S)), v = (S, ...A) => {
201
- var y;
202
- const I = f(t, S);
203
- try {
204
- if (S === n) {
205
- if (!j(S))
206
- throw new Error("atom not writable");
207
- (w ? "production" : void 0) !== "production" && U.add(t);
208
- const k = I.n, M = A[0];
209
- p(t, S, M), l(t, S), k !== I.n && (s.add(S), r(t, S), (y = i.c) == null || y.call(i, S));
210
- return;
211
- } else
212
- return _(t, S, ...A);
213
- } finally {
214
- b || (c(t), d(t));
215
- }
216
- };
217
- try {
218
- return u(t, n, m, v, ...o);
219
- } finally {
220
- b = !1;
221
- }
222
- }, gt = (t, n) => {
223
- var o;
224
- const e = g(t), s = e[1], i = e[3], u = e[6], f = e[11], d = e[15], c = e[18], a = e[19], r = f(t, n), _ = s.get(n);
225
- if (_ && !J(r.v)) {
226
- for (const [l, p] of r.d)
227
- if (!_.d.has(l)) {
228
- const b = f(t, l);
229
- c(t, l).t.add(n), _.d.add(l), p !== b.n && (i.add(l), d(t, l), (o = u.c) == null || o.call(u, l));
230
- }
231
- for (const l of _.d)
232
- if (!r.d.has(l)) {
233
- _.d.delete(l);
234
- const p = a(t, l);
235
- p == null || p.t.delete(n);
236
- }
237
- }
238
- }, bt = (t, n) => {
239
- var o;
240
- const e = g(t), s = e[1], i = e[4], u = e[6], f = e[10], d = e[11], c = e[12], a = e[13], r = e[14], _ = e[16], l = e[18], p = d(t, n);
241
- let b = s.get(n);
242
- if (!b) {
243
- r(t, n);
244
- for (const m of p.d.keys())
245
- l(t, m).t.add(n);
246
- if (b = {
247
- l: /* @__PURE__ */ new Set(),
248
- d: new Set(p.d.keys()),
249
- t: /* @__PURE__ */ new Set()
250
- }, s.set(n, b), P(n)) {
251
- const m = () => {
252
- let v = !0;
253
- const S = (...A) => {
254
- try {
255
- return _(t, n, ...A);
256
- } finally {
257
- v || (a(t), c(t));
258
- }
259
- };
260
- try {
261
- const A = f(t, n, S);
262
- A && (b.u = () => {
263
- v = !0;
264
- try {
265
- A();
266
- } finally {
267
- v = !1;
268
- }
269
- });
270
- } finally {
271
- v = !1;
272
- }
273
- };
274
- i.add(m);
275
- }
276
- (o = u.m) == null || o.call(u, n);
277
- }
278
- return b;
279
- }, mt = (t, n) => {
280
- var o, e;
281
- const s = g(t), i = s[1], u = s[5], f = s[6], d = s[11], c = s[19], a = d(t, n);
282
- let r = i.get(n);
283
- if (!r || r.l.size)
284
- return r;
285
- let _ = !1;
286
- for (const l of r.t)
287
- if ((o = i.get(l)) != null && o.d.has(n)) {
288
- _ = !0;
289
- break;
290
- }
291
- if (!_) {
292
- r.u && u.add(r.u), r = void 0, i.delete(n);
293
- for (const l of a.d.keys()) {
294
- const p = c(t, l);
295
- p == null || p.t.delete(n);
296
- }
297
- (e = f.u) == null || e.call(f, n);
298
- return;
299
- }
300
- return r;
301
- }, At = (t, n, o) => {
302
- const e = g(t)[11], s = e(t, n), i = "v" in s, u = s.v;
303
- if (E(o))
304
- for (const f of s.d.keys())
305
- $(
306
- n,
307
- o,
308
- e(t, f)
309
- );
310
- s.v = o, delete s.e, (!i || !Object.is(u, s.v)) && (++s.n, E(u) && rt(u));
311
- }, wt = (t, n) => {
312
- const o = g(t)[14];
313
- return C(o(t, n));
314
- }, It = (t, n, ...o) => {
315
- const e = g(t), s = e[12], i = e[13], u = e[16];
316
- try {
317
- return u(t, n, ...o);
318
- } finally {
319
- i(t), s(t);
320
- }
321
- }, kt = (t, n, o) => {
322
- const e = g(t), s = e[12], i = e[18], u = e[19], d = i(t, n).l;
323
- return d.add(o), s(t), () => {
324
- d.delete(o), u(t, n), s(t);
325
- };
326
- }, Q = /* @__PURE__ */ new WeakMap(), g = (t) => {
327
- const n = Q.get(t);
328
- if ((w ? "production" : void 0) !== "production" && !n)
329
- throw new Error(
330
- "Store must be created by buildStore to read its building blocks"
331
- );
332
- return n;
333
- };
334
- function Bt(...t) {
335
- const n = {
336
- get(e) {
337
- const s = g(n)[21];
338
- return s(n, e);
339
- },
340
- set(e, ...s) {
341
- const i = g(n)[22];
342
- return i(n, e, ...s);
343
- },
344
- sub(e, s) {
345
- const i = g(n)[23];
346
- return i(n, e, s);
347
- }
348
- }, o = [
349
- // store state
350
- /* @__PURE__ */ new WeakMap(),
351
- // atomStateMap
352
- /* @__PURE__ */ new WeakMap(),
353
- // mountedMap
354
- /* @__PURE__ */ new WeakMap(),
355
- // invalidatedAtoms
356
- /* @__PURE__ */ new Set(),
357
- // changedAtoms
358
- /* @__PURE__ */ new Set(),
359
- // mountCallbacks
360
- /* @__PURE__ */ new Set(),
361
- // unmountCallbacks
362
- {},
363
- // storeHooks
364
- // atom interceptors
365
- ut,
366
- at,
367
- lt,
368
- dt,
369
- // building-block functions
370
- ft,
371
- _t,
372
- vt,
373
- ht,
374
- pt,
375
- St,
376
- gt,
377
- bt,
378
- mt,
379
- At,
380
- wt,
381
- It,
382
- kt,
383
- void 0
384
- ].map((e, s) => t[s] || e);
385
- return Q.set(n, Object.freeze(o)), n;
386
- }
387
- const X = {};
388
- let Lt = 0;
389
- function Rt(t, n) {
390
- const o = `atom${++Lt}`, e = {
391
- toString() {
392
- return (X ? "production" : void 0) !== "production" && this.debugLabel ? o + ":" + this.debugLabel : o;
393
- }
394
- };
395
- return e.init = t, e.read = yt, e.write = Dt, e;
396
- }
397
- function yt(t) {
398
- return t(this);
399
- }
400
- function Dt(t, n, o) {
401
- return n(
402
- this,
403
- typeof o == "function" ? o(t(this)) : o
404
- );
405
- }
406
- function Y() {
407
- return Bt();
408
- }
409
- let L;
410
- function Ct() {
411
- return L || (L = Y(), (X ? "production" : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = L), globalThis.__JOTAI_DEFAULT_STORE__ !== L && console.warn(
412
- "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
413
- ))), L;
414
- }
415
- const Ot = {}, G = nt(
416
- void 0
417
- );
418
- function Z(t) {
419
- return ct(G) || Ct();
420
- }
421
- function Ut({
422
- children: t,
423
- store: n
424
- }) {
425
- const o = tt(null);
426
- return n ? z(G.Provider, { value: n }, t) : (o.current === null && (o.current = Y()), z(
427
- G.Provider,
428
- {
429
- // TODO: If this is not a false positive, consider using useState instead of useRef like https://github.com/pmndrs/jotai/pull/2771
430
- // eslint-disable-next-line react-hooks/refs
431
- value: o.current
432
- },
433
- t
434
- ));
435
- }
436
- const T = (t) => typeof (t == null ? void 0 : t.then) == "function", K = (t) => {
437
- t.status || (t.status = "pending", t.then(
438
- (n) => {
439
- t.status = "fulfilled", t.value = n;
440
- },
441
- (n) => {
442
- t.status = "rejected", t.reason = n;
443
- }
444
- ));
445
- }, Et = F.use || // A shim for older React versions
446
- ((t) => {
447
- if (t.status === "pending")
448
- throw t;
449
- if (t.status === "fulfilled")
450
- return t.value;
451
- throw t.status === "rejected" ? t.reason : (K(t), t);
452
- }), N = /* @__PURE__ */ new WeakMap(), x = (t, n) => {
453
- let o = N.get(t);
454
- return o || (o = new Promise((e, s) => {
455
- let i = t;
456
- const u = (c) => (a) => {
457
- i === c && e(a);
458
- }, f = (c) => (a) => {
459
- i === c && s(a);
460
- }, d = () => {
461
- try {
462
- const c = n();
463
- T(c) ? (N.set(c, o), i = c, c.then(u(c), f(c)), R(c, d)) : e(c);
464
- } catch (c) {
465
- s(c);
466
- }
467
- };
468
- t.then(u(t), f(t)), R(t, d);
469
- }), N.set(t, o)), o;
470
- };
471
- function Mt(t, n) {
472
- const { delay: o, unstable_promiseStatus: e = !F.use } = {}, s = Z(), [[i, u, f], d] = et(
473
- (a) => {
474
- const r = s.get(t);
475
- return Object.is(a[0], r) && a[1] === s && a[2] === t ? a : [r, s, t];
476
- },
477
- void 0,
478
- () => [s.get(t), s, t]
479
- );
480
- let c = i;
481
- if ((u !== s || f !== t) && (d(), c = s.get(t)), ot(() => {
482
- const a = s.sub(t, () => {
483
- if (e)
484
- try {
485
- const r = s.get(t);
486
- T(r) && K(
487
- x(r, () => s.get(t))
488
- );
489
- } catch {
490
- }
491
- if (typeof o == "number") {
492
- setTimeout(d, o);
493
- return;
494
- }
495
- d();
496
- });
497
- return d(), a;
498
- }, [s, t, o, e]), st(c), T(c)) {
499
- const a = x(c, () => s.get(t));
500
- return e && K(a), Et(a);
501
- }
502
- return c;
503
- }
504
- function Nt(t, n) {
505
- const o = Z();
506
- return it(
507
- (...s) => {
508
- if ((Ot ? "production" : void 0) !== "production" && !("write" in t))
509
- throw new Error("not writable atom");
510
- return o.set(t, ...s);
511
- },
512
- [o, t]
513
- );
514
- }
515
- function Gt(t, n) {
516
- return [
517
- Mt(t),
518
- // We do wrong type assertion here, which results in throwing an error.
519
- Nt(t)
520
- ];
521
- }
522
- export {
523
- Ut as P,
524
- Rt as a,
525
- Gt as u
526
- };