autoform-svelte 0.1.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/README.md +100 -0
- package/dist/index.css +1 -0
- package/dist/index.js +3305 -0
- package/package.json +62 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3305 @@
|
|
|
1
|
+
import { createEventDispatcher as In, getContext as Ir, setContext as Fr } from "svelte";
|
|
2
|
+
const Fn = "5";
|
|
3
|
+
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Fn);
|
|
4
|
+
const Kn = 1, Ln = 2, Gr = 4, Vn = 8, Un = 16, qn = 1, zn = 4, Bn = 8, Jn = 16, Hn = 1, Gn = 2, te = /* @__PURE__ */ Symbol(), Yr = "http://www.w3.org/1999/xhtml", vr = !1;
|
|
5
|
+
var Zt = Array.isArray, Yn = Array.prototype.indexOf, mt = Array.prototype.includes, gr = Array.from, Wn = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Zn = Object.getOwnPropertyDescriptors, Wr = Object.prototype, Xn = Array.prototype, wr = Object.getPrototypeOf;
|
|
6
|
+
const Re = () => {
|
|
7
|
+
};
|
|
8
|
+
function Qn(e) {
|
|
9
|
+
for (var t = 0; t < e.length; t++)
|
|
10
|
+
e[t]();
|
|
11
|
+
}
|
|
12
|
+
function Zr() {
|
|
13
|
+
var e, t, r = new Promise((i, n) => {
|
|
14
|
+
e = i, t = n;
|
|
15
|
+
});
|
|
16
|
+
return { promise: r, resolve: e, reject: t };
|
|
17
|
+
}
|
|
18
|
+
const ne = 2, Bt = 4, Ar = 8, Xr = 1 << 24, He = 16, je = 32, gt = 64, $n = 128, Ae = 512, ee = 1024, se = 2048, Ie = 4096, me = 8192, Be = 16384, It = 32768, lt = 65536, Kr = 1 << 17, Qr = 1 << 18, Xt = 1 << 19, ei = 1 << 20, qe = 1 << 25, ft = 65536, _r = 1 << 21, Er = 1 << 22, Ze = 1 << 23, vt = /* @__PURE__ */ Symbol("$state"), ti = /* @__PURE__ */ Symbol("legacy props"), ri = /* @__PURE__ */ Symbol(""), it = new class extends Error {
|
|
19
|
+
name = "StaleReactionError";
|
|
20
|
+
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
|
|
21
|
+
}(), ni = (
|
|
22
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
23
|
+
!!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
|
|
24
|
+
);
|
|
25
|
+
function ii() {
|
|
26
|
+
throw new Error("https://svelte.dev/e/async_derived_orphan");
|
|
27
|
+
}
|
|
28
|
+
function ai(e, t, r) {
|
|
29
|
+
throw new Error("https://svelte.dev/e/each_key_duplicate");
|
|
30
|
+
}
|
|
31
|
+
function oi(e) {
|
|
32
|
+
throw new Error("https://svelte.dev/e/effect_in_teardown");
|
|
33
|
+
}
|
|
34
|
+
function si() {
|
|
35
|
+
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
|
|
36
|
+
}
|
|
37
|
+
function li(e) {
|
|
38
|
+
throw new Error("https://svelte.dev/e/effect_orphan");
|
|
39
|
+
}
|
|
40
|
+
function fi() {
|
|
41
|
+
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
42
|
+
}
|
|
43
|
+
function ui(e) {
|
|
44
|
+
throw new Error("https://svelte.dev/e/props_invalid_value");
|
|
45
|
+
}
|
|
46
|
+
function ci() {
|
|
47
|
+
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
|
|
48
|
+
}
|
|
49
|
+
function di() {
|
|
50
|
+
throw new Error("https://svelte.dev/e/state_prototype_fixed");
|
|
51
|
+
}
|
|
52
|
+
function vi() {
|
|
53
|
+
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
|
|
54
|
+
}
|
|
55
|
+
function _i() {
|
|
56
|
+
console.warn("https://svelte.dev/e/select_multiple_invalid_value");
|
|
57
|
+
}
|
|
58
|
+
function $r(e) {
|
|
59
|
+
return e === this.v;
|
|
60
|
+
}
|
|
61
|
+
function hi(e, t) {
|
|
62
|
+
return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
|
|
63
|
+
}
|
|
64
|
+
function en(e) {
|
|
65
|
+
return !hi(e, this.v);
|
|
66
|
+
}
|
|
67
|
+
let pi = !1;
|
|
68
|
+
const mi = [];
|
|
69
|
+
function ct(e, t = !1, r = !1) {
|
|
70
|
+
return qt(e, /* @__PURE__ */ new Map(), "", mi, null, r);
|
|
71
|
+
}
|
|
72
|
+
function qt(e, t, r, i, n = null, a = !1) {
|
|
73
|
+
if (typeof e == "object" && e !== null) {
|
|
74
|
+
var s = t.get(e);
|
|
75
|
+
if (s !== void 0) return s;
|
|
76
|
+
if (e instanceof Map) return (
|
|
77
|
+
/** @type {Snapshot<T>} */
|
|
78
|
+
new Map(e)
|
|
79
|
+
);
|
|
80
|
+
if (e instanceof Set) return (
|
|
81
|
+
/** @type {Snapshot<T>} */
|
|
82
|
+
new Set(e)
|
|
83
|
+
);
|
|
84
|
+
if (Zt(e)) {
|
|
85
|
+
var l = (
|
|
86
|
+
/** @type {Snapshot<any>} */
|
|
87
|
+
Array(e.length)
|
|
88
|
+
);
|
|
89
|
+
t.set(e, l), n !== null && t.set(n, l);
|
|
90
|
+
for (var o = 0; o < e.length; o += 1) {
|
|
91
|
+
var f = e[o];
|
|
92
|
+
o in e && (l[o] = qt(f, t, r, i, null, a));
|
|
93
|
+
}
|
|
94
|
+
return l;
|
|
95
|
+
}
|
|
96
|
+
if (wr(e) === Wr) {
|
|
97
|
+
l = {}, t.set(e, l), n !== null && t.set(n, l);
|
|
98
|
+
for (var u in e)
|
|
99
|
+
l[u] = qt(
|
|
100
|
+
// @ts-expect-error
|
|
101
|
+
e[u],
|
|
102
|
+
t,
|
|
103
|
+
r,
|
|
104
|
+
i,
|
|
105
|
+
null,
|
|
106
|
+
a
|
|
107
|
+
);
|
|
108
|
+
return l;
|
|
109
|
+
}
|
|
110
|
+
if (e instanceof Date)
|
|
111
|
+
return (
|
|
112
|
+
/** @type {Snapshot<T>} */
|
|
113
|
+
structuredClone(e)
|
|
114
|
+
);
|
|
115
|
+
if (typeof /** @type {T & { toJSON?: any } } */
|
|
116
|
+
e.toJSON == "function" && !a)
|
|
117
|
+
return qt(
|
|
118
|
+
/** @type {T & { toJSON(): any } } */
|
|
119
|
+
e.toJSON(),
|
|
120
|
+
t,
|
|
121
|
+
r,
|
|
122
|
+
i,
|
|
123
|
+
// Associate the instance with the toJSON clone
|
|
124
|
+
e
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (e instanceof EventTarget)
|
|
128
|
+
return (
|
|
129
|
+
/** @type {Snapshot<T>} */
|
|
130
|
+
e
|
|
131
|
+
);
|
|
132
|
+
try {
|
|
133
|
+
return (
|
|
134
|
+
/** @type {Snapshot<T>} */
|
|
135
|
+
structuredClone(e)
|
|
136
|
+
);
|
|
137
|
+
} catch {
|
|
138
|
+
return (
|
|
139
|
+
/** @type {Snapshot<T>} */
|
|
140
|
+
e
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
let Fe = null;
|
|
145
|
+
function Jt(e) {
|
|
146
|
+
Fe = e;
|
|
147
|
+
}
|
|
148
|
+
function Ne(e, t = !1, r) {
|
|
149
|
+
Fe = {
|
|
150
|
+
p: Fe,
|
|
151
|
+
i: !1,
|
|
152
|
+
c: null,
|
|
153
|
+
e: null,
|
|
154
|
+
s: e,
|
|
155
|
+
x: null,
|
|
156
|
+
l: null
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function Pe(e) {
|
|
160
|
+
var t = (
|
|
161
|
+
/** @type {ComponentContext} */
|
|
162
|
+
Fe
|
|
163
|
+
), r = t.e;
|
|
164
|
+
if (r !== null) {
|
|
165
|
+
t.e = null;
|
|
166
|
+
for (var i of r)
|
|
167
|
+
_n(i);
|
|
168
|
+
}
|
|
169
|
+
return t.i = !0, Fe = t.p, /** @type {T} */
|
|
170
|
+
{};
|
|
171
|
+
}
|
|
172
|
+
function tn() {
|
|
173
|
+
return !0;
|
|
174
|
+
}
|
|
175
|
+
let dt = [];
|
|
176
|
+
function yi() {
|
|
177
|
+
var e = dt;
|
|
178
|
+
dt = [], Qn(e);
|
|
179
|
+
}
|
|
180
|
+
function Ht(e) {
|
|
181
|
+
if (dt.length === 0) {
|
|
182
|
+
var t = dt;
|
|
183
|
+
queueMicrotask(() => {
|
|
184
|
+
t === dt && yi();
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
dt.push(e);
|
|
188
|
+
}
|
|
189
|
+
function bi(e) {
|
|
190
|
+
var t = K;
|
|
191
|
+
if (t === null)
|
|
192
|
+
return P.f |= Ze, e;
|
|
193
|
+
if ((t.f & It) === 0 && (t.f & Bt) === 0)
|
|
194
|
+
throw e;
|
|
195
|
+
Gt(e, t);
|
|
196
|
+
}
|
|
197
|
+
function Gt(e, t) {
|
|
198
|
+
for (; t !== null; ) {
|
|
199
|
+
if ((t.f & $n) !== 0) {
|
|
200
|
+
if ((t.f & It) === 0)
|
|
201
|
+
throw e;
|
|
202
|
+
try {
|
|
203
|
+
t.b.error(e);
|
|
204
|
+
return;
|
|
205
|
+
} catch (r) {
|
|
206
|
+
e = r;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
t = t.parent;
|
|
210
|
+
}
|
|
211
|
+
throw e;
|
|
212
|
+
}
|
|
213
|
+
const gi = -7169;
|
|
214
|
+
function Q(e, t) {
|
|
215
|
+
e.f = e.f & gi | t;
|
|
216
|
+
}
|
|
217
|
+
function xr(e) {
|
|
218
|
+
(e.f & Ae) !== 0 || e.deps === null ? Q(e, ee) : Q(e, Ie);
|
|
219
|
+
}
|
|
220
|
+
function rn(e) {
|
|
221
|
+
if (e !== null)
|
|
222
|
+
for (const t of e)
|
|
223
|
+
(t.f & ne) === 0 || (t.f & ft) === 0 || (t.f ^= ft, rn(
|
|
224
|
+
/** @type {Derived} */
|
|
225
|
+
t.deps
|
|
226
|
+
));
|
|
227
|
+
}
|
|
228
|
+
function wi(e, t, r) {
|
|
229
|
+
(e.f & se) !== 0 ? t.add(e) : (e.f & Ie) !== 0 && r.add(e), rn(e.deps), Q(e, ee);
|
|
230
|
+
}
|
|
231
|
+
const Lt = /* @__PURE__ */ new Set();
|
|
232
|
+
let B = null, Oe = null, ge = [], Sr = null, hr = !1;
|
|
233
|
+
class Qt {
|
|
234
|
+
committed = !1;
|
|
235
|
+
/**
|
|
236
|
+
* The current values of any sources that are updated in this batch
|
|
237
|
+
* They keys of this map are identical to `this.#previous`
|
|
238
|
+
* @type {Map<Source, any>}
|
|
239
|
+
*/
|
|
240
|
+
current = /* @__PURE__ */ new Map();
|
|
241
|
+
/**
|
|
242
|
+
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
243
|
+
* They keys of this map are identical to `this.#current`
|
|
244
|
+
* @type {Map<Source, any>}
|
|
245
|
+
*/
|
|
246
|
+
previous = /* @__PURE__ */ new Map();
|
|
247
|
+
/**
|
|
248
|
+
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
249
|
+
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
250
|
+
* @type {Set<() => void>}
|
|
251
|
+
*/
|
|
252
|
+
#t = /* @__PURE__ */ new Set();
|
|
253
|
+
/**
|
|
254
|
+
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
255
|
+
* @type {Set<(batch: Batch) => void>}
|
|
256
|
+
*/
|
|
257
|
+
#r = /* @__PURE__ */ new Set();
|
|
258
|
+
/**
|
|
259
|
+
* The number of async effects that are currently in flight
|
|
260
|
+
*/
|
|
261
|
+
#e = 0;
|
|
262
|
+
/**
|
|
263
|
+
* The number of async effects that are currently in flight, _not_ inside a pending boundary
|
|
264
|
+
*/
|
|
265
|
+
#n = 0;
|
|
266
|
+
/**
|
|
267
|
+
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
268
|
+
* TODO replace with Promise.withResolvers once supported widely enough
|
|
269
|
+
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
270
|
+
*/
|
|
271
|
+
#o = null;
|
|
272
|
+
/**
|
|
273
|
+
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
274
|
+
* @type {Set<Effect>}
|
|
275
|
+
*/
|
|
276
|
+
#s = /* @__PURE__ */ new Set();
|
|
277
|
+
/**
|
|
278
|
+
* Deferred effects that are MAYBE_DIRTY
|
|
279
|
+
* @type {Set<Effect>}
|
|
280
|
+
*/
|
|
281
|
+
#i = /* @__PURE__ */ new Set();
|
|
282
|
+
/**
|
|
283
|
+
* A map of branches that still exist, but will be destroyed when this batch
|
|
284
|
+
* is committed — we skip over these during `process`.
|
|
285
|
+
* The value contains child effects that were dirty/maybe_dirty before being reset,
|
|
286
|
+
* so they can be rescheduled if the branch survives.
|
|
287
|
+
* @type {Map<Effect, { d: Effect[], m: Effect[] }>}
|
|
288
|
+
*/
|
|
289
|
+
#a = /* @__PURE__ */ new Map();
|
|
290
|
+
is_fork = !1;
|
|
291
|
+
#l = !1;
|
|
292
|
+
is_deferred() {
|
|
293
|
+
return this.is_fork || this.#n > 0;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Add an effect to the #skipped_branches map and reset its children
|
|
297
|
+
* @param {Effect} effect
|
|
298
|
+
*/
|
|
299
|
+
skip_effect(t) {
|
|
300
|
+
this.#a.has(t) || this.#a.set(t, { d: [], m: [] });
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Remove an effect from the #skipped_branches map and reschedule
|
|
304
|
+
* any tracked dirty/maybe_dirty child effects
|
|
305
|
+
* @param {Effect} effect
|
|
306
|
+
*/
|
|
307
|
+
unskip_effect(t) {
|
|
308
|
+
var r = this.#a.get(t);
|
|
309
|
+
if (r) {
|
|
310
|
+
this.#a.delete(t);
|
|
311
|
+
for (var i of r.d)
|
|
312
|
+
Q(i, se), ze(i);
|
|
313
|
+
for (i of r.m)
|
|
314
|
+
Q(i, Ie), ze(i);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
*
|
|
319
|
+
* @param {Effect[]} root_effects
|
|
320
|
+
*/
|
|
321
|
+
process(t) {
|
|
322
|
+
ge = [], this.apply();
|
|
323
|
+
var r = [], i = [];
|
|
324
|
+
for (const n of t)
|
|
325
|
+
this.#f(n, r, i);
|
|
326
|
+
if (this.is_deferred()) {
|
|
327
|
+
this.#u(i), this.#u(r);
|
|
328
|
+
for (const [n, a] of this.#a)
|
|
329
|
+
on(n, a);
|
|
330
|
+
} else {
|
|
331
|
+
for (const n of this.#t) n();
|
|
332
|
+
this.#t.clear(), this.#e === 0 && this.#c(), B = null, Lr(i), Lr(r), this.#o?.resolve();
|
|
333
|
+
}
|
|
334
|
+
Oe = null;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Traverse the effect tree, executing effects or stashing
|
|
338
|
+
* them for later execution as appropriate
|
|
339
|
+
* @param {Effect} root
|
|
340
|
+
* @param {Effect[]} effects
|
|
341
|
+
* @param {Effect[]} render_effects
|
|
342
|
+
*/
|
|
343
|
+
#f(t, r, i) {
|
|
344
|
+
t.f ^= ee;
|
|
345
|
+
for (var n = t.first, a = null; n !== null; ) {
|
|
346
|
+
var s = n.f, l = (s & (je | gt)) !== 0, o = l && (s & ee) !== 0, f = o || (s & me) !== 0 || this.#a.has(n);
|
|
347
|
+
if (!f && n.fn !== null) {
|
|
348
|
+
l ? n.f ^= ee : a !== null && (s & (Bt | Ar | Xr)) !== 0 ? a.b.defer_effect(n) : (s & Bt) !== 0 ? r.push(n) : Kt(n) && ((s & He) !== 0 && this.#i.add(n), yt(n));
|
|
349
|
+
var u = n.first;
|
|
350
|
+
if (u !== null) {
|
|
351
|
+
n = u;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
for (; n !== null; ) {
|
|
356
|
+
n === a && (a = null);
|
|
357
|
+
var h = n.next;
|
|
358
|
+
if (h !== null) {
|
|
359
|
+
n = h;
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
n = n.parent;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @param {Effect[]} effects
|
|
368
|
+
*/
|
|
369
|
+
#u(t) {
|
|
370
|
+
for (var r = 0; r < t.length; r += 1)
|
|
371
|
+
wi(t[r], this.#s, this.#i);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Associate a change to a given source with the current
|
|
375
|
+
* batch, noting its previous and current values
|
|
376
|
+
* @param {Source} source
|
|
377
|
+
* @param {any} value
|
|
378
|
+
*/
|
|
379
|
+
capture(t, r) {
|
|
380
|
+
r !== te && !this.previous.has(t) && this.previous.set(t, r), (t.f & Ze) === 0 && (this.current.set(t, t.v), Oe?.set(t, t.v));
|
|
381
|
+
}
|
|
382
|
+
activate() {
|
|
383
|
+
B = this, this.apply();
|
|
384
|
+
}
|
|
385
|
+
deactivate() {
|
|
386
|
+
B === this && (B = null, Oe = null);
|
|
387
|
+
}
|
|
388
|
+
flush() {
|
|
389
|
+
if (this.activate(), ge.length > 0) {
|
|
390
|
+
if (Ai(), B !== null && B !== this)
|
|
391
|
+
return;
|
|
392
|
+
} else this.#e === 0 && this.process([]);
|
|
393
|
+
this.deactivate();
|
|
394
|
+
}
|
|
395
|
+
discard() {
|
|
396
|
+
for (const t of this.#r) t(this);
|
|
397
|
+
this.#r.clear();
|
|
398
|
+
}
|
|
399
|
+
#c() {
|
|
400
|
+
if (Lt.size > 1) {
|
|
401
|
+
this.previous.clear();
|
|
402
|
+
var t = Oe, r = !0;
|
|
403
|
+
for (const n of Lt) {
|
|
404
|
+
if (n === this) {
|
|
405
|
+
r = !1;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const a = [];
|
|
409
|
+
for (const [l, o] of this.current) {
|
|
410
|
+
if (n.current.has(l))
|
|
411
|
+
if (r && o !== n.current.get(l))
|
|
412
|
+
n.current.set(l, o);
|
|
413
|
+
else
|
|
414
|
+
continue;
|
|
415
|
+
a.push(l);
|
|
416
|
+
}
|
|
417
|
+
if (a.length === 0)
|
|
418
|
+
continue;
|
|
419
|
+
const s = [...n.current.keys()].filter((l) => !this.current.has(l));
|
|
420
|
+
if (s.length > 0) {
|
|
421
|
+
var i = ge;
|
|
422
|
+
ge = [];
|
|
423
|
+
const l = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
424
|
+
for (const f of a)
|
|
425
|
+
nn(f, s, l, o);
|
|
426
|
+
if (ge.length > 0) {
|
|
427
|
+
B = n, n.apply();
|
|
428
|
+
for (const f of ge)
|
|
429
|
+
n.#f(f, [], []);
|
|
430
|
+
n.deactivate();
|
|
431
|
+
}
|
|
432
|
+
ge = i;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
B = null, Oe = t;
|
|
436
|
+
}
|
|
437
|
+
this.committed = !0, Lt.delete(this);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
*
|
|
441
|
+
* @param {boolean} blocking
|
|
442
|
+
*/
|
|
443
|
+
increment(t) {
|
|
444
|
+
this.#e += 1, t && (this.#n += 1);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
*
|
|
448
|
+
* @param {boolean} blocking
|
|
449
|
+
*/
|
|
450
|
+
decrement(t) {
|
|
451
|
+
this.#e -= 1, t && (this.#n -= 1), !this.#l && (this.#l = !0, Ht(() => {
|
|
452
|
+
this.#l = !1, this.is_deferred() ? ge.length > 0 && this.flush() : this.revive();
|
|
453
|
+
}));
|
|
454
|
+
}
|
|
455
|
+
revive() {
|
|
456
|
+
for (const t of this.#s)
|
|
457
|
+
this.#i.delete(t), Q(t, se), ze(t);
|
|
458
|
+
for (const t of this.#i)
|
|
459
|
+
Q(t, Ie), ze(t);
|
|
460
|
+
this.flush();
|
|
461
|
+
}
|
|
462
|
+
/** @param {() => void} fn */
|
|
463
|
+
oncommit(t) {
|
|
464
|
+
this.#t.add(t);
|
|
465
|
+
}
|
|
466
|
+
/** @param {(batch: Batch) => void} fn */
|
|
467
|
+
ondiscard(t) {
|
|
468
|
+
this.#r.add(t);
|
|
469
|
+
}
|
|
470
|
+
settled() {
|
|
471
|
+
return (this.#o ??= Zr()).promise;
|
|
472
|
+
}
|
|
473
|
+
static ensure() {
|
|
474
|
+
if (B === null) {
|
|
475
|
+
const t = B = new Qt();
|
|
476
|
+
Lt.add(B), Ht(() => {
|
|
477
|
+
B === t && t.flush();
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return B;
|
|
481
|
+
}
|
|
482
|
+
apply() {
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function Ai() {
|
|
486
|
+
hr = !0;
|
|
487
|
+
var e = null;
|
|
488
|
+
try {
|
|
489
|
+
for (var t = 0; ge.length > 0; ) {
|
|
490
|
+
var r = Qt.ensure();
|
|
491
|
+
if (t++ > 1e3) {
|
|
492
|
+
var i, n;
|
|
493
|
+
Ei();
|
|
494
|
+
}
|
|
495
|
+
r.process(ge), Xe.clear();
|
|
496
|
+
}
|
|
497
|
+
} finally {
|
|
498
|
+
ge = [], hr = !1, Sr = null;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function Ei() {
|
|
502
|
+
try {
|
|
503
|
+
fi();
|
|
504
|
+
} catch (e) {
|
|
505
|
+
Gt(e, Sr);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
let Ue = null;
|
|
509
|
+
function Lr(e) {
|
|
510
|
+
var t = e.length;
|
|
511
|
+
if (t !== 0) {
|
|
512
|
+
for (var r = 0; r < t; ) {
|
|
513
|
+
var i = e[r++];
|
|
514
|
+
if ((i.f & (Be | me)) === 0 && Kt(i) && (Ue = /* @__PURE__ */ new Set(), yt(i), i.deps === null && i.first === null && i.nodes === null && i.teardown === null && i.ac === null && pn(i), Ue?.size > 0)) {
|
|
515
|
+
Xe.clear();
|
|
516
|
+
for (const n of Ue) {
|
|
517
|
+
if ((n.f & (Be | me)) !== 0) continue;
|
|
518
|
+
const a = [n];
|
|
519
|
+
let s = n.parent;
|
|
520
|
+
for (; s !== null; )
|
|
521
|
+
Ue.has(s) && (Ue.delete(s), a.push(s)), s = s.parent;
|
|
522
|
+
for (let l = a.length - 1; l >= 0; l--) {
|
|
523
|
+
const o = a[l];
|
|
524
|
+
(o.f & (Be | me)) === 0 && yt(o);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
Ue.clear();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
Ue = null;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function nn(e, t, r, i) {
|
|
534
|
+
if (!r.has(e) && (r.add(e), e.reactions !== null))
|
|
535
|
+
for (const n of e.reactions) {
|
|
536
|
+
const a = n.f;
|
|
537
|
+
(a & ne) !== 0 ? nn(
|
|
538
|
+
/** @type {Derived} */
|
|
539
|
+
n,
|
|
540
|
+
t,
|
|
541
|
+
r,
|
|
542
|
+
i
|
|
543
|
+
) : (a & (Er | He)) !== 0 && (a & se) === 0 && an(n, t, i) && (Q(n, se), ze(
|
|
544
|
+
/** @type {Effect} */
|
|
545
|
+
n
|
|
546
|
+
));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function an(e, t, r) {
|
|
550
|
+
const i = r.get(e);
|
|
551
|
+
if (i !== void 0) return i;
|
|
552
|
+
if (e.deps !== null)
|
|
553
|
+
for (const n of e.deps) {
|
|
554
|
+
if (mt.call(t, n))
|
|
555
|
+
return !0;
|
|
556
|
+
if ((n.f & ne) !== 0 && an(
|
|
557
|
+
/** @type {Derived} */
|
|
558
|
+
n,
|
|
559
|
+
t,
|
|
560
|
+
r
|
|
561
|
+
))
|
|
562
|
+
return r.set(
|
|
563
|
+
/** @type {Derived} */
|
|
564
|
+
n,
|
|
565
|
+
!0
|
|
566
|
+
), !0;
|
|
567
|
+
}
|
|
568
|
+
return r.set(e, !1), !1;
|
|
569
|
+
}
|
|
570
|
+
function ze(e) {
|
|
571
|
+
for (var t = Sr = e; t.parent !== null; ) {
|
|
572
|
+
t = t.parent;
|
|
573
|
+
var r = t.f;
|
|
574
|
+
if (hr && t === K && (r & He) !== 0 && (r & Qr) === 0)
|
|
575
|
+
return;
|
|
576
|
+
if ((r & (gt | je)) !== 0) {
|
|
577
|
+
if ((r & ee) === 0) return;
|
|
578
|
+
t.f ^= ee;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
ge.push(t);
|
|
582
|
+
}
|
|
583
|
+
function on(e, t) {
|
|
584
|
+
if (!((e.f & je) !== 0 && (e.f & ee) !== 0)) {
|
|
585
|
+
(e.f & se) !== 0 ? t.d.push(e) : (e.f & Ie) !== 0 && t.m.push(e), Q(e, ee);
|
|
586
|
+
for (var r = e.first; r !== null; )
|
|
587
|
+
on(r, t), r = r.next;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
function xi(e, t, r, i) {
|
|
591
|
+
const n = $t;
|
|
592
|
+
var a = e.filter((_) => !_.settled);
|
|
593
|
+
if (r.length === 0 && a.length === 0) {
|
|
594
|
+
i(t.map(n));
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
var s = B, l = (
|
|
598
|
+
/** @type {Effect} */
|
|
599
|
+
K
|
|
600
|
+
), o = Si(), f = a.length === 1 ? a[0].promise : a.length > 1 ? Promise.all(a.map((_) => _.promise)) : null;
|
|
601
|
+
function u(_) {
|
|
602
|
+
o();
|
|
603
|
+
try {
|
|
604
|
+
i(_);
|
|
605
|
+
} catch (p) {
|
|
606
|
+
(l.f & Be) === 0 && Gt(p, l);
|
|
607
|
+
}
|
|
608
|
+
s?.deactivate(), pr();
|
|
609
|
+
}
|
|
610
|
+
if (r.length === 0) {
|
|
611
|
+
f.then(() => u(t.map(n)));
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
function h() {
|
|
615
|
+
o(), Promise.all(r.map((_) => /* @__PURE__ */ Oi(_))).then((_) => u([...t.map(n), ..._])).catch((_) => Gt(_, l));
|
|
616
|
+
}
|
|
617
|
+
f ? f.then(h) : h();
|
|
618
|
+
}
|
|
619
|
+
function Si() {
|
|
620
|
+
var e = K, t = P, r = Fe, i = B;
|
|
621
|
+
return function(a = !0) {
|
|
622
|
+
$e(e), Ke(t), Jt(r), a && i?.activate();
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function pr() {
|
|
626
|
+
$e(null), Ke(null), Jt(null);
|
|
627
|
+
}
|
|
628
|
+
// @__NO_SIDE_EFFECTS__
|
|
629
|
+
function $t(e) {
|
|
630
|
+
var t = ne | se, r = P !== null && (P.f & ne) !== 0 ? (
|
|
631
|
+
/** @type {Derived} */
|
|
632
|
+
P
|
|
633
|
+
) : null;
|
|
634
|
+
return K !== null && (K.f |= Xt), {
|
|
635
|
+
ctx: Fe,
|
|
636
|
+
deps: null,
|
|
637
|
+
effects: null,
|
|
638
|
+
equals: $r,
|
|
639
|
+
f: t,
|
|
640
|
+
fn: e,
|
|
641
|
+
reactions: null,
|
|
642
|
+
rv: 0,
|
|
643
|
+
v: (
|
|
644
|
+
/** @type {V} */
|
|
645
|
+
te
|
|
646
|
+
),
|
|
647
|
+
wv: 0,
|
|
648
|
+
parent: r ?? K,
|
|
649
|
+
ac: null
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
// @__NO_SIDE_EFFECTS__
|
|
653
|
+
function Oi(e, t, r) {
|
|
654
|
+
let i = (
|
|
655
|
+
/** @type {Effect | null} */
|
|
656
|
+
K
|
|
657
|
+
);
|
|
658
|
+
i === null && ii();
|
|
659
|
+
var n = (
|
|
660
|
+
/** @type {Boundary} */
|
|
661
|
+
i.b
|
|
662
|
+
), a = (
|
|
663
|
+
/** @type {Promise<V>} */
|
|
664
|
+
/** @type {unknown} */
|
|
665
|
+
void 0
|
|
666
|
+
), s = jt(
|
|
667
|
+
/** @type {V} */
|
|
668
|
+
te
|
|
669
|
+
), l = !P, o = /* @__PURE__ */ new Map();
|
|
670
|
+
return Vi(() => {
|
|
671
|
+
var f = Zr();
|
|
672
|
+
a = f.promise;
|
|
673
|
+
try {
|
|
674
|
+
Promise.resolve(e()).then(f.resolve, f.reject).then(() => {
|
|
675
|
+
u === B && u.committed && u.deactivate(), pr();
|
|
676
|
+
});
|
|
677
|
+
} catch (p) {
|
|
678
|
+
f.reject(p), pr();
|
|
679
|
+
}
|
|
680
|
+
var u = (
|
|
681
|
+
/** @type {Batch} */
|
|
682
|
+
B
|
|
683
|
+
);
|
|
684
|
+
if (l) {
|
|
685
|
+
var h = n.is_rendered();
|
|
686
|
+
n.update_pending_count(1), u.increment(h), o.get(u)?.reject(it), o.delete(u), o.set(u, f);
|
|
687
|
+
}
|
|
688
|
+
const _ = (p, m = void 0) => {
|
|
689
|
+
if (u.activate(), m)
|
|
690
|
+
m !== it && (s.f |= Ze, Nt(s, m));
|
|
691
|
+
else {
|
|
692
|
+
(s.f & Ze) !== 0 && (s.f ^= Ze), Nt(s, p);
|
|
693
|
+
for (const [v, d] of o) {
|
|
694
|
+
if (o.delete(v), v === u) break;
|
|
695
|
+
d.reject(it);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
l && (n.update_pending_count(-1), u.decrement(h));
|
|
699
|
+
};
|
|
700
|
+
f.promise.then(_, (p) => _(null, p || "unknown"));
|
|
701
|
+
}), Tr(() => {
|
|
702
|
+
for (const f of o.values())
|
|
703
|
+
f.reject(it);
|
|
704
|
+
}), new Promise((f) => {
|
|
705
|
+
function u(h) {
|
|
706
|
+
function _() {
|
|
707
|
+
h === a ? f(s) : u(a);
|
|
708
|
+
}
|
|
709
|
+
h.then(_, _);
|
|
710
|
+
}
|
|
711
|
+
u(a);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
// @__NO_SIDE_EFFECTS__
|
|
715
|
+
function S(e) {
|
|
716
|
+
const t = /* @__PURE__ */ $t(e);
|
|
717
|
+
return bn(t), t;
|
|
718
|
+
}
|
|
719
|
+
// @__NO_SIDE_EFFECTS__
|
|
720
|
+
function sn(e) {
|
|
721
|
+
const t = /* @__PURE__ */ $t(e);
|
|
722
|
+
return t.equals = en, t;
|
|
723
|
+
}
|
|
724
|
+
function ki(e) {
|
|
725
|
+
var t = e.effects;
|
|
726
|
+
if (t !== null) {
|
|
727
|
+
e.effects = null;
|
|
728
|
+
for (var r = 0; r < t.length; r += 1)
|
|
729
|
+
Je(
|
|
730
|
+
/** @type {Effect} */
|
|
731
|
+
t[r]
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function Ti(e) {
|
|
736
|
+
for (var t = e.parent; t !== null; ) {
|
|
737
|
+
if ((t.f & ne) === 0)
|
|
738
|
+
return (t.f & Be) === 0 ? (
|
|
739
|
+
/** @type {Effect} */
|
|
740
|
+
t
|
|
741
|
+
) : null;
|
|
742
|
+
t = t.parent;
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
function Or(e) {
|
|
747
|
+
var t, r = K;
|
|
748
|
+
$e(Ti(e));
|
|
749
|
+
try {
|
|
750
|
+
e.f &= ~ft, ki(e), t = En(e);
|
|
751
|
+
} finally {
|
|
752
|
+
$e(r);
|
|
753
|
+
}
|
|
754
|
+
return t;
|
|
755
|
+
}
|
|
756
|
+
function ln(e) {
|
|
757
|
+
var t = Or(e);
|
|
758
|
+
if (!e.equals(t) && (e.wv = wn(), (!B?.is_fork || e.deps === null) && (e.v = t, e.deps === null))) {
|
|
759
|
+
Q(e, ee);
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
Qe || (Oe !== null ? (vn() || B?.is_fork) && Oe.set(e, t) : xr(e));
|
|
763
|
+
}
|
|
764
|
+
function ji(e) {
|
|
765
|
+
if (e.effects !== null)
|
|
766
|
+
for (const t of e.effects)
|
|
767
|
+
(t.teardown || t.ac) && (t.teardown?.(), t.ac?.abort(it), t.teardown = Re, t.ac = null, Dt(t, 0), jr(t));
|
|
768
|
+
}
|
|
769
|
+
function fn(e) {
|
|
770
|
+
if (e.effects !== null)
|
|
771
|
+
for (const t of e.effects)
|
|
772
|
+
t.teardown && yt(t);
|
|
773
|
+
}
|
|
774
|
+
let mr = /* @__PURE__ */ new Set();
|
|
775
|
+
const Xe = /* @__PURE__ */ new Map();
|
|
776
|
+
let un = !1;
|
|
777
|
+
function jt(e, t) {
|
|
778
|
+
var r = {
|
|
779
|
+
f: 0,
|
|
780
|
+
// TODO ideally we could skip this altogether, but it causes type errors
|
|
781
|
+
v: e,
|
|
782
|
+
reactions: null,
|
|
783
|
+
equals: $r,
|
|
784
|
+
rv: 0,
|
|
785
|
+
wv: 0
|
|
786
|
+
};
|
|
787
|
+
return r;
|
|
788
|
+
}
|
|
789
|
+
// @__NO_SIDE_EFFECTS__
|
|
790
|
+
function we(e, t) {
|
|
791
|
+
const r = jt(e);
|
|
792
|
+
return bn(r), r;
|
|
793
|
+
}
|
|
794
|
+
// @__NO_SIDE_EFFECTS__
|
|
795
|
+
function Ni(e, t = !1, r = !0) {
|
|
796
|
+
const i = jt(e);
|
|
797
|
+
return t || (i.equals = en), i;
|
|
798
|
+
}
|
|
799
|
+
function X(e, t, r = !1) {
|
|
800
|
+
P !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
801
|
+
// to ensure we error if state is set inside an inspect effect
|
|
802
|
+
(!Te || (P.f & Kr) !== 0) && tn() && (P.f & (ne | He | Er | Kr)) !== 0 && (Ee === null || !mt.call(Ee, e)) && vi();
|
|
803
|
+
let i = r ? ke(t) : t;
|
|
804
|
+
return Nt(e, i);
|
|
805
|
+
}
|
|
806
|
+
function Nt(e, t) {
|
|
807
|
+
if (!e.equals(t)) {
|
|
808
|
+
var r = e.v;
|
|
809
|
+
Qe ? Xe.set(e, t) : Xe.set(e, r), e.v = t;
|
|
810
|
+
var i = Qt.ensure();
|
|
811
|
+
if (i.capture(e, r), (e.f & ne) !== 0) {
|
|
812
|
+
const n = (
|
|
813
|
+
/** @type {Derived} */
|
|
814
|
+
e
|
|
815
|
+
);
|
|
816
|
+
(e.f & se) !== 0 && Or(n), xr(n);
|
|
817
|
+
}
|
|
818
|
+
e.wv = wn(), cn(e, se), K !== null && (K.f & ee) !== 0 && (K.f & (je | gt)) === 0 && (be === null ? Bi([e]) : be.push(e)), !i.is_fork && mr.size > 0 && !un && Pi();
|
|
819
|
+
}
|
|
820
|
+
return t;
|
|
821
|
+
}
|
|
822
|
+
function Pi() {
|
|
823
|
+
un = !1;
|
|
824
|
+
for (const e of mr)
|
|
825
|
+
(e.f & ee) !== 0 && Q(e, Ie), Kt(e) && yt(e);
|
|
826
|
+
mr.clear();
|
|
827
|
+
}
|
|
828
|
+
function fr(e) {
|
|
829
|
+
X(e, e.v + 1);
|
|
830
|
+
}
|
|
831
|
+
function cn(e, t) {
|
|
832
|
+
var r = e.reactions;
|
|
833
|
+
if (r !== null)
|
|
834
|
+
for (var i = r.length, n = 0; n < i; n++) {
|
|
835
|
+
var a = r[n], s = a.f, l = (s & se) === 0;
|
|
836
|
+
if (l && Q(a, t), (s & ne) !== 0) {
|
|
837
|
+
var o = (
|
|
838
|
+
/** @type {Derived} */
|
|
839
|
+
a
|
|
840
|
+
);
|
|
841
|
+
Oe?.delete(o), (s & ft) === 0 && (s & Ae && (a.f |= ft), cn(o, Ie));
|
|
842
|
+
} else l && ((s & He) !== 0 && Ue !== null && Ue.add(
|
|
843
|
+
/** @type {Effect} */
|
|
844
|
+
a
|
|
845
|
+
), ze(
|
|
846
|
+
/** @type {Effect} */
|
|
847
|
+
a
|
|
848
|
+
));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function ke(e) {
|
|
852
|
+
if (typeof e != "object" || e === null || vt in e)
|
|
853
|
+
return e;
|
|
854
|
+
const t = wr(e);
|
|
855
|
+
if (t !== Wr && t !== Xn)
|
|
856
|
+
return e;
|
|
857
|
+
var r = /* @__PURE__ */ new Map(), i = Zt(e), n = /* @__PURE__ */ we(0), a = ot, s = (l) => {
|
|
858
|
+
if (ot === a)
|
|
859
|
+
return l();
|
|
860
|
+
var o = P, f = ot;
|
|
861
|
+
Ke(null), qr(a);
|
|
862
|
+
var u = l();
|
|
863
|
+
return Ke(o), qr(f), u;
|
|
864
|
+
};
|
|
865
|
+
return i && r.set("length", /* @__PURE__ */ we(
|
|
866
|
+
/** @type {any[]} */
|
|
867
|
+
e.length
|
|
868
|
+
)), new Proxy(
|
|
869
|
+
/** @type {any} */
|
|
870
|
+
e,
|
|
871
|
+
{
|
|
872
|
+
defineProperty(l, o, f) {
|
|
873
|
+
(!("value" in f) || f.configurable === !1 || f.enumerable === !1 || f.writable === !1) && ci();
|
|
874
|
+
var u = r.get(o);
|
|
875
|
+
return u === void 0 ? s(() => {
|
|
876
|
+
var h = /* @__PURE__ */ we(f.value);
|
|
877
|
+
return r.set(o, h), h;
|
|
878
|
+
}) : X(u, f.value, !0), !0;
|
|
879
|
+
},
|
|
880
|
+
deleteProperty(l, o) {
|
|
881
|
+
var f = r.get(o);
|
|
882
|
+
if (f === void 0) {
|
|
883
|
+
if (o in l) {
|
|
884
|
+
const u = s(() => /* @__PURE__ */ we(te));
|
|
885
|
+
r.set(o, u), fr(n);
|
|
886
|
+
}
|
|
887
|
+
} else
|
|
888
|
+
X(f, te), fr(n);
|
|
889
|
+
return !0;
|
|
890
|
+
},
|
|
891
|
+
get(l, o, f) {
|
|
892
|
+
if (o === vt)
|
|
893
|
+
return e;
|
|
894
|
+
var u = r.get(o), h = o in l;
|
|
895
|
+
if (u === void 0 && (!h || Ut(l, o)?.writable) && (u = s(() => {
|
|
896
|
+
var p = ke(h ? l[o] : te), m = /* @__PURE__ */ we(p);
|
|
897
|
+
return m;
|
|
898
|
+
}), r.set(o, u)), u !== void 0) {
|
|
899
|
+
var _ = c(u);
|
|
900
|
+
return _ === te ? void 0 : _;
|
|
901
|
+
}
|
|
902
|
+
return Reflect.get(l, o, f);
|
|
903
|
+
},
|
|
904
|
+
getOwnPropertyDescriptor(l, o) {
|
|
905
|
+
var f = Reflect.getOwnPropertyDescriptor(l, o);
|
|
906
|
+
if (f && "value" in f) {
|
|
907
|
+
var u = r.get(o);
|
|
908
|
+
u && (f.value = c(u));
|
|
909
|
+
} else if (f === void 0) {
|
|
910
|
+
var h = r.get(o), _ = h?.v;
|
|
911
|
+
if (h !== void 0 && _ !== te)
|
|
912
|
+
return {
|
|
913
|
+
enumerable: !0,
|
|
914
|
+
configurable: !0,
|
|
915
|
+
value: _,
|
|
916
|
+
writable: !0
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
return f;
|
|
920
|
+
},
|
|
921
|
+
has(l, o) {
|
|
922
|
+
if (o === vt)
|
|
923
|
+
return !0;
|
|
924
|
+
var f = r.get(o), u = f !== void 0 && f.v !== te || Reflect.has(l, o);
|
|
925
|
+
if (f !== void 0 || K !== null && (!u || Ut(l, o)?.writable)) {
|
|
926
|
+
f === void 0 && (f = s(() => {
|
|
927
|
+
var _ = u ? ke(l[o]) : te, p = /* @__PURE__ */ we(_);
|
|
928
|
+
return p;
|
|
929
|
+
}), r.set(o, f));
|
|
930
|
+
var h = c(f);
|
|
931
|
+
if (h === te)
|
|
932
|
+
return !1;
|
|
933
|
+
}
|
|
934
|
+
return u;
|
|
935
|
+
},
|
|
936
|
+
set(l, o, f, u) {
|
|
937
|
+
var h = r.get(o), _ = o in l;
|
|
938
|
+
if (i && o === "length")
|
|
939
|
+
for (var p = f; p < /** @type {Source<number>} */
|
|
940
|
+
h.v; p += 1) {
|
|
941
|
+
var m = r.get(p + "");
|
|
942
|
+
m !== void 0 ? X(m, te) : p in l && (m = s(() => /* @__PURE__ */ we(te)), r.set(p + "", m));
|
|
943
|
+
}
|
|
944
|
+
if (h === void 0)
|
|
945
|
+
(!_ || Ut(l, o)?.writable) && (h = s(() => /* @__PURE__ */ we(void 0)), X(h, ke(f)), r.set(o, h));
|
|
946
|
+
else {
|
|
947
|
+
_ = h.v !== te;
|
|
948
|
+
var v = s(() => ke(f));
|
|
949
|
+
X(h, v);
|
|
950
|
+
}
|
|
951
|
+
var d = Reflect.getOwnPropertyDescriptor(l, o);
|
|
952
|
+
if (d?.set && d.set.call(u, f), !_) {
|
|
953
|
+
if (i && typeof o == "string") {
|
|
954
|
+
var w = (
|
|
955
|
+
/** @type {Source<number>} */
|
|
956
|
+
r.get("length")
|
|
957
|
+
), x = Number(o);
|
|
958
|
+
Number.isInteger(x) && x >= w.v && X(w, x + 1);
|
|
959
|
+
}
|
|
960
|
+
fr(n);
|
|
961
|
+
}
|
|
962
|
+
return !0;
|
|
963
|
+
},
|
|
964
|
+
ownKeys(l) {
|
|
965
|
+
c(n);
|
|
966
|
+
var o = Reflect.ownKeys(l).filter((h) => {
|
|
967
|
+
var _ = r.get(h);
|
|
968
|
+
return _ === void 0 || _.v !== te;
|
|
969
|
+
});
|
|
970
|
+
for (var [f, u] of r)
|
|
971
|
+
u.v !== te && !(f in l) && o.push(f);
|
|
972
|
+
return o;
|
|
973
|
+
},
|
|
974
|
+
setPrototypeOf() {
|
|
975
|
+
di();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
function Vr(e) {
|
|
981
|
+
try {
|
|
982
|
+
if (e !== null && typeof e == "object" && vt in e)
|
|
983
|
+
return e[vt];
|
|
984
|
+
} catch {
|
|
985
|
+
}
|
|
986
|
+
return e;
|
|
987
|
+
}
|
|
988
|
+
function Di(e, t) {
|
|
989
|
+
return Object.is(Vr(e), Vr(t));
|
|
990
|
+
}
|
|
991
|
+
var Mi, Ci, Ri;
|
|
992
|
+
function _t(e = "") {
|
|
993
|
+
return document.createTextNode(e);
|
|
994
|
+
}
|
|
995
|
+
// @__NO_SIDE_EFFECTS__
|
|
996
|
+
function Yt(e) {
|
|
997
|
+
return (
|
|
998
|
+
/** @type {TemplateNode | null} */
|
|
999
|
+
Ci.call(e)
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
// @__NO_SIDE_EFFECTS__
|
|
1003
|
+
function Ft(e) {
|
|
1004
|
+
return (
|
|
1005
|
+
/** @type {TemplateNode | null} */
|
|
1006
|
+
Ri.call(e)
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
1009
|
+
function T(e, t) {
|
|
1010
|
+
return /* @__PURE__ */ Yt(e);
|
|
1011
|
+
}
|
|
1012
|
+
function C(e, t = !1) {
|
|
1013
|
+
{
|
|
1014
|
+
var r = /* @__PURE__ */ Yt(e);
|
|
1015
|
+
return r instanceof Comment && r.data === "" ? /* @__PURE__ */ Ft(r) : r;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
function M(e, t = 1, r = !1) {
|
|
1019
|
+
let i = e;
|
|
1020
|
+
for (; t--; )
|
|
1021
|
+
i = /** @type {TemplateNode} */
|
|
1022
|
+
/* @__PURE__ */ Ft(i);
|
|
1023
|
+
return i;
|
|
1024
|
+
}
|
|
1025
|
+
function Ii(e) {
|
|
1026
|
+
e.textContent = "";
|
|
1027
|
+
}
|
|
1028
|
+
function dn() {
|
|
1029
|
+
return !1;
|
|
1030
|
+
}
|
|
1031
|
+
function Fi(e, t, r) {
|
|
1032
|
+
return (
|
|
1033
|
+
/** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
|
|
1034
|
+
document.createElementNS(Yr, e, void 0)
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
function kr(e) {
|
|
1038
|
+
var t = P, r = K;
|
|
1039
|
+
Ke(null), $e(null);
|
|
1040
|
+
try {
|
|
1041
|
+
return e();
|
|
1042
|
+
} finally {
|
|
1043
|
+
Ke(t), $e(r);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function Ki(e) {
|
|
1047
|
+
K === null && (P === null && li(), si()), Qe && oi();
|
|
1048
|
+
}
|
|
1049
|
+
function Li(e, t) {
|
|
1050
|
+
var r = t.last;
|
|
1051
|
+
r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e);
|
|
1052
|
+
}
|
|
1053
|
+
function wt(e, t, r) {
|
|
1054
|
+
var i = K;
|
|
1055
|
+
i !== null && (i.f & me) !== 0 && (e |= me);
|
|
1056
|
+
var n = {
|
|
1057
|
+
ctx: Fe,
|
|
1058
|
+
deps: null,
|
|
1059
|
+
nodes: null,
|
|
1060
|
+
f: e | se | Ae,
|
|
1061
|
+
first: null,
|
|
1062
|
+
fn: t,
|
|
1063
|
+
last: null,
|
|
1064
|
+
next: null,
|
|
1065
|
+
parent: i,
|
|
1066
|
+
b: i && i.b,
|
|
1067
|
+
prev: null,
|
|
1068
|
+
teardown: null,
|
|
1069
|
+
wv: 0,
|
|
1070
|
+
ac: null
|
|
1071
|
+
};
|
|
1072
|
+
if (r)
|
|
1073
|
+
try {
|
|
1074
|
+
yt(n);
|
|
1075
|
+
} catch (l) {
|
|
1076
|
+
throw Je(n), l;
|
|
1077
|
+
}
|
|
1078
|
+
else t !== null && ze(n);
|
|
1079
|
+
var a = n;
|
|
1080
|
+
if (r && a.deps === null && a.teardown === null && a.nodes === null && a.first === a.last && // either `null`, or a singular child
|
|
1081
|
+
(a.f & Xt) === 0 && (a = a.first, (e & He) !== 0 && (e & lt) !== 0 && a !== null && (a.f |= lt)), a !== null && (a.parent = i, i !== null && Li(a, i), P !== null && (P.f & ne) !== 0 && (e & gt) === 0)) {
|
|
1082
|
+
var s = (
|
|
1083
|
+
/** @type {Derived} */
|
|
1084
|
+
P
|
|
1085
|
+
);
|
|
1086
|
+
(s.effects ??= []).push(a);
|
|
1087
|
+
}
|
|
1088
|
+
return n;
|
|
1089
|
+
}
|
|
1090
|
+
function vn() {
|
|
1091
|
+
return P !== null && !Te;
|
|
1092
|
+
}
|
|
1093
|
+
function Tr(e) {
|
|
1094
|
+
const t = wt(Ar, null, !1);
|
|
1095
|
+
return Q(t, ee), t.teardown = e, t;
|
|
1096
|
+
}
|
|
1097
|
+
function ur(e) {
|
|
1098
|
+
Ki();
|
|
1099
|
+
var t = (
|
|
1100
|
+
/** @type {Effect} */
|
|
1101
|
+
K.f
|
|
1102
|
+
), r = !P && (t & je) !== 0 && (t & It) === 0;
|
|
1103
|
+
if (r) {
|
|
1104
|
+
var i = (
|
|
1105
|
+
/** @type {ComponentContext} */
|
|
1106
|
+
Fe
|
|
1107
|
+
);
|
|
1108
|
+
(i.e ??= []).push(e);
|
|
1109
|
+
} else
|
|
1110
|
+
return _n(e);
|
|
1111
|
+
}
|
|
1112
|
+
function _n(e) {
|
|
1113
|
+
return wt(Bt | ei, e, !1);
|
|
1114
|
+
}
|
|
1115
|
+
function Vi(e) {
|
|
1116
|
+
return wt(Er | Xt, e, !0);
|
|
1117
|
+
}
|
|
1118
|
+
function R(e, t = [], r = [], i = []) {
|
|
1119
|
+
xi(i, t, r, (n) => {
|
|
1120
|
+
wt(Ar, () => e(...n.map(c)), !0);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
function er(e, t = 0) {
|
|
1124
|
+
var r = wt(He | t, e, !0);
|
|
1125
|
+
return r;
|
|
1126
|
+
}
|
|
1127
|
+
function Pt(e) {
|
|
1128
|
+
return wt(je | Xt, e, !0);
|
|
1129
|
+
}
|
|
1130
|
+
function hn(e) {
|
|
1131
|
+
var t = e.teardown;
|
|
1132
|
+
if (t !== null) {
|
|
1133
|
+
const r = Qe, i = P;
|
|
1134
|
+
Ur(!0), Ke(null);
|
|
1135
|
+
try {
|
|
1136
|
+
t.call(null);
|
|
1137
|
+
} finally {
|
|
1138
|
+
Ur(r), Ke(i);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
function jr(e, t = !1) {
|
|
1143
|
+
var r = e.first;
|
|
1144
|
+
for (e.first = e.last = null; r !== null; ) {
|
|
1145
|
+
const n = r.ac;
|
|
1146
|
+
n !== null && kr(() => {
|
|
1147
|
+
n.abort(it);
|
|
1148
|
+
});
|
|
1149
|
+
var i = r.next;
|
|
1150
|
+
(r.f & gt) !== 0 ? r.parent = null : Je(r, t), r = i;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
function Ui(e) {
|
|
1154
|
+
for (var t = e.first; t !== null; ) {
|
|
1155
|
+
var r = t.next;
|
|
1156
|
+
(t.f & je) === 0 && Je(t), t = r;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function Je(e, t = !0) {
|
|
1160
|
+
var r = !1;
|
|
1161
|
+
(t || (e.f & Qr) !== 0) && e.nodes !== null && e.nodes.end !== null && (qi(
|
|
1162
|
+
e.nodes.start,
|
|
1163
|
+
/** @type {TemplateNode} */
|
|
1164
|
+
e.nodes.end
|
|
1165
|
+
), r = !0), jr(e, t && !r), Dt(e, 0), Q(e, Be);
|
|
1166
|
+
var i = e.nodes && e.nodes.t;
|
|
1167
|
+
if (i !== null)
|
|
1168
|
+
for (const a of i)
|
|
1169
|
+
a.stop();
|
|
1170
|
+
hn(e);
|
|
1171
|
+
var n = e.parent;
|
|
1172
|
+
n !== null && n.first !== null && pn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
|
|
1173
|
+
}
|
|
1174
|
+
function qi(e, t) {
|
|
1175
|
+
for (; e !== null; ) {
|
|
1176
|
+
var r = e === t ? null : /* @__PURE__ */ Ft(e);
|
|
1177
|
+
e.remove(), e = r;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function pn(e) {
|
|
1181
|
+
var t = e.parent, r = e.prev, i = e.next;
|
|
1182
|
+
r !== null && (r.next = i), i !== null && (i.prev = r), t !== null && (t.first === e && (t.first = i), t.last === e && (t.last = r));
|
|
1183
|
+
}
|
|
1184
|
+
function Nr(e, t, r = !0) {
|
|
1185
|
+
var i = [];
|
|
1186
|
+
mn(e, i, !0);
|
|
1187
|
+
var n = () => {
|
|
1188
|
+
r && Je(e), t && t();
|
|
1189
|
+
}, a = i.length;
|
|
1190
|
+
if (a > 0) {
|
|
1191
|
+
var s = () => --a || n();
|
|
1192
|
+
for (var l of i)
|
|
1193
|
+
l.out(s);
|
|
1194
|
+
} else
|
|
1195
|
+
n();
|
|
1196
|
+
}
|
|
1197
|
+
function mn(e, t, r) {
|
|
1198
|
+
if ((e.f & me) === 0) {
|
|
1199
|
+
e.f ^= me;
|
|
1200
|
+
var i = e.nodes && e.nodes.t;
|
|
1201
|
+
if (i !== null)
|
|
1202
|
+
for (const l of i)
|
|
1203
|
+
(l.is_global || r) && t.push(l);
|
|
1204
|
+
for (var n = e.first; n !== null; ) {
|
|
1205
|
+
var a = n.next, s = (n.f & lt) !== 0 || // If this is a branch effect without a block effect parent,
|
|
1206
|
+
// it means the parent block effect was pruned. In that case,
|
|
1207
|
+
// transparency information was transferred to the branch effect.
|
|
1208
|
+
(n.f & je) !== 0 && (e.f & He) !== 0;
|
|
1209
|
+
mn(n, t, s ? r : !1), n = a;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
function Pr(e) {
|
|
1214
|
+
yn(e, !0);
|
|
1215
|
+
}
|
|
1216
|
+
function yn(e, t) {
|
|
1217
|
+
if ((e.f & me) !== 0) {
|
|
1218
|
+
e.f ^= me, (e.f & ee) === 0 && (Q(e, se), ze(e));
|
|
1219
|
+
for (var r = e.first; r !== null; ) {
|
|
1220
|
+
var i = r.next, n = (r.f & lt) !== 0 || (r.f & je) !== 0;
|
|
1221
|
+
yn(r, n ? t : !1), r = i;
|
|
1222
|
+
}
|
|
1223
|
+
var a = e.nodes && e.nodes.t;
|
|
1224
|
+
if (a !== null)
|
|
1225
|
+
for (const s of a)
|
|
1226
|
+
(s.is_global || t) && s.in();
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
function zi(e, t) {
|
|
1230
|
+
if (e.nodes)
|
|
1231
|
+
for (var r = e.nodes.start, i = e.nodes.end; r !== null; ) {
|
|
1232
|
+
var n = r === i ? null : /* @__PURE__ */ Ft(r);
|
|
1233
|
+
t.append(r), r = n;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
let zt = !1, Qe = !1;
|
|
1237
|
+
function Ur(e) {
|
|
1238
|
+
Qe = e;
|
|
1239
|
+
}
|
|
1240
|
+
let P = null, Te = !1;
|
|
1241
|
+
function Ke(e) {
|
|
1242
|
+
P = e;
|
|
1243
|
+
}
|
|
1244
|
+
let K = null;
|
|
1245
|
+
function $e(e) {
|
|
1246
|
+
K = e;
|
|
1247
|
+
}
|
|
1248
|
+
let Ee = null;
|
|
1249
|
+
function bn(e) {
|
|
1250
|
+
P !== null && (Ee === null ? Ee = [e] : Ee.push(e));
|
|
1251
|
+
}
|
|
1252
|
+
let ve = null, pe = 0, be = null;
|
|
1253
|
+
function Bi(e) {
|
|
1254
|
+
be = e;
|
|
1255
|
+
}
|
|
1256
|
+
let gn = 1, at = 0, ot = at;
|
|
1257
|
+
function qr(e) {
|
|
1258
|
+
ot = e;
|
|
1259
|
+
}
|
|
1260
|
+
function wn() {
|
|
1261
|
+
return ++gn;
|
|
1262
|
+
}
|
|
1263
|
+
function Kt(e) {
|
|
1264
|
+
var t = e.f;
|
|
1265
|
+
if ((t & se) !== 0)
|
|
1266
|
+
return !0;
|
|
1267
|
+
if (t & ne && (e.f &= ~ft), (t & Ie) !== 0) {
|
|
1268
|
+
for (var r = (
|
|
1269
|
+
/** @type {Value[]} */
|
|
1270
|
+
e.deps
|
|
1271
|
+
), i = r.length, n = 0; n < i; n++) {
|
|
1272
|
+
var a = r[n];
|
|
1273
|
+
if (Kt(
|
|
1274
|
+
/** @type {Derived} */
|
|
1275
|
+
a
|
|
1276
|
+
) && ln(
|
|
1277
|
+
/** @type {Derived} */
|
|
1278
|
+
a
|
|
1279
|
+
), a.wv > e.wv)
|
|
1280
|
+
return !0;
|
|
1281
|
+
}
|
|
1282
|
+
(t & Ae) !== 0 && // During time traveling we don't want to reset the status so that
|
|
1283
|
+
// traversal of the graph in the other batches still happens
|
|
1284
|
+
Oe === null && Q(e, ee);
|
|
1285
|
+
}
|
|
1286
|
+
return !1;
|
|
1287
|
+
}
|
|
1288
|
+
function An(e, t, r = !0) {
|
|
1289
|
+
var i = e.reactions;
|
|
1290
|
+
if (i !== null && !(Ee !== null && mt.call(Ee, e)))
|
|
1291
|
+
for (var n = 0; n < i.length; n++) {
|
|
1292
|
+
var a = i[n];
|
|
1293
|
+
(a.f & ne) !== 0 ? An(
|
|
1294
|
+
/** @type {Derived} */
|
|
1295
|
+
a,
|
|
1296
|
+
t,
|
|
1297
|
+
!1
|
|
1298
|
+
) : t === a && (r ? Q(a, se) : (a.f & ee) !== 0 && Q(a, Ie), ze(
|
|
1299
|
+
/** @type {Effect} */
|
|
1300
|
+
a
|
|
1301
|
+
));
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
function En(e) {
|
|
1305
|
+
var t = ve, r = pe, i = be, n = P, a = Ee, s = Fe, l = Te, o = ot, f = e.f;
|
|
1306
|
+
ve = /** @type {null | Value[]} */
|
|
1307
|
+
null, pe = 0, be = null, P = (f & (je | gt)) === 0 ? e : null, Ee = null, Jt(e.ctx), Te = !1, ot = ++at, e.ac !== null && (kr(() => {
|
|
1308
|
+
e.ac.abort(it);
|
|
1309
|
+
}), e.ac = null);
|
|
1310
|
+
try {
|
|
1311
|
+
e.f |= _r;
|
|
1312
|
+
var u = (
|
|
1313
|
+
/** @type {Function} */
|
|
1314
|
+
e.fn
|
|
1315
|
+
), h = u();
|
|
1316
|
+
e.f |= It;
|
|
1317
|
+
var _ = e.deps, p = B?.is_fork;
|
|
1318
|
+
if (ve !== null) {
|
|
1319
|
+
var m;
|
|
1320
|
+
if (p || Dt(e, pe), _ !== null && pe > 0)
|
|
1321
|
+
for (_.length = pe + ve.length, m = 0; m < ve.length; m++)
|
|
1322
|
+
_[pe + m] = ve[m];
|
|
1323
|
+
else
|
|
1324
|
+
e.deps = _ = ve;
|
|
1325
|
+
if (vn() && (e.f & Ae) !== 0)
|
|
1326
|
+
for (m = pe; m < _.length; m++)
|
|
1327
|
+
(_[m].reactions ??= []).push(e);
|
|
1328
|
+
} else !p && _ !== null && pe < _.length && (Dt(e, pe), _.length = pe);
|
|
1329
|
+
if (tn() && be !== null && !Te && _ !== null && (e.f & (ne | Ie | se)) === 0)
|
|
1330
|
+
for (m = 0; m < /** @type {Source[]} */
|
|
1331
|
+
be.length; m++)
|
|
1332
|
+
An(
|
|
1333
|
+
be[m],
|
|
1334
|
+
/** @type {Effect} */
|
|
1335
|
+
e
|
|
1336
|
+
);
|
|
1337
|
+
if (n !== null && n !== e) {
|
|
1338
|
+
if (at++, n.deps !== null)
|
|
1339
|
+
for (let v = 0; v < r; v += 1)
|
|
1340
|
+
n.deps[v].rv = at;
|
|
1341
|
+
if (t !== null)
|
|
1342
|
+
for (const v of t)
|
|
1343
|
+
v.rv = at;
|
|
1344
|
+
be !== null && (i === null ? i = be : i.push(.../** @type {Source[]} */
|
|
1345
|
+
be));
|
|
1346
|
+
}
|
|
1347
|
+
return (e.f & Ze) !== 0 && (e.f ^= Ze), h;
|
|
1348
|
+
} catch (v) {
|
|
1349
|
+
return bi(v);
|
|
1350
|
+
} finally {
|
|
1351
|
+
e.f ^= _r, ve = t, pe = r, be = i, P = n, Ee = a, Jt(s), Te = l, ot = o;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
function Ji(e, t) {
|
|
1355
|
+
let r = t.reactions;
|
|
1356
|
+
if (r !== null) {
|
|
1357
|
+
var i = Yn.call(r, e);
|
|
1358
|
+
if (i !== -1) {
|
|
1359
|
+
var n = r.length - 1;
|
|
1360
|
+
n === 0 ? r = t.reactions = null : (r[i] = r[n], r.pop());
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
if (r === null && (t.f & ne) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
|
1364
|
+
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
|
1365
|
+
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
|
1366
|
+
(ve === null || !mt.call(ve, t))) {
|
|
1367
|
+
var a = (
|
|
1368
|
+
/** @type {Derived} */
|
|
1369
|
+
t
|
|
1370
|
+
);
|
|
1371
|
+
(a.f & Ae) !== 0 && (a.f ^= Ae, a.f &= ~ft), xr(a), ji(a), Dt(a, 0);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
function Dt(e, t) {
|
|
1375
|
+
var r = e.deps;
|
|
1376
|
+
if (r !== null)
|
|
1377
|
+
for (var i = t; i < r.length; i++)
|
|
1378
|
+
Ji(e, r[i]);
|
|
1379
|
+
}
|
|
1380
|
+
function yt(e) {
|
|
1381
|
+
var t = e.f;
|
|
1382
|
+
if ((t & Be) === 0) {
|
|
1383
|
+
Q(e, ee);
|
|
1384
|
+
var r = K, i = zt;
|
|
1385
|
+
K = e, zt = !0;
|
|
1386
|
+
try {
|
|
1387
|
+
(t & (He | Xr)) !== 0 ? Ui(e) : jr(e), hn(e);
|
|
1388
|
+
var n = En(e);
|
|
1389
|
+
e.teardown = typeof n == "function" ? n : null, e.wv = gn;
|
|
1390
|
+
var a;
|
|
1391
|
+
vr && pi && (e.f & se) !== 0 && e.deps;
|
|
1392
|
+
} finally {
|
|
1393
|
+
zt = i, K = r;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
function c(e) {
|
|
1398
|
+
var t = e.f, r = (t & ne) !== 0;
|
|
1399
|
+
if (P !== null && !Te) {
|
|
1400
|
+
var i = K !== null && (K.f & Be) !== 0;
|
|
1401
|
+
if (!i && (Ee === null || !mt.call(Ee, e))) {
|
|
1402
|
+
var n = P.deps;
|
|
1403
|
+
if ((P.f & _r) !== 0)
|
|
1404
|
+
e.rv < at && (e.rv = at, ve === null && n !== null && n[pe] === e ? pe++ : ve === null ? ve = [e] : ve.push(e));
|
|
1405
|
+
else {
|
|
1406
|
+
(P.deps ??= []).push(e);
|
|
1407
|
+
var a = e.reactions;
|
|
1408
|
+
a === null ? e.reactions = [P] : mt.call(a, P) || a.push(P);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
if (Qe && Xe.has(e))
|
|
1413
|
+
return Xe.get(e);
|
|
1414
|
+
if (r) {
|
|
1415
|
+
var s = (
|
|
1416
|
+
/** @type {Derived} */
|
|
1417
|
+
e
|
|
1418
|
+
);
|
|
1419
|
+
if (Qe) {
|
|
1420
|
+
var l = s.v;
|
|
1421
|
+
return ((s.f & ee) === 0 && s.reactions !== null || Sn(s)) && (l = Or(s)), Xe.set(s, l), l;
|
|
1422
|
+
}
|
|
1423
|
+
var o = (s.f & Ae) === 0 && !Te && P !== null && (zt || (P.f & Ae) !== 0), f = (s.f & It) === 0;
|
|
1424
|
+
Kt(s) && (o && (s.f |= Ae), ln(s)), o && !f && (fn(s), xn(s));
|
|
1425
|
+
}
|
|
1426
|
+
if (Oe?.has(e))
|
|
1427
|
+
return Oe.get(e);
|
|
1428
|
+
if ((e.f & Ze) !== 0)
|
|
1429
|
+
throw e.v;
|
|
1430
|
+
return e.v;
|
|
1431
|
+
}
|
|
1432
|
+
function xn(e) {
|
|
1433
|
+
if (e.f |= Ae, e.deps !== null)
|
|
1434
|
+
for (const t of e.deps)
|
|
1435
|
+
(t.reactions ??= []).push(e), (t.f & ne) !== 0 && (t.f & Ae) === 0 && (fn(
|
|
1436
|
+
/** @type {Derived} */
|
|
1437
|
+
t
|
|
1438
|
+
), xn(
|
|
1439
|
+
/** @type {Derived} */
|
|
1440
|
+
t
|
|
1441
|
+
));
|
|
1442
|
+
}
|
|
1443
|
+
function Sn(e) {
|
|
1444
|
+
if (e.v === te) return !0;
|
|
1445
|
+
if (e.deps === null) return !1;
|
|
1446
|
+
for (const t of e.deps)
|
|
1447
|
+
if (Xe.has(t) || (t.f & ne) !== 0 && Sn(
|
|
1448
|
+
/** @type {Derived} */
|
|
1449
|
+
t
|
|
1450
|
+
))
|
|
1451
|
+
return !0;
|
|
1452
|
+
return !1;
|
|
1453
|
+
}
|
|
1454
|
+
function Hi(e) {
|
|
1455
|
+
var t = Te;
|
|
1456
|
+
try {
|
|
1457
|
+
return Te = !0, e();
|
|
1458
|
+
} finally {
|
|
1459
|
+
Te = t;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
const kt = /* @__PURE__ */ Symbol("events"), Gi = /* @__PURE__ */ new Set(), Yi = /* @__PURE__ */ new Set();
|
|
1463
|
+
function Wi(e, t, r, i = {}) {
|
|
1464
|
+
function n(a) {
|
|
1465
|
+
if (i.capture || Xi.call(t, a), !a.cancelBubble)
|
|
1466
|
+
return kr(() => r?.call(this, a));
|
|
1467
|
+
}
|
|
1468
|
+
return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Ht(() => {
|
|
1469
|
+
t.addEventListener(e, n, i);
|
|
1470
|
+
}) : t.addEventListener(e, n, i), n;
|
|
1471
|
+
}
|
|
1472
|
+
function Zi(e, t, r, i, n) {
|
|
1473
|
+
var a = { capture: i, passive: n }, s = Wi(e, t, r, a);
|
|
1474
|
+
(t === document.body || // @ts-ignore
|
|
1475
|
+
t === window || // @ts-ignore
|
|
1476
|
+
t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
|
|
1477
|
+
t instanceof HTMLMediaElement) && Tr(() => {
|
|
1478
|
+
t.removeEventListener(e, s, a);
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
function ce(e, t, r) {
|
|
1482
|
+
(t[kt] ??= {})[e] = r;
|
|
1483
|
+
}
|
|
1484
|
+
function et(e) {
|
|
1485
|
+
for (var t = 0; t < e.length; t++)
|
|
1486
|
+
Gi.add(e[t]);
|
|
1487
|
+
for (var r of Yi)
|
|
1488
|
+
r(e);
|
|
1489
|
+
}
|
|
1490
|
+
let zr = null;
|
|
1491
|
+
function Xi(e) {
|
|
1492
|
+
var t = this, r = (
|
|
1493
|
+
/** @type {Node} */
|
|
1494
|
+
t.ownerDocument
|
|
1495
|
+
), i = e.type, n = e.composedPath?.() || [], a = (
|
|
1496
|
+
/** @type {null | Element} */
|
|
1497
|
+
n[0] || e.target
|
|
1498
|
+
);
|
|
1499
|
+
zr = e;
|
|
1500
|
+
var s = 0, l = zr === e && e[kt];
|
|
1501
|
+
if (l) {
|
|
1502
|
+
var o = n.indexOf(l);
|
|
1503
|
+
if (o !== -1 && (t === document || t === /** @type {any} */
|
|
1504
|
+
window)) {
|
|
1505
|
+
e[kt] = t;
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
var f = n.indexOf(t);
|
|
1509
|
+
if (f === -1)
|
|
1510
|
+
return;
|
|
1511
|
+
o <= f && (s = o);
|
|
1512
|
+
}
|
|
1513
|
+
if (a = /** @type {Element} */
|
|
1514
|
+
n[s] || e.target, a !== t) {
|
|
1515
|
+
Wn(e, "currentTarget", {
|
|
1516
|
+
configurable: !0,
|
|
1517
|
+
get() {
|
|
1518
|
+
return a || r;
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
var u = P, h = K;
|
|
1522
|
+
Ke(null), $e(null);
|
|
1523
|
+
try {
|
|
1524
|
+
for (var _, p = []; a !== null; ) {
|
|
1525
|
+
var m = a.assignedSlot || a.parentNode || /** @type {any} */
|
|
1526
|
+
a.host || null;
|
|
1527
|
+
try {
|
|
1528
|
+
var v = a[kt]?.[i];
|
|
1529
|
+
v != null && (!/** @type {any} */
|
|
1530
|
+
a.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1531
|
+
// -> the target could not have been disabled because it emits the event in the first place
|
|
1532
|
+
e.target === a) && v.call(a, e);
|
|
1533
|
+
} catch (d) {
|
|
1534
|
+
_ ? p.push(d) : _ = d;
|
|
1535
|
+
}
|
|
1536
|
+
if (e.cancelBubble || m === t || m === null)
|
|
1537
|
+
break;
|
|
1538
|
+
a = m;
|
|
1539
|
+
}
|
|
1540
|
+
if (_) {
|
|
1541
|
+
for (let d of p)
|
|
1542
|
+
queueMicrotask(() => {
|
|
1543
|
+
throw d;
|
|
1544
|
+
});
|
|
1545
|
+
throw _;
|
|
1546
|
+
}
|
|
1547
|
+
} finally {
|
|
1548
|
+
e[kt] = t, delete e.currentTarget, Ke(u), $e(h);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
const Qi = (
|
|
1553
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
1554
|
+
globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
|
|
1555
|
+
/** @param {string} html */
|
|
1556
|
+
createHTML: (e) => e
|
|
1557
|
+
})
|
|
1558
|
+
);
|
|
1559
|
+
function $i(e) {
|
|
1560
|
+
return (
|
|
1561
|
+
/** @type {string} */
|
|
1562
|
+
Qi?.createHTML(e) ?? e
|
|
1563
|
+
);
|
|
1564
|
+
}
|
|
1565
|
+
function ea(e, t = !1) {
|
|
1566
|
+
var r = Fi("template");
|
|
1567
|
+
return e = e.replaceAll("<!>", "<!---->"), r.innerHTML = t ? $i(e) : e, r.content;
|
|
1568
|
+
}
|
|
1569
|
+
function yr(e, t) {
|
|
1570
|
+
var r = (
|
|
1571
|
+
/** @type {Effect} */
|
|
1572
|
+
K
|
|
1573
|
+
);
|
|
1574
|
+
r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
|
|
1575
|
+
}
|
|
1576
|
+
// @__NO_SIDE_EFFECTS__
|
|
1577
|
+
function N(e, t) {
|
|
1578
|
+
var r = (t & Hn) !== 0, i = (t & Gn) !== 0, n, a = !e.startsWith("<!>");
|
|
1579
|
+
return () => {
|
|
1580
|
+
n === void 0 && (n = ea(a ? e : "<!>" + e, !0), r || (n = /** @type {TemplateNode} */
|
|
1581
|
+
/* @__PURE__ */ Yt(n)));
|
|
1582
|
+
var s = (
|
|
1583
|
+
/** @type {TemplateNode} */
|
|
1584
|
+
i || Mi ? document.importNode(n, !0) : n.cloneNode(!0)
|
|
1585
|
+
);
|
|
1586
|
+
if (r) {
|
|
1587
|
+
var l = (
|
|
1588
|
+
/** @type {TemplateNode} */
|
|
1589
|
+
/* @__PURE__ */ Yt(s)
|
|
1590
|
+
), o = (
|
|
1591
|
+
/** @type {TemplateNode} */
|
|
1592
|
+
s.lastChild
|
|
1593
|
+
);
|
|
1594
|
+
yr(l, o);
|
|
1595
|
+
} else
|
|
1596
|
+
yr(s, s);
|
|
1597
|
+
return s;
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function re() {
|
|
1601
|
+
var e = document.createDocumentFragment(), t = document.createComment(""), r = _t();
|
|
1602
|
+
return e.append(t, r), yr(t, r), e;
|
|
1603
|
+
}
|
|
1604
|
+
function E(e, t) {
|
|
1605
|
+
e !== null && e.before(
|
|
1606
|
+
/** @type {Node} */
|
|
1607
|
+
t
|
|
1608
|
+
);
|
|
1609
|
+
}
|
|
1610
|
+
function F(e, t) {
|
|
1611
|
+
var r = t == null ? "" : typeof t == "object" ? t + "" : t;
|
|
1612
|
+
r !== (e.__t ??= e.nodeValue) && (e.__t = r, e.nodeValue = r + "");
|
|
1613
|
+
}
|
|
1614
|
+
class Dr {
|
|
1615
|
+
/** @type {TemplateNode} */
|
|
1616
|
+
anchor;
|
|
1617
|
+
/** @type {Map<Batch, Key>} */
|
|
1618
|
+
#t = /* @__PURE__ */ new Map();
|
|
1619
|
+
/**
|
|
1620
|
+
* Map of keys to effects that are currently rendered in the DOM.
|
|
1621
|
+
* These effects are visible and actively part of the document tree.
|
|
1622
|
+
* Example:
|
|
1623
|
+
* ```
|
|
1624
|
+
* {#if condition}
|
|
1625
|
+
* foo
|
|
1626
|
+
* {:else}
|
|
1627
|
+
* bar
|
|
1628
|
+
* {/if}
|
|
1629
|
+
* ```
|
|
1630
|
+
* Can result in the entries `true->Effect` and `false->Effect`
|
|
1631
|
+
* @type {Map<Key, Effect>}
|
|
1632
|
+
*/
|
|
1633
|
+
#r = /* @__PURE__ */ new Map();
|
|
1634
|
+
/**
|
|
1635
|
+
* Similar to #onscreen with respect to the keys, but contains branches that are not yet
|
|
1636
|
+
* in the DOM, because their insertion is deferred.
|
|
1637
|
+
* @type {Map<Key, Branch>}
|
|
1638
|
+
*/
|
|
1639
|
+
#e = /* @__PURE__ */ new Map();
|
|
1640
|
+
/**
|
|
1641
|
+
* Keys of effects that are currently outroing
|
|
1642
|
+
* @type {Set<Key>}
|
|
1643
|
+
*/
|
|
1644
|
+
#n = /* @__PURE__ */ new Set();
|
|
1645
|
+
/**
|
|
1646
|
+
* Whether to pause (i.e. outro) on change, or destroy immediately.
|
|
1647
|
+
* This is necessary for `<svelte:element>`
|
|
1648
|
+
*/
|
|
1649
|
+
#o = !0;
|
|
1650
|
+
/**
|
|
1651
|
+
* @param {TemplateNode} anchor
|
|
1652
|
+
* @param {boolean} transition
|
|
1653
|
+
*/
|
|
1654
|
+
constructor(t, r = !0) {
|
|
1655
|
+
this.anchor = t, this.#o = r;
|
|
1656
|
+
}
|
|
1657
|
+
#s = () => {
|
|
1658
|
+
var t = (
|
|
1659
|
+
/** @type {Batch} */
|
|
1660
|
+
B
|
|
1661
|
+
);
|
|
1662
|
+
if (this.#t.has(t)) {
|
|
1663
|
+
var r = (
|
|
1664
|
+
/** @type {Key} */
|
|
1665
|
+
this.#t.get(t)
|
|
1666
|
+
), i = this.#r.get(r);
|
|
1667
|
+
if (i)
|
|
1668
|
+
Pr(i), this.#n.delete(r);
|
|
1669
|
+
else {
|
|
1670
|
+
var n = this.#e.get(r);
|
|
1671
|
+
n && (this.#r.set(r, n.effect), this.#e.delete(r), n.fragment.lastChild.remove(), this.anchor.before(n.fragment), i = n.effect);
|
|
1672
|
+
}
|
|
1673
|
+
for (const [a, s] of this.#t) {
|
|
1674
|
+
if (this.#t.delete(a), a === t)
|
|
1675
|
+
break;
|
|
1676
|
+
const l = this.#e.get(s);
|
|
1677
|
+
l && (Je(l.effect), this.#e.delete(s));
|
|
1678
|
+
}
|
|
1679
|
+
for (const [a, s] of this.#r) {
|
|
1680
|
+
if (a === r || this.#n.has(a)) continue;
|
|
1681
|
+
const l = () => {
|
|
1682
|
+
if (Array.from(this.#t.values()).includes(a)) {
|
|
1683
|
+
var f = document.createDocumentFragment();
|
|
1684
|
+
zi(s, f), f.append(_t()), this.#e.set(a, { effect: s, fragment: f });
|
|
1685
|
+
} else
|
|
1686
|
+
Je(s);
|
|
1687
|
+
this.#n.delete(a), this.#r.delete(a);
|
|
1688
|
+
};
|
|
1689
|
+
this.#o || !i ? (this.#n.add(a), Nr(s, l, !1)) : l();
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
/**
|
|
1694
|
+
* @param {Batch} batch
|
|
1695
|
+
*/
|
|
1696
|
+
#i = (t) => {
|
|
1697
|
+
this.#t.delete(t);
|
|
1698
|
+
const r = Array.from(this.#t.values());
|
|
1699
|
+
for (const [i, n] of this.#e)
|
|
1700
|
+
r.includes(i) || (Je(n.effect), this.#e.delete(i));
|
|
1701
|
+
};
|
|
1702
|
+
/**
|
|
1703
|
+
*
|
|
1704
|
+
* @param {any} key
|
|
1705
|
+
* @param {null | ((target: TemplateNode) => void)} fn
|
|
1706
|
+
*/
|
|
1707
|
+
ensure(t, r) {
|
|
1708
|
+
var i = (
|
|
1709
|
+
/** @type {Batch} */
|
|
1710
|
+
B
|
|
1711
|
+
), n = dn();
|
|
1712
|
+
if (r && !this.#r.has(t) && !this.#e.has(t))
|
|
1713
|
+
if (n) {
|
|
1714
|
+
var a = document.createDocumentFragment(), s = _t();
|
|
1715
|
+
a.append(s), this.#e.set(t, {
|
|
1716
|
+
effect: Pt(() => r(s)),
|
|
1717
|
+
fragment: a
|
|
1718
|
+
});
|
|
1719
|
+
} else
|
|
1720
|
+
this.#r.set(
|
|
1721
|
+
t,
|
|
1722
|
+
Pt(() => r(this.anchor))
|
|
1723
|
+
);
|
|
1724
|
+
if (this.#t.set(i, t), n) {
|
|
1725
|
+
for (const [l, o] of this.#r)
|
|
1726
|
+
l === t ? i.unskip_effect(o) : i.skip_effect(o);
|
|
1727
|
+
for (const [l, o] of this.#e)
|
|
1728
|
+
l === t ? i.unskip_effect(o.effect) : i.skip_effect(o.effect);
|
|
1729
|
+
i.oncommit(this.#s), i.ondiscard(this.#i);
|
|
1730
|
+
} else
|
|
1731
|
+
this.#s();
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
function Mt(e, t, ...r) {
|
|
1735
|
+
var i = new Dr(e);
|
|
1736
|
+
er(() => {
|
|
1737
|
+
const n = t() ?? null;
|
|
1738
|
+
i.ensure(n, n && ((a) => n(a, ...r)));
|
|
1739
|
+
}, lt);
|
|
1740
|
+
}
|
|
1741
|
+
function H(e, t, r = !1) {
|
|
1742
|
+
var i = new Dr(e), n = r ? lt : 0;
|
|
1743
|
+
function a(s, l) {
|
|
1744
|
+
i.ensure(s, l);
|
|
1745
|
+
}
|
|
1746
|
+
er(() => {
|
|
1747
|
+
var s = !1;
|
|
1748
|
+
t((l, o = 0) => {
|
|
1749
|
+
s = !0, a(o, l);
|
|
1750
|
+
}), s || a(!1, null);
|
|
1751
|
+
}, n);
|
|
1752
|
+
}
|
|
1753
|
+
function ta(e, t) {
|
|
1754
|
+
return t;
|
|
1755
|
+
}
|
|
1756
|
+
function ra(e, t, r) {
|
|
1757
|
+
for (var i = [], n = t.length, a, s = t.length, l = 0; l < n; l++) {
|
|
1758
|
+
let h = t[l];
|
|
1759
|
+
Nr(
|
|
1760
|
+
h,
|
|
1761
|
+
() => {
|
|
1762
|
+
if (a) {
|
|
1763
|
+
if (a.pending.delete(h), a.done.add(h), a.pending.size === 0) {
|
|
1764
|
+
var _ = (
|
|
1765
|
+
/** @type {Set<EachOutroGroup>} */
|
|
1766
|
+
e.outrogroups
|
|
1767
|
+
);
|
|
1768
|
+
br(gr(a.done)), _.delete(a), _.size === 0 && (e.outrogroups = null);
|
|
1769
|
+
}
|
|
1770
|
+
} else
|
|
1771
|
+
s -= 1;
|
|
1772
|
+
},
|
|
1773
|
+
!1
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
if (s === 0) {
|
|
1777
|
+
var o = i.length === 0 && r !== null;
|
|
1778
|
+
if (o) {
|
|
1779
|
+
var f = (
|
|
1780
|
+
/** @type {Element} */
|
|
1781
|
+
r
|
|
1782
|
+
), u = (
|
|
1783
|
+
/** @type {Element} */
|
|
1784
|
+
f.parentNode
|
|
1785
|
+
);
|
|
1786
|
+
Ii(u), u.append(f), e.items.clear();
|
|
1787
|
+
}
|
|
1788
|
+
br(t, !o);
|
|
1789
|
+
} else
|
|
1790
|
+
a = {
|
|
1791
|
+
pending: new Set(t),
|
|
1792
|
+
done: /* @__PURE__ */ new Set()
|
|
1793
|
+
}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
|
|
1794
|
+
}
|
|
1795
|
+
function br(e, t = !0) {
|
|
1796
|
+
for (var r = 0; r < e.length; r++)
|
|
1797
|
+
Je(e[r], t);
|
|
1798
|
+
}
|
|
1799
|
+
var Br;
|
|
1800
|
+
function bt(e, t, r, i, n, a = null) {
|
|
1801
|
+
var s = e, l = /* @__PURE__ */ new Map(), o = (t & Gr) !== 0;
|
|
1802
|
+
if (o) {
|
|
1803
|
+
var f = (
|
|
1804
|
+
/** @type {Element} */
|
|
1805
|
+
e
|
|
1806
|
+
);
|
|
1807
|
+
s = f.appendChild(_t());
|
|
1808
|
+
}
|
|
1809
|
+
var u = null, h = /* @__PURE__ */ sn(() => {
|
|
1810
|
+
var w = r();
|
|
1811
|
+
return Zt(w) ? w : w == null ? [] : gr(w);
|
|
1812
|
+
}), _, p = !0;
|
|
1813
|
+
function m() {
|
|
1814
|
+
d.fallback = u, na(d, _, s, t, i), u !== null && (_.length === 0 ? (u.f & qe) === 0 ? Pr(u) : (u.f ^= qe, Tt(u, null, s)) : Nr(u, () => {
|
|
1815
|
+
u = null;
|
|
1816
|
+
}));
|
|
1817
|
+
}
|
|
1818
|
+
var v = er(() => {
|
|
1819
|
+
_ = /** @type {V[]} */
|
|
1820
|
+
c(h);
|
|
1821
|
+
for (var w = _.length, x = /* @__PURE__ */ new Set(), D = (
|
|
1822
|
+
/** @type {Batch} */
|
|
1823
|
+
B
|
|
1824
|
+
), I = dn(), L = 0; L < w; L += 1) {
|
|
1825
|
+
var $ = _[L], V = i($, L), G = p ? null : l.get(V);
|
|
1826
|
+
G ? (G.v && Nt(G.v, $), G.i && Nt(G.i, L), I && D.unskip_effect(G.e)) : (G = ia(
|
|
1827
|
+
l,
|
|
1828
|
+
p ? s : Br ??= _t(),
|
|
1829
|
+
$,
|
|
1830
|
+
V,
|
|
1831
|
+
L,
|
|
1832
|
+
n,
|
|
1833
|
+
t,
|
|
1834
|
+
r
|
|
1835
|
+
), p || (G.e.f |= qe), l.set(V, G)), x.add(V);
|
|
1836
|
+
}
|
|
1837
|
+
if (w === 0 && a && !u && (p ? u = Pt(() => a(s)) : (u = Pt(() => a(Br ??= _t())), u.f |= qe)), w > x.size && ai(), !p)
|
|
1838
|
+
if (I) {
|
|
1839
|
+
for (const [xe, W] of l)
|
|
1840
|
+
x.has(xe) || D.skip_effect(W.e);
|
|
1841
|
+
D.oncommit(m), D.ondiscard(() => {
|
|
1842
|
+
});
|
|
1843
|
+
} else
|
|
1844
|
+
m();
|
|
1845
|
+
c(h);
|
|
1846
|
+
}), d = { effect: v, items: l, outrogroups: null, fallback: u };
|
|
1847
|
+
p = !1;
|
|
1848
|
+
}
|
|
1849
|
+
function St(e) {
|
|
1850
|
+
for (; e !== null && (e.f & je) === 0; )
|
|
1851
|
+
e = e.next;
|
|
1852
|
+
return e;
|
|
1853
|
+
}
|
|
1854
|
+
function na(e, t, r, i, n) {
|
|
1855
|
+
var a = (i & Vn) !== 0, s = t.length, l = e.items, o = St(e.effect.first), f, u = null, h, _ = [], p = [], m, v, d, w;
|
|
1856
|
+
if (a)
|
|
1857
|
+
for (w = 0; w < s; w += 1)
|
|
1858
|
+
m = t[w], v = n(m, w), d = /** @type {EachItem} */
|
|
1859
|
+
l.get(v).e, (d.f & qe) === 0 && (d.nodes?.a?.measure(), (h ??= /* @__PURE__ */ new Set()).add(d));
|
|
1860
|
+
for (w = 0; w < s; w += 1) {
|
|
1861
|
+
if (m = t[w], v = n(m, w), d = /** @type {EachItem} */
|
|
1862
|
+
l.get(v).e, e.outrogroups !== null)
|
|
1863
|
+
for (const W of e.outrogroups)
|
|
1864
|
+
W.pending.delete(d), W.done.delete(d);
|
|
1865
|
+
if ((d.f & qe) !== 0)
|
|
1866
|
+
if (d.f ^= qe, d === o)
|
|
1867
|
+
Tt(d, null, r);
|
|
1868
|
+
else {
|
|
1869
|
+
var x = u ? u.next : o;
|
|
1870
|
+
d === e.effect.last && (e.effect.last = d.prev), d.prev && (d.prev.next = d.next), d.next && (d.next.prev = d.prev), Ye(e, u, d), Ye(e, d, x), Tt(d, x, r), u = d, _ = [], p = [], o = St(u.next);
|
|
1871
|
+
continue;
|
|
1872
|
+
}
|
|
1873
|
+
if ((d.f & me) !== 0 && (Pr(d), a && (d.nodes?.a?.unfix(), (h ??= /* @__PURE__ */ new Set()).delete(d))), d !== o) {
|
|
1874
|
+
if (f !== void 0 && f.has(d)) {
|
|
1875
|
+
if (_.length < p.length) {
|
|
1876
|
+
var D = p[0], I;
|
|
1877
|
+
u = D.prev;
|
|
1878
|
+
var L = _[0], $ = _[_.length - 1];
|
|
1879
|
+
for (I = 0; I < _.length; I += 1)
|
|
1880
|
+
Tt(_[I], D, r);
|
|
1881
|
+
for (I = 0; I < p.length; I += 1)
|
|
1882
|
+
f.delete(p[I]);
|
|
1883
|
+
Ye(e, L.prev, $.next), Ye(e, u, L), Ye(e, $, D), o = D, u = $, w -= 1, _ = [], p = [];
|
|
1884
|
+
} else
|
|
1885
|
+
f.delete(d), Tt(d, o, r), Ye(e, d.prev, d.next), Ye(e, d, u === null ? e.effect.first : u.next), Ye(e, u, d), u = d;
|
|
1886
|
+
continue;
|
|
1887
|
+
}
|
|
1888
|
+
for (_ = [], p = []; o !== null && o !== d; )
|
|
1889
|
+
(f ??= /* @__PURE__ */ new Set()).add(o), p.push(o), o = St(o.next);
|
|
1890
|
+
if (o === null)
|
|
1891
|
+
continue;
|
|
1892
|
+
}
|
|
1893
|
+
(d.f & qe) === 0 && _.push(d), u = d, o = St(d.next);
|
|
1894
|
+
}
|
|
1895
|
+
if (e.outrogroups !== null) {
|
|
1896
|
+
for (const W of e.outrogroups)
|
|
1897
|
+
W.pending.size === 0 && (br(gr(W.done)), e.outrogroups?.delete(W));
|
|
1898
|
+
e.outrogroups.size === 0 && (e.outrogroups = null);
|
|
1899
|
+
}
|
|
1900
|
+
if (o !== null || f !== void 0) {
|
|
1901
|
+
var V = [];
|
|
1902
|
+
if (f !== void 0)
|
|
1903
|
+
for (d of f)
|
|
1904
|
+
(d.f & me) === 0 && V.push(d);
|
|
1905
|
+
for (; o !== null; )
|
|
1906
|
+
(o.f & me) === 0 && o !== e.fallback && V.push(o), o = St(o.next);
|
|
1907
|
+
var G = V.length;
|
|
1908
|
+
if (G > 0) {
|
|
1909
|
+
var xe = (i & Gr) !== 0 && s === 0 ? r : null;
|
|
1910
|
+
if (a) {
|
|
1911
|
+
for (w = 0; w < G; w += 1)
|
|
1912
|
+
V[w].nodes?.a?.measure();
|
|
1913
|
+
for (w = 0; w < G; w += 1)
|
|
1914
|
+
V[w].nodes?.a?.fix();
|
|
1915
|
+
}
|
|
1916
|
+
ra(e, V, xe);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
a && Ht(() => {
|
|
1920
|
+
if (h !== void 0)
|
|
1921
|
+
for (d of h)
|
|
1922
|
+
d.nodes?.a?.apply();
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function ia(e, t, r, i, n, a, s, l) {
|
|
1926
|
+
var o = (s & Kn) !== 0 ? (s & Un) === 0 ? /* @__PURE__ */ Ni(r, !1, !1) : jt(r) : null, f = (s & Ln) !== 0 ? jt(n) : null;
|
|
1927
|
+
return {
|
|
1928
|
+
v: o,
|
|
1929
|
+
i: f,
|
|
1930
|
+
e: Pt(() => (a(t, o ?? r, f ?? n, l), () => {
|
|
1931
|
+
e.delete(i);
|
|
1932
|
+
}))
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
function Tt(e, t, r) {
|
|
1936
|
+
if (e.nodes)
|
|
1937
|
+
for (var i = e.nodes.start, n = e.nodes.end, a = t && (t.f & qe) === 0 ? (
|
|
1938
|
+
/** @type {EffectNodes} */
|
|
1939
|
+
t.nodes.start
|
|
1940
|
+
) : r; i !== null; ) {
|
|
1941
|
+
var s = (
|
|
1942
|
+
/** @type {TemplateNode} */
|
|
1943
|
+
/* @__PURE__ */ Ft(i)
|
|
1944
|
+
);
|
|
1945
|
+
if (a.before(i), i === n)
|
|
1946
|
+
return;
|
|
1947
|
+
i = s;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
function Ye(e, t, r) {
|
|
1951
|
+
t === null ? e.effect.first = r : t.next = r, r === null ? e.effect.last = t : r.prev = t;
|
|
1952
|
+
}
|
|
1953
|
+
function Ve(e, t, r) {
|
|
1954
|
+
var i = new Dr(e);
|
|
1955
|
+
er(() => {
|
|
1956
|
+
var n = t() ?? null;
|
|
1957
|
+
i.ensure(n, n && ((a) => r(a, n)));
|
|
1958
|
+
}, lt);
|
|
1959
|
+
}
|
|
1960
|
+
function Mr(e, t, r = !1) {
|
|
1961
|
+
if (e.multiple) {
|
|
1962
|
+
if (t == null)
|
|
1963
|
+
return;
|
|
1964
|
+
if (!Zt(t))
|
|
1965
|
+
return _i();
|
|
1966
|
+
for (var i of e.options)
|
|
1967
|
+
i.selected = t.includes(Jr(i));
|
|
1968
|
+
return;
|
|
1969
|
+
}
|
|
1970
|
+
for (i of e.options) {
|
|
1971
|
+
var n = Jr(i);
|
|
1972
|
+
if (Di(n, t)) {
|
|
1973
|
+
i.selected = !0;
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
(!r || t !== void 0) && (e.selectedIndex = -1);
|
|
1978
|
+
}
|
|
1979
|
+
function On(e) {
|
|
1980
|
+
var t = new MutationObserver(() => {
|
|
1981
|
+
Mr(e, e.__value);
|
|
1982
|
+
});
|
|
1983
|
+
t.observe(e, {
|
|
1984
|
+
// Listen to option element changes
|
|
1985
|
+
childList: !0,
|
|
1986
|
+
subtree: !0,
|
|
1987
|
+
// because of <optgroup>
|
|
1988
|
+
// Listen to option element value attribute changes
|
|
1989
|
+
// (doesn't get notified of select value changes,
|
|
1990
|
+
// because that property is not reflected as an attribute)
|
|
1991
|
+
attributes: !0,
|
|
1992
|
+
attributeFilter: ["value"]
|
|
1993
|
+
}), Tr(() => {
|
|
1994
|
+
t.disconnect();
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
function Jr(e) {
|
|
1998
|
+
return "__value" in e ? e.__value : e.value;
|
|
1999
|
+
}
|
|
2000
|
+
const aa = /* @__PURE__ */ Symbol("is custom element"), oa = /* @__PURE__ */ Symbol("is html"), sa = ni ? "progress" : "PROGRESS";
|
|
2001
|
+
function Ct(e, t) {
|
|
2002
|
+
var r = Cr(e);
|
|
2003
|
+
r.value === (r.value = // treat null and undefined the same for the initial value
|
|
2004
|
+
t ?? void 0) || // @ts-expect-error
|
|
2005
|
+
// `progress` elements always need their value set when it's `0`
|
|
2006
|
+
e.value === t && (t !== 0 || e.nodeName !== sa) || (e.value = t ?? "");
|
|
2007
|
+
}
|
|
2008
|
+
function la(e, t) {
|
|
2009
|
+
var r = Cr(e);
|
|
2010
|
+
r.checked !== (r.checked = // treat null and undefined the same for the initial value
|
|
2011
|
+
t ?? void 0) && (e.checked = t);
|
|
2012
|
+
}
|
|
2013
|
+
function st(e, t, r, i) {
|
|
2014
|
+
var n = Cr(e);
|
|
2015
|
+
n[t] !== (n[t] = r) && (t === "loading" && (e[ri] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && fa(e).includes(t) ? e[t] = r : e.setAttribute(t, r));
|
|
2016
|
+
}
|
|
2017
|
+
function Cr(e) {
|
|
2018
|
+
return (
|
|
2019
|
+
/** @type {Record<string | symbol, unknown>} **/
|
|
2020
|
+
// @ts-expect-error
|
|
2021
|
+
e.__attributes ??= {
|
|
2022
|
+
[aa]: e.nodeName.includes("-"),
|
|
2023
|
+
[oa]: e.namespaceURI === Yr
|
|
2024
|
+
}
|
|
2025
|
+
);
|
|
2026
|
+
}
|
|
2027
|
+
var Hr = /* @__PURE__ */ new Map();
|
|
2028
|
+
function fa(e) {
|
|
2029
|
+
var t = e.getAttribute("is") || e.nodeName, r = Hr.get(t);
|
|
2030
|
+
if (r) return r;
|
|
2031
|
+
Hr.set(t, r = []);
|
|
2032
|
+
for (var i, n = e, a = Element.prototype; a !== n; ) {
|
|
2033
|
+
i = Zn(n);
|
|
2034
|
+
for (var s in i)
|
|
2035
|
+
i[s].set && r.push(s);
|
|
2036
|
+
n = wr(n);
|
|
2037
|
+
}
|
|
2038
|
+
return r;
|
|
2039
|
+
}
|
|
2040
|
+
let Vt = !1;
|
|
2041
|
+
function ua(e) {
|
|
2042
|
+
var t = Vt;
|
|
2043
|
+
try {
|
|
2044
|
+
return Vt = !1, [e(), Vt];
|
|
2045
|
+
} finally {
|
|
2046
|
+
Vt = t;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
function cr(e, t, r, i) {
|
|
2050
|
+
var n = (r & Bn) !== 0, a = (r & Jn) !== 0, s = (
|
|
2051
|
+
/** @type {V} */
|
|
2052
|
+
i
|
|
2053
|
+
), l = !0, o = () => (l && (l = !1, s = a ? Hi(
|
|
2054
|
+
/** @type {() => V} */
|
|
2055
|
+
i
|
|
2056
|
+
) : (
|
|
2057
|
+
/** @type {V} */
|
|
2058
|
+
i
|
|
2059
|
+
)), s), f;
|
|
2060
|
+
if (n) {
|
|
2061
|
+
var u = vt in e || ti in e;
|
|
2062
|
+
f = Ut(e, t)?.set ?? (u && t in e ? (x) => e[t] = x : void 0);
|
|
2063
|
+
}
|
|
2064
|
+
var h, _ = !1;
|
|
2065
|
+
n ? [h, _] = ua(() => (
|
|
2066
|
+
/** @type {V} */
|
|
2067
|
+
e[t]
|
|
2068
|
+
)) : h = /** @type {V} */
|
|
2069
|
+
e[t], h === void 0 && i !== void 0 && (h = o(), f && (ui(), f(h)));
|
|
2070
|
+
var p;
|
|
2071
|
+
if (p = () => {
|
|
2072
|
+
var x = (
|
|
2073
|
+
/** @type {V} */
|
|
2074
|
+
e[t]
|
|
2075
|
+
);
|
|
2076
|
+
return x === void 0 ? o() : (l = !0, x);
|
|
2077
|
+
}, (r & zn) === 0)
|
|
2078
|
+
return p;
|
|
2079
|
+
if (f) {
|
|
2080
|
+
var m = e.$$legacy;
|
|
2081
|
+
return (
|
|
2082
|
+
/** @type {() => V} */
|
|
2083
|
+
(function(x, D) {
|
|
2084
|
+
return arguments.length > 0 ? ((!D || m || _) && f(D ? p() : x), x) : p();
|
|
2085
|
+
})
|
|
2086
|
+
);
|
|
2087
|
+
}
|
|
2088
|
+
var v = !1, d = ((r & qn) !== 0 ? $t : sn)(() => (v = !1, p()));
|
|
2089
|
+
n && c(d);
|
|
2090
|
+
var w = (
|
|
2091
|
+
/** @type {Effect} */
|
|
2092
|
+
K
|
|
2093
|
+
);
|
|
2094
|
+
return (
|
|
2095
|
+
/** @type {() => V} */
|
|
2096
|
+
(function(x, D) {
|
|
2097
|
+
if (arguments.length > 0) {
|
|
2098
|
+
const I = D ? c(d) : n ? ke(x) : x;
|
|
2099
|
+
return X(d, I), v = !0, s !== void 0 && (s = I), x;
|
|
2100
|
+
}
|
|
2101
|
+
return Qe && v || (w.f & Be) !== 0 ? d.v : c(d);
|
|
2102
|
+
})
|
|
2103
|
+
);
|
|
2104
|
+
}
|
|
2105
|
+
function Rt(e) {
|
|
2106
|
+
const t = e?.type ?? "object";
|
|
2107
|
+
return t === "string" ? e.format === "date-time" ? "date" : "string" : t === "number" ? "number" : t === "integer" ? "integer" : t === "boolean" ? "boolean" : t === "object" ? "object" : t === "array" ? "array" : "unknown";
|
|
2108
|
+
}
|
|
2109
|
+
function Wt(e) {
|
|
2110
|
+
if (e === null) return "null:";
|
|
2111
|
+
const t = typeof e;
|
|
2112
|
+
if (t === "object")
|
|
2113
|
+
try {
|
|
2114
|
+
return `object:${JSON.stringify(e)}`;
|
|
2115
|
+
} catch {
|
|
2116
|
+
return "object:[unserializable]";
|
|
2117
|
+
}
|
|
2118
|
+
return t === "undefined" ? "undefined:" : t === "number" && Number.isNaN(e) ? "number:NaN" : `${t}:${String(e)}`;
|
|
2119
|
+
}
|
|
2120
|
+
function kn(e) {
|
|
2121
|
+
if (e === null) return "null";
|
|
2122
|
+
const t = typeof e;
|
|
2123
|
+
if (t === "string") return e;
|
|
2124
|
+
if (t === "number" || t === "boolean") return String(e);
|
|
2125
|
+
if (t === "undefined") return "undefined";
|
|
2126
|
+
if (t === "object")
|
|
2127
|
+
try {
|
|
2128
|
+
return JSON.stringify(e);
|
|
2129
|
+
} catch {
|
|
2130
|
+
return "[object]";
|
|
2131
|
+
}
|
|
2132
|
+
return String(e);
|
|
2133
|
+
}
|
|
2134
|
+
function ca(e) {
|
|
2135
|
+
const t = Array.isArray(e?.anyOf) ? e.anyOf : Array.isArray(e?.oneOf) ? e.oneOf : null;
|
|
2136
|
+
if (!t || t.length === 0)
|
|
2137
|
+
throw new Error("anyOf/oneOf must contain at least one variant");
|
|
2138
|
+
let r;
|
|
2139
|
+
const i = [], n = /* @__PURE__ */ new Set();
|
|
2140
|
+
for (const a of t) {
|
|
2141
|
+
if (Rt(a) !== "object")
|
|
2142
|
+
throw new Error("Only object variants are supported for discriminated unions");
|
|
2143
|
+
const s = a?.properties;
|
|
2144
|
+
if (!s)
|
|
2145
|
+
throw new Error("Discriminated union variants must define properties");
|
|
2146
|
+
const l = Object.entries(s).filter(
|
|
2147
|
+
([, _]) => _?.type === "string" && typeof _?.const == "string"
|
|
2148
|
+
);
|
|
2149
|
+
if (l.length === 0)
|
|
2150
|
+
throw new Error("Discriminated union variants must have a string const property");
|
|
2151
|
+
if (l.length > 1)
|
|
2152
|
+
throw new Error(
|
|
2153
|
+
"Discriminated union variants must have exactly one string const property"
|
|
2154
|
+
);
|
|
2155
|
+
const [o, f] = l[0];
|
|
2156
|
+
if (r && o !== r)
|
|
2157
|
+
throw new Error(
|
|
2158
|
+
"Discriminated union variants must share the same discriminant key"
|
|
2159
|
+
);
|
|
2160
|
+
r ??= o;
|
|
2161
|
+
const u = f.const;
|
|
2162
|
+
if (n.has(u))
|
|
2163
|
+
throw new Error(`Duplicate discriminant value "${u}" is not allowed`);
|
|
2164
|
+
n.add(u);
|
|
2165
|
+
const h = ht("__variant__", a, !0);
|
|
2166
|
+
i.push({
|
|
2167
|
+
value: u,
|
|
2168
|
+
label: u,
|
|
2169
|
+
field: h
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
if (!r)
|
|
2173
|
+
throw new Error("Unable to determine discriminant key for anyOf union");
|
|
2174
|
+
return {
|
|
2175
|
+
discriminatorKey: r,
|
|
2176
|
+
options: i
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
function Tn(e) {
|
|
2180
|
+
const t = e?.properties ?? {}, r = new Set(e?.required ?? []);
|
|
2181
|
+
return Object.entries(t).map(([i, n]) => ht(i, n, r.has(i)));
|
|
2182
|
+
}
|
|
2183
|
+
function da(e) {
|
|
2184
|
+
const t = Array.isArray(e?.enum) ? e.enum : void 0;
|
|
2185
|
+
if (t?.length)
|
|
2186
|
+
return t.map((r) => ({
|
|
2187
|
+
value: r,
|
|
2188
|
+
key: Wt(r),
|
|
2189
|
+
label: kn(r)
|
|
2190
|
+
}));
|
|
2191
|
+
}
|
|
2192
|
+
function va(e) {
|
|
2193
|
+
const t = e?.form;
|
|
2194
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
2195
|
+
const r = {};
|
|
2196
|
+
return (t.widget === "input" || t.widget === "textarea") && (r.widget = t.widget), typeof t.label == "string" && (r.label = t.label), typeof t.placeholder == "string" && (r.placeholder = t.placeholder), t.reorderable === !0 && (r.reorderable = !0), Object.keys(r).length ? r : void 0;
|
|
2197
|
+
}
|
|
2198
|
+
function jn(e) {
|
|
2199
|
+
return e == null || typeof e != "object" ? e : structuredClone(e);
|
|
2200
|
+
}
|
|
2201
|
+
function ht(e, t, r = !1) {
|
|
2202
|
+
const i = Rt(t), n = {
|
|
2203
|
+
key: e,
|
|
2204
|
+
type: i,
|
|
2205
|
+
title: t?.title,
|
|
2206
|
+
description: t?.description,
|
|
2207
|
+
defaultValue: t?.default !== void 0 ? jn(t.default) : void 0,
|
|
2208
|
+
form: va(t),
|
|
2209
|
+
required: r,
|
|
2210
|
+
enumValues: da(t)
|
|
2211
|
+
};
|
|
2212
|
+
if ((Array.isArray(t?.anyOf) ? t.anyOf : Array.isArray(t?.oneOf) ? t.oneOf : void 0)?.length && (n.discriminatedUnion = ca(t)), i === "object") {
|
|
2213
|
+
n.children = Tn(t);
|
|
2214
|
+
const s = t?.additionalProperties;
|
|
2215
|
+
s && s !== !1 && (n.additionalProperties = s === !0 ? { allowAny: !0 } : {
|
|
2216
|
+
allowAny: !0,
|
|
2217
|
+
schema: ht("__additional__", s)
|
|
2218
|
+
});
|
|
2219
|
+
} else if (i === "array") {
|
|
2220
|
+
const s = t?.items;
|
|
2221
|
+
Array.isArray(s) ? s.length > 0 && (n.items = ht("__item__", s[0])) : s && (n.items = ht("__item__", s));
|
|
2222
|
+
}
|
|
2223
|
+
return n;
|
|
2224
|
+
}
|
|
2225
|
+
function _a(e) {
|
|
2226
|
+
return Rt(e) !== "object" ? { fields: [ht("value", e, !0)] } : {
|
|
2227
|
+
fields: Tn(e)
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
function ha(e) {
|
|
2231
|
+
return e.type !== "string" ? "input" : e.form?.widget === "textarea" ? "textarea" : "input";
|
|
2232
|
+
}
|
|
2233
|
+
function tr(e) {
|
|
2234
|
+
return typeof e.form?.placeholder == "string" ? e.form.placeholder : void 0;
|
|
2235
|
+
}
|
|
2236
|
+
function tt(e) {
|
|
2237
|
+
return typeof e.form?.label == "string" && e.form.label.trim().length > 0 ? e.form.label : e.title ? e.title : e.key === "__item__" ? "Item" : e.key;
|
|
2238
|
+
}
|
|
2239
|
+
function pa(e) {
|
|
2240
|
+
return e.type === "object" && e.form?.reorderable === !0;
|
|
2241
|
+
}
|
|
2242
|
+
function pt(e) {
|
|
2243
|
+
if (e.defaultValue !== void 0)
|
|
2244
|
+
return jn(e.defaultValue);
|
|
2245
|
+
if (e.enumValues?.length) {
|
|
2246
|
+
const t = e.enumValues[0].value;
|
|
2247
|
+
return t !== null && typeof t == "object" ? structuredClone(t) : t;
|
|
2248
|
+
}
|
|
2249
|
+
switch (e.type) {
|
|
2250
|
+
case "string":
|
|
2251
|
+
return "";
|
|
2252
|
+
case "number":
|
|
2253
|
+
case "integer":
|
|
2254
|
+
return null;
|
|
2255
|
+
case "boolean":
|
|
2256
|
+
return !1;
|
|
2257
|
+
case "date":
|
|
2258
|
+
return "";
|
|
2259
|
+
case "object": {
|
|
2260
|
+
const t = {};
|
|
2261
|
+
if (e.discriminatedUnion && e.discriminatedUnion.options.length > 0) {
|
|
2262
|
+
const r = e.discriminatedUnion.options[0], i = e.discriminatedUnion.discriminatorKey;
|
|
2263
|
+
t[i] = r.value;
|
|
2264
|
+
for (const n of r.field.children ?? [])
|
|
2265
|
+
n.key !== i && (t[n.key] = pt(n));
|
|
2266
|
+
return t;
|
|
2267
|
+
}
|
|
2268
|
+
for (const r of e.children ?? [])
|
|
2269
|
+
t[r.key] = pt(r);
|
|
2270
|
+
return t;
|
|
2271
|
+
}
|
|
2272
|
+
case "array":
|
|
2273
|
+
return [];
|
|
2274
|
+
default:
|
|
2275
|
+
return null;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
function dr(e, t) {
|
|
2279
|
+
if (!e.discriminatedUnion)
|
|
2280
|
+
return {
|
|
2281
|
+
children: e.children ?? [],
|
|
2282
|
+
additionalProperties: e.additionalProperties
|
|
2283
|
+
};
|
|
2284
|
+
const r = e.discriminatedUnion, i = t && typeof t == "object" && !Array.isArray(t) ? t[r.discriminatorKey] : void 0, n = r.options.find((s) => s.value === i) ?? r.options[0];
|
|
2285
|
+
return {
|
|
2286
|
+
children: n?.field.children?.filter((s) => s.key !== r.discriminatorKey) ?? [],
|
|
2287
|
+
additionalProperties: n?.field.additionalProperties,
|
|
2288
|
+
discriminatorKey: r.discriminatorKey,
|
|
2289
|
+
activeOption: n
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
function go(e, t) {
|
|
2293
|
+
return {
|
|
2294
|
+
...e,
|
|
2295
|
+
key: t
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
function Ot(e, t, r) {
|
|
2299
|
+
if (!t.length) throw new Error("unreachable");
|
|
2300
|
+
let i = e;
|
|
2301
|
+
for (let a = 0; a < t.length - 1; a++) {
|
|
2302
|
+
const s = t[a], l = typeof s == "number" ? String(s) : s;
|
|
2303
|
+
if (typeof i[l] != "object" || i[l] === null) {
|
|
2304
|
+
const o = typeof t[a + 1] == "number";
|
|
2305
|
+
i[l] = o ? [] : {};
|
|
2306
|
+
}
|
|
2307
|
+
i = i[l];
|
|
2308
|
+
}
|
|
2309
|
+
const n = t[t.length - 1];
|
|
2310
|
+
i[typeof n == "number" ? String(n) : n] = r;
|
|
2311
|
+
}
|
|
2312
|
+
function We(e, ...t) {
|
|
2313
|
+
return t.reduce(
|
|
2314
|
+
(r, i) => r?.[typeof i == "number" ? String(i) : i],
|
|
2315
|
+
e
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
function ma(e, ...t) {
|
|
2319
|
+
const r = t.slice(0, -1), i = t[t.length - 1];
|
|
2320
|
+
let n = e;
|
|
2321
|
+
for (const s of r) {
|
|
2322
|
+
const l = typeof s == "number" ? String(s) : s;
|
|
2323
|
+
(typeof n[l] != "object" || n[l] === null) && (n[l] = {}), n = n[l];
|
|
2324
|
+
}
|
|
2325
|
+
const a = typeof i == "number" ? String(i) : i;
|
|
2326
|
+
return Array.isArray(n[a]) || (n[a] = []), n[a];
|
|
2327
|
+
}
|
|
2328
|
+
function ya(e, t, r) {
|
|
2329
|
+
const i = ma(e, ...t);
|
|
2330
|
+
if (!r.items) {
|
|
2331
|
+
i.push(null);
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
i.push(pt(r.items));
|
|
2335
|
+
}
|
|
2336
|
+
function ba(e, t, r) {
|
|
2337
|
+
const i = We(e, ...t);
|
|
2338
|
+
Array.isArray(i) && i.splice(r, 1);
|
|
2339
|
+
}
|
|
2340
|
+
function ga(e) {
|
|
2341
|
+
if (e == null || e === "") return "";
|
|
2342
|
+
const t = Number(e);
|
|
2343
|
+
return Number.isFinite(t) ? String(t) : "";
|
|
2344
|
+
}
|
|
2345
|
+
function wa(e) {
|
|
2346
|
+
if (e.trim() === "") return null;
|
|
2347
|
+
const t = Number(e);
|
|
2348
|
+
return Number.isFinite(t) ? t : null;
|
|
2349
|
+
}
|
|
2350
|
+
function Aa(e) {
|
|
2351
|
+
if (!e) return "";
|
|
2352
|
+
const t = e instanceof Date ? e : new Date(e);
|
|
2353
|
+
if (Number.isNaN(t.getTime())) return "";
|
|
2354
|
+
const r = (i) => String(i).padStart(2, "0");
|
|
2355
|
+
return `${t.getFullYear()}-${r(t.getMonth() + 1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`;
|
|
2356
|
+
}
|
|
2357
|
+
function Ea(e) {
|
|
2358
|
+
const t = e.trim();
|
|
2359
|
+
if (!t) return null;
|
|
2360
|
+
try {
|
|
2361
|
+
return JSON.parse(t);
|
|
2362
|
+
} catch {
|
|
2363
|
+
return t;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
function xa(e, t) {
|
|
2367
|
+
const r = [];
|
|
2368
|
+
function i(l) {
|
|
2369
|
+
if (Array.isArray(l?.anyOf)) return l.anyOf;
|
|
2370
|
+
if (Array.isArray(l?.oneOf)) return l.oneOf;
|
|
2371
|
+
}
|
|
2372
|
+
function n(l, o, f) {
|
|
2373
|
+
const u = Array.isArray(l?.enum) ? l.enum : void 0;
|
|
2374
|
+
if (!u || o === void 0) return;
|
|
2375
|
+
u.some((_) => Wt(_) === Wt(o)) || r.push(
|
|
2376
|
+
`${f || "(root)"} should be one of ${u.map(kn).join(", ")}`
|
|
2377
|
+
);
|
|
2378
|
+
}
|
|
2379
|
+
function a(l, o) {
|
|
2380
|
+
const f = i(l);
|
|
2381
|
+
if (!f || f.length === 0 || o == null || typeof o != "object" || Array.isArray(o))
|
|
2382
|
+
return;
|
|
2383
|
+
let u;
|
|
2384
|
+
for (const h of f) {
|
|
2385
|
+
if (Rt(h) !== "object")
|
|
2386
|
+
throw new Error("Only object variants are supported for discriminated unions");
|
|
2387
|
+
const _ = h?.properties;
|
|
2388
|
+
if (!_)
|
|
2389
|
+
throw new Error("Discriminated union variants must define properties");
|
|
2390
|
+
const p = Object.entries(_).filter(
|
|
2391
|
+
([, w]) => w?.type === "string" && typeof w?.const == "string"
|
|
2392
|
+
);
|
|
2393
|
+
if (p.length !== 1)
|
|
2394
|
+
throw new Error(
|
|
2395
|
+
"Discriminated union variants must have exactly one string const property"
|
|
2396
|
+
);
|
|
2397
|
+
const [m, v] = p[0];
|
|
2398
|
+
if (u && m !== u)
|
|
2399
|
+
throw new Error("Discriminated union variants must share the same discriminant key");
|
|
2400
|
+
u ??= m;
|
|
2401
|
+
const d = v.const;
|
|
2402
|
+
if (o[m] === d) return h;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
function s(l, o, f) {
|
|
2406
|
+
const u = Rt(l);
|
|
2407
|
+
if (u === "object") {
|
|
2408
|
+
if (o == null || typeof o != "object" || Array.isArray(o)) {
|
|
2409
|
+
r.push(`${f || "(root)"} should be an object`);
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2412
|
+
const h = l.properties ?? {}, _ = new Set(l.required ?? []);
|
|
2413
|
+
for (const v of _)
|
|
2414
|
+
v in o || r.push(`${f ? f + "." : ""}${v} is required`);
|
|
2415
|
+
for (const [v, d] of Object.entries(h))
|
|
2416
|
+
v in o && s(d, o[v], f ? `${f}.${v}` : v);
|
|
2417
|
+
const p = l?.additionalProperties;
|
|
2418
|
+
if (p === !1)
|
|
2419
|
+
for (const v of Object.keys(o))
|
|
2420
|
+
v in h || r.push(`${f ? f + "." : ""}${v} is not allowed`);
|
|
2421
|
+
else if (p && p !== !0 && typeof p == "object")
|
|
2422
|
+
for (const [v, d] of Object.entries(o))
|
|
2423
|
+
v in h || s(p, d, f ? `${f}.${v}` : v);
|
|
2424
|
+
if (i(l)?.length) {
|
|
2425
|
+
const v = a(l, o);
|
|
2426
|
+
if (!v) {
|
|
2427
|
+
r.push(`${f || "(root)"} did not match any union variant`);
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
s(v, o, f);
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
n(l, o, f);
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
if (u === "string") {
|
|
2437
|
+
o != null && typeof o != "string" ? r.push(`${f || "(root)"} should be a string`) : n(l, o, f);
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2440
|
+
if (u === "date") {
|
|
2441
|
+
if (o != null) {
|
|
2442
|
+
const h = o instanceof Date ? o : new Date(o);
|
|
2443
|
+
Number.isNaN(h.getTime()) && r.push(`${f || "(root)"} should be a valid date-time`);
|
|
2444
|
+
}
|
|
2445
|
+
n(l, o, f);
|
|
2446
|
+
return;
|
|
2447
|
+
}
|
|
2448
|
+
if (u === "number" || u === "integer") {
|
|
2449
|
+
if (o != null && typeof o != "number") {
|
|
2450
|
+
r.push(`${f || "(root)"} should be a number`);
|
|
2451
|
+
return;
|
|
2452
|
+
}
|
|
2453
|
+
if (u === "integer" && o != null && !Number.isInteger(o)) {
|
|
2454
|
+
r.push(`${f || "(root)"} should be an integer`);
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
n(l, o, f);
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
if (u === "boolean") {
|
|
2461
|
+
if (o != null && typeof o != "boolean") {
|
|
2462
|
+
r.push(`${f || "(root)"} should be a boolean`);
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
n(l, o, f);
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
if (u === "array") {
|
|
2469
|
+
if (!Array.isArray(o)) {
|
|
2470
|
+
r.push(`${f || "(root)"} should be an array`);
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
const h = l.items;
|
|
2474
|
+
h && (Array.isArray(h) && h.length > 0 ? o.forEach((_, p) => s(h[0], _, `${f}[${p}]`)) : Array.isArray(h) || o.forEach((_, p) => s(h, _, `${f}[${p}]`))), n(l, o, f);
|
|
2475
|
+
return;
|
|
2476
|
+
}
|
|
2477
|
+
n(l, o, f);
|
|
2478
|
+
}
|
|
2479
|
+
return s(e, t, ""), r.length ? { ok: !1, errors: r } : { ok: !0 };
|
|
2480
|
+
}
|
|
2481
|
+
var Sa = /* @__PURE__ */ N('<h3 class="af-title svelte-18268fr"> </h3>'), Oa = /* @__PURE__ */ N("<p> </p>"), ka = /* @__PURE__ */ N('<div class="af-errors svelte-18268fr"></div>'), Ta = /* @__PURE__ */ N('<form class="af-form svelte-18268fr"><!> <!> <!> <div class="af-actions svelte-18268fr"><button type="button" class="af-btn af-btn-secondary svelte-18268fr"> </button> <button type="submit" class="af-btn af-btn-primary svelte-18268fr"> </button></div></form>');
|
|
2482
|
+
function ja(e, t) {
|
|
2483
|
+
Ne(t, !0);
|
|
2484
|
+
var r = Ta(), i = T(r);
|
|
2485
|
+
{
|
|
2486
|
+
var n = (p) => {
|
|
2487
|
+
var m = Sa(), v = T(m);
|
|
2488
|
+
R(() => F(v, t.title)), E(p, m);
|
|
2489
|
+
};
|
|
2490
|
+
H(i, (p) => {
|
|
2491
|
+
t.title && p(n);
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
var a = M(i, 2);
|
|
2495
|
+
Mt(a, () => t.children);
|
|
2496
|
+
var s = M(a, 2);
|
|
2497
|
+
{
|
|
2498
|
+
var l = (p) => {
|
|
2499
|
+
var m = ka();
|
|
2500
|
+
bt(m, 23, () => t.errors, (v, d) => `${d}-${v}`, (v, d) => {
|
|
2501
|
+
var w = Oa(), x = T(w);
|
|
2502
|
+
R(() => F(x, c(d))), E(v, w);
|
|
2503
|
+
}), E(p, m);
|
|
2504
|
+
};
|
|
2505
|
+
H(s, (p) => {
|
|
2506
|
+
t.errors.length && p(l);
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
var o = M(s, 2), f = T(o), u = T(f), h = M(f, 2), _ = T(h);
|
|
2510
|
+
R(() => {
|
|
2511
|
+
F(u, t.cancelLabel), F(_, t.submitLabel);
|
|
2512
|
+
}), Zi("submit", r, (p) => {
|
|
2513
|
+
p.preventDefault(), t.onsubmit();
|
|
2514
|
+
}), ce("click", f, function(...p) {
|
|
2515
|
+
t.oncancel?.apply(this, p);
|
|
2516
|
+
}), E(e, r), Pe();
|
|
2517
|
+
}
|
|
2518
|
+
et(["click"]);
|
|
2519
|
+
var Na = /* @__PURE__ */ N('<p class="af-help svelte-yr0bu8"> </p>'), Pa = /* @__PURE__ */ N('<textarea class="af-input svelte-yr0bu8"></textarea>'), Da = /* @__PURE__ */ N('<input class="af-input svelte-yr0bu8" type="text"/>'), Ma = /* @__PURE__ */ N('<p class="af-label svelte-yr0bu8"> </p> <!> <!>', 1);
|
|
2520
|
+
function Ca(e, t) {
|
|
2521
|
+
Ne(t, !0);
|
|
2522
|
+
const r = /* @__PURE__ */ S(() => tt(t.field)), i = /* @__PURE__ */ S(() => ha(t.field)), n = /* @__PURE__ */ S(() => tr(t.field));
|
|
2523
|
+
var a = Ma(), s = C(a), l = T(s), o = M(s, 2);
|
|
2524
|
+
{
|
|
2525
|
+
var f = (p) => {
|
|
2526
|
+
var m = Na(), v = T(m);
|
|
2527
|
+
R(() => F(v, t.field.description)), E(p, m);
|
|
2528
|
+
};
|
|
2529
|
+
H(o, (p) => {
|
|
2530
|
+
t.field.description && p(f);
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
var u = M(o, 2);
|
|
2534
|
+
{
|
|
2535
|
+
var h = (p) => {
|
|
2536
|
+
var m = Pa();
|
|
2537
|
+
st(m, "rows", 3), R(() => {
|
|
2538
|
+
Ct(m, t.value ?? ""), st(m, "placeholder", c(n));
|
|
2539
|
+
}), ce("input", m, (v) => t.onchange(v.currentTarget.value)), E(p, m);
|
|
2540
|
+
}, _ = (p) => {
|
|
2541
|
+
var m = Da();
|
|
2542
|
+
R(() => {
|
|
2543
|
+
Ct(m, t.value ?? ""), st(m, "placeholder", c(n));
|
|
2544
|
+
}), ce("input", m, (v) => t.onchange(v.currentTarget.value)), E(p, m);
|
|
2545
|
+
};
|
|
2546
|
+
H(u, (p) => {
|
|
2547
|
+
c(i) === "textarea" ? p(h) : p(_, !1);
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
R(() => F(l, c(r))), E(e, a), Pe();
|
|
2551
|
+
}
|
|
2552
|
+
et(["input"]);
|
|
2553
|
+
var Ra = /* @__PURE__ */ N('<p class="af-help svelte-1cde0jg"> </p>'), Ia = /* @__PURE__ */ N('<p class="af-label svelte-1cde0jg"> </p> <!> <input class="af-input svelte-1cde0jg" type="number"/>', 1);
|
|
2554
|
+
function Fa(e, t) {
|
|
2555
|
+
Ne(t, !0);
|
|
2556
|
+
const r = /* @__PURE__ */ S(() => tt(t.field)), i = /* @__PURE__ */ S(() => tr(t.field));
|
|
2557
|
+
var n = Ia(), a = C(n), s = T(a), l = M(a, 2);
|
|
2558
|
+
{
|
|
2559
|
+
var o = (u) => {
|
|
2560
|
+
var h = Ra(), _ = T(h);
|
|
2561
|
+
R(() => F(_, t.field.description)), E(u, h);
|
|
2562
|
+
};
|
|
2563
|
+
H(l, (u) => {
|
|
2564
|
+
t.field.description && u(o);
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
var f = M(l, 2);
|
|
2568
|
+
R(
|
|
2569
|
+
(u) => {
|
|
2570
|
+
F(s, c(r)), st(f, "step", t.field.type === "integer" ? 1 : "any"), Ct(f, u), st(f, "placeholder", c(i));
|
|
2571
|
+
},
|
|
2572
|
+
[() => ga(t.value)]
|
|
2573
|
+
), ce("input", f, (u) => {
|
|
2574
|
+
const h = wa(u.currentTarget.value);
|
|
2575
|
+
t.onchange(t.field.type === "integer" && h != null ? Math.trunc(h) : h);
|
|
2576
|
+
}), E(e, n), Pe();
|
|
2577
|
+
}
|
|
2578
|
+
et(["input"]);
|
|
2579
|
+
var Ka = /* @__PURE__ */ N('<p class="af-help svelte-1onbcyh"> </p>'), La = /* @__PURE__ */ N('<label class="af-checkbox-row svelte-1onbcyh"><input type="checkbox"/> <span> </span></label> <!>', 1);
|
|
2580
|
+
function Va(e, t) {
|
|
2581
|
+
Ne(t, !0);
|
|
2582
|
+
const r = /* @__PURE__ */ S(() => tt(t.field));
|
|
2583
|
+
var i = La(), n = C(i), a = T(n), s = M(a, 2), l = T(s), o = M(n, 2);
|
|
2584
|
+
{
|
|
2585
|
+
var f = (u) => {
|
|
2586
|
+
var h = Ka(), _ = T(h);
|
|
2587
|
+
R(() => F(_, t.field.description)), E(u, h);
|
|
2588
|
+
};
|
|
2589
|
+
H(o, (u) => {
|
|
2590
|
+
t.field.description && u(f);
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
R(() => {
|
|
2594
|
+
la(a, !!t.value), F(l, c(r));
|
|
2595
|
+
}), ce("input", a, (u) => t.onchange(u.currentTarget.checked)), E(e, i), Pe();
|
|
2596
|
+
}
|
|
2597
|
+
et(["input"]);
|
|
2598
|
+
var Ua = /* @__PURE__ */ N('<p class="af-help svelte-6rq2q9"> </p>'), qa = /* @__PURE__ */ N('<p class="af-label svelte-6rq2q9"> </p> <!> <input class="af-input svelte-6rq2q9" type="datetime-local"/>', 1);
|
|
2599
|
+
function za(e, t) {
|
|
2600
|
+
Ne(t, !0);
|
|
2601
|
+
const r = /* @__PURE__ */ S(() => tt(t.field)), i = /* @__PURE__ */ S(() => tr(t.field));
|
|
2602
|
+
var n = qa(), a = C(n), s = T(a), l = M(a, 2);
|
|
2603
|
+
{
|
|
2604
|
+
var o = (u) => {
|
|
2605
|
+
var h = Ua(), _ = T(h);
|
|
2606
|
+
R(() => F(_, t.field.description)), E(u, h);
|
|
2607
|
+
};
|
|
2608
|
+
H(l, (u) => {
|
|
2609
|
+
t.field.description && u(o);
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
var f = M(l, 2);
|
|
2613
|
+
R(
|
|
2614
|
+
(u) => {
|
|
2615
|
+
F(s, c(r)), Ct(f, u), st(f, "placeholder", c(i));
|
|
2616
|
+
},
|
|
2617
|
+
[() => Aa(t.value)]
|
|
2618
|
+
), ce("input", f, (u) => t.onchange(new Date(u.currentTarget.value))), E(e, n), Pe();
|
|
2619
|
+
}
|
|
2620
|
+
et(["input"]);
|
|
2621
|
+
var Ba = /* @__PURE__ */ N('<p class="af-help svelte-5p4vbg"> </p>'), Ja = /* @__PURE__ */ N('<option disabled=""> </option>'), Ha = /* @__PURE__ */ N("<option> </option>"), Ga = /* @__PURE__ */ N('<p class="af-label svelte-5p4vbg"> </p> <!> <select class="af-input svelte-5p4vbg"><!><!></select>', 1);
|
|
2622
|
+
function Ya(e, t) {
|
|
2623
|
+
Ne(t, !0);
|
|
2624
|
+
const r = /* @__PURE__ */ S(() => tt(t.field)), i = /* @__PURE__ */ S(() => tr(t.field) ?? "Select an option");
|
|
2625
|
+
var n = Ga(), a = C(n), s = T(a), l = M(a, 2);
|
|
2626
|
+
{
|
|
2627
|
+
var o = (m) => {
|
|
2628
|
+
var v = Ba(), d = T(v);
|
|
2629
|
+
R(() => F(d, t.field.description)), E(m, v);
|
|
2630
|
+
};
|
|
2631
|
+
H(l, (m) => {
|
|
2632
|
+
t.field.description && m(o);
|
|
2633
|
+
});
|
|
2634
|
+
}
|
|
2635
|
+
var f = M(l, 2), u = T(f);
|
|
2636
|
+
{
|
|
2637
|
+
var h = (m) => {
|
|
2638
|
+
var v = Ja(), d = T(v);
|
|
2639
|
+
v.value = v.__value = "", R(() => F(d, c(i))), E(m, v);
|
|
2640
|
+
};
|
|
2641
|
+
H(u, (m) => {
|
|
2642
|
+
t.selectedKey === "" && m(h);
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
var _ = M(u);
|
|
2646
|
+
bt(_, 17, () => t.options, (m) => m.key, (m, v) => {
|
|
2647
|
+
var d = Ha(), w = T(d), x = {};
|
|
2648
|
+
R(() => {
|
|
2649
|
+
F(w, c(v).label), x !== (x = c(v).key) && (d.value = (d.__value = c(v).key) ?? "");
|
|
2650
|
+
}), E(m, d);
|
|
2651
|
+
});
|
|
2652
|
+
var p;
|
|
2653
|
+
On(f), R(() => {
|
|
2654
|
+
F(s, c(r)), p !== (p = t.selectedKey) && (f.value = (f.__value = t.selectedKey) ?? "", Mr(f, t.selectedKey));
|
|
2655
|
+
}), ce("input", f, (m) => {
|
|
2656
|
+
const v = m.currentTarget.value;
|
|
2657
|
+
if (!v) return;
|
|
2658
|
+
const d = t.options.find((x) => x.key === v);
|
|
2659
|
+
if (!d) return;
|
|
2660
|
+
const w = d.value !== null && typeof d.value == "object" ? structuredClone(d.value) : d.value;
|
|
2661
|
+
t.onchange(w);
|
|
2662
|
+
}), E(e, n), Pe();
|
|
2663
|
+
}
|
|
2664
|
+
et(["input"]);
|
|
2665
|
+
var Wa = /* @__PURE__ */ N('<button type="button" class="af-btn af-btn-secondary svelte-1c6lbe6">+ Property</button>'), Za = /* @__PURE__ */ N('<p class="af-help svelte-1c6lbe6"> </p>'), Xa = /* @__PURE__ */ N("<option> </option>"), Qa = /* @__PURE__ */ N('<p class="af-help svelte-1c6lbe6"> </p> <select class="af-input svelte-1c6lbe6"></select>', 1), $a = /* @__PURE__ */ N('<button type="button" class="af-btn af-btn-secondary svelte-1c6lbe6">Up</button> <button type="button" class="af-btn af-btn-secondary svelte-1c6lbe6">Down</button>', 1), eo = /* @__PURE__ */ N('<button type="button" class="af-btn af-btn-danger svelte-1c6lbe6">Remove</button>'), to = /* @__PURE__ */ N('<div class="af-move-row svelte-1c6lbe6"><!> <!></div>'), ro = /* @__PURE__ */ N('<p class="af-label svelte-1c6lbe6"> </p> <textarea class="af-input svelte-1c6lbe6"></textarea>', 1), no = /* @__PURE__ */ N('<div class="af-nested svelte-1c6lbe6"><!> <!></div>'), io = /* @__PURE__ */ N('<div class="af-label-row svelte-1c6lbe6"><p class="af-label svelte-1c6lbe6"> </p> <!></div> <!> <!> <!>', 1);
|
|
2666
|
+
function ao(e, t) {
|
|
2667
|
+
Ne(t, !0);
|
|
2668
|
+
const r = /* @__PURE__ */ S(() => tt(t.field)), i = /* @__PURE__ */ S(() => t.value && typeof t.value == "object" && !Array.isArray(t.value) ? t.value : {});
|
|
2669
|
+
var n = io(), a = C(n), s = T(a), l = T(s), o = M(s, 2);
|
|
2670
|
+
{
|
|
2671
|
+
var f = (v) => {
|
|
2672
|
+
var d = Wa();
|
|
2673
|
+
ce("click", d, function(...w) {
|
|
2674
|
+
t.onAddProperty?.apply(this, w);
|
|
2675
|
+
}), E(v, d);
|
|
2676
|
+
};
|
|
2677
|
+
H(o, (v) => {
|
|
2678
|
+
t.onAddProperty && v(f);
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
var u = M(a, 2);
|
|
2682
|
+
{
|
|
2683
|
+
var h = (v) => {
|
|
2684
|
+
var d = Za(), w = T(d);
|
|
2685
|
+
R(() => F(w, t.field.description)), E(v, d);
|
|
2686
|
+
};
|
|
2687
|
+
H(u, (v) => {
|
|
2688
|
+
t.field.description && v(h);
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
var _ = M(u, 2);
|
|
2692
|
+
{
|
|
2693
|
+
var p = (v) => {
|
|
2694
|
+
var d = Qa(), w = C(d), x = T(w), D = M(w, 2);
|
|
2695
|
+
bt(D, 21, () => t.discriminator.options, (L) => L.value, (L, $) => {
|
|
2696
|
+
var V = Xa(), G = T(V), xe = {};
|
|
2697
|
+
R(() => {
|
|
2698
|
+
F(G, c($).label), xe !== (xe = c($).value) && (V.value = (V.__value = c($).value) ?? "");
|
|
2699
|
+
}), E(L, V);
|
|
2700
|
+
});
|
|
2701
|
+
var I;
|
|
2702
|
+
On(D), R(() => {
|
|
2703
|
+
F(x, t.discriminator.key), I !== (I = t.discriminator.value) && (D.value = (D.__value = t.discriminator.value) ?? "", Mr(D, t.discriminator.value));
|
|
2704
|
+
}), ce("input", D, (L) => t.discriminator.onchange(L.currentTarget.value)), E(v, d);
|
|
2705
|
+
};
|
|
2706
|
+
H(_, (v) => {
|
|
2707
|
+
t.discriminator && v(p);
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2710
|
+
var m = M(_, 2);
|
|
2711
|
+
bt(m, 18, () => t.orderedKeys, (v) => v, (v, d, w) => {
|
|
2712
|
+
const x = /* @__PURE__ */ S(() => t.childLookup.get(d)), D = /* @__PURE__ */ S(() => c(w) === 0), I = /* @__PURE__ */ S(() => c(w) === t.orderedKeys.length - 1);
|
|
2713
|
+
var L = no(), $ = T(L);
|
|
2714
|
+
{
|
|
2715
|
+
var V = (le) => {
|
|
2716
|
+
var fe = to(), Le = T(fe);
|
|
2717
|
+
{
|
|
2718
|
+
var rt = (ye) => {
|
|
2719
|
+
var de = $a(), Se = C(de), De = M(Se, 2);
|
|
2720
|
+
R(() => {
|
|
2721
|
+
Se.disabled = c(D), De.disabled = c(I);
|
|
2722
|
+
}), ce("click", Se, () => t.onMoveKey?.(d, -1)), ce("click", De, () => t.onMoveKey?.(d, 1)), E(ye, de);
|
|
2723
|
+
};
|
|
2724
|
+
H(Le, (ye) => {
|
|
2725
|
+
t.onMoveKey && t.orderedKeys.length > 1 && ye(rt);
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
var ut = M(Le, 2);
|
|
2729
|
+
{
|
|
2730
|
+
var At = (ye) => {
|
|
2731
|
+
var de = eo();
|
|
2732
|
+
ce("click", de, () => t.onRemoveProperty?.(d)), E(ye, de);
|
|
2733
|
+
};
|
|
2734
|
+
H(ut, (ye) => {
|
|
2735
|
+
c(x) || ye(At);
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
E(le, fe);
|
|
2739
|
+
};
|
|
2740
|
+
H($, (le) => {
|
|
2741
|
+
(t.onMoveKey && t.orderedKeys.length > 1 || !c(x)) && le(V);
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2744
|
+
var G = M($, 2);
|
|
2745
|
+
{
|
|
2746
|
+
var xe = (le) => {
|
|
2747
|
+
var fe = re(), Le = C(fe);
|
|
2748
|
+
Mt(Le, () => t.renderField, () => c(x), () => [c(x).key]), E(le, fe);
|
|
2749
|
+
}, W = (le) => {
|
|
2750
|
+
const fe = /* @__PURE__ */ S(() => c(i)[d]), Le = /* @__PURE__ */ S(() => (() => {
|
|
2751
|
+
if (typeof c(fe) == "string") return c(fe);
|
|
2752
|
+
if (c(fe) === void 0) return "";
|
|
2753
|
+
try {
|
|
2754
|
+
return JSON.stringify(c(fe), null, 2);
|
|
2755
|
+
} catch {
|
|
2756
|
+
return String(c(fe));
|
|
2757
|
+
}
|
|
2758
|
+
})());
|
|
2759
|
+
var rt = re(), ut = C(rt);
|
|
2760
|
+
{
|
|
2761
|
+
var At = (de) => {
|
|
2762
|
+
var Se = re(), De = C(Se);
|
|
2763
|
+
Mt(De, () => t.renderField, () => t.resolved.additionalProperties.schema, () => [d], () => ({ showLabel: !1 })), E(de, Se);
|
|
2764
|
+
}, ye = (de) => {
|
|
2765
|
+
var Se = ro(), De = C(Se), rr = T(De), Et = M(De, 2);
|
|
2766
|
+
st(Et, "rows", 3), R(() => {
|
|
2767
|
+
F(rr, d), Ct(Et, c(Le));
|
|
2768
|
+
}), ce("input", Et, (nr) => t.onchange({
|
|
2769
|
+
...c(i),
|
|
2770
|
+
[d]: Ea(nr.currentTarget.value)
|
|
2771
|
+
})), E(de, Se);
|
|
2772
|
+
};
|
|
2773
|
+
H(ut, (de) => {
|
|
2774
|
+
t.resolved.additionalProperties?.schema ? de(At) : de(ye, !1);
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
E(le, rt);
|
|
2778
|
+
};
|
|
2779
|
+
H(G, (le) => {
|
|
2780
|
+
c(x) ? le(xe) : le(W, !1);
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
E(v, L);
|
|
2784
|
+
}), R(() => F(l, c(r))), E(e, n), Pe();
|
|
2785
|
+
}
|
|
2786
|
+
et(["click", "input"]);
|
|
2787
|
+
var oo = /* @__PURE__ */ N('<p class="af-help svelte-zpgw7y"> </p>'), so = /* @__PURE__ */ N('<p class="af-help svelte-zpgw7y">Array item schema is not supported.</p>'), lo = /* @__PURE__ */ N('<div class="af-nested svelte-zpgw7y"><div class="af-move-row svelte-zpgw7y"><span class="af-help svelte-zpgw7y"></span> <button type="button" class="af-btn af-btn-danger svelte-zpgw7y">Remove</button></div> <!></div>'), fo = /* @__PURE__ */ N('<div class="af-label-row svelte-zpgw7y"><p class="af-label svelte-zpgw7y"> </p> <button type="button" class="af-btn af-btn-secondary svelte-zpgw7y">+ Item</button></div> <!> <!>', 1);
|
|
2788
|
+
function uo(e, t) {
|
|
2789
|
+
Ne(t, !0);
|
|
2790
|
+
const r = /* @__PURE__ */ S(() => tt(t.field));
|
|
2791
|
+
var i = fo(), n = C(i), a = T(n), s = T(a), l = M(a, 2), o = M(n, 2);
|
|
2792
|
+
{
|
|
2793
|
+
var f = (p) => {
|
|
2794
|
+
var m = oo(), v = T(m);
|
|
2795
|
+
R(() => F(v, t.field.description)), E(p, m);
|
|
2796
|
+
};
|
|
2797
|
+
H(o, (p) => {
|
|
2798
|
+
t.field.description && p(f);
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
var u = M(o, 2);
|
|
2802
|
+
{
|
|
2803
|
+
var h = (p) => {
|
|
2804
|
+
var m = so();
|
|
2805
|
+
E(p, m);
|
|
2806
|
+
}, _ = (p) => {
|
|
2807
|
+
var m = re(), v = C(m);
|
|
2808
|
+
bt(v, 17, () => Array(t.count), ta, (d, w, x) => {
|
|
2809
|
+
var D = lo(), I = T(D), L = T(I);
|
|
2810
|
+
L.textContent = `Item ${x + 1}`;
|
|
2811
|
+
var $ = M(L, 2), V = M(I, 2);
|
|
2812
|
+
Mt(V, () => t.renderField, () => t.items, () => [x], () => ({ showLabel: !1 })), ce("click", $, () => t.onRemove(x)), E(d, D);
|
|
2813
|
+
}), E(p, m);
|
|
2814
|
+
};
|
|
2815
|
+
H(u, (p) => {
|
|
2816
|
+
t.items ? p(_, !1) : p(h);
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
R(() => F(s, c(r))), ce("click", l, function(...p) {
|
|
2820
|
+
t.onAdd?.apply(this, p);
|
|
2821
|
+
}), E(e, i), Pe();
|
|
2822
|
+
}
|
|
2823
|
+
et(["click"]);
|
|
2824
|
+
var co = /* @__PURE__ */ N('<p class="af-help svelte-1a7i94f"> </p>'), vo = /* @__PURE__ */ N('<p class="af-label svelte-1a7i94f"> </p> <!> <p class="af-help svelte-1a7i94f"> </p>', 1);
|
|
2825
|
+
function _o(e, t) {
|
|
2826
|
+
Ne(t, !0);
|
|
2827
|
+
const r = /* @__PURE__ */ S(() => tt(t.field));
|
|
2828
|
+
var i = vo(), n = C(i), a = T(n), s = M(n, 2);
|
|
2829
|
+
{
|
|
2830
|
+
var l = (u) => {
|
|
2831
|
+
var h = co(), _ = T(h);
|
|
2832
|
+
R(() => F(_, t.field.description)), E(u, h);
|
|
2833
|
+
};
|
|
2834
|
+
H(s, (u) => {
|
|
2835
|
+
t.field.description && u(l);
|
|
2836
|
+
});
|
|
2837
|
+
}
|
|
2838
|
+
var o = M(s, 2), f = T(o);
|
|
2839
|
+
R(() => {
|
|
2840
|
+
F(a, c(r)), F(f, `Field type "${t.field.type ?? ""}" is not supported.`);
|
|
2841
|
+
}), E(e, i), Pe();
|
|
2842
|
+
}
|
|
2843
|
+
const ho = {
|
|
2844
|
+
Form: ja,
|
|
2845
|
+
String: Ca,
|
|
2846
|
+
Number: Fa,
|
|
2847
|
+
Boolean: Va,
|
|
2848
|
+
Date: za,
|
|
2849
|
+
Enum: Ya,
|
|
2850
|
+
Object: ao,
|
|
2851
|
+
Array: uo,
|
|
2852
|
+
Unknown: _o
|
|
2853
|
+
};
|
|
2854
|
+
function wo(e) {
|
|
2855
|
+
return { toJSONSchema: e };
|
|
2856
|
+
}
|
|
2857
|
+
function po(e) {
|
|
2858
|
+
return "type" in e || "properties" in e || "items" in e || "enum" in e || "anyOf" in e || "oneOf" in e || "required" in e || "additionalProperties" in e || "format" in e || "$ref" in e;
|
|
2859
|
+
}
|
|
2860
|
+
const mo = {
|
|
2861
|
+
toJSONSchema(e) {
|
|
2862
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
2863
|
+
throw new Error(
|
|
2864
|
+
"jsonSchemaAdapter expected a JSON Schema object. Pass adapter for non-JSON schema libraries."
|
|
2865
|
+
);
|
|
2866
|
+
if (!po(e))
|
|
2867
|
+
throw new Error(
|
|
2868
|
+
"Invalid JSON Schema: missing core schema keys. If you are using Zod or another schema library, pass its adapter."
|
|
2869
|
+
);
|
|
2870
|
+
return e;
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
function Ao(e, t) {
|
|
2874
|
+
Ne(t, !0);
|
|
2875
|
+
const r = (b, y = Re, g = Re, j = Re) => {
|
|
2876
|
+
const A = /* @__PURE__ */ S(() => We(c(v), ...g())), O = /* @__PURE__ */ S(() => y().enumValues && y().enumValues.length > 0 ? y().enumValues : null), k = /* @__PURE__ */ S(() => c(f));
|
|
2877
|
+
var Y = re(), ie = C(Y);
|
|
2878
|
+
{
|
|
2879
|
+
var ae = (q) => {
|
|
2880
|
+
const J = /* @__PURE__ */ S(() => c(A) === void 0 ? null : Wt(c(A))), oe = /* @__PURE__ */ S(() => c(J) && c(O).some((Z) => Z.key === c(J)) ? c(J) : "");
|
|
2881
|
+
var z = re(), ue = C(z);
|
|
2882
|
+
Ve(ue, () => c(k).Enum, (Z, nt) => {
|
|
2883
|
+
nt(Z, {
|
|
2884
|
+
get field() {
|
|
2885
|
+
return y();
|
|
2886
|
+
},
|
|
2887
|
+
get value() {
|
|
2888
|
+
return c(A);
|
|
2889
|
+
},
|
|
2890
|
+
onchange: (Me) => W(g(), Me),
|
|
2891
|
+
get options() {
|
|
2892
|
+
return c(O);
|
|
2893
|
+
},
|
|
2894
|
+
get selectedKey() {
|
|
2895
|
+
return c(oe);
|
|
2896
|
+
}
|
|
2897
|
+
});
|
|
2898
|
+
}), E(q, z);
|
|
2899
|
+
}, U = (q) => {
|
|
2900
|
+
const J = (Ge, or = Re, sr = Re, Ce = Re) => {
|
|
2901
|
+
{
|
|
2902
|
+
let xt = /* @__PURE__ */ S(() => [...g(), ...sr()]);
|
|
2903
|
+
r(Ge, or, () => c(xt), Ce);
|
|
2904
|
+
}
|
|
2905
|
+
}, oe = /* @__PURE__ */ S(() => c(A) && typeof c(A) == "object" && !Array.isArray(c(A)) ? c(A) : {}), z = /* @__PURE__ */ S(() => dr(y(), c(oe))), ue = /* @__PURE__ */ S(() => pa(y())), Z = /* @__PURE__ */ S(() => rt(g(), y(), c(oe), c(z).children, c(z).discriminatorKey ? [c(z).discriminatorKey] : [])), nt = /* @__PURE__ */ S(() => new Map(c(z).children.map((Ge) => [Ge.key, Ge])));
|
|
2906
|
+
var Me = re(), ar = C(Me);
|
|
2907
|
+
{
|
|
2908
|
+
let Ge = /* @__PURE__ */ S(() => c(z).additionalProperties?.allowAny ? () => rr(g(), y(), c(z).additionalProperties) : void 0), or = /* @__PURE__ */ S(() => c(ue) ? (Ce, xt) => At(g(), y(), Ce, xt) : void 0), sr = /* @__PURE__ */ S(() => y().discriminatedUnion ? {
|
|
2909
|
+
key: y().discriminatedUnion.discriminatorKey,
|
|
2910
|
+
value: c(z).activeOption?.value ?? "",
|
|
2911
|
+
options: y().discriminatedUnion.options.map((Ce) => ({ value: Ce.value, label: Ce.label })),
|
|
2912
|
+
onchange: (Ce) => de(g(), y(), Ce)
|
|
2913
|
+
} : void 0);
|
|
2914
|
+
Ve(ar, () => c(k).Object, (Ce, xt) => {
|
|
2915
|
+
xt(Ce, {
|
|
2916
|
+
get field() {
|
|
2917
|
+
return y();
|
|
2918
|
+
},
|
|
2919
|
+
get value() {
|
|
2920
|
+
return c(A);
|
|
2921
|
+
},
|
|
2922
|
+
onchange: (lr) => W(g(), lr),
|
|
2923
|
+
get resolved() {
|
|
2924
|
+
return c(z);
|
|
2925
|
+
},
|
|
2926
|
+
get orderedKeys() {
|
|
2927
|
+
return c(Z);
|
|
2928
|
+
},
|
|
2929
|
+
get childLookup() {
|
|
2930
|
+
return c(nt);
|
|
2931
|
+
},
|
|
2932
|
+
get renderField() {
|
|
2933
|
+
return J;
|
|
2934
|
+
},
|
|
2935
|
+
get onAddProperty() {
|
|
2936
|
+
return c(Ge);
|
|
2937
|
+
},
|
|
2938
|
+
onRemoveProperty: (lr) => Et(g(), lr),
|
|
2939
|
+
get onMoveKey() {
|
|
2940
|
+
return c(or);
|
|
2941
|
+
},
|
|
2942
|
+
get discriminator() {
|
|
2943
|
+
return c(sr);
|
|
2944
|
+
}
|
|
2945
|
+
});
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
E(q, Me);
|
|
2949
|
+
}, _e = (q) => {
|
|
2950
|
+
const J = (Z, nt = Re, Me = Re, ar = Re) => {
|
|
2951
|
+
{
|
|
2952
|
+
let Ge = /* @__PURE__ */ S(() => [...g(), ...Me()]);
|
|
2953
|
+
r(Z, nt, () => c(Ge), ar);
|
|
2954
|
+
}
|
|
2955
|
+
}, oe = /* @__PURE__ */ S(() => Array.isArray(c(A)) ? c(A) : []);
|
|
2956
|
+
var z = re(), ue = C(z);
|
|
2957
|
+
Ve(ue, () => c(k).Array, (Z, nt) => {
|
|
2958
|
+
nt(Z, {
|
|
2959
|
+
get field() {
|
|
2960
|
+
return y();
|
|
2961
|
+
},
|
|
2962
|
+
get value() {
|
|
2963
|
+
return c(A);
|
|
2964
|
+
},
|
|
2965
|
+
onchange: (Me) => W(g(), Me),
|
|
2966
|
+
get items() {
|
|
2967
|
+
return y().items;
|
|
2968
|
+
},
|
|
2969
|
+
get count() {
|
|
2970
|
+
return c(oe).length;
|
|
2971
|
+
},
|
|
2972
|
+
get renderField() {
|
|
2973
|
+
return J;
|
|
2974
|
+
},
|
|
2975
|
+
onAdd: () => Se(g(), y()),
|
|
2976
|
+
onRemove: (Me) => ba(c(v), g(), Me)
|
|
2977
|
+
});
|
|
2978
|
+
}), E(q, z);
|
|
2979
|
+
}, he = (q) => {
|
|
2980
|
+
var J = re(), oe = C(J);
|
|
2981
|
+
Ve(oe, () => c(k).Boolean, (z, ue) => {
|
|
2982
|
+
ue(z, {
|
|
2983
|
+
get field() {
|
|
2984
|
+
return y();
|
|
2985
|
+
},
|
|
2986
|
+
get value() {
|
|
2987
|
+
return c(A);
|
|
2988
|
+
},
|
|
2989
|
+
onchange: (Z) => W(g(), Z)
|
|
2990
|
+
});
|
|
2991
|
+
}), E(q, J);
|
|
2992
|
+
}, ir = (q) => {
|
|
2993
|
+
var J = re(), oe = C(J);
|
|
2994
|
+
Ve(oe, () => c(k).Number, (z, ue) => {
|
|
2995
|
+
ue(z, {
|
|
2996
|
+
get field() {
|
|
2997
|
+
return y();
|
|
2998
|
+
},
|
|
2999
|
+
get value() {
|
|
3000
|
+
return c(A);
|
|
3001
|
+
},
|
|
3002
|
+
onchange: (Z) => W(g(), Z)
|
|
3003
|
+
});
|
|
3004
|
+
}), E(q, J);
|
|
3005
|
+
}, Mn = (q) => {
|
|
3006
|
+
var J = re(), oe = C(J);
|
|
3007
|
+
Ve(oe, () => c(k).String, (z, ue) => {
|
|
3008
|
+
ue(z, {
|
|
3009
|
+
get field() {
|
|
3010
|
+
return y();
|
|
3011
|
+
},
|
|
3012
|
+
get value() {
|
|
3013
|
+
return c(A);
|
|
3014
|
+
},
|
|
3015
|
+
onchange: (Z) => W(g(), Z)
|
|
3016
|
+
});
|
|
3017
|
+
}), E(q, J);
|
|
3018
|
+
}, Cn = (q) => {
|
|
3019
|
+
var J = re(), oe = C(J);
|
|
3020
|
+
Ve(oe, () => c(k).Date, (z, ue) => {
|
|
3021
|
+
ue(z, {
|
|
3022
|
+
get field() {
|
|
3023
|
+
return y();
|
|
3024
|
+
},
|
|
3025
|
+
get value() {
|
|
3026
|
+
return c(A);
|
|
3027
|
+
},
|
|
3028
|
+
onchange: (Z) => W(g(), Z)
|
|
3029
|
+
});
|
|
3030
|
+
}), E(q, J);
|
|
3031
|
+
}, Rn = (q) => {
|
|
3032
|
+
var J = re(), oe = C(J);
|
|
3033
|
+
Ve(oe, () => c(k).Unknown, (z, ue) => {
|
|
3034
|
+
ue(z, {
|
|
3035
|
+
get field() {
|
|
3036
|
+
return y();
|
|
3037
|
+
},
|
|
3038
|
+
get value() {
|
|
3039
|
+
return c(A);
|
|
3040
|
+
},
|
|
3041
|
+
onchange: (Z) => W(g(), Z)
|
|
3042
|
+
});
|
|
3043
|
+
}), E(q, J);
|
|
3044
|
+
};
|
|
3045
|
+
H(ie, (q) => {
|
|
3046
|
+
c(O) ? q(ae) : y().type === "object" ? q(U, 1) : y().type === "array" ? q(_e, 2) : y().type === "boolean" ? q(he, 3) : y().type === "number" || y().type === "integer" ? q(ir, 4) : y().type === "string" ? q(Mn, 5) : y().type === "date" ? q(Cn, 6) : q(Rn, !1);
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
E(b, Y);
|
|
3050
|
+
}, i = In();
|
|
3051
|
+
let n = cr(t, "data", 31, () => ke({})), a = cr(t, "submitLabel", 3, "Save"), s = cr(t, "cancelLabel", 3, "Cancel");
|
|
3052
|
+
const l = Ir("autoform-theme"), o = Ir("autoform-adapter"), f = /* @__PURE__ */ S(() => t.theme ?? l?.() ?? ho), u = /* @__PURE__ */ S(() => t.adapter ?? o?.() ?? mo);
|
|
3053
|
+
function h() {
|
|
3054
|
+
return { type: "object", properties: {} };
|
|
3055
|
+
}
|
|
3056
|
+
function _(b, y) {
|
|
3057
|
+
try {
|
|
3058
|
+
const g = b.toJSONSchema(y);
|
|
3059
|
+
return !g || typeof g != "object" || Array.isArray(g) ? h() : g;
|
|
3060
|
+
} catch {
|
|
3061
|
+
return h();
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
const p = /* @__PURE__ */ S(() => _(c(u), t.schema)), m = /* @__PURE__ */ S(() => _a(c(p)).fields);
|
|
3065
|
+
let v = /* @__PURE__ */ we(ke(structuredClone(ct(n()) || {}))), d = /* @__PURE__ */ we(ke(structuredClone(ct(n()) || {}))), w = /* @__PURE__ */ we(ke([])), x = /* @__PURE__ */ we(ke(/* @__PURE__ */ new Map()));
|
|
3066
|
+
const D = /* @__PURE__ */ new Map();
|
|
3067
|
+
let I = !1, L = !1;
|
|
3068
|
+
function $(b, y) {
|
|
3069
|
+
return Object.prototype.hasOwnProperty.call(b, y);
|
|
3070
|
+
}
|
|
3071
|
+
function V(b, y) {
|
|
3072
|
+
if (!b || typeof b != "object" || Array.isArray(b)) return !1;
|
|
3073
|
+
const g = $(b, y.key), j = g ? b[y.key] : void 0;
|
|
3074
|
+
if (!g || j === void 0)
|
|
3075
|
+
return b[y.key] = pt(y), !0;
|
|
3076
|
+
if (y.type !== "object" || !j || typeof j != "object" || Array.isArray(j)) return !1;
|
|
3077
|
+
const A = j;
|
|
3078
|
+
let O = !1;
|
|
3079
|
+
if (y.discriminatedUnion) {
|
|
3080
|
+
const k = dr(y, A), Y = k.discriminatorKey;
|
|
3081
|
+
Y && A[Y] === void 0 && k.activeOption && (A[Y] = k.activeOption.value, O = !0);
|
|
3082
|
+
for (const ie of k.children)
|
|
3083
|
+
O = V(A, ie) || O;
|
|
3084
|
+
return O;
|
|
3085
|
+
}
|
|
3086
|
+
for (const k of y.children ?? [])
|
|
3087
|
+
O = V(A, k) || O;
|
|
3088
|
+
return O;
|
|
3089
|
+
}
|
|
3090
|
+
function G(b, y) {
|
|
3091
|
+
let g = !1;
|
|
3092
|
+
for (const j of y)
|
|
3093
|
+
g = V(b, j) || g;
|
|
3094
|
+
return g;
|
|
3095
|
+
}
|
|
3096
|
+
function xe() {
|
|
3097
|
+
const b = structuredClone(ct(c(v)) || {});
|
|
3098
|
+
return L = !0, n(b), b;
|
|
3099
|
+
}
|
|
3100
|
+
ur(() => {
|
|
3101
|
+
const b = structuredClone(ct(n()) || {});
|
|
3102
|
+
if (G(b, c(m)), L) {
|
|
3103
|
+
L = !1;
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
I = !0, X(v, b, !0), X(d, structuredClone(b), !0), X(x, /* @__PURE__ */ new Map(), !0), X(w, [], !0), queueMicrotask(() => {
|
|
3107
|
+
I = !1;
|
|
3108
|
+
});
|
|
3109
|
+
}), ur(() => {
|
|
3110
|
+
I || xe();
|
|
3111
|
+
}), ur(() => {
|
|
3112
|
+
G(c(v), c(m)), G(c(d), c(m));
|
|
3113
|
+
});
|
|
3114
|
+
function W(b, y) {
|
|
3115
|
+
Ot(c(v), b, y), ye(b.slice(0, -1));
|
|
3116
|
+
}
|
|
3117
|
+
function le(b) {
|
|
3118
|
+
return b.length ? b.map((y) => typeof y == "number" ? `[${y}]` : y).join(".") : "__root__";
|
|
3119
|
+
}
|
|
3120
|
+
function fe(b, y) {
|
|
3121
|
+
const g = le(b), j = c(x).get(g);
|
|
3122
|
+
if (j && j.length === y.length && j.every((O, k) => O === y[k]))
|
|
3123
|
+
return;
|
|
3124
|
+
const A = new Map(c(x));
|
|
3125
|
+
A.set(g, y), X(x, A, !0), D.delete(g);
|
|
3126
|
+
}
|
|
3127
|
+
function Le(b, y) {
|
|
3128
|
+
const g = le(b), j = D.get(g);
|
|
3129
|
+
j && j.length === y.length && j.every((A, O) => A === y[O]) || (D.set(g, y), queueMicrotask(() => {
|
|
3130
|
+
const A = D.get(g);
|
|
3131
|
+
A && (D.delete(g), fe(b, A));
|
|
3132
|
+
}));
|
|
3133
|
+
}
|
|
3134
|
+
function rt(b, y, g, j, A = []) {
|
|
3135
|
+
const O = le(b), k = j.map((he) => he.key), Y = new Set(A), ie = g && typeof g == "object" && !Array.isArray(g) ? Object.keys(g).filter((he) => !k.includes(he) && !Y.has(he)) : [], ae = [...k, ...ie], U = c(x).get(O);
|
|
3136
|
+
if (!U)
|
|
3137
|
+
return Le(b, ae), ae;
|
|
3138
|
+
const _e = U.filter((he) => ae.includes(he));
|
|
3139
|
+
for (const he of ae)
|
|
3140
|
+
_e.includes(he) || _e.push(he);
|
|
3141
|
+
return _e.length !== U.length || _e.some((he, ir) => he !== U[ir]) ? (Le(b, _e), _e) : U;
|
|
3142
|
+
}
|
|
3143
|
+
function ut(b, y) {
|
|
3144
|
+
if (!y.length) return;
|
|
3145
|
+
const g = We(c(v), ...b);
|
|
3146
|
+
if (!g || typeof g != "object" || Array.isArray(g)) return;
|
|
3147
|
+
const j = {};
|
|
3148
|
+
for (const A of y)
|
|
3149
|
+
A in g && (j[A] = g[A]);
|
|
3150
|
+
for (const A of Object.keys(g))
|
|
3151
|
+
y.includes(A) || (j[A] = g[A]);
|
|
3152
|
+
Ot(c(v), b, j);
|
|
3153
|
+
}
|
|
3154
|
+
function At(b, y, g, j) {
|
|
3155
|
+
const A = We(c(v), ...b), O = dr(y, A), k = rt(b, y, A, O.children, O.discriminatorKey ? [O.discriminatorKey] : []), Y = k.indexOf(g);
|
|
3156
|
+
if (Y === -1) return;
|
|
3157
|
+
const ie = Y + j;
|
|
3158
|
+
if (ie < 0 || ie >= k.length) return;
|
|
3159
|
+
const ae = k.slice();
|
|
3160
|
+
ae.splice(Y, 1), ae.splice(ie, 0, g), fe(b, ae), ut(b, ae);
|
|
3161
|
+
}
|
|
3162
|
+
function ye(b) {
|
|
3163
|
+
if (!b.length) return;
|
|
3164
|
+
const y = c(x).get(le(b));
|
|
3165
|
+
y && ut(b, y);
|
|
3166
|
+
}
|
|
3167
|
+
function de(b, y, g) {
|
|
3168
|
+
const j = y.discriminatedUnion;
|
|
3169
|
+
if (!j) return;
|
|
3170
|
+
const A = j.options.find((U) => U.value === g);
|
|
3171
|
+
if (!A) return;
|
|
3172
|
+
De(b);
|
|
3173
|
+
const O = We(c(v), ...b), k = j.discriminatorKey, Y = {};
|
|
3174
|
+
Y[k] = A.value;
|
|
3175
|
+
const ie = /* @__PURE__ */ new Set();
|
|
3176
|
+
for (const U of A.field.children ?? []) {
|
|
3177
|
+
if (ie.add(U.key), U.key === k) continue;
|
|
3178
|
+
const _e = O && Object.prototype.hasOwnProperty.call(O, U.key) ? O[U.key] : void 0;
|
|
3179
|
+
Y[U.key] = _e === void 0 ? pt(U) : _e;
|
|
3180
|
+
}
|
|
3181
|
+
if (O && typeof O == "object" && !Array.isArray(O))
|
|
3182
|
+
for (const [U, _e] of Object.entries(O))
|
|
3183
|
+
U !== k && (ie.has(U) || (Y[U] = _e));
|
|
3184
|
+
Ot(c(v), b, Y);
|
|
3185
|
+
const ae = (A.field.children ?? []).map((U) => U.key).filter((U) => U !== k);
|
|
3186
|
+
fe(b, ae), ye(b);
|
|
3187
|
+
}
|
|
3188
|
+
function Se(b, y) {
|
|
3189
|
+
ya(c(v), b, y);
|
|
3190
|
+
}
|
|
3191
|
+
function De(b) {
|
|
3192
|
+
const y = We(c(v), ...b);
|
|
3193
|
+
(y == null || typeof y != "object" || Array.isArray(y)) && Ot(c(v), b, {});
|
|
3194
|
+
}
|
|
3195
|
+
function rr(b, y, g) {
|
|
3196
|
+
const j = g ?? y.additionalProperties;
|
|
3197
|
+
if (!j?.allowAny) return;
|
|
3198
|
+
const A = prompt("Property name");
|
|
3199
|
+
if (!A) return;
|
|
3200
|
+
const O = A.trim();
|
|
3201
|
+
if (!O) return;
|
|
3202
|
+
De(b);
|
|
3203
|
+
const k = We(c(v), ...b);
|
|
3204
|
+
if (!k) return;
|
|
3205
|
+
if (O in k) {
|
|
3206
|
+
X(w, [`Property "${O}" already exists.`], !0);
|
|
3207
|
+
return;
|
|
3208
|
+
}
|
|
3209
|
+
const Y = j.schema ? pt(j.schema) : null;
|
|
3210
|
+
Ot(c(v), [...b, O], Y);
|
|
3211
|
+
}
|
|
3212
|
+
function Et(b, y) {
|
|
3213
|
+
const g = We(c(v), ...b);
|
|
3214
|
+
!g || typeof g != "object" || Array.isArray(g) || delete g[y];
|
|
3215
|
+
}
|
|
3216
|
+
function nr() {
|
|
3217
|
+
X(w, [], !0);
|
|
3218
|
+
const b = xa(c(p), c(v));
|
|
3219
|
+
if (!b.ok) {
|
|
3220
|
+
X(w, b.errors, !0), i("error", { errors: b.errors });
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
X(d, structuredClone(ct(c(v)) || {}), !0);
|
|
3224
|
+
const y = xe();
|
|
3225
|
+
i("submit", { data: structuredClone(y) });
|
|
3226
|
+
}
|
|
3227
|
+
function Nn() {
|
|
3228
|
+
X(v, structuredClone(ct(c(d)) || {}), !0), X(w, [], !0), i("cancel");
|
|
3229
|
+
}
|
|
3230
|
+
var Rr = re(), Pn = C(Rr);
|
|
3231
|
+
{
|
|
3232
|
+
var Dn = (b) => {
|
|
3233
|
+
const y = /* @__PURE__ */ S(() => c(f));
|
|
3234
|
+
var g = re(), j = C(g);
|
|
3235
|
+
{
|
|
3236
|
+
const A = (O) => {
|
|
3237
|
+
var k = re(), Y = C(k);
|
|
3238
|
+
bt(Y, 17, () => c(m), (ie) => ie.key, (ie, ae) => {
|
|
3239
|
+
r(ie, () => c(ae), () => [c(ae).key]);
|
|
3240
|
+
}), E(O, k);
|
|
3241
|
+
};
|
|
3242
|
+
Ve(j, () => c(y).Form, (O, k) => {
|
|
3243
|
+
k(O, {
|
|
3244
|
+
get title() {
|
|
3245
|
+
return t.title;
|
|
3246
|
+
},
|
|
3247
|
+
get errors() {
|
|
3248
|
+
return c(w);
|
|
3249
|
+
},
|
|
3250
|
+
get submitLabel() {
|
|
3251
|
+
return a();
|
|
3252
|
+
},
|
|
3253
|
+
get cancelLabel() {
|
|
3254
|
+
return s();
|
|
3255
|
+
},
|
|
3256
|
+
onsubmit: nr,
|
|
3257
|
+
oncancel: Nn,
|
|
3258
|
+
children: A,
|
|
3259
|
+
$$slots: { default: !0 }
|
|
3260
|
+
});
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
E(b, g);
|
|
3264
|
+
};
|
|
3265
|
+
H(Pn, (b) => {
|
|
3266
|
+
b(Dn);
|
|
3267
|
+
});
|
|
3268
|
+
}
|
|
3269
|
+
E(e, Rr), Pe();
|
|
3270
|
+
}
|
|
3271
|
+
function Eo(e, t) {
|
|
3272
|
+
Ne(t, !0), Fr("autoform-theme", () => t.theme), Fr("autoform-adapter", () => t.adapter);
|
|
3273
|
+
var r = re(), i = C(r);
|
|
3274
|
+
Mt(i, () => t.children), E(e, r), Pe();
|
|
3275
|
+
}
|
|
3276
|
+
export {
|
|
3277
|
+
Ao as Autoform,
|
|
3278
|
+
Eo as AutoformProvider,
|
|
3279
|
+
ya as arrayPush,
|
|
3280
|
+
ba as arrayRemove,
|
|
3281
|
+
Ot as assignSafeObject,
|
|
3282
|
+
wo as createCustomAdapter,
|
|
3283
|
+
Ao as default,
|
|
3284
|
+
pt as defaultForParsed,
|
|
3285
|
+
ma as ensureArray,
|
|
3286
|
+
Wt as enumValueKey,
|
|
3287
|
+
kn as enumValueLabel,
|
|
3288
|
+
go as fieldWithKey,
|
|
3289
|
+
wa as fromNumberInput,
|
|
3290
|
+
We as getNestedValue,
|
|
3291
|
+
pa as isObjectReorderable,
|
|
3292
|
+
mo as jsonSchemaAdapter,
|
|
3293
|
+
ho as nativeTheme,
|
|
3294
|
+
ht as parseField,
|
|
3295
|
+
_a as parseJsonSchema,
|
|
3296
|
+
tt as resolveFieldLabel,
|
|
3297
|
+
dr as resolveObjectSchema,
|
|
3298
|
+
tr as resolvePlaceholder,
|
|
3299
|
+
ha as resolveStringWidget,
|
|
3300
|
+
Ea as safeParseJson,
|
|
3301
|
+
Rt as schemaNodeType,
|
|
3302
|
+
Aa as toDatetimeLocal,
|
|
3303
|
+
ga as toNumberInput,
|
|
3304
|
+
xa as validateJson
|
|
3305
|
+
};
|