svg-jww-viewer 2025.12.1

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/dist/index.mjs ADDED
@@ -0,0 +1,3873 @@
1
+ //#region target/js/release/build/svg_jww_ui/svg_jww_ui.js
2
+ const $1L = {
3
+ hi: 0,
4
+ lo: 1
5
+ };
6
+ const $2305843009213693952L = {
7
+ hi: 536870912,
8
+ lo: 0
9
+ };
10
+ const $5955668970331000884L = {
11
+ hi: 1386662239,
12
+ lo: -1067102156
13
+ };
14
+ const $1784059615882449851L = {
15
+ hi: 415383748,
16
+ lo: -1362422853
17
+ };
18
+ const $8982663654677661702L = {
19
+ hi: 2091439360,
20
+ lo: 1910491142
21
+ };
22
+ const $1380349269358112757L = {
23
+ hi: 321387608,
24
+ lo: -636522507
25
+ };
26
+ const $7286864317269821294L = {
27
+ hi: 1696605309,
28
+ lo: 894846830
29
+ };
30
+ const $2135987035920910082L = {
31
+ hi: 497323236,
32
+ lo: 1760020226
33
+ };
34
+ const $7005857020398200553L = {
35
+ hi: 1631178199,
36
+ lo: 1745020649
37
+ };
38
+ const $1652639921975621497L = {
39
+ hi: 384785216,
40
+ lo: -1023641735
41
+ };
42
+ const $_481418970354774919L = {
43
+ hi: -112089089,
44
+ lo: 1138658425
45
+ };
46
+ const $1278668206209430417L = {
47
+ hi: 297713141,
48
+ lo: 2024993681
49
+ };
50
+ const $8928596168509315048L = {
51
+ hi: 2078850792,
52
+ lo: -689350680
53
+ };
54
+ const $1978643211784836272L = {
55
+ hi: 460688772,
56
+ lo: -1884531536
57
+ };
58
+ const $_8371072500651252758L = {
59
+ hi: -1949042199,
60
+ lo: -1717296150
61
+ };
62
+ const $1530901034580419511L = {
63
+ hi: 356440673,
64
+ lo: 1081189303
65
+ };
66
+ const $597001226353042382L = {
67
+ hi: 139000179,
68
+ lo: -885070898
69
+ };
70
+ const $1184477304306571148L = {
71
+ hi: 275782613,
72
+ lo: 666146700
73
+ };
74
+ const $1527430471115325346L = {
75
+ hi: 355632619,
76
+ lo: -1175470174
77
+ };
78
+ const $1832889850782397517L = {
79
+ hi: 426752923,
80
+ lo: -1269975987
81
+ };
82
+ const $_5913534206540532074L = {
83
+ hi: -1376851976,
84
+ lo: 1812444822
85
+ };
86
+ const $1418129833677084982L = {
87
+ hi: 330184081,
88
+ lo: -172697290
89
+ };
90
+ const $5577825024675947042L = {
91
+ hi: 1298688590,
92
+ lo: -1357372894
93
+ };
94
+ const $2194449627517475473L = {
95
+ hi: 510935119,
96
+ lo: 1034607249
97
+ };
98
+ const $_7439769533505684065L = {
99
+ hi: -1732206330,
100
+ lo: -526467681
101
+ };
102
+ const $1697873161311732311L = {
103
+ hi: 395316900,
104
+ lo: -39337385
105
+ };
106
+ const $_8133250842069730034L = {
107
+ hi: -1893670029,
108
+ lo: 1900641550
109
+ };
110
+ const $1313665730009899186L = {
111
+ hi: 305861637,
112
+ lo: 1993875634
113
+ };
114
+ const $_5745727253942878843L = {
115
+ hi: -1337781375,
116
+ lo: 880033157
117
+ };
118
+ const $2032799256770390445L = {
119
+ hi: 473297959,
120
+ lo: 1601841581
121
+ };
122
+ const $0L = {
123
+ hi: 0,
124
+ lo: 0
125
+ };
126
+ const $1152921504606846976L = {
127
+ hi: 268435456,
128
+ lo: 0
129
+ };
130
+ const $1490116119384765625L = {
131
+ hi: 346944695,
132
+ lo: 839070905
133
+ };
134
+ const $1032610780636961552L = {
135
+ hi: 240423432,
136
+ lo: -1290085616
137
+ };
138
+ const $1925929944387235853L = {
139
+ hi: 448415508,
140
+ lo: -1786957811
141
+ };
142
+ const $7910200175544436838L = {
143
+ hi: 1841736998,
144
+ lo: 1301219430
145
+ };
146
+ const $1244603055572228341L = {
147
+ hi: 289781730,
148
+ lo: -2051041035
149
+ };
150
+ const $_1504838264676837686L = {
151
+ hi: -350372462,
152
+ lo: 1032165066
153
+ };
154
+ const $1608611746708759036L = {
155
+ hi: 374534108,
156
+ lo: 1612227068
157
+ };
158
+ const $_5421850118411349444L = {
159
+ hi: -1262372853,
160
+ lo: 581866044
161
+ };
162
+ const $2079081953128979843L = {
163
+ hi: 484073989,
164
+ lo: 1529716099
165
+ };
166
+ const $6607496772837067824L = {
167
+ hi: 1538427726,
168
+ lo: -1887548368
169
+ };
170
+ const $1343575221513417750L = {
171
+ hi: 312825483,
172
+ lo: -1621953514
173
+ };
174
+ const $_1113817083813899013L = {
175
+ hi: -259330749,
176
+ lo: 1988285691
177
+ };
178
+ const $1736530273035216783L = {
179
+ hi: 404317461,
180
+ lo: 838461327
181
+ };
182
+ const $_5409364890226003632L = {
183
+ hi: -1259465910,
184
+ lo: -644091568
185
+ };
186
+ const $2244412773384604712L = {
187
+ hi: 522568070,
188
+ lo: -1494201304
189
+ };
190
+ const $1605989338741628675L = {
191
+ hi: 373923531,
192
+ lo: 1891786499
193
+ };
194
+ const $1450417759929778918L = {
195
+ hi: 337701700,
196
+ lo: -1668791578
197
+ };
198
+ const $_8816519005292960336L = {
199
+ hi: -2052755795,
200
+ lo: 906519984
201
+ };
202
+ const $1874621017369538693L = {
203
+ hi: 436469218,
204
+ lo: 348844165
205
+ };
206
+ const $665883850346957067L = {
207
+ hi: 155038165,
208
+ lo: 2040105227
209
+ };
210
+ const $1211445438634777304L = {
211
+ hi: 282061621,
212
+ lo: 983030488
213
+ };
214
+ const $_3514853404985837908L = {
215
+ hi: -818365581,
216
+ lo: 1581201068
217
+ };
218
+ const $1565756531257009982L = {
219
+ hi: 364556100,
220
+ lo: -95262914
221
+ };
222
+ const $5L = {
223
+ hi: 0,
224
+ lo: 5
225
+ };
226
+ const $25L = {
227
+ hi: 0,
228
+ lo: 25
229
+ };
230
+ const $125L = {
231
+ hi: 0,
232
+ lo: 125
233
+ };
234
+ const $625L = {
235
+ hi: 0,
236
+ lo: 625
237
+ };
238
+ const $3125L = {
239
+ hi: 0,
240
+ lo: 3125
241
+ };
242
+ const $15625L = {
243
+ hi: 0,
244
+ lo: 15625
245
+ };
246
+ const $78125L = {
247
+ hi: 0,
248
+ lo: 78125
249
+ };
250
+ const $390625L = {
251
+ hi: 0,
252
+ lo: 390625
253
+ };
254
+ const $1953125L = {
255
+ hi: 0,
256
+ lo: 1953125
257
+ };
258
+ const $9765625L = {
259
+ hi: 0,
260
+ lo: 9765625
261
+ };
262
+ const $48828125L = {
263
+ hi: 0,
264
+ lo: 48828125
265
+ };
266
+ const $244140625L = {
267
+ hi: 0,
268
+ lo: 244140625
269
+ };
270
+ const $1220703125L = {
271
+ hi: 0,
272
+ lo: 1220703125
273
+ };
274
+ const $6103515625L = {
275
+ hi: 1,
276
+ lo: 1808548329
277
+ };
278
+ const $30517578125L = {
279
+ hi: 7,
280
+ lo: 452807053
281
+ };
282
+ const $152587890625L = {
283
+ hi: 35,
284
+ lo: -2030932031
285
+ };
286
+ const $762939453125L = {
287
+ hi: 177,
288
+ lo: -1564725563
289
+ };
290
+ const $3814697265625L = {
291
+ hi: 888,
292
+ lo: 766306777
293
+ };
294
+ const $19073486328125L = {
295
+ hi: 4440,
296
+ lo: -463433411
297
+ };
298
+ const $95367431640625L = {
299
+ hi: 22204,
300
+ lo: 1977800241
301
+ };
302
+ const $476837158203125L = {
303
+ hi: 111022,
304
+ lo: 1299066613
305
+ };
306
+ const $2384185791015625L = {
307
+ hi: 555111,
308
+ lo: -2094601527
309
+ };
310
+ const $11920928955078125L = {
311
+ hi: 2775557,
312
+ lo: -1883073043
313
+ };
314
+ const $59604644775390625L = {
315
+ hi: 13877787,
316
+ lo: -825430623
317
+ };
318
+ const $298023223876953125L = {
319
+ hi: 69388939,
320
+ lo: 167814181
321
+ };
322
+ const Option$None$0$ = { $tag: 0 };
323
+ function Option$Some$0$(param0) {
324
+ this._0 = param0;
325
+ }
326
+ Option$Some$0$.prototype.$tag = 1;
327
+ var $PanicError = class extends Error {};
328
+ function $panic() {
329
+ throw new $PanicError();
330
+ }
331
+ function $bound_check(arr, index) {
332
+ if (index < 0 || index >= arr.length) throw new Error("Index out of bounds");
333
+ }
334
+ function $make_array_len_and_init(a, b) {
335
+ const arr = new Array(a);
336
+ arr.fill(b);
337
+ return arr;
338
+ }
339
+ function Result$Err$1$(param0) {
340
+ this._0 = param0;
341
+ }
342
+ Result$Err$1$.prototype.$tag = 0;
343
+ function Result$Ok$1$(param0) {
344
+ this._0 = param0;
345
+ }
346
+ Result$Ok$1$.prototype.$tag = 1;
347
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds = { $tag: 1 };
348
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex = { $tag: 0 };
349
+ const moonbitlang$core$builtin$$int_to_string_js = (x, radix) => {
350
+ return x.toString(radix);
351
+ };
352
+ const moonbitlang$core$builtin$$uint_to_string_js = (x, radix) => {
353
+ return (x >>> 0).toString(radix);
354
+ };
355
+ const moonbitlang$core$builtin$$uint64_to_string_js = (num, radix) => {
356
+ return (BigInt(num.hi >>> 0) << 32n | BigInt(num.lo >>> 0)).toString(radix);
357
+ };
358
+ function $makebytes(a, b) {
359
+ const arr = new Uint8Array(a);
360
+ if (b !== 0) arr.fill(b);
361
+ return arr;
362
+ }
363
+ const moonbitlang$core$builtin$$JSArray$push = (arr, val) => {
364
+ arr.push(val);
365
+ };
366
+ const $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Continue$2$ = { $tag: 0 };
367
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Break$2$(param0) {
368
+ this._0 = param0;
369
+ }
370
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Break$2$.prototype.$tag = 1;
371
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Return$2$(param0) {
372
+ this._0 = param0;
373
+ }
374
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Return$2$.prototype.$tag = 2;
375
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Error$2$(param0) {
376
+ this._0 = param0;
377
+ }
378
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Error$2$.prototype.$tag = 3;
379
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$JumpOuter$2$(param0) {
380
+ this._0 = param0;
381
+ }
382
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$JumpOuter$2$.prototype.$tag = 4;
383
+ const moonbitlang$core$builtin$$try_init_wasm_helper = function() {
384
+ try {
385
+ return new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
386
+ 0,
387
+ 97,
388
+ 115,
389
+ 109,
390
+ 1,
391
+ 0,
392
+ 0,
393
+ 0,
394
+ 1,
395
+ 13,
396
+ 2,
397
+ 96,
398
+ 0,
399
+ 1,
400
+ 127,
401
+ 96,
402
+ 4,
403
+ 127,
404
+ 127,
405
+ 127,
406
+ 127,
407
+ 1,
408
+ 127,
409
+ 3,
410
+ 7,
411
+ 6,
412
+ 0,
413
+ 1,
414
+ 1,
415
+ 1,
416
+ 1,
417
+ 1,
418
+ 6,
419
+ 6,
420
+ 1,
421
+ 127,
422
+ 1,
423
+ 65,
424
+ 0,
425
+ 11,
426
+ 7,
427
+ 50,
428
+ 6,
429
+ 3,
430
+ 109,
431
+ 117,
432
+ 108,
433
+ 0,
434
+ 1,
435
+ 5,
436
+ 100,
437
+ 105,
438
+ 118,
439
+ 95,
440
+ 115,
441
+ 0,
442
+ 2,
443
+ 5,
444
+ 100,
445
+ 105,
446
+ 118,
447
+ 95,
448
+ 117,
449
+ 0,
450
+ 3,
451
+ 5,
452
+ 114,
453
+ 101,
454
+ 109,
455
+ 95,
456
+ 115,
457
+ 0,
458
+ 4,
459
+ 5,
460
+ 114,
461
+ 101,
462
+ 109,
463
+ 95,
464
+ 117,
465
+ 0,
466
+ 5,
467
+ 8,
468
+ 103,
469
+ 101,
470
+ 116,
471
+ 95,
472
+ 104,
473
+ 105,
474
+ 103,
475
+ 104,
476
+ 0,
477
+ 0,
478
+ 10,
479
+ 191,
480
+ 1,
481
+ 6,
482
+ 4,
483
+ 0,
484
+ 35,
485
+ 0,
486
+ 11,
487
+ 36,
488
+ 1,
489
+ 1,
490
+ 126,
491
+ 32,
492
+ 0,
493
+ 173,
494
+ 32,
495
+ 1,
496
+ 173,
497
+ 66,
498
+ 32,
499
+ 134,
500
+ 132,
501
+ 32,
502
+ 2,
503
+ 173,
504
+ 32,
505
+ 3,
506
+ 173,
507
+ 66,
508
+ 32,
509
+ 134,
510
+ 132,
511
+ 126,
512
+ 34,
513
+ 4,
514
+ 66,
515
+ 32,
516
+ 135,
517
+ 167,
518
+ 36,
519
+ 0,
520
+ 32,
521
+ 4,
522
+ 167,
523
+ 11,
524
+ 36,
525
+ 1,
526
+ 1,
527
+ 126,
528
+ 32,
529
+ 0,
530
+ 173,
531
+ 32,
532
+ 1,
533
+ 173,
534
+ 66,
535
+ 32,
536
+ 134,
537
+ 132,
538
+ 32,
539
+ 2,
540
+ 173,
541
+ 32,
542
+ 3,
543
+ 173,
544
+ 66,
545
+ 32,
546
+ 134,
547
+ 132,
548
+ 127,
549
+ 34,
550
+ 4,
551
+ 66,
552
+ 32,
553
+ 135,
554
+ 167,
555
+ 36,
556
+ 0,
557
+ 32,
558
+ 4,
559
+ 167,
560
+ 11,
561
+ 36,
562
+ 1,
563
+ 1,
564
+ 126,
565
+ 32,
566
+ 0,
567
+ 173,
568
+ 32,
569
+ 1,
570
+ 173,
571
+ 66,
572
+ 32,
573
+ 134,
574
+ 132,
575
+ 32,
576
+ 2,
577
+ 173,
578
+ 32,
579
+ 3,
580
+ 173,
581
+ 66,
582
+ 32,
583
+ 134,
584
+ 132,
585
+ 128,
586
+ 34,
587
+ 4,
588
+ 66,
589
+ 32,
590
+ 135,
591
+ 167,
592
+ 36,
593
+ 0,
594
+ 32,
595
+ 4,
596
+ 167,
597
+ 11,
598
+ 36,
599
+ 1,
600
+ 1,
601
+ 126,
602
+ 32,
603
+ 0,
604
+ 173,
605
+ 32,
606
+ 1,
607
+ 173,
608
+ 66,
609
+ 32,
610
+ 134,
611
+ 132,
612
+ 32,
613
+ 2,
614
+ 173,
615
+ 32,
616
+ 3,
617
+ 173,
618
+ 66,
619
+ 32,
620
+ 134,
621
+ 132,
622
+ 129,
623
+ 34,
624
+ 4,
625
+ 66,
626
+ 32,
627
+ 135,
628
+ 167,
629
+ 36,
630
+ 0,
631
+ 32,
632
+ 4,
633
+ 167,
634
+ 11,
635
+ 36,
636
+ 1,
637
+ 1,
638
+ 126,
639
+ 32,
640
+ 0,
641
+ 173,
642
+ 32,
643
+ 1,
644
+ 173,
645
+ 66,
646
+ 32,
647
+ 134,
648
+ 132,
649
+ 32,
650
+ 2,
651
+ 173,
652
+ 32,
653
+ 3,
654
+ 173,
655
+ 66,
656
+ 32,
657
+ 134,
658
+ 132,
659
+ 130,
660
+ 34,
661
+ 4,
662
+ 66,
663
+ 32,
664
+ 135,
665
+ 167,
666
+ 36,
667
+ 0,
668
+ 32,
669
+ 4,
670
+ 167,
671
+ 11
672
+ ])), {}).exports;
673
+ } catch (e) {
674
+ return;
675
+ }
676
+ };
677
+ const moonbitlang$core$builtin$$MyInt64$div_u_bigint = (a, b) => {
678
+ const result = (BigInt(a.hi >>> 0) << 32n | BigInt(a.lo >>> 0)) / (BigInt(b.hi >>> 0) << 32n | BigInt(b.lo >>> 0));
679
+ const lo = Number(result & 4294967295n);
680
+ return {
681
+ hi: Number(result >> 32n & 4294967295n) | 0,
682
+ lo: lo | 0
683
+ };
684
+ };
685
+ const moonbitlang$core$builtin$$MyInt64$mod_u_bigint = (a, b) => {
686
+ const result = (BigInt(a.hi >>> 0) << 32n | BigInt(a.lo >>> 0)) % (BigInt(b.hi >>> 0) << 32n | BigInt(b.lo >>> 0));
687
+ const lo = Number(result & 4294967295n);
688
+ return {
689
+ hi: Number(result >> 32n & 4294967295n) | 0,
690
+ lo: lo | 0
691
+ };
692
+ };
693
+ const moonbitlang$core$builtin$$MyInt64$compare_u = (a, b) => {
694
+ const ahi = a.hi >>> 0;
695
+ const bhi = b.hi >>> 0;
696
+ if (ahi < bhi) return -1;
697
+ if (ahi > bhi) return 1;
698
+ const alo = a.lo >>> 0;
699
+ const blo = b.lo >>> 0;
700
+ if (alo < blo) return -1;
701
+ if (alo > blo) return 1;
702
+ return 0;
703
+ };
704
+ const moonbitlang$core$builtin$$MyInt64$reinterpret_double = function f(a) {
705
+ let view = f._view;
706
+ if (view === void 0) view = f._view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
707
+ view.setFloat64(0, a);
708
+ return {
709
+ hi: view.getInt32(0),
710
+ lo: view.getInt32(4)
711
+ };
712
+ };
713
+ const $4294967295L = {
714
+ hi: 0,
715
+ lo: -1
716
+ };
717
+ const $10000000000000000L = {
718
+ hi: 2328306,
719
+ lo: 1874919424
720
+ };
721
+ const $1000000000000000L = {
722
+ hi: 232830,
723
+ lo: -1530494976
724
+ };
725
+ const $100000000000000L = {
726
+ hi: 23283,
727
+ lo: 276447232
728
+ };
729
+ const $10000000000000L = {
730
+ hi: 2328,
731
+ lo: 1316134912
732
+ };
733
+ const $1000000000000L = {
734
+ hi: 232,
735
+ lo: -727379968
736
+ };
737
+ const $100000000000L = {
738
+ hi: 23,
739
+ lo: 1215752192
740
+ };
741
+ const $10000000000L = {
742
+ hi: 2,
743
+ lo: 1410065408
744
+ };
745
+ const $1000000000L = {
746
+ hi: 0,
747
+ lo: 1e9
748
+ };
749
+ const $100000000L = {
750
+ hi: 0,
751
+ lo: 1e8
752
+ };
753
+ const $10000000L = {
754
+ hi: 0,
755
+ lo: 1e7
756
+ };
757
+ const $1000000L = {
758
+ hi: 0,
759
+ lo: 1e6
760
+ };
761
+ const $100000L = {
762
+ hi: 0,
763
+ lo: 1e5
764
+ };
765
+ const $10000L = {
766
+ hi: 0,
767
+ lo: 1e4
768
+ };
769
+ const $1000L = {
770
+ hi: 0,
771
+ lo: 1e3
772
+ };
773
+ const $100L = {
774
+ hi: 0,
775
+ lo: 100
776
+ };
777
+ const $10L = {
778
+ hi: 0,
779
+ lo: 10
780
+ };
781
+ const $4L = {
782
+ hi: 0,
783
+ lo: 4
784
+ };
785
+ const $2L = {
786
+ hi: 0,
787
+ lo: 2
788
+ };
789
+ function $64$mizchi$47$luna$47$luna$46$Node$Element$3$(param0) {
790
+ this._0 = param0;
791
+ }
792
+ $64$mizchi$47$luna$47$luna$46$Node$Element$3$.prototype.$tag = 0;
793
+ function $64$mizchi$47$luna$47$luna$46$Node$Text$3$(param0) {
794
+ this._0 = param0;
795
+ }
796
+ $64$mizchi$47$luna$47$luna$46$Node$Text$3$.prototype.$tag = 1;
797
+ function $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(param0) {
798
+ this._0 = param0;
799
+ }
800
+ $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$.prototype.$tag = 2;
801
+ function $64$mizchi$47$luna$47$luna$46$Node$Fragment$3$(param0) {
802
+ this._0 = param0;
803
+ }
804
+ $64$mizchi$47$luna$47$luna$46$Node$Fragment$3$.prototype.$tag = 3;
805
+ function $64$mizchi$47$luna$47$luna$46$Node$Show$3$(param0, param1) {
806
+ this._0 = param0;
807
+ this._1 = param1;
808
+ }
809
+ $64$mizchi$47$luna$47$luna$46$Node$Show$3$.prototype.$tag = 4;
810
+ function $64$mizchi$47$luna$47$luna$46$Node$For$3$(param0) {
811
+ this._0 = param0;
812
+ }
813
+ $64$mizchi$47$luna$47$luna$46$Node$For$3$.prototype.$tag = 5;
814
+ function $64$mizchi$47$luna$47$luna$46$Node$Component$3$(param0) {
815
+ this._0 = param0;
816
+ }
817
+ $64$mizchi$47$luna$47$luna$46$Node$Component$3$.prototype.$tag = 6;
818
+ function $64$mizchi$47$luna$47$luna$46$Node$Island$3$(param0) {
819
+ this._0 = param0;
820
+ }
821
+ $64$mizchi$47$luna$47$luna$46$Node$Island$3$.prototype.$tag = 7;
822
+ function $64$mizchi$47$luna$47$luna$46$Node$WcIsland$3$(param0) {
823
+ this._0 = param0;
824
+ }
825
+ $64$mizchi$47$luna$47$luna$46$Node$WcIsland$3$.prototype.$tag = 8;
826
+ function $64$mizchi$47$luna$47$luna$46$Node$Async$3$(param0) {
827
+ this._0 = param0;
828
+ }
829
+ $64$mizchi$47$luna$47$luna$46$Node$Async$3$.prototype.$tag = 9;
830
+ function $64$mizchi$47$luna$47$luna$46$Node$ErrorBoundary$3$(param0) {
831
+ this._0 = param0;
832
+ }
833
+ $64$mizchi$47$luna$47$luna$46$Node$ErrorBoundary$3$.prototype.$tag = 10;
834
+ function $64$mizchi$47$luna$47$luna$46$Node$Switch$3$(param0) {
835
+ this._0 = param0;
836
+ }
837
+ $64$mizchi$47$luna$47$luna$46$Node$Switch$3$.prototype.$tag = 11;
838
+ function $64$mizchi$47$luna$47$luna$46$Node$InternalRef$3$(param0) {
839
+ this._0 = param0;
840
+ }
841
+ $64$mizchi$47$luna$47$luna$46$Node$InternalRef$3$.prototype.$tag = 12;
842
+ function $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$(param0) {
843
+ this._0 = param0;
844
+ }
845
+ $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$.prototype.$tag = 13;
846
+ function $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(param0) {
847
+ this._0 = param0;
848
+ }
849
+ $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$.prototype.$tag = 0;
850
+ function $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(param0) {
851
+ this._0 = param0;
852
+ }
853
+ $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$.prototype.$tag = 1;
854
+ function $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(param0) {
855
+ this._0 = param0;
856
+ }
857
+ $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$.prototype.$tag = 2;
858
+ function $64$mizchi$47$luna$47$luna$46$Attr$VAction$3$(param0) {
859
+ this._0 = param0;
860
+ }
861
+ $64$mizchi$47$luna$47$luna$46$Attr$VAction$3$.prototype.$tag = 3;
862
+ const $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger = {
863
+ method_0: moonbitlang$core$builtin$$Logger$write_string$0$,
864
+ method_1: moonbitlang$core$builtin$$Logger$write_substring$1$,
865
+ method_2: moonbitlang$core$builtin$$Logger$write_view$0$,
866
+ method_3: moonbitlang$core$builtin$$Logger$write_char$0$
867
+ };
868
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5354 = ":";
869
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5393 = ":";
870
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5387 = "-";
871
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5374 = ":";
872
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5368 = ":";
873
+ const moonbitlang$core$builtin$$wasm_helper_cache = {
874
+ tried: false,
875
+ exports: void 0
876
+ };
877
+ const moonbitlang$core$builtin$$output$46$42$bind$124$8198 = "/";
878
+ const moonbitlang$core$builtin$$output$46$42$bind$124$8192 = "/";
879
+ const moonbitlang$core$builtin$$boyer_moore_horspool_find$46$constr$47$37 = 0;
880
+ const moonbitlang$core$builtin$$brute_force_find$46$constr$47$51 = 0;
881
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2 = [
882
+ $1L,
883
+ $2305843009213693952L,
884
+ $5955668970331000884L,
885
+ $1784059615882449851L,
886
+ $8982663654677661702L,
887
+ $1380349269358112757L,
888
+ $7286864317269821294L,
889
+ $2135987035920910082L,
890
+ $7005857020398200553L,
891
+ $1652639921975621497L,
892
+ $_481418970354774919L,
893
+ $1278668206209430417L,
894
+ $8928596168509315048L,
895
+ $1978643211784836272L,
896
+ $_8371072500651252758L,
897
+ $1530901034580419511L,
898
+ $597001226353042382L,
899
+ $1184477304306571148L,
900
+ $1527430471115325346L,
901
+ $1832889850782397517L,
902
+ $_5913534206540532074L,
903
+ $1418129833677084982L,
904
+ $5577825024675947042L,
905
+ $2194449627517475473L,
906
+ $_7439769533505684065L,
907
+ $1697873161311732311L,
908
+ $_8133250842069730034L,
909
+ $1313665730009899186L,
910
+ $_5745727253942878843L,
911
+ $2032799256770390445L
912
+ ];
913
+ const moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS = [
914
+ 1414808916,
915
+ 67458373,
916
+ 268701696,
917
+ 4195348,
918
+ 1073807360,
919
+ 1091917141,
920
+ 1108,
921
+ 65604,
922
+ 1073741824,
923
+ 1140850753,
924
+ 1346716752,
925
+ 1431634004,
926
+ 1365595476,
927
+ 1073758208,
928
+ 16777217,
929
+ 66816,
930
+ 1364284433,
931
+ 89478484,
932
+ 0
933
+ ];
934
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2 = [
935
+ $0L,
936
+ $1152921504606846976L,
937
+ $0L,
938
+ $1490116119384765625L,
939
+ $1032610780636961552L,
940
+ $1925929944387235853L,
941
+ $7910200175544436838L,
942
+ $1244603055572228341L,
943
+ $_1504838264676837686L,
944
+ $1608611746708759036L,
945
+ $_5421850118411349444L,
946
+ $2079081953128979843L,
947
+ $6607496772837067824L,
948
+ $1343575221513417750L,
949
+ $_1113817083813899013L,
950
+ $1736530273035216783L,
951
+ $_5409364890226003632L,
952
+ $2244412773384604712L,
953
+ $1605989338741628675L,
954
+ $1450417759929778918L,
955
+ $_8816519005292960336L,
956
+ $1874621017369538693L,
957
+ $665883850346957067L,
958
+ $1211445438634777304L,
959
+ $_3514853404985837908L,
960
+ $1565756531257009982L
961
+ ];
962
+ const moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS = [
963
+ 0,
964
+ 0,
965
+ 0,
966
+ 0,
967
+ 1073741824,
968
+ 1500076437,
969
+ 1431590229,
970
+ 1448432917,
971
+ 1091896580,
972
+ 1079333904,
973
+ 1146442053,
974
+ 1146111296,
975
+ 1163220304,
976
+ 1073758208,
977
+ -1773927360,
978
+ 1431721317,
979
+ 1413824581,
980
+ 1075134801,
981
+ 1431671125,
982
+ 1363170645,
983
+ 261
984
+ ];
985
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE = [
986
+ $1L,
987
+ $5L,
988
+ $25L,
989
+ $125L,
990
+ $625L,
991
+ $3125L,
992
+ $15625L,
993
+ $78125L,
994
+ $390625L,
995
+ $1953125L,
996
+ $9765625L,
997
+ $48828125L,
998
+ $244140625L,
999
+ $1220703125L,
1000
+ $6103515625L,
1001
+ $30517578125L,
1002
+ $152587890625L,
1003
+ $762939453125L,
1004
+ $3814697265625L,
1005
+ $19073486328125L,
1006
+ $95367431640625L,
1007
+ $476837158203125L,
1008
+ $2384185791015625L,
1009
+ $11920928955078125L,
1010
+ $59604644775390625L,
1011
+ $298023223876953125L
1012
+ ];
1013
+ const moonbitlang$core$double$internal$ryu$$ryu_to_string$46$record$47$728 = {
1014
+ mantissa: $0L,
1015
+ exponent: 0
1016
+ };
1017
+ const mizchi$luna$luna$signal$$reactive_context = {
1018
+ current_subscriber: void 0,
1019
+ current_owner: void 0,
1020
+ current_cleanups: Option$None$0$,
1021
+ batch_depth: 0,
1022
+ pending_effects: [],
1023
+ pending_ids: []
1024
+ };
1025
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$39 = "/";
1026
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$35 = ".js";
1027
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$33 = "_";
1028
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$34 = "-";
1029
+ const mizchi$luna$luna$render$$render_attrs_to$46$42$bind$124$630 = "on";
1030
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$915 = "/";
1031
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$916 = "_";
1032
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$917 = ".";
1033
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$918 = "_";
1034
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$780 = "&amp;";
1035
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$781 = "&lt;";
1036
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$782 = "&gt;";
1037
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$783 = "&quot;";
1038
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$784 = "&#39;";
1039
+ const mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$803 = "&amp;";
1040
+ const mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$804 = "&quot;";
1041
+ function moonbitlang$core$abort$$abort$2$(msg) {
1042
+ return $panic();
1043
+ }
1044
+ function moonbitlang$core$abort$$abort$3$(msg) {
1045
+ return $panic();
1046
+ }
1047
+ function moonbitlang$core$abort$$abort$4$(msg) {
1048
+ $panic();
1049
+ }
1050
+ function moonbitlang$core$abort$$abort$5$(msg) {
1051
+ return $panic();
1052
+ }
1053
+ function moonbitlang$core$builtin$$Eq$equal$6$(_x_5248, _x_5249) {
1054
+ if (_x_5248 === 0) if (_x_5249 === 0) return true;
1055
+ else return false;
1056
+ else if (_x_5249 === 1) return true;
1057
+ else return false;
1058
+ }
1059
+ function moonbitlang$core$builtin$$abort$2$(string, loc) {
1060
+ return moonbitlang$core$abort$$abort$2$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1061
+ }
1062
+ function moonbitlang$core$builtin$$abort$3$(string, loc) {
1063
+ return moonbitlang$core$abort$$abort$3$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1064
+ }
1065
+ function moonbitlang$core$builtin$$abort$4$(string, loc) {
1066
+ moonbitlang$core$abort$$abort$4$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1067
+ }
1068
+ function moonbitlang$core$builtin$$abort$5$(string, loc) {
1069
+ return moonbitlang$core$abort$$abort$5$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1070
+ }
1071
+ function moonbitlang$core$builtin$$StringBuilder$new$46$inner(size_hint) {
1072
+ return { val: "" };
1073
+ }
1074
+ function moonbitlang$core$builtin$$Logger$write_char$0$(self, ch) {
1075
+ const _bind = self;
1076
+ _bind.val = `${_bind.val}${String.fromCodePoint(ch)}`;
1077
+ }
1078
+ function moonbitlang$core$builtin$$code_point_of_surrogate_pair(leading, trailing) {
1079
+ return (((Math.imul(leading - 55296 | 0, 1024) | 0) + trailing | 0) - 56320 | 0) + 65536 | 0;
1080
+ }
1081
+ function moonbitlang$core$builtin$$op_notequal$6$(x, y) {
1082
+ return !moonbitlang$core$builtin$$Eq$equal$6$(x, y);
1083
+ }
1084
+ function moonbitlang$core$builtin$$op_notequal$8$(x, y) {
1085
+ return !moonbitlang$core$builtin$$Eq$equal$8$(x, y);
1086
+ }
1087
+ function moonbitlang$core$array$$Array$at$3$(self, index) {
1088
+ const len = self.length;
1089
+ if (index >= 0 && index < len) {
1090
+ $bound_check(self, index);
1091
+ return self[index];
1092
+ } else return $panic();
1093
+ }
1094
+ function moonbitlang$core$builtin$$boyer_moore_horspool_find(haystack, needle) {
1095
+ const haystack_len = haystack.end - haystack.start | 0;
1096
+ const needle_len = needle.end - needle.start | 0;
1097
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1098
+ const skip_table = $make_array_len_and_init(256, needle_len);
1099
+ const _end4418 = needle_len - 1 | 0;
1100
+ let _tmp = 0;
1101
+ while (true) {
1102
+ const i = _tmp;
1103
+ if (i < _end4418) {
1104
+ const _tmp$2$1 = needle.str;
1105
+ const _tmp$3 = needle.start + i | 0;
1106
+ const _tmp$4 = _tmp$2$1.charCodeAt(_tmp$3) & 255;
1107
+ $bound_check(skip_table, _tmp$4);
1108
+ skip_table[_tmp$4] = (needle_len - 1 | 0) - i | 0;
1109
+ _tmp = i + 1 | 0;
1110
+ continue;
1111
+ } else break;
1112
+ }
1113
+ let _tmp$2 = 0;
1114
+ while (true) {
1115
+ const i = _tmp$2;
1116
+ if (i <= (haystack_len - needle_len | 0)) {
1117
+ const _end4424 = needle_len - 1 | 0;
1118
+ let _tmp$3 = 0;
1119
+ while (true) {
1120
+ const j = _tmp$3;
1121
+ if (j <= _end4424) {
1122
+ const _p$1 = i + j | 0;
1123
+ const _tmp$4$1 = haystack.str;
1124
+ const _tmp$5$1 = haystack.start + _p$1 | 0;
1125
+ const _tmp$6$1 = _tmp$4$1.charCodeAt(_tmp$5$1);
1126
+ const _tmp$7 = needle.str;
1127
+ const _tmp$8 = needle.start + j | 0;
1128
+ if (_tmp$6$1 !== _tmp$7.charCodeAt(_tmp$8)) break;
1129
+ _tmp$3 = j + 1 | 0;
1130
+ continue;
1131
+ } else return i;
1132
+ }
1133
+ const _p = (i + needle_len | 0) - 1 | 0;
1134
+ const _tmp$4 = haystack.str;
1135
+ const _tmp$5 = haystack.start + _p | 0;
1136
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5) & 255;
1137
+ $bound_check(skip_table, _tmp$6);
1138
+ _tmp$2 = i + skip_table[_tmp$6] | 0;
1139
+ continue;
1140
+ } else break;
1141
+ }
1142
+ return;
1143
+ } else return;
1144
+ else return moonbitlang$core$builtin$$boyer_moore_horspool_find$46$constr$47$37;
1145
+ }
1146
+ function moonbitlang$core$builtin$$brute_force_find(haystack, needle) {
1147
+ const haystack_len = haystack.end - haystack.start | 0;
1148
+ const needle_len = needle.end - needle.start | 0;
1149
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1150
+ const _p = 0;
1151
+ const _tmp = needle.str;
1152
+ const _tmp$2 = needle.start + _p | 0;
1153
+ const needle_first = _tmp.charCodeAt(_tmp$2);
1154
+ const forward_len = haystack_len - needle_len | 0;
1155
+ let i = 0;
1156
+ while (true) if (i <= forward_len) {
1157
+ while (true) {
1158
+ let _tmp$3;
1159
+ if (i <= forward_len) {
1160
+ const _p$2 = i;
1161
+ const _tmp$4 = haystack.str;
1162
+ const _tmp$5 = haystack.start + _p$2 | 0;
1163
+ _tmp$3 = _tmp$4.charCodeAt(_tmp$5) !== needle_first;
1164
+ } else _tmp$3 = false;
1165
+ if (_tmp$3) {
1166
+ i = i + 1 | 0;
1167
+ continue;
1168
+ } else break;
1169
+ }
1170
+ if (i <= forward_len) {
1171
+ let _tmp$3 = 1;
1172
+ while (true) {
1173
+ const j = _tmp$3;
1174
+ if (j < needle_len) {
1175
+ const _p$2 = i + j | 0;
1176
+ const _tmp$4 = haystack.str;
1177
+ const _tmp$5 = haystack.start + _p$2 | 0;
1178
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5);
1179
+ const _tmp$7 = needle.str;
1180
+ const _tmp$8 = needle.start + j | 0;
1181
+ if (_tmp$6 !== _tmp$7.charCodeAt(_tmp$8)) break;
1182
+ _tmp$3 = j + 1 | 0;
1183
+ continue;
1184
+ } else return i;
1185
+ }
1186
+ i = i + 1 | 0;
1187
+ }
1188
+ continue;
1189
+ } else break;
1190
+ return;
1191
+ } else return;
1192
+ else return moonbitlang$core$builtin$$brute_force_find$46$constr$47$51;
1193
+ }
1194
+ function moonbitlang$core$string$$StringView$find(self, str) {
1195
+ return (str.end - str.start | 0) <= 4 ? moonbitlang$core$builtin$$brute_force_find(self, str) : moonbitlang$core$builtin$$boyer_moore_horspool_find(self, str);
1196
+ }
1197
+ function moonbitlang$core$builtin$$boyer_moore_horspool_rev_find(haystack, needle) {
1198
+ const haystack_len = haystack.end - haystack.start | 0;
1199
+ const needle_len = needle.end - needle.start | 0;
1200
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1201
+ const skip_table = $make_array_len_and_init(256, needle_len);
1202
+ let _tmp = needle_len - 1 | 0;
1203
+ while (true) {
1204
+ const i = _tmp;
1205
+ if (i > 0) {
1206
+ const _tmp$2$1 = needle.str;
1207
+ const _tmp$3 = needle.start + i | 0;
1208
+ const _tmp$4 = _tmp$2$1.charCodeAt(_tmp$3) & 255;
1209
+ $bound_check(skip_table, _tmp$4);
1210
+ skip_table[_tmp$4] = i;
1211
+ _tmp = i - 1 | 0;
1212
+ continue;
1213
+ } else break;
1214
+ }
1215
+ let _tmp$2 = haystack_len - needle_len | 0;
1216
+ while (true) {
1217
+ const i = _tmp$2;
1218
+ if (i >= 0) {
1219
+ let _tmp$3 = 0;
1220
+ while (true) {
1221
+ const j = _tmp$3;
1222
+ if (j < needle_len) {
1223
+ const _p = i + j | 0;
1224
+ const _tmp$4$1 = haystack.str;
1225
+ const _tmp$5$1 = haystack.start + _p | 0;
1226
+ const _tmp$6$1 = _tmp$4$1.charCodeAt(_tmp$5$1);
1227
+ const _tmp$7 = needle.str;
1228
+ const _tmp$8 = needle.start + j | 0;
1229
+ if (_tmp$6$1 !== _tmp$7.charCodeAt(_tmp$8)) break;
1230
+ _tmp$3 = j + 1 | 0;
1231
+ continue;
1232
+ } else return i;
1233
+ }
1234
+ const _tmp$4 = haystack.str;
1235
+ const _tmp$5 = haystack.start + i | 0;
1236
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5) & 255;
1237
+ $bound_check(skip_table, _tmp$6);
1238
+ _tmp$2 = i - skip_table[_tmp$6] | 0;
1239
+ continue;
1240
+ } else break;
1241
+ }
1242
+ return;
1243
+ } else return;
1244
+ else return haystack_len;
1245
+ }
1246
+ function moonbitlang$core$builtin$$brute_force_rev_find(haystack, needle) {
1247
+ const haystack_len = haystack.end - haystack.start | 0;
1248
+ const needle_len = needle.end - needle.start | 0;
1249
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1250
+ const _p = 0;
1251
+ const _tmp = needle.str;
1252
+ const _tmp$2 = needle.start + _p | 0;
1253
+ const needle_first = _tmp.charCodeAt(_tmp$2);
1254
+ let i = haystack_len - needle_len | 0;
1255
+ while (true) if (i >= 0) {
1256
+ while (true) {
1257
+ let _tmp$3;
1258
+ if (i >= 0) {
1259
+ const _p$2 = i;
1260
+ const _tmp$4 = haystack.str;
1261
+ const _tmp$5 = haystack.start + _p$2 | 0;
1262
+ _tmp$3 = _tmp$4.charCodeAt(_tmp$5) !== needle_first;
1263
+ } else _tmp$3 = false;
1264
+ if (_tmp$3) {
1265
+ i = i - 1 | 0;
1266
+ continue;
1267
+ } else break;
1268
+ }
1269
+ if (i >= 0) {
1270
+ let _tmp$3 = 1;
1271
+ while (true) {
1272
+ const j = _tmp$3;
1273
+ if (j < needle_len) {
1274
+ const _p$2 = i + j | 0;
1275
+ const _tmp$4 = haystack.str;
1276
+ const _tmp$5 = haystack.start + _p$2 | 0;
1277
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5);
1278
+ const _tmp$7 = needle.str;
1279
+ const _tmp$8 = needle.start + j | 0;
1280
+ if (_tmp$6 !== _tmp$7.charCodeAt(_tmp$8)) break;
1281
+ _tmp$3 = j + 1 | 0;
1282
+ continue;
1283
+ } else return i;
1284
+ }
1285
+ i = i - 1 | 0;
1286
+ }
1287
+ continue;
1288
+ } else break;
1289
+ return;
1290
+ } else return;
1291
+ else return haystack_len;
1292
+ }
1293
+ function moonbitlang$core$string$$StringView$rev_find(self, str) {
1294
+ return (str.end - str.start | 0) <= 4 ? moonbitlang$core$builtin$$brute_force_rev_find(self, str) : moonbitlang$core$builtin$$boyer_moore_horspool_rev_find(self, str);
1295
+ }
1296
+ function moonbitlang$core$string$$StringView$view$46$inner(self, start_offset, end_offset) {
1297
+ let end_offset$2;
1298
+ if (end_offset === void 0) end_offset$2 = self.end - self.start | 0;
1299
+ else end_offset$2 = end_offset;
1300
+ return start_offset >= 0 && start_offset <= end_offset$2 && end_offset$2 <= (self.end - self.start | 0) ? {
1301
+ str: self.str,
1302
+ start: self.start + start_offset | 0,
1303
+ end: self.start + end_offset$2 | 0
1304
+ } : moonbitlang$core$builtin$$abort$3$("Invalid index for View", "@moonbitlang/core/builtin:stringview.mbt:111:5-111:36");
1305
+ }
1306
+ function moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(view) {
1307
+ const _bind = moonbitlang$core$string$$StringView$find(view, {
1308
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5354,
1309
+ start: 0,
1310
+ end: 1
1311
+ });
1312
+ if (_bind === void 0) return;
1313
+ else {
1314
+ const _i = _bind;
1315
+ return _i > 0 && (_i + 1 | 0) < (view.end - view.start | 0) ? {
1316
+ _0: moonbitlang$core$string$$StringView$view$46$inner(view, 0, _i),
1317
+ _1: moonbitlang$core$string$$StringView$view$46$inner(view, _i + 1 | 0, void 0)
1318
+ } : void 0;
1319
+ }
1320
+ }
1321
+ function moonbitlang$core$builtin$$SourceLocRepr$parse(repr) {
1322
+ _L: if (moonbitlang$core$string$$String$char_length_ge$46$inner(repr, 1, 0, repr.length)) if (repr.charCodeAt(0) === 64) {
1323
+ const _bind = moonbitlang$core$string$$String$offset_of_nth_char$46$inner(repr, 1, 0, repr.length);
1324
+ let _tmp;
1325
+ if (_bind === void 0) _tmp = repr.length;
1326
+ else _tmp = _bind;
1327
+ const _x$2 = {
1328
+ str: repr,
1329
+ start: _tmp,
1330
+ end: repr.length
1331
+ };
1332
+ const _bind$2 = moonbitlang$core$string$$StringView$find(_x$2, {
1333
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5393,
1334
+ start: 0,
1335
+ end: 1
1336
+ });
1337
+ if (_bind$2 === void 0) return $panic();
1338
+ else {
1339
+ const _pkg_end = _bind$2;
1340
+ const pkg = moonbitlang$core$string$$StringView$view$46$inner(_x$2, 0, _pkg_end);
1341
+ const _bind$3 = moonbitlang$core$string$$StringView$rev_find(_x$2, {
1342
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5387,
1343
+ start: 0,
1344
+ end: 1
1345
+ });
1346
+ if (_bind$3 === void 0) return $panic();
1347
+ else {
1348
+ const _start_loc_end = _bind$3;
1349
+ if ((_start_loc_end + 1 | 0) < (_x$2.end - _x$2.start | 0)) {
1350
+ const _bind$4 = moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(moonbitlang$core$string$$StringView$view$46$inner(_x$2, _start_loc_end + 1 | 0, void 0));
1351
+ if (_bind$4 === void 0) return $panic();
1352
+ else {
1353
+ const _x$3 = _bind$4;
1354
+ const _end_line = _x$3._0;
1355
+ const _end_column = _x$3._1;
1356
+ const rest = moonbitlang$core$string$$StringView$view$46$inner(_x$2, 0, _start_loc_end);
1357
+ _L$2: {
1358
+ const _bind$5 = moonbitlang$core$string$$StringView$rev_find(rest, {
1359
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5374,
1360
+ start: 0,
1361
+ end: 1
1362
+ });
1363
+ if (_bind$5 === void 0) break _L$2;
1364
+ else {
1365
+ const _bind$6 = moonbitlang$core$string$$StringView$rev_find(moonbitlang$core$string$$StringView$view$46$inner(rest, 0, _bind$5), {
1366
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5368,
1367
+ start: 0,
1368
+ end: 1
1369
+ });
1370
+ if (_bind$6 === void 0) break _L$2;
1371
+ else {
1372
+ const _filename_end = _bind$6;
1373
+ if ((_filename_end + 1 | 0) < (rest.end - rest.start | 0)) {
1374
+ const _bind$7 = moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(moonbitlang$core$string$$StringView$view$46$inner(rest, _filename_end + 1 | 0, void 0));
1375
+ if (_bind$7 === void 0) return $panic();
1376
+ else {
1377
+ const _x$4 = _bind$7;
1378
+ const _start_line = _x$4._0;
1379
+ const _start_column = _x$4._1;
1380
+ if (_filename_end > (_pkg_end + 1 | 0)) return {
1381
+ pkg,
1382
+ filename: moonbitlang$core$string$$StringView$view$46$inner(rest, _pkg_end + 1 | 0, _filename_end),
1383
+ start_line: _start_line,
1384
+ start_column: _start_column,
1385
+ end_line: _end_line,
1386
+ end_column: _end_column
1387
+ };
1388
+ else return $panic();
1389
+ }
1390
+ } else return $panic();
1391
+ }
1392
+ }
1393
+ }
1394
+ return $panic();
1395
+ }
1396
+ } else return $panic();
1397
+ }
1398
+ }
1399
+ } else break _L;
1400
+ else break _L;
1401
+ return $panic();
1402
+ }
1403
+ function moonbitlang$core$builtin$$StringBuilder$write_object$2$(self, obj) {
1404
+ moonbitlang$core$builtin$$Show$output$2$(obj, {
1405
+ self,
1406
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1407
+ });
1408
+ }
1409
+ function moonbitlang$core$builtin$$Logger$write_string$0$(self, str) {
1410
+ const _bind = self;
1411
+ _bind.val = `${_bind.val}${str}`;
1412
+ }
1413
+ function moonbitlang$core$builtin$$Compare$op_lt$9$(x, y) {
1414
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) < 0;
1415
+ }
1416
+ function moonbitlang$core$builtin$$Compare$op_gt$9$(x, y) {
1417
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) > 0;
1418
+ }
1419
+ function moonbitlang$core$builtin$$Compare$op_le$9$(x, y) {
1420
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) <= 0;
1421
+ }
1422
+ function moonbitlang$core$builtin$$Compare$op_ge$9$(x, y) {
1423
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) >= 0;
1424
+ }
1425
+ function moonbitlang$core$string$$String$sub$46$inner(self, start, end) {
1426
+ const len = self.length;
1427
+ let end$2;
1428
+ if (end === void 0) end$2 = len;
1429
+ else {
1430
+ const _end = end;
1431
+ end$2 = _end < 0 ? len + _end | 0 : _end;
1432
+ }
1433
+ const start$2 = start < 0 ? len + start | 0 : start;
1434
+ if (start$2 >= 0 && start$2 <= end$2 && end$2 <= len) {
1435
+ let _tmp;
1436
+ if (start$2 < len) {
1437
+ const _p = self.charCodeAt(start$2);
1438
+ _tmp = 56320 <= _p && _p <= 57343;
1439
+ } else _tmp = false;
1440
+ if (_tmp) return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
1441
+ let _tmp$2;
1442
+ if (end$2 < len) {
1443
+ const _p = self.charCodeAt(end$2);
1444
+ _tmp$2 = 56320 <= _p && _p <= 57343;
1445
+ } else _tmp$2 = false;
1446
+ if (_tmp$2) return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
1447
+ return new Result$Ok$1$({
1448
+ str: self,
1449
+ start: start$2,
1450
+ end: end$2
1451
+ });
1452
+ } else return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds);
1453
+ }
1454
+ function moonbitlang$core$builtin$$Logger$write_substring$1$(self, value, start, len) {
1455
+ let _tmp;
1456
+ _L: {
1457
+ _L$2: {
1458
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(value, start, start + len | 0);
1459
+ if (_bind.$tag === 1) _tmp = _bind._0;
1460
+ else {
1461
+ _bind._0;
1462
+ break _L$2;
1463
+ }
1464
+ break _L;
1465
+ }
1466
+ _tmp = $panic();
1467
+ }
1468
+ moonbitlang$core$builtin$$Logger$write_view$0$(self, _tmp);
1469
+ }
1470
+ function moonbitlang$core$builtin$$Show$to_string$9$(self) {
1471
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1472
+ moonbitlang$core$builtin$$Show$output$8$(self, {
1473
+ self: logger,
1474
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1475
+ });
1476
+ return logger.val;
1477
+ }
1478
+ function moonbitlang$core$builtin$$Show$to_string$7$(self) {
1479
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1480
+ moonbitlang$core$builtin$$Show$output$10$(self, {
1481
+ self: logger,
1482
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1483
+ });
1484
+ return logger.val;
1485
+ }
1486
+ function moonbitlang$core$int$$Int$to_string$46$inner(self, radix) {
1487
+ return moonbitlang$core$builtin$$int_to_string_js(self, radix);
1488
+ }
1489
+ function moonbitlang$core$uint$$UInt$to_string$46$inner(self, radix) {
1490
+ return moonbitlang$core$builtin$$uint_to_string_js(self, radix);
1491
+ }
1492
+ function moonbitlang$core$uint64$$UInt64$to_string$46$inner(self, radix) {
1493
+ return moonbitlang$core$builtin$$uint64_to_string_js(self, radix);
1494
+ }
1495
+ function moonbitlang$core$builtin$$Show$to_string$3$(self) {
1496
+ return self.str.substring(self.start, self.end);
1497
+ }
1498
+ function moonbitlang$core$builtin$$Iterator$next$11$(self) {
1499
+ return self();
1500
+ }
1501
+ function moonbitlang$core$builtin$$Iterator$next$12$(self) {
1502
+ return self();
1503
+ }
1504
+ function moonbitlang$core$builtin$$Iterator$next$3$(self) {
1505
+ return self();
1506
+ }
1507
+ function moonbitlang$core$builtin$$Iterator$iter$11$(self) {
1508
+ return (yield_) => {
1509
+ while (true) {
1510
+ const _bind = moonbitlang$core$builtin$$Iterator$next$11$(self);
1511
+ if (_bind === void 0) return 1;
1512
+ else {
1513
+ if (yield_(_bind) === 1) {} else return 0;
1514
+ continue;
1515
+ }
1516
+ }
1517
+ };
1518
+ }
1519
+ function moonbitlang$core$builtin$$Iterator$iter$12$(self) {
1520
+ return (yield_) => {
1521
+ while (true) {
1522
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(self);
1523
+ if (_bind === -1) return 1;
1524
+ else {
1525
+ if (yield_(_bind) === 1) {} else return 0;
1526
+ continue;
1527
+ }
1528
+ }
1529
+ };
1530
+ }
1531
+ function moonbitlang$core$builtin$$Iterator$iter$3$(self) {
1532
+ return (yield_) => {
1533
+ while (true) {
1534
+ const _bind = moonbitlang$core$builtin$$Iterator$next$3$(self);
1535
+ if (_bind === void 0) return 1;
1536
+ else {
1537
+ if (yield_(_bind) === 1) {} else return 0;
1538
+ continue;
1539
+ }
1540
+ }
1541
+ };
1542
+ }
1543
+ function moonbitlang$core$string$$StringView$iterator(self) {
1544
+ const start = self.start;
1545
+ const end = self.end;
1546
+ const index = { val: start };
1547
+ const _p = () => {
1548
+ if (index.val < end) {
1549
+ const _tmp = self.str;
1550
+ const _tmp$2 = index.val;
1551
+ const c1 = _tmp.charCodeAt(_tmp$2);
1552
+ if (55296 <= c1 && c1 <= 56319 && (index.val + 1 | 0) < self.end) {
1553
+ const _tmp$3 = self.str;
1554
+ const _tmp$4 = index.val + 1 | 0;
1555
+ const c2 = _tmp$3.charCodeAt(_tmp$4);
1556
+ if (56320 <= c2 && c2 <= 57343) {
1557
+ index.val = index.val + 2 | 0;
1558
+ return moonbitlang$core$builtin$$code_point_of_surrogate_pair(c1, c2);
1559
+ }
1560
+ }
1561
+ index.val = index.val + 1 | 0;
1562
+ return c1;
1563
+ } else return -1;
1564
+ };
1565
+ return _p;
1566
+ }
1567
+ function moonbitlang$core$string$$StringView$iter(self) {
1568
+ return moonbitlang$core$builtin$$Iterator$iter$12$(moonbitlang$core$string$$StringView$iterator(self));
1569
+ }
1570
+ function moonbitlang$core$string$$String$view$46$inner(self, start_offset, end_offset) {
1571
+ let end_offset$2;
1572
+ if (end_offset === void 0) end_offset$2 = self.length;
1573
+ else end_offset$2 = end_offset;
1574
+ return start_offset >= 0 && start_offset <= end_offset$2 && end_offset$2 <= self.length ? {
1575
+ str: self,
1576
+ start: start_offset,
1577
+ end: end_offset$2
1578
+ } : moonbitlang$core$builtin$$abort$3$("Invalid index for View", "@moonbitlang/core/builtin:stringview.mbt:374:5-374:36");
1579
+ }
1580
+ function moonbitlang$core$string$$String$char_length_ge$46$inner(self, len, start_offset, end_offset) {
1581
+ let end_offset$2;
1582
+ if (end_offset === void 0) end_offset$2 = self.length;
1583
+ else end_offset$2 = end_offset;
1584
+ let _tmp = start_offset;
1585
+ let _tmp$2 = 0;
1586
+ while (true) {
1587
+ const index = _tmp;
1588
+ const count = _tmp$2;
1589
+ if (index < end_offset$2 && count < len) {
1590
+ const c1 = self.charCodeAt(index);
1591
+ if (55296 <= c1 && c1 <= 56319 && (index + 1 | 0) < end_offset$2) {
1592
+ const _tmp$3 = index + 1 | 0;
1593
+ const c2 = self.charCodeAt(_tmp$3);
1594
+ if (56320 <= c2 && c2 <= 57343) {
1595
+ _tmp = index + 2 | 0;
1596
+ _tmp$2 = count + 1 | 0;
1597
+ continue;
1598
+ } else moonbitlang$core$builtin$$abort$4$("invalid surrogate pair", "@moonbitlang/core/builtin:string.mbt:491:9-491:40");
1599
+ }
1600
+ _tmp = index + 1 | 0;
1601
+ _tmp$2 = count + 1 | 0;
1602
+ continue;
1603
+ } else return count >= len;
1604
+ }
1605
+ }
1606
+ function moonbitlang$core$string$$String$offset_of_nth_char_backward(self, n, start_offset, end_offset) {
1607
+ let char_count = 0;
1608
+ let utf16_offset = end_offset;
1609
+ while (true) if ((utf16_offset - 1 | 0) >= start_offset && char_count < n) {
1610
+ const _tmp = utf16_offset - 1 | 0;
1611
+ const c = self.charCodeAt(_tmp);
1612
+ if (56320 <= c && c <= 57343) utf16_offset = utf16_offset - 2 | 0;
1613
+ else utf16_offset = utf16_offset - 1 | 0;
1614
+ char_count = char_count + 1 | 0;
1615
+ continue;
1616
+ } else break;
1617
+ return char_count < n || utf16_offset < start_offset ? void 0 : utf16_offset;
1618
+ }
1619
+ function moonbitlang$core$string$$String$offset_of_nth_char_forward(self, n, start_offset, end_offset) {
1620
+ if (start_offset >= 0 && start_offset <= end_offset) {
1621
+ let utf16_offset = start_offset;
1622
+ let char_count = 0;
1623
+ while (true) if (utf16_offset < end_offset && char_count < n) {
1624
+ const _tmp = utf16_offset;
1625
+ const c = self.charCodeAt(_tmp);
1626
+ if (55296 <= c && c <= 56319) utf16_offset = utf16_offset + 2 | 0;
1627
+ else utf16_offset = utf16_offset + 1 | 0;
1628
+ char_count = char_count + 1 | 0;
1629
+ continue;
1630
+ } else break;
1631
+ return char_count < n || utf16_offset >= end_offset ? void 0 : utf16_offset;
1632
+ } else return moonbitlang$core$builtin$$abort$5$("Invalid start index", "@moonbitlang/core/builtin:string.mbt:366:5-366:33");
1633
+ }
1634
+ function moonbitlang$core$string$$String$offset_of_nth_char$46$inner(self, i, start_offset, end_offset) {
1635
+ let end_offset$2;
1636
+ if (end_offset === void 0) end_offset$2 = self.length;
1637
+ else end_offset$2 = end_offset;
1638
+ return i >= 0 ? moonbitlang$core$string$$String$offset_of_nth_char_forward(self, i, start_offset, end_offset$2) : moonbitlang$core$string$$String$offset_of_nth_char_backward(self, -i | 0, start_offset, end_offset$2);
1639
+ }
1640
+ function moonbitlang$core$builtin$$StringBuilder$write_iter(self, iter) {
1641
+ iter((ch) => {
1642
+ moonbitlang$core$builtin$$Logger$write_char$0$(self, ch);
1643
+ return 1;
1644
+ });
1645
+ }
1646
+ function moonbitlang$core$builtin$$Logger$write_view$0$(self, str) {
1647
+ const _bind = self;
1648
+ _bind.val = `${_bind.val}${moonbitlang$core$builtin$$Show$to_string$3$(str)}`;
1649
+ }
1650
+ function moonbitlang$core$string$$String$find(self, str) {
1651
+ return moonbitlang$core$string$$StringView$find({
1652
+ str: self,
1653
+ start: 0,
1654
+ end: self.length
1655
+ }, str);
1656
+ }
1657
+ function moonbitlang$core$string$$StringView$has_suffix(self, str) {
1658
+ const _bind = moonbitlang$core$string$$StringView$rev_find(self, str);
1659
+ if (_bind === void 0) return false;
1660
+ else return _bind === ((self.end - self.start | 0) - (str.end - str.start | 0) | 0);
1661
+ }
1662
+ function moonbitlang$core$string$$String$has_suffix(self, str) {
1663
+ return moonbitlang$core$string$$StringView$has_suffix({
1664
+ str: self,
1665
+ start: 0,
1666
+ end: self.length
1667
+ }, str);
1668
+ }
1669
+ function moonbitlang$core$string$$StringView$has_prefix(self, str) {
1670
+ const _bind = moonbitlang$core$string$$StringView$find(self, str);
1671
+ if (_bind === void 0) return false;
1672
+ else return _bind === 0;
1673
+ }
1674
+ function moonbitlang$core$string$$String$has_prefix(self, str) {
1675
+ return moonbitlang$core$string$$StringView$has_prefix({
1676
+ str: self,
1677
+ start: 0,
1678
+ end: self.length
1679
+ }, str);
1680
+ }
1681
+ function moonbitlang$core$array$$Array$push$11$(self, value) {
1682
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1683
+ }
1684
+ function moonbitlang$core$array$$Array$push$13$(self, value) {
1685
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1686
+ }
1687
+ function moonbitlang$core$array$$Array$push$3$(self, value) {
1688
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1689
+ }
1690
+ function moonbitlang$core$string$$String$iterator(self) {
1691
+ const len = self.length;
1692
+ const index = { val: 0 };
1693
+ const _p = () => {
1694
+ if (index.val < len) {
1695
+ const _tmp = index.val;
1696
+ const c1 = self.charCodeAt(_tmp);
1697
+ if (55296 <= c1 && c1 <= 56319 && (index.val + 1 | 0) < len) {
1698
+ const _tmp$2 = index.val + 1 | 0;
1699
+ const c2 = self.charCodeAt(_tmp$2);
1700
+ if (56320 <= c2 && c2 <= 57343) {
1701
+ const c = moonbitlang$core$builtin$$code_point_of_surrogate_pair(c1, c2);
1702
+ index.val = index.val + 2 | 0;
1703
+ return c;
1704
+ }
1705
+ }
1706
+ index.val = index.val + 1 | 0;
1707
+ return c1;
1708
+ } else return -1;
1709
+ };
1710
+ return _p;
1711
+ }
1712
+ function moonbitlang$core$builtin$$Iter$run$11$(self, f) {
1713
+ return self(f);
1714
+ }
1715
+ function moonbitlang$core$builtin$$Show$to_string$12$(self) {
1716
+ return String.fromCodePoint(self);
1717
+ }
1718
+ function moonbitlang$core$string$$StringView$split(self, sep) {
1719
+ const sep_len = sep.end - sep.start | 0;
1720
+ if (sep_len === 0) {
1721
+ const _bind = moonbitlang$core$string$$StringView$iter(self);
1722
+ return (_p$1) => _bind((_p$2) => _p$1(moonbitlang$core$string$$String$view$46$inner(moonbitlang$core$builtin$$Show$to_string$12$(_p$2), 0, void 0)));
1723
+ }
1724
+ const remaining = { val: self };
1725
+ const _p = () => {
1726
+ const _bind = remaining.val;
1727
+ if (_bind === void 0) return;
1728
+ else {
1729
+ const _view = _bind;
1730
+ const _bind$2 = moonbitlang$core$string$$StringView$find(_view, sep);
1731
+ if (_bind$2 === void 0) {
1732
+ remaining.val = void 0;
1733
+ return _view;
1734
+ } else {
1735
+ const _end = _bind$2;
1736
+ remaining.val = moonbitlang$core$string$$StringView$view$46$inner(_view, _end + sep_len | 0, void 0);
1737
+ return moonbitlang$core$string$$StringView$view$46$inner(_view, 0, _end);
1738
+ }
1739
+ }
1740
+ };
1741
+ return moonbitlang$core$builtin$$Iterator$iter$3$(_p);
1742
+ }
1743
+ function moonbitlang$core$string$$String$split(self, sep) {
1744
+ return moonbitlang$core$string$$StringView$split({
1745
+ str: self,
1746
+ start: 0,
1747
+ end: self.length
1748
+ }, sep);
1749
+ }
1750
+ function moonbitlang$core$builtin$$Iter$each$14$(self, f) {
1751
+ const _foreach_result = { val: $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Continue$2$ };
1752
+ self((a) => {
1753
+ f(a);
1754
+ return 1;
1755
+ });
1756
+ const _tmp = _foreach_result.val;
1757
+ switch (_tmp.$tag) {
1758
+ case 0: return;
1759
+ case 1:
1760
+ _tmp._0;
1761
+ return;
1762
+ case 2: return _tmp._0;
1763
+ case 3:
1764
+ $panic();
1765
+ return;
1766
+ default:
1767
+ $panic();
1768
+ return;
1769
+ }
1770
+ }
1771
+ function moonbitlang$core$builtin$$Iter$collect$3$(self) {
1772
+ const result = [];
1773
+ moonbitlang$core$builtin$$Iter$each$14$(self, (e) => {
1774
+ moonbitlang$core$array$$Array$push$3$(result, e);
1775
+ });
1776
+ return result;
1777
+ }
1778
+ function moonbitlang$core$string$$String$replace(self, old, new_) {
1779
+ const _bind = moonbitlang$core$string$$String$find(self, old);
1780
+ if (_bind === void 0) return self;
1781
+ else {
1782
+ const _end = _bind;
1783
+ const _self = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1784
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(moonbitlang$core$string$$String$view$46$inner(self, 0, _end)));
1785
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(new_));
1786
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(moonbitlang$core$string$$String$view$46$inner(self, _end + (old.end - old.start | 0) | 0, void 0)));
1787
+ return _self.val;
1788
+ }
1789
+ }
1790
+ function moonbitlang$core$builtin$$Show$output$2$(self, logger) {
1791
+ logger.method_table.method_0(logger.self, moonbitlang$core$int$$Int$to_string$46$inner(self, 10));
1792
+ }
1793
+ function moonbitlang$core$builtin$$Show$output$8$(self, logger) {
1794
+ logger.method_table.method_0(logger.self, moonbitlang$core$uint64$$UInt64$to_string$46$inner(self, 10));
1795
+ }
1796
+ function moonbitlang$core$array$$ArrayView$iterator$11$(self) {
1797
+ const i = { val: 0 };
1798
+ const _p = () => {
1799
+ if (i.val < (self.end - self.start | 0)) {
1800
+ const elem = self.buf[self.start + i.val | 0];
1801
+ i.val = i.val + 1 | 0;
1802
+ return elem;
1803
+ } else return;
1804
+ };
1805
+ return _p;
1806
+ }
1807
+ function moonbitlang$core$array$$Array$iterator$11$(self) {
1808
+ return moonbitlang$core$array$$ArrayView$iterator$11$({
1809
+ buf: self,
1810
+ start: 0,
1811
+ end: self.length
1812
+ });
1813
+ }
1814
+ function moonbitlang$core$array$$Array$iter$11$(self) {
1815
+ return moonbitlang$core$builtin$$Iterator$iter$11$(moonbitlang$core$array$$Array$iterator$11$(self));
1816
+ }
1817
+ function moonbitlang$core$builtin$$MyInt64$extend_i32_u(value) {
1818
+ return {
1819
+ hi: 0,
1820
+ lo: value
1821
+ };
1822
+ }
1823
+ function moonbitlang$core$uint64$$UInt64$extend_uint(value) {
1824
+ return moonbitlang$core$builtin$$MyInt64$extend_i32_u(value);
1825
+ }
1826
+ function moonbitlang$core$uint$$UInt$to_uint64(self) {
1827
+ return moonbitlang$core$uint64$$UInt64$extend_uint(self);
1828
+ }
1829
+ function moonbitlang$core$builtin$$Iter$any$11$(self, f) {
1830
+ return moonbitlang$core$builtin$$op_notequal$6$(moonbitlang$core$builtin$$Iter$run$11$(self, (k) => f(k) ? 0 : 1), 1);
1831
+ }
1832
+ function moonbitlang$core$uint64$$UInt64$to_int(self) {
1833
+ return self.lo;
1834
+ }
1835
+ function moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, bhi, blo) {
1836
+ const _ahi = self.hi;
1837
+ const _alo = self.lo;
1838
+ const lo = _alo + blo | 0;
1839
+ const s = lo >> 31;
1840
+ const as_ = _alo >> 31;
1841
+ const bs = blo >> 31;
1842
+ const c = (as_ & bs | ~s & (as_ ^ bs)) & 1;
1843
+ return {
1844
+ hi: (_ahi + bhi | 0) + c | 0,
1845
+ lo
1846
+ };
1847
+ }
1848
+ function moonbitlang$core$builtin$$Add$add$15$(self, other) {
1849
+ return moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, other.hi, other.lo);
1850
+ }
1851
+ function moonbitlang$core$builtin$$Sub$sub$15$(self, other) {
1852
+ return other.lo === 0 ? {
1853
+ hi: self.hi - other.hi | 0,
1854
+ lo: self.lo
1855
+ } : moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, ~other.hi, ~other.lo + 1 | 0);
1856
+ }
1857
+ function moonbitlang$core$builtin$$Mul$mul$15$(self, other) {
1858
+ const _ahi = self.hi;
1859
+ const _alo = self.lo;
1860
+ const _bhi = other.hi;
1861
+ const _blo = other.lo;
1862
+ const ahi = _ahi;
1863
+ const alo = _alo;
1864
+ const bhi = _bhi;
1865
+ const blo = _blo;
1866
+ const a48 = ahi >>> 16 | 0;
1867
+ const a32 = ahi & 65535;
1868
+ const a16 = alo >>> 16 | 0;
1869
+ const a00 = alo & 65535;
1870
+ const b48 = bhi >>> 16 | 0;
1871
+ const b32 = bhi & 65535;
1872
+ const b16 = blo >>> 16 | 0;
1873
+ const b00 = blo & 65535;
1874
+ const c00 = Math.imul(a00, b00) | 0;
1875
+ const c16 = c00 >>> 16 | 0;
1876
+ const c00$2 = c00 & 65535;
1877
+ const c16$2 = (c16 >>> 0) + ((Math.imul(a16, b00) | 0) >>> 0) | 0;
1878
+ const c32 = c16$2 >>> 16 | 0;
1879
+ const c16$4 = ((c16$2 & 65535) >>> 0) + ((Math.imul(a00, b16) | 0) >>> 0) | 0;
1880
+ const c32$2 = (c32 >>> 0) + ((c16$4 >>> 16 | 0) >>> 0) | 0;
1881
+ const c16$5 = c16$4 & 65535;
1882
+ const c32$3 = (c32$2 >>> 0) + ((Math.imul(a32, b00) | 0) >>> 0) | 0;
1883
+ const c48 = c32$3 >>> 16 | 0;
1884
+ const c32$5 = ((c32$3 & 65535) >>> 0) + ((Math.imul(a16, b16) | 0) >>> 0) | 0;
1885
+ const c48$2 = (c48 >>> 0) + ((c32$5 >>> 16 | 0) >>> 0) | 0;
1886
+ const c32$7 = ((c32$5 & 65535) >>> 0) + ((Math.imul(a00, b32) | 0) >>> 0) | 0;
1887
+ const c48$3 = (c48$2 >>> 0) + ((c32$7 >>> 16 | 0) >>> 0) | 0;
1888
+ const c32$8 = c32$7 & 65535;
1889
+ return {
1890
+ hi: (((((((((c48$3 >>> 0) + ((Math.imul(a48, b00) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a32, b16) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a16, b32) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a00, b48) | 0) >>> 0) | 0) & 65535) << 16 | c32$8,
1891
+ lo: c16$5 << 16 | c00$2
1892
+ };
1893
+ }
1894
+ function moonbitlang$core$builtin$$try_get_int64_wasm_helper() {
1895
+ if (moonbitlang$core$builtin$$wasm_helper_cache.tried) return !(moonbitlang$core$builtin$$wasm_helper_cache.exports === void 0);
1896
+ moonbitlang$core$builtin$$wasm_helper_cache.tried = true;
1897
+ moonbitlang$core$builtin$$wasm_helper_cache.exports = moonbitlang$core$builtin$$try_init_wasm_helper();
1898
+ return !(moonbitlang$core$builtin$$wasm_helper_cache.exports === void 0);
1899
+ }
1900
+ function moonbitlang$core$builtin$$MyInt64$div_u(self, other) {
1901
+ if (!(other.hi === 0 && other.lo === 0)) {
1902
+ if (!moonbitlang$core$builtin$$try_get_int64_wasm_helper()) return moonbitlang$core$builtin$$MyInt64$div_u_bigint(self, other);
1903
+ const _bind = moonbitlang$core$builtin$$wasm_helper_cache.exports;
1904
+ if (_bind === void 0) return $panic();
1905
+ else {
1906
+ const _exports = _bind;
1907
+ const _ahi = self.hi;
1908
+ const _alo = self.lo;
1909
+ const _bhi = other.hi;
1910
+ const _blo = other.lo;
1911
+ const _func = _exports.div_u;
1912
+ const lo = _func(_alo, _ahi, _blo, _bhi);
1913
+ const _func$2 = _exports.get_high;
1914
+ return {
1915
+ hi: _func$2(),
1916
+ lo
1917
+ };
1918
+ }
1919
+ } else return $panic();
1920
+ }
1921
+ function moonbitlang$core$builtin$$MyInt64$mod_u(self, other) {
1922
+ if (!(other.hi === 0 && other.lo === 0)) {
1923
+ if (!moonbitlang$core$builtin$$try_get_int64_wasm_helper()) return moonbitlang$core$builtin$$MyInt64$mod_u_bigint(self, other);
1924
+ const _bind = moonbitlang$core$builtin$$wasm_helper_cache.exports;
1925
+ if (_bind === void 0) return $panic();
1926
+ else {
1927
+ const _exports = _bind;
1928
+ const _ahi = self.hi;
1929
+ const _alo = self.lo;
1930
+ const _bhi = other.hi;
1931
+ const _blo = other.lo;
1932
+ const _func = _exports.rem_u;
1933
+ const lo = _func(_alo, _ahi, _blo, _bhi);
1934
+ const _func$2 = _exports.get_high;
1935
+ return {
1936
+ hi: _func$2(),
1937
+ lo
1938
+ };
1939
+ }
1940
+ } else return $panic();
1941
+ }
1942
+ function moonbitlang$core$builtin$$MyInt64$land(self, other) {
1943
+ return {
1944
+ hi: self.hi & other.hi,
1945
+ lo: self.lo & other.lo
1946
+ };
1947
+ }
1948
+ function moonbitlang$core$builtin$$MyInt64$lor(self, other) {
1949
+ return {
1950
+ hi: self.hi | other.hi,
1951
+ lo: self.lo | other.lo
1952
+ };
1953
+ }
1954
+ function moonbitlang$core$builtin$$MyInt64$lsl(self, shift) {
1955
+ const shift$2 = shift & 63;
1956
+ if (shift$2 === 0) return self;
1957
+ else if (shift$2 < 32) {
1958
+ const _hi = self.hi;
1959
+ const _lo = self.lo;
1960
+ const hi = _hi;
1961
+ const lo = _lo;
1962
+ return {
1963
+ hi: hi << shift$2 | (lo >>> (32 - shift$2 | 0) | 0),
1964
+ lo: lo << shift$2
1965
+ };
1966
+ } else return {
1967
+ hi: self.lo << (shift$2 - 32 | 0),
1968
+ lo: 0
1969
+ };
1970
+ }
1971
+ function moonbitlang$core$builtin$$MyInt64$lsr(self, shift) {
1972
+ const shift$2 = shift & 63;
1973
+ return shift$2 === 0 ? self : shift$2 < 32 ? {
1974
+ hi: self.hi >>> shift$2 | 0,
1975
+ lo: self.lo >>> shift$2 | self.hi << (32 - shift$2 | 0)
1976
+ } : {
1977
+ hi: 0,
1978
+ lo: self.hi >>> (shift$2 - 32 | 0) | 0
1979
+ };
1980
+ }
1981
+ function moonbitlang$core$double$$Double$reinterpret_as_uint64(self) {
1982
+ return moonbitlang$core$builtin$$MyInt64$reinterpret_double(self);
1983
+ }
1984
+ function moonbitlang$core$builtin$$Add$add$8$(self, other) {
1985
+ return moonbitlang$core$builtin$$Add$add$15$(self, other);
1986
+ }
1987
+ function moonbitlang$core$builtin$$Sub$sub$8$(self, other) {
1988
+ return moonbitlang$core$builtin$$Sub$sub$15$(self, other);
1989
+ }
1990
+ function moonbitlang$core$builtin$$Mul$mul$8$(self, other) {
1991
+ return moonbitlang$core$builtin$$Mul$mul$15$(self, other);
1992
+ }
1993
+ function moonbitlang$core$builtin$$Div$div$8$(self, other) {
1994
+ return moonbitlang$core$builtin$$MyInt64$div_u(self, other);
1995
+ }
1996
+ function moonbitlang$core$builtin$$Mod$mod$8$(self, other) {
1997
+ return moonbitlang$core$builtin$$MyInt64$mod_u(self, other);
1998
+ }
1999
+ function moonbitlang$core$builtin$$Compare$compare$8$(self, other) {
2000
+ return moonbitlang$core$builtin$$MyInt64$compare_u(self, other);
2001
+ }
2002
+ function moonbitlang$core$builtin$$Eq$equal$8$(self, other) {
2003
+ const _p = self;
2004
+ const _p$2 = other;
2005
+ return _p.hi === _p$2.hi && _p.lo === _p$2.lo;
2006
+ }
2007
+ function moonbitlang$core$builtin$$BitAnd$land$8$(self, other) {
2008
+ return moonbitlang$core$builtin$$MyInt64$land(self, other);
2009
+ }
2010
+ function moonbitlang$core$builtin$$BitOr$lor$8$(self, other) {
2011
+ return moonbitlang$core$builtin$$MyInt64$lor(self, other);
2012
+ }
2013
+ function moonbitlang$core$builtin$$Shl$shl$8$(self, shift) {
2014
+ return moonbitlang$core$builtin$$MyInt64$lsl(self, shift);
2015
+ }
2016
+ function moonbitlang$core$builtin$$Shr$shr$8$(self, shift) {
2017
+ return moonbitlang$core$builtin$$MyInt64$lsr(self, shift);
2018
+ }
2019
+ function moonbitlang$core$double$$Double$to_int(self) {
2020
+ return self !== self ? 0 : self >= 2147483647 ? 2147483647 : self <= -2147483648 ? -2147483648 : self | 0;
2021
+ }
2022
+ function moonbitlang$core$builtin$$Show$output$16$(self, logger) {
2023
+ const pkg = self.pkg;
2024
+ const _bind = moonbitlang$core$string$$StringView$find(pkg, {
2025
+ str: moonbitlang$core$builtin$$output$46$42$bind$124$8198,
2026
+ start: 0,
2027
+ end: 1
2028
+ });
2029
+ let _bind$2;
2030
+ if (_bind === void 0) _bind$2 = {
2031
+ _0: pkg,
2032
+ _1: void 0
2033
+ };
2034
+ else {
2035
+ const _first_slash = _bind;
2036
+ const _bind$3 = moonbitlang$core$string$$StringView$find(moonbitlang$core$string$$StringView$view$46$inner(pkg, _first_slash + 1 | 0, void 0), {
2037
+ str: moonbitlang$core$builtin$$output$46$42$bind$124$8192,
2038
+ start: 0,
2039
+ end: 1
2040
+ });
2041
+ if (_bind$3 === void 0) _bind$2 = {
2042
+ _0: pkg,
2043
+ _1: void 0
2044
+ };
2045
+ else {
2046
+ const _second_slash = _bind$3;
2047
+ const module_name_end = (_first_slash + 1 | 0) + _second_slash | 0;
2048
+ _bind$2 = {
2049
+ _0: moonbitlang$core$string$$StringView$view$46$inner(pkg, 0, module_name_end),
2050
+ _1: moonbitlang$core$string$$StringView$view$46$inner(pkg, module_name_end + 1 | 0, void 0)
2051
+ };
2052
+ }
2053
+ }
2054
+ const _module_name = _bind$2._0;
2055
+ const _package_name = _bind$2._1;
2056
+ if (_package_name === void 0) {} else {
2057
+ const _pkg_name = _package_name;
2058
+ logger.method_table.method_2(logger.self, _pkg_name);
2059
+ logger.method_table.method_3(logger.self, 47);
2060
+ }
2061
+ logger.method_table.method_2(logger.self, self.filename);
2062
+ logger.method_table.method_3(logger.self, 58);
2063
+ logger.method_table.method_2(logger.self, self.start_line);
2064
+ logger.method_table.method_3(logger.self, 58);
2065
+ logger.method_table.method_2(logger.self, self.start_column);
2066
+ logger.method_table.method_3(logger.self, 45);
2067
+ logger.method_table.method_2(logger.self, self.end_line);
2068
+ logger.method_table.method_3(logger.self, 58);
2069
+ logger.method_table.method_2(logger.self, self.end_column);
2070
+ logger.method_table.method_3(logger.self, 64);
2071
+ logger.method_table.method_2(logger.self, _module_name);
2072
+ }
2073
+ function moonbitlang$core$builtin$$Show$output$10$(self, logger) {
2074
+ moonbitlang$core$builtin$$Show$output$16$(moonbitlang$core$builtin$$SourceLocRepr$parse(self), logger);
2075
+ }
2076
+ function moonbitlang$core$double$internal$ryu$$copy_special_str(sign, exponent, mantissa) {
2077
+ if (mantissa) return "NaN";
2078
+ const s = sign ? "-" : "";
2079
+ if (exponent) return `${s}Infinity`;
2080
+ return `${s}0.0`;
2081
+ }
2082
+ function moonbitlang$core$double$internal$ryu$$string_from_bytes(bytes, from, to) {
2083
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(bytes.length);
2084
+ let _tmp = from;
2085
+ while (true) {
2086
+ const i = _tmp;
2087
+ if (i < to) {
2088
+ $bound_check(bytes, i);
2089
+ const _p = bytes[i];
2090
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _p);
2091
+ _tmp = i + 1 | 0;
2092
+ continue;
2093
+ } else break;
2094
+ }
2095
+ return buf.val;
2096
+ }
2097
+ function moonbitlang$core$double$internal$ryu$$umul128(a, b) {
2098
+ const aLo = moonbitlang$core$builtin$$BitAnd$land$8$(a, $4294967295L);
2099
+ const aHi = moonbitlang$core$builtin$$Shr$shr$8$(a, 32);
2100
+ const bLo = moonbitlang$core$builtin$$BitAnd$land$8$(b, $4294967295L);
2101
+ const bHi = moonbitlang$core$builtin$$Shr$shr$8$(b, 32);
2102
+ const x = moonbitlang$core$builtin$$Mul$mul$8$(aLo, bLo);
2103
+ const y = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aHi, bLo), moonbitlang$core$builtin$$Shr$shr$8$(x, 32));
2104
+ const z = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aLo, bHi), moonbitlang$core$builtin$$BitAnd$land$8$(y, $4294967295L));
2105
+ const w = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aHi, bHi), moonbitlang$core$builtin$$Shr$shr$8$(y, 32)), moonbitlang$core$builtin$$Shr$shr$8$(z, 32));
2106
+ return {
2107
+ _0: moonbitlang$core$builtin$$Mul$mul$8$(a, b),
2108
+ _1: w
2109
+ };
2110
+ }
2111
+ function moonbitlang$core$double$internal$ryu$$shiftright128(lo, hi, dist) {
2112
+ return moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$(hi, 64 - dist | 0), moonbitlang$core$builtin$$Shr$shr$8$(lo, dist));
2113
+ }
2114
+ function moonbitlang$core$double$internal$ryu$$pow5Factor(value) {
2115
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $5L), $0L)) return 0;
2116
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $25L), $0L)) return 1;
2117
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $125L), $0L)) return 2;
2118
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $625L), $0L)) return 3;
2119
+ let count = 4;
2120
+ let value$2 = moonbitlang$core$builtin$$Div$div$8$(value, $625L);
2121
+ while (true) if (moonbitlang$core$builtin$$Compare$op_gt$9$(value$2, $0L)) {
2122
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value$2, $5L), $0L)) return count;
2123
+ value$2 = moonbitlang$core$builtin$$Div$div$8$(value$2, $5L);
2124
+ count = count + 1 | 0;
2125
+ continue;
2126
+ } else break;
2127
+ return moonbitlang$core$builtin$$abort$2$(`IllegalArgumentException ${moonbitlang$core$builtin$$Show$to_string$9$(value$2)}`, "@moonbitlang/core/double/internal/ryu:ryu.mbt:116:3-116:45");
2128
+ }
2129
+ function moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(value, p) {
2130
+ return moonbitlang$core$double$internal$ryu$$pow5Factor(value) >= p;
2131
+ }
2132
+ function moonbitlang$core$double$internal$ryu$$multipleOfPowerOf2(value, p) {
2133
+ return moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(value, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, p), $1L)), $0L);
2134
+ }
2135
+ function moonbitlang$core$double$internal$ryu$$mulShiftAll64(m, mul, j, mmShift) {
2136
+ const _mul0 = mul._0;
2137
+ const _mul1 = mul._1;
2138
+ const m$2 = moonbitlang$core$builtin$$Shl$shl$8$(m, 1);
2139
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m$2, _mul0);
2140
+ const _lo = _bind._0;
2141
+ const _tmp = _bind._1;
2142
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m$2, _mul1);
2143
+ const _lo2 = _bind$2._0;
2144
+ const _hi2 = _bind$2._1;
2145
+ const mid = moonbitlang$core$builtin$$Add$add$8$(_tmp, _lo2);
2146
+ const hi = moonbitlang$core$builtin$$Add$add$8$(_hi2, moonbitlang$core$builtin$$Compare$op_lt$9$(mid, _tmp) ? $1L : $0L);
2147
+ const lo2 = moonbitlang$core$builtin$$Add$add$8$(_lo, _mul0);
2148
+ const mid2 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(mid, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(lo2, _lo) ? $1L : $0L);
2149
+ const vp = moonbitlang$core$double$internal$ryu$$shiftright128(mid2, moonbitlang$core$builtin$$Add$add$8$(hi, moonbitlang$core$builtin$$Compare$op_lt$9$(mid2, mid) ? $1L : $0L), (j - 64 | 0) - 1 | 0);
2150
+ let vm = $0L;
2151
+ if (mmShift) {
2152
+ const lo3 = moonbitlang$core$builtin$$Sub$sub$8$(_lo, _mul0);
2153
+ const mid3 = moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mid, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(_lo, lo3) ? $1L : $0L);
2154
+ vm = moonbitlang$core$double$internal$ryu$$shiftright128(mid3, moonbitlang$core$builtin$$Sub$sub$8$(hi, moonbitlang$core$builtin$$Compare$op_lt$9$(mid, mid3) ? $1L : $0L), (j - 64 | 0) - 1 | 0);
2155
+ } else {
2156
+ const lo3 = moonbitlang$core$builtin$$Add$add$8$(_lo, _lo);
2157
+ const mid3 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(mid, mid), moonbitlang$core$builtin$$Compare$op_lt$9$(lo3, _lo) ? $1L : $0L);
2158
+ const hi3 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(hi, hi), moonbitlang$core$builtin$$Compare$op_lt$9$(mid3, mid) ? $1L : $0L);
2159
+ const lo4 = moonbitlang$core$builtin$$Sub$sub$8$(lo3, _mul0);
2160
+ const mid4 = moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mid3, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(lo3, lo4) ? $1L : $0L);
2161
+ vm = moonbitlang$core$double$internal$ryu$$shiftright128(mid4, moonbitlang$core$builtin$$Sub$sub$8$(hi3, moonbitlang$core$builtin$$Compare$op_lt$9$(mid3, mid4) ? $1L : $0L), j - 64 | 0);
2162
+ }
2163
+ return {
2164
+ _0: moonbitlang$core$double$internal$ryu$$shiftright128(mid, hi, (j - 64 | 0) - 1 | 0),
2165
+ _1: vp,
2166
+ _2: vm
2167
+ };
2168
+ }
2169
+ function moonbitlang$core$double$internal$ryu$$double_computePow5(i) {
2170
+ const base = i / 26 | 0;
2171
+ const base2 = Math.imul(base, 26) | 0;
2172
+ const offset = i - base2 | 0;
2173
+ const _p = Math.imul(base, 2) | 0;
2174
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2, _p);
2175
+ const mul0 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2[_p];
2176
+ const _p$2 = (Math.imul(base, 2) | 0) + 1 | 0;
2177
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2, _p$2);
2178
+ const mul1 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2[_p$2];
2179
+ if (offset === 0) return {
2180
+ _0: mul0,
2181
+ _1: mul1
2182
+ };
2183
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE, offset);
2184
+ const m = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE[offset];
2185
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m, mul1);
2186
+ const _low1 = _bind._0;
2187
+ const _high1 = _bind._1;
2188
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m, mul0);
2189
+ const _low0 = _bind$2._0;
2190
+ const _high0 = _bind$2._1;
2191
+ const sum = moonbitlang$core$builtin$$Add$add$8$(_high0, _low1);
2192
+ let high1 = _high1;
2193
+ if (moonbitlang$core$builtin$$Compare$op_lt$9$(sum, _high0)) high1 = moonbitlang$core$builtin$$Add$add$8$(high1, $1L);
2194
+ const delta = (((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) - (((Math.imul(base2, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0;
2195
+ const _tmp = moonbitlang$core$double$internal$ryu$$shiftright128(_low0, sum, delta);
2196
+ const _p$3 = i / 16 | 0;
2197
+ $bound_check(moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS, _p$3);
2198
+ return {
2199
+ _0: moonbitlang$core$builtin$$Add$add$8$(_tmp, moonbitlang$core$uint$$UInt$to_uint64(moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS[_p$3] >>> (i % 16 << 1) & 3)),
2200
+ _1: moonbitlang$core$double$internal$ryu$$shiftright128(sum, high1, delta)
2201
+ };
2202
+ }
2203
+ function moonbitlang$core$double$internal$ryu$$double_computeInvPow5(i) {
2204
+ const base = ((i + 26 | 0) - 1 | 0) / 26 | 0;
2205
+ const base2 = Math.imul(base, 26) | 0;
2206
+ const offset = base2 - i | 0;
2207
+ const _p = Math.imul(base, 2) | 0;
2208
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2, _p);
2209
+ const mul0 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2[_p];
2210
+ const _p$2 = (Math.imul(base, 2) | 0) + 1 | 0;
2211
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2, _p$2);
2212
+ const mul1 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2[_p$2];
2213
+ if (offset === 0) return {
2214
+ _0: mul0,
2215
+ _1: mul1
2216
+ };
2217
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE, offset);
2218
+ const m = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE[offset];
2219
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m, mul1);
2220
+ const _low1 = _bind._0;
2221
+ const _high1 = _bind._1;
2222
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m, mul0);
2223
+ const _low0 = _bind$2._0;
2224
+ const _high0 = _bind$2._1;
2225
+ const sum = moonbitlang$core$builtin$$Add$add$8$(_high0, _low1);
2226
+ let high1 = _high1;
2227
+ if (moonbitlang$core$builtin$$Compare$op_lt$9$(sum, _high0)) high1 = moonbitlang$core$builtin$$Add$add$8$(high1, $1L);
2228
+ const delta = (((Math.imul(base2, 1217359) | 0) >>> 19 | 0) + 1 | 0) - (((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0;
2229
+ const _tmp = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$double$internal$ryu$$shiftright128(_low0, sum, delta), $1L);
2230
+ const _p$3 = i / 16 | 0;
2231
+ $bound_check(moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS, _p$3);
2232
+ return {
2233
+ _0: moonbitlang$core$builtin$$Add$add$8$(_tmp, moonbitlang$core$uint$$UInt$to_uint64(moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS[_p$3] >>> (i % 16 << 1) & 3)),
2234
+ _1: moonbitlang$core$double$internal$ryu$$shiftright128(sum, high1, delta)
2235
+ };
2236
+ }
2237
+ function moonbitlang$core$double$internal$ryu$$decimal_length17(v) {
2238
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000000000L)) return 17;
2239
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000000000L)) return 16;
2240
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000000000L)) return 15;
2241
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000000L)) return 14;
2242
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000000L)) return 13;
2243
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000000L)) return 12;
2244
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000L)) return 11;
2245
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000L)) return 10;
2246
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000L)) return 9;
2247
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000L)) return 8;
2248
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000L)) return 7;
2249
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000L)) return 6;
2250
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000L)) return 5;
2251
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000L)) return 4;
2252
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100L)) return 3;
2253
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10L)) return 2;
2254
+ return 1;
2255
+ }
2256
+ function moonbitlang$core$double$internal$ryu$$d2d(ieeeMantissa, ieeeExponent) {
2257
+ let e2 = 0;
2258
+ let m2 = $0L;
2259
+ if (ieeeExponent === 0) {
2260
+ e2 = -1076;
2261
+ m2 = ieeeMantissa;
2262
+ } else {
2263
+ e2 = ((ieeeExponent - 1023 | 0) - 52 | 0) - 2 | 0;
2264
+ m2 = moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), ieeeMantissa);
2265
+ }
2266
+ const even = moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(m2, $1L), $0L);
2267
+ const mv = moonbitlang$core$builtin$$Mul$mul$8$($4L, m2);
2268
+ const mmShift = moonbitlang$core$builtin$$op_notequal$8$(ieeeMantissa, $0L) || ieeeExponent >>> 0 <= 1;
2269
+ let vr = $0L;
2270
+ let vp = $0L;
2271
+ let vm = $0L;
2272
+ let e10 = 0;
2273
+ let vmIsTrailingZeros = false;
2274
+ let vrIsTrailingZeros = false;
2275
+ if (e2 >= 0) {
2276
+ const _p = e2;
2277
+ const q = ((Math.imul(_p, 78913) | 0) >>> 18 | 0) - (e2 > 3 ? 1 : 0) | 0;
2278
+ e10 = q;
2279
+ const k = (125 + (((Math.imul(q, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0) - 1 | 0;
2280
+ const i = ((-e2 | 0) + q | 0) + k | 0;
2281
+ const pow5 = moonbitlang$core$double$internal$ryu$$double_computeInvPow5(q);
2282
+ const _bind = moonbitlang$core$double$internal$ryu$$mulShiftAll64(m2, pow5, i, mmShift);
2283
+ const _vrOut = _bind._0;
2284
+ const _vpOut = _bind._1;
2285
+ const _vmOut = _bind._2;
2286
+ vr = _vrOut;
2287
+ vp = _vpOut;
2288
+ vm = _vmOut;
2289
+ if (q <= 21) if ((moonbitlang$core$uint64$$UInt64$to_int(mv) - (Math.imul(5, moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Div$div$8$(mv, $5L))) | 0) | 0) === 0) vrIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(mv, q);
2290
+ else if (even) vmIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mv, $1L), mmShift ? $1L : $0L), q);
2291
+ else vp = moonbitlang$core$builtin$$Sub$sub$8$(vp, moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(moonbitlang$core$builtin$$Add$add$8$(mv, $2L), q) ? $1L : $0L);
2292
+ } else {
2293
+ const _p = -e2 | 0;
2294
+ const q = ((Math.imul(_p, 732923) | 0) >>> 20 | 0) - ((-e2 | 0) > 1 ? 1 : 0) | 0;
2295
+ e10 = q + e2 | 0;
2296
+ const i = (-e2 | 0) - q | 0;
2297
+ const j = q - ((((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) - 125 | 0) | 0;
2298
+ const pow5 = moonbitlang$core$double$internal$ryu$$double_computePow5(i);
2299
+ const _bind = moonbitlang$core$double$internal$ryu$$mulShiftAll64(m2, pow5, j, mmShift);
2300
+ const _vrOut = _bind._0;
2301
+ const _vpOut = _bind._1;
2302
+ const _vmOut = _bind._2;
2303
+ vr = _vrOut;
2304
+ vp = _vpOut;
2305
+ vm = _vmOut;
2306
+ if (q <= 1) {
2307
+ vrIsTrailingZeros = true;
2308
+ if (even) vmIsTrailingZeros = (mmShift ? 1 : 0) === 1;
2309
+ else vp = moonbitlang$core$builtin$$Sub$sub$8$(vp, $1L);
2310
+ } else if (q < 63) vrIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf2(mv, q);
2311
+ }
2312
+ let removed = 0;
2313
+ let lastRemovedDigit = 0;
2314
+ let output = $0L;
2315
+ if (vmIsTrailingZeros || vrIsTrailingZeros) {
2316
+ while (true) {
2317
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2318
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2319
+ if (moonbitlang$core$builtin$$Compare$op_le$9$(vpDiv10, vmDiv10)) break;
2320
+ const vmMod10 = moonbitlang$core$uint64$$UInt64$to_int(vm) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vmDiv10)) | 0) | 0;
2321
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2322
+ const vrMod10 = moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0;
2323
+ vmIsTrailingZeros = vmIsTrailingZeros && vmMod10 === 0;
2324
+ vrIsTrailingZeros = vrIsTrailingZeros && lastRemovedDigit === 0;
2325
+ lastRemovedDigit = vrMod10;
2326
+ vr = vrDiv10;
2327
+ vp = vpDiv10;
2328
+ vm = vmDiv10;
2329
+ removed = removed + 1 | 0;
2330
+ continue;
2331
+ }
2332
+ if (vmIsTrailingZeros) while (true) {
2333
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2334
+ if ((moonbitlang$core$uint64$$UInt64$to_int(vm) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vmDiv10)) | 0) | 0) !== 0) break;
2335
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2336
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2337
+ const vrMod10 = moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0;
2338
+ vrIsTrailingZeros = vrIsTrailingZeros && lastRemovedDigit === 0;
2339
+ lastRemovedDigit = vrMod10;
2340
+ vr = vrDiv10;
2341
+ vp = vpDiv10;
2342
+ vm = vmDiv10;
2343
+ removed = removed + 1 | 0;
2344
+ continue;
2345
+ }
2346
+ if (vrIsTrailingZeros && lastRemovedDigit === 5 && moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$Mod$mod$8$(vr, $2L), $0L)) lastRemovedDigit = 4;
2347
+ output = moonbitlang$core$builtin$$Add$add$8$(vr, moonbitlang$core$builtin$$Eq$equal$8$(vr, vm) && (!even || !vmIsTrailingZeros) || lastRemovedDigit >= 5 ? $1L : $0L);
2348
+ } else {
2349
+ let roundUp = false;
2350
+ const vpDiv100 = moonbitlang$core$builtin$$Div$div$8$(vp, $100L);
2351
+ const vmDiv100 = moonbitlang$core$builtin$$Div$div$8$(vm, $100L);
2352
+ if (moonbitlang$core$builtin$$Compare$op_gt$9$(vpDiv100, vmDiv100)) {
2353
+ const vrDiv100 = moonbitlang$core$builtin$$Div$div$8$(vr, $100L);
2354
+ roundUp = (moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(100, moonbitlang$core$uint64$$UInt64$to_int(vrDiv100)) | 0) | 0) >= 50;
2355
+ vr = vrDiv100;
2356
+ vp = vpDiv100;
2357
+ vm = vmDiv100;
2358
+ removed = removed + 2 | 0;
2359
+ }
2360
+ while (true) {
2361
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2362
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2363
+ if (moonbitlang$core$builtin$$Compare$op_le$9$(vpDiv10, vmDiv10)) break;
2364
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2365
+ roundUp = (moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0) >= 5;
2366
+ vr = vrDiv10;
2367
+ vp = vpDiv10;
2368
+ vm = vmDiv10;
2369
+ removed = removed + 1 | 0;
2370
+ continue;
2371
+ }
2372
+ output = moonbitlang$core$builtin$$Add$add$8$(vr, moonbitlang$core$builtin$$Eq$equal$8$(vr, vm) || roundUp ? $1L : $0L);
2373
+ }
2374
+ const exp = e10 + removed | 0;
2375
+ return {
2376
+ mantissa: output,
2377
+ exponent: exp
2378
+ };
2379
+ }
2380
+ function moonbitlang$core$double$internal$ryu$$to_chars(v, sign) {
2381
+ const result = $makebytes(25, 0);
2382
+ let index = 0;
2383
+ if (sign) {
2384
+ const _tmp = index;
2385
+ $bound_check(result, _tmp);
2386
+ result[_tmp] = 45;
2387
+ index = index + 1 | 0;
2388
+ }
2389
+ let output = v.mantissa;
2390
+ const olength = moonbitlang$core$double$internal$ryu$$decimal_length17(output);
2391
+ let exp = (v.exponent + olength | 0) - 1 | 0;
2392
+ if (!(exp >= -6 && exp < 21)) {
2393
+ const _end41 = olength - 1 | 0;
2394
+ let _tmp = 0;
2395
+ while (true) {
2396
+ const i = _tmp;
2397
+ if (i < _end41) {
2398
+ const c = moonbitlang$core$builtin$$Mod$mod$8$(output, $10L);
2399
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2400
+ const _tmp$2$1 = (index + olength | 0) - i | 0;
2401
+ $bound_check(result, _tmp$2$1);
2402
+ result[_tmp$2$1] = (48 + moonbitlang$core$uint64$$UInt64$to_int(c) | 0) & 255;
2403
+ _tmp = i + 1 | 0;
2404
+ continue;
2405
+ } else break;
2406
+ }
2407
+ const _tmp$2 = index;
2408
+ $bound_check(result, _tmp$2);
2409
+ result[_tmp$2] = (48 + (moonbitlang$core$uint64$$UInt64$to_int(output) % 10 | 0) | 0) & 255;
2410
+ if (olength > 1) {
2411
+ const _tmp$3$1 = index + 1 | 0;
2412
+ $bound_check(result, _tmp$3$1);
2413
+ result[_tmp$3$1] = 46;
2414
+ } else index = index - 1 | 0;
2415
+ index = index + (olength + 1 | 0) | 0;
2416
+ const _tmp$3 = index;
2417
+ $bound_check(result, _tmp$3);
2418
+ result[_tmp$3] = 101;
2419
+ index = index + 1 | 0;
2420
+ if (exp < 0) {
2421
+ const _tmp$4 = index;
2422
+ $bound_check(result, _tmp$4);
2423
+ result[_tmp$4] = 45;
2424
+ index = index + 1 | 0;
2425
+ exp = -exp | 0;
2426
+ } else {
2427
+ const _tmp$4 = index;
2428
+ $bound_check(result, _tmp$4);
2429
+ result[_tmp$4] = 43;
2430
+ index = index + 1 | 0;
2431
+ }
2432
+ if (exp >= 100) {
2433
+ const a = exp / 100 | 0;
2434
+ const b = (exp / 10 | 0) % 10 | 0;
2435
+ const c = exp % 10 | 0;
2436
+ const _tmp$4 = index;
2437
+ $bound_check(result, _tmp$4);
2438
+ result[_tmp$4] = (48 + a | 0) & 255;
2439
+ const _tmp$5 = index + 1 | 0;
2440
+ $bound_check(result, _tmp$5);
2441
+ result[_tmp$5] = (48 + b | 0) & 255;
2442
+ const _tmp$6 = index + 2 | 0;
2443
+ $bound_check(result, _tmp$6);
2444
+ result[_tmp$6] = (48 + c | 0) & 255;
2445
+ index = index + 3 | 0;
2446
+ } else if (exp >= 10) {
2447
+ const a = exp / 10 | 0;
2448
+ const b = exp % 10 | 0;
2449
+ const _tmp$4 = index;
2450
+ $bound_check(result, _tmp$4);
2451
+ result[_tmp$4] = (48 + a | 0) & 255;
2452
+ const _tmp$5 = index + 1 | 0;
2453
+ $bound_check(result, _tmp$5);
2454
+ result[_tmp$5] = (48 + b | 0) & 255;
2455
+ index = index + 2 | 0;
2456
+ } else {
2457
+ const _tmp$4 = index;
2458
+ $bound_check(result, _tmp$4);
2459
+ result[_tmp$4] = (48 + exp | 0) & 255;
2460
+ index = index + 1 | 0;
2461
+ }
2462
+ return moonbitlang$core$double$internal$ryu$$string_from_bytes(result, 0, index);
2463
+ } else {
2464
+ if (exp < 0) {
2465
+ const _tmp = index;
2466
+ $bound_check(result, _tmp);
2467
+ result[_tmp] = 48;
2468
+ index = index + 1 | 0;
2469
+ const _tmp$2 = index;
2470
+ $bound_check(result, _tmp$2);
2471
+ result[_tmp$2] = 46;
2472
+ index = index + 1 | 0;
2473
+ let _tmp$3 = -1;
2474
+ while (true) {
2475
+ const i = _tmp$3;
2476
+ if (i > exp) {
2477
+ const _tmp$4$1 = index;
2478
+ $bound_check(result, _tmp$4$1);
2479
+ result[_tmp$4$1] = 48;
2480
+ index = index + 1 | 0;
2481
+ _tmp$3 = i - 1 | 0;
2482
+ continue;
2483
+ } else break;
2484
+ }
2485
+ const current = index;
2486
+ let _tmp$4 = 0;
2487
+ while (true) {
2488
+ const i = _tmp$4;
2489
+ if (i < olength) {
2490
+ const _tmp$5 = ((current + olength | 0) - i | 0) - 1 | 0;
2491
+ $bound_check(result, _tmp$5);
2492
+ result[_tmp$5] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2493
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2494
+ index = index + 1 | 0;
2495
+ _tmp$4 = i + 1 | 0;
2496
+ continue;
2497
+ } else break;
2498
+ }
2499
+ } else if ((exp + 1 | 0) >= olength) {
2500
+ let _tmp = 0;
2501
+ while (true) {
2502
+ const i = _tmp;
2503
+ if (i < olength) {
2504
+ const _tmp$2$1 = ((index + olength | 0) - i | 0) - 1 | 0;
2505
+ $bound_check(result, _tmp$2$1);
2506
+ result[_tmp$2$1] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2507
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2508
+ _tmp = i + 1 | 0;
2509
+ continue;
2510
+ } else break;
2511
+ }
2512
+ index = index + olength | 0;
2513
+ const _end64 = exp + 1 | 0;
2514
+ let _tmp$2 = olength;
2515
+ while (true) {
2516
+ const i = _tmp$2;
2517
+ if (i < _end64) {
2518
+ const _tmp$3 = index;
2519
+ $bound_check(result, _tmp$3);
2520
+ result[_tmp$3] = 48;
2521
+ index = index + 1 | 0;
2522
+ _tmp$2 = i + 1 | 0;
2523
+ continue;
2524
+ } else break;
2525
+ }
2526
+ } else {
2527
+ let current = index + 1 | 0;
2528
+ let _tmp = 0;
2529
+ while (true) {
2530
+ const i = _tmp;
2531
+ if (i < olength) {
2532
+ if (((olength - i | 0) - 1 | 0) === exp) {
2533
+ const _tmp$2$1 = ((current + olength | 0) - i | 0) - 1 | 0;
2534
+ $bound_check(result, _tmp$2$1);
2535
+ result[_tmp$2$1] = 46;
2536
+ current = current - 1 | 0;
2537
+ }
2538
+ const _tmp$2 = ((current + olength | 0) - i | 0) - 1 | 0;
2539
+ $bound_check(result, _tmp$2);
2540
+ result[_tmp$2] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2541
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2542
+ _tmp = i + 1 | 0;
2543
+ continue;
2544
+ } else break;
2545
+ }
2546
+ index = index + (olength + 1 | 0) | 0;
2547
+ }
2548
+ return moonbitlang$core$double$internal$ryu$$string_from_bytes(result, 0, index);
2549
+ }
2550
+ }
2551
+ function moonbitlang$core$double$internal$ryu$$d2d_small_int(ieeeMantissa, ieeeExponent) {
2552
+ const m2 = moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), ieeeMantissa);
2553
+ const e2 = (ieeeExponent - 1023 | 0) - 52 | 0;
2554
+ if (e2 > 0) return;
2555
+ if (e2 < -52) return;
2556
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(m2, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, -e2 | 0), $1L)), $0L)) return;
2557
+ return {
2558
+ mantissa: moonbitlang$core$builtin$$Shr$shr$8$(m2, -e2 | 0),
2559
+ exponent: 0
2560
+ };
2561
+ }
2562
+ function moonbitlang$core$double$internal$ryu$$ryu_to_string(val) {
2563
+ if (val === 0) return "0";
2564
+ const bits = moonbitlang$core$double$$Double$reinterpret_as_uint64(val);
2565
+ const ieeeSign = moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(moonbitlang$core$builtin$$Shr$shr$8$(bits, 63), $1L), $0L);
2566
+ const ieeeMantissa = moonbitlang$core$builtin$$BitAnd$land$8$(bits, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), $1L));
2567
+ const ieeeExponent = moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$BitAnd$land$8$(moonbitlang$core$builtin$$Shr$shr$8$(bits, 52), moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 11), $1L)));
2568
+ if (ieeeExponent === 2047 || ieeeExponent === 0 && moonbitlang$core$builtin$$Eq$equal$8$(ieeeMantissa, $0L)) return moonbitlang$core$double$internal$ryu$$copy_special_str(ieeeSign, ieeeExponent !== 0, moonbitlang$core$builtin$$op_notequal$8$(ieeeMantissa, $0L));
2569
+ let v = moonbitlang$core$double$internal$ryu$$ryu_to_string$46$record$47$728;
2570
+ const small = moonbitlang$core$double$internal$ryu$$d2d_small_int(ieeeMantissa, ieeeExponent);
2571
+ if (small === void 0) v = moonbitlang$core$double$internal$ryu$$d2d(ieeeMantissa, ieeeExponent);
2572
+ else {
2573
+ let x = small;
2574
+ while (true) {
2575
+ const q = moonbitlang$core$builtin$$Div$div$8$(x.mantissa, $10L);
2576
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Sub$sub$8$(x.mantissa, moonbitlang$core$builtin$$Mul$mul$8$($10L, q)), $0L)) break;
2577
+ x = {
2578
+ mantissa: q,
2579
+ exponent: x.exponent + 1 | 0
2580
+ };
2581
+ continue;
2582
+ }
2583
+ v = x;
2584
+ }
2585
+ return moonbitlang$core$double$internal$ryu$$to_chars(v, ieeeSign);
2586
+ }
2587
+ function moonbitlang$core$double$$Double$to_string(self) {
2588
+ return moonbitlang$core$double$internal$ryu$$ryu_to_string(self);
2589
+ }
2590
+ function mizchi$luna$luna$signal$$Signal$get$17$(self) {
2591
+ const _bind = mizchi$luna$luna$signal$$reactive_context.current_subscriber;
2592
+ if (_bind === void 0) {} else {
2593
+ const _subscriber = _bind;
2594
+ if (!moonbitlang$core$builtin$$Iter$any$11$(moonbitlang$core$array$$Array$iter$11$(self.subscribers), (s) => s.id === _subscriber.id)) moonbitlang$core$array$$Array$push$11$(self.subscribers, _subscriber);
2595
+ }
2596
+ return self.value;
2597
+ }
2598
+ function mizchi$luna$luna$signal$$Signal$get$18$(self) {
2599
+ const _bind = mizchi$luna$luna$signal$$reactive_context.current_subscriber;
2600
+ if (_bind === void 0) {} else {
2601
+ const _subscriber = _bind;
2602
+ if (!moonbitlang$core$builtin$$Iter$any$11$(moonbitlang$core$array$$Array$iter$11$(self.subscribers), (s) => s.id === _subscriber.id)) moonbitlang$core$array$$Array$push$11$(self.subscribers, _subscriber);
2603
+ }
2604
+ return self.value;
2605
+ }
2606
+ function mizchi$luna$luna$signal$$Signal$new$17$(initial) {
2607
+ return {
2608
+ value: initial,
2609
+ subscribers: []
2610
+ };
2611
+ }
2612
+ function mizchi$luna$luna$signal$$Signal$new$18$(initial) {
2613
+ return {
2614
+ value: initial,
2615
+ subscribers: []
2616
+ };
2617
+ }
2618
+ function mizchi$luna$luna$signal$$signal$17$(initial) {
2619
+ return mizchi$luna$luna$signal$$Signal$new$17$(initial);
2620
+ }
2621
+ function mizchi$luna$luna$signal$$signal$18$(initial) {
2622
+ return mizchi$luna$luna$signal$$Signal$new$18$(initial);
2623
+ }
2624
+ function mizchi$luna$luna$$handler$4$(f) {
2625
+ return { callback: f };
2626
+ }
2627
+ function mizchi$luna$luna$$h$4$(tag, attrs, children) {
2628
+ return new $64$mizchi$47$luna$47$luna$46$Node$Element$3$({
2629
+ tag,
2630
+ attrs,
2631
+ children
2632
+ });
2633
+ }
2634
+ function mizchi$luna$luna$$TriggerType$to_string(self) {
2635
+ switch (self.$tag) {
2636
+ case 0: return "load";
2637
+ case 1: return "idle";
2638
+ case 2: return "visible";
2639
+ case 3: return `media:${self._0}`;
2640
+ default: return "none";
2641
+ }
2642
+ }
2643
+ function mizchi$luna$luna$$event_handler() {
2644
+ return { callback: (_discard_) => {} };
2645
+ }
2646
+ function mizchi$luna$internal$utils$$extract_wc_name_from_url(url) {
2647
+ const parts = moonbitlang$core$builtin$$Iter$collect$3$(moonbitlang$core$string$$String$split(url, {
2648
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$39,
2649
+ start: 0,
2650
+ end: 1
2651
+ }));
2652
+ const filename = moonbitlang$core$builtin$$Show$to_string$3$(parts.length > 0 ? moonbitlang$core$array$$Array$at$3$(parts, parts.length - 1 | 0) : moonbitlang$core$string$$String$view$46$inner("", 0, void 0));
2653
+ let name;
2654
+ if (moonbitlang$core$string$$String$has_suffix(filename, {
2655
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$35,
2656
+ start: 0,
2657
+ end: 3
2658
+ }) && filename.length > 3) _L: {
2659
+ _L$2: {
2660
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(filename, 0, filename.length - 3 | 0);
2661
+ let _tmp;
2662
+ if (_bind.$tag === 1) _tmp = _bind._0;
2663
+ else {
2664
+ _bind._0;
2665
+ break _L$2;
2666
+ }
2667
+ name = moonbitlang$core$builtin$$Show$to_string$3$(_tmp);
2668
+ break _L;
2669
+ }
2670
+ name = filename;
2671
+ }
2672
+ else name = filename;
2673
+ return moonbitlang$core$string$$String$replace(name, {
2674
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$33,
2675
+ start: 0,
2676
+ end: 1
2677
+ }, {
2678
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$34,
2679
+ start: 0,
2680
+ end: 1
2681
+ });
2682
+ }
2683
+ function mizchi$luna$luna$render$$escape_html_to_internal(sb, s) {
2684
+ const len = s.length;
2685
+ if (len === 0) return;
2686
+ let start = 0;
2687
+ let i = 0;
2688
+ const _it = moonbitlang$core$string$$String$iterator(s);
2689
+ while (true) {
2690
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2691
+ if (_bind === -1) break;
2692
+ else {
2693
+ const code = _bind;
2694
+ let escape_seq;
2695
+ switch (code) {
2696
+ case 38:
2697
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$780;
2698
+ break;
2699
+ case 60:
2700
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$781;
2701
+ break;
2702
+ case 62:
2703
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$782;
2704
+ break;
2705
+ case 34:
2706
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$783;
2707
+ break;
2708
+ case 39:
2709
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$784;
2710
+ break;
2711
+ default: escape_seq = void 0;
2712
+ }
2713
+ if (escape_seq === void 0) {} else {
2714
+ const _seq = escape_seq;
2715
+ if (i > start) moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, i));
2716
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _seq);
2717
+ start = i + 1 | 0;
2718
+ }
2719
+ i = i + 1 | 0;
2720
+ continue;
2721
+ }
2722
+ }
2723
+ if (start < len) if (start === 0) {
2724
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s);
2725
+ return;
2726
+ } else {
2727
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, len));
2728
+ return;
2729
+ }
2730
+ else return;
2731
+ }
2732
+ function mizchi$luna$luna$render$$escape_html_to(sb, s) {
2733
+ mizchi$luna$luna$render$$escape_html_to_internal(sb, s);
2734
+ }
2735
+ function mizchi$luna$luna$render$$is_void_element(tag) {
2736
+ const len = tag.length;
2737
+ if (len < 2 || len > 6) return false;
2738
+ switch (len) {
2739
+ case 2: return tag === "br" || tag === "hr";
2740
+ case 3: return tag === "img" || tag === "col" || tag === "wbr";
2741
+ case 4: return tag === "area" || tag === "base" || tag === "link" || tag === "meta";
2742
+ case 5: return tag === "embed" || tag === "input" || tag === "track" || tag === "param";
2743
+ case 6: return tag === "source" || tag === "keygen";
2744
+ default: return false;
2745
+ }
2746
+ }
2747
+ function mizchi$luna$luna$render$$escape_attr_to_internal(sb, s) {
2748
+ const len = s.length;
2749
+ if (len === 0) return;
2750
+ let start = 0;
2751
+ let i = 0;
2752
+ const _it = moonbitlang$core$string$$String$iterator(s);
2753
+ while (true) {
2754
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2755
+ if (_bind === -1) break;
2756
+ else {
2757
+ const code = _bind;
2758
+ let escape_seq;
2759
+ switch (code) {
2760
+ case 38:
2761
+ escape_seq = mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$803;
2762
+ break;
2763
+ case 34:
2764
+ escape_seq = mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$804;
2765
+ break;
2766
+ default: escape_seq = void 0;
2767
+ }
2768
+ if (escape_seq === void 0) {} else {
2769
+ const _seq = escape_seq;
2770
+ if (i > start) moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, i));
2771
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _seq);
2772
+ start = i + 1 | 0;
2773
+ }
2774
+ i = i + 1 | 0;
2775
+ continue;
2776
+ }
2777
+ }
2778
+ if (start < len) if (start === 0) {
2779
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s);
2780
+ return;
2781
+ } else {
2782
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, len));
2783
+ return;
2784
+ }
2785
+ else return;
2786
+ }
2787
+ function mizchi$luna$luna$render$$escape_attr_to(sb, s) {
2788
+ mizchi$luna$luna$render$$escape_attr_to_internal(sb, s);
2789
+ }
2790
+ function mizchi$luna$luna$render$$render_attr_value(sb, name, s) {
2791
+ switch (s) {
2792
+ case "__remove__": return;
2793
+ case "":
2794
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2795
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2796
+ return;
2797
+ default:
2798
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2799
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2800
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "=\"");
2801
+ mizchi$luna$luna$render$$escape_attr_to(sb, s);
2802
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2803
+ return;
2804
+ }
2805
+ }
2806
+ function mizchi$luna$luna$render$$render_attrs_to$4$(sb, attrs) {
2807
+ const _len = attrs.length;
2808
+ let _tmp = 0;
2809
+ while (true) {
2810
+ const _i = _tmp;
2811
+ if (_i < _len) {
2812
+ const attr = attrs[_i];
2813
+ const _name = attr._0;
2814
+ const _value = attr._1;
2815
+ switch (_value.$tag) {
2816
+ case 0: {
2817
+ const _s = _value._0;
2818
+ mizchi$luna$luna$render$$render_attr_value(sb, _name, _s);
2819
+ break;
2820
+ }
2821
+ case 1: {
2822
+ const _getter = _value._0;
2823
+ mizchi$luna$luna$render$$render_attr_value(sb, _name, _getter());
2824
+ break;
2825
+ }
2826
+ case 2: break;
2827
+ default: {
2828
+ const _action_name = _value._0;
2829
+ let event_name;
2830
+ if (moonbitlang$core$string$$String$has_prefix(_name, {
2831
+ str: mizchi$luna$luna$render$$render_attrs_to$46$42$bind$124$630,
2832
+ start: 0,
2833
+ end: 2
2834
+ })) _L: {
2835
+ _L$2: {
2836
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(_name, 2, void 0);
2837
+ let _tmp$2;
2838
+ if (_bind.$tag === 1) _tmp$2 = _bind._0;
2839
+ else {
2840
+ _bind._0;
2841
+ break _L$2;
2842
+ }
2843
+ event_name = moonbitlang$core$builtin$$Show$to_string$3$(_tmp$2);
2844
+ break _L;
2845
+ }
2846
+ event_name = _name;
2847
+ }
2848
+ else event_name = _name;
2849
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " data-action-");
2850
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, event_name);
2851
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "=\"");
2852
+ mizchi$luna$luna$render$$escape_attr_to(sb, _action_name);
2853
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2854
+ }
2855
+ }
2856
+ _tmp = _i + 1 | 0;
2857
+ continue;
2858
+ } else return;
2859
+ }
2860
+ }
2861
+ function mizchi$luna$luna$render$$write_wc_close_tag(sb, name) {
2862
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</template></");
2863
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2864
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
2865
+ }
2866
+ function mizchi$luna$luna$render$$hash_css(css) {
2867
+ let hash = 5381;
2868
+ const _it = moonbitlang$core$string$$String$iterator(css);
2869
+ while (true) {
2870
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2871
+ if (_bind === -1) break;
2872
+ else {
2873
+ const _c = _bind;
2874
+ hash = (((hash << 5 >>> 0) + (hash >>> 0) | 0) >>> 0) + (_c >>> 0) | 0;
2875
+ continue;
2876
+ }
2877
+ }
2878
+ return moonbitlang$core$uint$$UInt$to_string$46$inner(hash, 10);
2879
+ }
2880
+ function mizchi$luna$luna$render$$minify_css(css) {
2881
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(css.length);
2882
+ let prev_char = 32;
2883
+ let in_space = false;
2884
+ const _it = moonbitlang$core$string$$String$iterator(css);
2885
+ while (true) {
2886
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2887
+ if (_bind === -1) break;
2888
+ else {
2889
+ const _c = _bind;
2890
+ _L: {
2891
+ _L$2: {
2892
+ _L$3: {
2893
+ _L$4: {
2894
+ switch (_c) {
2895
+ case 10: break _L$4;
2896
+ case 13: break _L$4;
2897
+ case 9: break _L$4;
2898
+ case 32:
2899
+ if (!in_space) in_space = true;
2900
+ break;
2901
+ case 123: break _L$2;
2902
+ case 125: break _L$2;
2903
+ case 58: break _L$2;
2904
+ case 59: break _L$2;
2905
+ case 44: break _L$2;
2906
+ default:
2907
+ if (in_space && prev_char !== 123 && prev_char !== 125 && prev_char !== 58 && prev_char !== 59 && prev_char !== 44 && prev_char !== 32) moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2908
+ in_space = false;
2909
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, _c);
2910
+ prev_char = _c;
2911
+ }
2912
+ break _L$3;
2913
+ }
2914
+ if (!in_space) in_space = true;
2915
+ }
2916
+ break _L;
2917
+ }
2918
+ in_space = false;
2919
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, _c);
2920
+ prev_char = _c;
2921
+ }
2922
+ continue;
2923
+ }
2924
+ }
2925
+ return sb.val;
2926
+ }
2927
+ function mizchi$luna$luna$render$$write_style_tag(sb, styles) {
2928
+ if (styles.length > 0) {
2929
+ const minified = mizchi$luna$luna$render$$minify_css(styles);
2930
+ const hash = mizchi$luna$luna$render$$hash_css(minified);
2931
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<style id=\"style-");
2932
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, hash);
2933
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
2934
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, minified);
2935
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</style>");
2936
+ return;
2937
+ } else return;
2938
+ }
2939
+ function mizchi$luna$luna$render$$write_wc_open_tag(sb, name, url, state, trigger, styles) {
2940
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 60);
2941
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2942
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-url=\"");
2943
+ mizchi$luna$luna$render$$escape_attr_to(sb, url);
2944
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2945
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-state=\"");
2946
+ mizchi$luna$luna$render$$escape_attr_to(sb, state);
2947
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2948
+ let _tmp;
2949
+ if (trigger.$tag === 0) _tmp = true;
2950
+ else _tmp = false;
2951
+ if (!_tmp) {
2952
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-trigger=\"");
2953
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(trigger));
2954
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2955
+ }
2956
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
2957
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<template shadowrootmode=\"open\">");
2958
+ mizchi$luna$luna$render$$write_style_tag(sb, styles);
2959
+ }
2960
+ function mizchi$luna$luna$render$$render_island_close_to$4$(sb, island) {
2961
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</div>");
2962
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/luna:island:");
2963
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2964
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
2965
+ }
2966
+ function mizchi$luna$luna$render$$render_island_open_to$4$(sb, island) {
2967
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--luna:island:");
2968
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2969
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " url=");
2970
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.url);
2971
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " trigger=");
2972
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(island.trigger));
2973
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
2974
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<div luna:id=\"");
2975
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2976
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:url=\"");
2977
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.url);
2978
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:state=\"");
2979
+ mizchi$luna$luna$render$$escape_attr_to(sb, island.state);
2980
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:client-trigger=\"");
2981
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(island.trigger));
2982
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
2983
+ }
2984
+ function mizchi$luna$luna$render$$has_dynamic_content$4$(attrs) {
2985
+ const _len = attrs.length;
2986
+ let _tmp = 0;
2987
+ while (true) {
2988
+ const _i = _tmp;
2989
+ if (_i < _len) {
2990
+ const _value = attrs[_i]._1;
2991
+ _L: {
2992
+ _L$2: {
2993
+ switch (_value.$tag) {
2994
+ case 1: break _L$2;
2995
+ case 2: break _L$2;
2996
+ case 3: break _L$2;
2997
+ }
2998
+ break _L;
2999
+ }
3000
+ return true;
3001
+ }
3002
+ _tmp = _i + 1 | 0;
3003
+ continue;
3004
+ } else break;
3005
+ }
3006
+ return false;
3007
+ }
3008
+ function mizchi$luna$luna$render$$render_wc_island_with_id_to$4$(sb, island, id_counter) {
3009
+ const id = id_counter.val;
3010
+ id_counter.val = id + 1 | 0;
3011
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--wc:");
3012
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3013
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3014
+ mizchi$luna$luna$render$$write_wc_open_tag(sb, island.name, island.url, island.state, island.trigger, island.styles);
3015
+ const _arr = island.children;
3016
+ const _len = _arr.length;
3017
+ let _tmp = 0;
3018
+ while (true) {
3019
+ const _i = _tmp;
3020
+ if (_i < _len) {
3021
+ const child = _arr[_i];
3022
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3023
+ _tmp = _i + 1 | 0;
3024
+ continue;
3025
+ } else break;
3026
+ }
3027
+ mizchi$luna$luna$render$$write_wc_close_tag(sb, island.name);
3028
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/wc-->");
3029
+ }
3030
+ function mizchi$luna$luna$render$$render_with_id_to$46$reset$47$891() {}
3031
+ function mizchi$luna$luna$render$$render_with_id_to$4$(sb, node, id_counter) {
3032
+ let _tmp = node;
3033
+ _L: while (true) {
3034
+ const node$2 = _tmp;
3035
+ switch (node$2.$tag) {
3036
+ case 1: {
3037
+ const _content = node$2._0;
3038
+ mizchi$luna$luna$render$$escape_html_to(sb, _content);
3039
+ return;
3040
+ }
3041
+ case 13: {
3042
+ const _html = node$2._0;
3043
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _html);
3044
+ return;
3045
+ }
3046
+ case 2: {
3047
+ const _getter = node$2._0;
3048
+ const id = id_counter.val;
3049
+ id_counter.val = id + 1 | 0;
3050
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--t:");
3051
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3052
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3053
+ mizchi$luna$luna$render$$escape_html_to(sb, _getter());
3054
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/t-->");
3055
+ return;
3056
+ }
3057
+ case 3: {
3058
+ const _children = node$2._0;
3059
+ const _len = _children.length;
3060
+ let _tmp$2 = 0;
3061
+ while (true) {
3062
+ const _i = _tmp$2;
3063
+ if (_i < _len) {
3064
+ const child = _children[_i];
3065
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3066
+ _tmp$2 = _i + 1 | 0;
3067
+ continue;
3068
+ } else return;
3069
+ }
3070
+ }
3071
+ case 0: {
3072
+ const _elem = node$2._0;
3073
+ const tag = _elem.tag;
3074
+ const id$2 = id_counter.val;
3075
+ id_counter.val = id$2 + 1 | 0;
3076
+ const needs_hydration = mizchi$luna$luna$render$$has_dynamic_content$4$(_elem.attrs);
3077
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 60);
3078
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, tag);
3079
+ mizchi$luna$luna$render$$render_attrs_to$4$(sb, _elem.attrs);
3080
+ if (needs_hydration) {
3081
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " sol:hk=\"");
3082
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$2);
3083
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
3084
+ }
3085
+ if (mizchi$luna$luna$render$$is_void_element(tag)) {
3086
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " />");
3087
+ return;
3088
+ } else {
3089
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
3090
+ const _arr = _elem.children;
3091
+ const _len$2 = _arr.length;
3092
+ let _tmp$3 = 0;
3093
+ while (true) {
3094
+ const _i = _tmp$3;
3095
+ if (_i < _len$2) {
3096
+ const child = _arr[_i];
3097
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3098
+ _tmp$3 = _i + 1 | 0;
3099
+ continue;
3100
+ } else break;
3101
+ }
3102
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</");
3103
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, tag);
3104
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
3105
+ return;
3106
+ }
3107
+ }
3108
+ case 4: {
3109
+ const _Show = node$2;
3110
+ const _condition = _Show._0;
3111
+ const _child = _Show._1;
3112
+ const id$3 = id_counter.val;
3113
+ id_counter.val = id$3 + 1 | 0;
3114
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--s:");
3115
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$3);
3116
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3117
+ if (_condition()) mizchi$luna$luna$render$$render_with_id_to$4$(sb, _child(), id_counter);
3118
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/s-->");
3119
+ return;
3120
+ }
3121
+ case 5: {
3122
+ const _render = node$2._0;
3123
+ const id$4 = id_counter.val;
3124
+ id_counter.val = id$4 + 1 | 0;
3125
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--f:");
3126
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$4);
3127
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3128
+ const _arr = _render();
3129
+ const _len$2 = _arr.length;
3130
+ let _tmp$3 = 0;
3131
+ while (true) {
3132
+ const _i = _tmp$3;
3133
+ if (_i < _len$2) {
3134
+ const item = _arr[_i];
3135
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, item, id_counter);
3136
+ _tmp$3 = _i + 1 | 0;
3137
+ continue;
3138
+ } else break;
3139
+ }
3140
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/f-->");
3141
+ return;
3142
+ }
3143
+ case 6: {
3144
+ const _render$2 = node$2._0;
3145
+ _tmp = _render$2();
3146
+ continue _L;
3147
+ }
3148
+ case 7: {
3149
+ const _island = node$2._0;
3150
+ mizchi$luna$luna$render$$render_island_with_id_to$4$(sb, _island, id_counter);
3151
+ return;
3152
+ }
3153
+ case 8: {
3154
+ const _wc_island = node$2._0;
3155
+ mizchi$luna$luna$render$$render_wc_island_with_id_to$4$(sb, _wc_island, id_counter);
3156
+ return;
3157
+ }
3158
+ case 12: {
3159
+ const _iref = node$2._0;
3160
+ mizchi$luna$luna$render$$render_internal_ref_with_id_to$4$(sb, _iref, id_counter);
3161
+ return;
3162
+ }
3163
+ case 9: {
3164
+ const _async_node = node$2._0;
3165
+ const id$5 = id_counter.val;
3166
+ id_counter.val = id$5 + 1 | 0;
3167
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--a:");
3168
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$5);
3169
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3170
+ const _func = _async_node.fallback;
3171
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _func(), id_counter);
3172
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/a-->");
3173
+ return;
3174
+ }
3175
+ case 10: {
3176
+ const _boundary = node$2._0;
3177
+ const id$6 = id_counter.val;
3178
+ id_counter.val = id$6 + 1 | 0;
3179
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--eb:");
3180
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$6);
3181
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3182
+ let _try_err;
3183
+ _L$2: {
3184
+ _L$3: {
3185
+ const _func$2 = _boundary.children;
3186
+ const _bind = _func$2();
3187
+ let _tmp$4;
3188
+ if (_bind.$tag === 1) _tmp$4 = _bind._0;
3189
+ else {
3190
+ _try_err = _bind._0;
3191
+ break _L$3;
3192
+ }
3193
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _tmp$4, id_counter);
3194
+ break _L$2;
3195
+ }
3196
+ _L$4: _L$5: {
3197
+ const _func$2 = _boundary.fallback;
3198
+ const _bind = _func$2(_try_err, mizchi$luna$luna$render$$render_with_id_to$46$reset$47$891);
3199
+ let _tmp$4;
3200
+ if (_bind.$tag === 1) _tmp$4 = _bind._0;
3201
+ else {
3202
+ _bind._0;
3203
+ break _L$5;
3204
+ }
3205
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _tmp$4, id_counter);
3206
+ break _L$4;
3207
+ }
3208
+ }
3209
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/eb-->");
3210
+ return;
3211
+ }
3212
+ default: {
3213
+ const _switch_node = node$2._0;
3214
+ const id$7 = id_counter.val;
3215
+ id_counter.val = id$7 + 1 | 0;
3216
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--sw:");
3217
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$7);
3218
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3219
+ const _arr$2 = _switch_node.cases;
3220
+ const _len$3 = _arr$2.length;
3221
+ let _tmp$4 = 0;
3222
+ while (true) {
3223
+ const _i = _tmp$4;
3224
+ if (_i < _len$3) {
3225
+ const case_ = _arr$2[_i];
3226
+ const _func$2 = case_.when;
3227
+ if (_func$2()) {
3228
+ const _func$3 = case_.render;
3229
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _func$3(), id_counter);
3230
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/sw-->");
3231
+ return;
3232
+ }
3233
+ _tmp$4 = _i + 1 | 0;
3234
+ continue;
3235
+ } else break;
3236
+ }
3237
+ const _bind = _switch_node.fallback;
3238
+ if (_bind === void 0) {} else mizchi$luna$luna$render$$render_with_id_to$4$(sb, _bind(), id_counter);
3239
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/sw-->");
3240
+ return;
3241
+ }
3242
+ }
3243
+ }
3244
+ }
3245
+ function mizchi$luna$luna$render$$render_internal_ref_with_id_to$4$(sb, iref, id_counter) {
3246
+ if (iref.wc) {
3247
+ mizchi$luna$luna$render$$render_internal_ref_wc_with_id_to$4$(sb, iref, id_counter);
3248
+ return;
3249
+ } else {
3250
+ mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$4$(sb, iref, id_counter);
3251
+ return;
3252
+ }
3253
+ }
3254
+ function mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$4$(sb, iref, id_counter) {
3255
+ const id = id_counter.val;
3256
+ id_counter.val = id + 1 | 0;
3257
+ const island_id = moonbitlang$core$string$$String$replace(moonbitlang$core$string$$String$replace(iref.url, {
3258
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$915,
3259
+ start: 0,
3260
+ end: 1
3261
+ }, {
3262
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$916,
3263
+ start: 0,
3264
+ end: 1
3265
+ }), {
3266
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$917,
3267
+ start: 0,
3268
+ end: 1
3269
+ }, {
3270
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$918,
3271
+ start: 0,
3272
+ end: 1
3273
+ });
3274
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--i:");
3275
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3276
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3277
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--luna:island:");
3278
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3279
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " url=");
3280
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, iref.url);
3281
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " trigger=");
3282
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(iref.trigger));
3283
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3284
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<div luna:id=\"");
3285
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3286
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:url=\"");
3287
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, iref.url);
3288
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:state=\"");
3289
+ mizchi$luna$luna$render$$escape_attr_to(sb, iref.state);
3290
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:client-trigger=\"");
3291
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(iref.trigger));
3292
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
3293
+ const _arr = iref.children;
3294
+ const _len = _arr.length;
3295
+ let _tmp = 0;
3296
+ while (true) {
3297
+ const _i = _tmp;
3298
+ if (_i < _len) {
3299
+ const child = _arr[_i];
3300
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3301
+ _tmp = _i + 1 | 0;
3302
+ continue;
3303
+ } else break;
3304
+ }
3305
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</div>");
3306
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/luna:island:");
3307
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3308
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3309
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/i-->");
3310
+ }
3311
+ function mizchi$luna$luna$render$$render_internal_ref_wc_with_id_to$4$(sb, iref, id_counter) {
3312
+ const id = id_counter.val;
3313
+ id_counter.val = id + 1 | 0;
3314
+ const name = mizchi$luna$internal$utils$$extract_wc_name_from_url(iref.url);
3315
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--wc:");
3316
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3317
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3318
+ mizchi$luna$luna$render$$write_wc_open_tag(sb, name, iref.url, iref.state, iref.trigger, iref.styles);
3319
+ const _arr = iref.children;
3320
+ const _len = _arr.length;
3321
+ let _tmp = 0;
3322
+ while (true) {
3323
+ const _i = _tmp;
3324
+ if (_i < _len) {
3325
+ const child = _arr[_i];
3326
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3327
+ _tmp = _i + 1 | 0;
3328
+ continue;
3329
+ } else break;
3330
+ }
3331
+ mizchi$luna$luna$render$$write_wc_close_tag(sb, name);
3332
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/wc-->");
3333
+ }
3334
+ function mizchi$luna$luna$render$$render_island_with_id_to$4$(sb, island, id_counter) {
3335
+ mizchi$luna$luna$render$$render_island_open_to$4$(sb, island);
3336
+ const _arr = island.children;
3337
+ const _len = _arr.length;
3338
+ let _tmp = 0;
3339
+ while (true) {
3340
+ const _i = _tmp;
3341
+ if (_i < _len) {
3342
+ const child = _arr[_i];
3343
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3344
+ _tmp = _i + 1 | 0;
3345
+ continue;
3346
+ } else break;
3347
+ }
3348
+ mizchi$luna$luna$render$$render_island_close_to$4$(sb, island);
3349
+ }
3350
+ function mizchi$luna$luna$render$$render_to_string_with_hydration$4$(node) {
3351
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(256);
3352
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, node, { val: 0 });
3353
+ return sb.val;
3354
+ }
3355
+ function f4ah6o$svg_jww$svg_jww_ui$$render_layer_item(layer, on_toggle_visibility, on_toggle_lock, on_select) {
3356
+ const visibility_icon = layer.visible ? "👁" : "○";
3357
+ const lock_icon = layer.locked ? "🔒" : "🔓";
3358
+ const opacity = layer.visible ? "1.0" : "0.5";
3359
+ const _tmp$3 = [
3360
+ {
3361
+ _0: "class",
3362
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-item")
3363
+ },
3364
+ {
3365
+ _0: "data-layer-id",
3366
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(moonbitlang$core$int$$Int$to_string$46$inner(layer.layer_id, 10))
3367
+ },
3368
+ {
3369
+ _0: "style",
3370
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(`display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; opacity: ${opacity}`)
3371
+ },
3372
+ {
3373
+ _0: "onClick",
3374
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_select)
3375
+ }
3376
+ ];
3377
+ const _tmp$7 = mizchi$luna$luna$$h$4$("button", [
3378
+ {
3379
+ _0: "class",
3380
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-visibility")
3381
+ },
3382
+ {
3383
+ _0: "title",
3384
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Toggle Visibility")
3385
+ },
3386
+ {
3387
+ _0: "onClick",
3388
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_visibility)
3389
+ },
3390
+ {
3391
+ _0: "style",
3392
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 20px; height: 20px; border: none; background: transparent; cursor: pointer; font-size: 14px;")
3393
+ }
3394
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(visibility_icon)]);
3395
+ const _tmp$11 = mizchi$luna$luna$$h$4$("button", [
3396
+ {
3397
+ _0: "class",
3398
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-lock")
3399
+ },
3400
+ {
3401
+ _0: "title",
3402
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Toggle Lock")
3403
+ },
3404
+ {
3405
+ _0: "onClick",
3406
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_lock)
3407
+ },
3408
+ {
3409
+ _0: "style",
3410
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 20px; height: 20px; border: none; background: transparent; cursor: pointer; font-size: 14px;")
3411
+ }
3412
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(lock_icon)]);
3413
+ const _tmp$13 = [{
3414
+ _0: "class",
3415
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-name")
3416
+ }, {
3417
+ _0: "style",
3418
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; font-size: 13px;")
3419
+ }];
3420
+ const _p$12 = layer.name;
3421
+ return mizchi$luna$luna$$h$4$("div", _tmp$3, [
3422
+ _tmp$7,
3423
+ _tmp$11,
3424
+ mizchi$luna$luna$$h$4$("span", _tmp$13, [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(_p$12)])
3425
+ ]);
3426
+ }
3427
+ function f4ah6o$svg_jww$svg_jww_ui$$render_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer) {
3428
+ const layers = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).layers;
3429
+ const _tmp$2 = [{
3430
+ _0: "class",
3431
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel")
3432
+ }, {
3433
+ _0: "style",
3434
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border: 1px solid #ccc; border-radius: 4px; overflow: hidden;")
3435
+ }];
3436
+ const _tmp$5 = mizchi$luna$luna$$h$4$("div", [{
3437
+ _0: "class",
3438
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-header")
3439
+ }, {
3440
+ _0: "style",
3441
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #ccc; font-weight: bold; font-size: 14px;")
3442
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers")]);
3443
+ const _tmp$7 = [{
3444
+ _0: "class",
3445
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-list")
3446
+ }, {
3447
+ _0: "style",
3448
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("max-height: 300px; overflow-y: auto;")
3449
+ }];
3450
+ const _p$8 = new Array(layers.length);
3451
+ const _p$9 = layers.length;
3452
+ let _tmp$8 = 0;
3453
+ while (true) {
3454
+ const _p$10 = _tmp$8;
3455
+ if (_p$10 < _p$9) {
3456
+ const _p$11 = layers[_p$10];
3457
+ _p$8[_p$10] = f4ah6o$svg_jww$svg_jww_ui$$render_layer_item(_p$11, on_toggle_visibility, on_toggle_lock, on_select_layer);
3458
+ _tmp$8 = _p$10 + 1 | 0;
3459
+ continue;
3460
+ } else break;
3461
+ }
3462
+ const _tmp$9 = mizchi$luna$luna$$h$4$("div", _tmp$7, _p$8);
3463
+ const _tmp$11 = [{
3464
+ _0: "class",
3465
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-footer")
3466
+ }, {
3467
+ _0: "style",
3468
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 6px 12px; background: #f5f5f5; border-top: 1px solid #ccc; font-size: 12px; color: #666;")
3469
+ }];
3470
+ const _p$12 = () => {
3471
+ const layers$2 = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).layers;
3472
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(layers$2.length, 10)} layers`;
3473
+ };
3474
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [
3475
+ _tmp$5,
3476
+ _tmp$9,
3477
+ mizchi$luna$luna$$h$4$("div", _tmp$11, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$12)])
3478
+ ]);
3479
+ }
3480
+ function f4ah6o$svg_jww$svg_jww_ui$$render_collapsible_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer, on_toggle_panel) {
3481
+ return mizchi$luna$luna$$h$4$("div", [{
3482
+ _0: "class",
3483
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-wrapper")
3484
+ }, {
3485
+ _0: "style",
3486
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border: 1px solid #ccc; border-radius: 4px;")
3487
+ }], [mizchi$luna$luna$$h$4$("div", [
3488
+ {
3489
+ _0: "class",
3490
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-toggle")
3491
+ },
3492
+ {
3493
+ _0: "style",
3494
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 8px 12px; background: #f5f5f5; cursor: pointer; display: flex; justify-content: space-between; align-items: center;")
3495
+ },
3496
+ {
3497
+ _0: "onClick",
3498
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_panel)
3499
+ }
3500
+ ], [mizchi$luna$luna$$h$4$("span", [{
3501
+ _0: "style",
3502
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-weight: bold; font-size: 14px;")
3503
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers")]), mizchi$luna$luna$$h$4$("span", [{
3504
+ _0: "style",
3505
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px;")
3506
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("▼")])]), mizchi$luna$luna$$h$4$("div", [], [f4ah6o$svg_jww$svg_jww_ui$$render_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer)])]);
3507
+ }
3508
+ function f4ah6o$svg_jww$svg_jww_ui$$render_canvas(state_sig, svg_content_sig, on_pan, on_wheel) {
3509
+ const svg_content = mizchi$luna$luna$signal$$Signal$get$18$(svg_content_sig);
3510
+ const _tmp$2 = [{
3511
+ _0: "class",
3512
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas")
3513
+ }, {
3514
+ _0: "style",
3515
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: relative; overflow: hidden;")
3516
+ }];
3517
+ const _tmp$3 = {
3518
+ _0: "class",
3519
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas-content")
3520
+ };
3521
+ const _p$4 = () => {
3522
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3523
+ return `transform: translate(${moonbitlang$core$double$$Double$to_string(vp.offset_x)}px, ${moonbitlang$core$double$$Double$to_string(vp.offset_y)}px) scale(${moonbitlang$core$double$$Double$to_string(vp.scale)}); transform-origin: 0 0;`;
3524
+ };
3525
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [mizchi$luna$luna$$h$4$("div", [
3526
+ _tmp$3,
3527
+ {
3528
+ _0: "style",
3529
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(_p$4)
3530
+ },
3531
+ {
3532
+ _0: "onWheel",
3533
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_wheel)
3534
+ }
3535
+ ], [mizchi$luna$luna$$h$4$("div", [{
3536
+ _0: "class",
3537
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-svg-wrapper")
3538
+ }, {
3539
+ _0: "style",
3540
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("pointer-events: none;")
3541
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$(svg_content)])]), mizchi$luna$luna$$h$4$("div", [
3542
+ {
3543
+ _0: "class",
3544
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-pan-overlay")
3545
+ },
3546
+ {
3547
+ _0: "style",
3548
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: absolute; inset: 0; cursor: grab;")
3549
+ },
3550
+ {
3551
+ _0: "onMouseDown",
3552
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_pan)
3553
+ }
3554
+ ], [])]);
3555
+ }
3556
+ function f4ah6o$svg_jww$svg_jww_ui$$render_canvas_with_controls(state_sig, svg_content_sig, on_pan, on_wheel, on_zoom_in, on_zoom_out, on_fit, on_reset) {
3557
+ const _tmp$2 = [{
3558
+ _0: "class",
3559
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-viewer")
3560
+ }, {
3561
+ _0: "style",
3562
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: relative;")
3563
+ }];
3564
+ const _tmp$3 = f4ah6o$svg_jww$svg_jww_ui$$render_canvas(state_sig, svg_content_sig, on_pan, on_wheel);
3565
+ const _tmp$5 = [{
3566
+ _0: "class",
3567
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-controls")
3568
+ }, {
3569
+ _0: "style",
3570
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: absolute; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 4px;")
3571
+ }];
3572
+ const _tmp$10 = mizchi$luna$luna$$h$4$("button", [
3573
+ {
3574
+ _0: "class",
3575
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3576
+ },
3577
+ {
3578
+ _0: "title",
3579
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom In")
3580
+ },
3581
+ {
3582
+ _0: "onClick",
3583
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_in)
3584
+ },
3585
+ {
3586
+ _0: "style",
3587
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3588
+ }
3589
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("+")]);
3590
+ const _tmp$12 = [{
3591
+ _0: "class",
3592
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-level")
3593
+ }, {
3594
+ _0: "style",
3595
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("text-align: center; font-size: 12px; color: #666; min-width: 50px;")
3596
+ }];
3597
+ const _p$11 = () => {
3598
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3599
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(vp.scale * 100), 10)}%`;
3600
+ };
3601
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [_tmp$3, mizchi$luna$luna$$h$4$("div", _tmp$5, [
3602
+ _tmp$10,
3603
+ mizchi$luna$luna$$h$4$("div", _tmp$12, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$11)]),
3604
+ mizchi$luna$luna$$h$4$("button", [
3605
+ {
3606
+ _0: "class",
3607
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3608
+ },
3609
+ {
3610
+ _0: "title",
3611
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom Out")
3612
+ },
3613
+ {
3614
+ _0: "onClick",
3615
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_out)
3616
+ },
3617
+ {
3618
+ _0: "style",
3619
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3620
+ }
3621
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("-")]),
3622
+ mizchi$luna$luna$$h$4$("div", [{
3623
+ _0: "style",
3624
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("height: 1px; background: #ccc;")
3625
+ }], []),
3626
+ mizchi$luna$luna$$h$4$("button", [
3627
+ {
3628
+ _0: "class",
3629
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3630
+ },
3631
+ {
3632
+ _0: "title",
3633
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Fit to View")
3634
+ },
3635
+ {
3636
+ _0: "onClick",
3637
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_fit)
3638
+ },
3639
+ {
3640
+ _0: "style",
3641
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3642
+ }
3643
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("⛶")]),
3644
+ mizchi$luna$luna$$h$4$("button", [
3645
+ {
3646
+ _0: "class",
3647
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3648
+ },
3649
+ {
3650
+ _0: "title",
3651
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Reset View")
3652
+ },
3653
+ {
3654
+ _0: "onClick",
3655
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_reset)
3656
+ },
3657
+ {
3658
+ _0: "style",
3659
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3660
+ }
3661
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("⟲")])
3662
+ ])]);
3663
+ }
3664
+ function f4ah6o$svg_jww$svg_jww_ui$$render_info_panel(state_sig) {
3665
+ const _tmp$2 = [{
3666
+ _0: "class",
3667
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-info-panel")
3668
+ }, {
3669
+ _0: "style",
3670
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border-top: 1px solid #ccc; padding: 12px;")
3671
+ }];
3672
+ const _tmp$4 = mizchi$luna$luna$$h$4$("h3", [{
3673
+ _0: "style",
3674
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("margin: 0 0 8px 0; font-size: 14px;")
3675
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Document Info")]);
3676
+ const _tmp$5 = [{
3677
+ _0: "style",
3678
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px; color: #666; display: flex; flex-direction: column; gap: 4px;")
3679
+ }];
3680
+ const _tmp$6 = [];
3681
+ const _tmp$7 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Viewport:");
3682
+ const _p$7 = () => {
3683
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3684
+ return `${moonbitlang$core$double$$Double$to_string(vp.width)}x${moonbitlang$core$double$$Double$to_string(vp.height)}`;
3685
+ };
3686
+ const _tmp$8 = mizchi$luna$luna$$h$4$("div", _tmp$6, [_tmp$7, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$7)]);
3687
+ const _tmp$9 = [];
3688
+ const _tmp$10 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Scale:");
3689
+ const _p$9 = () => {
3690
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3691
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(vp.scale * 100), 10)}%`;
3692
+ };
3693
+ const _tmp$11 = mizchi$luna$luna$$h$4$("div", _tmp$9, [_tmp$10, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$9)]);
3694
+ const _tmp$12 = [];
3695
+ const _tmp$13 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers:");
3696
+ const _p$11 = () => {
3697
+ const state = mizchi$luna$luna$signal$$Signal$get$17$(state_sig);
3698
+ const _p$12 = state.layers;
3699
+ const _p$13 = [];
3700
+ const _p$14 = _p$12.length;
3701
+ let _tmp$14 = 0;
3702
+ while (true) {
3703
+ const _p$15 = _tmp$14;
3704
+ if (_p$15 < _p$14) {
3705
+ const _p$16 = _p$12[_p$15];
3706
+ if (_p$16.visible) moonbitlang$core$array$$Array$push$13$(_p$13, _p$16);
3707
+ _tmp$14 = _p$15 + 1 | 0;
3708
+ continue;
3709
+ } else break;
3710
+ }
3711
+ const visible = _p$13.length;
3712
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(visible, 10)} / ${moonbitlang$core$int$$Int$to_string$46$inner(state.layers.length, 10)}`;
3713
+ };
3714
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [_tmp$4, mizchi$luna$luna$$h$4$("div", _tmp$5, [
3715
+ _tmp$8,
3716
+ _tmp$11,
3717
+ mizchi$luna$luna$$h$4$("div", _tmp$12, [_tmp$13, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$11)])
3718
+ ])]);
3719
+ }
3720
+ function f4ah6o$svg_jww$svg_jww_ui$$render_toolbar(state_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_toggle_layer_panel) {
3721
+ const _tmp$2 = [{
3722
+ _0: "class",
3723
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-toolbar")
3724
+ }, {
3725
+ _0: "style",
3726
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #ccc;")
3727
+ }];
3728
+ const _tmp$4 = mizchi$luna$luna$$h$4$("span", [{
3729
+ _0: "style",
3730
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-weight: bold; font-size: 16px;")
3731
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("JWW Viewer")]);
3732
+ const _tmp$6 = mizchi$luna$luna$$h$4$("span", [{
3733
+ _0: "style",
3734
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("color: #999;")
3735
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("|")]);
3736
+ const _tmp$10 = mizchi$luna$luna$$h$4$("button", [
3737
+ {
3738
+ _0: "title",
3739
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom In (Ctrl+)")
3740
+ },
3741
+ {
3742
+ _0: "onClick",
3743
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_in)
3744
+ },
3745
+ {
3746
+ _0: "style",
3747
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3748
+ }
3749
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Zoom In")]);
3750
+ const _tmp$14 = mizchi$luna$luna$$h$4$("button", [
3751
+ {
3752
+ _0: "title",
3753
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom Out (Ctrl-)")
3754
+ },
3755
+ {
3756
+ _0: "onClick",
3757
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_out)
3758
+ },
3759
+ {
3760
+ _0: "style",
3761
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3762
+ }
3763
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Zoom Out")]);
3764
+ const _tmp$18 = mizchi$luna$luna$$h$4$("button", [
3765
+ {
3766
+ _0: "title",
3767
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Fit to View (Ctrl+F)")
3768
+ },
3769
+ {
3770
+ _0: "onClick",
3771
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_fit)
3772
+ },
3773
+ {
3774
+ _0: "style",
3775
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3776
+ }
3777
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Fit")]);
3778
+ const _tmp$22 = mizchi$luna$luna$$h$4$("button", [
3779
+ {
3780
+ _0: "title",
3781
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Reset View (Ctrl+R)")
3782
+ },
3783
+ {
3784
+ _0: "onClick",
3785
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_reset)
3786
+ },
3787
+ {
3788
+ _0: "style",
3789
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3790
+ }
3791
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Reset")]);
3792
+ const _tmp$23 = mizchi$luna$luna$$h$4$("div", [{
3793
+ _0: "style",
3794
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1;")
3795
+ }], []);
3796
+ const _tmp$25 = [{
3797
+ _0: "class",
3798
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-toolbar-info")
3799
+ }, {
3800
+ _0: "style",
3801
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px; color: #666;")
3802
+ }];
3803
+ const _p$22 = () => {
3804
+ return `Scale: ${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport.scale * 100), 10)}%`;
3805
+ };
3806
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [
3807
+ _tmp$4,
3808
+ _tmp$6,
3809
+ _tmp$10,
3810
+ _tmp$14,
3811
+ _tmp$18,
3812
+ _tmp$22,
3813
+ _tmp$23,
3814
+ mizchi$luna$luna$$h$4$("span", _tmp$25, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$22)])
3815
+ ]);
3816
+ }
3817
+ function f4ah6o$svg_jww$svg_jww_ui$$render_app(state_sig, svg_content_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_pan, on_toggle_layer_visibility, on_toggle_layer_lock, on_select_layer, on_toggle_layer_panel) {
3818
+ const _tmp = {
3819
+ _0: "class",
3820
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-viewer-app")
3821
+ };
3822
+ const _p$2 = () => {
3823
+ return `display: flex; height: 100vh; background-color: ${mizchi$luna$luna$signal$$Signal$get$17$(state_sig).background_color};`;
3824
+ };
3825
+ return mizchi$luna$luna$$h$4$("div", [_tmp, {
3826
+ _0: "style",
3827
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(_p$2)
3828
+ }], [mizchi$luna$luna$$h$4$("div", [{
3829
+ _0: "class",
3830
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-main-content")
3831
+ }, {
3832
+ _0: "style",
3833
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; display: flex; flex-direction: column;")
3834
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_toolbar(state_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_toggle_layer_panel), mizchi$luna$luna$$h$4$("div", [{
3835
+ _0: "class",
3836
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas-container")
3837
+ }, {
3838
+ _0: "style",
3839
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; position: relative; overflow: hidden;")
3840
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_canvas_with_controls(state_sig, svg_content_sig, on_pan, mizchi$luna$luna$$event_handler(), on_zoom_in, on_zoom_out, on_fit, on_reset)])]), mizchi$luna$luna$$h$4$("div", [{
3841
+ _0: "class",
3842
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-sidebar")
3843
+ }, {
3844
+ _0: "style",
3845
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 200px; border-left: 1px solid #ccc; display: flex; flex-direction: column;")
3846
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_collapsible_layer_panel(state_sig, on_toggle_layer_visibility, on_toggle_layer_lock, on_select_layer, on_toggle_layer_panel), f4ah6o$svg_jww$svg_jww_ui$$render_info_panel(state_sig)])]);
3847
+ }
3848
+ function f4ah6o$svg_jww$svg_jww_ui$$render_app_html(app_state, svg_content) {
3849
+ const state_sig = mizchi$luna$luna$signal$$signal$17$(app_state);
3850
+ const svg_sig = mizchi$luna$luna$signal$$signal$18$(svg_content);
3851
+ const noop = mizchi$luna$luna$$handler$4$((_x) => {});
3852
+ return mizchi$luna$luna$render$$render_to_string_with_hydration$4$(f4ah6o$svg_jww$svg_jww_ui$$render_app(state_sig, svg_sig, noop, noop, noop, noop, noop, noop, noop, noop, noop));
3853
+ }
3854
+ function f4ah6o$svg_jww$svg_jww_ui$$serialize_state(state) {
3855
+ const vp = state.viewport;
3856
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
3857
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "{\"viewport\":{\"scale\":");
3858
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.scale));
3859
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"offset_x\":");
3860
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.offset_x));
3861
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"offset_y\":");
3862
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.offset_y));
3863
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"width\":");
3864
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.width));
3865
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"height\":");
3866
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.height));
3867
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "}}");
3868
+ return sb.val;
3869
+ }
3870
+
3871
+ //#endregion
3872
+ export { f4ah6o$svg_jww$svg_jww_ui$$render_app as render_app, f4ah6o$svg_jww$svg_jww_ui$$render_app_html as render_app_html, f4ah6o$svg_jww$svg_jww_ui$$serialize_state as serialize_state };
3873
+ //# sourceMappingURL=index.mjs.map