ezh 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1313 @@
1
+ import { a3, L, U, W } from './RbTree';
2
+ const V = {
3
+ 'ariaAtomic': 'aria-atomic',
4
+ 'ariaAutoComplete': 'aria-autocomplete',
5
+ 'ariaBrailleLabel': 'aria-braillelabel',
6
+ 'ariaBrailleRoleDescription': 'aria-brailleroledescription',
7
+ 'ariaBusy': 'aria-busy',
8
+ 'ariaChecked': 'aria-checked',
9
+ 'ariaColCount': 'aria-colcount',
10
+ 'ariaColIndex': 'aria-colindex',
11
+ 'ariaColIndexText': 'aria-colindextext',
12
+ 'ariaColSpan': 'aria-colspan',
13
+ 'ariaCurrent': 'aria-current',
14
+ 'ariaDescription': 'aria-description',
15
+ 'ariaDisabled': 'aria-disabled',
16
+ 'ariaExpanded': 'aria-expanded',
17
+ 'ariaHasPopup': 'aria-haspopup',
18
+ 'ariaHidden': 'aria-hidden',
19
+ 'ariaInvalid': 'aria-invalid',
20
+ 'ariaKeyShortcuts': 'aria-keyshortcuts',
21
+ 'ariaLabel': 'aria-label',
22
+ 'ariaLevel': 'aria-level',
23
+ 'ariaLive': 'aria-live',
24
+ 'ariaModal': 'aria-modal',
25
+ 'ariaMultiLine': 'aria-multiline',
26
+ 'ariaMultiSelectable': 'aria-multiselectable',
27
+ 'ariaOrientation': 'aria-orientation',
28
+ 'ariaPlaceholder': 'aria-placeholder',
29
+ 'ariaPosInSet': 'aria-posinset',
30
+ 'ariaPressed': 'aria-pressed',
31
+ 'ariaReadOnly': 'aria-readonly',
32
+ 'ariaRequired': 'aria-required',
33
+ 'ariaRoleDescription': 'aria-roledescription',
34
+ 'ariaRowCount': 'aria-rowcount',
35
+ 'ariaRowIndex': 'aria-rowindex',
36
+ 'ariaRowIndexText': 'aria-rowindextext',
37
+ 'ariaRowSpan': 'aria-rowspan',
38
+ 'ariaSelected': 'aria-selected',
39
+ 'ariaSetSize': 'aria-setsize',
40
+ 'ariaSort': 'aria-sort',
41
+ 'ariaValueMax': 'aria-valuemax',
42
+ 'ariaValueMin': 'aria-valuemin',
43
+ 'ariaValueNow': 'aria-valuenow',
44
+ 'ariaValueText': 'aria-valuetext',
45
+ 'alignmentBaseline': 'alignment-baseline',
46
+ 'annotationXml': 'annotation-xml',
47
+ 'baselineShift': 'baseline-shift',
48
+ 'clipPath': 'clip-path',
49
+ 'clipRule': 'clip-rule',
50
+ 'colorInterpolation': 'color-interpolation',
51
+ 'colorInterpolationFilters': 'color-interpolation-filters',
52
+ 'colorProfile': 'color-profile',
53
+ 'colorRendering': 'color-rendering',
54
+ 'dominantBaseline': 'dominant-baseline',
55
+ 'enableBackground': 'enable-background',
56
+ 'fillOpacity': 'fill-opacity',
57
+ 'fillRule': 'fill-rule',
58
+ 'floodColor': 'flood-color',
59
+ 'floodOpacity': 'flood-opacity',
60
+ 'fontFamily': 'font-family',
61
+ 'fontSize': 'font-size',
62
+ 'fontSizeAdjust': 'font-size-adjust',
63
+ 'fontStretch': 'font-stretch',
64
+ 'fontStyle': 'font-style',
65
+ 'fontVariant': 'font-variant',
66
+ 'fontWeight': 'font-weight',
67
+ 'glyphOrientationHorizontal': 'glyph-orientation-horizontal',
68
+ 'glyphOrientationVertical': 'glyph-orientation-vertical',
69
+ 'imageRendering': 'image-rendering',
70
+ 'letterSpacing': 'letter-spacing',
71
+ 'lightingColor': 'lighting-color',
72
+ 'markerEnd': 'marker-end',
73
+ 'markerMid': 'marker-mid',
74
+ 'markerStart': 'marker-start',
75
+ 'pointerEvents': 'pointer-events',
76
+ 'shapeRendering': 'shape-rendering',
77
+ 'stopColor': 'stop-color',
78
+ 'stopOpacity': 'stop-opacity',
79
+ 'strokeDasharray': 'stroke-dasharray',
80
+ 'strokeDashoffset': 'stroke-dashoffset',
81
+ 'strokeLinecap': 'stroke-linecap',
82
+ 'strokeLinejoin': 'stroke-linejoin',
83
+ 'strokeMiterlimit': 'stroke-miterlimit',
84
+ 'strokeOpacity': 'stroke-opacity',
85
+ 'strokeWidth': 'stroke-width',
86
+ 'style': 'style',
87
+ 'textAnchor': 'text-anchor',
88
+ 'textDecoration': 'text-decoration',
89
+ 'textRendering': 'text-rendering',
90
+ 'unicodeBidi': 'unicode-bidi',
91
+ 'vectorEffect': 'vector-effect',
92
+ 'wordSpacing': 'word-spacing',
93
+ 'writingMode': 'writing-mode',
94
+ };
95
+ const X = {};
96
+ const Y = [];
97
+ Object.freeze(X);
98
+ Object.freeze(Y);
99
+ const E = () => false;
100
+ const y = [];
101
+ const w = new Set();
102
+ const a7 = new W();
103
+ const ai = new W();
104
+ const au = [];
105
+ const av = [];
106
+ const aj = {
107
+ id: '',
108
+ index: 0,
109
+ firstElement: null,
110
+ attachTo: E,
111
+ move: E,
112
+ detachFrom: E,
113
+ update: E,
114
+ refresh: E,
115
+ release: E,
116
+ version: 0,
117
+ parentCom: {},
118
+ markChanged: E,
119
+ watchMountChange: E,
120
+ };
121
+ let F = '';
122
+ let ak = 20000;
123
+ let A = 0;
124
+ let aw = 0;
125
+ let M = undefined;
126
+ const G = new W();
127
+ export const o = new Map();
128
+ export let q = aj;
129
+ export let N = 0;
130
+ const aF = (z, aV) => {
131
+ return document.createElement(z);
132
+ };
133
+ let aa = aF;
134
+ const ax = {
135
+ 'svg': (z, O) => {
136
+ O.a9();
137
+ return document.createElementNS('http://www.w3.org/2000/svg', z);
138
+ },
139
+ 'math': (z, O) => {
140
+ O.a9();
141
+ return document.createElementNS('http://www.w3.org/1998/Math/MathML', z);
142
+ },
143
+ 'foreignObject': (z, O) => {
144
+ if (z !== 'foreignObject') {
145
+ return document.createElement(z);
146
+ }
147
+ O.a9();
148
+ return document.createElementNS('http://www.w3.org/2000/svg', z);
149
+ },
150
+ };
151
+ const al = () => {
152
+ if (++aw >= A) {
153
+ for (const element of w) {
154
+ w.delete(element);
155
+ if (element.id) {
156
+ element.release();
157
+ }
158
+ else {
159
+ if (--aw < A) {
160
+ w.add(element);
161
+ break;
162
+ }
163
+ }
164
+ }
165
+ }
166
+ else {
167
+ w.add(Object.create(aj));
168
+ }
169
+ if (M) {
170
+ M = setTimeout(al, ak);
171
+ }
172
+ };
173
+ const ay = (parent, m) => {
174
+ const az = ['', m];
175
+ while (parent.constructor !== a8) {
176
+ az.push(parent.id);
177
+ parent = parent.parent;
178
+ }
179
+ return az.reverse().join(',');
180
+ };
181
+ const aG = () => {
182
+ do {
183
+ G.a5((id, element) => {
184
+ const { newChildren, parent } = element;
185
+ if (newChildren) {
186
+ if (parent && am(parent)) {
187
+ element.refresh(newChildren);
188
+ parent.currentBefore = undefined;
189
+ }
190
+ else if (element.constructor === an) {
191
+ a7.C(id, element);
192
+ }
193
+ }
194
+ return L;
195
+ });
196
+ } while (!G.a4());
197
+ N++;
198
+ for (const { parent, element } of y) {
199
+ element.detachFrom(X);
200
+ if (element.parent !== parent) {
201
+ if (!ai.a4() && am(parent)) {
202
+ const a6 = !element.parent;
203
+ const ab = ay(parent, element.id);
204
+ ai.a5((key, value) => {
205
+ if (key.startsWith(ab)) {
206
+ value._(value.D, a6);
207
+ return L;
208
+ }
209
+ return U;
210
+ }, ab);
211
+ }
212
+ }
213
+ }
214
+ y.length = 0;
215
+ };
216
+ const Q = (children, f = [], from = 0) => {
217
+ let a = children[from];
218
+ for (;;) {
219
+ if (a && a.id !== undefined) {
220
+ f.push(a);
221
+ }
222
+ else if (a !== null && a !== undefined) {
223
+ switch (typeof a) {
224
+ case 'object':
225
+ Q(a, f);
226
+ break;
227
+ case 'function':
228
+ a = a();
229
+ continue;
230
+ case 'boolean':
231
+ case 'number':
232
+ case 'bigint':
233
+ a = '' + a;
234
+ default:
235
+ f.push(new ao('', a));
236
+ }
237
+ }
238
+ if (++from < children.length) {
239
+ a = children[from];
240
+ }
241
+ else {
242
+ break;
243
+ }
244
+ }
245
+ return f;
246
+ };
247
+ const ac = (B, children, parent) => {
248
+ let f;
249
+ const length = B.length;
250
+ let newChildren = children;
251
+ let b = 0;
252
+ while (b < length) {
253
+ const a$ = B[b];
254
+ if (a$ !== newChildren[b]) {
255
+ if (b === newChildren.length) {
256
+ return newChildren;
257
+ }
258
+ const a = newChildren[b];
259
+ if (!a || a.id === undefined) {
260
+ newChildren = Q(newChildren, newChildren.slice(0, b), b);
261
+ continue;
262
+ }
263
+ else if (f !== newChildren) {
264
+ break;
265
+ }
266
+ }
267
+ if (!f && a$.parent !== parent) {
268
+ f = B;
269
+ }
270
+ b++;
271
+ }
272
+ if (b === newChildren.length) {
273
+ return f;
274
+ }
275
+ return newChildren === children ? Q(newChildren, B.slice(0, b), b) : newChildren;
276
+ };
277
+ const am = (element) => {
278
+ let parent = element;
279
+ do {
280
+ if (parent.constructor === a8) {
281
+ return true;
282
+ }
283
+ parent = parent.parent;
284
+ } while (parent);
285
+ return false;
286
+ };
287
+ const ad = (B, newChildren, parent, aH) => {
288
+ let b, i;
289
+ let a;
290
+ if (newChildren !== B && B.length) {
291
+ const ap = [];
292
+ let t;
293
+ i = newChildren.length;
294
+ b = 10000000;
295
+ while (--i >= 0) {
296
+ a = newChildren[i];
297
+ if (a.parent === parent) {
298
+ const a_ = i - a.index;
299
+ if (a_ === b) {
300
+ t.H++;
301
+ a.index = i;
302
+ }
303
+ else {
304
+ t = {
305
+ from: a.index,
306
+ to: i,
307
+ H: 1,
308
+ };
309
+ b = a_;
310
+ a.index = -ap.push(t);
311
+ }
312
+ }
313
+ else if (b !== 10000000) {
314
+ b = 10000000;
315
+ }
316
+ }
317
+ const aq = [];
318
+ i = B.length - 1;
319
+ while (i >= 0) {
320
+ a = B[i];
321
+ if (a.index < 0) {
322
+ t = ap[-a.index - 1];
323
+ aq.push(t);
324
+ i -= t.H;
325
+ }
326
+ else {
327
+ a.detachFrom(parent);
328
+ i--;
329
+ }
330
+ }
331
+ let R;
332
+ let ae;
333
+ let af = 0;
334
+ i = newChildren.length - 1;
335
+ while (i >= 0) {
336
+ a = newChildren[i];
337
+ if (a.parent !== parent) {
338
+ a.index = i--;
339
+ a.attachTo(parent);
340
+ }
341
+ else {
342
+ t = ap[-a.index - 1];
343
+ ae = t.H;
344
+ R = aq[af];
345
+ a.index = i;
346
+ if (!aH) {
347
+ if (R === t) {
348
+ af++;
349
+ i -= t.H;
350
+ parent.currentBefore = undefined;
351
+ continue;
352
+ }
353
+ if (R.from > t.from) {
354
+ b = af;
355
+ do {
356
+ ae -= R.H;
357
+ R = aq[++b];
358
+ } while (R.from > t.from && ae > 0);
359
+ if (ae > 0) {
360
+ i -= t.H;
361
+ parent.currentBefore = undefined;
362
+ af = b;
363
+ continue;
364
+ }
365
+ }
366
+ }
367
+ b = i - t.H;
368
+ do {
369
+ a.move();
370
+ } while (--i > b && (a = newChildren[i]));
371
+ }
372
+ }
373
+ }
374
+ else {
375
+ for (i = newChildren.length - 1; i >= 0; i--) {
376
+ a = newChildren[i];
377
+ a.index = i;
378
+ if (parent !== a.parent) {
379
+ a.attachTo(parent);
380
+ }
381
+ }
382
+ }
383
+ parent.currentBefore = undefined;
384
+ };
385
+ class ao {
386
+ constructor(id, text) {
387
+ this.id = id;
388
+ this.parent = undefined;
389
+ this.index = 0;
390
+ this.n = 0;
391
+ this.ag = text;
392
+ }
393
+ id;
394
+ parent;
395
+ index;
396
+ firstElement;
397
+ attachTo(target) {
398
+ if (!this.firstElement) {
399
+ this.firstElement = document.createTextNode(this.ag);
400
+ }
401
+ const { parent, firstElement, index } = this;
402
+ if (this.id) {
403
+ if (!this.n++) {
404
+ w.delete(this);
405
+ }
406
+ if (parent) {
407
+ firstElement.remove();
408
+ y.push({ parent, element: this });
409
+ }
410
+ }
411
+ this.parent = target;
412
+ let r = target.currentBefore;
413
+ if (r === undefined) {
414
+ r = target.findNextSiblingElement(index);
415
+ }
416
+ target.element.insertBefore(firstElement, r);
417
+ target.currentBefore = firstElement;
418
+ }
419
+ move() {
420
+ const { parent, index, firstElement } = this;
421
+ let r = parent.currentBefore;
422
+ if (r === undefined) {
423
+ r = parent.findNextSiblingElement(index);
424
+ }
425
+ parent.element.insertBefore(firstElement, r);
426
+ parent.currentBefore = firstElement;
427
+ }
428
+ detachFrom(target) {
429
+ if (this.parent === target) {
430
+ this.firstElement.remove();
431
+ this.parent = undefined;
432
+ if (this.id) {
433
+ y.push({ parent: target, element: this });
434
+ }
435
+ }
436
+ else {
437
+ if (this.id && !--this.n) {
438
+ if (A) {
439
+ w.add(this);
440
+ }
441
+ else {
442
+ this.release();
443
+ }
444
+ }
445
+ }
446
+ }
447
+ update(text) {
448
+ if (this.ag !== text) {
449
+ this.ag = text;
450
+ if (this.firstElement) {
451
+ this.firstElement.nodeValue = text;
452
+ }
453
+ }
454
+ return false;
455
+ }
456
+ refresh() { }
457
+ release(target) {
458
+ if (target && this.parent === target) {
459
+ this.firstElement.remove();
460
+ this.parent = undefined;
461
+ }
462
+ if (this.id && --this.n <= 0) {
463
+ o.delete(this.id);
464
+ }
465
+ }
466
+ n;
467
+ ag;
468
+ }
469
+ export class aI {
470
+ constructor(id, children, aJ) {
471
+ this.id = id;
472
+ this.parent = undefined;
473
+ this.index = 0;
474
+ this.n = 0;
475
+ this.newChildren = this.d = aJ ? Q(children) : (children || Y);
476
+ this.currentBefore = undefined;
477
+ }
478
+ id;
479
+ parent;
480
+ index;
481
+ newChildren;
482
+ currentBefore;
483
+ get element() {
484
+ return this.parent.element;
485
+ }
486
+ get firstElement() {
487
+ const { d } = this;
488
+ for (let b = 0; b < d.length; b++) {
489
+ const h = d[b].firstElement;
490
+ if (h) {
491
+ return h;
492
+ }
493
+ }
494
+ return null;
495
+ }
496
+ attachTo(target) {
497
+ const { parent, d, newChildren } = this;
498
+ if (!this.n++) {
499
+ w.delete(this);
500
+ }
501
+ if (parent) {
502
+ y.push({ parent, element: this });
503
+ for (let b = d.length - 1; b >= 0; b--) {
504
+ d[b].detachFrom(this);
505
+ }
506
+ }
507
+ this.parent = target;
508
+ const children = newChildren || d;
509
+ for (let b = children.length - 1; b >= 0; b--) {
510
+ const a = children[b];
511
+ a.index = b;
512
+ a.attachTo(this);
513
+ }
514
+ target.currentBefore = this.currentBefore;
515
+ this.currentBefore = undefined;
516
+ this.d = children;
517
+ this.newChildren = undefined;
518
+ }
519
+ move() {
520
+ const { d, newChildren } = this;
521
+ if (newChildren) {
522
+ ad(d, newChildren, this, true);
523
+ this.d = newChildren;
524
+ this.newChildren = undefined;
525
+ }
526
+ else {
527
+ for (let b = d.length - 1; b >= 0; b--) {
528
+ d[b].move();
529
+ }
530
+ this.currentBefore = undefined;
531
+ }
532
+ }
533
+ detachFrom(target) {
534
+ if (this.parent === target) {
535
+ const { d } = this;
536
+ for (const a of d) {
537
+ a.detachFrom(this);
538
+ }
539
+ this.parent = undefined;
540
+ y.push({ parent: target, element: this });
541
+ }
542
+ else {
543
+ if (!--this.n) {
544
+ if (A) {
545
+ w.add(this);
546
+ }
547
+ else {
548
+ this.release();
549
+ }
550
+ }
551
+ }
552
+ }
553
+ update(p, children) {
554
+ if (children) {
555
+ const newChildren = ac(this.d, children, this);
556
+ if (newChildren) {
557
+ this.newChildren = newChildren;
558
+ return true;
559
+ }
560
+ }
561
+ return false;
562
+ }
563
+ refresh(newChildren) {
564
+ ad(this.d, newChildren, this);
565
+ this.d = newChildren;
566
+ this.newChildren = undefined;
567
+ }
568
+ release(target) {
569
+ if (target && this.parent === target) {
570
+ const { d } = this;
571
+ for (const a of d) {
572
+ a.detachFrom(this);
573
+ }
574
+ this.parent = undefined;
575
+ }
576
+ if (--this.n <= 0) {
577
+ o.delete(this.id);
578
+ }
579
+ }
580
+ findNextSiblingElement(index) {
581
+ const children = this.newChildren || this.d;
582
+ let h;
583
+ let b = index + 1;
584
+ let a = children[b];
585
+ while (a) {
586
+ h = a.firstElement;
587
+ if (h) {
588
+ return h;
589
+ }
590
+ a = children[++b];
591
+ }
592
+ h = this.parent.currentBefore;
593
+ return h !== undefined ? h : this.parent.findNextSiblingElement(this.index);
594
+ }
595
+ n;
596
+ d;
597
+ }
598
+ export class aK {
599
+ constructor(id, tag, props, children, check, mutableChild) {
600
+ this.id = id;
601
+ this.parent = undefined;
602
+ this.index = 0;
603
+ this.n = 0;
604
+ this.firstElement = this.element = aa(tag, this);
605
+ this.newChildren = this.d = mutableChild ? Q(children) : (children || Y);
606
+ this.currentBefore = undefined;
607
+ if (props) {
608
+ this.p = X;
609
+ this.u = -1;
610
+ if (tag === 'select') {
611
+ const ar = this.element;
612
+ const at = props;
613
+ const c = at.value;
614
+ if (c) {
615
+ at.value = undefined;
616
+ const aL = this.refresh;
617
+ this.refresh = (newChildren) => {
618
+ ad(this.d, newChildren, this);
619
+ this.d = newChildren;
620
+ this.newChildren = undefined;
621
+ if (Array.isArray(c)) {
622
+ const aA = c;
623
+ const [e, Z, S] = aA;
624
+ ar.value = S;
625
+ const _ = aA[3] = (x) => e[Z] = x.target.value;
626
+ ar.addEventListener('change', _);
627
+ }
628
+ else {
629
+ ar.value = c;
630
+ }
631
+ at.value = c;
632
+ this.refresh = aL;
633
+ };
634
+ }
635
+ }
636
+ this.update(props);
637
+ this.u = check ?? 0;
638
+ }
639
+ else {
640
+ this.p = props;
641
+ this.u = 0;
642
+ }
643
+ }
644
+ id;
645
+ element;
646
+ parent;
647
+ newChildren;
648
+ index;
649
+ currentBefore;
650
+ firstElement;
651
+ attachTo(target) {
652
+ const { parent, element, newChildren, index } = this;
653
+ if (!this.n++) {
654
+ w.delete(this);
655
+ }
656
+ if (parent) {
657
+ element.remove();
658
+ y.push({ parent, element: this });
659
+ }
660
+ this.parent = target;
661
+ if (newChildren) {
662
+ this.refresh(newChildren);
663
+ }
664
+ let r = target.currentBefore;
665
+ if (r === undefined) {
666
+ r = target.findNextSiblingElement(index);
667
+ }
668
+ target.element.insertBefore(element, r);
669
+ target.currentBefore = element;
670
+ }
671
+ move() {
672
+ const { parent, newChildren, index, element } = this;
673
+ if (newChildren) {
674
+ this.refresh(newChildren);
675
+ }
676
+ let r = parent.currentBefore;
677
+ if (r === undefined) {
678
+ r = parent.findNextSiblingElement(index);
679
+ }
680
+ parent.element.insertBefore(element, r);
681
+ parent.currentBefore = element;
682
+ }
683
+ detachFrom(target) {
684
+ if (this.parent === target) {
685
+ this.element.remove();
686
+ this.parent = undefined;
687
+ y.push({ parent: target, element: this });
688
+ }
689
+ else {
690
+ if (!--this.n) {
691
+ if (A) {
692
+ w.add(this);
693
+ }
694
+ else {
695
+ this.release();
696
+ }
697
+ }
698
+ }
699
+ }
700
+ update(props, children) {
701
+ const { element, p, u } = this;
702
+ if (p && u) {
703
+ this.p = props;
704
+ let k = u;
705
+ for (const key in props) {
706
+ const c = props[key];
707
+ const g = p[key];
708
+ if (c !== g) {
709
+ if (c !== null && c !== undefined) {
710
+ switch (typeof c) {
711
+ case 'string': {
712
+ const a0 = V[key];
713
+ if (!a0) {
714
+ element[key] = c;
715
+ }
716
+ else {
717
+ element.setAttribute(a0, c);
718
+ }
719
+ break;
720
+ }
721
+ case 'number':
722
+ case 'boolean':
723
+ case 'function': {
724
+ element[key] = c;
725
+ break;
726
+ }
727
+ default: {
728
+ if (Array.isArray(c)) {
729
+ const [e, Z, S] = c;
730
+ if (g) {
731
+ const [aM, aN, aO, aB] = g;
732
+ if (aO !== S && element[key] !== S) {
733
+ element[key] = S;
734
+ }
735
+ if (aM === e && aN === Z) {
736
+ c[3] = aB;
737
+ }
738
+ else {
739
+ const _ = c[3] = (x) => e[Z] = x.target[key];
740
+ element.removeEventListener('change', aB);
741
+ element.addEventListener('change', _);
742
+ }
743
+ }
744
+ else {
745
+ element[key] = S;
746
+ const _ = c[3] = (x) => e[Z] = x.target[key];
747
+ element.addEventListener('change', _);
748
+ }
749
+ break;
750
+ }
751
+ if (key === 'style') {
752
+ if (!g) {
753
+ const style = element.style;
754
+ const s = {};
755
+ let k = 0;
756
+ for (const l in c) {
757
+ const a1 = c[l];
758
+ s[l] = a1;
759
+ k++;
760
+ style[l] = a1;
761
+ }
762
+ props[key] = s;
763
+ s.k = k;
764
+ break;
765
+ }
766
+ const style = element.style;
767
+ const s = {};
768
+ let k = 0;
769
+ let J = g.k;
770
+ for (const l in c) {
771
+ const K = c[l];
772
+ s[l] = K;
773
+ if (l in g) {
774
+ J--;
775
+ }
776
+ k++;
777
+ if (K !== g[key]) {
778
+ style[l] = K;
779
+ }
780
+ }
781
+ props[key] = s;
782
+ s.k = k;
783
+ if (J) {
784
+ for (const l in g) {
785
+ if (!(l in c)) {
786
+ style[l] = null;
787
+ if (!--J) {
788
+ break;
789
+ }
790
+ }
791
+ }
792
+ }
793
+ break;
794
+ }
795
+ element[key] = c;
796
+ }
797
+ }
798
+ }
799
+ else {
800
+ switch (typeof g) {
801
+ case 'string': {
802
+ const a0 = V[key];
803
+ if (!a0) {
804
+ this.element[key] = c;
805
+ }
806
+ else {
807
+ this.element.removeAttribute(a0);
808
+ }
809
+ break;
810
+ }
811
+ case 'object': {
812
+ if (g) {
813
+ if (Array.isArray(g)) {
814
+ element.removeEventListener('change', g[3]);
815
+ }
816
+ else if (g === X) {
817
+ element[key] = c;
818
+ }
819
+ }
820
+ else {
821
+ element[key] = c;
822
+ }
823
+ break;
824
+ }
825
+ default: {
826
+ element[key] = c;
827
+ }
828
+ }
829
+ }
830
+ }
831
+ if (!--k) {
832
+ break;
833
+ }
834
+ }
835
+ }
836
+ if (children) {
837
+ const newChildren = ac(this.d, children, this);
838
+ if (newChildren) {
839
+ this.newChildren = newChildren;
840
+ return true;
841
+ }
842
+ }
843
+ return false;
844
+ }
845
+ refresh(newChildren) {
846
+ ad(this.d, newChildren, this);
847
+ this.d = newChildren;
848
+ this.newChildren = undefined;
849
+ }
850
+ release(target) {
851
+ if (target && this.parent === target) {
852
+ this.element.remove();
853
+ this.parent = undefined;
854
+ }
855
+ if (--this.n <= 0) {
856
+ const { d } = this;
857
+ for (const a of d) {
858
+ a.release(this);
859
+ }
860
+ o.delete(this.id);
861
+ }
862
+ }
863
+ findNextSiblingElement(index) {
864
+ const children = this.newChildren || this.d;
865
+ let h;
866
+ let b = index + 1;
867
+ let a = children[b];
868
+ while (a) {
869
+ h = a.firstElement;
870
+ if (h) {
871
+ return h;
872
+ }
873
+ a = children[++b];
874
+ }
875
+ return null;
876
+ }
877
+ a9() {
878
+ this.update = this.aP;
879
+ }
880
+ aP(props, children) {
881
+ const { element, p, u } = this;
882
+ if (p && u) {
883
+ this.p = props;
884
+ let k = u;
885
+ for (const key in props) {
886
+ const c = props[key];
887
+ const g = p[key];
888
+ if (c !== g) {
889
+ if (c !== null && c !== undefined) {
890
+ switch (typeof c) {
891
+ case 'string': {
892
+ element.setAttribute(V[key] ?? key, c);
893
+ break;
894
+ }
895
+ case 'number':
896
+ case 'boolean': {
897
+ element.setAttribute(V[key] ?? key, '' + c);
898
+ break;
899
+ }
900
+ case 'function': {
901
+ element[key] = c;
902
+ break;
903
+ }
904
+ default: {
905
+ if (key === 'style') {
906
+ if (!g) {
907
+ const style = element.style;
908
+ const s = {};
909
+ let k = 0;
910
+ for (const l in c) {
911
+ const a1 = c[l];
912
+ s[l] = a1;
913
+ k++;
914
+ style[l] = a1;
915
+ }
916
+ props[key] = s;
917
+ s.k = k;
918
+ break;
919
+ }
920
+ const style = element.style;
921
+ const s = {};
922
+ let k = 0;
923
+ let J = g.k;
924
+ for (const l in c) {
925
+ const K = c[l];
926
+ s[l] = K;
927
+ if (l in g) {
928
+ J--;
929
+ }
930
+ k++;
931
+ if (K !== g[key]) {
932
+ style[l] = K;
933
+ }
934
+ }
935
+ props[key] = s;
936
+ s.k = k;
937
+ if (J) {
938
+ for (const l in g) {
939
+ if (!(l in c)) {
940
+ style[l] = null;
941
+ if (!--J) {
942
+ break;
943
+ }
944
+ }
945
+ }
946
+ }
947
+ break;
948
+ }
949
+ element[key] = c;
950
+ }
951
+ }
952
+ }
953
+ else {
954
+ const aQ = typeof g;
955
+ switch (aQ) {
956
+ case 'string':
957
+ case 'number':
958
+ case 'boolean': {
959
+ element.removeAttribute(V[key] ?? key);
960
+ break;
961
+ }
962
+ default: {
963
+ element[key] = c;
964
+ }
965
+ }
966
+ }
967
+ }
968
+ if (!--k) {
969
+ break;
970
+ }
971
+ }
972
+ }
973
+ if (children) {
974
+ const newChildren = ac(this.d, children, this);
975
+ if (newChildren) {
976
+ this.newChildren = newChildren;
977
+ return true;
978
+ }
979
+ }
980
+ return false;
981
+ }
982
+ n;
983
+ p;
984
+ d;
985
+ u;
986
+ }
987
+ export class an {
988
+ constructor(id, parentCom, entry, props, children, check, mutableChild) {
989
+ this.id = id;
990
+ this.parentCom = parentCom;
991
+ this.parent = undefined;
992
+ this.index = 0;
993
+ this.version = 0;
994
+ this.n = 0;
995
+ this.aC = entry;
996
+ this.p = props;
997
+ this.newChildren = this.d = mutableChild ? Q(children) : (children || Y);
998
+ this.u = check ?? 0;
999
+ }
1000
+ id;
1001
+ parentCom;
1002
+ parent;
1003
+ newChildren;
1004
+ index;
1005
+ version;
1006
+ get firstElement() {
1007
+ return this.j?.firstElement || null;
1008
+ }
1009
+ attachTo(target) {
1010
+ const { parent, newChildren, j } = this;
1011
+ this.parent = target;
1012
+ if (newChildren) {
1013
+ this.refresh(newChildren);
1014
+ }
1015
+ else if (j) {
1016
+ j.index = this.index;
1017
+ j.attachTo(target);
1018
+ }
1019
+ if (!this.n++) {
1020
+ w.delete(this);
1021
+ }
1022
+ if (parent) {
1023
+ y.push({ parent, element: this });
1024
+ }
1025
+ }
1026
+ move() {
1027
+ const { newChildren, j } = this;
1028
+ if (newChildren) {
1029
+ this.refresh(newChildren);
1030
+ }
1031
+ else if (j) {
1032
+ j.index = this.index;
1033
+ j.move();
1034
+ }
1035
+ }
1036
+ detachFrom(target) {
1037
+ if (this.parent === target) {
1038
+ this.j?.detachFrom(target);
1039
+ this.parent = undefined;
1040
+ y.push({ parent: target, element: this });
1041
+ }
1042
+ else {
1043
+ if (!--this.n) {
1044
+ if (A) {
1045
+ w.add(this);
1046
+ }
1047
+ else {
1048
+ this.release();
1049
+ }
1050
+ }
1051
+ }
1052
+ }
1053
+ update(props, children) {
1054
+ const { p, d, u } = this;
1055
+ this.p = props;
1056
+ if (children) {
1057
+ const newChildren = ac(d, children, this.parent);
1058
+ if (newChildren) {
1059
+ this.newChildren = newChildren;
1060
+ return true;
1061
+ }
1062
+ }
1063
+ if (!this.newChildren && u) {
1064
+ let k = u;
1065
+ for (const key in p) {
1066
+ if (p[key] !== props[key]) {
1067
+ this.newChildren = d;
1068
+ return true;
1069
+ }
1070
+ if (!--k) {
1071
+ break;
1072
+ }
1073
+ }
1074
+ }
1075
+ return false;
1076
+ }
1077
+ refresh(newChildren) {
1078
+ const { id, parent, j, index } = this;
1079
+ const aR = q;
1080
+ q = this;
1081
+ let v = this.aC(this.p || X, newChildren);
1082
+ if (v !== j) {
1083
+ switch (typeof v) {
1084
+ case 'boolean':
1085
+ case 'number':
1086
+ case 'bigint':
1087
+ v = '' + v;
1088
+ case 'string':
1089
+ v = new ao('', v);
1090
+ this.j = v;
1091
+ v.index = index;
1092
+ v.attachTo(parent);
1093
+ j?.detachFrom(parent);
1094
+ break;
1095
+ default:
1096
+ if (v) {
1097
+ this.j = v;
1098
+ v.index = index;
1099
+ v.attachTo(parent);
1100
+ j?.detachFrom(parent);
1101
+ if (!a7.a4()) {
1102
+ a7.a5((a2, com) => {
1103
+ if (!a2.startsWith(id)) {
1104
+ return U;
1105
+ }
1106
+ if (com.parent && am(com.parent)) {
1107
+ G.C(a2, com);
1108
+ return L;
1109
+ }
1110
+ return a3;
1111
+ }, id);
1112
+ }
1113
+ }
1114
+ else {
1115
+ this.j = undefined;
1116
+ j?.detachFrom(parent);
1117
+ }
1118
+ }
1119
+ }
1120
+ else if (j) {
1121
+ if (j.parent !== parent) {
1122
+ j.index = index;
1123
+ j.attachTo(parent);
1124
+ }
1125
+ else if (j.index !== index) {
1126
+ j.index = index;
1127
+ j.move();
1128
+ }
1129
+ }
1130
+ this.d = newChildren;
1131
+ this.newChildren = undefined;
1132
+ q = aR;
1133
+ }
1134
+ release(target) {
1135
+ if (target && this.parent === target) {
1136
+ this.j?.detachFrom(target);
1137
+ this.parent = undefined;
1138
+ }
1139
+ if (--this.n <= 0) {
1140
+ if (this.newChildren) {
1141
+ a7.delete(this.id);
1142
+ }
1143
+ o.delete(this.id);
1144
+ }
1145
+ }
1146
+ markChanged() {
1147
+ if (!this.newChildren) {
1148
+ this.newChildren = this.d;
1149
+ return true;
1150
+ }
1151
+ return false;
1152
+ }
1153
+ watchMountChange(aS, _, D) {
1154
+ const ab = ay(this.parent, this.id);
1155
+ ai.C(ab + aS, { _, D }, true);
1156
+ }
1157
+ n;
1158
+ aC;
1159
+ p;
1160
+ d;
1161
+ u;
1162
+ j;
1163
+ }
1164
+ class a8 {
1165
+ constructor(id, rootElement) {
1166
+ this.id = id;
1167
+ this.element = rootElement;
1168
+ this.currentBefore = undefined;
1169
+ }
1170
+ id;
1171
+ element;
1172
+ parent;
1173
+ currentBefore;
1174
+ findNextSiblingElement(aY) {
1175
+ return null;
1176
+ }
1177
+ render(entry) {
1178
+ if (!this.ah) {
1179
+ this.ah = new an(this.id, aj, entry, null, Y);
1180
+ o.set(this.id, this.ah);
1181
+ this.ah.attachTo(this);
1182
+ N++;
1183
+ }
1184
+ }
1185
+ ah;
1186
+ }
1187
+ export const addComReader = (readerRecord, key) => {
1188
+ if (q.id) {
1189
+ let I = readerRecord[key];
1190
+ if (!I) {
1191
+ I = new Map();
1192
+ readerRecord[key] = I;
1193
+ }
1194
+ I.set(q.id, q.version);
1195
+ }
1196
+ };
1197
+ export let refreshComReaders = (readerRecord, key) => {
1198
+ const I = readerRecord[key];
1199
+ if (I) {
1200
+ for (const [a2, version] of I) {
1201
+ const com = o.get(a2);
1202
+ if (com?.version === version && com.markChanged()) {
1203
+ if (G.a4()) {
1204
+ queueMicrotask(aG);
1205
+ }
1206
+ G.C(a2, com);
1207
+ }
1208
+ }
1209
+ I.clear();
1210
+ }
1211
+ };
1212
+ export const aD = (replace) => refreshComReaders = replace;
1213
+ export const configGC = (waitIntervals, interval = 20000) => {
1214
+ if (waitIntervals >= 0 && interval >= 1000) {
1215
+ ak = interval;
1216
+ if (A) {
1217
+ clearTimeout(M);
1218
+ }
1219
+ if (waitIntervals) {
1220
+ M = setTimeout(al, ak);
1221
+ }
1222
+ else if (M) {
1223
+ M = undefined;
1224
+ for (let b = 0; b < A; b++) {
1225
+ al();
1226
+ }
1227
+ }
1228
+ A = waitIntervals;
1229
+ return true;
1230
+ }
1231
+ return false;
1232
+ };
1233
+ const aT = () => {
1234
+ F = av.pop();
1235
+ };
1236
+ export var $ezh;
1237
+ (function ($ezh) {
1238
+ $ezh.render = (rootElement, entry) => {
1239
+ const id = (au.length || '') + '|';
1240
+ const aE = new a8(id, rootElement);
1241
+ au.push(aE);
1242
+ aE.render(entry);
1243
+ };
1244
+ $ezh.$ = (id, tag, props, children, check, mutableChild) => {
1245
+ const m = `${q.id}${id}${F}`;
1246
+ let element = o.get(m);
1247
+ if (element) {
1248
+ if ((props || children) && element.update(props, children)) {
1249
+ G.C(m, element);
1250
+ }
1251
+ return element;
1252
+ }
1253
+ element = new aK(m, tag, props, children, check, mutableChild);
1254
+ o.set(m, element);
1255
+ return element;
1256
+ };
1257
+ $ezh.$c = (id, entry, props, children, check, mutableChild) => {
1258
+ const m = `${q.id}${id}${F}`;
1259
+ let element = o.get(m);
1260
+ if (element) {
1261
+ if ((props || children) && element.update(props, children)) {
1262
+ G.C(m, element);
1263
+ }
1264
+ return element;
1265
+ }
1266
+ element = new an(m, q, entry, props, children, check, mutableChild);
1267
+ o.set(m, element);
1268
+ return element;
1269
+ };
1270
+ $ezh.$f = (id, children, mutableChild) => {
1271
+ const m = `${q.id}${id}${F}`;
1272
+ let element = o.get(m);
1273
+ if (element) {
1274
+ if (children && element.update(null, children)) {
1275
+ G.C(m, element);
1276
+ }
1277
+ return element;
1278
+ }
1279
+ element = new aI(m, children, mutableChild);
1280
+ o.set(m, element);
1281
+ return element;
1282
+ };
1283
+ $ezh.$k = (key) => {
1284
+ av.push(F);
1285
+ F = `${F || '{'}${key}}`;
1286
+ return aT;
1287
+ };
1288
+ $ezh.$n = (ns) => {
1289
+ const aU = aa;
1290
+ aa = ax[ns];
1291
+ return () => {
1292
+ aa = aU;
1293
+ };
1294
+ };
1295
+ $ezh.$s = (cb, element) => {
1296
+ cb();
1297
+ return element;
1298
+ };
1299
+ $ezh.$t = (id, text, mayChange) => {
1300
+ const m = `${q.id}${id}${F}`;
1301
+ let element = o.get(m);
1302
+ if (element) {
1303
+ if (mayChange) {
1304
+ element.update(text);
1305
+ }
1306
+ return element;
1307
+ }
1308
+ element = new ao(m, text);
1309
+ o.set(element.id, element);
1310
+ return element;
1311
+ };
1312
+ })($ezh || ($ezh = {}));
1313
+ //# sourceMappingURL=elements.js.map