@ryupold/vode 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/vode.js +220 -92
- package/dist/vode.min.js +1 -1
- package/dist/vode.min.mjs +1 -1
- package/dist/vode.mjs +219 -96
- package/index.ts +5 -1
- package/package.json +3 -3
- package/src/merge-class.ts +62 -0
- package/src/state-context.ts +228 -0
- package/src/vode.ts +140 -140
- package/tsconfig.json +1 -2
package/README.md
CHANGED
|
@@ -399,6 +399,17 @@ const ComponentEwww = (s) => {
|
|
|
399
399
|
|
|
400
400
|
return [DIV, s.loading ? [PROGRESS] : s.title];
|
|
401
401
|
}
|
|
402
|
+
|
|
403
|
+
// ✨ experimental view transitions support ✨
|
|
404
|
+
// patch with a render via view transition
|
|
405
|
+
s.patch([{}, (s) => {/*...*/}]); //all given patches will be part of a view transition
|
|
406
|
+
|
|
407
|
+
// empty array patches command to skip the current view transition
|
|
408
|
+
// and set the queued animated patches until now as current state with a sync patch
|
|
409
|
+
s.patch([]);
|
|
410
|
+
|
|
411
|
+
// skip current view transition and start this view transition instead
|
|
412
|
+
s.patch([[], { loading: true }]);
|
|
402
413
|
```
|
|
403
414
|
|
|
404
415
|
### memoization
|
|
@@ -452,6 +463,7 @@ import { tag, props, children, mergeClass, hydrate } from '@ryupold/vode';
|
|
|
452
463
|
// Merge class props intelligently
|
|
453
464
|
mergeClass('foo', ['baz', 'bar']); // -> 'foo bar baz'
|
|
454
465
|
mergeClass(['foo'], { bar: true, baz: false }); // -> 'foo bar'
|
|
466
|
+
mergeClass({zig: true, zag: false}, 'foo', ['baz', 'bar']); // -> 'zig foo bar baz'
|
|
455
467
|
|
|
456
468
|
const myVode = [DIV, { class: 'foo' }, [SPAN, 'hello'], [STRONG, 'world']];
|
|
457
469
|
|
|
@@ -528,6 +540,24 @@ The memo with empty dependency array prevents further render calls from the oute
|
|
|
528
540
|
so rendering of the subtree inside is controlled by the inner app.
|
|
529
541
|
Take note of the fact that the top-level element of the inner app refers to the surrounding element and will change its state accordingly.
|
|
530
542
|
|
|
543
|
+
#### view transitions
|
|
544
|
+
The library has experimental support for [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API).
|
|
545
|
+
You can pass an array of patches to the `patch` function where each patch will be applied with the next available view transition.
|
|
546
|
+
|
|
547
|
+
Patching an empty array `[]` will skip the current view transition and set the queued animated patches until now as current state with a sync patch.
|
|
548
|
+
> Keep in mind that view transitions are not supported in all browsers yet and only one active transition can happen at a time. This feature may change significantly in the future, so do not rely on it heavily.
|
|
549
|
+
|
|
550
|
+
Scheduling behaviour can in theory be overridden with `containerNode._vode.asyncRenderer`.
|
|
551
|
+
|
|
552
|
+
```js
|
|
553
|
+
// or globally disable view transitions for the vode framework
|
|
554
|
+
import { globals } from '@ryupold/vode';
|
|
555
|
+
globals.startViewTransition = null;
|
|
556
|
+
|
|
557
|
+
// set to disable view transitions for specific vode-app
|
|
558
|
+
containerNode._vode.asyncRenderer = null;
|
|
559
|
+
```
|
|
560
|
+
|
|
531
561
|
### performance
|
|
532
562
|
|
|
533
563
|
There are some metrics available on the appNode.
|
package/dist/vode.js
CHANGED
|
@@ -61,6 +61,7 @@ var V = (() => {
|
|
|
61
61
|
DIV: () => DIV,
|
|
62
62
|
DL: () => DL,
|
|
63
63
|
DT: () => DT,
|
|
64
|
+
DelegateStateContext: () => DelegateStateContext,
|
|
64
65
|
ELLIPSE: () => ELLIPSE,
|
|
65
66
|
EM: () => EM,
|
|
66
67
|
EMBED: () => EMBED,
|
|
@@ -115,6 +116,7 @@ var V = (() => {
|
|
|
115
116
|
INPUT: () => INPUT,
|
|
116
117
|
INS: () => INS,
|
|
117
118
|
KBD: () => KBD,
|
|
119
|
+
KeyStateContext: () => KeyStateContext,
|
|
118
120
|
LABEL: () => LABEL,
|
|
119
121
|
LEGEND: () => LEGEND,
|
|
120
122
|
LI: () => LI,
|
|
@@ -229,6 +231,7 @@ var V = (() => {
|
|
|
229
231
|
childrenStart: () => childrenStart,
|
|
230
232
|
createPatch: () => createPatch,
|
|
231
233
|
createState: () => createState,
|
|
234
|
+
globals: () => globals,
|
|
232
235
|
hydrate: () => hydrate,
|
|
233
236
|
memo: () => memo,
|
|
234
237
|
mergeClass: () => mergeClass,
|
|
@@ -238,6 +241,11 @@ var V = (() => {
|
|
|
238
241
|
});
|
|
239
242
|
|
|
240
243
|
// src/vode.ts
|
|
244
|
+
var globals = {
|
|
245
|
+
currentViewTransition: void 0,
|
|
246
|
+
requestAnimationFrame: !!window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : ((cb) => cb()),
|
|
247
|
+
startViewTransition: !!document.startViewTransition ? document.startViewTransition.bind(document) : null
|
|
248
|
+
};
|
|
241
249
|
function vode(tag2, props2, ...children2) {
|
|
242
250
|
if (!tag2) throw new Error("first argument to vode() must be a tag name or a vode");
|
|
243
251
|
if (Array.isArray(tag2)) return tag2;
|
|
@@ -249,12 +257,16 @@ var V = (() => {
|
|
|
249
257
|
if (!state || typeof state !== "object") throw new Error("second argument to app() must be a state object");
|
|
250
258
|
if (typeof dom !== "function") throw new Error("third argument to app() must be a function that returns a vode");
|
|
251
259
|
const _vode = {};
|
|
252
|
-
_vode.
|
|
260
|
+
_vode.syncRenderer = globals.requestAnimationFrame;
|
|
261
|
+
_vode.asyncRenderer = globals.startViewTransition;
|
|
262
|
+
_vode.qSync = null;
|
|
263
|
+
_vode.qAsync = null;
|
|
264
|
+
_vode.stats = { lastSyncRenderTime: 0, lastAsyncRenderTime: 0, syncRenderCount: 0, asyncRenderCount: 0, liveEffectCount: 0, patchCount: 0, syncRenderPatchCount: 0, asyncRenderPatchCount: 0 };
|
|
253
265
|
Object.defineProperty(state, "patch", {
|
|
254
266
|
enumerable: false,
|
|
255
267
|
configurable: true,
|
|
256
268
|
writable: false,
|
|
257
|
-
value: async (action) => {
|
|
269
|
+
value: async (action, isAsync) => {
|
|
258
270
|
if (!action || typeof action !== "function" && typeof action !== "object") return;
|
|
259
271
|
_vode.stats.patchCount++;
|
|
260
272
|
if (action?.next) {
|
|
@@ -265,13 +277,13 @@ var V = (() => {
|
|
|
265
277
|
while (v.done === false) {
|
|
266
278
|
_vode.stats.liveEffectCount++;
|
|
267
279
|
try {
|
|
268
|
-
_vode.patch(v.value);
|
|
280
|
+
_vode.patch(v.value, isAsync);
|
|
269
281
|
v = await generator.next();
|
|
270
282
|
} finally {
|
|
271
283
|
_vode.stats.liveEffectCount--;
|
|
272
284
|
}
|
|
273
285
|
}
|
|
274
|
-
_vode.patch(v.value);
|
|
286
|
+
_vode.patch(v.value, isAsync);
|
|
275
287
|
} finally {
|
|
276
288
|
_vode.stats.liveEffectCount--;
|
|
277
289
|
}
|
|
@@ -279,57 +291,91 @@ var V = (() => {
|
|
|
279
291
|
_vode.stats.liveEffectCount++;
|
|
280
292
|
try {
|
|
281
293
|
const nextState = await action;
|
|
282
|
-
_vode.patch(nextState);
|
|
294
|
+
_vode.patch(nextState, isAsync);
|
|
283
295
|
} finally {
|
|
284
296
|
_vode.stats.liveEffectCount--;
|
|
285
297
|
}
|
|
286
298
|
} else if (Array.isArray(action)) {
|
|
287
|
-
if (
|
|
288
|
-
|
|
289
|
-
_vode.patch(
|
|
290
|
-
|
|
299
|
+
if (action.length > 0) {
|
|
300
|
+
for (const p of action) {
|
|
301
|
+
_vode.patch(p, !document.hidden && !!_vode.asyncRenderer);
|
|
302
|
+
}
|
|
291
303
|
} else {
|
|
292
|
-
_vode.
|
|
304
|
+
_vode.qSync = mergeState(_vode.qSync || {}, _vode.qAsync, false);
|
|
305
|
+
_vode.qAsync = null;
|
|
306
|
+
globals.currentViewTransition?.skipTransition();
|
|
307
|
+
_vode.stats.syncRenderPatchCount++;
|
|
308
|
+
_vode.renderSync();
|
|
293
309
|
}
|
|
294
310
|
} else if (typeof action === "function") {
|
|
295
|
-
_vode.patch(action(_vode.state));
|
|
311
|
+
_vode.patch(action(_vode.state), isAsync);
|
|
296
312
|
} else {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
313
|
+
if (isAsync) {
|
|
314
|
+
_vode.stats.asyncRenderPatchCount++;
|
|
315
|
+
_vode.qAsync = mergeState(_vode.qAsync || {}, action, false);
|
|
316
|
+
await _vode.renderAsync();
|
|
317
|
+
} else {
|
|
318
|
+
_vode.stats.syncRenderPatchCount++;
|
|
319
|
+
_vode.qSync = mergeState(_vode.qSync || {}, action, false);
|
|
320
|
+
_vode.renderSync();
|
|
321
|
+
}
|
|
300
322
|
}
|
|
301
323
|
}
|
|
302
324
|
});
|
|
303
|
-
|
|
325
|
+
function renderDom(isAsync) {
|
|
326
|
+
const sw = Date.now();
|
|
327
|
+
const vom = dom(_vode.state);
|
|
328
|
+
_vode.vode = render(_vode.state, _vode.patch, container.parentElement, 0, _vode.vode, vom);
|
|
329
|
+
if (container.tagName.toUpperCase() !== vom[0].toUpperCase()) {
|
|
330
|
+
container = _vode.vode.node;
|
|
331
|
+
container._vode = _vode;
|
|
332
|
+
}
|
|
333
|
+
if (!isAsync) {
|
|
334
|
+
_vode.stats.lastSyncRenderTime = Date.now() - sw;
|
|
335
|
+
_vode.stats.syncRenderCount++;
|
|
336
|
+
_vode.isRendering = false;
|
|
337
|
+
if (_vode.qSync) _vode.renderSync();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const sr = renderDom.bind(null, false);
|
|
341
|
+
const ar = renderDom.bind(null, true);
|
|
342
|
+
Object.defineProperty(_vode, "renderSync", {
|
|
304
343
|
enumerable: false,
|
|
305
344
|
configurable: true,
|
|
306
345
|
writable: false,
|
|
307
|
-
value: () =>
|
|
308
|
-
if (_vode.isRendering || !_vode.
|
|
346
|
+
value: () => {
|
|
347
|
+
if (_vode.isRendering || !_vode.qSync) return;
|
|
309
348
|
_vode.isRendering = true;
|
|
349
|
+
_vode.state = mergeState(_vode.state, _vode.qSync, true);
|
|
350
|
+
_vode.qSync = null;
|
|
351
|
+
_vode.syncRenderer(sr);
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(_vode, "renderAsync", {
|
|
355
|
+
enumerable: false,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: false,
|
|
358
|
+
value: async () => {
|
|
359
|
+
if (_vode.isAnimating || !_vode.qAsync) return;
|
|
360
|
+
await globals.currentViewTransition?.updateCallbackDone;
|
|
361
|
+
if (_vode.isAnimating || !_vode.qAsync || document.hidden) return;
|
|
362
|
+
_vode.isAnimating = true;
|
|
310
363
|
const sw = Date.now();
|
|
311
364
|
try {
|
|
312
|
-
_vode.state = mergeState(_vode.state, _vode.
|
|
313
|
-
_vode.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (container.tagName.toUpperCase() !== vom[0].toUpperCase()) {
|
|
317
|
-
container = _vode.vode.node;
|
|
318
|
-
container._vode = _vode;
|
|
319
|
-
}
|
|
365
|
+
_vode.state = mergeState(_vode.state, _vode.qAsync, true);
|
|
366
|
+
_vode.qAsync = null;
|
|
367
|
+
globals.currentViewTransition = _vode.asyncRenderer(ar);
|
|
368
|
+
await globals.currentViewTransition?.updateCallbackDone;
|
|
320
369
|
} finally {
|
|
321
|
-
_vode.
|
|
322
|
-
_vode.stats.
|
|
323
|
-
_vode.
|
|
324
|
-
if (_vode.q) {
|
|
325
|
-
_vode.render();
|
|
326
|
-
}
|
|
370
|
+
_vode.stats.lastAsyncRenderTime = Date.now() - sw;
|
|
371
|
+
_vode.stats.asyncRenderCount++;
|
|
372
|
+
_vode.isAnimating = false;
|
|
327
373
|
}
|
|
328
|
-
|
|
374
|
+
if (_vode.qAsync) _vode.renderAsync();
|
|
375
|
+
}
|
|
329
376
|
});
|
|
330
377
|
_vode.patch = state.patch;
|
|
331
378
|
_vode.state = state;
|
|
332
|
-
_vode.q = null;
|
|
333
379
|
const root = container;
|
|
334
380
|
root._vode = _vode;
|
|
335
381
|
_vode.vode = render(
|
|
@@ -404,47 +450,6 @@ var V = (() => {
|
|
|
404
450
|
}
|
|
405
451
|
return void 0;
|
|
406
452
|
}
|
|
407
|
-
function mergeClass(a, b) {
|
|
408
|
-
if (!a) return b;
|
|
409
|
-
if (!b) return a;
|
|
410
|
-
if (typeof a === "string" && typeof b === "string") {
|
|
411
|
-
const aSplit = a.split(" ");
|
|
412
|
-
const bSplit = b.split(" ");
|
|
413
|
-
const classSet = /* @__PURE__ */ new Set([...aSplit, ...bSplit]);
|
|
414
|
-
return Array.from(classSet).join(" ").trim();
|
|
415
|
-
} else if (typeof a === "string" && Array.isArray(b)) {
|
|
416
|
-
const classSet = /* @__PURE__ */ new Set([...b, ...a.split(" ")]);
|
|
417
|
-
return Array.from(classSet).join(" ").trim();
|
|
418
|
-
} else if (Array.isArray(a) && typeof b === "string") {
|
|
419
|
-
const classSet = /* @__PURE__ */ new Set([...a, ...b.split(" ")]);
|
|
420
|
-
return Array.from(classSet).join(" ").trim();
|
|
421
|
-
} else if (Array.isArray(a) && Array.isArray(b)) {
|
|
422
|
-
const classSet = /* @__PURE__ */ new Set([...a, ...b]);
|
|
423
|
-
return Array.from(classSet).join(" ").trim();
|
|
424
|
-
} else if (typeof a === "string" && typeof b === "object") {
|
|
425
|
-
return { [a]: true, ...b };
|
|
426
|
-
} else if (typeof a === "object" && typeof b === "string") {
|
|
427
|
-
return { ...a, [b]: true };
|
|
428
|
-
} else if (typeof a === "object" && typeof b === "object") {
|
|
429
|
-
return { ...a, ...b };
|
|
430
|
-
} else if (typeof a === "object" && Array.isArray(b)) {
|
|
431
|
-
const aa = { ...a };
|
|
432
|
-
for (const item of b) {
|
|
433
|
-
aa[item] = true;
|
|
434
|
-
}
|
|
435
|
-
return aa;
|
|
436
|
-
} else if (Array.isArray(a) && typeof b === "object") {
|
|
437
|
-
const aa = {};
|
|
438
|
-
for (const item of a) {
|
|
439
|
-
aa[item] = true;
|
|
440
|
-
}
|
|
441
|
-
for (const bKey of Object.keys(b)) {
|
|
442
|
-
aa[bKey] = b[bKey];
|
|
443
|
-
}
|
|
444
|
-
return aa;
|
|
445
|
-
}
|
|
446
|
-
throw new Error(`cannot merge classes of ${a} (${typeof a}) and ${b} (${typeof b})`);
|
|
447
|
-
}
|
|
448
453
|
function children(vode2) {
|
|
449
454
|
const start = childrenStart(vode2);
|
|
450
455
|
if (start > 0) {
|
|
@@ -544,7 +549,7 @@ var V = (() => {
|
|
|
544
549
|
xmlns = properties?.xmlns || xmlns;
|
|
545
550
|
const newNode = xmlns ? document.createElementNS(xmlns, newVode[0]) : document.createElement(newVode[0]);
|
|
546
551
|
newVode.node = newNode;
|
|
547
|
-
patchProperties(patch, newNode, void 0, properties);
|
|
552
|
+
patchProperties(state, patch, newNode, void 0, properties);
|
|
548
553
|
if (oldNode) {
|
|
549
554
|
oldNode.onUnmount && patch(oldNode.onUnmount(oldNode));
|
|
550
555
|
oldNode.replaceWith(newNode);
|
|
@@ -576,12 +581,12 @@ var V = (() => {
|
|
|
576
581
|
newvode[1] = remember(state, newvode[1], oldvode[1]);
|
|
577
582
|
if (prev !== newvode[1]) {
|
|
578
583
|
const properties = props(newVode);
|
|
579
|
-
patchProperties(patch, oldNode, props(oldVode), properties);
|
|
584
|
+
patchProperties(state, patch, oldNode, props(oldVode), properties);
|
|
580
585
|
hasProps = !!properties;
|
|
581
586
|
}
|
|
582
587
|
} else {
|
|
583
588
|
const properties = props(newVode);
|
|
584
|
-
patchProperties(patch, oldNode, props(oldVode), properties);
|
|
589
|
+
patchProperties(state, patch, oldNode, props(oldVode), properties);
|
|
585
590
|
hasProps = !!properties;
|
|
586
591
|
}
|
|
587
592
|
const newKids = children(newVode);
|
|
@@ -646,15 +651,15 @@ var V = (() => {
|
|
|
646
651
|
return c;
|
|
647
652
|
}
|
|
648
653
|
}
|
|
649
|
-
function patchProperties(patch, node, oldProps, newProps) {
|
|
654
|
+
function patchProperties(s, patch, node, oldProps, newProps) {
|
|
650
655
|
if (!newProps && !oldProps) return;
|
|
651
656
|
if (oldProps) {
|
|
652
657
|
for (const key in oldProps) {
|
|
653
658
|
const oldValue = oldProps[key];
|
|
654
659
|
const newValue = newProps?.[key];
|
|
655
660
|
if (oldValue !== newValue) {
|
|
656
|
-
if (newProps) newProps[key] = patchProperty(patch, node, key, oldValue, newValue);
|
|
657
|
-
else patchProperty(patch, node, key, oldValue, void 0);
|
|
661
|
+
if (newProps) newProps[key] = patchProperty(s, patch, node, key, oldValue, newValue);
|
|
662
|
+
else patchProperty(s, patch, node, key, oldValue, void 0);
|
|
658
663
|
}
|
|
659
664
|
}
|
|
660
665
|
}
|
|
@@ -662,17 +667,17 @@ var V = (() => {
|
|
|
662
667
|
for (const key in newProps) {
|
|
663
668
|
if (!(key in oldProps)) {
|
|
664
669
|
const newValue = newProps[key];
|
|
665
|
-
newProps[key] = patchProperty(patch, node, key, void 0, newValue);
|
|
670
|
+
newProps[key] = patchProperty(s, patch, node, key, void 0, newValue);
|
|
666
671
|
}
|
|
667
672
|
}
|
|
668
673
|
} else if (newProps) {
|
|
669
674
|
for (const key in newProps) {
|
|
670
675
|
const newValue = newProps[key];
|
|
671
|
-
newProps[key] = patchProperty(patch, node, key, void 0, newValue);
|
|
676
|
+
newProps[key] = patchProperty(s, patch, node, key, void 0, newValue);
|
|
672
677
|
}
|
|
673
678
|
}
|
|
674
679
|
}
|
|
675
|
-
function patchProperty(patch, node, key, oldValue, newValue) {
|
|
680
|
+
function patchProperty(s, patch, node, key, oldValue, newValue) {
|
|
676
681
|
if (key === "style") {
|
|
677
682
|
if (!newValue) {
|
|
678
683
|
node.style.cssText = "";
|
|
@@ -702,15 +707,7 @@ var V = (() => {
|
|
|
702
707
|
let eventHandler = null;
|
|
703
708
|
if (typeof newValue === "function") {
|
|
704
709
|
const action = newValue;
|
|
705
|
-
eventHandler = (evt) => patch(
|
|
706
|
-
} else if (Array.isArray(newValue)) {
|
|
707
|
-
const arr = newValue;
|
|
708
|
-
const action = newValue[0];
|
|
709
|
-
if (arr.length > 1) {
|
|
710
|
-
eventHandler = () => patch([action, ...arr.slice(1)]);
|
|
711
|
-
} else {
|
|
712
|
-
eventHandler = (evt) => patch([action, evt]);
|
|
713
|
-
}
|
|
710
|
+
eventHandler = (evt) => patch(action(s, evt));
|
|
714
711
|
} else if (typeof newValue === "object") {
|
|
715
712
|
eventHandler = () => patch(newValue);
|
|
716
713
|
}
|
|
@@ -938,5 +935,136 @@ var V = (() => {
|
|
|
938
935
|
var MUNDER = "munder";
|
|
939
936
|
var MUNDEROVER = "munderover";
|
|
940
937
|
var SEMANTICS = "semantics";
|
|
938
|
+
|
|
939
|
+
// src/merge-class.ts
|
|
940
|
+
function mergeClass(...classes) {
|
|
941
|
+
if (!classes || classes.length === 0) return null;
|
|
942
|
+
if (classes.length === 1) return classes[0];
|
|
943
|
+
let finalClass = classes[0];
|
|
944
|
+
for (let index = 1; index < classes.length; index++) {
|
|
945
|
+
const a = finalClass, b = classes[index];
|
|
946
|
+
if (!a) {
|
|
947
|
+
finalClass = b;
|
|
948
|
+
} else if (!b) {
|
|
949
|
+
continue;
|
|
950
|
+
} else if (typeof a === "string" && typeof b === "string") {
|
|
951
|
+
const aSplit = a.split(" ");
|
|
952
|
+
const bSplit = b.split(" ");
|
|
953
|
+
const classSet = /* @__PURE__ */ new Set([...aSplit, ...bSplit]);
|
|
954
|
+
finalClass = Array.from(classSet).join(" ").trim();
|
|
955
|
+
} else if (typeof a === "string" && Array.isArray(b)) {
|
|
956
|
+
const classSet = /* @__PURE__ */ new Set([...b, ...a.split(" ")]);
|
|
957
|
+
finalClass = Array.from(classSet).join(" ").trim();
|
|
958
|
+
} else if (Array.isArray(a) && typeof b === "string") {
|
|
959
|
+
const classSet = /* @__PURE__ */ new Set([...a, ...b.split(" ")]);
|
|
960
|
+
finalClass = Array.from(classSet).join(" ").trim();
|
|
961
|
+
} else if (Array.isArray(a) && Array.isArray(b)) {
|
|
962
|
+
const classSet = /* @__PURE__ */ new Set([...a, ...b]);
|
|
963
|
+
finalClass = Array.from(classSet).join(" ").trim();
|
|
964
|
+
} else if (typeof a === "string" && typeof b === "object") {
|
|
965
|
+
finalClass = { [a]: true, ...b };
|
|
966
|
+
} else if (typeof a === "object" && typeof b === "string") {
|
|
967
|
+
finalClass = { ...a, [b]: true };
|
|
968
|
+
} else if (typeof a === "object" && typeof b === "object") {
|
|
969
|
+
finalClass = { ...a, ...b };
|
|
970
|
+
} else if (typeof a === "object" && Array.isArray(b)) {
|
|
971
|
+
const aa = { ...a };
|
|
972
|
+
for (const item of b) {
|
|
973
|
+
aa[item] = true;
|
|
974
|
+
}
|
|
975
|
+
finalClass = aa;
|
|
976
|
+
} else if (Array.isArray(a) && typeof b === "object") {
|
|
977
|
+
const aa = {};
|
|
978
|
+
for (const item of a) {
|
|
979
|
+
aa[item] = true;
|
|
980
|
+
}
|
|
981
|
+
for (const bKey of Object.keys(b)) {
|
|
982
|
+
aa[bKey] = b[bKey];
|
|
983
|
+
}
|
|
984
|
+
finalClass = aa;
|
|
985
|
+
} else throw new Error(`cannot merge classes of ${a} (${typeof a}) and ${b} (${typeof b})`);
|
|
986
|
+
}
|
|
987
|
+
return finalClass;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// src/state-context.ts
|
|
991
|
+
var KeyStateContext = class {
|
|
992
|
+
constructor(state, path) {
|
|
993
|
+
this.state = state;
|
|
994
|
+
this.path = path;
|
|
995
|
+
this.keys = path.split(".");
|
|
996
|
+
}
|
|
997
|
+
keys;
|
|
998
|
+
get() {
|
|
999
|
+
const keys = this.keys;
|
|
1000
|
+
let raw = this.state ? this.state[keys[0]] : void 0;
|
|
1001
|
+
for (let i = 1; i < keys.length && !!raw; i++) {
|
|
1002
|
+
raw = raw[keys[i]];
|
|
1003
|
+
}
|
|
1004
|
+
return raw;
|
|
1005
|
+
}
|
|
1006
|
+
put(value) {
|
|
1007
|
+
this.putDeep(value, this.state);
|
|
1008
|
+
}
|
|
1009
|
+
patch(value) {
|
|
1010
|
+
if (Array.isArray(value)) {
|
|
1011
|
+
const animation = [];
|
|
1012
|
+
for (const v of value) {
|
|
1013
|
+
animation.push(this.createPatch(v));
|
|
1014
|
+
}
|
|
1015
|
+
this.state.patch(animation);
|
|
1016
|
+
}
|
|
1017
|
+
this.state.patch(this.createPatch(value));
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Creates a render-patch for the parent state by setting a nested sub-state value while creating necessary structure.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* ```typescript
|
|
1024
|
+
* const ctx = new StateContext(state, 'user.profile.settings');
|
|
1025
|
+
* const patch = ctx.createPatch({ theme: 'light' });
|
|
1026
|
+
* // patch is { user: { profile: { settings: { theme: 'light' } } } }
|
|
1027
|
+
* ```
|
|
1028
|
+
*
|
|
1029
|
+
* @param value
|
|
1030
|
+
* @returns {{key-path}:{...: value}} render-patch for the parent state
|
|
1031
|
+
*/
|
|
1032
|
+
createPatch(value) {
|
|
1033
|
+
const renderPatch = {};
|
|
1034
|
+
this.putDeep(value, renderPatch);
|
|
1035
|
+
return renderPatch;
|
|
1036
|
+
}
|
|
1037
|
+
putDeep(value, target) {
|
|
1038
|
+
const keys = this.keys;
|
|
1039
|
+
if (keys.length > 1) {
|
|
1040
|
+
let i = 0;
|
|
1041
|
+
let raw = target[keys[i]];
|
|
1042
|
+
if (typeof raw !== "object" || raw === null) {
|
|
1043
|
+
target[keys[i]] = raw = {};
|
|
1044
|
+
}
|
|
1045
|
+
for (i = 1; i < keys.length - 1; i++) {
|
|
1046
|
+
const p = raw;
|
|
1047
|
+
raw = raw[keys[i]];
|
|
1048
|
+
if (typeof raw !== "object" || raw === null) {
|
|
1049
|
+
p[keys[i]] = raw = {};
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
raw[keys[i]] = value;
|
|
1053
|
+
} else {
|
|
1054
|
+
if (typeof target[keys[0]] === "object" && typeof value === "object")
|
|
1055
|
+
Object.assign(target[keys[0]], value);
|
|
1056
|
+
else
|
|
1057
|
+
target[keys[0]] = value;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var DelegateStateContext = class {
|
|
1062
|
+
constructor(state, get, put, patch) {
|
|
1063
|
+
this.state = state;
|
|
1064
|
+
this.get = get;
|
|
1065
|
+
this.put = put;
|
|
1066
|
+
this.patch = patch;
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
941
1069
|
return __toCommonJS(index_exports);
|
|
942
1070
|
})();
|
package/dist/vode.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var V=(()=>{var N=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var U=(t,o)=>{for(var a in o)N(t,a,{get:o[a],enumerable:!0})},G=(t,o,a,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of H(o))!k.call(t,e)&&e!==a&&N(t,e,{get:()=>o[e],enumerable:!(n=F(o,e))||n.enumerable});return t};var V=t=>G(N({},"__esModule",{value:!0}),t);var Us={};U(Us,{A:()=>z,ABBR:()=>Z,ADDRESS:()=>w,ANIMATE:()=>eo,ANIMATEMOTION:()=>oo,ANIMATETRANSFORM:()=>so,ANNOTATION:()=>cs,ANNOTATION_XML:()=>is,AREA:()=>tt,ARTICLE:()=>et,ASIDE:()=>ot,AUDIO:()=>st,B:()=>nt,BASE:()=>at,BDI:()=>rt,BDO:()=>ct,BLOCKQUOTE:()=>it,BODY:()=>pt,BR:()=>Tt,BUTTON:()=>ft,CANVAS:()=>lt,CAPTION:()=>St,CIRCLE:()=>no,CITE:()=>gt,CLIPPATH:()=>ao,CODE:()=>dt,COL:()=>ut,COLGROUP:()=>xt,DATA:()=>yt,DATALIST:()=>Et,DD:()=>mt,DEFS:()=>ro,DEL:()=>ht,DESC:()=>co,DETAILS:()=>At,DFN:()=>Pt,DIALOG:()=>Ct,DIV:()=>Mt,DL:()=>Nt,DT:()=>Ot,ELLIPSE:()=>io,EM:()=>Rt,EMBED:()=>bt,FEBLEND:()=>po,FECOLORMATRIX:()=>To,FECOMPONENTTRANSFER:()=>fo,FECOMPOSITE:()=>lo,FECONVOLVEMATRIX:()=>So,FEDIFFUSELIGHTING:()=>go,FEDISPLACEMENTMAP:()=>uo,FEDISTANTLIGHT:()=>xo,FEDROPSHADOW:()=>yo,FEFLOOD:()=>Eo,FEFUNCA:()=>mo,FEFUNCB:()=>ho,FEFUNCG:()=>Ao,FEFUNCR:()=>Po,FEGAUSSIANBLUR:()=>Co,FEIMAGE:()=>Mo,FEMERGE:()=>No,FEMERGENODE:()=>Oo,FEMORPHOLOGY:()=>Ro,FEOFFSET:()=>bo,FEPOINTLIGHT:()=>Lo,FESPECULARLIGHTING:()=>Do,FESPOTLIGHT:()=>Io,FETILE:()=>vo,FETURBULENCE:()=>Fo,FIELDSET:()=>Lt,FIGCAPTION:()=>Dt,FIGURE:()=>It,FILTER:()=>Ho,FOOTER:()=>vt,FOREIGNOBJECT:()=>ko,FORM:()=>Ft,G:()=>Uo,H1:()=>Ht,H2:()=>kt,H3:()=>Ut,H4:()=>Gt,H5:()=>Vt,H6:()=>jt,HEAD:()=>Bt,HEADER:()=>_t,HGROUP:()=>Kt,HR:()=>Xt,HTML:()=>qt,I:()=>Yt,IFRAME:()=>Wt,IMAGE:()=>Go,IMG:()=>$t,INPUT:()=>Jt,INS:()=>Qt,KBD:()=>zt,LABEL:()=>Zt,LEGEND:()=>wt,LI:()=>te,LINE:()=>Vo,LINEARGRADIENT:()=>jo,LINK:()=>ee,MACTION:()=>ps,MAIN:()=>oe,MAP:()=>se,MARK:()=>ne,MARKER:()=>Bo,MASK:()=>_o,MATH:()=>Ts,MENU:()=>ae,MERROR:()=>fs,META:()=>re,METADATA:()=>Ko,METER:()=>ce,MFRAC:()=>ls,MI:()=>Ss,MMULTISCRIPTS:()=>gs,MN:()=>ds,MO:()=>us,MOVER:()=>xs,MPADDED:()=>ys,MPATH:()=>Xo,MPHANTOM:()=>Es,MPRESCRIPTS:()=>ms,MROOT:()=>hs,MROW:()=>As,MS:()=>Ps,MSPACE:()=>Cs,MSQRT:()=>Ms,MSTYLE:()=>Ns,MSUB:()=>Os,MSUBSUP:()=>Rs,MSUP:()=>bs,MTABLE:()=>Ls,MTD:()=>Ds,MTEXT:()=>Is,MTR:()=>vs,MUNDER:()=>Fs,MUNDEROVER:()=>Hs,NAV:()=>ie,NOSCRIPT:()=>pe,OBJECT:()=>Te,OL:()=>fe,OPTGROUP:()=>le,OPTION:()=>Se,OUTPUT:()=>ge,P:()=>de,PATH:()=>qo,PATTERN:()=>Yo,PICTURE:()=>ue,POLYGON:()=>Wo,POLYLINE:()=>$o,PRE:()=>xe,PROGRESS:()=>ye,Q:()=>Ee,RADIALGRADIENT:()=>Jo,RECT:()=>Qo,RP:()=>me,RT:()=>he,RUBY:()=>Ae,S:()=>Pe,SAMP:()=>Ce,SCRIPT:()=>Me,SEARCH:()=>Ne,SECTION:()=>Oe,SELECT:()=>Re,SEMANTICS:()=>ks,SET:()=>zo,SLOT:()=>be,SMALL:()=>Le,SOURCE:()=>De,SPAN:()=>Ie,STOP:()=>Zo,STRONG:()=>ve,STYLE:()=>Fe,SUB:()=>He,SUMMARY:()=>ke,SUP:()=>Ue,SVG:()=>wo,SWITCH:()=>ts,SYMBOL:()=>es,TABLE:()=>Ge,TBODY:()=>Ve,TD:()=>je,TEMPLATE:()=>Be,TEXT:()=>os,TEXTAREA:()=>_e,TEXTPATH:()=>ss,TFOOT:()=>Ke,TH:()=>Xe,THEAD:()=>qe,TIME:()=>Ye,TITLE:()=>We,TR:()=>$e,TRACK:()=>Je,TSPAN:()=>ns,U:()=>Qe,UL:()=>ze,USE:()=>as,VAR:()=>Ze,VIDEO:()=>we,VIEW:()=>rs,WBR:()=>to,app:()=>B,child:()=>$,childCount:()=>W,children:()=>A,childrenStart:()=>C,createPatch:()=>X,createState:()=>K,hydrate:()=>b,memo:()=>_,mergeClass:()=>Y,props:()=>d,tag:()=>q,vode:()=>j});function j(t,o,...a){if(!t)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(t)?t:o?[t,o,...a]:[t,...a]}function B(t,o,a,...n){if(!t?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let e={};e.stats={lastRenderTime:0,renderCount:0,liveEffectCount:0,patchCount:0,renderPatchCount:0},Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async r=>{if(!(!r||typeof r!="function"&&typeof r!="object"))if(e.stats.patchCount++,r?.next){let i=r;e.stats.liveEffectCount++;try{let S=await i.next();for(;S.done===!1;){e.stats.liveEffectCount++;try{e.patch(S.value),S=await i.next()}finally{e.stats.liveEffectCount--}}e.patch(S.value)}finally{e.stats.liveEffectCount--}}else if(r.then){e.stats.liveEffectCount++;try{let i=await r;e.patch(i)}finally{e.stats.liveEffectCount--}}else Array.isArray(r)?typeof r[0]=="function"?r.length>1?e.patch(r[0](e.state,...r.slice(1))):e.patch(r[0](e.state)):e.stats.patchCount--:typeof r=="function"?e.patch(r(e.state)):(e.stats.renderPatchCount++,e.q=x(e.q||{},r,!1),e.isRendering||e.render())}}),Object.defineProperty(e,"render",{enumerable:!1,configurable:!0,writable:!1,value:()=>requestAnimationFrame(()=>{if(e.isRendering||!e.q)return;e.isRendering=!0;let r=Date.now();try{e.state=x(e.state,e.q,!0),e.q=null;let i=a(e.state);e.vode=P(e.state,e.patch,t.parentElement,0,e.vode,i),t.tagName.toUpperCase()!==i[0].toUpperCase()&&(t=e.vode.node,t._vode=e)}finally{e.isRendering=!1,e.stats.renderCount++,e.stats.lastRenderTime=Date.now()-r,e.q&&e.render()}})}),e.patch=o.patch,e.state=o,e.q=null;let s=t;s._vode=e,e.vode=P(o,e.patch,t.parentElement,Array.from(t.parentElement.children).indexOf(t),b(t,!0),a(o));for(let r of n)e.patch(r);return e.patch}function b(t,o){if(t?.nodeType===Node.TEXT_NODE)return t.nodeValue?.trim()!==""?o?t:t.nodeValue:void 0;if(t.nodeType===Node.COMMENT_NODE)return;if(t.nodeType===Node.ELEMENT_NODE){let n=[t.tagName.toLowerCase()];if(o&&(n.node=t),t?.hasAttributes()){let e={},s=t.attributes;for(let r of s)e[r.name]=r.value;n.push(e)}if(t.hasChildNodes()){let e=[];for(let s of t.childNodes){let r=s&&b(s,o);r?n.push(r):s&&o&&e.push(s)}for(let s of e)s.remove()}return n}else return}function _(t,o){if(!t||!Array.isArray(t))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=t,o}function K(t){if(!t||typeof t!="object")throw new Error("createState() must be called with a state object");return t}function X(t){return t}function q(t){return t?Array.isArray(t)?t[0]:typeof t=="string"||t.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function d(t){if(Array.isArray(t)&&t.length>1&&t[1]&&!Array.isArray(t[1])&&typeof t[1]=="object"&&t[1].nodeType!==Node.TEXT_NODE)return t[1]}function Y(t,o){if(!t)return o;if(!o)return t;if(typeof t=="string"&&typeof o=="string"){let a=t.split(" "),n=o.split(" "),e=new Set([...a,...n]);return Array.from(e).join(" ").trim()}else if(typeof t=="string"&&Array.isArray(o)){let a=new Set([...o,...t.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&typeof o=="string"){let a=new Set([...t,...o.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&Array.isArray(o)){let a=new Set([...t,...o]);return Array.from(a).join(" ").trim()}else{if(typeof t=="string"&&typeof o=="object")return{[t]:!0,...o};if(typeof t=="object"&&typeof o=="string")return{...t,[o]:!0};if(typeof t=="object"&&typeof o=="object")return{...t,...o};if(typeof t=="object"&&Array.isArray(o)){let a={...t};for(let n of o)a[n]=!0;return a}else if(Array.isArray(t)&&typeof o=="object"){let a={};for(let n of t)a[n]=!0;for(let n of Object.keys(o))a[n]=o[n];return a}}throw new Error(`cannot merge classes of ${t} (${typeof t}) and ${o} (${typeof o})`)}function A(t){let o=C(t);return o>0?t.slice(o):null}function W(t){return t.length-C(t)}function $(t,o){return t[o+C(t)]}function C(t){return d(t)?2:1}function x(t,o,a){if(!o)return t;for(let n in o){let e=o[n];if(e&&typeof e=="object"){let s=t[n];s?Array.isArray(e)?t[n]=[...e]:e instanceof Date&&s!==e?t[n]=new Date(e):Array.isArray(s)?t[n]=x({},e,a):typeof s=="object"?x(t[n],e,a):t[n]=x({},e,a):Array.isArray(e)?t[n]=[...e]:e instanceof Date?t[n]=new Date(e):t[n]=x({},e,a)}else e===void 0&&a?delete t[n]:t[n]=e}return t}function P(t,o,a,n,e,s,r){s=O(t,s,e);let i=!s||typeof s=="number"||typeof s=="boolean";if(s===e||!e&&i)return e;let S=e?.nodeType===Node.TEXT_NODE,p=S?e:e?.node;if(i){p?.onUnmount&&o(p.onUnmount(p)),p?.remove();return}let E=!i&&Q(s),m=!i&&J(s),M=!!s&&typeof s!="string"&&!!(s?.node||s?.nodeType===Node.TEXT_NODE);if(!E&&!m&&!M&&!e)throw new Error("Invalid vode: "+typeof s+" "+JSON.stringify(s));if(M&&E?s=s.wholeText:M&&m&&(s=[...s]),S&&E)return p.nodeValue!==s&&(p.nodeValue=s),e;if(E&&(!p||!S)){let f=document.createTextNode(s);return p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(f)):a.childNodes[n]?a.insertBefore(f,a.childNodes[n]):a.appendChild(f),f}if(m&&(!p||S||e[0]!==s[0])){let f=s;1 in f&&(f[1]=O(t,f[1],void 0));let y=d(s);r=y?.xmlns||r;let l=r?document.createElementNS(r,s[0]):document.createElement(s[0]);s.node=l,R(o,l,void 0,y),p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(l)):a.childNodes[n]?a.insertBefore(l,a.childNodes[n]):a.appendChild(l);let g=A(s);if(g)for(let T=0;T<g.length;T++){let c=g[T],u=P(t,o,l,T,void 0,c,r);s[y?T+2:T+1]=u}return l.onMount&&o(l.onMount(l)),s}if(!S&&m&&e[0]===s[0]){s.node=p;let f=s,y=e,l=!1;if(f[1]?.__memo){let c=f[1];if(f[1]=O(t,f[1],y[1]),c!==f[1]){let u=d(s);R(o,p,d(e),u),l=!!u}}else{let c=d(s);R(o,p,d(e),c),l=!!c}let g=A(s),T=A(e);if(g){for(let c=0;c<g.length;c++){let u=g[c],v=T&&T[c],L=P(t,o,p,c,v,u,r);L&&(s[l?c+2:c+1]=L)}for(let c=g.length;T&&c<T.length;c++)T[c]?.node?T[c].node.remove():T[c]?.nodeType===Node.TEXT_NODE&&T[c].remove()}for(let c=g?.length||0;c<T?.length;c++)T[c]?.node?T[c].node.remove():T[c]?.nodeType===Node.TEXT_NODE&&T[c].remove();return s}}function J(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"}function Q(t){return typeof t=="string"||t?.nodeType===Node.TEXT_NODE}function O(t,o,a){if(typeof o!="function")return o;let n=o?.__memo,e=a?.__memo;if(Array.isArray(n)&&Array.isArray(e)&&n.length===e.length){let r=!0;for(let i=0;i<n.length;i++)if(n[i]!==e[i]){r=!1;break}if(r)return a}let s=D(o,t);return typeof s=="object"&&(s.__memo=o?.__memo),s}function D(t,o){return typeof t=="function"?D(t(o),o):t}function R(t,o,a,n){if(!(!n&&!a)){if(a)for(let e in a){let s=a[e],r=n?.[e];s!==r&&(n?n[e]=h(t,o,e,s,r):h(t,o,e,s,void 0))}if(n&&a){for(let e in n)if(!(e in a)){let s=n[e];n[e]=h(t,o,e,void 0,s)}}else if(n)for(let e in n){let s=n[e];n[e]=h(t,o,e,void 0,s)}}}function h(t,o,a,n,e){if(a==="style")if(!e)o.style.cssText="";else if(typeof e=="string")n!==e&&(o.style.cssText=e);else if(n&&typeof n=="object")for(let s in{...n,...e})!n||e[s]!==n[s]?o.style[s]=e[s]:n[s]&&!e[s]&&(o.style[s]=void 0);else for(let s in e)o.style[s]=e[s];else if(a==="class")e?o.setAttribute("class",I(e)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(e){let s=null;if(typeof e=="function"){let r=e;s=i=>t([r,i])}else if(Array.isArray(e)){let r=e,i=e[0];r.length>1?s=()=>t([i,...r.slice(1)]):s=S=>t([i,S])}else typeof e=="object"&&(s=()=>t(e));o[a]=s}else o[a]=null;else e!=null&&e!==!1?o.setAttribute(a,e):o.removeAttribute(a);return e}function I(t){return typeof t=="string"?t:Array.isArray(t)?t.map(I).join(" "):typeof t=="object"?Object.keys(t).filter(o=>t[o]).join(" "):""}var z="a",Z="abbr",w="address",tt="area",et="article",ot="aside",st="audio",nt="b",at="base",rt="bdi",ct="bdo",it="blockquote",pt="body",Tt="br",ft="button",lt="canvas",St="caption",gt="cite",dt="code",ut="col",xt="colgroup",yt="data",Et="datalist",mt="dd",ht="del",At="details",Pt="dfn",Ct="dialog",Mt="div",Nt="dl",Ot="dt",Rt="em",bt="embed",Lt="fieldset",Dt="figcaption",It="figure",vt="footer",Ft="form",Ht="h1",kt="h2",Ut="h3",Gt="h4",Vt="h5",jt="h6",Bt="head",_t="header",Kt="hgroup",Xt="hr",qt="html",Yt="i",Wt="iframe",$t="img",Jt="input",Qt="ins",zt="kbd",Zt="label",wt="legend",te="li",ee="link",oe="main",se="map",ne="mark",ae="menu",re="meta",ce="meter",ie="nav",pe="noscript",Te="object",fe="ol",le="optgroup",Se="option",ge="output",de="p",ue="picture",xe="pre",ye="progress",Ee="q",me="rp",he="rt",Ae="ruby",Pe="s",Ce="samp",Me="script",Ne="search",Oe="section",Re="select",be="slot",Le="small",De="source",Ie="span",ve="strong",Fe="style",He="sub",ke="summary",Ue="sup",Ge="table",Ve="tbody",je="td",Be="template",_e="textarea",Ke="tfoot",Xe="th",qe="thead",Ye="time",We="title",$e="tr",Je="track",Qe="u",ze="ul",Ze="var",we="video",to="wbr",eo="animate",oo="animateMotion",so="animateTransform",no="circle",ao="clipPath",ro="defs",co="desc",io="ellipse",po="feBlend",To="feColorMatrix",fo="feComponentTransfer",lo="feComposite",So="feConvolveMatrix",go="feDiffuseLighting",uo="feDisplacementMap",xo="feDistantLight",yo="feDropShadow",Eo="feFlood",mo="feFuncA",ho="feFuncB",Ao="feFuncG",Po="feFuncR",Co="feGaussianBlur",Mo="feImage",No="feMerge",Oo="feMergeNode",Ro="feMorphology",bo="feOffset",Lo="fePointLight",Do="feSpecularLighting",Io="feSpotLight",vo="feTile",Fo="feTurbulence",Ho="filter",ko="foreignObject",Uo="g",Go="image",Vo="line",jo="linearGradient",Bo="marker",_o="mask",Ko="metadata",Xo="mpath",qo="path",Yo="pattern",Wo="polygon",$o="polyline",Jo="radialGradient",Qo="rect",zo="set",Zo="stop",wo="svg",ts="switch",es="symbol",os="text",ss="textPath",ns="tspan",as="use",rs="view",cs="annotation",is="annotation-xml",ps="maction",Ts="math",fs="merror",ls="mfrac",Ss="mi",gs="mmultiscripts",ds="mn",us="mo",xs="mover",ys="mpadded",Es="mphantom",ms="mprescripts",hs="mroot",As="mrow",Ps="ms",Cs="mspace",Ms="msqrt",Ns="mstyle",Os="msub",Rs="msubsup",bs="msup",Ls="mtable",Ds="mtd",Is="mtext",vs="mtr",Fs="munder",Hs="munderover",ks="semantics";return V(Us);})();
|
|
1
|
+
"use strict";var V=(()=>{var N=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var G=(e,n)=>{for(var a in n)N(e,a,{get:n[a],enumerable:!0})},K=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of j(n))!U.call(e,t)&&t!==a&&N(e,t,{get:()=>n[t],enumerable:!(s=H(n,t))||s.enumerable});return e};var B=e=>K(N({},"__esModule",{value:!0}),e);var Kn={};G(Kn,{A:()=>Z,ABBR:()=>tt,ADDRESS:()=>et,ANIMATE:()=>no,ANIMATEMOTION:()=>so,ANIMATETRANSFORM:()=>ao,ANNOTATION:()=>ln,ANNOTATION_XML:()=>Sn,AREA:()=>ot,ARTICLE:()=>nt,ASIDE:()=>st,AUDIO:()=>at,B:()=>rt,BASE:()=>ct,BDI:()=>it,BDO:()=>pt,BLOCKQUOTE:()=>lt,BODY:()=>St,BR:()=>Tt,BUTTON:()=>ft,CANVAS:()=>dt,CAPTION:()=>ut,CIRCLE:()=>ro,CITE:()=>yt,CLIPPATH:()=>co,CODE:()=>gt,COL:()=>xt,COLGROUP:()=>ht,DATA:()=>mt,DATALIST:()=>Et,DD:()=>bt,DEFS:()=>io,DEL:()=>Pt,DESC:()=>po,DETAILS:()=>At,DFN:()=>Ct,DIALOG:()=>Mt,DIV:()=>Nt,DL:()=>Rt,DT:()=>Ot,DelegateStateContext:()=>L,ELLIPSE:()=>lo,EM:()=>Dt,EMBED:()=>vt,FEBLEND:()=>So,FECOLORMATRIX:()=>To,FECOMPONENTTRANSFER:()=>fo,FECOMPOSITE:()=>uo,FECONVOLVEMATRIX:()=>yo,FEDIFFUSELIGHTING:()=>go,FEDISPLACEMENTMAP:()=>xo,FEDISTANTLIGHT:()=>ho,FEDROPSHADOW:()=>mo,FEFLOOD:()=>Eo,FEFUNCA:()=>bo,FEFUNCB:()=>Po,FEFUNCG:()=>Ao,FEFUNCR:()=>Co,FEGAUSSIANBLUR:()=>Mo,FEIMAGE:()=>No,FEMERGE:()=>Ro,FEMERGENODE:()=>Oo,FEMORPHOLOGY:()=>Do,FEOFFSET:()=>vo,FEPOINTLIGHT:()=>Lo,FESPECULARLIGHTING:()=>Io,FESPOTLIGHT:()=>Fo,FETILE:()=>Vo,FETURBULENCE:()=>ko,FIELDSET:()=>Lt,FIGCAPTION:()=>It,FIGURE:()=>Ft,FILTER:()=>Ho,FOOTER:()=>Vt,FOREIGNOBJECT:()=>jo,FORM:()=>kt,G:()=>Uo,H1:()=>Ht,H2:()=>jt,H3:()=>Ut,H4:()=>Gt,H5:()=>Kt,H6:()=>Bt,HEAD:()=>_t,HEADER:()=>qt,HGROUP:()=>Xt,HR:()=>wt,HTML:()=>$t,I:()=>Yt,IFRAME:()=>Wt,IMAGE:()=>Go,IMG:()=>Jt,INPUT:()=>Qt,INS:()=>zt,KBD:()=>Zt,KeyStateContext:()=>v,LABEL:()=>te,LEGEND:()=>ee,LI:()=>oe,LINE:()=>Ko,LINEARGRADIENT:()=>Bo,LINK:()=>ne,MACTION:()=>Tn,MAIN:()=>se,MAP:()=>ae,MARK:()=>re,MARKER:()=>_o,MASK:()=>qo,MATH:()=>fn,MENU:()=>ce,MERROR:()=>dn,META:()=>ie,METADATA:()=>Xo,METER:()=>pe,MFRAC:()=>un,MI:()=>yn,MMULTISCRIPTS:()=>gn,MN:()=>xn,MO:()=>hn,MOVER:()=>mn,MPADDED:()=>En,MPATH:()=>wo,MPHANTOM:()=>bn,MPRESCRIPTS:()=>Pn,MROOT:()=>An,MROW:()=>Cn,MS:()=>Mn,MSPACE:()=>Nn,MSQRT:()=>Rn,MSTYLE:()=>On,MSUB:()=>Dn,MSUBSUP:()=>vn,MSUP:()=>Ln,MTABLE:()=>In,MTD:()=>Fn,MTEXT:()=>Vn,MTR:()=>kn,MUNDER:()=>Hn,MUNDEROVER:()=>jn,NAV:()=>le,NOSCRIPT:()=>Se,OBJECT:()=>Te,OL:()=>fe,OPTGROUP:()=>de,OPTION:()=>ue,OUTPUT:()=>ye,P:()=>ge,PATH:()=>$o,PATTERN:()=>Yo,PICTURE:()=>xe,POLYGON:()=>Wo,POLYLINE:()=>Jo,PRE:()=>he,PROGRESS:()=>me,Q:()=>Ee,RADIALGRADIENT:()=>Qo,RECT:()=>zo,RP:()=>be,RT:()=>Pe,RUBY:()=>Ae,S:()=>Ce,SAMP:()=>Me,SCRIPT:()=>Ne,SEARCH:()=>Re,SECTION:()=>Oe,SELECT:()=>De,SEMANTICS:()=>Un,SET:()=>Zo,SLOT:()=>ve,SMALL:()=>Le,SOURCE:()=>Ie,SPAN:()=>Fe,STOP:()=>tn,STRONG:()=>Ve,STYLE:()=>ke,SUB:()=>He,SUMMARY:()=>je,SUP:()=>Ue,SVG:()=>en,SWITCH:()=>on,SYMBOL:()=>nn,TABLE:()=>Ge,TBODY:()=>Ke,TD:()=>Be,TEMPLATE:()=>_e,TEXT:()=>sn,TEXTAREA:()=>qe,TEXTPATH:()=>an,TFOOT:()=>Xe,TH:()=>we,THEAD:()=>$e,TIME:()=>Ye,TITLE:()=>We,TR:()=>Je,TRACK:()=>Qe,TSPAN:()=>rn,U:()=>ze,UL:()=>Ze,USE:()=>cn,VAR:()=>to,VIDEO:()=>eo,VIEW:()=>pn,WBR:()=>oo,app:()=>q,child:()=>J,childCount:()=>W,children:()=>A,childrenStart:()=>M,createPatch:()=>$,createState:()=>w,globals:()=>h,hydrate:()=>D,memo:()=>X,mergeClass:()=>Gn,props:()=>m,tag:()=>Y,vode:()=>_});var h={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function _(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function q(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=h.requestAnimationFrame,t.asyncRenderer=h.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(c,d)=>{if(!(!c||typeof c!="function"&&typeof c!="object"))if(t.stats.patchCount++,c?.next){let S=c;t.stats.liveEffectCount++;try{let x=await S.next();for(;x.done===!1;){t.stats.liveEffectCount++;try{t.patch(x.value,d),x=await S.next()}finally{t.stats.liveEffectCount--}}t.patch(x.value,d)}finally{t.stats.liveEffectCount--}}else if(c.then){t.stats.liveEffectCount++;try{let S=await c;t.patch(S,d)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(c))if(c.length>0)for(let S of c)t.patch(S,!document.hidden&&!!t.asyncRenderer);else t.qSync=g(t.qSync||{},t.qAsync,!1),t.qAsync=null,h.currentViewTransition?.skipTransition(),t.stats.syncRenderPatchCount++,t.renderSync();else typeof c=="function"?t.patch(c(t.state),d):d?(t.stats.asyncRenderPatchCount++,t.qAsync=g(t.qAsync||{},c,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=g(t.qSync||{},c,!1),t.renderSync())}});function o(c){let d=Date.now(),S=a(t.state);t.vode=C(t.state,t.patch,e.parentElement,0,t.vode,S),e.tagName.toUpperCase()!==S[0].toUpperCase()&&(e=t.vode.node,e._vode=t),c||(t.stats.lastSyncRenderTime=Date.now()-d,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let r=o.bind(null,!1),l=o.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=g(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(r))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await h.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let c=Date.now();try{t.state=g(t.state,t.qAsync,!0),t.qAsync=null,h.currentViewTransition=t.asyncRenderer(l),await h.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-c,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.patch=n.patch,t.state=n;let u=e;u._vode=t,t.vode=C(n,t.patch,e.parentElement,Array.from(e.parentElement.children).indexOf(e),D(e,!0),a(n));for(let c of s)t.patch(c);return t.patch}function D(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&D(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function X(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function w(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function $(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function m(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function A(e){let n=M(e);return n>0?e.slice(n):null}function W(e){return e.length-M(e)}function J(e,n){return e[n+M(e)]}function M(e){return m(e)?2:1}function g(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=g({},t,a):typeof o=="object"?g(e[s],t,a):e[s]=g({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=g({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){o=R(e,o,t);let l=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&l)return t;let u=t?.nodeType===Node.TEXT_NODE,c=u?t:t?.node;if(l){c?.onUnmount&&n(c.onUnmount(c)),c?.remove();return}let d=!l&&z(o),S=!l&&Q(o),x=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!d&&!S&&!x&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(x&&d?o=o.wholeText:x&&S&&(o=[...o]),u&&d)return c.nodeValue!==o&&(c.nodeValue=o),t;if(d&&(!c||!u)){let T=document.createTextNode(o);return c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(T)):a.childNodes[s]?a.insertBefore(T,a.childNodes[s]):a.appendChild(T),T}if(S&&(!c||u||t[0]!==o[0])){let T=o;1 in T&&(T[1]=R(e,T[1],void 0));let b=m(o);r=b?.xmlns||r;let f=r?document.createElementNS(r,o[0]):document.createElement(o[0]);o.node=f,O(e,n,f,void 0,b),c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(f)):a.childNodes[s]?a.insertBefore(f,a.childNodes[s]):a.appendChild(f);let y=A(o);if(y)for(let p=0;p<y.length;p++){let i=y[p],E=C(e,n,f,p,void 0,i,r);o[b?p+2:p+1]=E}return f.onMount&&n(f.onMount(f)),o}if(!u&&S&&t[0]===o[0]){o.node=c;let T=o,b=t,f=!1;if(T[1]?.__memo){let i=T[1];if(T[1]=R(e,T[1],b[1]),i!==T[1]){let E=m(o);O(e,n,c,m(t),E),f=!!E}}else{let i=m(o);O(e,n,c,m(t),i),f=!!i}let y=A(o),p=A(t);if(y){for(let i=0;i<y.length;i++){let E=y[i],k=p&&p[i],I=C(e,n,c,i,k,E,r);I&&(o[f?i+2:i+1]=I)}for(let i=y.length;p&&i<p.length;i++)p[i]?.node?p[i].node.remove():p[i]?.nodeType===Node.TEXT_NODE&&p[i].remove()}for(let i=y?.length||0;i<p?.length;i++)p[i]?.node?p[i].node.remove():p[i]?.nodeType===Node.TEXT_NODE&&p[i].remove();return o}}function Q(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function z(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let l=0;l<s.length;l++)if(s[l]!==t[l]){r=!1;break}if(r)return a}let o=F(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function F(e,n){return typeof e=="function"?F(e(n),n):e}function O(e,n,a,s,t){if(!(!t&&!s)){if(s)for(let o in s){let r=s[o],l=t?.[o];r!==l&&(t?t[o]=P(e,n,a,o,r,l):P(e,n,a,o,r,void 0))}if(t&&s){for(let o in t)if(!(o in s)){let r=t[o];t[o]=P(e,n,a,o,void 0,r)}}else if(t)for(let o in t){let r=t[o];t[o]=P(e,n,a,o,void 0,r)}}}function P(e,n,a,s,t,o){if(s==="style")if(!o)a.style.cssText="";else if(typeof o=="string")t!==o&&(a.style.cssText=o);else if(t&&typeof t=="object")for(let r in{...t,...o})!t||o[r]!==t[r]?a.style[r]=o[r]:t[r]&&!o[r]&&(a.style[r]=void 0);else for(let r in o)a.style[r]=o[r];else if(s==="class")o?a.setAttribute("class",V(o)):a.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(o){let r=null;if(typeof o=="function"){let l=o;r=u=>n(l(e,u))}else typeof o=="object"&&(r=()=>n(o));a[s]=r}else a[s]=null;else o!=null&&o!==!1?a.setAttribute(s,o):a.removeAttribute(s);return o}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var Z="a",tt="abbr",et="address",ot="area",nt="article",st="aside",at="audio",rt="b",ct="base",it="bdi",pt="bdo",lt="blockquote",St="body",Tt="br",ft="button",dt="canvas",ut="caption",yt="cite",gt="code",xt="col",ht="colgroup",mt="data",Et="datalist",bt="dd",Pt="del",At="details",Ct="dfn",Mt="dialog",Nt="div",Rt="dl",Ot="dt",Dt="em",vt="embed",Lt="fieldset",It="figcaption",Ft="figure",Vt="footer",kt="form",Ht="h1",jt="h2",Ut="h3",Gt="h4",Kt="h5",Bt="h6",_t="head",qt="header",Xt="hgroup",wt="hr",$t="html",Yt="i",Wt="iframe",Jt="img",Qt="input",zt="ins",Zt="kbd",te="label",ee="legend",oe="li",ne="link",se="main",ae="map",re="mark",ce="menu",ie="meta",pe="meter",le="nav",Se="noscript",Te="object",fe="ol",de="optgroup",ue="option",ye="output",ge="p",xe="picture",he="pre",me="progress",Ee="q",be="rp",Pe="rt",Ae="ruby",Ce="s",Me="samp",Ne="script",Re="search",Oe="section",De="select",ve="slot",Le="small",Ie="source",Fe="span",Ve="strong",ke="style",He="sub",je="summary",Ue="sup",Ge="table",Ke="tbody",Be="td",_e="template",qe="textarea",Xe="tfoot",we="th",$e="thead",Ye="time",We="title",Je="tr",Qe="track",ze="u",Ze="ul",to="var",eo="video",oo="wbr",no="animate",so="animateMotion",ao="animateTransform",ro="circle",co="clipPath",io="defs",po="desc",lo="ellipse",So="feBlend",To="feColorMatrix",fo="feComponentTransfer",uo="feComposite",yo="feConvolveMatrix",go="feDiffuseLighting",xo="feDisplacementMap",ho="feDistantLight",mo="feDropShadow",Eo="feFlood",bo="feFuncA",Po="feFuncB",Ao="feFuncG",Co="feFuncR",Mo="feGaussianBlur",No="feImage",Ro="feMerge",Oo="feMergeNode",Do="feMorphology",vo="feOffset",Lo="fePointLight",Io="feSpecularLighting",Fo="feSpotLight",Vo="feTile",ko="feTurbulence",Ho="filter",jo="foreignObject",Uo="g",Go="image",Ko="line",Bo="linearGradient",_o="marker",qo="mask",Xo="metadata",wo="mpath",$o="path",Yo="pattern",Wo="polygon",Jo="polyline",Qo="radialGradient",zo="rect",Zo="set",tn="stop",en="svg",on="switch",nn="symbol",sn="text",an="textPath",rn="tspan",cn="use",pn="view",ln="annotation",Sn="annotation-xml",Tn="maction",fn="math",dn="merror",un="mfrac",yn="mi",gn="mmultiscripts",xn="mn",hn="mo",mn="mover",En="mpadded",bn="mphantom",Pn="mprescripts",An="mroot",Cn="mrow",Mn="ms",Nn="mspace",Rn="msqrt",On="mstyle",Dn="msub",vn="msubsup",Ln="msup",In="mtable",Fn="mtd",Vn="mtext",kn="mtr",Hn="munder",jn="munderover",Un="semantics";function Gn(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),l=new Set([...o,...r]);n=Array.from(l).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var v=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},L=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return B(Kn);})();
|