@tanstack/query-devtools 5.101.3 → 5.102.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/build/Devtools-B8gBVih5.js +11463 -0
- package/build/Devtools-C2baIe1r.cjs +1248 -0
- package/build/Devtools-CFKbGy8Z.js +1249 -0
- package/build/Devtools-CFKbGy8Z.js.map +1 -0
- package/build/Devtools-QIchsTu4.cjs +11510 -0
- package/build/DevtoolsComponent-B932o_Kt.cjs +1 -0
- package/build/DevtoolsComponent-CFsAhafd.js +34 -0
- package/build/DevtoolsComponent-Cb-WvQCr.js +2 -0
- package/build/DevtoolsComponent-Cb-WvQCr.js.map +1 -0
- package/build/DevtoolsComponent-ChtbiwqS.cjs +34 -0
- package/build/DevtoolsPanelComponent-B9zkHqmD.js +41 -0
- package/build/DevtoolsPanelComponent-Be8narGM.js +2 -0
- package/build/DevtoolsPanelComponent-Be8narGM.js.map +1 -0
- package/build/DevtoolsPanelComponent-CHpU_w5-.cjs +41 -0
- package/build/DevtoolsPanelComponent-Dm3BbKKd.cjs +1 -0
- package/build/dev.cjs +241 -16792
- package/build/dev.js +236 -274
- package/build/index.cjs +1 -16791
- package/build/index.d.cts +55 -51
- package/build/index.d.cts.map +1 -0
- package/build/index.d.ts +55 -51
- package/build/index.d.ts.map +1 -0
- package/build/index.js +2 -279
- package/build/index.js.map +1 -0
- package/build/utils-BLwigsFG.cjs +2942 -0
- package/build/utils-BPMMmTje.js +2 -0
- package/build/utils-BPMMmTje.js.map +1 -0
- package/build/utils-CESniQp_.js +2613 -0
- package/build/utils-DzxoHwL2.cjs +1 -0
- package/package.json +6 -8
- package/build/DevtoolsComponent/SO26Z5QU.js +0 -38
- package/build/DevtoolsComponent/ZXV6FBN7.js +0 -38
- package/build/DevtoolsPanelComponent/MO2VZFYH.js +0 -47
- package/build/DevtoolsPanelComponent/MYKLHYJZ.js +0 -47
- package/build/chunk/M4GWWVAC.js +0 -2915
- package/build/chunk/OJ5GAW4I.js +0 -12753
- package/build/chunk/RQBHRHJL.js +0 -12751
- package/build/chunk/ZCXR2IAF.js +0 -2914
|
@@ -0,0 +1,2613 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/dist/solid.js
|
|
2
|
+
const sharedConfig = {
|
|
3
|
+
context: void 0,
|
|
4
|
+
registry: void 0,
|
|
5
|
+
effects: void 0,
|
|
6
|
+
done: false,
|
|
7
|
+
getContextId() {
|
|
8
|
+
return getContextId(this.context.count);
|
|
9
|
+
},
|
|
10
|
+
getNextContextId() {
|
|
11
|
+
return getContextId(this.context.count++);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function getContextId(count) {
|
|
15
|
+
const num = String(count), len = num.length - 1;
|
|
16
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
17
|
+
}
|
|
18
|
+
function setHydrateContext(context) {
|
|
19
|
+
sharedConfig.context = context;
|
|
20
|
+
}
|
|
21
|
+
const equalFn = (a, b) => a === b;
|
|
22
|
+
const $PROXY = Symbol("solid-proxy");
|
|
23
|
+
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
24
|
+
const $TRACK = Symbol("solid-track");
|
|
25
|
+
const signalOptions = { equals: equalFn };
|
|
26
|
+
let runEffects = runQueue;
|
|
27
|
+
const STALE = 1;
|
|
28
|
+
const PENDING = 2;
|
|
29
|
+
const UNOWNED = {
|
|
30
|
+
owned: null,
|
|
31
|
+
cleanups: null,
|
|
32
|
+
context: null,
|
|
33
|
+
owner: null
|
|
34
|
+
};
|
|
35
|
+
const NO_INIT = {};
|
|
36
|
+
var Owner = null;
|
|
37
|
+
let Transition = null;
|
|
38
|
+
let Listener = null;
|
|
39
|
+
let Updates = null;
|
|
40
|
+
let Effects = null;
|
|
41
|
+
let ExecCount = 0;
|
|
42
|
+
function createRoot(fn, detachedOwner) {
|
|
43
|
+
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
44
|
+
owned: null,
|
|
45
|
+
cleanups: null,
|
|
46
|
+
context: current ? current.context : null,
|
|
47
|
+
owner: current
|
|
48
|
+
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
49
|
+
Owner = root;
|
|
50
|
+
Listener = null;
|
|
51
|
+
try {
|
|
52
|
+
return runUpdates(updateFn, true);
|
|
53
|
+
} finally {
|
|
54
|
+
Listener = listener;
|
|
55
|
+
Owner = owner;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function createSignal(value, options) {
|
|
59
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
60
|
+
const s = {
|
|
61
|
+
value,
|
|
62
|
+
observers: null,
|
|
63
|
+
observerSlots: null,
|
|
64
|
+
comparator: options.equals || void 0
|
|
65
|
+
};
|
|
66
|
+
const setter = (value) => {
|
|
67
|
+
if (typeof value === "function") {
|
|
68
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
69
|
+
else value = value(s.value);
|
|
70
|
+
}
|
|
71
|
+
return writeSignal(s, value);
|
|
72
|
+
};
|
|
73
|
+
return [readSignal.bind(s), setter];
|
|
74
|
+
}
|
|
75
|
+
function createComputed(fn, value, options) {
|
|
76
|
+
updateComputation(createComputation(fn, value, true, STALE));
|
|
77
|
+
}
|
|
78
|
+
function createRenderEffect(fn, value, options) {
|
|
79
|
+
updateComputation(createComputation(fn, value, false, STALE));
|
|
80
|
+
}
|
|
81
|
+
function createEffect(fn, value, options) {
|
|
82
|
+
runEffects = runUserEffects;
|
|
83
|
+
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
84
|
+
if (s) c.suspense = s;
|
|
85
|
+
if (!options || !options.render) c.user = true;
|
|
86
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
87
|
+
}
|
|
88
|
+
function createMemo(fn, value, options) {
|
|
89
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
90
|
+
const c = createComputation(fn, value, true, 0);
|
|
91
|
+
c.observers = null;
|
|
92
|
+
c.observerSlots = null;
|
|
93
|
+
c.comparator = options.equals || void 0;
|
|
94
|
+
updateComputation(c);
|
|
95
|
+
return readSignal.bind(c);
|
|
96
|
+
}
|
|
97
|
+
function isPromise(v) {
|
|
98
|
+
return v && typeof v === "object" && "then" in v;
|
|
99
|
+
}
|
|
100
|
+
function createResource(pSource, pFetcher, pOptions) {
|
|
101
|
+
let source;
|
|
102
|
+
let fetcher;
|
|
103
|
+
let options;
|
|
104
|
+
if (typeof pFetcher === "function") {
|
|
105
|
+
source = pSource;
|
|
106
|
+
fetcher = pFetcher;
|
|
107
|
+
options = pOptions || {};
|
|
108
|
+
} else {
|
|
109
|
+
source = true;
|
|
110
|
+
fetcher = pSource;
|
|
111
|
+
options = pFetcher || {};
|
|
112
|
+
}
|
|
113
|
+
let pr = null, initP = NO_INIT, id = null, loadedUnderTransition = false, scheduled = false, resolved = "initialValue" in options, dynamic = typeof source === "function" && createMemo(source);
|
|
114
|
+
const contexts = /* @__PURE__ */ new Set(), [value, setValue] = (options.storage || createSignal)(options.initialValue), [error, setError] = createSignal(void 0), [track, trigger] = createSignal(void 0, { equals: false }), [state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
115
|
+
if (sharedConfig.context) {
|
|
116
|
+
id = sharedConfig.getNextContextId();
|
|
117
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
118
|
+
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
119
|
+
}
|
|
120
|
+
function loadEnd(p, v, error, key) {
|
|
121
|
+
if (pr === p) {
|
|
122
|
+
pr = null;
|
|
123
|
+
key !== void 0 && (resolved = true);
|
|
124
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, { value: v }));
|
|
125
|
+
initP = NO_INIT;
|
|
126
|
+
if (Transition && p && loadedUnderTransition) {
|
|
127
|
+
Transition.promises.delete(p);
|
|
128
|
+
loadedUnderTransition = false;
|
|
129
|
+
runUpdates(() => {
|
|
130
|
+
Transition.running = true;
|
|
131
|
+
completeLoad(v, error);
|
|
132
|
+
}, false);
|
|
133
|
+
} else completeLoad(v, error);
|
|
134
|
+
}
|
|
135
|
+
return v;
|
|
136
|
+
}
|
|
137
|
+
function completeLoad(v, err) {
|
|
138
|
+
runUpdates(() => {
|
|
139
|
+
if (err === void 0) setValue(() => v);
|
|
140
|
+
setState(err !== void 0 ? "errored" : resolved ? "ready" : "unresolved");
|
|
141
|
+
setError(err);
|
|
142
|
+
for (const c of contexts.keys()) c.decrement();
|
|
143
|
+
contexts.clear();
|
|
144
|
+
}, false);
|
|
145
|
+
}
|
|
146
|
+
function read() {
|
|
147
|
+
const c = SuspenseContext && useContext(SuspenseContext), v = value(), err = error();
|
|
148
|
+
if (err !== void 0 && !pr) throw err;
|
|
149
|
+
if (Listener && !Listener.user && c) createComputed(() => {
|
|
150
|
+
track();
|
|
151
|
+
if (pr) {
|
|
152
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
153
|
+
else if (!contexts.has(c)) {
|
|
154
|
+
c.increment();
|
|
155
|
+
contexts.add(c);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return v;
|
|
160
|
+
}
|
|
161
|
+
function load(refetching = true) {
|
|
162
|
+
if (refetching !== false && scheduled) return;
|
|
163
|
+
scheduled = false;
|
|
164
|
+
const lookup = dynamic ? dynamic() : source;
|
|
165
|
+
loadedUnderTransition = Transition && Transition.running;
|
|
166
|
+
if (lookup == null || lookup === false) {
|
|
167
|
+
loadEnd(pr, untrack(value));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (Transition && pr) Transition.promises.delete(pr);
|
|
171
|
+
let error;
|
|
172
|
+
const p = initP !== NO_INIT ? initP : untrack(() => {
|
|
173
|
+
try {
|
|
174
|
+
return fetcher(lookup, {
|
|
175
|
+
value: value(),
|
|
176
|
+
refetching
|
|
177
|
+
});
|
|
178
|
+
} catch (fetcherError) {
|
|
179
|
+
error = fetcherError;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
if (error !== void 0) {
|
|
183
|
+
loadEnd(pr, void 0, castError(error), lookup);
|
|
184
|
+
return;
|
|
185
|
+
} else if (!isPromise(p)) {
|
|
186
|
+
loadEnd(pr, p, void 0, lookup);
|
|
187
|
+
return p;
|
|
188
|
+
}
|
|
189
|
+
pr = p;
|
|
190
|
+
if ("v" in p) {
|
|
191
|
+
if (p.s === 1) loadEnd(pr, p.v, void 0, lookup);
|
|
192
|
+
else loadEnd(pr, void 0, castError(p.v), lookup);
|
|
193
|
+
return p;
|
|
194
|
+
}
|
|
195
|
+
scheduled = true;
|
|
196
|
+
queueMicrotask(() => scheduled = false);
|
|
197
|
+
runUpdates(() => {
|
|
198
|
+
setState(resolved ? "refreshing" : "pending");
|
|
199
|
+
trigger();
|
|
200
|
+
}, false);
|
|
201
|
+
return p.then((v) => loadEnd(p, v, void 0, lookup), (e) => loadEnd(p, void 0, castError(e), lookup));
|
|
202
|
+
}
|
|
203
|
+
Object.defineProperties(read, {
|
|
204
|
+
state: { get: () => state() },
|
|
205
|
+
error: { get: () => error() },
|
|
206
|
+
loading: { get() {
|
|
207
|
+
const s = state();
|
|
208
|
+
return s === "pending" || s === "refreshing";
|
|
209
|
+
} },
|
|
210
|
+
latest: { get() {
|
|
211
|
+
if (!resolved) return read();
|
|
212
|
+
const err = error();
|
|
213
|
+
if (err && !pr) throw err;
|
|
214
|
+
return value();
|
|
215
|
+
} }
|
|
216
|
+
});
|
|
217
|
+
let owner = Owner;
|
|
218
|
+
if (dynamic) createComputed(() => (owner = Owner, load(false)));
|
|
219
|
+
else load(false);
|
|
220
|
+
return [read, {
|
|
221
|
+
refetch: (info) => runWithOwner(owner, () => load(info)),
|
|
222
|
+
mutate: setValue
|
|
223
|
+
}];
|
|
224
|
+
}
|
|
225
|
+
function batch(fn) {
|
|
226
|
+
return runUpdates(fn, false);
|
|
227
|
+
}
|
|
228
|
+
function untrack(fn) {
|
|
229
|
+
if (Listener === null) return fn();
|
|
230
|
+
const listener = Listener;
|
|
231
|
+
Listener = null;
|
|
232
|
+
try {
|
|
233
|
+
return fn();
|
|
234
|
+
} finally {
|
|
235
|
+
Listener = listener;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function on(deps, fn, options) {
|
|
239
|
+
const isArray = Array.isArray(deps);
|
|
240
|
+
let prevInput;
|
|
241
|
+
let defer = options && options.defer;
|
|
242
|
+
return (prevValue) => {
|
|
243
|
+
let input;
|
|
244
|
+
if (isArray) {
|
|
245
|
+
input = Array(deps.length);
|
|
246
|
+
for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
|
|
247
|
+
} else input = deps();
|
|
248
|
+
if (defer) {
|
|
249
|
+
defer = false;
|
|
250
|
+
return prevValue;
|
|
251
|
+
}
|
|
252
|
+
const result = untrack(() => fn(input, prevInput, prevValue));
|
|
253
|
+
prevInput = input;
|
|
254
|
+
return result;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function onMount(fn) {
|
|
258
|
+
createEffect(() => untrack(fn));
|
|
259
|
+
}
|
|
260
|
+
function onCleanup(fn) {
|
|
261
|
+
if (Owner === null);
|
|
262
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
263
|
+
else Owner.cleanups.push(fn);
|
|
264
|
+
return fn;
|
|
265
|
+
}
|
|
266
|
+
function getOwner() {
|
|
267
|
+
return Owner;
|
|
268
|
+
}
|
|
269
|
+
function runWithOwner(o, fn) {
|
|
270
|
+
const prev = Owner;
|
|
271
|
+
const prevListener = Listener;
|
|
272
|
+
Owner = o;
|
|
273
|
+
Listener = null;
|
|
274
|
+
try {
|
|
275
|
+
return runUpdates(fn, true);
|
|
276
|
+
} catch (err) {
|
|
277
|
+
handleError(err);
|
|
278
|
+
} finally {
|
|
279
|
+
Owner = prev;
|
|
280
|
+
Listener = prevListener;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function startTransition(fn) {
|
|
284
|
+
if (Transition && Transition.running) {
|
|
285
|
+
fn();
|
|
286
|
+
return Transition.done;
|
|
287
|
+
}
|
|
288
|
+
const l = Listener;
|
|
289
|
+
const o = Owner;
|
|
290
|
+
return Promise.resolve().then(() => {
|
|
291
|
+
Listener = l;
|
|
292
|
+
Owner = o;
|
|
293
|
+
let t;
|
|
294
|
+
if (SuspenseContext) {
|
|
295
|
+
t = Transition || (Transition = {
|
|
296
|
+
sources: /* @__PURE__ */ new Set(),
|
|
297
|
+
effects: [],
|
|
298
|
+
promises: /* @__PURE__ */ new Set(),
|
|
299
|
+
disposed: /* @__PURE__ */ new Set(),
|
|
300
|
+
queue: /* @__PURE__ */ new Set(),
|
|
301
|
+
running: true
|
|
302
|
+
});
|
|
303
|
+
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
304
|
+
t.running = true;
|
|
305
|
+
}
|
|
306
|
+
runUpdates(fn, false);
|
|
307
|
+
Listener = Owner = null;
|
|
308
|
+
return t ? t.done : void 0;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
|
|
312
|
+
function useTransition() {
|
|
313
|
+
return [transPending, startTransition];
|
|
314
|
+
}
|
|
315
|
+
function createContext(defaultValue, options) {
|
|
316
|
+
const id = Symbol("context");
|
|
317
|
+
return {
|
|
318
|
+
id,
|
|
319
|
+
Provider: createProvider(id),
|
|
320
|
+
defaultValue
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function useContext(context) {
|
|
324
|
+
let value;
|
|
325
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
326
|
+
}
|
|
327
|
+
function children(fn) {
|
|
328
|
+
const children = createMemo(fn);
|
|
329
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
330
|
+
memo.toArray = () => {
|
|
331
|
+
const c = memo();
|
|
332
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
333
|
+
};
|
|
334
|
+
return memo;
|
|
335
|
+
}
|
|
336
|
+
let SuspenseContext;
|
|
337
|
+
function readSignal() {
|
|
338
|
+
const runningTransition = Transition && Transition.running;
|
|
339
|
+
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
340
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
341
|
+
else {
|
|
342
|
+
const updates = Updates;
|
|
343
|
+
Updates = null;
|
|
344
|
+
runUpdates(() => lookUpstream(this), false);
|
|
345
|
+
Updates = updates;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (Listener) {
|
|
349
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
350
|
+
if (!Listener.sources) {
|
|
351
|
+
Listener.sources = [this];
|
|
352
|
+
Listener.sourceSlots = [sSlot];
|
|
353
|
+
} else {
|
|
354
|
+
Listener.sources.push(this);
|
|
355
|
+
Listener.sourceSlots.push(sSlot);
|
|
356
|
+
}
|
|
357
|
+
if (!this.observers) {
|
|
358
|
+
this.observers = [Listener];
|
|
359
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
360
|
+
} else {
|
|
361
|
+
this.observers.push(Listener);
|
|
362
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
366
|
+
return this.value;
|
|
367
|
+
}
|
|
368
|
+
function writeSignal(node, value, isComp) {
|
|
369
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
370
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
371
|
+
if (Transition) {
|
|
372
|
+
const TransitionRunning = Transition.running;
|
|
373
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
374
|
+
Transition.sources.add(node);
|
|
375
|
+
node.tValue = value;
|
|
376
|
+
}
|
|
377
|
+
if (!TransitionRunning) node.value = value;
|
|
378
|
+
} else node.value = value;
|
|
379
|
+
if (node.observers && node.observers.length) runUpdates(() => {
|
|
380
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
381
|
+
const o = node.observers[i];
|
|
382
|
+
const TransitionRunning = Transition && Transition.running;
|
|
383
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
384
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
385
|
+
if (o.pure) Updates.push(o);
|
|
386
|
+
else Effects.push(o);
|
|
387
|
+
if (o.observers) markDownstream(o);
|
|
388
|
+
}
|
|
389
|
+
if (!TransitionRunning) o.state = STALE;
|
|
390
|
+
else o.tState = STALE;
|
|
391
|
+
}
|
|
392
|
+
if (Updates.length > 1e6) {
|
|
393
|
+
Updates = [];
|
|
394
|
+
throw new Error();
|
|
395
|
+
}
|
|
396
|
+
}, false);
|
|
397
|
+
}
|
|
398
|
+
return value;
|
|
399
|
+
}
|
|
400
|
+
function updateComputation(node) {
|
|
401
|
+
if (!node.fn) return;
|
|
402
|
+
cleanNode(node);
|
|
403
|
+
const time = ExecCount;
|
|
404
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
405
|
+
if (Transition && !Transition.running && Transition.sources.has(node)) queueMicrotask(() => {
|
|
406
|
+
runUpdates(() => {
|
|
407
|
+
Transition && (Transition.running = true);
|
|
408
|
+
Listener = Owner = node;
|
|
409
|
+
runComputation(node, node.tValue, time);
|
|
410
|
+
Listener = Owner = null;
|
|
411
|
+
}, false);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function runComputation(node, value, time) {
|
|
415
|
+
let nextValue;
|
|
416
|
+
const owner = Owner, listener = Listener;
|
|
417
|
+
Listener = Owner = node;
|
|
418
|
+
try {
|
|
419
|
+
nextValue = node.fn(value);
|
|
420
|
+
} catch (err) {
|
|
421
|
+
if (node.pure) {
|
|
422
|
+
if (Transition && Transition.running) {
|
|
423
|
+
node.tState = STALE;
|
|
424
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
425
|
+
node.tOwned = void 0;
|
|
426
|
+
} else {
|
|
427
|
+
node.state = STALE;
|
|
428
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
429
|
+
node.owned = null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
node.updatedAt = time + 1;
|
|
433
|
+
return handleError(err);
|
|
434
|
+
} finally {
|
|
435
|
+
Listener = listener;
|
|
436
|
+
Owner = owner;
|
|
437
|
+
}
|
|
438
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
439
|
+
if (node.updatedAt != null && "observers" in node) writeSignal(node, nextValue, true);
|
|
440
|
+
else if (Transition && Transition.running && node.pure) {
|
|
441
|
+
if (!Transition.sources.has(node)) node.value = nextValue;
|
|
442
|
+
Transition.sources.add(node);
|
|
443
|
+
node.tValue = nextValue;
|
|
444
|
+
} else node.value = nextValue;
|
|
445
|
+
node.updatedAt = time;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
449
|
+
const c = {
|
|
450
|
+
fn,
|
|
451
|
+
state,
|
|
452
|
+
updatedAt: null,
|
|
453
|
+
owned: null,
|
|
454
|
+
sources: null,
|
|
455
|
+
sourceSlots: null,
|
|
456
|
+
cleanups: null,
|
|
457
|
+
value: init,
|
|
458
|
+
owner: Owner,
|
|
459
|
+
context: Owner ? Owner.context : null,
|
|
460
|
+
pure
|
|
461
|
+
};
|
|
462
|
+
if (Transition && Transition.running) {
|
|
463
|
+
c.state = 0;
|
|
464
|
+
c.tState = state;
|
|
465
|
+
}
|
|
466
|
+
if (Owner === null);
|
|
467
|
+
else if (Owner !== UNOWNED) {
|
|
468
|
+
if (Transition && Transition.running && Owner.pure) {
|
|
469
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
470
|
+
else Owner.tOwned.push(c);
|
|
471
|
+
} else if (!Owner.owned) Owner.owned = [c];
|
|
472
|
+
else Owner.owned.push(c);
|
|
473
|
+
}
|
|
474
|
+
return c;
|
|
475
|
+
}
|
|
476
|
+
function runTop(node) {
|
|
477
|
+
const runningTransition = Transition && Transition.running;
|
|
478
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
479
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
480
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
481
|
+
const ancestors = [node];
|
|
482
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
483
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
484
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
485
|
+
}
|
|
486
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
487
|
+
node = ancestors[i];
|
|
488
|
+
if (runningTransition) {
|
|
489
|
+
let top = node, prev = ancestors[i + 1];
|
|
490
|
+
while ((top = top.owner) && top !== prev) if (Transition.disposed.has(top)) return;
|
|
491
|
+
}
|
|
492
|
+
if ((runningTransition ? node.tState : node.state) === STALE) updateComputation(node);
|
|
493
|
+
else if ((runningTransition ? node.tState : node.state) === PENDING) {
|
|
494
|
+
const updates = Updates;
|
|
495
|
+
Updates = null;
|
|
496
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
497
|
+
Updates = updates;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function runUpdates(fn, init) {
|
|
502
|
+
if (Updates) return fn();
|
|
503
|
+
let wait = false;
|
|
504
|
+
if (!init) Updates = [];
|
|
505
|
+
if (Effects) wait = true;
|
|
506
|
+
else Effects = [];
|
|
507
|
+
ExecCount++;
|
|
508
|
+
try {
|
|
509
|
+
const res = fn();
|
|
510
|
+
completeUpdates(wait);
|
|
511
|
+
return res;
|
|
512
|
+
} catch (err) {
|
|
513
|
+
if (!wait) Effects = null;
|
|
514
|
+
Updates = null;
|
|
515
|
+
handleError(err);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function completeUpdates(wait) {
|
|
519
|
+
if (Updates) {
|
|
520
|
+
runQueue(Updates);
|
|
521
|
+
Updates = null;
|
|
522
|
+
}
|
|
523
|
+
if (wait) return;
|
|
524
|
+
let res;
|
|
525
|
+
if (Transition) {
|
|
526
|
+
if (!Transition.promises.size && !Transition.queue.size) {
|
|
527
|
+
const sources = Transition.sources;
|
|
528
|
+
const disposed = Transition.disposed;
|
|
529
|
+
Effects.push.apply(Effects, Transition.effects);
|
|
530
|
+
res = Transition.resolve;
|
|
531
|
+
for (const e of Effects) {
|
|
532
|
+
"tState" in e && (e.state = e.tState);
|
|
533
|
+
delete e.tState;
|
|
534
|
+
}
|
|
535
|
+
Transition = null;
|
|
536
|
+
runUpdates(() => {
|
|
537
|
+
for (const d of disposed) cleanNode(d);
|
|
538
|
+
for (const v of sources) {
|
|
539
|
+
v.value = v.tValue;
|
|
540
|
+
if (v.owned) for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
541
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
542
|
+
delete v.tValue;
|
|
543
|
+
delete v.tOwned;
|
|
544
|
+
v.tState = 0;
|
|
545
|
+
}
|
|
546
|
+
setTransPending(false);
|
|
547
|
+
}, false);
|
|
548
|
+
} else if (Transition.running) {
|
|
549
|
+
Transition.running = false;
|
|
550
|
+
Transition.effects.push.apply(Transition.effects, Effects);
|
|
551
|
+
Effects = null;
|
|
552
|
+
setTransPending(true);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const e = Effects;
|
|
557
|
+
Effects = null;
|
|
558
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
559
|
+
if (res) res();
|
|
560
|
+
}
|
|
561
|
+
function runQueue(queue) {
|
|
562
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
563
|
+
}
|
|
564
|
+
function runUserEffects(queue) {
|
|
565
|
+
let i, userLength = 0;
|
|
566
|
+
for (i = 0; i < queue.length; i++) {
|
|
567
|
+
const e = queue[i];
|
|
568
|
+
if (!e.user) runTop(e);
|
|
569
|
+
else queue[userLength++] = e;
|
|
570
|
+
}
|
|
571
|
+
if (sharedConfig.context) {
|
|
572
|
+
if (sharedConfig.count) {
|
|
573
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
574
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
setHydrateContext();
|
|
578
|
+
}
|
|
579
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
580
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
581
|
+
userLength += sharedConfig.effects.length;
|
|
582
|
+
delete sharedConfig.effects;
|
|
583
|
+
}
|
|
584
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
585
|
+
}
|
|
586
|
+
function lookUpstream(node, ignore) {
|
|
587
|
+
const runningTransition = Transition && Transition.running;
|
|
588
|
+
if (runningTransition) node.tState = 0;
|
|
589
|
+
else node.state = 0;
|
|
590
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
591
|
+
const source = node.sources[i];
|
|
592
|
+
if (source.sources) {
|
|
593
|
+
const state = runningTransition ? source.tState : source.state;
|
|
594
|
+
if (state === STALE) {
|
|
595
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
596
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function markDownstream(node) {
|
|
601
|
+
const runningTransition = Transition && Transition.running;
|
|
602
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
603
|
+
const o = node.observers[i];
|
|
604
|
+
if (runningTransition ? !o.tState : !o.state) {
|
|
605
|
+
if (runningTransition) o.tState = PENDING;
|
|
606
|
+
else o.state = PENDING;
|
|
607
|
+
if (o.pure) Updates.push(o);
|
|
608
|
+
else Effects.push(o);
|
|
609
|
+
o.observers && markDownstream(o);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
function cleanNode(node) {
|
|
614
|
+
let i;
|
|
615
|
+
if (node.sources) while (node.sources.length) {
|
|
616
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
617
|
+
if (obs && obs.length) {
|
|
618
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
619
|
+
if (index < obs.length) {
|
|
620
|
+
n.sourceSlots[s] = index;
|
|
621
|
+
obs[index] = n;
|
|
622
|
+
source.observerSlots[index] = s;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (node.tOwned) {
|
|
627
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
628
|
+
delete node.tOwned;
|
|
629
|
+
}
|
|
630
|
+
if (Transition && Transition.running && node.pure) reset(node, true);
|
|
631
|
+
else if (node.owned) {
|
|
632
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
633
|
+
node.owned = null;
|
|
634
|
+
}
|
|
635
|
+
if (node.cleanups) {
|
|
636
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
637
|
+
node.cleanups = null;
|
|
638
|
+
}
|
|
639
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
640
|
+
else node.state = 0;
|
|
641
|
+
}
|
|
642
|
+
function reset(node, top) {
|
|
643
|
+
if (!top) {
|
|
644
|
+
node.tState = 0;
|
|
645
|
+
Transition.disposed.add(node);
|
|
646
|
+
}
|
|
647
|
+
if (node.owned) for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
648
|
+
}
|
|
649
|
+
function castError(err) {
|
|
650
|
+
if (err instanceof Error) return err;
|
|
651
|
+
return new Error(typeof err === "string" ? err : "Unknown error", { cause: err });
|
|
652
|
+
}
|
|
653
|
+
function handleError(err, owner = Owner) {
|
|
654
|
+
throw castError(err);
|
|
655
|
+
}
|
|
656
|
+
function resolveChildren(children) {
|
|
657
|
+
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
658
|
+
if (Array.isArray(children)) {
|
|
659
|
+
const results = [];
|
|
660
|
+
for (let i = 0; i < children.length; i++) {
|
|
661
|
+
const result = resolveChildren(children[i]);
|
|
662
|
+
Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
|
|
663
|
+
}
|
|
664
|
+
return results;
|
|
665
|
+
}
|
|
666
|
+
return children;
|
|
667
|
+
}
|
|
668
|
+
function createProvider(id, options) {
|
|
669
|
+
return function provider(props) {
|
|
670
|
+
let res;
|
|
671
|
+
createRenderEffect(() => res = untrack(() => {
|
|
672
|
+
Owner.context = {
|
|
673
|
+
...Owner.context,
|
|
674
|
+
[id]: props.value
|
|
675
|
+
};
|
|
676
|
+
return children(() => props.children);
|
|
677
|
+
}), void 0);
|
|
678
|
+
return res;
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
const FALLBACK = Symbol("fallback");
|
|
682
|
+
function dispose(d) {
|
|
683
|
+
for (let i = 0; i < d.length; i++) d[i]();
|
|
684
|
+
}
|
|
685
|
+
function mapArray(list, mapFn, options = {}) {
|
|
686
|
+
let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
|
|
687
|
+
onCleanup(() => dispose(disposers));
|
|
688
|
+
return () => {
|
|
689
|
+
let newItems = list() || [], newLen = newItems.length, i, j;
|
|
690
|
+
newItems[$TRACK];
|
|
691
|
+
return untrack(() => {
|
|
692
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
693
|
+
if (newLen === 0) {
|
|
694
|
+
if (len !== 0) {
|
|
695
|
+
dispose(disposers);
|
|
696
|
+
disposers = [];
|
|
697
|
+
items = [];
|
|
698
|
+
mapped = [];
|
|
699
|
+
len = 0;
|
|
700
|
+
indexes && (indexes = []);
|
|
701
|
+
}
|
|
702
|
+
if (options.fallback) {
|
|
703
|
+
items = [FALLBACK];
|
|
704
|
+
mapped[0] = createRoot((disposer) => {
|
|
705
|
+
disposers[0] = disposer;
|
|
706
|
+
return options.fallback();
|
|
707
|
+
});
|
|
708
|
+
len = 1;
|
|
709
|
+
}
|
|
710
|
+
} else if (len === 0) {
|
|
711
|
+
mapped = new Array(newLen);
|
|
712
|
+
for (j = 0; j < newLen; j++) {
|
|
713
|
+
items[j] = newItems[j];
|
|
714
|
+
mapped[j] = createRoot(mapper);
|
|
715
|
+
}
|
|
716
|
+
len = newLen;
|
|
717
|
+
} else {
|
|
718
|
+
temp = new Array(newLen);
|
|
719
|
+
tempdisposers = new Array(newLen);
|
|
720
|
+
indexes && (tempIndexes = new Array(newLen));
|
|
721
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
722
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
723
|
+
temp[newEnd] = mapped[end];
|
|
724
|
+
tempdisposers[newEnd] = disposers[end];
|
|
725
|
+
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
726
|
+
}
|
|
727
|
+
newIndices = /* @__PURE__ */ new Map();
|
|
728
|
+
newIndicesNext = new Array(newEnd + 1);
|
|
729
|
+
for (j = newEnd; j >= start; j--) {
|
|
730
|
+
item = newItems[j];
|
|
731
|
+
i = newIndices.get(item);
|
|
732
|
+
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
733
|
+
newIndices.set(item, j);
|
|
734
|
+
}
|
|
735
|
+
for (i = start; i <= end; i++) {
|
|
736
|
+
item = items[i];
|
|
737
|
+
j = newIndices.get(item);
|
|
738
|
+
if (j !== void 0 && j !== -1) {
|
|
739
|
+
temp[j] = mapped[i];
|
|
740
|
+
tempdisposers[j] = disposers[i];
|
|
741
|
+
indexes && (tempIndexes[j] = indexes[i]);
|
|
742
|
+
j = newIndicesNext[j];
|
|
743
|
+
newIndices.set(item, j);
|
|
744
|
+
} else disposers[i]();
|
|
745
|
+
}
|
|
746
|
+
for (j = start; j < newLen; j++) if (j in temp) {
|
|
747
|
+
mapped[j] = temp[j];
|
|
748
|
+
disposers[j] = tempdisposers[j];
|
|
749
|
+
if (indexes) {
|
|
750
|
+
indexes[j] = tempIndexes[j];
|
|
751
|
+
indexes[j](j);
|
|
752
|
+
}
|
|
753
|
+
} else mapped[j] = createRoot(mapper);
|
|
754
|
+
mapped = mapped.slice(0, len = newLen);
|
|
755
|
+
items = newItems.slice(0);
|
|
756
|
+
}
|
|
757
|
+
return mapped;
|
|
758
|
+
});
|
|
759
|
+
function mapper(disposer) {
|
|
760
|
+
disposers[j] = disposer;
|
|
761
|
+
if (indexes) {
|
|
762
|
+
const [s, set] = createSignal(j);
|
|
763
|
+
indexes[j] = set;
|
|
764
|
+
return mapFn(newItems[j], s);
|
|
765
|
+
}
|
|
766
|
+
return mapFn(newItems[j]);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function indexArray(list, mapFn, options = {}) {
|
|
771
|
+
let items = [], mapped = [], disposers = [], signals = [], len = 0, i;
|
|
772
|
+
onCleanup(() => dispose(disposers));
|
|
773
|
+
return () => {
|
|
774
|
+
const newItems = list() || [], newLen = newItems.length;
|
|
775
|
+
newItems[$TRACK];
|
|
776
|
+
return untrack(() => {
|
|
777
|
+
if (newLen === 0) {
|
|
778
|
+
if (len !== 0) {
|
|
779
|
+
dispose(disposers);
|
|
780
|
+
disposers = [];
|
|
781
|
+
items = [];
|
|
782
|
+
mapped = [];
|
|
783
|
+
len = 0;
|
|
784
|
+
signals = [];
|
|
785
|
+
}
|
|
786
|
+
if (options.fallback) {
|
|
787
|
+
items = [FALLBACK];
|
|
788
|
+
mapped[0] = createRoot((disposer) => {
|
|
789
|
+
disposers[0] = disposer;
|
|
790
|
+
return options.fallback();
|
|
791
|
+
});
|
|
792
|
+
len = 1;
|
|
793
|
+
}
|
|
794
|
+
return mapped;
|
|
795
|
+
}
|
|
796
|
+
if (items[0] === FALLBACK) {
|
|
797
|
+
disposers[0]();
|
|
798
|
+
disposers = [];
|
|
799
|
+
items = [];
|
|
800
|
+
mapped = [];
|
|
801
|
+
len = 0;
|
|
802
|
+
}
|
|
803
|
+
for (i = 0; i < newLen; i++) if (i < items.length && items[i] !== newItems[i]) signals[i](() => newItems[i]);
|
|
804
|
+
else if (i >= items.length) mapped[i] = createRoot(mapper);
|
|
805
|
+
for (; i < items.length; i++) disposers[i]();
|
|
806
|
+
len = signals.length = disposers.length = newLen;
|
|
807
|
+
items = newItems.slice(0);
|
|
808
|
+
return mapped = mapped.slice(0, len);
|
|
809
|
+
});
|
|
810
|
+
function mapper(disposer) {
|
|
811
|
+
disposers[i] = disposer;
|
|
812
|
+
const [s, set] = createSignal(newItems[i]);
|
|
813
|
+
signals[i] = set;
|
|
814
|
+
return mapFn(s, i);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
function createComponent(Comp, props) {
|
|
819
|
+
return untrack(() => Comp(props || {}));
|
|
820
|
+
}
|
|
821
|
+
function trueFn() {
|
|
822
|
+
return true;
|
|
823
|
+
}
|
|
824
|
+
const propTraps = {
|
|
825
|
+
get(_, property, receiver) {
|
|
826
|
+
if (property === $PROXY) return receiver;
|
|
827
|
+
return _.get(property);
|
|
828
|
+
},
|
|
829
|
+
has(_, property) {
|
|
830
|
+
if (property === $PROXY) return true;
|
|
831
|
+
return _.has(property);
|
|
832
|
+
},
|
|
833
|
+
set: trueFn,
|
|
834
|
+
deleteProperty: trueFn,
|
|
835
|
+
getOwnPropertyDescriptor(_, property) {
|
|
836
|
+
return {
|
|
837
|
+
configurable: true,
|
|
838
|
+
enumerable: true,
|
|
839
|
+
get() {
|
|
840
|
+
return _.get(property);
|
|
841
|
+
},
|
|
842
|
+
set: trueFn,
|
|
843
|
+
deleteProperty: trueFn
|
|
844
|
+
};
|
|
845
|
+
},
|
|
846
|
+
ownKeys(_) {
|
|
847
|
+
return _.keys();
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
function resolveSource(s) {
|
|
851
|
+
return !(s = typeof s === "function" ? s() : s) ? {} : s;
|
|
852
|
+
}
|
|
853
|
+
function resolveSources() {
|
|
854
|
+
for (let i = 0, length = this.length; i < length; ++i) {
|
|
855
|
+
const v = this[i]();
|
|
856
|
+
if (v !== void 0) return v;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function mergeProps(...sources) {
|
|
860
|
+
let proxy = false;
|
|
861
|
+
for (let i = 0; i < sources.length; i++) {
|
|
862
|
+
const s = sources[i];
|
|
863
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
864
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
865
|
+
}
|
|
866
|
+
if (SUPPORTS_PROXY && proxy) return new Proxy({
|
|
867
|
+
get(property) {
|
|
868
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
869
|
+
const v = resolveSource(sources[i])[property];
|
|
870
|
+
if (v !== void 0) return v;
|
|
871
|
+
}
|
|
872
|
+
},
|
|
873
|
+
has(property) {
|
|
874
|
+
for (let i = sources.length - 1; i >= 0; i--) if (property in resolveSource(sources[i])) return true;
|
|
875
|
+
return false;
|
|
876
|
+
},
|
|
877
|
+
keys() {
|
|
878
|
+
const keys = [];
|
|
879
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
880
|
+
return [...new Set(keys)];
|
|
881
|
+
}
|
|
882
|
+
}, propTraps);
|
|
883
|
+
const sourcesMap = {};
|
|
884
|
+
const defined = Object.create(null);
|
|
885
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
886
|
+
const source = sources[i];
|
|
887
|
+
if (!source) continue;
|
|
888
|
+
const sourceKeys = Object.getOwnPropertyNames(source);
|
|
889
|
+
for (let i = sourceKeys.length - 1; i >= 0; i--) {
|
|
890
|
+
const key = sourceKeys[i];
|
|
891
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
892
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
893
|
+
if (!defined[key]) defined[key] = desc.get ? {
|
|
894
|
+
enumerable: true,
|
|
895
|
+
configurable: true,
|
|
896
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
897
|
+
} : desc.value !== void 0 ? desc : void 0;
|
|
898
|
+
else {
|
|
899
|
+
const sources = sourcesMap[key];
|
|
900
|
+
if (sources) {
|
|
901
|
+
if (desc.get) sources.push(desc.get.bind(source));
|
|
902
|
+
else if (desc.value !== void 0) sources.push(() => desc.value);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
const target = {};
|
|
908
|
+
const definedKeys = Object.keys(defined);
|
|
909
|
+
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
910
|
+
const key = definedKeys[i], desc = defined[key];
|
|
911
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
912
|
+
else target[key] = desc ? desc.value : void 0;
|
|
913
|
+
}
|
|
914
|
+
return target;
|
|
915
|
+
}
|
|
916
|
+
function splitProps(props, ...keys) {
|
|
917
|
+
const len = keys.length;
|
|
918
|
+
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
919
|
+
const blocked = len > 1 ? keys.flat() : keys[0];
|
|
920
|
+
const res = keys.map((k) => {
|
|
921
|
+
return new Proxy({
|
|
922
|
+
get(property) {
|
|
923
|
+
return k.includes(property) ? props[property] : void 0;
|
|
924
|
+
},
|
|
925
|
+
has(property) {
|
|
926
|
+
return k.includes(property) && property in props;
|
|
927
|
+
},
|
|
928
|
+
keys() {
|
|
929
|
+
return k.filter((property) => property in props);
|
|
930
|
+
}
|
|
931
|
+
}, propTraps);
|
|
932
|
+
});
|
|
933
|
+
res.push(new Proxy({
|
|
934
|
+
get(property) {
|
|
935
|
+
return blocked.includes(property) ? void 0 : props[property];
|
|
936
|
+
},
|
|
937
|
+
has(property) {
|
|
938
|
+
return blocked.includes(property) ? false : property in props;
|
|
939
|
+
},
|
|
940
|
+
keys() {
|
|
941
|
+
return Object.keys(props).filter((k) => !blocked.includes(k));
|
|
942
|
+
}
|
|
943
|
+
}, propTraps));
|
|
944
|
+
return res;
|
|
945
|
+
}
|
|
946
|
+
const objects = [];
|
|
947
|
+
for (let i = 0; i <= len; i++) objects[i] = {};
|
|
948
|
+
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
949
|
+
let keyIndex = len;
|
|
950
|
+
for (let i = 0; i < keys.length; i++) if (keys[i].includes(propName)) {
|
|
951
|
+
keyIndex = i;
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
954
|
+
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
955
|
+
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
|
|
956
|
+
}
|
|
957
|
+
return objects;
|
|
958
|
+
}
|
|
959
|
+
function lazy(fn) {
|
|
960
|
+
let comp;
|
|
961
|
+
let p;
|
|
962
|
+
const wrap = (props) => {
|
|
963
|
+
const ctx = sharedConfig.context;
|
|
964
|
+
if (ctx) {
|
|
965
|
+
const [s, set] = createSignal();
|
|
966
|
+
sharedConfig.count || (sharedConfig.count = 0);
|
|
967
|
+
sharedConfig.count++;
|
|
968
|
+
(p || (p = fn())).then((mod) => {
|
|
969
|
+
!sharedConfig.done && setHydrateContext(ctx);
|
|
970
|
+
sharedConfig.count--;
|
|
971
|
+
set(() => mod.default);
|
|
972
|
+
setHydrateContext();
|
|
973
|
+
});
|
|
974
|
+
comp = s;
|
|
975
|
+
} else if (!comp) {
|
|
976
|
+
const [s] = createResource(() => (p || (p = fn())).then((mod) => mod.default));
|
|
977
|
+
comp = s;
|
|
978
|
+
}
|
|
979
|
+
let Comp;
|
|
980
|
+
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
981
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
982
|
+
const c = sharedConfig.context;
|
|
983
|
+
setHydrateContext(ctx);
|
|
984
|
+
const r = Comp(props);
|
|
985
|
+
setHydrateContext(c);
|
|
986
|
+
return r;
|
|
987
|
+
}) : "");
|
|
988
|
+
};
|
|
989
|
+
wrap.preload = () => p || ((p = fn()).then((mod) => comp = () => mod.default), p);
|
|
990
|
+
return wrap;
|
|
991
|
+
}
|
|
992
|
+
let counter = 0;
|
|
993
|
+
function createUniqueId() {
|
|
994
|
+
return sharedConfig.context ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
995
|
+
}
|
|
996
|
+
const narrowedError = (name) => `Stale read from <${name}>.`;
|
|
997
|
+
function For(props) {
|
|
998
|
+
const fallback = "fallback" in props && { fallback: () => props.fallback };
|
|
999
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
1000
|
+
}
|
|
1001
|
+
function Index(props) {
|
|
1002
|
+
const fallback = "fallback" in props && { fallback: () => props.fallback };
|
|
1003
|
+
return createMemo(indexArray(() => props.each, props.children, fallback || void 0));
|
|
1004
|
+
}
|
|
1005
|
+
function Show(props) {
|
|
1006
|
+
const keyed = props.keyed;
|
|
1007
|
+
const conditionValue = createMemo(() => props.when, void 0, void 0);
|
|
1008
|
+
const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, { equals: (a, b) => !a === !b });
|
|
1009
|
+
return createMemo(() => {
|
|
1010
|
+
const c = condition();
|
|
1011
|
+
if (c) {
|
|
1012
|
+
const child = props.children;
|
|
1013
|
+
return typeof child === "function" && child.length > 0 ? untrack(() => child(keyed ? c : () => {
|
|
1014
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1015
|
+
return conditionValue();
|
|
1016
|
+
})) : child;
|
|
1017
|
+
}
|
|
1018
|
+
return props.fallback;
|
|
1019
|
+
}, void 0, void 0);
|
|
1020
|
+
}
|
|
1021
|
+
function Switch(props) {
|
|
1022
|
+
const chs = children(() => props.children);
|
|
1023
|
+
const switchFunc = createMemo(() => {
|
|
1024
|
+
const ch = chs();
|
|
1025
|
+
const mps = Array.isArray(ch) ? ch : [ch];
|
|
1026
|
+
let func = () => void 0;
|
|
1027
|
+
for (let i = 0; i < mps.length; i++) {
|
|
1028
|
+
const index = i;
|
|
1029
|
+
const mp = mps[i];
|
|
1030
|
+
const prevFunc = func;
|
|
1031
|
+
const conditionValue = createMemo(() => prevFunc() ? void 0 : mp.when, void 0, void 0);
|
|
1032
|
+
const condition = mp.keyed ? conditionValue : createMemo(conditionValue, void 0, { equals: (a, b) => !a === !b });
|
|
1033
|
+
func = () => prevFunc() || (condition() ? [
|
|
1034
|
+
index,
|
|
1035
|
+
conditionValue,
|
|
1036
|
+
mp
|
|
1037
|
+
] : void 0);
|
|
1038
|
+
}
|
|
1039
|
+
return func;
|
|
1040
|
+
});
|
|
1041
|
+
return createMemo(() => {
|
|
1042
|
+
const sel = switchFunc()();
|
|
1043
|
+
if (!sel) return props.fallback;
|
|
1044
|
+
const [index, conditionValue, mp] = sel;
|
|
1045
|
+
const child = mp.children;
|
|
1046
|
+
return typeof child === "function" && child.length > 0 ? untrack(() => child(mp.keyed ? conditionValue() : () => {
|
|
1047
|
+
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
1048
|
+
return conditionValue();
|
|
1049
|
+
})) : child;
|
|
1050
|
+
}, void 0, void 0);
|
|
1051
|
+
}
|
|
1052
|
+
function Match(props) {
|
|
1053
|
+
return props;
|
|
1054
|
+
}
|
|
1055
|
+
//#endregion
|
|
1056
|
+
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/web/dist/web.js
|
|
1057
|
+
const Properties = /*#__PURE__*/ new Set([
|
|
1058
|
+
"className",
|
|
1059
|
+
"value",
|
|
1060
|
+
"readOnly",
|
|
1061
|
+
"noValidate",
|
|
1062
|
+
"formNoValidate",
|
|
1063
|
+
"isMap",
|
|
1064
|
+
"noModule",
|
|
1065
|
+
"playsInline",
|
|
1066
|
+
"adAuctionHeaders",
|
|
1067
|
+
"allowFullscreen",
|
|
1068
|
+
"browsingTopics",
|
|
1069
|
+
"defaultChecked",
|
|
1070
|
+
"defaultMuted",
|
|
1071
|
+
"defaultSelected",
|
|
1072
|
+
"disablePictureInPicture",
|
|
1073
|
+
"disableRemotePlayback",
|
|
1074
|
+
"preservesPitch",
|
|
1075
|
+
"shadowRootClonable",
|
|
1076
|
+
"shadowRootCustomElementRegistry",
|
|
1077
|
+
"shadowRootDelegatesFocus",
|
|
1078
|
+
"shadowRootSerializable",
|
|
1079
|
+
"sharedStorageWritable",
|
|
1080
|
+
...[
|
|
1081
|
+
"allowfullscreen",
|
|
1082
|
+
"async",
|
|
1083
|
+
"alpha",
|
|
1084
|
+
"autofocus",
|
|
1085
|
+
"autoplay",
|
|
1086
|
+
"checked",
|
|
1087
|
+
"controls",
|
|
1088
|
+
"default",
|
|
1089
|
+
"disabled",
|
|
1090
|
+
"formnovalidate",
|
|
1091
|
+
"hidden",
|
|
1092
|
+
"indeterminate",
|
|
1093
|
+
"inert",
|
|
1094
|
+
"ismap",
|
|
1095
|
+
"loop",
|
|
1096
|
+
"multiple",
|
|
1097
|
+
"muted",
|
|
1098
|
+
"nomodule",
|
|
1099
|
+
"novalidate",
|
|
1100
|
+
"open",
|
|
1101
|
+
"playsinline",
|
|
1102
|
+
"readonly",
|
|
1103
|
+
"required",
|
|
1104
|
+
"reversed",
|
|
1105
|
+
"seamless",
|
|
1106
|
+
"selected",
|
|
1107
|
+
"adauctionheaders",
|
|
1108
|
+
"browsingtopics",
|
|
1109
|
+
"credentialless",
|
|
1110
|
+
"defaultchecked",
|
|
1111
|
+
"defaultmuted",
|
|
1112
|
+
"defaultselected",
|
|
1113
|
+
"defer",
|
|
1114
|
+
"disablepictureinpicture",
|
|
1115
|
+
"disableremoteplayback",
|
|
1116
|
+
"preservespitch",
|
|
1117
|
+
"shadowrootclonable",
|
|
1118
|
+
"shadowrootcustomelementregistry",
|
|
1119
|
+
"shadowrootdelegatesfocus",
|
|
1120
|
+
"shadowrootserializable",
|
|
1121
|
+
"sharedstoragewritable"
|
|
1122
|
+
]
|
|
1123
|
+
]);
|
|
1124
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
1125
|
+
"innerHTML",
|
|
1126
|
+
"textContent",
|
|
1127
|
+
"innerText",
|
|
1128
|
+
"children"
|
|
1129
|
+
]);
|
|
1130
|
+
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
1131
|
+
className: "class",
|
|
1132
|
+
htmlFor: "for"
|
|
1133
|
+
});
|
|
1134
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
1135
|
+
class: "className",
|
|
1136
|
+
novalidate: {
|
|
1137
|
+
$: "noValidate",
|
|
1138
|
+
FORM: 1
|
|
1139
|
+
},
|
|
1140
|
+
formnovalidate: {
|
|
1141
|
+
$: "formNoValidate",
|
|
1142
|
+
BUTTON: 1,
|
|
1143
|
+
INPUT: 1
|
|
1144
|
+
},
|
|
1145
|
+
ismap: {
|
|
1146
|
+
$: "isMap",
|
|
1147
|
+
IMG: 1
|
|
1148
|
+
},
|
|
1149
|
+
nomodule: {
|
|
1150
|
+
$: "noModule",
|
|
1151
|
+
SCRIPT: 1
|
|
1152
|
+
},
|
|
1153
|
+
playsinline: {
|
|
1154
|
+
$: "playsInline",
|
|
1155
|
+
VIDEO: 1
|
|
1156
|
+
},
|
|
1157
|
+
readonly: {
|
|
1158
|
+
$: "readOnly",
|
|
1159
|
+
INPUT: 1,
|
|
1160
|
+
TEXTAREA: 1
|
|
1161
|
+
},
|
|
1162
|
+
adauctionheaders: {
|
|
1163
|
+
$: "adAuctionHeaders",
|
|
1164
|
+
IFRAME: 1
|
|
1165
|
+
},
|
|
1166
|
+
allowfullscreen: {
|
|
1167
|
+
$: "allowFullscreen",
|
|
1168
|
+
IFRAME: 1
|
|
1169
|
+
},
|
|
1170
|
+
browsingtopics: {
|
|
1171
|
+
$: "browsingTopics",
|
|
1172
|
+
IMG: 1
|
|
1173
|
+
},
|
|
1174
|
+
defaultchecked: {
|
|
1175
|
+
$: "defaultChecked",
|
|
1176
|
+
INPUT: 1
|
|
1177
|
+
},
|
|
1178
|
+
defaultmuted: {
|
|
1179
|
+
$: "defaultMuted",
|
|
1180
|
+
AUDIO: 1,
|
|
1181
|
+
VIDEO: 1
|
|
1182
|
+
},
|
|
1183
|
+
defaultselected: {
|
|
1184
|
+
$: "defaultSelected",
|
|
1185
|
+
OPTION: 1
|
|
1186
|
+
},
|
|
1187
|
+
disablepictureinpicture: {
|
|
1188
|
+
$: "disablePictureInPicture",
|
|
1189
|
+
VIDEO: 1
|
|
1190
|
+
},
|
|
1191
|
+
disableremoteplayback: {
|
|
1192
|
+
$: "disableRemotePlayback",
|
|
1193
|
+
AUDIO: 1,
|
|
1194
|
+
VIDEO: 1
|
|
1195
|
+
},
|
|
1196
|
+
preservespitch: {
|
|
1197
|
+
$: "preservesPitch",
|
|
1198
|
+
AUDIO: 1,
|
|
1199
|
+
VIDEO: 1
|
|
1200
|
+
},
|
|
1201
|
+
shadowrootclonable: {
|
|
1202
|
+
$: "shadowRootClonable",
|
|
1203
|
+
TEMPLATE: 1
|
|
1204
|
+
},
|
|
1205
|
+
shadowrootdelegatesfocus: {
|
|
1206
|
+
$: "shadowRootDelegatesFocus",
|
|
1207
|
+
TEMPLATE: 1
|
|
1208
|
+
},
|
|
1209
|
+
shadowrootserializable: {
|
|
1210
|
+
$: "shadowRootSerializable",
|
|
1211
|
+
TEMPLATE: 1
|
|
1212
|
+
},
|
|
1213
|
+
sharedstoragewritable: {
|
|
1214
|
+
$: "sharedStorageWritable",
|
|
1215
|
+
IFRAME: 1,
|
|
1216
|
+
IMG: 1
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
function getPropAlias(prop, tagName) {
|
|
1220
|
+
const a = PropAliases[prop];
|
|
1221
|
+
return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
|
|
1222
|
+
}
|
|
1223
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
1224
|
+
"beforeinput",
|
|
1225
|
+
"click",
|
|
1226
|
+
"dblclick",
|
|
1227
|
+
"contextmenu",
|
|
1228
|
+
"focusin",
|
|
1229
|
+
"focusout",
|
|
1230
|
+
"input",
|
|
1231
|
+
"keydown",
|
|
1232
|
+
"keyup",
|
|
1233
|
+
"mousedown",
|
|
1234
|
+
"mousemove",
|
|
1235
|
+
"mouseout",
|
|
1236
|
+
"mouseover",
|
|
1237
|
+
"mouseup",
|
|
1238
|
+
"pointerdown",
|
|
1239
|
+
"pointermove",
|
|
1240
|
+
"pointerout",
|
|
1241
|
+
"pointerover",
|
|
1242
|
+
"pointerup",
|
|
1243
|
+
"touchend",
|
|
1244
|
+
"touchmove",
|
|
1245
|
+
"touchstart"
|
|
1246
|
+
]);
|
|
1247
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
1248
|
+
"altGlyph",
|
|
1249
|
+
"altGlyphDef",
|
|
1250
|
+
"altGlyphItem",
|
|
1251
|
+
"animate",
|
|
1252
|
+
"animateColor",
|
|
1253
|
+
"animateMotion",
|
|
1254
|
+
"animateTransform",
|
|
1255
|
+
"circle",
|
|
1256
|
+
"clipPath",
|
|
1257
|
+
"color-profile",
|
|
1258
|
+
"cursor",
|
|
1259
|
+
"defs",
|
|
1260
|
+
"desc",
|
|
1261
|
+
"ellipse",
|
|
1262
|
+
"feBlend",
|
|
1263
|
+
"feColorMatrix",
|
|
1264
|
+
"feComponentTransfer",
|
|
1265
|
+
"feComposite",
|
|
1266
|
+
"feConvolveMatrix",
|
|
1267
|
+
"feDiffuseLighting",
|
|
1268
|
+
"feDisplacementMap",
|
|
1269
|
+
"feDistantLight",
|
|
1270
|
+
"feDropShadow",
|
|
1271
|
+
"feFlood",
|
|
1272
|
+
"feFuncA",
|
|
1273
|
+
"feFuncB",
|
|
1274
|
+
"feFuncG",
|
|
1275
|
+
"feFuncR",
|
|
1276
|
+
"feGaussianBlur",
|
|
1277
|
+
"feImage",
|
|
1278
|
+
"feMerge",
|
|
1279
|
+
"feMergeNode",
|
|
1280
|
+
"feMorphology",
|
|
1281
|
+
"feOffset",
|
|
1282
|
+
"fePointLight",
|
|
1283
|
+
"feSpecularLighting",
|
|
1284
|
+
"feSpotLight",
|
|
1285
|
+
"feTile",
|
|
1286
|
+
"feTurbulence",
|
|
1287
|
+
"filter",
|
|
1288
|
+
"font",
|
|
1289
|
+
"font-face",
|
|
1290
|
+
"font-face-format",
|
|
1291
|
+
"font-face-name",
|
|
1292
|
+
"font-face-src",
|
|
1293
|
+
"font-face-uri",
|
|
1294
|
+
"foreignObject",
|
|
1295
|
+
"g",
|
|
1296
|
+
"glyph",
|
|
1297
|
+
"glyphRef",
|
|
1298
|
+
"hkern",
|
|
1299
|
+
"image",
|
|
1300
|
+
"line",
|
|
1301
|
+
"linearGradient",
|
|
1302
|
+
"marker",
|
|
1303
|
+
"mask",
|
|
1304
|
+
"metadata",
|
|
1305
|
+
"missing-glyph",
|
|
1306
|
+
"mpath",
|
|
1307
|
+
"path",
|
|
1308
|
+
"pattern",
|
|
1309
|
+
"polygon",
|
|
1310
|
+
"polyline",
|
|
1311
|
+
"radialGradient",
|
|
1312
|
+
"rect",
|
|
1313
|
+
"set",
|
|
1314
|
+
"stop",
|
|
1315
|
+
"svg",
|
|
1316
|
+
"switch",
|
|
1317
|
+
"symbol",
|
|
1318
|
+
"text",
|
|
1319
|
+
"textPath",
|
|
1320
|
+
"tref",
|
|
1321
|
+
"tspan",
|
|
1322
|
+
"use",
|
|
1323
|
+
"view",
|
|
1324
|
+
"vkern"
|
|
1325
|
+
]);
|
|
1326
|
+
const SVGNamespace = {
|
|
1327
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
1328
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
1329
|
+
};
|
|
1330
|
+
const memo = (fn) => createMemo(() => fn());
|
|
1331
|
+
function reconcileArrays(parentNode, a, b) {
|
|
1332
|
+
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
1333
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
1334
|
+
if (a[aStart] === b[bStart]) {
|
|
1335
|
+
aStart++;
|
|
1336
|
+
bStart++;
|
|
1337
|
+
continue;
|
|
1338
|
+
}
|
|
1339
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
1340
|
+
aEnd--;
|
|
1341
|
+
bEnd--;
|
|
1342
|
+
}
|
|
1343
|
+
if (aEnd === aStart) {
|
|
1344
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
1345
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
1346
|
+
} else if (bEnd === bStart) while (aStart < aEnd) {
|
|
1347
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
1348
|
+
aStart++;
|
|
1349
|
+
}
|
|
1350
|
+
else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
1351
|
+
const node = a[--aEnd].nextSibling;
|
|
1352
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
1353
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
1354
|
+
a[aEnd] = b[bEnd];
|
|
1355
|
+
} else {
|
|
1356
|
+
if (!map) {
|
|
1357
|
+
map = /* @__PURE__ */ new Map();
|
|
1358
|
+
let i = bStart;
|
|
1359
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
1360
|
+
}
|
|
1361
|
+
const index = map.get(a[aStart]);
|
|
1362
|
+
if (index != null) {
|
|
1363
|
+
if (bStart < index && index < bEnd) {
|
|
1364
|
+
let i = aStart, sequence = 1, t;
|
|
1365
|
+
while (++i < aEnd && i < bEnd) {
|
|
1366
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
1367
|
+
sequence++;
|
|
1368
|
+
}
|
|
1369
|
+
if (sequence > index - bStart) {
|
|
1370
|
+
const node = a[aStart];
|
|
1371
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
1372
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
1373
|
+
} else aStart++;
|
|
1374
|
+
} else a[aStart++].remove();
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
const $$EVENTS = "_$DX_DELEGATE";
|
|
1379
|
+
function render(code, element, init, options = {}) {
|
|
1380
|
+
let disposer;
|
|
1381
|
+
createRoot((dispose) => {
|
|
1382
|
+
disposer = dispose;
|
|
1383
|
+
element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
|
|
1384
|
+
}, options.owner);
|
|
1385
|
+
return () => {
|
|
1386
|
+
disposer();
|
|
1387
|
+
element.textContent = "";
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
1391
|
+
let node;
|
|
1392
|
+
const create = () => {
|
|
1393
|
+
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
1394
|
+
t.innerHTML = html;
|
|
1395
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
1396
|
+
};
|
|
1397
|
+
const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
1398
|
+
fn.cloneNode = fn;
|
|
1399
|
+
return fn;
|
|
1400
|
+
}
|
|
1401
|
+
function delegateEvents(eventNames, document = window.document) {
|
|
1402
|
+
const e = document[$$EVENTS] || (document[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
1403
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
1404
|
+
const name = eventNames[i];
|
|
1405
|
+
if (!e.has(name)) {
|
|
1406
|
+
e.add(name);
|
|
1407
|
+
document.addEventListener(name, eventHandler);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
function clearDelegatedEvents(document = window.document) {
|
|
1412
|
+
if (document[$$EVENTS]) {
|
|
1413
|
+
for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
|
|
1414
|
+
delete document[$$EVENTS];
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
function setAttribute(node, name, value) {
|
|
1418
|
+
if (isHydrating(node)) return;
|
|
1419
|
+
if (value == null) node.removeAttribute(name);
|
|
1420
|
+
else node.setAttribute(name, value);
|
|
1421
|
+
}
|
|
1422
|
+
function setAttributeNS(node, namespace, name, value) {
|
|
1423
|
+
if (isHydrating(node)) return;
|
|
1424
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
1425
|
+
else node.setAttributeNS(namespace, name, value);
|
|
1426
|
+
}
|
|
1427
|
+
function setBoolAttribute(node, name, value) {
|
|
1428
|
+
if (isHydrating(node)) return;
|
|
1429
|
+
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
1430
|
+
}
|
|
1431
|
+
function className(node, value) {
|
|
1432
|
+
if (isHydrating(node)) return;
|
|
1433
|
+
if (value == null) node.removeAttribute("class");
|
|
1434
|
+
else node.className = value;
|
|
1435
|
+
}
|
|
1436
|
+
function addEventListener(node, name, handler, delegate) {
|
|
1437
|
+
if (delegate) {
|
|
1438
|
+
if (Array.isArray(handler)) {
|
|
1439
|
+
node[`$$${name}`] = handler[0];
|
|
1440
|
+
node[`$$${name}Data`] = handler[1];
|
|
1441
|
+
} else node[`$$${name}`] = handler;
|
|
1442
|
+
} else if (Array.isArray(handler)) {
|
|
1443
|
+
const handlerFn = handler[0];
|
|
1444
|
+
node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
|
|
1445
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
1446
|
+
}
|
|
1447
|
+
function classList(node, value, prev = {}) {
|
|
1448
|
+
const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
|
|
1449
|
+
let i, len;
|
|
1450
|
+
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
1451
|
+
const key = prevKeys[i];
|
|
1452
|
+
if (!key || key === "undefined" || value[key]) continue;
|
|
1453
|
+
toggleClassKey(node, key, false);
|
|
1454
|
+
delete prev[key];
|
|
1455
|
+
}
|
|
1456
|
+
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
1457
|
+
const key = classKeys[i], classValue = !!value[key];
|
|
1458
|
+
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
1459
|
+
toggleClassKey(node, key, true);
|
|
1460
|
+
prev[key] = classValue;
|
|
1461
|
+
}
|
|
1462
|
+
return prev;
|
|
1463
|
+
}
|
|
1464
|
+
function style(node, value, prev) {
|
|
1465
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
1466
|
+
const nodeStyle = node.style;
|
|
1467
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
1468
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
|
|
1469
|
+
prev || (prev = {});
|
|
1470
|
+
value || (value = {});
|
|
1471
|
+
let v, s;
|
|
1472
|
+
for (s in prev) {
|
|
1473
|
+
value[s] ?? nodeStyle.removeProperty(s);
|
|
1474
|
+
delete prev[s];
|
|
1475
|
+
}
|
|
1476
|
+
for (s in value) {
|
|
1477
|
+
v = value[s];
|
|
1478
|
+
if (v !== prev[s]) {
|
|
1479
|
+
nodeStyle.setProperty(s, v);
|
|
1480
|
+
prev[s] = v;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return prev;
|
|
1484
|
+
}
|
|
1485
|
+
function setStyleProperty(node, name, value) {
|
|
1486
|
+
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
1487
|
+
}
|
|
1488
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
1489
|
+
const prevProps = {};
|
|
1490
|
+
if (!skipChildren) createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
1491
|
+
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
1492
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
1493
|
+
return prevProps;
|
|
1494
|
+
}
|
|
1495
|
+
function use(fn, element, arg) {
|
|
1496
|
+
return untrack(() => fn(element, arg));
|
|
1497
|
+
}
|
|
1498
|
+
function insert(parent, accessor, marker, initial) {
|
|
1499
|
+
if (marker !== void 0 && !initial) initial = [];
|
|
1500
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
1501
|
+
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
1502
|
+
}
|
|
1503
|
+
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
1504
|
+
props || (props = {});
|
|
1505
|
+
for (const prop in prevProps) if (!(prop in props)) {
|
|
1506
|
+
if (prop === "children") continue;
|
|
1507
|
+
prevProps[prop] = assignProp$1(node, prop, null, prevProps[prop], isSVG, skipRef, props);
|
|
1508
|
+
}
|
|
1509
|
+
for (const prop in props) {
|
|
1510
|
+
if (prop === "children") {
|
|
1511
|
+
if (!skipChildren) insertExpression(node, props.children);
|
|
1512
|
+
continue;
|
|
1513
|
+
}
|
|
1514
|
+
const value = props[prop];
|
|
1515
|
+
prevProps[prop] = assignProp$1(node, prop, value, prevProps[prop], isSVG, skipRef, props);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
function getNextElement(template) {
|
|
1519
|
+
let node, key;
|
|
1520
|
+
if (!isHydrating() || !(node = sharedConfig.registry.get(key = getHydrationKey()))) return template();
|
|
1521
|
+
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
1522
|
+
sharedConfig.registry.delete(key);
|
|
1523
|
+
return node;
|
|
1524
|
+
}
|
|
1525
|
+
function isHydrating(node) {
|
|
1526
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
1527
|
+
}
|
|
1528
|
+
function toPropertyName(name) {
|
|
1529
|
+
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
1530
|
+
}
|
|
1531
|
+
function toggleClassKey(node, key, value) {
|
|
1532
|
+
const classNames = key.trim().split(/\s+/);
|
|
1533
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
1534
|
+
}
|
|
1535
|
+
function assignProp$1(node, prop, value, prev, isSVG, skipRef, props) {
|
|
1536
|
+
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
1537
|
+
if (prop === "style") return style(node, value, prev);
|
|
1538
|
+
if (prop === "classList") return classList(node, value, prev);
|
|
1539
|
+
if (value === prev) return prev;
|
|
1540
|
+
if (prop === "ref") {
|
|
1541
|
+
if (!skipRef) value(node);
|
|
1542
|
+
} else if (prop.slice(0, 3) === "on:") {
|
|
1543
|
+
const e = prop.slice(3);
|
|
1544
|
+
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
1545
|
+
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
1546
|
+
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
1547
|
+
const e = prop.slice(10);
|
|
1548
|
+
prev && node.removeEventListener(e, prev, true);
|
|
1549
|
+
value && node.addEventListener(e, value, true);
|
|
1550
|
+
} else if (prop.slice(0, 2) === "on") {
|
|
1551
|
+
const name = prop.slice(2).toLowerCase();
|
|
1552
|
+
const delegate = DelegatedEvents.has(name);
|
|
1553
|
+
if (!delegate && prev) {
|
|
1554
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
1555
|
+
node.removeEventListener(name, h);
|
|
1556
|
+
}
|
|
1557
|
+
if (delegate || value) {
|
|
1558
|
+
addEventListener(node, name, value, delegate);
|
|
1559
|
+
delegate && delegateEvents([name]);
|
|
1560
|
+
}
|
|
1561
|
+
} else if (prop.slice(0, 5) === "attr:") setAttribute(node, prop.slice(5), value);
|
|
1562
|
+
else if (prop.slice(0, 5) === "bool:") setBoolAttribute(node, prop.slice(5), value);
|
|
1563
|
+
else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || "is" in props)) {
|
|
1564
|
+
if (forceProp) {
|
|
1565
|
+
prop = prop.slice(5);
|
|
1566
|
+
isProp = true;
|
|
1567
|
+
} else if (isHydrating(node)) return value;
|
|
1568
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
1569
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
1570
|
+
else node[propAlias || prop] = value;
|
|
1571
|
+
} else {
|
|
1572
|
+
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
1573
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
1574
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
1575
|
+
}
|
|
1576
|
+
return value;
|
|
1577
|
+
}
|
|
1578
|
+
function eventHandler(e) {
|
|
1579
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
1580
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
1581
|
+
}
|
|
1582
|
+
let node = e.target;
|
|
1583
|
+
const key = `$$${e.type}`;
|
|
1584
|
+
const oriTarget = e.target;
|
|
1585
|
+
const oriCurrentTarget = e.currentTarget;
|
|
1586
|
+
const retarget = (value) => Object.defineProperty(e, "target", {
|
|
1587
|
+
configurable: true,
|
|
1588
|
+
value
|
|
1589
|
+
});
|
|
1590
|
+
const handleNode = () => {
|
|
1591
|
+
const handler = node[key];
|
|
1592
|
+
if (handler && !node.disabled) {
|
|
1593
|
+
const data = node[`${key}Data`];
|
|
1594
|
+
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
1595
|
+
if (e.cancelBubble) return;
|
|
1596
|
+
}
|
|
1597
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
1598
|
+
return true;
|
|
1599
|
+
};
|
|
1600
|
+
const walkUpTree = () => {
|
|
1601
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host));
|
|
1602
|
+
};
|
|
1603
|
+
Object.defineProperty(e, "currentTarget", {
|
|
1604
|
+
configurable: true,
|
|
1605
|
+
get() {
|
|
1606
|
+
return node || document;
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
1610
|
+
if (e.composedPath) {
|
|
1611
|
+
const path = e.composedPath();
|
|
1612
|
+
retarget(path[0]);
|
|
1613
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
1614
|
+
node = path[i];
|
|
1615
|
+
if (!handleNode()) break;
|
|
1616
|
+
if (node._$host) {
|
|
1617
|
+
node = node._$host;
|
|
1618
|
+
walkUpTree();
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
if (node.parentNode === oriCurrentTarget) break;
|
|
1622
|
+
}
|
|
1623
|
+
} else walkUpTree();
|
|
1624
|
+
retarget(oriTarget);
|
|
1625
|
+
}
|
|
1626
|
+
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
1627
|
+
const hydrating = isHydrating(parent);
|
|
1628
|
+
if (hydrating) {
|
|
1629
|
+
!current && (current = [...parent.childNodes]);
|
|
1630
|
+
let cleaned = [];
|
|
1631
|
+
for (let i = 0; i < current.length; i++) {
|
|
1632
|
+
const node = current[i];
|
|
1633
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
1634
|
+
else cleaned.push(node);
|
|
1635
|
+
}
|
|
1636
|
+
current = cleaned;
|
|
1637
|
+
}
|
|
1638
|
+
while (typeof current === "function") current = current();
|
|
1639
|
+
if (value === current) return current;
|
|
1640
|
+
const t = typeof value, multi = marker !== void 0;
|
|
1641
|
+
parent = multi && current[0] && current[0].parentNode || parent;
|
|
1642
|
+
if (t === "string" || t === "number") {
|
|
1643
|
+
if (hydrating) return current;
|
|
1644
|
+
if (t === "number") {
|
|
1645
|
+
value = value.toString();
|
|
1646
|
+
if (value === current) return current;
|
|
1647
|
+
}
|
|
1648
|
+
if (multi) {
|
|
1649
|
+
let node = current[0];
|
|
1650
|
+
if (node && node.nodeType === 3) node.data !== value && (node.data = value);
|
|
1651
|
+
else node = document.createTextNode(value);
|
|
1652
|
+
current = cleanChildren(parent, current, marker, node);
|
|
1653
|
+
} else if (current !== "" && typeof current === "string") current = parent.firstChild.data = value;
|
|
1654
|
+
else current = parent.textContent = value;
|
|
1655
|
+
} else if (value == null || t === "boolean") {
|
|
1656
|
+
if (hydrating) return current;
|
|
1657
|
+
current = cleanChildren(parent, current, marker);
|
|
1658
|
+
} else if (t === "function") {
|
|
1659
|
+
createRenderEffect(() => {
|
|
1660
|
+
let v = value();
|
|
1661
|
+
while (typeof v === "function") v = v();
|
|
1662
|
+
current = insertExpression(parent, v, current, marker);
|
|
1663
|
+
});
|
|
1664
|
+
return () => current;
|
|
1665
|
+
} else if (Array.isArray(value)) {
|
|
1666
|
+
const array = [];
|
|
1667
|
+
const currentArray = current && Array.isArray(current);
|
|
1668
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
1669
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
1670
|
+
return () => current;
|
|
1671
|
+
}
|
|
1672
|
+
if (hydrating) {
|
|
1673
|
+
if (!array.length) return current;
|
|
1674
|
+
if (marker === void 0) return current = [...parent.childNodes];
|
|
1675
|
+
let node = array[0];
|
|
1676
|
+
if (node.parentNode !== parent) return current;
|
|
1677
|
+
const nodes = [node];
|
|
1678
|
+
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
1679
|
+
return current = nodes;
|
|
1680
|
+
}
|
|
1681
|
+
if (array.length === 0) {
|
|
1682
|
+
current = cleanChildren(parent, current, marker);
|
|
1683
|
+
if (multi) return current;
|
|
1684
|
+
} else if (currentArray) {
|
|
1685
|
+
if (current.length === 0) appendNodes(parent, array, marker);
|
|
1686
|
+
else reconcileArrays(parent, current, array);
|
|
1687
|
+
} else {
|
|
1688
|
+
current && cleanChildren(parent);
|
|
1689
|
+
appendNodes(parent, array);
|
|
1690
|
+
}
|
|
1691
|
+
current = array;
|
|
1692
|
+
} else if (value.nodeType) {
|
|
1693
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
1694
|
+
if (Array.isArray(current)) {
|
|
1695
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
1696
|
+
cleanChildren(parent, current, null, value);
|
|
1697
|
+
} else if (current == null || current === "" || !parent.firstChild) parent.appendChild(value);
|
|
1698
|
+
else parent.replaceChild(value, parent.firstChild);
|
|
1699
|
+
current = value;
|
|
1700
|
+
}
|
|
1701
|
+
return current;
|
|
1702
|
+
}
|
|
1703
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
1704
|
+
let dynamic = false;
|
|
1705
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1706
|
+
let item = array[i], prev = current && current[normalized.length], t;
|
|
1707
|
+
if (item == null || item === true || item === false);
|
|
1708
|
+
else if ((t = typeof item) === "object" && item.nodeType) normalized.push(item);
|
|
1709
|
+
else if (Array.isArray(item)) dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
1710
|
+
else if (t === "function") {
|
|
1711
|
+
if (unwrap) {
|
|
1712
|
+
while (typeof item === "function") item = item();
|
|
1713
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
1714
|
+
} else {
|
|
1715
|
+
normalized.push(item);
|
|
1716
|
+
dynamic = true;
|
|
1717
|
+
}
|
|
1718
|
+
} else {
|
|
1719
|
+
const value = String(item);
|
|
1720
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1721
|
+
else normalized.push(document.createTextNode(value));
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
return dynamic;
|
|
1725
|
+
}
|
|
1726
|
+
function appendNodes(parent, array, marker = null) {
|
|
1727
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
1728
|
+
}
|
|
1729
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
1730
|
+
if (marker === void 0) return parent.textContent = "";
|
|
1731
|
+
const node = replacement || document.createTextNode("");
|
|
1732
|
+
if (current.length) {
|
|
1733
|
+
let inserted = false;
|
|
1734
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
1735
|
+
const el = current[i];
|
|
1736
|
+
if (node !== el) {
|
|
1737
|
+
const isParent = el.parentNode === parent;
|
|
1738
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1739
|
+
else isParent && el.remove();
|
|
1740
|
+
} else inserted = true;
|
|
1741
|
+
}
|
|
1742
|
+
} else parent.insertBefore(node, marker);
|
|
1743
|
+
return [node];
|
|
1744
|
+
}
|
|
1745
|
+
function getHydrationKey() {
|
|
1746
|
+
return sharedConfig.getNextContextId();
|
|
1747
|
+
}
|
|
1748
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
1749
|
+
function createElement(tagName, isSVG = false, is = void 0) {
|
|
1750
|
+
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, { is });
|
|
1751
|
+
}
|
|
1752
|
+
function Portal(props) {
|
|
1753
|
+
const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
|
|
1754
|
+
let content;
|
|
1755
|
+
let hydrating = !!sharedConfig.context;
|
|
1756
|
+
createEffect(() => {
|
|
1757
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1758
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1759
|
+
const el = mount();
|
|
1760
|
+
if (el instanceof HTMLHeadElement) {
|
|
1761
|
+
const [clean, setClean] = createSignal(false);
|
|
1762
|
+
const cleanup = () => setClean(true);
|
|
1763
|
+
createRoot((dispose) => insert(el, () => !clean() ? content() : dispose(), null));
|
|
1764
|
+
onCleanup(cleanup);
|
|
1765
|
+
} else {
|
|
1766
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({ mode: "open" }) : container;
|
|
1767
|
+
Object.defineProperty(container, "_$host", {
|
|
1768
|
+
get() {
|
|
1769
|
+
return marker.parentNode;
|
|
1770
|
+
},
|
|
1771
|
+
configurable: true
|
|
1772
|
+
});
|
|
1773
|
+
insert(renderRoot, content);
|
|
1774
|
+
el.appendChild(container);
|
|
1775
|
+
props.ref && props.ref(container);
|
|
1776
|
+
onCleanup(() => el.removeChild(container));
|
|
1777
|
+
}
|
|
1778
|
+
}, void 0, { render: !hydrating });
|
|
1779
|
+
return marker;
|
|
1780
|
+
}
|
|
1781
|
+
function createDynamic(component, props) {
|
|
1782
|
+
const cached = createMemo(component);
|
|
1783
|
+
return createMemo(() => {
|
|
1784
|
+
const component = cached();
|
|
1785
|
+
switch (typeof component) {
|
|
1786
|
+
case "function": return untrack(() => component(props));
|
|
1787
|
+
case "string":
|
|
1788
|
+
const isSvg = SVGElements.has(component);
|
|
1789
|
+
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
|
|
1790
|
+
spread(el, props, isSvg);
|
|
1791
|
+
return el;
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
function Dynamic(props) {
|
|
1796
|
+
const [, others] = splitProps(props, ["component"]);
|
|
1797
|
+
return createDynamic(() => props.component, others);
|
|
1798
|
+
}
|
|
1799
|
+
//#endregion
|
|
1800
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/double-indexed-kv.js
|
|
1801
|
+
var DoubleIndexedKV = class {
|
|
1802
|
+
constructor() {
|
|
1803
|
+
this.keyToValue = /* @__PURE__ */ new Map();
|
|
1804
|
+
this.valueToKey = /* @__PURE__ */ new Map();
|
|
1805
|
+
}
|
|
1806
|
+
set(key, value) {
|
|
1807
|
+
this.keyToValue.set(key, value);
|
|
1808
|
+
this.valueToKey.set(value, key);
|
|
1809
|
+
}
|
|
1810
|
+
getByKey(key) {
|
|
1811
|
+
return this.keyToValue.get(key);
|
|
1812
|
+
}
|
|
1813
|
+
getByValue(value) {
|
|
1814
|
+
return this.valueToKey.get(value);
|
|
1815
|
+
}
|
|
1816
|
+
clear() {
|
|
1817
|
+
this.keyToValue.clear();
|
|
1818
|
+
this.valueToKey.clear();
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
//#endregion
|
|
1822
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/registry.js
|
|
1823
|
+
var Registry = class {
|
|
1824
|
+
constructor(generateIdentifier) {
|
|
1825
|
+
this.generateIdentifier = generateIdentifier;
|
|
1826
|
+
this.kv = new DoubleIndexedKV();
|
|
1827
|
+
}
|
|
1828
|
+
register(value, identifier) {
|
|
1829
|
+
if (this.kv.getByValue(value)) return;
|
|
1830
|
+
if (!identifier) identifier = this.generateIdentifier(value);
|
|
1831
|
+
this.kv.set(identifier, value);
|
|
1832
|
+
}
|
|
1833
|
+
clear() {
|
|
1834
|
+
this.kv.clear();
|
|
1835
|
+
}
|
|
1836
|
+
getIdentifier(value) {
|
|
1837
|
+
return this.kv.getByValue(value);
|
|
1838
|
+
}
|
|
1839
|
+
getValue(identifier) {
|
|
1840
|
+
return this.kv.getByKey(identifier);
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
//#endregion
|
|
1844
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/class-registry.js
|
|
1845
|
+
var ClassRegistry = class extends Registry {
|
|
1846
|
+
constructor() {
|
|
1847
|
+
super((c) => c.name);
|
|
1848
|
+
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
1849
|
+
}
|
|
1850
|
+
register(value, options) {
|
|
1851
|
+
if (typeof options === "object") {
|
|
1852
|
+
if (options.allowProps) this.classToAllowedProps.set(value, options.allowProps);
|
|
1853
|
+
super.register(value, options.identifier);
|
|
1854
|
+
} else super.register(value, options);
|
|
1855
|
+
}
|
|
1856
|
+
getAllowedProps(value) {
|
|
1857
|
+
return this.classToAllowedProps.get(value);
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/util.js
|
|
1862
|
+
function valuesOfObj(record) {
|
|
1863
|
+
if ("values" in Object) return Object.values(record);
|
|
1864
|
+
const values = [];
|
|
1865
|
+
for (const key in record) if (record.hasOwnProperty(key)) values.push(record[key]);
|
|
1866
|
+
return values;
|
|
1867
|
+
}
|
|
1868
|
+
function find(record, predicate) {
|
|
1869
|
+
const values = valuesOfObj(record);
|
|
1870
|
+
if ("find" in values) return values.find(predicate);
|
|
1871
|
+
const valuesNotNever = values;
|
|
1872
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
1873
|
+
const value = valuesNotNever[i];
|
|
1874
|
+
if (predicate(value)) return value;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
function forEach(record, run) {
|
|
1878
|
+
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
1879
|
+
}
|
|
1880
|
+
function includes(arr, value) {
|
|
1881
|
+
return arr.indexOf(value) !== -1;
|
|
1882
|
+
}
|
|
1883
|
+
function findArr(record, predicate) {
|
|
1884
|
+
for (let i = 0; i < record.length; i++) {
|
|
1885
|
+
const value = record[i];
|
|
1886
|
+
if (predicate(value)) return value;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
//#endregion
|
|
1890
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/custom-transformer-registry.js
|
|
1891
|
+
var CustomTransformerRegistry = class {
|
|
1892
|
+
constructor() {
|
|
1893
|
+
this.transfomers = {};
|
|
1894
|
+
}
|
|
1895
|
+
register(transformer) {
|
|
1896
|
+
this.transfomers[transformer.name] = transformer;
|
|
1897
|
+
}
|
|
1898
|
+
findApplicable(v) {
|
|
1899
|
+
return find(this.transfomers, (transformer) => transformer.isApplicable(v));
|
|
1900
|
+
}
|
|
1901
|
+
findByName(name) {
|
|
1902
|
+
return this.transfomers[name];
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/is.js
|
|
1907
|
+
const getType$1 = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
|
|
1908
|
+
const isUndefined = (payload) => typeof payload === "undefined";
|
|
1909
|
+
const isNull = (payload) => payload === null;
|
|
1910
|
+
const isPlainObject$1 = (payload) => {
|
|
1911
|
+
if (typeof payload !== "object" || payload === null) return false;
|
|
1912
|
+
if (payload === Object.prototype) return false;
|
|
1913
|
+
if (Object.getPrototypeOf(payload) === null) return true;
|
|
1914
|
+
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
1915
|
+
};
|
|
1916
|
+
const isEmptyObject = (payload) => isPlainObject$1(payload) && Object.keys(payload).length === 0;
|
|
1917
|
+
const isArray$1 = (payload) => Array.isArray(payload);
|
|
1918
|
+
const isString = (payload) => typeof payload === "string";
|
|
1919
|
+
const isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
|
|
1920
|
+
const isBoolean = (payload) => typeof payload === "boolean";
|
|
1921
|
+
const isRegExp = (payload) => payload instanceof RegExp;
|
|
1922
|
+
const isMap = (payload) => payload instanceof Map;
|
|
1923
|
+
const isSet = (payload) => payload instanceof Set;
|
|
1924
|
+
const isSymbol = (payload) => getType$1(payload) === "Symbol";
|
|
1925
|
+
const isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
|
|
1926
|
+
const isError = (payload) => payload instanceof Error;
|
|
1927
|
+
const isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
|
|
1928
|
+
const isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
|
|
1929
|
+
const isBigint = (payload) => typeof payload === "bigint";
|
|
1930
|
+
const isInfinite = (payload) => payload === Infinity || payload === -Infinity;
|
|
1931
|
+
const isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
|
|
1932
|
+
const isURL = (payload) => payload instanceof URL;
|
|
1933
|
+
//#endregion
|
|
1934
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/pathstringifier.js
|
|
1935
|
+
const escapeKey = (key) => key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
|
|
1936
|
+
const stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
|
|
1937
|
+
const parsePath = (string, legacyPaths) => {
|
|
1938
|
+
const result = [];
|
|
1939
|
+
let segment = "";
|
|
1940
|
+
for (let i = 0; i < string.length; i++) {
|
|
1941
|
+
let char = string.charAt(i);
|
|
1942
|
+
if (!legacyPaths && char === "\\") {
|
|
1943
|
+
const escaped = string.charAt(i + 1);
|
|
1944
|
+
if (escaped === "\\") {
|
|
1945
|
+
segment += "\\";
|
|
1946
|
+
i++;
|
|
1947
|
+
continue;
|
|
1948
|
+
} else if (escaped !== ".") throw Error("invalid path");
|
|
1949
|
+
}
|
|
1950
|
+
if (char === "\\" && string.charAt(i + 1) === ".") {
|
|
1951
|
+
segment += ".";
|
|
1952
|
+
i++;
|
|
1953
|
+
continue;
|
|
1954
|
+
}
|
|
1955
|
+
if (char === ".") {
|
|
1956
|
+
result.push(segment);
|
|
1957
|
+
segment = "";
|
|
1958
|
+
continue;
|
|
1959
|
+
}
|
|
1960
|
+
segment += char;
|
|
1961
|
+
}
|
|
1962
|
+
const lastSegment = segment;
|
|
1963
|
+
result.push(lastSegment);
|
|
1964
|
+
return result;
|
|
1965
|
+
};
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/transformer.js
|
|
1968
|
+
function simpleTransformation(isApplicable, annotation, transform, untransform) {
|
|
1969
|
+
return {
|
|
1970
|
+
isApplicable,
|
|
1971
|
+
annotation,
|
|
1972
|
+
transform,
|
|
1973
|
+
untransform
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
const simpleRules = [
|
|
1977
|
+
simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
|
|
1978
|
+
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
1979
|
+
if (typeof BigInt !== "undefined") return BigInt(v);
|
|
1980
|
+
console.error("Please add a BigInt polyfill.");
|
|
1981
|
+
return v;
|
|
1982
|
+
}),
|
|
1983
|
+
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
1984
|
+
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
1985
|
+
const baseError = {
|
|
1986
|
+
name: v.name,
|
|
1987
|
+
message: v.message
|
|
1988
|
+
};
|
|
1989
|
+
if ("cause" in v) baseError.cause = v.cause;
|
|
1990
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
1991
|
+
baseError[prop] = v[prop];
|
|
1992
|
+
});
|
|
1993
|
+
return baseError;
|
|
1994
|
+
}, (v, superJson) => {
|
|
1995
|
+
const e = new Error(v.message, { cause: v.cause });
|
|
1996
|
+
e.name = v.name;
|
|
1997
|
+
e.stack = v.stack;
|
|
1998
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
1999
|
+
e[prop] = v[prop];
|
|
2000
|
+
});
|
|
2001
|
+
return e;
|
|
2002
|
+
}),
|
|
2003
|
+
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
2004
|
+
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
2005
|
+
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
2006
|
+
return new RegExp(body, flags);
|
|
2007
|
+
}),
|
|
2008
|
+
simpleTransformation(isSet, "set", (v) => [...v.values()], (v) => new Set(v)),
|
|
2009
|
+
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
2010
|
+
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
2011
|
+
if (isNaNValue(v)) return "NaN";
|
|
2012
|
+
if (v > 0) return "Infinity";
|
|
2013
|
+
else return "-Infinity";
|
|
2014
|
+
}, Number),
|
|
2015
|
+
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
2016
|
+
return "-0";
|
|
2017
|
+
}, Number),
|
|
2018
|
+
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
2019
|
+
];
|
|
2020
|
+
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
2021
|
+
return {
|
|
2022
|
+
isApplicable,
|
|
2023
|
+
annotation,
|
|
2024
|
+
transform,
|
|
2025
|
+
untransform
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
const symbolRule = compositeTransformation((s, superJson) => {
|
|
2029
|
+
if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
|
|
2030
|
+
return false;
|
|
2031
|
+
}, (s, superJson) => {
|
|
2032
|
+
return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
|
|
2033
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
2034
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
2035
|
+
if (!value) throw new Error("Trying to deserialize unknown symbol");
|
|
2036
|
+
return value;
|
|
2037
|
+
});
|
|
2038
|
+
const constructorToName = [
|
|
2039
|
+
Int8Array,
|
|
2040
|
+
Uint8Array,
|
|
2041
|
+
Int16Array,
|
|
2042
|
+
Uint16Array,
|
|
2043
|
+
Int32Array,
|
|
2044
|
+
Uint32Array,
|
|
2045
|
+
Float32Array,
|
|
2046
|
+
Float64Array,
|
|
2047
|
+
Uint8ClampedArray
|
|
2048
|
+
].reduce((obj, ctor) => {
|
|
2049
|
+
obj[ctor.name] = ctor;
|
|
2050
|
+
return obj;
|
|
2051
|
+
}, {});
|
|
2052
|
+
const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
2053
|
+
const ctor = constructorToName[a[1]];
|
|
2054
|
+
if (!ctor) throw new Error("Trying to deserialize unknown typed array");
|
|
2055
|
+
return new ctor(v);
|
|
2056
|
+
});
|
|
2057
|
+
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
2058
|
+
if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
2059
|
+
return false;
|
|
2060
|
+
}
|
|
2061
|
+
const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
2062
|
+
return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
|
|
2063
|
+
}, (clazz, superJson) => {
|
|
2064
|
+
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
2065
|
+
if (!allowedProps) return { ...clazz };
|
|
2066
|
+
const result = {};
|
|
2067
|
+
allowedProps.forEach((prop) => {
|
|
2068
|
+
result[prop] = clazz[prop];
|
|
2069
|
+
});
|
|
2070
|
+
return result;
|
|
2071
|
+
}, (v, a, superJson) => {
|
|
2072
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
2073
|
+
if (!clazz) throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
2074
|
+
return Object.assign(Object.create(clazz.prototype), v);
|
|
2075
|
+
});
|
|
2076
|
+
const customRule = compositeTransformation((value, superJson) => {
|
|
2077
|
+
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
2078
|
+
}, (value, superJson) => {
|
|
2079
|
+
return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
|
|
2080
|
+
}, (value, superJson) => {
|
|
2081
|
+
return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
|
|
2082
|
+
}, (v, a, superJson) => {
|
|
2083
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
2084
|
+
if (!transformer) throw new Error("Trying to deserialize unknown custom value");
|
|
2085
|
+
return transformer.deserialize(v);
|
|
2086
|
+
});
|
|
2087
|
+
const compositeRules = [
|
|
2088
|
+
classRule,
|
|
2089
|
+
symbolRule,
|
|
2090
|
+
customRule,
|
|
2091
|
+
typedArrayRule
|
|
2092
|
+
];
|
|
2093
|
+
const transformValue = (value, superJson) => {
|
|
2094
|
+
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
2095
|
+
if (applicableCompositeRule) return {
|
|
2096
|
+
value: applicableCompositeRule.transform(value, superJson),
|
|
2097
|
+
type: applicableCompositeRule.annotation(value, superJson)
|
|
2098
|
+
};
|
|
2099
|
+
const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
|
|
2100
|
+
if (applicableSimpleRule) return {
|
|
2101
|
+
value: applicableSimpleRule.transform(value, superJson),
|
|
2102
|
+
type: applicableSimpleRule.annotation
|
|
2103
|
+
};
|
|
2104
|
+
};
|
|
2105
|
+
const simpleRulesByAnnotation = {};
|
|
2106
|
+
simpleRules.forEach((rule) => {
|
|
2107
|
+
simpleRulesByAnnotation[rule.annotation] = rule;
|
|
2108
|
+
});
|
|
2109
|
+
const untransformValue = (json, type, superJson) => {
|
|
2110
|
+
if (isArray$1(type)) switch (type[0]) {
|
|
2111
|
+
case "symbol": return symbolRule.untransform(json, type, superJson);
|
|
2112
|
+
case "class": return classRule.untransform(json, type, superJson);
|
|
2113
|
+
case "custom": return customRule.untransform(json, type, superJson);
|
|
2114
|
+
case "typed-array": return typedArrayRule.untransform(json, type, superJson);
|
|
2115
|
+
default: throw new Error("Unknown transformation: " + type);
|
|
2116
|
+
}
|
|
2117
|
+
else {
|
|
2118
|
+
const transformation = simpleRulesByAnnotation[type];
|
|
2119
|
+
if (!transformation) throw new Error("Unknown transformation: " + type);
|
|
2120
|
+
return transformation.untransform(json, superJson);
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
//#endregion
|
|
2124
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/accessDeep.js
|
|
2125
|
+
const getNthKey = (value, n) => {
|
|
2126
|
+
if (n > value.size) throw new Error("index out of bounds");
|
|
2127
|
+
const keys = value.keys();
|
|
2128
|
+
while (n > 0) {
|
|
2129
|
+
keys.next();
|
|
2130
|
+
n--;
|
|
2131
|
+
}
|
|
2132
|
+
return keys.next().value;
|
|
2133
|
+
};
|
|
2134
|
+
function validatePath(path) {
|
|
2135
|
+
if (includes(path, "__proto__")) throw new Error("__proto__ is not allowed as a property");
|
|
2136
|
+
if (includes(path, "prototype")) throw new Error("prototype is not allowed as a property");
|
|
2137
|
+
if (includes(path, "constructor")) throw new Error("constructor is not allowed as a property");
|
|
2138
|
+
}
|
|
2139
|
+
const getDeep = (object, path) => {
|
|
2140
|
+
validatePath(path);
|
|
2141
|
+
for (let i = 0; i < path.length; i++) {
|
|
2142
|
+
const key = path[i];
|
|
2143
|
+
if (isSet(object)) object = getNthKey(object, +key);
|
|
2144
|
+
else if (isMap(object)) {
|
|
2145
|
+
const row = +key;
|
|
2146
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
2147
|
+
const keyOfRow = getNthKey(object, row);
|
|
2148
|
+
switch (type) {
|
|
2149
|
+
case "key":
|
|
2150
|
+
object = keyOfRow;
|
|
2151
|
+
break;
|
|
2152
|
+
case "value": object = object.get(keyOfRow);
|
|
2153
|
+
}
|
|
2154
|
+
} else object = object[key];
|
|
2155
|
+
}
|
|
2156
|
+
return object;
|
|
2157
|
+
};
|
|
2158
|
+
const setDeep = (object, path, mapper) => {
|
|
2159
|
+
validatePath(path);
|
|
2160
|
+
if (path.length === 0) return mapper(object);
|
|
2161
|
+
let parent = object;
|
|
2162
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
2163
|
+
const key = path[i];
|
|
2164
|
+
if (isArray$1(parent)) {
|
|
2165
|
+
const index = +key;
|
|
2166
|
+
parent = parent[index];
|
|
2167
|
+
} else if (isPlainObject$1(parent)) parent = parent[key];
|
|
2168
|
+
else if (isSet(parent)) {
|
|
2169
|
+
const row = +key;
|
|
2170
|
+
parent = getNthKey(parent, row);
|
|
2171
|
+
} else if (isMap(parent)) {
|
|
2172
|
+
if (i === path.length - 2) break;
|
|
2173
|
+
const row = +key;
|
|
2174
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
2175
|
+
const keyOfRow = getNthKey(parent, row);
|
|
2176
|
+
switch (type) {
|
|
2177
|
+
case "key":
|
|
2178
|
+
parent = keyOfRow;
|
|
2179
|
+
break;
|
|
2180
|
+
case "value": parent = parent.get(keyOfRow);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
const lastKey = path[path.length - 1];
|
|
2185
|
+
if (isArray$1(parent)) parent[+lastKey] = mapper(parent[+lastKey]);
|
|
2186
|
+
else if (isPlainObject$1(parent)) parent[lastKey] = mapper(parent[lastKey]);
|
|
2187
|
+
if (isSet(parent)) {
|
|
2188
|
+
const oldValue = getNthKey(parent, +lastKey);
|
|
2189
|
+
const newValue = mapper(oldValue);
|
|
2190
|
+
if (oldValue !== newValue) {
|
|
2191
|
+
parent.delete(oldValue);
|
|
2192
|
+
parent.add(newValue);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
if (isMap(parent)) {
|
|
2196
|
+
const row = +path[path.length - 2];
|
|
2197
|
+
const keyToRow = getNthKey(parent, row);
|
|
2198
|
+
switch (+lastKey === 0 ? "key" : "value") {
|
|
2199
|
+
case "key": {
|
|
2200
|
+
const newKey = mapper(keyToRow);
|
|
2201
|
+
parent.set(newKey, parent.get(keyToRow));
|
|
2202
|
+
if (newKey !== keyToRow) parent.delete(keyToRow);
|
|
2203
|
+
break;
|
|
2204
|
+
}
|
|
2205
|
+
case "value": parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
return object;
|
|
2209
|
+
};
|
|
2210
|
+
//#endregion
|
|
2211
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/plainer.js
|
|
2212
|
+
const enableLegacyPaths = (version) => version < 1;
|
|
2213
|
+
function traverse(tree, walker, version, origin = []) {
|
|
2214
|
+
if (!tree) return;
|
|
2215
|
+
const legacyPaths = enableLegacyPaths(version);
|
|
2216
|
+
if (!isArray$1(tree)) {
|
|
2217
|
+
forEach(tree, (subtree, key) => traverse(subtree, walker, version, [...origin, ...parsePath(key, legacyPaths)]));
|
|
2218
|
+
return;
|
|
2219
|
+
}
|
|
2220
|
+
const [nodeValue, children] = tree;
|
|
2221
|
+
if (children) forEach(children, (child, key) => {
|
|
2222
|
+
traverse(child, walker, version, [...origin, ...parsePath(key, legacyPaths)]);
|
|
2223
|
+
});
|
|
2224
|
+
walker(nodeValue, origin);
|
|
2225
|
+
}
|
|
2226
|
+
function applyValueAnnotations(plain, annotations, version, superJson) {
|
|
2227
|
+
traverse(annotations, (type, path) => {
|
|
2228
|
+
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
2229
|
+
}, version);
|
|
2230
|
+
return plain;
|
|
2231
|
+
}
|
|
2232
|
+
function applyReferentialEqualityAnnotations(plain, annotations, version) {
|
|
2233
|
+
const legacyPaths = enableLegacyPaths(version);
|
|
2234
|
+
function apply(identicalPaths, path) {
|
|
2235
|
+
const object = getDeep(plain, parsePath(path, legacyPaths));
|
|
2236
|
+
identicalPaths.map((path) => parsePath(path, legacyPaths)).forEach((identicalObjectPath) => {
|
|
2237
|
+
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
if (isArray$1(annotations)) {
|
|
2241
|
+
const [root, other] = annotations;
|
|
2242
|
+
root.forEach((identicalPath) => {
|
|
2243
|
+
plain = setDeep(plain, parsePath(identicalPath, legacyPaths), () => plain);
|
|
2244
|
+
});
|
|
2245
|
+
if (other) forEach(other, apply);
|
|
2246
|
+
} else forEach(annotations, apply);
|
|
2247
|
+
return plain;
|
|
2248
|
+
}
|
|
2249
|
+
const isDeep = (object, superJson) => isPlainObject$1(object) || isArray$1(object) || isMap(object) || isSet(object) || isError(object) || isInstanceOfRegisteredClass(object, superJson);
|
|
2250
|
+
function addIdentity(object, path, identities) {
|
|
2251
|
+
const existingSet = identities.get(object);
|
|
2252
|
+
if (existingSet) existingSet.push(path);
|
|
2253
|
+
else identities.set(object, [path]);
|
|
2254
|
+
}
|
|
2255
|
+
function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
2256
|
+
const result = {};
|
|
2257
|
+
let rootEqualityPaths = void 0;
|
|
2258
|
+
identitites.forEach((paths) => {
|
|
2259
|
+
if (paths.length <= 1) return;
|
|
2260
|
+
if (!dedupe) paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
2261
|
+
const [representativePath, ...identicalPaths] = paths;
|
|
2262
|
+
if (representativePath.length === 0) rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
2263
|
+
else result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
2264
|
+
});
|
|
2265
|
+
if (rootEqualityPaths) {
|
|
2266
|
+
if (isEmptyObject(result)) return [rootEqualityPaths];
|
|
2267
|
+
else return [rootEqualityPaths, result];
|
|
2268
|
+
} else return isEmptyObject(result) ? void 0 : result;
|
|
2269
|
+
}
|
|
2270
|
+
const walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
|
|
2271
|
+
const primitive = isPrimitive(object);
|
|
2272
|
+
if (!primitive) {
|
|
2273
|
+
addIdentity(object, path, identities);
|
|
2274
|
+
const seen = seenObjects.get(object);
|
|
2275
|
+
if (seen) return dedupe ? { transformedValue: null } : seen;
|
|
2276
|
+
}
|
|
2277
|
+
if (!isDeep(object, superJson)) {
|
|
2278
|
+
const transformed = transformValue(object, superJson);
|
|
2279
|
+
const result = transformed ? {
|
|
2280
|
+
transformedValue: transformed.value,
|
|
2281
|
+
annotations: [transformed.type]
|
|
2282
|
+
} : { transformedValue: object };
|
|
2283
|
+
if (!primitive) seenObjects.set(object, result);
|
|
2284
|
+
return result;
|
|
2285
|
+
}
|
|
2286
|
+
if (includes(objectsInThisPath, object)) return { transformedValue: null };
|
|
2287
|
+
const transformationResult = transformValue(object, superJson);
|
|
2288
|
+
const transformed = transformationResult?.value ?? object;
|
|
2289
|
+
const transformedValue = isArray$1(transformed) ? [] : {};
|
|
2290
|
+
const innerAnnotations = {};
|
|
2291
|
+
forEach(transformed, (value, index) => {
|
|
2292
|
+
if (index === "__proto__" || index === "constructor" || index === "prototype") throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
2293
|
+
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
2294
|
+
transformedValue[index] = recursiveResult.transformedValue;
|
|
2295
|
+
if (isArray$1(recursiveResult.annotations)) innerAnnotations[escapeKey(index)] = recursiveResult.annotations;
|
|
2296
|
+
else if (isPlainObject$1(recursiveResult.annotations)) forEach(recursiveResult.annotations, (tree, key) => {
|
|
2297
|
+
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
2298
|
+
});
|
|
2299
|
+
});
|
|
2300
|
+
const result = isEmptyObject(innerAnnotations) ? {
|
|
2301
|
+
transformedValue,
|
|
2302
|
+
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
2303
|
+
} : {
|
|
2304
|
+
transformedValue,
|
|
2305
|
+
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
2306
|
+
};
|
|
2307
|
+
if (!primitive) seenObjects.set(object, result);
|
|
2308
|
+
return result;
|
|
2309
|
+
};
|
|
2310
|
+
//#endregion
|
|
2311
|
+
//#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/getType.js
|
|
2312
|
+
/** Returns the object type of the given payload */
|
|
2313
|
+
function getType(payload) {
|
|
2314
|
+
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
2315
|
+
}
|
|
2316
|
+
//#endregion
|
|
2317
|
+
//#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isArray.js
|
|
2318
|
+
/** Returns whether the payload is an array */
|
|
2319
|
+
function isArray(payload) {
|
|
2320
|
+
return getType(payload) === "Array";
|
|
2321
|
+
}
|
|
2322
|
+
//#endregion
|
|
2323
|
+
//#region ../../node_modules/.pnpm/is-what@5.5.0/node_modules/is-what/dist/isPlainObject.js
|
|
2324
|
+
/**
|
|
2325
|
+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects
|
|
2326
|
+
* with other prototypes)
|
|
2327
|
+
*/
|
|
2328
|
+
function isPlainObject(payload) {
|
|
2329
|
+
if (getType(payload) !== "Object") return false;
|
|
2330
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
2331
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
2332
|
+
}
|
|
2333
|
+
//#endregion
|
|
2334
|
+
//#region ../../node_modules/.pnpm/copy-anything@4.0.5/node_modules/copy-anything/dist/index.js
|
|
2335
|
+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
2336
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
2337
|
+
if (propType === "enumerable") carry[key] = newVal;
|
|
2338
|
+
if (includeNonenumerable && propType === "nonenumerable") Object.defineProperty(carry, key, {
|
|
2339
|
+
value: newVal,
|
|
2340
|
+
enumerable: false,
|
|
2341
|
+
writable: true,
|
|
2342
|
+
configurable: true
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
/**
|
|
2346
|
+
* Copy (clone) an object and all its props recursively to get rid of any prop referenced of the
|
|
2347
|
+
* original object. Arrays are also cloned, however objects inside arrays are still linked.
|
|
2348
|
+
*
|
|
2349
|
+
* @param target Target can be anything
|
|
2350
|
+
* @param [options={}] See type {@link Options} for more details.
|
|
2351
|
+
*
|
|
2352
|
+
* - `{ props: ['key1'] }` will only copy the `key1` property. When using this you will need to cast
|
|
2353
|
+
* the return type manually (in order to keep the TS implementation in here simple I didn't
|
|
2354
|
+
* built a complex auto resolved type for those few cases people want to use this option)
|
|
2355
|
+
* - `{ nonenumerable: true }` will copy all non-enumerable properties. Default is `{}`
|
|
2356
|
+
*
|
|
2357
|
+
* @returns The target with replaced values
|
|
2358
|
+
*/
|
|
2359
|
+
function copy(target, options = {}) {
|
|
2360
|
+
if (isArray(target)) return target.map((item) => copy(item, options));
|
|
2361
|
+
if (!isPlainObject(target)) return target;
|
|
2362
|
+
const props = Object.getOwnPropertyNames(target);
|
|
2363
|
+
const symbols = Object.getOwnPropertySymbols(target);
|
|
2364
|
+
return [...props, ...symbols].reduce((carry, key) => {
|
|
2365
|
+
if (key === "__proto__") return carry;
|
|
2366
|
+
if (isArray(options.props) && !options.props.includes(key)) return carry;
|
|
2367
|
+
const val = target[key];
|
|
2368
|
+
assignProp(carry, key, copy(val, options), target, options.nonenumerable);
|
|
2369
|
+
return carry;
|
|
2370
|
+
}, {});
|
|
2371
|
+
}
|
|
2372
|
+
//#endregion
|
|
2373
|
+
//#region ../../node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/index.js
|
|
2374
|
+
var SuperJSON = class {
|
|
2375
|
+
/**
|
|
2376
|
+
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
2377
|
+
*/
|
|
2378
|
+
constructor({ dedupe = false } = {}) {
|
|
2379
|
+
this.classRegistry = new ClassRegistry();
|
|
2380
|
+
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
2381
|
+
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
2382
|
+
this.allowedErrorProps = [];
|
|
2383
|
+
this.dedupe = dedupe;
|
|
2384
|
+
}
|
|
2385
|
+
serialize(object) {
|
|
2386
|
+
const identities = /* @__PURE__ */ new Map();
|
|
2387
|
+
const output = walker(object, identities, this, this.dedupe);
|
|
2388
|
+
const res = { json: output.transformedValue };
|
|
2389
|
+
if (output.annotations) res.meta = {
|
|
2390
|
+
...res.meta,
|
|
2391
|
+
values: output.annotations
|
|
2392
|
+
};
|
|
2393
|
+
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
2394
|
+
if (equalityAnnotations) res.meta = {
|
|
2395
|
+
...res.meta,
|
|
2396
|
+
referentialEqualities: equalityAnnotations
|
|
2397
|
+
};
|
|
2398
|
+
if (res.meta) res.meta.v = 1;
|
|
2399
|
+
return res;
|
|
2400
|
+
}
|
|
2401
|
+
deserialize(payload, options) {
|
|
2402
|
+
const { json, meta } = payload;
|
|
2403
|
+
let result = options?.inPlace ? json : copy(json);
|
|
2404
|
+
if (meta?.values) result = applyValueAnnotations(result, meta.values, meta.v ?? 0, this);
|
|
2405
|
+
if (meta?.referentialEqualities) result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities, meta.v ?? 0);
|
|
2406
|
+
return result;
|
|
2407
|
+
}
|
|
2408
|
+
stringify(object) {
|
|
2409
|
+
return JSON.stringify(this.serialize(object));
|
|
2410
|
+
}
|
|
2411
|
+
parse(string) {
|
|
2412
|
+
return this.deserialize(JSON.parse(string), { inPlace: true });
|
|
2413
|
+
}
|
|
2414
|
+
registerClass(v, options) {
|
|
2415
|
+
this.classRegistry.register(v, options);
|
|
2416
|
+
}
|
|
2417
|
+
registerSymbol(v, identifier) {
|
|
2418
|
+
this.symbolRegistry.register(v, identifier);
|
|
2419
|
+
}
|
|
2420
|
+
registerCustom(transformer, name) {
|
|
2421
|
+
this.customTransformerRegistry.register({
|
|
2422
|
+
name,
|
|
2423
|
+
...transformer
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
allowErrorProps(...props) {
|
|
2427
|
+
this.allowedErrorProps.push(...props);
|
|
2428
|
+
}
|
|
2429
|
+
};
|
|
2430
|
+
SuperJSON.defaultInstance = new SuperJSON();
|
|
2431
|
+
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
2432
|
+
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
2433
|
+
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
2434
|
+
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
2435
|
+
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
2436
|
+
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
2437
|
+
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
2438
|
+
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
2439
|
+
const serialize = SuperJSON.serialize;
|
|
2440
|
+
SuperJSON.deserialize;
|
|
2441
|
+
const stringify = SuperJSON.stringify;
|
|
2442
|
+
SuperJSON.parse;
|
|
2443
|
+
SuperJSON.registerClass;
|
|
2444
|
+
SuperJSON.registerCustom;
|
|
2445
|
+
SuperJSON.registerSymbol;
|
|
2446
|
+
SuperJSON.allowErrorProps;
|
|
2447
|
+
//#endregion
|
|
2448
|
+
//#region src/utils.tsx
|
|
2449
|
+
function getQueryStatusLabel(query) {
|
|
2450
|
+
return query.state.fetchStatus === "fetching" ? "fetching" : !query.getObserversCount() ? "inactive" : query.state.fetchStatus === "paused" ? "paused" : query.isStale() ? "stale" : "fresh";
|
|
2451
|
+
}
|
|
2452
|
+
function getSidedProp(prop, side) {
|
|
2453
|
+
return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
2454
|
+
}
|
|
2455
|
+
function getQueryStatusColor({ queryState, observerCount, isStale }) {
|
|
2456
|
+
return queryState?.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState?.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
|
|
2457
|
+
}
|
|
2458
|
+
function getMutationStatusColor({ status, isPaused }) {
|
|
2459
|
+
return isPaused ? "purple" : status === "error" ? "red" : status === "pending" ? "yellow" : status === "success" ? "green" : "gray";
|
|
2460
|
+
}
|
|
2461
|
+
function getQueryStatusColorByLabel(label) {
|
|
2462
|
+
return label === "fresh" ? "green" : label === "stale" ? "yellow" : label === "paused" ? "purple" : label === "inactive" ? "gray" : "blue";
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Displays a string regardless the type of the data
|
|
2466
|
+
* @param {unknown} value Value to be stringified
|
|
2467
|
+
* @param {boolean} beautify Formats json to multiline
|
|
2468
|
+
*/
|
|
2469
|
+
const displayValue = (value, beautify = false) => {
|
|
2470
|
+
const { json } = serialize(value);
|
|
2471
|
+
return JSON.stringify(json, null, beautify ? 2 : void 0);
|
|
2472
|
+
};
|
|
2473
|
+
const getStatusRank = (q) => q.state.fetchStatus !== "idle" ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
2474
|
+
const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
2475
|
+
const dateSort = (a, b) => {
|
|
2476
|
+
const diff = b.state.dataUpdatedAt - a.state.dataUpdatedAt;
|
|
2477
|
+
return diff < 0 ? -1 : diff > 0 ? 1 : 0;
|
|
2478
|
+
};
|
|
2479
|
+
const statusAndDateSort = (a, b) => {
|
|
2480
|
+
if (getStatusRank(a) === getStatusRank(b)) return dateSort(a, b);
|
|
2481
|
+
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
2482
|
+
};
|
|
2483
|
+
const sortFns = {
|
|
2484
|
+
status: statusAndDateSort,
|
|
2485
|
+
"query hash": queryHashSort,
|
|
2486
|
+
"last updated": dateSort
|
|
2487
|
+
};
|
|
2488
|
+
const getMutationStatusRank = (m) => m.state.isPaused ? 0 : m.state.status === "error" ? 2 : m.state.status === "pending" ? 1 : 3;
|
|
2489
|
+
const mutationDateSort = (a, b) => a.state.submittedAt < b.state.submittedAt ? 1 : -1;
|
|
2490
|
+
const mutationStatusSort = (a, b) => {
|
|
2491
|
+
if (getMutationStatusRank(a) === getMutationStatusRank(b)) return mutationDateSort(a, b);
|
|
2492
|
+
return getMutationStatusRank(a) > getMutationStatusRank(b) ? 1 : -1;
|
|
2493
|
+
};
|
|
2494
|
+
const mutationSortFns = {
|
|
2495
|
+
status: mutationStatusSort,
|
|
2496
|
+
"last updated": mutationDateSort
|
|
2497
|
+
};
|
|
2498
|
+
const convertRemToPixels = (rem) => {
|
|
2499
|
+
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
2500
|
+
};
|
|
2501
|
+
const getPreferredColorScheme = () => {
|
|
2502
|
+
const [colorScheme, setColorScheme] = createSignal("dark");
|
|
2503
|
+
onMount(() => {
|
|
2504
|
+
const query = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2505
|
+
setColorScheme(query.matches ? "dark" : "light");
|
|
2506
|
+
const listener = (e) => {
|
|
2507
|
+
setColorScheme(e.matches ? "dark" : "light");
|
|
2508
|
+
};
|
|
2509
|
+
query.addEventListener("change", listener);
|
|
2510
|
+
onCleanup(() => query.removeEventListener("change", listener));
|
|
2511
|
+
});
|
|
2512
|
+
return colorScheme;
|
|
2513
|
+
};
|
|
2514
|
+
/**
|
|
2515
|
+
* updates nested data by path
|
|
2516
|
+
*
|
|
2517
|
+
* @param {unknown} oldData Data to be updated
|
|
2518
|
+
* @param {Array<string>} updatePath Path to the data to be updated
|
|
2519
|
+
* @param {unknown} value New value
|
|
2520
|
+
*/
|
|
2521
|
+
const updateNestedDataByPath = (oldData, updatePath, value) => {
|
|
2522
|
+
if (updatePath.length === 0) return value;
|
|
2523
|
+
if (oldData instanceof Map) {
|
|
2524
|
+
const newData = new Map(oldData);
|
|
2525
|
+
if (updatePath.length === 1) {
|
|
2526
|
+
newData.set(updatePath[0], value);
|
|
2527
|
+
return newData;
|
|
2528
|
+
}
|
|
2529
|
+
const [head, ...tail] = updatePath;
|
|
2530
|
+
newData.set(head, updateNestedDataByPath(newData.get(head), tail, value));
|
|
2531
|
+
return newData;
|
|
2532
|
+
}
|
|
2533
|
+
if (oldData instanceof Set) {
|
|
2534
|
+
const setAsArray = updateNestedDataByPath(Array.from(oldData), updatePath, value);
|
|
2535
|
+
return new Set(setAsArray);
|
|
2536
|
+
}
|
|
2537
|
+
if (Array.isArray(oldData)) {
|
|
2538
|
+
const newData = [...oldData];
|
|
2539
|
+
if (updatePath.length === 1) {
|
|
2540
|
+
newData[updatePath[0]] = value;
|
|
2541
|
+
return newData;
|
|
2542
|
+
}
|
|
2543
|
+
const [head, ...tail] = updatePath;
|
|
2544
|
+
newData[head] = updateNestedDataByPath(newData[head], tail, value);
|
|
2545
|
+
return newData;
|
|
2546
|
+
}
|
|
2547
|
+
if (oldData instanceof Object) {
|
|
2548
|
+
const newData = { ...oldData };
|
|
2549
|
+
if (updatePath.length === 1) {
|
|
2550
|
+
newData[updatePath[0]] = value;
|
|
2551
|
+
return newData;
|
|
2552
|
+
}
|
|
2553
|
+
const [head, ...tail] = updatePath;
|
|
2554
|
+
newData[head] = updateNestedDataByPath(newData[head], tail, value);
|
|
2555
|
+
return newData;
|
|
2556
|
+
}
|
|
2557
|
+
return oldData;
|
|
2558
|
+
};
|
|
2559
|
+
/**
|
|
2560
|
+
* Deletes nested data by path
|
|
2561
|
+
*
|
|
2562
|
+
* @param {unknown} oldData Data to be updated
|
|
2563
|
+
* @param {Array<string>} deletePath Path to the data to be deleted
|
|
2564
|
+
* @returns newData without the deleted items by path
|
|
2565
|
+
*/
|
|
2566
|
+
const deleteNestedDataByPath = (oldData, deletePath) => {
|
|
2567
|
+
if (oldData instanceof Map) {
|
|
2568
|
+
const newData = new Map(oldData);
|
|
2569
|
+
if (deletePath.length === 1) {
|
|
2570
|
+
newData.delete(deletePath[0]);
|
|
2571
|
+
return newData;
|
|
2572
|
+
}
|
|
2573
|
+
const [head, ...tail] = deletePath;
|
|
2574
|
+
newData.set(head, deleteNestedDataByPath(newData.get(head), tail));
|
|
2575
|
+
return newData;
|
|
2576
|
+
}
|
|
2577
|
+
if (oldData instanceof Set) {
|
|
2578
|
+
const setAsArray = deleteNestedDataByPath(Array.from(oldData), deletePath);
|
|
2579
|
+
return new Set(setAsArray);
|
|
2580
|
+
}
|
|
2581
|
+
if (Array.isArray(oldData)) {
|
|
2582
|
+
const newData = [...oldData];
|
|
2583
|
+
if (deletePath.length === 1) return newData.filter((_, idx) => idx.toString() !== deletePath[0]);
|
|
2584
|
+
const [head, ...tail] = deletePath;
|
|
2585
|
+
newData[head] = deleteNestedDataByPath(newData[head], tail);
|
|
2586
|
+
return newData;
|
|
2587
|
+
}
|
|
2588
|
+
if (oldData instanceof Object) {
|
|
2589
|
+
const newData = { ...oldData };
|
|
2590
|
+
if (deletePath.length === 1) {
|
|
2591
|
+
delete newData[deletePath[0]];
|
|
2592
|
+
return newData;
|
|
2593
|
+
}
|
|
2594
|
+
const [head, ...tail] = deletePath;
|
|
2595
|
+
newData[head] = deleteNestedDataByPath(newData[head], tail);
|
|
2596
|
+
return newData;
|
|
2597
|
+
}
|
|
2598
|
+
return oldData;
|
|
2599
|
+
};
|
|
2600
|
+
const setupStyleSheet = (nonce, target) => {
|
|
2601
|
+
if (!nonce) return;
|
|
2602
|
+
window.__nonce__ = nonce;
|
|
2603
|
+
const root = target ?? document.head;
|
|
2604
|
+
if (root.querySelector("#_goober")) return;
|
|
2605
|
+
const styleTag = document.createElement("style");
|
|
2606
|
+
const textNode = document.createTextNode("");
|
|
2607
|
+
styleTag.appendChild(textNode);
|
|
2608
|
+
styleTag.id = "_goober";
|
|
2609
|
+
styleTag.setAttribute("nonce", nonce);
|
|
2610
|
+
root.appendChild(styleTag);
|
|
2611
|
+
};
|
|
2612
|
+
//#endregion
|
|
2613
|
+
export { untrack as $, $TRACK as A, createEffect as B, memo as C, spread as D, setStyleProperty as E, Switch as F, createUniqueId as G, createRenderEffect as H, batch as I, mergeProps as J, getOwner as K, createComponent as L, Index as M, Match as N, template as O, Show as P, splitProps as Q, createComputed as R, insert as S, setAttribute as T, createRoot as U, createMemo as V, createSignal as W, onCleanup as X, on as Y, onMount as Z, Portal as _, getPreferredColorScheme as a, clearDelegatedEvents as b, getQueryStatusLabel as c, setupStyleSheet as d, useContext as et, sortFns as f, Dynamic as g, stringify as h, getMutationStatusColor as i, For as j, use as k, getSidedProp as l, serialize as m, deleteNestedDataByPath as n, getQueryStatusColor as o, updateNestedDataByPath as p, lazy as q, displayValue as r, getQueryStatusColorByLabel as s, convertRemToPixels as t, useTransition as tt, mutationSortFns as u, addEventListener as v, render as w, delegateEvents as x, className as y, createContext as z };
|