@qwik.dev/core 2.0.0-beta.35 → 2.0.0-beta.37
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/backpatch/index.mjs +2 -2
- package/dist/backpatch/package.json +1 -1
- package/dist/backpatch-executor.debug.js +2 -1
- package/dist/backpatch-executor.js +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +272 -78
- package/dist/core.min.mjs +8 -9
- package/dist/core.mjs +2307 -1329
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4520 -3646
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +6 -4
- package/dist/optimizer.mjs +1533 -1440
- package/dist/out-of-order-executor.debug.js +163 -0
- package/dist/out-of-order-executor.js +1 -0
- package/dist/preloader.mjs +1 -1
- package/dist/qwikloader.debug.js +51 -28
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +4 -0
- package/dist/server.mjs +1158 -146
- package/dist/server.prod.mjs +1192 -391
- package/dist/testing/index.d.ts +78 -20
- package/dist/testing/index.mjs +3015 -1230
- package/dist/testing/package.json +1 -1
- package/dist/worker/package.json +1 -1
- package/package.json +3 -3
- package/public.d.ts +1 -0
package/dist/server.prod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-beta.37-dev+82dc74d
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { setPlatform as setPlatform2 } from "@qwik.dev/core";
|
|
10
10
|
|
|
11
11
|
// packages/qwik/src/server/platform.ts
|
|
12
|
-
import { setPlatform as
|
|
12
|
+
import { setPlatform as Hs } from "@qwik.dev/core";
|
|
13
13
|
|
|
14
14
|
import { isDev as isDev6 } from "@qwik.dev/core/build";
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ import { isDev as isDev6 } from "@qwik.dev/core/build";
|
|
|
17
17
|
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
18
18
|
|
|
19
19
|
// packages/qwik/src/core/shared/error/assert.ts
|
|
20
|
-
import { isDev as
|
|
20
|
+
import { isDev as me } from "@qwik.dev/core/build";
|
|
21
21
|
|
|
22
22
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
23
23
|
var qDev = globalThis.qDev !== false;
|
|
@@ -34,18 +34,18 @@ var qRuntimeQrl = globalThis.qRuntimeQrl === true;
|
|
|
34
34
|
var STYLE = qDev ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
|
|
35
35
|
|
|
36
36
|
var throwErrorAndStop = (e, ...t) => {
|
|
37
|
-
const n =
|
|
37
|
+
const n = be(false, e, ...t);
|
|
38
38
|
debugger;
|
|
39
39
|
throw n;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
var logErrorAndStop = (e, ...t) => {
|
|
43
|
-
const n =
|
|
43
|
+
const n = be(qDev, e, ...t);
|
|
44
44
|
debugger;
|
|
45
45
|
return n;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var be = (e, t, ...n) => {
|
|
49
49
|
const r = t instanceof Error ? t : new Error(t);
|
|
50
50
|
!qTest && console.error("%cQWIK ERROR", STYLE, r.message, ...n, r.stack);
|
|
51
51
|
e && !qTest && setTimeout(() => {
|
|
@@ -58,7 +58,7 @@ var fe = (e, t, ...n) => {
|
|
|
58
58
|
var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
|
|
59
59
|
|
|
60
60
|
function assertTrue(e, t, ...n) {
|
|
61
|
-
if (
|
|
61
|
+
if (me) {
|
|
62
62
|
if (e === true) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
@@ -67,7 +67,7 @@ function assertTrue(e, t, ...n) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// packages/qwik/src/core/client/util-mapArray.ts
|
|
70
|
-
var
|
|
70
|
+
var ve = (e, t, n) => {
|
|
71
71
|
isDev2 && assertTrue(n % 2 === 0, "Expecting even number.");
|
|
72
72
|
let r = n >> 1;
|
|
73
73
|
let s = e.length - 2 >> 1;
|
|
@@ -86,8 +86,8 @@ var ae = (e, t, n) => {
|
|
|
86
86
|
return r << 1 ^ -1;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
var
|
|
90
|
-
const i =
|
|
89
|
+
var _e = (e, t, n, r, s = false) => {
|
|
90
|
+
const i = ve(e, t, r);
|
|
91
91
|
if (i >= 0) {
|
|
92
92
|
if (n == null && !s) {
|
|
93
93
|
e.splice(i, 2);
|
|
@@ -100,7 +100,7 @@ var he = (e, t, n, r, s = false) => {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
var mapApp_remove = (e, t, n) => {
|
|
103
|
-
const r =
|
|
103
|
+
const r = ve(e, t, n);
|
|
104
104
|
let s = null;
|
|
105
105
|
if (r >= 0) {
|
|
106
106
|
s = e[r + 1];
|
|
@@ -110,8 +110,8 @@ var mapApp_remove = (e, t, n) => {
|
|
|
110
110
|
return s;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
var
|
|
114
|
-
const r =
|
|
113
|
+
var ge = (e, t, n) => {
|
|
114
|
+
const r = ve(e, t, n);
|
|
115
115
|
if (r >= 0) {
|
|
116
116
|
return e[r + 1];
|
|
117
117
|
} else {
|
|
@@ -119,17 +119,17 @@ var de = (e, t, n) => {
|
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
var
|
|
122
|
+
var Ee = (e, t, n) => ve(e, t, n) >= 0;
|
|
123
123
|
|
|
124
124
|
// packages/qwik/src/core/shared/error/error.ts
|
|
125
125
|
import { isDev as isDev3 } from "@qwik.dev/core/build";
|
|
126
126
|
|
|
127
127
|
// packages/qwik/src/core/shared/utils/types.ts
|
|
128
|
-
var
|
|
128
|
+
var ke = e => typeof e === "object" && e !== null;
|
|
129
129
|
|
|
130
|
-
var
|
|
130
|
+
var Re = e => Array.isArray(e);
|
|
131
131
|
|
|
132
|
-
var
|
|
132
|
+
var Pe = e => typeof e === "string";
|
|
133
133
|
|
|
134
134
|
// packages/qwik/src/core/shared/error/error.ts
|
|
135
135
|
var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q";
|
|
@@ -211,7 +211,7 @@ var codeToText = (e, ...t) => {
|
|
|
211
211
|
if (t.length) {
|
|
212
212
|
r = r.replaceAll(/{{(\d+)}}/g, (e, n) => {
|
|
213
213
|
let r = t[n];
|
|
214
|
-
if (r &&
|
|
214
|
+
if (r && ke(r) && r.constructor === Object) {
|
|
215
215
|
r = JSON.stringify(r).slice(0, 50);
|
|
216
216
|
}
|
|
217
217
|
return r;
|
|
@@ -223,7 +223,7 @@ var codeToText = (e, ...t) => {
|
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
var
|
|
226
|
+
var qe = (e, t = []) => {
|
|
227
227
|
const n = codeToText(e, ...t);
|
|
228
228
|
return logErrorAndStop(n, ...t);
|
|
229
229
|
};
|
|
@@ -231,10 +231,10 @@ var ve = (e, t = []) => {
|
|
|
231
231
|
// packages/qwik/src/core/shared/qrl/qrl-utils.ts
|
|
232
232
|
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
233
233
|
|
|
234
|
-
var
|
|
234
|
+
var Me = "<sync>";
|
|
235
235
|
|
|
236
236
|
// packages/qwik/src/core/shared/types.ts
|
|
237
|
-
var
|
|
237
|
+
var xe = "q:type";
|
|
238
238
|
|
|
239
239
|
// packages/qwik/src/core/shared/vnode-data-types.ts
|
|
240
240
|
var VNodeDataSeparator = {
|
|
@@ -406,6 +406,12 @@ var VNodeDataChar = {
|
|
|
406
406
|
/* ******* */ "~"
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
+
var je = (e, t) => {
|
|
410
|
+
const n = parseInt(e, 10) - 1;
|
|
411
|
+
const r = n + t;
|
|
412
|
+
return -(r * (r + 1) / 2 + t + 1);
|
|
413
|
+
};
|
|
414
|
+
|
|
409
415
|
// packages/qwik/src/core/shared/utils/character-escaping.ts
|
|
410
416
|
function escapeHTML(e) {
|
|
411
417
|
let t = "";
|
|
@@ -457,26 +463,64 @@ function encodeVNodeDataString(e) {
|
|
|
457
463
|
}
|
|
458
464
|
}
|
|
459
465
|
|
|
466
|
+
function encodeVNodeDataKey(e) {
|
|
467
|
+
const t = encodeURI(e);
|
|
468
|
+
let n = "";
|
|
469
|
+
const r = t.length;
|
|
470
|
+
let s = 0;
|
|
471
|
+
let i = s;
|
|
472
|
+
for (;s < r; s++) {
|
|
473
|
+
const e = t.charCodeAt(s);
|
|
474
|
+
let r = null;
|
|
475
|
+
if (e === 59) {
|
|
476
|
+
r = "%3B";
|
|
477
|
+
} else if (e === 61) {
|
|
478
|
+
r = "%3D";
|
|
479
|
+
} else if (e === 63) {
|
|
480
|
+
r = "%3F";
|
|
481
|
+
} else if (e === 64) {
|
|
482
|
+
r = "%40";
|
|
483
|
+
} else if (e === 126) {
|
|
484
|
+
r = "%7E";
|
|
485
|
+
} else {
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
n += t.substring(i, s) + r;
|
|
489
|
+
i = s + 1;
|
|
490
|
+
}
|
|
491
|
+
if (i === 0) {
|
|
492
|
+
return t;
|
|
493
|
+
} else {
|
|
494
|
+
return n + t.substring(i);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
460
498
|
// packages/qwik/src/core/shared/utils/markers.ts
|
|
461
|
-
var
|
|
499
|
+
var Le = "q:renderFn";
|
|
462
500
|
|
|
463
|
-
var
|
|
501
|
+
var De = "q:slot";
|
|
464
502
|
|
|
465
503
|
var QSlotParent = "q:sparent";
|
|
466
504
|
|
|
467
|
-
var
|
|
505
|
+
var QStatePatchAttr = "q:patch";
|
|
506
|
+
|
|
507
|
+
var Ph = "q:r";
|
|
508
|
+
|
|
509
|
+
var Ue = "q:style";
|
|
468
510
|
|
|
469
|
-
var
|
|
511
|
+
var ze = "style[q\\:style]";
|
|
470
512
|
|
|
471
513
|
var QStyleSSelector = "style[q\\:sstyle]";
|
|
472
514
|
|
|
473
|
-
var
|
|
515
|
+
var Be = ze + "," + QStyleSSelector;
|
|
474
516
|
|
|
475
|
-
var
|
|
517
|
+
var He = "q:sstyle";
|
|
476
518
|
|
|
477
|
-
var
|
|
519
|
+
var Je = "q:ctx";
|
|
478
520
|
|
|
479
|
-
var
|
|
521
|
+
var Qe = "q:brefs";
|
|
522
|
+
|
|
523
|
+
var QwikEvContainerReady = 0;
|
|
480
524
|
|
|
481
525
|
var QRenderAttr = "q:render";
|
|
482
526
|
|
|
@@ -484,7 +528,7 @@ var QRuntimeAttr = "q:runtime";
|
|
|
484
528
|
|
|
485
529
|
var QVersionAttr = "q:version";
|
|
486
530
|
|
|
487
|
-
var
|
|
531
|
+
var Ge = "q:base";
|
|
488
532
|
|
|
489
533
|
var QLocaleAttr = "q:locale";
|
|
490
534
|
|
|
@@ -492,78 +536,74 @@ var QManifestHashAttr = "q:manifest-hash";
|
|
|
492
536
|
|
|
493
537
|
var QInstanceAttr = "q:instance";
|
|
494
538
|
|
|
495
|
-
var
|
|
539
|
+
var Ke = "q:container-island";
|
|
496
540
|
|
|
497
|
-
var
|
|
541
|
+
var Ze = "/" + Ke;
|
|
498
542
|
|
|
499
|
-
var
|
|
543
|
+
var ts = "q:ignore";
|
|
500
544
|
|
|
501
|
-
var
|
|
545
|
+
var ns = "/" + ts;
|
|
502
546
|
|
|
503
|
-
var
|
|
547
|
+
var es = "q:container";
|
|
504
548
|
|
|
505
|
-
var
|
|
549
|
+
var ss = "/" + es;
|
|
506
550
|
|
|
507
|
-
var
|
|
551
|
+
var is = "q:template";
|
|
508
552
|
|
|
509
|
-
var
|
|
553
|
+
var os = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
510
554
|
|
|
511
|
-
var
|
|
555
|
+
var QDefaultSlot = "";
|
|
512
556
|
|
|
513
|
-
var
|
|
557
|
+
var as = "q:id";
|
|
514
558
|
|
|
515
|
-
var
|
|
559
|
+
var hs = "q:key";
|
|
516
560
|
|
|
517
|
-
var
|
|
561
|
+
var ds = "q:props";
|
|
518
562
|
|
|
519
|
-
var
|
|
563
|
+
var ps = "q:seq";
|
|
520
564
|
|
|
521
|
-
var
|
|
565
|
+
var $s = "q:seqIdx";
|
|
522
566
|
|
|
523
567
|
var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
|
|
524
568
|
|
|
525
|
-
var
|
|
526
|
-
|
|
527
|
-
var nr = "q:p";
|
|
569
|
+
var ys = "q:p";
|
|
528
570
|
|
|
529
|
-
var
|
|
571
|
+
var ms = "q:ps";
|
|
530
572
|
|
|
531
|
-
var
|
|
573
|
+
var ws = ":";
|
|
532
574
|
|
|
533
|
-
var
|
|
575
|
+
var bs = ws + "on";
|
|
534
576
|
|
|
535
|
-
var
|
|
577
|
+
var vs = ws + "onIdx";
|
|
536
578
|
|
|
537
|
-
var
|
|
579
|
+
var _s = ws + "onFlags";
|
|
538
580
|
|
|
539
|
-
var
|
|
581
|
+
var gs = ws + "nearestCursorBoundary";
|
|
540
582
|
|
|
541
|
-
var
|
|
583
|
+
var Es = ":";
|
|
542
584
|
|
|
543
|
-
var
|
|
544
|
-
|
|
545
|
-
var fr = "dangerouslySetInnerHTML";
|
|
585
|
+
var Ss = "dangerouslySetInnerHTML";
|
|
546
586
|
|
|
547
587
|
// packages/qwik/src/core/shared/utils/promises.ts
|
|
548
|
-
import { isDev as isDev5, isServer as
|
|
588
|
+
import { isDev as isDev5, isServer as $e } from "@qwik.dev/core/build";
|
|
549
589
|
|
|
550
|
-
var
|
|
590
|
+
var Rs = 100;
|
|
551
591
|
|
|
552
|
-
var
|
|
592
|
+
var Ps = e => !!e && typeof e == "object" && typeof e.then === "function";
|
|
553
593
|
|
|
554
|
-
var
|
|
594
|
+
var qs = (e, t) => Ps(e) ? e.then(t) : t(e);
|
|
555
595
|
|
|
556
596
|
var checkError = e => {
|
|
557
|
-
if (
|
|
597
|
+
if ($e && e instanceof ReferenceError && e.message.includes("window")) {
|
|
558
598
|
e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
|
|
559
599
|
}
|
|
560
600
|
};
|
|
561
601
|
|
|
562
|
-
var
|
|
602
|
+
var As = e => {
|
|
563
603
|
throw e;
|
|
564
604
|
};
|
|
565
605
|
|
|
566
|
-
function n(e, t =
|
|
606
|
+
function n(e, t = As) {
|
|
567
607
|
let n = false;
|
|
568
608
|
let r;
|
|
569
609
|
try {
|
|
@@ -572,21 +612,21 @@ function n(e, t = yr) {
|
|
|
572
612
|
} catch (e) {
|
|
573
613
|
r = e;
|
|
574
614
|
}
|
|
575
|
-
if (!
|
|
615
|
+
if (!Ps(r)) {
|
|
576
616
|
if (n) {
|
|
577
617
|
return r;
|
|
578
618
|
}
|
|
579
619
|
isDev5 && checkError(r);
|
|
580
620
|
return t(r);
|
|
581
621
|
}
|
|
582
|
-
let s =
|
|
622
|
+
let s = Rs;
|
|
583
623
|
const i = async n => {
|
|
584
|
-
while (
|
|
624
|
+
while (Ps(n)) {
|
|
585
625
|
try {
|
|
586
626
|
await n;
|
|
587
627
|
return await e();
|
|
588
628
|
} catch (e) {
|
|
589
|
-
if (
|
|
629
|
+
if (Ps(e)) {
|
|
590
630
|
if (! --s) {
|
|
591
631
|
n = new Error("Exceeded max retry count in retryOnPromise");
|
|
592
632
|
break;
|
|
@@ -615,34 +655,34 @@ function convertStyleIdsToString(e) {
|
|
|
615
655
|
}
|
|
616
656
|
|
|
617
657
|
// packages/qwik/src/core/shared/utils/event-names.ts
|
|
618
|
-
var
|
|
658
|
+
var Ns = e => e.charCodeAt(0) === 113 && e.charCodeAt(1) === 45 && (e.charCodeAt(3) === 58 || e.charCodeAt(3) === 112 && e.charCodeAt(4) === 58);
|
|
619
659
|
|
|
620
660
|
function isPreventDefault(e) {
|
|
621
661
|
return e.startsWith("preventdefault:");
|
|
622
662
|
}
|
|
623
663
|
|
|
624
664
|
// packages/qwik/src/core/shared/utils/unitless_number.ts
|
|
625
|
-
var
|
|
665
|
+
var Ls = /* @__PURE__ */ new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount",
|
|
626
666
|
// Known Prefixed Properties
|
|
627
667
|
"MozBoxFlex",
|
|
628
668
|
// TODO: Remove these since they shouldn't be used in modern code
|
|
629
669
|
"msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
|
|
630
670
|
|
|
631
|
-
var isUnitlessNumber = e =>
|
|
671
|
+
var isUnitlessNumber = e => Ls.has(e);
|
|
632
672
|
|
|
633
673
|
// packages/qwik/src/core/shared/utils/styles.ts
|
|
634
|
-
var
|
|
674
|
+
var Xs = e => {
|
|
635
675
|
if (!e) {
|
|
636
676
|
return "";
|
|
637
677
|
}
|
|
638
|
-
if (
|
|
678
|
+
if (Pe(e)) {
|
|
639
679
|
return e.trim();
|
|
640
680
|
}
|
|
641
681
|
const t = [];
|
|
642
|
-
if (
|
|
682
|
+
if (Re(e)) {
|
|
643
683
|
for (let n = 0; n < e.length; n++) {
|
|
644
684
|
const r = e[n];
|
|
645
|
-
const s =
|
|
685
|
+
const s = Xs(r);
|
|
646
686
|
if (s) {
|
|
647
687
|
t.push(s);
|
|
648
688
|
}
|
|
@@ -657,15 +697,15 @@ var Er = e => {
|
|
|
657
697
|
return t.join(" ");
|
|
658
698
|
};
|
|
659
699
|
|
|
660
|
-
var
|
|
700
|
+
var Ds = e => e.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
661
701
|
|
|
662
702
|
var stringifyStyle = e => {
|
|
663
703
|
if (e == null) {
|
|
664
704
|
return "";
|
|
665
705
|
}
|
|
666
706
|
if (typeof e == "object") {
|
|
667
|
-
if (
|
|
668
|
-
throw
|
|
707
|
+
if (Re(e)) {
|
|
708
|
+
throw qe(0 /* stringifyClassOrStyle */ , [ e, "style" ]);
|
|
669
709
|
} else {
|
|
670
710
|
const t = [];
|
|
671
711
|
for (const n in e) {
|
|
@@ -675,7 +715,7 @@ var stringifyStyle = e => {
|
|
|
675
715
|
if (n.startsWith("--")) {
|
|
676
716
|
t.push(n + ":" + r);
|
|
677
717
|
} else {
|
|
678
|
-
t.push(
|
|
718
|
+
t.push(Ds(n) + ":" + Ws(n, r));
|
|
679
719
|
}
|
|
680
720
|
}
|
|
681
721
|
}
|
|
@@ -688,9 +728,9 @@ var stringifyStyle = e => {
|
|
|
688
728
|
|
|
689
729
|
var serializeBooleanOrNumberAttribute = e => e != null ? String(e) : null;
|
|
690
730
|
|
|
691
|
-
function
|
|
731
|
+
function s(e, t, n) {
|
|
692
732
|
if (isClassAttr(e)) {
|
|
693
|
-
const e =
|
|
733
|
+
const e = Xs(t);
|
|
694
734
|
t = n ? n + (e.length ? " " + e : e) : e;
|
|
695
735
|
} else if (e === "style") {
|
|
696
736
|
t = stringifyStyle(t);
|
|
@@ -708,7 +748,7 @@ function isEnumeratedBooleanAttribute(e) {
|
|
|
708
748
|
return isAriaAttribute(e) || [ "spellcheck", "draggable", "contenteditable" ].includes(e);
|
|
709
749
|
}
|
|
710
750
|
|
|
711
|
-
var
|
|
751
|
+
var Ws = (e, t) => {
|
|
712
752
|
if (typeof t === "number" && t !== 0 && !isUnitlessNumber(e)) {
|
|
713
753
|
return t + "px";
|
|
714
754
|
}
|
|
@@ -737,9 +777,9 @@ var parseBundleGraph = e => {
|
|
|
737
777
|
o = -i / 10;
|
|
738
778
|
} else {
|
|
739
779
|
s.push({
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
780
|
+
Wt: e[i],
|
|
781
|
+
Yt: o,
|
|
782
|
+
Gt: 1
|
|
743
783
|
});
|
|
744
784
|
}
|
|
745
785
|
n++;
|
|
@@ -758,7 +798,7 @@ var initPreloader = e => {
|
|
|
758
798
|
};
|
|
759
799
|
|
|
760
800
|
// packages/qwik/src/core/shared/utils/objects.ts
|
|
761
|
-
var
|
|
801
|
+
var dr = e => {
|
|
762
802
|
for (const t in e) {
|
|
763
803
|
if (Object.prototype.hasOwnProperty.call(e, t)) {
|
|
764
804
|
return false;
|
|
@@ -767,6 +807,29 @@ var Kr = e => {
|
|
|
767
807
|
return true;
|
|
768
808
|
};
|
|
769
809
|
|
|
810
|
+
// packages/qwik/src/core/ssr/stream-writer.ts
|
|
811
|
+
var stringifyRootRefPath = e => {
|
|
812
|
+
let t = String(e[0]);
|
|
813
|
+
for (let n = 1; n < e.length; n++) {
|
|
814
|
+
t += " " + e[n];
|
|
815
|
+
}
|
|
816
|
+
return t;
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
var writeStringRootRef = (e, t) => e.write(String(t));
|
|
820
|
+
|
|
821
|
+
var writeStringRootRefPath = (e, t) => e.write(stringifyRootRefPath(t));
|
|
822
|
+
|
|
823
|
+
var pr = e => ({
|
|
824
|
+
write: e,
|
|
825
|
+
writeRootRef(e) {
|
|
826
|
+
return writeStringRootRef(this, e);
|
|
827
|
+
},
|
|
828
|
+
writeRootRefPath(e) {
|
|
829
|
+
return writeStringRootRefPath(this, e);
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
|
|
770
833
|
// packages/qwik/src/core/shared/ssr-const.ts
|
|
771
834
|
var LT = "<";
|
|
772
835
|
|
|
@@ -774,21 +837,21 @@ var GT = ">";
|
|
|
774
837
|
|
|
775
838
|
var CLOSE_TAG = "</";
|
|
776
839
|
|
|
777
|
-
var
|
|
840
|
+
var ga = " ";
|
|
778
841
|
|
|
779
842
|
var ATTR_EQUALS_QUOTE = '="';
|
|
780
843
|
|
|
781
|
-
var
|
|
844
|
+
var $r = '"';
|
|
782
845
|
|
|
783
846
|
var EMPTY_ATTR = '=""';
|
|
784
847
|
|
|
785
|
-
var
|
|
848
|
+
var yr = "[";
|
|
786
849
|
|
|
787
|
-
var
|
|
850
|
+
var mr = "]";
|
|
788
851
|
|
|
789
852
|
var PAREN_CLOSE = ")";
|
|
790
853
|
|
|
791
|
-
var
|
|
854
|
+
var wr = ",";
|
|
792
855
|
|
|
793
856
|
// packages/qwik/src/server/platform.ts
|
|
794
857
|
var getDevSegmentPath = (e, t, n, r) => {
|
|
@@ -796,7 +859,7 @@ var getDevSegmentPath = (e, t, n, r) => {
|
|
|
796
859
|
if (s) {
|
|
797
860
|
return s;
|
|
798
861
|
}
|
|
799
|
-
if (n ===
|
|
862
|
+
if (n === Me) {
|
|
800
863
|
return [ n, "" ];
|
|
801
864
|
}
|
|
802
865
|
if (!r) {
|
|
@@ -810,14 +873,14 @@ var getDevSegmentPath = (e, t, n, r) => {
|
|
|
810
873
|
return [ n, i ];
|
|
811
874
|
};
|
|
812
875
|
|
|
813
|
-
function
|
|
876
|
+
function Us(e, t) {
|
|
814
877
|
const n = t?.mapper;
|
|
815
878
|
const r = e.symbolMapper ? e.symbolMapper : (e, t, r) => {
|
|
816
879
|
if (n || isDev6 && import.meta.env?.MODE !== "test") {
|
|
817
|
-
const t =
|
|
880
|
+
const t = Rh(e);
|
|
818
881
|
const s = !isDev6 ? n[t] : getDevSegmentPath(n, t, e, r);
|
|
819
882
|
if (!s) {
|
|
820
|
-
if (t ===
|
|
883
|
+
if (t === Me) {
|
|
821
884
|
return [ t, "" ];
|
|
822
885
|
}
|
|
823
886
|
const s = globalThis.__qwik_reg_symbols?.has(t);
|
|
@@ -832,12 +895,12 @@ function Pr(e, t) {
|
|
|
832
895
|
const s = {
|
|
833
896
|
isServer: true,
|
|
834
897
|
async importSymbol(e, t, n) {
|
|
835
|
-
const r =
|
|
898
|
+
const r = Rh(n);
|
|
836
899
|
const s = globalThis.__qwik_reg_symbols?.get(r);
|
|
837
900
|
if (s) {
|
|
838
901
|
return s;
|
|
839
902
|
}
|
|
840
|
-
throw
|
|
903
|
+
throw qe(6 /* dynamicImportFailed */ , [ n ]);
|
|
841
904
|
},
|
|
842
905
|
raf: () => {
|
|
843
906
|
console.error("server can not rerender");
|
|
@@ -851,11 +914,11 @@ function Pr(e, t) {
|
|
|
851
914
|
}
|
|
852
915
|
|
|
853
916
|
async function setServerPlatform(e, t) {
|
|
854
|
-
const n =
|
|
855
|
-
|
|
917
|
+
const n = Us(e, t);
|
|
918
|
+
Hs(n);
|
|
856
919
|
}
|
|
857
920
|
|
|
858
|
-
var
|
|
921
|
+
var Rh = e => {
|
|
859
922
|
const t = e.lastIndexOf("_");
|
|
860
923
|
if (t > -1) {
|
|
861
924
|
return e.slice(t + 1);
|
|
@@ -864,15 +927,77 @@ var Ha = e => {
|
|
|
864
927
|
};
|
|
865
928
|
|
|
866
929
|
// packages/qwik/src/server/ssr-render.ts
|
|
867
|
-
import { getClientManifest as
|
|
930
|
+
import { getClientManifest as Qf } from "@qwik.dev/core";
|
|
868
931
|
|
|
869
932
|
// packages/qwik/src/server/ssr-container.ts
|
|
870
933
|
import { isDev as isDev8 } from "@qwik.dev/core/build";
|
|
871
934
|
|
|
872
|
-
import { _SubscriptionData as
|
|
935
|
+
import { _SubscriptionData as Ti, _SharedContainer as lc, _jsxSorted as Di, _jsxSplit as Wi, _res as _, _setEvent, _walkJSX as Xn, _createQRL as xf, isSignal as lu } from "@qwik.dev/core/internal";
|
|
936
|
+
|
|
937
|
+
// packages/qwik/src/server/ooos-utils.ts
|
|
938
|
+
import { _SubscriptionPatch as qu } from "@qwik.dev/core/internal";
|
|
939
|
+
|
|
940
|
+
var recordExternalRootEffect = (e, t, n, r, s, i, o, a) => {
|
|
941
|
+
if (!r || o !== null && !a) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
let l = s;
|
|
945
|
+
if (o !== null && s && (typeof s === "object" || typeof s === "function")) {
|
|
946
|
+
l = n.get(s) || s;
|
|
947
|
+
}
|
|
948
|
+
const c = e.ge(l);
|
|
949
|
+
t.St(l);
|
|
950
|
+
t.St(i);
|
|
951
|
+
if (o !== null && typeof o !== "string") {
|
|
952
|
+
t.St(o);
|
|
953
|
+
}
|
|
954
|
+
r.push({
|
|
955
|
+
rootObj: l,
|
|
956
|
+
rootId: c,
|
|
957
|
+
effect: i,
|
|
958
|
+
prop: o
|
|
959
|
+
});
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
var collectSubscriptionPatches = (e, t, n) => {
|
|
963
|
+
if (!t?.length) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
const r = [];
|
|
967
|
+
const s = /* @__PURE__ */ new Map;
|
|
968
|
+
for (let i = 0; i < t.length; i++) {
|
|
969
|
+
const o = t[i];
|
|
970
|
+
const a = o.rootId === void 0 ? e.ge(o.rootObj) : o.rootId;
|
|
971
|
+
if (a === void 0 || a >= n) {
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
let l = s.get(a);
|
|
975
|
+
if (!l) {
|
|
976
|
+
l = new qu(a, o.prop === null ? /* @__PURE__ */ new Set : /* @__PURE__ */ new Map);
|
|
977
|
+
s.set(a, l);
|
|
978
|
+
r.push(l);
|
|
979
|
+
}
|
|
980
|
+
const c = l.subscriptions;
|
|
981
|
+
if (o.prop === null) {
|
|
982
|
+
if (c instanceof Set) {
|
|
983
|
+
c.add(o.effect);
|
|
984
|
+
}
|
|
985
|
+
} else {
|
|
986
|
+
if (c instanceof Map) {
|
|
987
|
+
let e = c.get(o.prop);
|
|
988
|
+
if (!e) {
|
|
989
|
+
e = /* @__PURE__ */ new Set;
|
|
990
|
+
c.set(o.prop, e);
|
|
991
|
+
}
|
|
992
|
+
e.add(o.effect);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
return r.length ? r : void 0;
|
|
997
|
+
};
|
|
873
998
|
|
|
874
999
|
// packages/qwik/src/server/preload-impl.ts
|
|
875
|
-
import { getPlatform as
|
|
1000
|
+
import { getPlatform as Js } from "@qwik.dev/core";
|
|
876
1001
|
|
|
877
1002
|
var simplifyPath = (e, t) => {
|
|
878
1003
|
if (t == null) {
|
|
@@ -892,7 +1017,7 @@ var simplifyPath = (e, t) => {
|
|
|
892
1017
|
};
|
|
893
1018
|
|
|
894
1019
|
var getBase = e => {
|
|
895
|
-
let t = e.
|
|
1020
|
+
let t = e.qe;
|
|
896
1021
|
if (import.meta.env?.DEV && !qTest) {
|
|
897
1022
|
t = import.meta.env?.BASE_URL;
|
|
898
1023
|
}
|
|
@@ -942,9 +1067,7 @@ var preloaderPre = (e, t, n) => {
|
|
|
942
1067
|
if (n) {
|
|
943
1068
|
h["nonce"] = n;
|
|
944
1069
|
}
|
|
945
|
-
e.
|
|
946
|
-
e.write(u);
|
|
947
|
-
e.closeElement();
|
|
1070
|
+
e.writeScript(h, u);
|
|
948
1071
|
}
|
|
949
1072
|
const a = simplifyPath(s, r?.manifest.core);
|
|
950
1073
|
if (a) {
|
|
@@ -1003,9 +1126,7 @@ var includePreloader = (e, t, n, r) => {
|
|
|
1003
1126
|
if (r) {
|
|
1004
1127
|
t["nonce"] = r;
|
|
1005
1128
|
}
|
|
1006
|
-
e.
|
|
1007
|
-
e.write(h);
|
|
1008
|
-
e.closeElement();
|
|
1129
|
+
e.writeScript(t, h);
|
|
1009
1130
|
}
|
|
1010
1131
|
return null;
|
|
1011
1132
|
};
|
|
@@ -1015,7 +1136,7 @@ var preloaderPost = (e, t, n) => {
|
|
|
1015
1136
|
return;
|
|
1016
1137
|
}
|
|
1017
1138
|
if (t.preloader !== false) {
|
|
1018
|
-
const r = Array.from(e.serializationCtx.
|
|
1139
|
+
const r = Array.from(e.serializationCtx.xt);
|
|
1019
1140
|
const s = getBundles(r);
|
|
1020
1141
|
includePreloader(e, t.preloader, s, n);
|
|
1021
1142
|
}
|
|
@@ -1029,10 +1150,10 @@ function normalizePreLoaderOptions(e) {
|
|
|
1029
1150
|
}
|
|
1030
1151
|
|
|
1031
1152
|
var getBundles = e => {
|
|
1032
|
-
const t =
|
|
1153
|
+
const t = Js();
|
|
1033
1154
|
const n = e?.map(e => {
|
|
1034
|
-
const n = e.
|
|
1035
|
-
const r = e.
|
|
1155
|
+
const n = e.vt;
|
|
1156
|
+
const r = e._t;
|
|
1036
1157
|
const s = t.chunkForSymbol(n, r, e.dev?.file);
|
|
1037
1158
|
if (s) {
|
|
1038
1159
|
return s[1];
|
|
@@ -1048,13 +1169,17 @@ var preLoaderOptionsDefault = {
|
|
|
1048
1169
|
};
|
|
1049
1170
|
|
|
1050
1171
|
// packages/qwik/src/server/scripts.ts
|
|
1051
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = 'const e=document,t=window,
|
|
1172
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = 'const e=document,t=window,n="w",r="wp",o="d",s="dp",i="e",a="ep",c="capture:",l="readystatechange",p=0,u=new Set,d=new Set([e]),f=new Map,h={};let q,b,g;const m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return d.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,"[q\\\\:shadowroot]");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&"function"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},C=e=>{if(e.length){const t=()=>E(e);g=g?g.then(t,t):t()}},S=t=>{if(void 0===t._qwikjson_){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){t._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},_=e=>{h[e]=1,I(l)},k=t=>{const n=t.getAttribute("q:instance");return"paused"===t.getAttribute("q:container")&&"loading"===e.readyState&&!h[n]&&new Promise(t=>{w(e,l,()=>{("loading"!==e.readyState||h[n])&&t()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(t,n)=>{e.dispatchEvent($(t,n))},N=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(":");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute("q-"+t)),j=(t,n,r,o,s,i,a,c=!0)=>{const l={qBase:r,symbol:i,element:n,reqTime:a};if(!s){const n=(e["qFuncs_"+t.getAttribute("q:instance")]||[])[+i];if(!n&&c){const e=Error("sym:"+i);I("qerror",{importError:"sync",error:e,...l}),console.error(e)}return n}const p=`${i}|${r}|${s}`,u=f.get(p);if(u)return u;const d=new URL(s,o).href,h=import(d);return S(t),h.then(e=>{const t=e[i];if(t)f.set(p,t),I("qsymbol",l);else{const e=Error(`${i} not in ${d}`);I("qerror",{importError:"no-symbol",error:e,...l}),console.error(e)}return t},e=>{I("qerror",{importError:"async",error:e,...l}),console.error(e)})},D=(t,n,r,o,s,i=!0)=>{let a=!1;s&&(i&&t.hasAttribute("preventdefault:"+s)&&n.preventDefault(),t.hasAttribute("stoppropagation:"+s)&&n.stopPropagation());const c=t._qDispatch?.[r];if(c){if("function"==typeof c){const e=()=>c(n,t);if(a)o.push(async()=>{const t=e();A(t)&&await t});else{const t=e();A(t)&&(a=!0,o.push(()=>t))}}else if(c.length)for(let e=0;e<c.length;e++){const r=c[e];if(r){const e=()=>r(n,t);if(a)o.push(async()=>{const t=e();A(t)&&await t});else{const t=e();A(t)&&(a=!0,o.push(()=>t))}}}return}const l=t.getAttribute("q-"+r);if(l){const r=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),s=r.getAttribute("q:base"),i=new URL(s,e.baseURI),c=l.split("|"),p=k(r);for(let e=0;e<c.length;e++){const l=c[e],u=performance.now(),[d,f,h]=l.split("#"),q=e=>{if(e&&t.isConnected){const r=e=>{I("qerror",{error:e,qBase:s,symbol:f,element:t,reqTime:u})};try{const o=e.call(h,n,t);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(e=!0)=>j(r,t,s,i,d,f,u,e),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=i,n=!0)=>{const r=N(e.type),o=t+":"+r,s=c+r,a=[],l=[],p=[];let u=e.target;for(;u;)L(u)?(a.push(u),l.push(U(u,o,s)),u=u.parentElement):u=u.parentElement;for(let t=a.length-1;t>=0;t--)if(l[t]&&(D(a[t],e,o,p,r,n),e.cancelBubble))return void C(p);for(let t=0;t<a.length;t++)if(!l[t]&&(D(a[t],e,o,p,r,n),!e.bubbles||e.cancelBubble))return void C(p);C(p)},P=e=>O(e,a,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+":"+r,s=v("[q-"+e+"\\\\:"+r+"]"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}C(i)},J=e=>{F(o,e)},M=e=>{F(s,e,!1)},Z=e=>{F(n,e)},z=e=>{F(r,e,!1)},G=()=>{const n=e.readyState;if("interactive"==n||"complete"==n){if(b=1,d.forEach(y),u.has("d:qinit")){u.delete("d:qinit");const e=$("qinit"),t=v("[q-d\\\\:qinit]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qinit",n),o.removeAttribute("q-d:qinit")}C(n)}if(u.has("d:qidle")&&(u.delete("d:qidle"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=$("qidle"),t=v("[q-d\\\\:qidle]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qidle",n),o.removeAttribute("q-d:qidle")}C(n)})),u.has("e:qvisible")){q||(q=new IntersectionObserver(e=>{const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.isIntersecting&&(q.unobserve(r.target),D(r.target,$("qvisible",r),"e:qvisible",t))}C(t)}));const e=v("[q-e\\\\:qvisible]:not([q\\\\:observed])");for(let t=0;t<e.length;t++){const n=e[t];q.observe(n),n.setAttribute("q:observed","true")}}}},H=(...e)=>{for(let r=0;r<e.length;r++){const s=e[r];if(0===s)_(e[++r]);else if("string"==typeof s){if(!u.has(s)){u.add(s);const{scope:e,eventName:r}=T(s),i=x(e),a=B(e);a===n?w(t,r,i?z:Z,!0,i):d.forEach(e=>w(e,r,a===o?i?M:J:i?P:O,!0,i)),1!==b||"e:qvisible"!==s&&"d:qinit"!==s&&"d:qidle"!==s||G()}}else d.has(s)||(u.forEach(e=>{const{scope:t,eventName:r}=T(e),i=x(t),a=B(t);a!==n&&w(s,r,a===o?i?M:J:i?P:O,!0,i)}),d.add(s))}},K=t._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H("e:click","e:input"),t._qwikEv={events:u,roots:d,push:H},w(e,l,G),G())';
|
|
1173
|
+
|
|
1174
|
+
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst windowPrefix = "w";\nconst passiveWindowPrefix = "wp";\nconst documentPrefix = "d";\nconst passiveDocumentPrefix = "dp";\nconst elementPrefix = "e";\nconst passiveElementPrefix = "ep";\nconst capturePrefix = "capture:";\nconst readyStateChange = "readystatechange";\nconst QwikEvContainerReady = 0;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nconst readyContainers = {};\nlet observer;\nlet hasInitialized;\nlet queuedTasks;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, { capture, passive });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(fragment);\n const shadowRoots = nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]");\n for (let i = 0; i < shadowRoots.length; i++) {\n const parent = shadowRoots[i];\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst runTasks = async (tasks) => {\n for (let i = 0; i < tasks.length; i++) {\n await tasks[i]();\n }\n};\nconst queueTasks = (tasks) => {\n if (tasks.length) {\n const run = () => runTasks(tasks);\n queuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n }\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst markContainerReady = (hash) => {\n readyContainers[hash] = 1;\n emitEvent(readyStateChange);\n};\nconst waitForContainerReady = (container) => {\n const hash = container.getAttribute("q:instance");\n return container.getAttribute("q:container") === "paused" && doc.readyState === "loading" && !readyContainers[hash] && new Promise((resolve) => {\n const ready = () => {\n if (doc.readyState !== "loading" || readyContainers[hash]) {\n resolve();\n }\n };\n addEventListener(doc, readyStateChange, ready);\n });\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => {\n const separatorIndex = event.indexOf(":");\n const scope = event.slice(0, separatorIndex);\n return {\n scope,\n eventName: kebabToCamel(event.slice(separatorIndex + 1))\n };\n};\nconst isPassiveScope = (scope) => scope.length === 2;\nconst getRootScope = (scope) => scope.charAt(0);\nconst isElementNode = (node) => !!node && node.nodeType === 1;\nconst isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute("q-" + scopedKebabName));\nconst resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime, reportSyncError = true) => {\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n if (!chunk) {\n const handler2 = (doc["qFuncs_" + container.getAttribute("q:instance")] || [])[+symbol];\n if (!handler2 && reportSyncError) {\n const error = new Error("sym:" + symbol);\n emitEvent("qerror", {\n importError: "sync",\n error,\n ...eventData\n });\n console.error(error);\n }\n return handler2;\n }\n const key = `${symbol}|${qBase}|${chunk}`;\n const handler = symbols.get(key);\n if (handler) {\n return handler;\n }\n const href = new URL(chunk, base).href;\n const module = import(\n href\n );\n resolveContainer(container);\n return module.then(\n (module2) => {\n const handler2 = module2[symbol];\n if (!handler2) {\n const error = new Error(`${symbol} not in ${href}`);\n emitEvent("qerror", {\n importError: "no-symbol",\n error,\n ...eventData\n });\n console.error(error);\n } else {\n symbols.set(key, handler2);\n emitEvent("qsymbol", eventData);\n }\n return handler2;\n },\n (error) => {\n emitEvent("qerror", {\n importError: "async",\n error,\n ...eventData\n });\n console.error(error);\n return void 0;\n }\n );\n};\nconst dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n let defer = false;\n if (kebabName) {\n if (allowPreventDefault && element.hasAttribute("preventdefault:" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (typeof handlers === "function") {\n const run = () => handlers(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n } else if (handlers.length) {\n for (let i = 0; i < handlers.length; i++) {\n const handler = handlers[i];\n if (handler) {\n const run = () => handler(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute("q-" + scopedKebabName);\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const base = new URL(qBase, doc.baseURI);\n const qrls = attrValue.split("|");\n const waitForReady = waitForContainerReady(container);\n for (let i = 0; i < qrls.length; i++) {\n const qrl = qrls[i];\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split("#");\n const run = (handler2) => {\n if (handler2 && element.isConnected) {\n const onError = (error) => {\n emitEvent("qerror", {\n error,\n qBase,\n symbol,\n element,\n reqTime\n });\n };\n try {\n const result = handler2.call(capturedIds, ev, element);\n if (isPromise(result)) {\n return result.catch(onError);\n }\n } catch (error) {\n return onError(error);\n }\n }\n };\n const resolve = (reportSyncError = true) => resolveHandler(container, element, qBase, base, chunk, symbol, reqTime, reportSyncError);\n const handler = waitForReady ? void 0 : resolve();\n if (waitForReady) {\n defer = true;\n tasks.push(async () => {\n await waitForReady;\n await run(await resolve(false) || await resolve());\n });\n } else if (isPromise(handler)) {\n defer = true;\n tasks.push(() => handler.then(run));\n } else if (defer) {\n defer = true;\n tasks.push(async () => {\n await run(handler || await resolve());\n });\n } else {\n const result = run(handler);\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n};\nconst processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const captureAttribute = capturePrefix + kebabName;\n const elements = [];\n const captureHandlers = [];\n const tasks = [];\n let current = ev.target;\n while (current) {\n if (isElementNode(current)) {\n elements.push(current);\n captureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n current = current.parentElement;\n } else {\n current = current.parentElement;\n }\n }\n for (let i = elements.length - 1; i >= 0; i--) {\n if (captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n if (ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n for (let i = 0; i < elements.length; i++) {\n if (!captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n if (!ev.bubbles || ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n queueTasks(tasks);\n};\nconst processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nconst broadcast = (scope, ev, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const elements = querySelectorAll("[q-" + scope + "\\\\:" + kebabName + "]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n }\n queueTasks(tasks);\n};\nconst processDocumentEvent = (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processPassiveDocumentEvent = (ev) => {\n broadcast(passiveDocumentPrefix, ev, false);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processPassiveWindowEvent = (ev) => {\n broadcast(passiveWindowPrefix, ev, false);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == "interactive" || readyState == "complete") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has("d:qinit")) {\n events.delete("d:qinit");\n const ev = createEvent("qinit");\n const elements = querySelectorAll("[q-d\\\\:qinit]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qinit", tasks);\n el.removeAttribute("q-d:qinit");\n }\n queueTasks(tasks);\n }\n if (events.has("d:qidle")) {\n events.delete("d:qidle");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent("qidle");\n const elements = querySelectorAll("[q-d\\\\:qidle]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qidle", tasks);\n el.removeAttribute("q-d:qidle");\n }\n queueTasks(tasks);\n });\n }\n if (events.has("e:qvisible")) {\n observer || (observer = new IntersectionObserver((entries) => {\n const tasks = [];\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(\n entry.target,\n createEvent("qvisible", entry),\n "e:qvisible",\n tasks\n );\n }\n }\n queueTasks(tasks);\n }));\n const elements = querySelectorAll("[q-e\\\\:qvisible]:not([q\\\\:observed])");\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n observer.observe(el);\n el.setAttribute("q:observed", "true");\n }\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (let i = 0; i < eventNames.length; i++) {\n const eventNameOrRoot = eventNames[i];\n if (eventNameOrRoot === QwikEvContainerReady) {\n markContainerReady(eventNames[++i]);\n } else if (typeof eventNameOrRoot === "string") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope === windowPrefix) {\n addEventListener(\n win,\n eventName,\n passive ? processPassiveWindowEvent : processWindowEvent,\n true,\n passive\n );\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === "e:qvisible" || eventNameOrRoot === "d:qinit" || eventNameOrRoot === "d:qidle")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot("e:click", "e:input");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, readyStateChange, processReadyStateChange);\n processReadyStateChange();\n}';
|
|
1052
1175
|
|
|
1053
|
-
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst windowPrefix = "w";\nconst passiveWindowPrefix = "wp";\nconst documentPrefix = "d";\nconst passiveDocumentPrefix = "dp";\nconst elementPrefix = "e";\nconst passiveElementPrefix = "ep";\nconst capturePrefix = "capture:";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\nlet hasInitialized;\nlet queuedTasks;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, { capture, passive });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(fragment);\n const shadowRoots = nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]");\n for (let i = 0; i < shadowRoots.length; i++) {\n const parent = shadowRoots[i];\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst runTasks = async (tasks) => {\n for (let i = 0; i < tasks.length; i++) {\n await tasks[i]();\n }\n};\nconst queueTasks = (tasks) => {\n if (tasks.length) {\n const run = () => runTasks(tasks);\n queuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n }\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => {\n const separatorIndex = event.indexOf(":");\n const scope = event.slice(0, separatorIndex);\n return {\n scope,\n eventName: kebabToCamel(event.slice(separatorIndex + 1))\n };\n};\nconst isPassiveScope = (scope) => scope.length === 2;\nconst getRootScope = (scope) => scope.charAt(0);\nconst isElementNode = (node) => !!node && node.nodeType === 1;\nconst isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute("q-" + scopedKebabName));\nconst resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime) => {\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n if (chunk === "") {\n const hash = container.getAttribute("q:instance");\n const handler2 = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler2) {\n const error = new Error("sym:" + symbol);\n emitEvent("qerror", {\n importError: "sync",\n error,\n ...eventData\n });\n console.error(error);\n }\n return handler2;\n }\n const key = `${symbol}|${qBase}|${chunk}`;\n const handler = symbols.get(key);\n if (handler) {\n return handler;\n }\n const href = new URL(chunk, base).href;\n const module = import(\n href\n );\n resolveContainer(container);\n return module.then(\n (module2) => {\n const handler2 = module2[symbol];\n if (!handler2) {\n const error = new Error(`${symbol} not in ${href}`);\n emitEvent("qerror", {\n importError: "no-symbol",\n error,\n ...eventData\n });\n console.error(error);\n } else {\n symbols.set(key, handler2);\n emitEvent("qsymbol", eventData);\n }\n return handler2;\n },\n (error) => {\n emitEvent("qerror", {\n importError: "async",\n error,\n ...eventData\n });\n console.error(error);\n return void 0;\n }\n );\n};\nconst dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n let defer = false;\n if (kebabName) {\n if (allowPreventDefault && element.hasAttribute("preventdefault:" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (typeof handlers === "function") {\n const run = () => handlers(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n } else if (handlers.length) {\n for (let i = 0; i < handlers.length; i++) {\n const handler = handlers[i];\n if (handler) {\n const run = () => handler(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute("q-" + scopedKebabName);\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const base = new URL(qBase, doc.baseURI);\n const qrls = attrValue.split("|");\n for (let i = 0; i < qrls.length; i++) {\n const qrl = qrls[i];\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split("#");\n const run = (handler2) => {\n if (handler2 && element.isConnected) {\n try {\n const result = handler2.call(capturedIds, ev, element);\n if (isPromise(result)) {\n return result.catch((error) => {\n emitEvent("qerror", {\n error,\n qBase,\n symbol,\n element,\n reqTime\n });\n });\n }\n } catch (error) {\n emitEvent("qerror", {\n error,\n qBase,\n symbol,\n element,\n reqTime\n });\n }\n }\n };\n const handler = resolveHandler(container, element, qBase, base, chunk, symbol, reqTime);\n if (defer || isPromise(handler)) {\n defer = true;\n tasks.push(async () => {\n await run(isPromise(handler) ? await handler : handler);\n });\n } else {\n const result = run(handler);\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n};\nconst processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const captureAttribute = capturePrefix + kebabName;\n const elements = [];\n const captureHandlers = [];\n const tasks = [];\n let current = ev.target;\n while (current) {\n if (isElementNode(current)) {\n elements.push(current);\n captureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n current = current.parentElement;\n } else {\n current = current.parentElement;\n }\n }\n for (let i = elements.length - 1; i >= 0; i--) {\n if (captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n const continuePropagation = !ev.cancelBubble;\n if (!continuePropagation || ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n for (let i = 0; i < elements.length; i++) {\n if (!captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (!doBubble || ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n queueTasks(tasks);\n};\nconst processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nconst broadcast = (scope, ev, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const elements = querySelectorAll("[q-" + scope + "\\\\:" + kebabName + "]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n }\n queueTasks(tasks);\n};\nconst processDocumentEvent = (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processPassiveDocumentEvent = (ev) => {\n broadcast(passiveDocumentPrefix, ev, false);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processPassiveWindowEvent = (ev) => {\n broadcast(passiveWindowPrefix, ev, false);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == "interactive" || readyState == "complete") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has("d:qinit")) {\n events.delete("d:qinit");\n const ev = createEvent("qinit");\n const elements = querySelectorAll("[q-d\\\\:qinit]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qinit", tasks);\n el.removeAttribute("q-d:qinit");\n }\n queueTasks(tasks);\n }\n if (events.has("d:qidle")) {\n events.delete("d:qidle");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent("qidle");\n const elements = querySelectorAll("[q-d\\\\:qidle]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qidle", tasks);\n el.removeAttribute("q-d:qidle");\n }\n queueTasks(tasks);\n });\n }\n if (events.has("e:qvisible")) {\n observer || (observer = new IntersectionObserver((entries) => {\n const tasks = [];\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(\n entry.target,\n createEvent("qvisible", entry),\n "e:qvisible",\n tasks\n );\n }\n }\n queueTasks(tasks);\n }));\n const elements = querySelectorAll("[q-e\\\\:qvisible]:not([q\\\\:observed])");\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n observer.observe(el);\n el.setAttribute("q:observed", "true");\n }\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (let i = 0; i < eventNames.length; i++) {\n const eventNameOrRoot = eventNames[i];\n if (typeof eventNameOrRoot === "string") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope === windowPrefix) {\n addEventListener(\n win,\n eventName,\n passive ? processPassiveWindowEvent : processWindowEvent,\n true,\n passive\n );\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === "e:qvisible" || eventNameOrRoot === "d:qinit" || eventNameOrRoot === "d:qidle")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot("e:click", "e:input");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
|
|
1176
|
+
var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `const t='script[type="qwik/backpatch"]';function e(e,n){const o=n||e.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const n=o.querySelectorAll(t),r=n[n.length-1];if(r){const t=JSON.parse(r.textContent||"[]"),n=e.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let c=n.currentNode,i=c.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],r=t[e+1];let l=t[e+2];for(;i<o&&(c=n.nextNode(),c);)c.hasAttribute(":")&&i++;const s=c;null==l||!1===l?s.removeAttribute(r):("boolean"==typeof l&&(l=""),s.setAttribute(r,l))}}}}const n=document.currentScript;if(n){const t=n.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");t&&e(document,t)}`;
|
|
1054
1177
|
|
|
1055
|
-
var
|
|
1178
|
+
var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';\nfunction executeBackpatch(doc, containerElement) {\n const container = containerElement || doc.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n if (container) {\n const scripts = container.querySelectorAll(BACKPATCH_DATA_SELECTOR);\n const script = scripts[scripts.length - 1];\n if (script) {\n const data = JSON.parse(script.textContent || "[]");\n const walker = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n let currentNode = walker.currentNode;\n let currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;\n for (let i = 0; i < data.length; i += 3) {\n const elementIdx = data[i];\n const attrName = data[i + 1];\n let value = data[i + 2];\n while (currentNodeIdx < elementIdx) {\n currentNode = walker.nextNode();\n if (!currentNode) {\n break;\n }\n if (currentNode.hasAttribute(":")) {\n currentNodeIdx++;\n }\n }\n const element = currentNode;\n if (value == null || value === false) {\n element.removeAttribute(attrName);\n } else {\n if (typeof value === "boolean") {\n value = "";\n }\n element.setAttribute(attrName, value);\n }\n }\n }\n }\n}\nconst executorScript = document.currentScript;\nif (executorScript) {\n const container = executorScript.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n if (container) {\n executeBackpatch(document, container);\n }\n}`;
|
|
1056
1179
|
|
|
1057
|
-
var
|
|
1180
|
+
var QWIK_OUT_OF_ORDER_EXECUTOR_MINIFIED = `const t='template[q\\\\:r="',e="q:r",n='[q\\\\:rp="',r="q:g",l="q:i",o="q:o",s="[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])",u=u=>{const i=new WeakMap,c=()=>{const t=u.currentScript;return t&&t.closest(s)||u},f=(t,e,n,r)=>{let l=i.get(t);return l||i.set(t,l={}),l[e]||(l[e]={r:{},n:0,t:n,o:r})},a=(t,e)=>t?(e&&e.style&&(e.style.display="none"),t.style&&(t.style.display="contents"),1):0,q=t=>{const e=t.o;let n,r,l=0;if("p"===e)for(const e in t.r)n=t.r[e],n[0]&&a(n[0],n[1])&&(n[0]=0,l++);else if("s"===e)for(r=t.n;(n=t.r[r])&&n[0]&&a(n[0],n[1]);r++)n[0]=0,l++,t.n=r+1;else if("r"===e){if(t.t<0)return 0;for(t.n<0&&(t.n=t.t-1),r=t.n;(n=t.r[r])&&n[0]&&a(n[0],n[1]);r--)n[0]=0,l++,t.n=r-1}else{if(t.t<0)return 0;for(r=0;r<t.t;r++)if(n=t.r[r],!n)return 0;for(r=0;r<t.t;r++)n=t.r[r],n[0]&&a(n[0],n[1])&&(n[0]=0,l++)}return l},p=s=>{const i=c(),p=((n,r)=>{const l=u.currentScript,o=l?l.previousElementSibling:null;if(o&&"template"===o.localName&&o.getAttribute(e)===r+"")return o;const s=n.querySelectorAll(t+r+'"]');return s.length?s[s.length-1]:null})(i,s);if(!p)return;const g=((e,r,l)=>{if(!l)return null;const o=((t,e)=>t.querySelector(n+e+'"]'))(e,r),s=o?((e,n)=>e.querySelector(t+n+'"]'))(o,r):null,u=s?s.parentNode:null;return s&&o&&u?(u.insertBefore(l.content,s),s.remove(),l.remove(),[o,o.previousElementSibling]):null})(i,s,p);if(!g)return;((t,e)=>{var n;const r=u;null==(n=r.qProcessOOOS)||n.call(r,t,e)})(s,g[0]||null);const m=p.getAttribute(r);if(m){const t=+(p.getAttribute(l)||0),e=f(i,m,-1,p.getAttribute(o)||"p");return e.r[t]=g,void q(e)}a(g[0]||null,g[1])};p.g=(t,e,n)=>{const r=f(c(),t,e,n);r.t=e,r.o=n,"r"===r.o&&0===r.n&&(r.n=e-1),q(r)},p.d=u,globalThis.qO=p};u(document)`;
|
|
1181
|
+
|
|
1182
|
+
var QWIK_OUT_OF_ORDER_EXECUTOR_DEBUG = `const Q_RESOLVED_SELECTOR = 'template[q\\\\:r="';\nconst Q_RESOLVED_ATTR = "q:r";\nconst Q_RESULT_PARENT_SELECTOR = '[q\\\\:rp="';\nconst Q_GROUP_ATTR = "q:g";\nconst Q_INDEX_ATTR = "q:i";\nconst Q_ORDER_ATTR = "q:o";\nconst Q_CONTAINER_SELECTOR = "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])";\nconst installOutOfOrderExecutor = (doc) => {\n const groups = /* @__PURE__ */ new WeakMap();\n const process = (boundaryId, content) => {\n var _a;\n const executorDoc = doc;\n (_a = executorDoc.qProcessOOOS) == null ? void 0 : _a.call(executorDoc, boundaryId, content);\n };\n const getScope = () => {\n const script = doc.currentScript;\n return script ? script.closest(Q_CONTAINER_SELECTOR) || doc : doc;\n };\n const group = (scope, groupId, total, order) => {\n let scopedGroups = groups.get(scope);\n if (!scopedGroups) {\n groups.set(scope, scopedGroups = {});\n }\n return scopedGroups[groupId] || (scopedGroups[groupId] = {\n r: {},\n n: 0,\n t: total,\n o: order\n });\n };\n const getResolvedTemplate = (scope, boundaryId) => {\n const currentScript = doc.currentScript;\n const previousElement = currentScript ? currentScript.previousElementSibling : null;\n if (previousElement && previousElement.localName === "template" && previousElement.getAttribute(Q_RESOLVED_ATTR) === String(boundaryId)) {\n return previousElement;\n }\n const templates = scope.querySelectorAll(Q_RESOLVED_SELECTOR + boundaryId + '"]');\n return templates.length ? templates[templates.length - 1] : null;\n };\n const getPlaceholderTemplate = (content, boundaryId) => {\n return content.querySelector(Q_RESOLVED_SELECTOR + boundaryId + '"]');\n };\n const getResultParent = (scope, boundaryId) => {\n return scope.querySelector(Q_RESULT_PARENT_SELECTOR + boundaryId + '"]');\n };\n const reveal = (content, fallback) => {\n if (!content) {\n return 0;\n }\n if (fallback && fallback.style) {\n fallback.style.display = "none";\n }\n if (content.style) {\n content.style.display = "contents";\n }\n return 1;\n };\n const move = (scope, boundaryId, resolved) => {\n if (!resolved) {\n return null;\n }\n const content = getResultParent(scope, boundaryId);\n const placeholder = content ? getPlaceholderTemplate(content, boundaryId) : null;\n const parent = placeholder ? placeholder.parentNode : null;\n if (!placeholder || !content || !parent) {\n return null;\n }\n parent.insertBefore(resolved.content, placeholder);\n placeholder.remove();\n resolved.remove();\n return [content, content.previousElementSibling];\n };\n const flush = (group2) => {\n const order = group2.o;\n let entry;\n let index;\n let swapped = 0;\n if (order === "p") {\n for (const key in group2.r) {\n entry = group2.r[key];\n if (entry[0] && reveal(entry[0], entry[1])) {\n entry[0] = 0;\n swapped++;\n }\n }\n } else if (order === "s") {\n for (index = group2.n; (entry = group2.r[index]) && entry[0]; index++) {\n if (!reveal(entry[0], entry[1])) {\n break;\n }\n entry[0] = 0;\n swapped++;\n group2.n = index + 1;\n }\n } else if (order === "r") {\n if (group2.t < 0) {\n return 0;\n }\n if (group2.n < 0) {\n group2.n = group2.t - 1;\n }\n for (index = group2.n; (entry = group2.r[index]) && entry[0]; index--) {\n if (!reveal(entry[0], entry[1])) {\n break;\n }\n entry[0] = 0;\n swapped++;\n group2.n = index - 1;\n }\n } else {\n if (group2.t < 0) {\n return 0;\n }\n for (index = 0; index < group2.t; index++) {\n entry = group2.r[index];\n if (!entry) {\n return 0;\n }\n }\n for (index = 0; index < group2.t; index++) {\n entry = group2.r[index];\n if (entry[0] && reveal(entry[0], entry[1])) {\n entry[0] = 0;\n swapped++;\n }\n }\n }\n return swapped;\n };\n const qO = ((boundaryId) => {\n const scope = getScope();\n const resolved = getResolvedTemplate(scope, boundaryId);\n if (!resolved) {\n return;\n }\n const entry = move(scope, boundaryId, resolved);\n if (!entry) {\n return;\n }\n process(boundaryId, entry[0] || null);\n const groupId = resolved.getAttribute(Q_GROUP_ATTR);\n if (groupId) {\n const index = +(resolved.getAttribute(Q_INDEX_ATTR) || 0);\n const currentGroup = group(scope, groupId, -1, resolved.getAttribute(Q_ORDER_ATTR) || "p");\n currentGroup.r[index] = entry;\n flush(currentGroup);\n return;\n }\n reveal(entry[0] || null, entry[1]);\n });\n qO.g = (groupId, total, order) => {\n const currentGroup = group(getScope(), groupId, total, order);\n currentGroup.t = total;\n currentGroup.o = order;\n if (currentGroup.o === "r" && currentGroup.n === 0) {\n currentGroup.n = total - 1;\n }\n flush(currentGroup);\n };\n qO.d = doc;\n globalThis.qO = qO;\n};\ninstallOutOfOrderExecutor(document)`;
|
|
1058
1183
|
|
|
1059
1184
|
function getQwikLoaderScript(e = {}) {
|
|
1060
1185
|
return e.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
@@ -1072,8 +1197,16 @@ function getQwikBackpatchExecutorScript(e = {}) {
|
|
|
1072
1197
|
return e.debug ? QWIK_BACKPATCH_EXECUTOR_DEBUG : QWIK_BACKPATCH_EXECUTOR_MINIFIED;
|
|
1073
1198
|
}
|
|
1074
1199
|
|
|
1200
|
+
function getQwikOutOfOrderExecutorScript(e = {}) {
|
|
1201
|
+
if (!__EXPERIMENTAL__.suspense) {
|
|
1202
|
+
return "";
|
|
1203
|
+
}
|
|
1204
|
+
const t = e.debug ? QWIK_OUT_OF_ORDER_EXECUTOR_DEBUG : QWIK_OUT_OF_ORDER_EXECUTOR_MINIFIED;
|
|
1205
|
+
return `if(!globalThis.qO||globalThis.qO.d!==document){${t}}`;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1075
1208
|
// packages/qwik/src/server/ssr-node.ts
|
|
1076
|
-
import { _isJSXNode as
|
|
1209
|
+
import { _isJSXNode as Ai, _EMPTY_OBJ, _EFFECT_BACK_REF as _r } from "@qwik.dev/core/internal";
|
|
1077
1210
|
|
|
1078
1211
|
import { isDev as isDev7 } from "@qwik.dev/core/build";
|
|
1079
1212
|
|
|
@@ -1105,19 +1238,19 @@ var SsrNode = class {
|
|
|
1105
1238
|
attrs;
|
|
1106
1239
|
/** Local props which don't serialize; */
|
|
1107
1240
|
localProps=null;
|
|
1108
|
-
get [
|
|
1109
|
-
return this.getProp(
|
|
1241
|
+
get [_r]() {
|
|
1242
|
+
return this.getProp(Qe);
|
|
1110
1243
|
}
|
|
1111
1244
|
setProp(e, t) {
|
|
1112
1245
|
if (this.attrs === _EMPTY_OBJ) {
|
|
1113
1246
|
this.setEmptyArrayAsVNodeDataAttributes();
|
|
1114
1247
|
}
|
|
1115
|
-
if (e.startsWith(
|
|
1248
|
+
if (e.startsWith(ws)) {
|
|
1116
1249
|
(this.localProps ||= {})[e] = t;
|
|
1117
1250
|
} else {
|
|
1118
1251
|
this.attrs[e] = t;
|
|
1119
1252
|
}
|
|
1120
|
-
if (e ==
|
|
1253
|
+
if (e == ps && t) {
|
|
1121
1254
|
this.cleanupQueue.push(t);
|
|
1122
1255
|
}
|
|
1123
1256
|
}
|
|
@@ -1133,14 +1266,14 @@ var SsrNode = class {
|
|
|
1133
1266
|
}
|
|
1134
1267
|
}
|
|
1135
1268
|
getProp(e) {
|
|
1136
|
-
if (e.startsWith(
|
|
1269
|
+
if (e.startsWith(ws)) {
|
|
1137
1270
|
return this.localProps ? this.localProps[e] ?? null : null;
|
|
1138
1271
|
} else {
|
|
1139
1272
|
return this.attrs[e] ?? null;
|
|
1140
1273
|
}
|
|
1141
1274
|
}
|
|
1142
1275
|
removeProp(e) {
|
|
1143
|
-
if (e.startsWith(
|
|
1276
|
+
if (e.startsWith(ws)) {
|
|
1144
1277
|
if (this.localProps) {
|
|
1145
1278
|
delete this.localProps[e];
|
|
1146
1279
|
}
|
|
@@ -1183,7 +1316,7 @@ var SsrNode = class {
|
|
|
1183
1316
|
|
|
1184
1317
|
var DomRef = class {
|
|
1185
1318
|
constructor(e) {
|
|
1186
|
-
this.
|
|
1319
|
+
this.ne = e;
|
|
1187
1320
|
}
|
|
1188
1321
|
__brand__="DomRef";
|
|
1189
1322
|
};
|
|
@@ -1200,16 +1333,16 @@ var SsrComponentFrame = class {
|
|
|
1200
1333
|
distributeChildrenIntoSlots(e, t, n) {
|
|
1201
1334
|
this.projectionScopedStyle = t;
|
|
1202
1335
|
this.projectionComponentFrame = n;
|
|
1203
|
-
if (
|
|
1336
|
+
if (Ai(e)) {
|
|
1204
1337
|
const t = this.getSlotName(e);
|
|
1205
|
-
|
|
1338
|
+
_e(this.slots, t, e, 0);
|
|
1206
1339
|
} else if (Array.isArray(e) && e.length > 0) {
|
|
1207
1340
|
const t = [];
|
|
1208
1341
|
for (let n = 0; n < e.length; n++) {
|
|
1209
1342
|
const r = e[n];
|
|
1210
|
-
if (
|
|
1343
|
+
if (Ai(r)) {
|
|
1211
1344
|
const e = this.getSlotName(r);
|
|
1212
|
-
if (e ===
|
|
1345
|
+
if (e === QDefaultSlot) {
|
|
1213
1346
|
t.push(r);
|
|
1214
1347
|
} else {
|
|
1215
1348
|
this.updateSlot(e, r);
|
|
@@ -1218,13 +1351,13 @@ var SsrComponentFrame = class {
|
|
|
1218
1351
|
t.push(r);
|
|
1219
1352
|
}
|
|
1220
1353
|
}
|
|
1221
|
-
t.length > 0 &&
|
|
1354
|
+
t.length > 0 && _e(this.slots, QDefaultSlot, t, 0);
|
|
1222
1355
|
} else {
|
|
1223
|
-
|
|
1356
|
+
_e(this.slots, QDefaultSlot, e, 0);
|
|
1224
1357
|
}
|
|
1225
1358
|
}
|
|
1226
1359
|
updateSlot(e, t) {
|
|
1227
|
-
let n =
|
|
1360
|
+
let n = ge(this.slots, e, 0);
|
|
1228
1361
|
if (n === null) {
|
|
1229
1362
|
n = t;
|
|
1230
1363
|
} else if (Array.isArray(n)) {
|
|
@@ -1232,25 +1365,99 @@ var SsrComponentFrame = class {
|
|
|
1232
1365
|
} else {
|
|
1233
1366
|
n = [ n, t ];
|
|
1234
1367
|
}
|
|
1235
|
-
|
|
1368
|
+
_e(this.slots, e, n, 0);
|
|
1236
1369
|
}
|
|
1237
1370
|
getSlotName(e) {
|
|
1238
|
-
if (e.props[
|
|
1239
|
-
return e.props[
|
|
1371
|
+
if (e.props[De]) {
|
|
1372
|
+
return e.props[De];
|
|
1240
1373
|
}
|
|
1241
|
-
return
|
|
1374
|
+
return QDefaultSlot;
|
|
1242
1375
|
}
|
|
1243
1376
|
hasSlot(e) {
|
|
1244
|
-
return
|
|
1377
|
+
return Ee(this.slots, e, 0);
|
|
1378
|
+
}
|
|
1379
|
+
claimChildrenForSlot(e) {
|
|
1380
|
+
return mapApp_remove(this.slots, e, 0);
|
|
1245
1381
|
}
|
|
1246
1382
|
consumeChildrenForSlot(e, t) {
|
|
1247
|
-
const n =
|
|
1383
|
+
const n = this.claimChildrenForSlot(t);
|
|
1248
1384
|
this.componentNode.setProp(t, e.id);
|
|
1249
1385
|
e.setProp(QSlotParent, this.componentNode.id);
|
|
1250
1386
|
return n;
|
|
1251
1387
|
}
|
|
1252
1388
|
};
|
|
1253
1389
|
|
|
1390
|
+
// packages/qwik/src/server/ssr-stream-writer.ts
|
|
1391
|
+
var renderSSRChunks = (e, t) => {
|
|
1392
|
+
let n = "";
|
|
1393
|
+
for (let r = 0; r < e.length; r++) {
|
|
1394
|
+
const s = e[r];
|
|
1395
|
+
if (typeof s === "string") {
|
|
1396
|
+
n += s;
|
|
1397
|
+
} else {
|
|
1398
|
+
const e = s.type === "root-ref" ? s.localId : s.localPath[0];
|
|
1399
|
+
n += String(t ? t[e] ?? e : e);
|
|
1400
|
+
if (s.type !== "root-ref-path") {
|
|
1401
|
+
continue;
|
|
1402
|
+
}
|
|
1403
|
+
const r = s.localPath;
|
|
1404
|
+
for (let e = 1; e < r.length; e++) {
|
|
1405
|
+
n += " " + r[e];
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
return n;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
var StringSSRWriter = class {
|
|
1413
|
+
buffer=[];
|
|
1414
|
+
write(e) {
|
|
1415
|
+
this.buffer.push(e);
|
|
1416
|
+
}
|
|
1417
|
+
writeRootRef(e) {
|
|
1418
|
+
writeStringRootRef(this, e);
|
|
1419
|
+
}
|
|
1420
|
+
writeRootRefPath(e) {
|
|
1421
|
+
writeStringRootRefPath(this, e);
|
|
1422
|
+
}
|
|
1423
|
+
clear() {
|
|
1424
|
+
this.buffer.length = 0;
|
|
1425
|
+
}
|
|
1426
|
+
toString(e) {
|
|
1427
|
+
return this.buffer.join("");
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
var StringBufferSegmentWriter = class {
|
|
1432
|
+
chunks=[];
|
|
1433
|
+
write(e) {
|
|
1434
|
+
this.chunks.push(e);
|
|
1435
|
+
}
|
|
1436
|
+
writeRootRef(e) {
|
|
1437
|
+
this.chunks.push({
|
|
1438
|
+
type: "root-ref",
|
|
1439
|
+
localId: e
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
writeRootRefPath(e) {
|
|
1443
|
+
this.chunks.push({
|
|
1444
|
+
type: "root-ref-path",
|
|
1445
|
+
localPath: e
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
clear() {
|
|
1449
|
+
this.chunks.length = 0;
|
|
1450
|
+
}
|
|
1451
|
+
extract() {
|
|
1452
|
+
const e = this.chunks;
|
|
1453
|
+
this.chunks = [];
|
|
1454
|
+
return e;
|
|
1455
|
+
}
|
|
1456
|
+
toString(e) {
|
|
1457
|
+
return renderSSRChunks(this.chunks, e);
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1254
1461
|
// packages/qwik/src/server/tag-nesting.ts
|
|
1255
1462
|
var allowedContent = e => {
|
|
1256
1463
|
switch (e) {
|
|
@@ -1667,7 +1874,7 @@ function getBuildBase(e) {
|
|
|
1667
1874
|
}
|
|
1668
1875
|
|
|
1669
1876
|
var versions = {
|
|
1670
|
-
qwik: "2.0.0-beta.
|
|
1877
|
+
qwik: "2.0.0-beta.37-dev+82dc74d",
|
|
1671
1878
|
qwikDom: "2.1.19"
|
|
1672
1879
|
};
|
|
1673
1880
|
|
|
@@ -1736,7 +1943,7 @@ function vNodeData_createSsrNodeReference(e, t, n, r, s) {
|
|
|
1736
1943
|
i[i.length - 1]++;
|
|
1737
1944
|
}
|
|
1738
1945
|
}
|
|
1739
|
-
let a = n
|
|
1946
|
+
let a = String(n);
|
|
1740
1947
|
if (t[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
1741
1948
|
for (let e = 0; e < i.length; e++) {
|
|
1742
1949
|
const t = i[e];
|
|
@@ -1766,11 +1973,13 @@ function encodeAsAlphanumeric(e) {
|
|
|
1766
1973
|
}
|
|
1767
1974
|
|
|
1768
1975
|
// packages/qwik/src/server/ssr-container.ts
|
|
1976
|
+
var NO_SCRIPT_HERE_ELEMENTS = /* @__PURE__ */ new Set([ "script", "style", "textarea", "title", "iframe", "noframes", "noscript", "xmp", "template", "svg", "math" ]);
|
|
1977
|
+
|
|
1769
1978
|
function ssrCreateContainer(e) {
|
|
1770
1979
|
e.renderOptions ||= {};
|
|
1771
1980
|
return new SSRContainer({
|
|
1772
1981
|
tagName: e.tagName || "div",
|
|
1773
|
-
writer: e.writer || new
|
|
1982
|
+
writer: e.writer || new StringSSRWriter,
|
|
1774
1983
|
streamHandler: e.streamHandler,
|
|
1775
1984
|
locale: e.locale || "",
|
|
1776
1985
|
timing: e.timing || {
|
|
@@ -1790,24 +1999,19 @@ function ssrCreateContainer(e) {
|
|
|
1790
1999
|
});
|
|
1791
2000
|
}
|
|
1792
2001
|
|
|
1793
|
-
var
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
}
|
|
1798
|
-
toString() {
|
|
1799
|
-
return this.buffer.join("");
|
|
1800
|
-
}
|
|
2002
|
+
var noopStreamHandler = {
|
|
2003
|
+
flush() {},
|
|
2004
|
+
waitForPendingFlush() {},
|
|
2005
|
+
streamBlockStart() {},
|
|
2006
|
+
streamBlockEnd() {}
|
|
1801
2007
|
};
|
|
1802
2008
|
|
|
1803
|
-
var js = {};
|
|
1804
|
-
|
|
1805
2009
|
var QTemplateProps = {
|
|
1806
2010
|
hidden: true,
|
|
1807
2011
|
"aria-hidden": true
|
|
1808
2012
|
};
|
|
1809
2013
|
|
|
1810
|
-
var SSRContainer = class extends
|
|
2014
|
+
var SSRContainer = class extends lc {
|
|
1811
2015
|
tag;
|
|
1812
2016
|
isHtml;
|
|
1813
2017
|
writer;
|
|
@@ -1817,7 +2021,12 @@ var SSRContainer = class extends Ou {
|
|
|
1817
2021
|
resolvedManifest;
|
|
1818
2022
|
symbolToChunkResolver;
|
|
1819
2023
|
renderOptions;
|
|
2024
|
+
outOfOrderStreaming;
|
|
1820
2025
|
serializationCtx;
|
|
2026
|
+
// Sometimes there is no app state, but framework metadata still points to a vnode id.
|
|
2027
|
+
// For example, an OOOS segment can point outside the segment to a root vnode through
|
|
2028
|
+
// q:sparent, so root vnode data must still be emitted for the client ref table.
|
|
2029
|
+
hasVNodeRefsForSerialization=false;
|
|
1821
2030
|
/**
|
|
1822
2031
|
* We use this to append additional nodes in the head node
|
|
1823
2032
|
*
|
|
@@ -1835,6 +2044,7 @@ var SSRContainer = class extends Ou {
|
|
|
1835
2044
|
currentComponentNode=null;
|
|
1836
2045
|
styleIds=/* @__PURE__ */ new Set;
|
|
1837
2046
|
isBackpatchExecutorEmitted=false;
|
|
2047
|
+
isOutOfOrderExecutorEmitted=false;
|
|
1838
2048
|
backpatchMap=/* @__PURE__ */ new Map;
|
|
1839
2049
|
currentElementFrame=null;
|
|
1840
2050
|
renderTimer;
|
|
@@ -1846,16 +2056,31 @@ var SSRContainer = class extends Ou {
|
|
|
1846
2056
|
*/
|
|
1847
2057
|
depthFirstElementCount=-1;
|
|
1848
2058
|
vNodeDatas=[];
|
|
2059
|
+
vNodeDataOffset=0;
|
|
1849
2060
|
componentStack=[];
|
|
1850
2061
|
cleanupQueue=[];
|
|
1851
2062
|
emitContainerDataFrame=null;
|
|
1852
|
-
|
|
2063
|
+
Te=randomStr();
|
|
1853
2064
|
// Temporary flag to find missing roots after the state was serialized
|
|
1854
2065
|
t=false;
|
|
1855
2066
|
qlInclude;
|
|
1856
2067
|
promiseAttributes=null;
|
|
2068
|
+
vnodeSegment=null;
|
|
2069
|
+
i=0 /* NotReady */;
|
|
2070
|
+
// OOOS related fields
|
|
2071
|
+
outOfOrderId=0;
|
|
2072
|
+
outOfOrderUsed=false;
|
|
2073
|
+
outOfOrderPendingSegments=[];
|
|
2074
|
+
outOfOrderSegments=[];
|
|
2075
|
+
rootContainerReadyPromise=null;
|
|
2076
|
+
resolveRootContainerReady=null;
|
|
2077
|
+
renderQueue=Promise.resolve();
|
|
2078
|
+
emittedQwikEventNames=/* @__PURE__ */ new Set;
|
|
2079
|
+
emittedSyncFnCount=0;
|
|
2080
|
+
rootContainerSerializedRootCount=0;
|
|
2081
|
+
emittedVNodeDataOwners=null;
|
|
1857
2082
|
constructor(e) {
|
|
1858
|
-
super(e.renderOptions.serverData ??
|
|
2083
|
+
super(e.renderOptions.serverData ?? {}, e.locale);
|
|
1859
2084
|
this.symbolToChunkResolver = e => {
|
|
1860
2085
|
const t = e.lastIndexOf("_");
|
|
1861
2086
|
const n = this.resolvedManifest.mapper[t == -1 ? e : e.substring(t + 1)];
|
|
@@ -1868,19 +2093,28 @@ var SSRContainer = class extends Ou {
|
|
|
1868
2093
|
this.writer = e.writer;
|
|
1869
2094
|
this.streamHandler = e.streamHandler;
|
|
1870
2095
|
this.timing = e.timing;
|
|
1871
|
-
this.
|
|
2096
|
+
this.qe = e.buildBase;
|
|
1872
2097
|
this.resolvedManifest = e.resolvedManifest;
|
|
1873
2098
|
this.renderOptions = e.renderOptions;
|
|
1874
|
-
this.
|
|
1875
|
-
|
|
1876
|
-
|
|
2099
|
+
const t = this.renderOptions.streaming?.outOfOrder === true;
|
|
2100
|
+
if (!__EXPERIMENTAL__.suspense) {
|
|
2101
|
+
if (t) {
|
|
2102
|
+
throw new Error('Out-of-order Suspense streaming requires `experimental: ["suspense"]` in the `qwikVite` plugin.');
|
|
2103
|
+
}
|
|
2104
|
+
this.outOfOrderStreaming = false;
|
|
2105
|
+
} else {
|
|
2106
|
+
this.outOfOrderStreaming = t;
|
|
2107
|
+
}
|
|
2108
|
+
this.Pe = 1e5;
|
|
2109
|
+
const n = this.renderOptions.qwikLoader;
|
|
2110
|
+
this.qlInclude = n ? typeof n === "object" ? n.include === "never" ? 2 /* Done */ : 0 /* Module */ : n === "inline" ? 1 /* Inline */ : n === "never" ? 2 /* Done */ : 0 /* Module */ : 0 /* Module */;
|
|
1877
2111
|
if (this.qlInclude === 0 /* Module */) {
|
|
1878
2112
|
const e = this.resolvedManifest?.manifest.qwikLoader;
|
|
1879
2113
|
if (!e) {
|
|
1880
2114
|
this.qlInclude = 1 /* Inline */;
|
|
1881
2115
|
}
|
|
1882
2116
|
}
|
|
1883
|
-
this.
|
|
2117
|
+
this.v();
|
|
1884
2118
|
}
|
|
1885
2119
|
ensureProjectionResolved(e) {}
|
|
1886
2120
|
handleError(e, t) {
|
|
@@ -1905,23 +2139,158 @@ var SSRContainer = class extends Ou {
|
|
|
1905
2139
|
await this.closeContainer();
|
|
1906
2140
|
}
|
|
1907
2141
|
async renderJSX(e, t) {
|
|
1908
|
-
await
|
|
2142
|
+
await Xn(this, e, t);
|
|
2143
|
+
}
|
|
2144
|
+
A() {
|
|
2145
|
+
return this.i === 2 /* OOOSReady */;
|
|
2146
|
+
}
|
|
2147
|
+
/** Queue OOOS serialization/write work that must not overlap with root state serialization. */ S(e) {
|
|
2148
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
2149
|
+
return e();
|
|
2150
|
+
}
|
|
2151
|
+
if (this.i === 0 /* NotReady */) {
|
|
2152
|
+
return e();
|
|
2153
|
+
}
|
|
2154
|
+
const t = this.i === 1 /* DataStreamStarted */ ? this.renderQueue.then(() => this.C()).then(e) : this.renderQueue.then(e);
|
|
2155
|
+
this.renderQueue = t.catch(() => {});
|
|
2156
|
+
return t;
|
|
2157
|
+
}
|
|
2158
|
+
C() {
|
|
2159
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || this.A()) {
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
return this.rootContainerReadyPromise ||= new Promise(e => {
|
|
2163
|
+
this.resolveRootContainerReady = e;
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
I() {
|
|
2167
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || this.A()) {
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
this.rootContainerSerializedRootCount = this.serializationCtx.Yn.length;
|
|
2171
|
+
this.i = 2 /* OOOSReady */;
|
|
2172
|
+
this.resolveRootContainerReady?.();
|
|
2173
|
+
this.resolveRootContainerReady = null;
|
|
2174
|
+
this.rootContainerReadyPromise = null;
|
|
2175
|
+
}
|
|
2176
|
+
nextOutOfOrderId() {
|
|
2177
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
2178
|
+
return 0;
|
|
2179
|
+
}
|
|
2180
|
+
this.outOfOrderUsed = true;
|
|
2181
|
+
return ++this.outOfOrderId;
|
|
2182
|
+
}
|
|
2183
|
+
emitOutOfOrderSegmentScripts(e) {
|
|
2184
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !e) {
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
this.write(e);
|
|
2188
|
+
}
|
|
2189
|
+
async segment(e, t, n) {
|
|
2190
|
+
if (!__EXPERIMENTAL__.suspense) {
|
|
2191
|
+
throw new Error('Out-of-order Suspense streaming requires `experimental: ["suspense"]` in the `qwikVite` plugin.');
|
|
2192
|
+
}
|
|
2193
|
+
if (!this.outOfOrderStreaming) {
|
|
2194
|
+
throw new Error("Out-of-order Suspense streaming requires `streaming.outOfOrder` to be `true`.");
|
|
2195
|
+
}
|
|
2196
|
+
this.markVNodeRefForSerialization(n.parentComponentFrame?.componentNode);
|
|
2197
|
+
const r = new StringBufferSegmentWriter;
|
|
2198
|
+
const s = this.createSegmentContainer(e, r);
|
|
2199
|
+
this.outOfOrderSegments.push(s);
|
|
2200
|
+
try {
|
|
2201
|
+
await s.renderJSX(t, n);
|
|
2202
|
+
await s.resolvePromiseAttributes();
|
|
2203
|
+
const e = r.extract();
|
|
2204
|
+
return {
|
|
2205
|
+
container: s,
|
|
2206
|
+
writer: r,
|
|
2207
|
+
htmlChunks: e
|
|
2208
|
+
};
|
|
2209
|
+
} catch (e) {
|
|
2210
|
+
this.removeOutOfOrderSegment(s);
|
|
2211
|
+
throw e;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
F() {
|
|
2215
|
+
let e = this;
|
|
2216
|
+
while (e instanceof SSRSegmentContainer) {
|
|
2217
|
+
e = e.Re;
|
|
2218
|
+
}
|
|
2219
|
+
return e;
|
|
2220
|
+
}
|
|
2221
|
+
createSegmentContainer(e, t) {
|
|
2222
|
+
const n = this.F();
|
|
2223
|
+
const r = this.getOrCreateLastNode();
|
|
2224
|
+
this.addRoot(r);
|
|
2225
|
+
this.markVNodeRefForSerialization(r);
|
|
2226
|
+
const s = {
|
|
2227
|
+
tagNesting: 10 /* ANYTHING */ ,
|
|
2228
|
+
parent: null,
|
|
2229
|
+
elementName: "#segment",
|
|
2230
|
+
depthFirstElementIdx: -1,
|
|
2231
|
+
// OOOS inserts this synthetic root under the Suspense content host on the client.
|
|
2232
|
+
vNodeData: [ 16 /* SERIALIZE */ ],
|
|
2233
|
+
currentFile: null,
|
|
2234
|
+
refBase: r.id
|
|
2235
|
+
};
|
|
2236
|
+
const i = new SSRSegmentContainer({
|
|
2237
|
+
tagName: this.tag,
|
|
2238
|
+
writer: t,
|
|
2239
|
+
streamHandler: noopStreamHandler,
|
|
2240
|
+
locale: this.jt,
|
|
2241
|
+
timing: this.timing,
|
|
2242
|
+
buildBase: this.qe || "/build/",
|
|
2243
|
+
resolvedManifest: this.resolvedManifest,
|
|
2244
|
+
renderOptions: this.renderOptions
|
|
2245
|
+
}, n);
|
|
2246
|
+
const o = i;
|
|
2247
|
+
o.Cn = true;
|
|
2248
|
+
o.dt = this.dt;
|
|
2249
|
+
i.serializationCtx = i.serializationCtxFactory(SsrNode, DomRef, this.symbolToChunkResolver, t);
|
|
2250
|
+
i.serializationCtx.gt = this.serializationCtx.gt.bind(this.serializationCtx);
|
|
2251
|
+
i.currentElementFrame = s;
|
|
2252
|
+
i.currentComponentNode = this.currentComponentNode;
|
|
2253
|
+
i.depthFirstElementCount = 0;
|
|
2254
|
+
i.vNodeDatas = [ s.vNodeData ];
|
|
2255
|
+
i.componentStack = this.componentStack.slice();
|
|
2256
|
+
i.vnodeSegment = e;
|
|
2257
|
+
i.styleIds = this.styleIds;
|
|
2258
|
+
i.emittedQwikEventNames = this.emittedQwikEventNames;
|
|
2259
|
+
i.qlInclude = 2 /* Done */;
|
|
2260
|
+
i.Te = this.Te;
|
|
2261
|
+
o._didAddQwikLoader = true;
|
|
2262
|
+
return i;
|
|
2263
|
+
}
|
|
2264
|
+
queueOutOfOrderSegment(e) {
|
|
2265
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
this.outOfOrderPendingSegments.push(e);
|
|
2269
|
+
}
|
|
2270
|
+
removeOutOfOrderSegment(e) {
|
|
2271
|
+
const t = this.outOfOrderSegments;
|
|
2272
|
+
for (let n = 0; n < t.length; n++) {
|
|
2273
|
+
if (t[n] === e) {
|
|
2274
|
+
t.splice(n, 1);
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
1909
2278
|
}
|
|
1910
2279
|
setContext(e, t, n) {
|
|
1911
2280
|
const r = e;
|
|
1912
|
-
let s = r.getProp(
|
|
2281
|
+
let s = r.getProp(Je);
|
|
1913
2282
|
if (s == null) {
|
|
1914
|
-
r.setProp(
|
|
2283
|
+
r.setProp(Je, s = []);
|
|
1915
2284
|
}
|
|
1916
|
-
|
|
2285
|
+
_e(s, t.id, n, 0, true);
|
|
1917
2286
|
this.addRoot(r);
|
|
1918
2287
|
}
|
|
1919
2288
|
resolveContext(e, t) {
|
|
1920
2289
|
let n = e;
|
|
1921
2290
|
while (n) {
|
|
1922
|
-
const e = n.getProp(
|
|
1923
|
-
if (e != null &&
|
|
1924
|
-
return
|
|
2291
|
+
const e = n.getProp(Je);
|
|
2292
|
+
if (e != null && Ee(e, t.id, 0)) {
|
|
2293
|
+
return ge(e, t.id, 0);
|
|
1925
2294
|
}
|
|
1926
2295
|
n = n.parentComponent;
|
|
1927
2296
|
}
|
|
@@ -1948,15 +2317,15 @@ var SSRContainer = class extends Ou {
|
|
|
1948
2317
|
}
|
|
1949
2318
|
const e = this.renderOptions.containerAttributes || {};
|
|
1950
2319
|
const t = e[QRenderAttr];
|
|
1951
|
-
e[
|
|
2320
|
+
e[es] = "paused" /* PAUSED */;
|
|
1952
2321
|
e[QRuntimeAttr] = "2";
|
|
1953
|
-
e[QVersionAttr] = this.
|
|
2322
|
+
e[QVersionAttr] = this.ke ?? "dev";
|
|
1954
2323
|
e[QRenderAttr] = (t ? t + "-" : "") + (isDev8 ? "ssr-dev" : "ssr");
|
|
1955
|
-
e[
|
|
1956
|
-
e[QLocaleAttr] = this.
|
|
2324
|
+
e[Ge] = this.qe || "";
|
|
2325
|
+
e[QLocaleAttr] = this.jt;
|
|
1957
2326
|
e[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
|
|
1958
|
-
e[QInstanceAttr] = this.
|
|
1959
|
-
this.
|
|
2327
|
+
e[QInstanceAttr] = this.Te;
|
|
2328
|
+
this.Dt.containerAttributes = e;
|
|
1960
2329
|
this.openElement(this.tag, null, e);
|
|
1961
2330
|
if (!this.isHtml) {
|
|
1962
2331
|
this.emitContainerDataFrame = this.currentElementFrame;
|
|
@@ -1965,18 +2334,18 @@ var SSRContainer = class extends Ou {
|
|
|
1965
2334
|
/** Renders closing tag for current container */ closeContainer() {
|
|
1966
2335
|
return this.closeElement();
|
|
1967
2336
|
}
|
|
1968
|
-
|
|
2337
|
+
qt=0;
|
|
1969
2338
|
/** Renders opening tag for DOM element */
|
|
1970
2339
|
openElement(e, t, n, r = null, s = null, i = null, o = true) {
|
|
1971
2340
|
const a = isQwikStyleElement(e, n) || isQwikStyleElement(e, r);
|
|
1972
|
-
if (e
|
|
1973
|
-
this.
|
|
2341
|
+
if (NO_SCRIPT_HERE_ELEMENTS.has(e)) {
|
|
2342
|
+
this.qt++;
|
|
1974
2343
|
}
|
|
1975
2344
|
if (
|
|
1976
2345
|
// don't append qwik loader before qwik style elements
|
|
1977
2346
|
// it will confuse the resuming, because styles are expected to be the first nodes in subtree
|
|
1978
2347
|
!a && this.qlInclude === 1 /* Inline */) {
|
|
1979
|
-
if (this.
|
|
2348
|
+
if (this.qt === 0 && this.size > 30 * 1024 && e !== "body") {
|
|
1980
2349
|
this.emitQwikLoaderInline();
|
|
1981
2350
|
}
|
|
1982
2351
|
}
|
|
@@ -1996,13 +2365,13 @@ var SSRContainer = class extends Ou {
|
|
|
1996
2365
|
if (n) {
|
|
1997
2366
|
l = this.writeAttrs(e, n, false, s, i, o);
|
|
1998
2367
|
}
|
|
1999
|
-
this.write(" " +
|
|
2368
|
+
this.write(" " + Es);
|
|
2000
2369
|
if (t !== null) {
|
|
2001
2370
|
this.write(`="${t}"`);
|
|
2002
2371
|
} else if (qTest) {
|
|
2003
2372
|
this.write(EMPTY_ATTR);
|
|
2004
2373
|
}
|
|
2005
|
-
if (r && !
|
|
2374
|
+
if (r && !dr(r)) {
|
|
2006
2375
|
l = this.writeAttrs(e, r, true, s, i, o) || l;
|
|
2007
2376
|
}
|
|
2008
2377
|
this.write(GT);
|
|
@@ -2016,7 +2385,7 @@ var SSRContainer = class extends Ou {
|
|
|
2016
2385
|
this.emitContainerDataFrame = null;
|
|
2017
2386
|
this.onRenderDone();
|
|
2018
2387
|
const e = createTimer();
|
|
2019
|
-
return
|
|
2388
|
+
return qs(qs(this.emitContainerData(), () => this._closeElement()), () => {
|
|
2020
2389
|
this.timing.snapshot = e();
|
|
2021
2390
|
});
|
|
2022
2391
|
}
|
|
@@ -2032,7 +2401,7 @@ var SSRContainer = class extends Ou {
|
|
|
2032
2401
|
for (let t = 0; t < e.length; t++) {
|
|
2033
2402
|
const n = e[t];
|
|
2034
2403
|
if (hasDestroy(n)) {
|
|
2035
|
-
n.
|
|
2404
|
+
n.Tn();
|
|
2036
2405
|
}
|
|
2037
2406
|
}
|
|
2038
2407
|
e = this.cleanupQueue.pop();
|
|
@@ -2047,8 +2416,8 @@ var SSRContainer = class extends Ou {
|
|
|
2047
2416
|
this.write(GT);
|
|
2048
2417
|
}
|
|
2049
2418
|
this.lastNode = null;
|
|
2050
|
-
if (t
|
|
2051
|
-
this.
|
|
2419
|
+
if (NO_SCRIPT_HERE_ELEMENTS.has(t)) {
|
|
2420
|
+
this.qt--;
|
|
2052
2421
|
}
|
|
2053
2422
|
}
|
|
2054
2423
|
/** Writes opening data to vNodeData for fragment boundaries */ openFragment(e) {
|
|
@@ -2067,7 +2436,13 @@ var SSRContainer = class extends Ou {
|
|
|
2067
2436
|
this.openFragment(e);
|
|
2068
2437
|
const t = this.getComponentFrame();
|
|
2069
2438
|
if (t) {
|
|
2070
|
-
this.
|
|
2439
|
+
const e = this.getOrCreateLastNode();
|
|
2440
|
+
this.markVNodeRefForSerialization(e);
|
|
2441
|
+
if (!this.vnodeSegment) {
|
|
2442
|
+
this.addRoot(t.componentNode);
|
|
2443
|
+
} else {
|
|
2444
|
+
this.markVNodeRefForSerialization(t.componentNode);
|
|
2445
|
+
}
|
|
2071
2446
|
t.projectionDepth++;
|
|
2072
2447
|
}
|
|
2073
2448
|
}
|
|
@@ -2108,21 +2483,24 @@ var SSRContainer = class extends Ou {
|
|
|
2108
2483
|
if (e.slots.length === 0) {
|
|
2109
2484
|
return;
|
|
2110
2485
|
}
|
|
2111
|
-
this.openElement(
|
|
2486
|
+
this.openElement(is, null, QTemplateProps, null);
|
|
2112
2487
|
const t = e.projectionScopedStyle;
|
|
2113
2488
|
for (let n = 0; n < e.slots.length; n += 2) {
|
|
2114
2489
|
const r = e.slots[n];
|
|
2115
2490
|
const s = e.slots[n + 1];
|
|
2491
|
+
if (this.vnodeSegment) {
|
|
2492
|
+
this.markVNodeRefForSerialization(e.componentNode);
|
|
2493
|
+
}
|
|
2116
2494
|
this.openFragment(isDev8 ? {
|
|
2117
|
-
[
|
|
2118
|
-
[QSlotParent]: e.componentNode.id
|
|
2495
|
+
[xe]: "P" /* Projection */ ,
|
|
2496
|
+
[QSlotParent]: e.componentNode.id,
|
|
2497
|
+
[De]: r
|
|
2119
2498
|
} : {
|
|
2120
|
-
[QSlotParent]: e.componentNode.id
|
|
2499
|
+
[QSlotParent]: e.componentNode.id,
|
|
2500
|
+
[De]: r
|
|
2121
2501
|
});
|
|
2122
2502
|
const i = this.getOrCreateLastNode();
|
|
2123
|
-
|
|
2124
|
-
i.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
2125
|
-
}
|
|
2503
|
+
i.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
2126
2504
|
e.componentNode.setProp(r, i.id);
|
|
2127
2505
|
await this.renderJSX(s, {
|
|
2128
2506
|
currentStyleScoped: t,
|
|
@@ -2145,29 +2523,31 @@ var SSRContainer = class extends Ou {
|
|
|
2145
2523
|
}
|
|
2146
2524
|
addRoot(e) {
|
|
2147
2525
|
if (this.t) {
|
|
2148
|
-
|
|
2526
|
+
const t = this.serializationCtx.ge(e);
|
|
2527
|
+
return t;
|
|
2149
2528
|
}
|
|
2150
2529
|
return this.serializationCtx.St(e);
|
|
2151
2530
|
}
|
|
2152
2531
|
getOrCreateLastNode() {
|
|
2153
2532
|
if (!this.lastNode) {
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
this.
|
|
2533
|
+
const e = this.currentElementFrame;
|
|
2534
|
+
const t = e.depthFirstElementIdx + 1;
|
|
2535
|
+
const n = e.refBase ?? (this.vnodeSegment ? je(this.vnodeSegment, t) : t + this.vNodeDataOffset);
|
|
2536
|
+
this.lastNode = vNodeData_createSsrNodeReference(this.currentComponentNode, e.vNodeData, n, this.cleanupQueue, e.currentFile);
|
|
2157
2537
|
}
|
|
2158
2538
|
return this.lastNode;
|
|
2159
2539
|
}
|
|
2160
2540
|
addUnclaimedProjection(e, t, n) {
|
|
2161
2541
|
e.slots.push(t, n);
|
|
2162
2542
|
}
|
|
2163
|
-
|
|
2543
|
+
v() {
|
|
2164
2544
|
const e = this.resolvedManifest.manifest.injections;
|
|
2165
2545
|
if (!e) {
|
|
2166
2546
|
return;
|
|
2167
2547
|
}
|
|
2168
2548
|
for (let t = 0; t < e.length; t++) {
|
|
2169
2549
|
const n = e[t];
|
|
2170
|
-
const r =
|
|
2550
|
+
const r = Wi(n.tag, null, n.attributes || {}, null, 0, null);
|
|
2171
2551
|
if (n.location === "head") {
|
|
2172
2552
|
this.additionalHeadNodes.push(r);
|
|
2173
2553
|
} else {
|
|
@@ -2175,19 +2555,19 @@ var SSRContainer = class extends Ou {
|
|
|
2175
2555
|
}
|
|
2176
2556
|
}
|
|
2177
2557
|
}
|
|
2178
|
-
|
|
2558
|
+
Xe(e, t, n, r) {
|
|
2179
2559
|
if (r) {
|
|
2180
2560
|
const e = this.getComponentFrame(0);
|
|
2181
2561
|
e.scopedStyleIds.add(t);
|
|
2182
2562
|
const r = convertStyleIdsToString(e.scopedStyleIds);
|
|
2183
|
-
this.setHostProp(n,
|
|
2563
|
+
this.setHostProp(n, He, r);
|
|
2184
2564
|
}
|
|
2185
2565
|
if (!this.styleIds.has(t)) {
|
|
2186
2566
|
this.styleIds.add(t);
|
|
2187
2567
|
if (this.currentElementFrame?.elementName === "html") {
|
|
2188
|
-
this.additionalHeadNodes.push(
|
|
2568
|
+
this.additionalHeadNodes.push(Di("style", null, {
|
|
2189
2569
|
dangerouslySetInnerHTML: e,
|
|
2190
|
-
[
|
|
2570
|
+
[Ue]: t
|
|
2191
2571
|
}, null, 0, t));
|
|
2192
2572
|
} else {
|
|
2193
2573
|
this._styleNode(t, e);
|
|
@@ -2196,24 +2576,64 @@ var SSRContainer = class extends Ou {
|
|
|
2196
2576
|
}
|
|
2197
2577
|
_styleNode(e, t) {
|
|
2198
2578
|
this.openElement("style", null, {
|
|
2199
|
-
[
|
|
2579
|
+
[Ue]: e
|
|
2200
2580
|
});
|
|
2201
2581
|
this.write(t);
|
|
2202
2582
|
this.closeElement();
|
|
2203
2583
|
}
|
|
2584
|
+
ut(e) {
|
|
2585
|
+
if (this.isHtml && this.currentElementFrame?.elementName === "html") {
|
|
2586
|
+
this.additionalHeadNodes.push(e);
|
|
2587
|
+
return true;
|
|
2588
|
+
}
|
|
2589
|
+
return false;
|
|
2590
|
+
}
|
|
2204
2591
|
////////////////////////////////////
|
|
2205
2592
|
emitContainerData() {
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2593
|
+
const e = this.renderOptions.streaming?.inOrder?.strategy === "disabled";
|
|
2594
|
+
const t = !e || __EXPERIMENTAL__.suspense && this.outOfOrderStreaming && this.outOfOrderUsed;
|
|
2595
|
+
return qs(qs(t ? this.streamHandler.flush() : void 0, () => this.resolvePromiseAttributes()), () => {
|
|
2596
|
+
this.i = 1 /* DataStreamStarted */;
|
|
2597
|
+
return qs(this.emitStateData(), () => {
|
|
2598
|
+
this.t = true;
|
|
2599
|
+
return qs(this.emitRestStateData(), () => this.emitOutOfOrderSegmentsAndData());
|
|
2600
|
+
});
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
emitRestStateData() {
|
|
2604
|
+
this.emitVNodeData();
|
|
2605
|
+
this.emitDelayedOutOfOrderSegmentVNodeData();
|
|
2606
|
+
if (!isDev8) {
|
|
2607
|
+
preloaderPost(this, this.renderOptions, this.Dt?.nonce);
|
|
2608
|
+
}
|
|
2609
|
+
this.emitSyncFnsData();
|
|
2610
|
+
this.emitPatchDataIfNeeded();
|
|
2611
|
+
this.emitExecutorIfNeeded();
|
|
2612
|
+
this.emitQwikLoaderAtBottomIfNeeded();
|
|
2613
|
+
}
|
|
2614
|
+
emitDelayedOutOfOrderSegmentVNodeData() {
|
|
2615
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2618
|
+
for (let e = 0; e < this.outOfOrderSegments.length; e++) {
|
|
2619
|
+
const t = this.outOfOrderSegments[e];
|
|
2620
|
+
if (t.Qe === 1 /* EarlyFinalized */) {
|
|
2621
|
+
t.He();
|
|
2622
|
+
e--;
|
|
2211
2623
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
emitOutOfOrderSegmentsAndData() {
|
|
2627
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
this.emitOutOfOrderExecutorIfNeeded();
|
|
2631
|
+
return qs(this.streamHandler.flush(), async () => {
|
|
2632
|
+
this.I();
|
|
2633
|
+
if (this.outOfOrderPendingSegments.length) {
|
|
2634
|
+
await Promise.all(this.outOfOrderPendingSegments);
|
|
2635
|
+
}
|
|
2636
|
+
});
|
|
2217
2637
|
}
|
|
2218
2638
|
/**
|
|
2219
2639
|
* Serialize the vNodeData into a string and emit it as a script tag.
|
|
@@ -2232,50 +2652,59 @@ var SSRContainer = class extends Ou {
|
|
|
2232
2652
|
*
|
|
2233
2653
|
* NOTE: Not every element will need vNodeData. So we need to encode how many elements should be
|
|
2234
2654
|
* skipped. By choosing different separators we can encode different numbers of elements to skip.
|
|
2235
|
-
*/ emitVNodeData() {
|
|
2236
|
-
|
|
2655
|
+
*/ emitVNodeData(e) {
|
|
2656
|
+
this.F().markVNodeDataOwnerEmitted(e);
|
|
2657
|
+
if (!e && !this.serializationCtx.Yn.length && !this.hasVNodeRefsForSerialization) {
|
|
2237
2658
|
return;
|
|
2238
2659
|
}
|
|
2239
|
-
this.
|
|
2660
|
+
this.emitVNodeDataScript(e, this.vNodeDatas.entries());
|
|
2661
|
+
}
|
|
2662
|
+
emitVNodeDataScript(e, t, n = false) {
|
|
2663
|
+
const r = {
|
|
2240
2664
|
type: "qwik/vnode"
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2665
|
+
};
|
|
2666
|
+
if (__EXPERIMENTAL__.suspense && this.outOfOrderStreaming && e) {
|
|
2667
|
+
r[Ph] = e;
|
|
2668
|
+
}
|
|
2669
|
+
if (n) {
|
|
2670
|
+
r[QStatePatchAttr] = true;
|
|
2671
|
+
}
|
|
2672
|
+
this.openScript(r);
|
|
2673
|
+
const s = [];
|
|
2674
|
+
let i = 0;
|
|
2675
|
+
for (const [e, n] of t) {
|
|
2676
|
+
const t = n[0];
|
|
2677
|
+
if (t & 16 /* SERIALIZE */) {
|
|
2678
|
+
i = this.emitVNodeSeparators(i, e);
|
|
2679
|
+
if (t & 8 /* REFERENCE */) {
|
|
2251
2680
|
this.write(VNodeDataSeparator.REFERENCE_CH);
|
|
2252
2681
|
}
|
|
2253
|
-
if (
|
|
2254
|
-
let
|
|
2255
|
-
let
|
|
2256
|
-
for (let r = 1; r <
|
|
2257
|
-
const i =
|
|
2682
|
+
if (t & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
|
|
2683
|
+
let e = null;
|
|
2684
|
+
let t = 0;
|
|
2685
|
+
for (let r = 1; r < n.length; r++) {
|
|
2686
|
+
const i = n[r];
|
|
2258
2687
|
if (typeof i === "object" && i !== null) {
|
|
2259
|
-
|
|
2260
|
-
|
|
2688
|
+
s.push(e);
|
|
2689
|
+
e = i;
|
|
2261
2690
|
} else if (i === OPEN_FRAGMENT) {
|
|
2262
|
-
|
|
2691
|
+
t++;
|
|
2263
2692
|
this.write(VNodeDataChar.OPEN_CHAR);
|
|
2264
2693
|
} else if (i === CLOSE_FRAGMENT) {
|
|
2265
|
-
if (
|
|
2266
|
-
this.writeFragmentAttrs(
|
|
2267
|
-
|
|
2694
|
+
if (e) {
|
|
2695
|
+
this.writeFragmentAttrs(e);
|
|
2696
|
+
e = s.pop();
|
|
2268
2697
|
}
|
|
2269
|
-
|
|
2698
|
+
t--;
|
|
2270
2699
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
2271
2700
|
} else if (i === WRITE_ELEMENT_ATTRS) {
|
|
2272
|
-
if (
|
|
2701
|
+
if (e && !dr(e)) {
|
|
2273
2702
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2274
2703
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2275
|
-
this.writeFragmentAttrs(
|
|
2704
|
+
this.writeFragmentAttrs(e);
|
|
2276
2705
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2277
2706
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2278
|
-
|
|
2707
|
+
e = s.pop();
|
|
2279
2708
|
}
|
|
2280
2709
|
} else if (i >= 0) {
|
|
2281
2710
|
this.write(encodeAsAlphanumeric(i));
|
|
@@ -2283,60 +2712,101 @@ var SSRContainer = class extends Ou {
|
|
|
2283
2712
|
this.write(String(0 - i));
|
|
2284
2713
|
}
|
|
2285
2714
|
}
|
|
2286
|
-
while (
|
|
2287
|
-
if (
|
|
2288
|
-
this.writeFragmentAttrs(
|
|
2289
|
-
|
|
2715
|
+
while (t-- > 0) {
|
|
2716
|
+
if (e) {
|
|
2717
|
+
this.writeFragmentAttrs(e);
|
|
2718
|
+
e = s.pop();
|
|
2290
2719
|
}
|
|
2291
2720
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
2292
2721
|
}
|
|
2293
2722
|
}
|
|
2294
2723
|
}
|
|
2295
2724
|
}
|
|
2296
|
-
this.
|
|
2725
|
+
this.closeScript();
|
|
2726
|
+
if (n && !e) {
|
|
2727
|
+
this.emitInlineScript("document.qProcessVNodeDataPatch&&document.qProcessVNodeDataPatch(document.currentScript.previousElementSibling)");
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
markVNodeRefForSerialization(e) {
|
|
2731
|
+
if (e) {
|
|
2732
|
+
this.hasVNodeRefsForSerialization = true;
|
|
2733
|
+
e.vnodeData[0] |= 16 /* SERIALIZE */ | 8 /* REFERENCE */;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
markVNodeDataOwnerEmitted(e) {
|
|
2737
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
2738
|
+
return;
|
|
2739
|
+
}
|
|
2740
|
+
(this.emittedVNodeDataOwners ||= /* @__PURE__ */ new Set).add(e);
|
|
2741
|
+
}
|
|
2742
|
+
isVNodeDataOwnerEmitted(e) {
|
|
2743
|
+
return this.emittedVNodeDataOwners?.has(e) === true;
|
|
2744
|
+
}
|
|
2745
|
+
getVNodeDataOwnerFromNodeId(e) {
|
|
2746
|
+
const t = parseInt(e, 10);
|
|
2747
|
+
if (t >= 0) {
|
|
2748
|
+
return {
|
|
2749
|
+
owner: void 0,
|
|
2750
|
+
localIndex: t
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
const n = -t - 1;
|
|
2754
|
+
const r = Math.floor((Math.sqrt(8 * n + 1) - 1) / 2);
|
|
2755
|
+
const s = r * (r + 1) / 2;
|
|
2756
|
+
const i = n - s;
|
|
2757
|
+
const o = r - i;
|
|
2758
|
+
return {
|
|
2759
|
+
owner: String(o + 1),
|
|
2760
|
+
localIndex: i
|
|
2761
|
+
};
|
|
2297
2762
|
}
|
|
2298
2763
|
writeFragmentAttrs(e) {
|
|
2299
2764
|
for (const t in e) {
|
|
2300
|
-
|
|
2301
|
-
let r =
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2765
|
+
const n = e[t];
|
|
2766
|
+
let r = n;
|
|
2767
|
+
let s;
|
|
2768
|
+
let i = null;
|
|
2769
|
+
if (t === as && typeof n === "number") {
|
|
2770
|
+
s = n;
|
|
2771
|
+
r = String(n);
|
|
2772
|
+
} else if (typeof n !== "string") {
|
|
2773
|
+
s = this.addRoot(n);
|
|
2774
|
+
if (s === void 0) {
|
|
2305
2775
|
continue;
|
|
2306
2776
|
}
|
|
2307
|
-
|
|
2777
|
+
r = String(s);
|
|
2308
2778
|
}
|
|
2309
2779
|
switch (t) {
|
|
2310
|
-
case
|
|
2780
|
+
case He:
|
|
2311
2781
|
this.write(VNodeDataChar.SCOPED_STYLE_CHAR);
|
|
2312
2782
|
break;
|
|
2313
2783
|
|
|
2314
|
-
case
|
|
2784
|
+
case Le:
|
|
2315
2785
|
this.write(VNodeDataChar.RENDER_FN_CHAR);
|
|
2316
2786
|
break;
|
|
2317
2787
|
|
|
2318
|
-
case
|
|
2788
|
+
case as:
|
|
2319
2789
|
this.write(VNodeDataChar.ID_CHAR);
|
|
2320
2790
|
break;
|
|
2321
2791
|
|
|
2322
|
-
case
|
|
2792
|
+
case ds:
|
|
2323
2793
|
this.write(VNodeDataChar.PROPS_CHAR);
|
|
2324
2794
|
break;
|
|
2325
2795
|
|
|
2326
|
-
case
|
|
2327
|
-
|
|
2796
|
+
case hs:
|
|
2797
|
+
i = encodeVNodeDataKey;
|
|
2328
2798
|
this.write(VNodeDataChar.KEY_CHAR);
|
|
2329
2799
|
break;
|
|
2330
2800
|
|
|
2331
|
-
case
|
|
2801
|
+
case ps:
|
|
2332
2802
|
this.write(VNodeDataChar.SEQ_CHAR);
|
|
2333
2803
|
break;
|
|
2334
2804
|
|
|
2335
|
-
case
|
|
2805
|
+
case $s:
|
|
2336
2806
|
this.write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
2337
2807
|
break;
|
|
2338
2808
|
|
|
2339
|
-
case
|
|
2809
|
+
case Qe:
|
|
2340
2810
|
this.write(VNodeDataChar.BACK_REFS_CHAR);
|
|
2341
2811
|
break;
|
|
2342
2812
|
|
|
@@ -2345,68 +2815,86 @@ var SSRContainer = class extends Ou {
|
|
|
2345
2815
|
break;
|
|
2346
2816
|
|
|
2347
2817
|
// Skipping `\` character for now because it is used for escaping.
|
|
2348
|
-
case
|
|
2818
|
+
case Je:
|
|
2349
2819
|
this.write(VNodeDataChar.CONTEXT_CHAR);
|
|
2350
2820
|
break;
|
|
2351
2821
|
|
|
2352
|
-
case
|
|
2822
|
+
case De:
|
|
2353
2823
|
this.write(VNodeDataChar.SLOT_CHAR);
|
|
2354
2824
|
break;
|
|
2355
2825
|
|
|
2356
2826
|
default:
|
|
2357
2827
|
{
|
|
2358
|
-
|
|
2828
|
+
i = encodeURI;
|
|
2359
2829
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2360
2830
|
this.write(encodeVNodeDataString(t));
|
|
2361
2831
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2362
2832
|
}
|
|
2363
2833
|
}
|
|
2364
|
-
const
|
|
2365
|
-
const
|
|
2366
|
-
if (
|
|
2834
|
+
const o = encodeVNodeDataString(i ? i(r) : r);
|
|
2835
|
+
const a = i ? o !== r : false;
|
|
2836
|
+
if (a) {
|
|
2367
2837
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2368
|
-
this.write(
|
|
2838
|
+
this.write(o);
|
|
2369
2839
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2840
|
+
} else if (typeof s === "number") {
|
|
2841
|
+
this.writeRootRef(s);
|
|
2370
2842
|
} else {
|
|
2371
|
-
this.write(
|
|
2843
|
+
this.write(r);
|
|
2372
2844
|
}
|
|
2373
2845
|
}
|
|
2374
2846
|
}
|
|
2375
2847
|
emitStateData() {
|
|
2376
|
-
if (!this.serializationCtx.
|
|
2848
|
+
if (!this.serializationCtx.Yn.length) {
|
|
2377
2849
|
return;
|
|
2378
2850
|
}
|
|
2379
2851
|
const e = this.stateScriptAttrs();
|
|
2380
|
-
this.
|
|
2381
|
-
|
|
2382
|
-
|
|
2852
|
+
this.openScript(e);
|
|
2853
|
+
this.serializationCtx.Bn(this.writer);
|
|
2854
|
+
return qs(this.serializationCtx.It(), () => {
|
|
2855
|
+
this.closeScript();
|
|
2383
2856
|
});
|
|
2384
2857
|
}
|
|
2385
2858
|
/** Add q-d:qidle attribute to eagerly resume some state if needed */ stateScriptAttrs() {
|
|
2386
2859
|
const e = {
|
|
2387
|
-
type: "qwik/state"
|
|
2860
|
+
type: "qwik/state",
|
|
2861
|
+
[QInstanceAttr]: this.Te
|
|
2388
2862
|
};
|
|
2389
|
-
const t = this.serializationCtx.
|
|
2863
|
+
const t = this.serializationCtx.Tt;
|
|
2390
2864
|
if (t.size > 0) {
|
|
2391
|
-
e["q-d:qidle"] =
|
|
2865
|
+
e["q-d:qidle"] = xf(null, "_res", _, null, [ ...t ]);
|
|
2392
2866
|
}
|
|
2393
2867
|
return e;
|
|
2394
2868
|
}
|
|
2395
|
-
emitSyncFnsData() {
|
|
2396
|
-
const
|
|
2397
|
-
|
|
2398
|
-
|
|
2869
|
+
emitSyncFnsData(e = false) {
|
|
2870
|
+
const t = this.serializationCtx.$e;
|
|
2871
|
+
const n = e ? this.emittedSyncFnCount : 0;
|
|
2872
|
+
if (t.length > n) {
|
|
2873
|
+
const r = {
|
|
2399
2874
|
"q:func": "qwik/json"
|
|
2400
2875
|
};
|
|
2401
2876
|
if (this.renderOptions.serverData?.nonce) {
|
|
2402
|
-
|
|
2877
|
+
r["nonce"] = this.renderOptions.serverData.nonce;
|
|
2403
2878
|
}
|
|
2404
|
-
this.
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2879
|
+
this.openScript(r);
|
|
2880
|
+
if (e) {
|
|
2881
|
+
const e = Q_FUNCS_PREFIX.replace("HASH", this.Te).slice(0, -1);
|
|
2882
|
+
this.write(`(${e}||(${e}=[])).push(`);
|
|
2883
|
+
} else {
|
|
2884
|
+
this.write(Q_FUNCS_PREFIX.replace("HASH", this.Te));
|
|
2885
|
+
}
|
|
2886
|
+
if (!e) {
|
|
2887
|
+
this.write(yr);
|
|
2888
|
+
}
|
|
2889
|
+
this.writeArray(e ? t.slice(n) : t, wr);
|
|
2890
|
+
if (!e) {
|
|
2891
|
+
this.write(mr);
|
|
2892
|
+
}
|
|
2893
|
+
if (e) {
|
|
2894
|
+
this.write(")");
|
|
2895
|
+
}
|
|
2896
|
+
this.closeScript();
|
|
2897
|
+
this.emittedSyncFnCount = t.length;
|
|
2410
2898
|
}
|
|
2411
2899
|
}
|
|
2412
2900
|
emitPatchDataIfNeeded() {
|
|
@@ -2414,7 +2902,7 @@ var SSRContainer = class extends Ou {
|
|
|
2414
2902
|
for (const [t, n] of this.backpatchMap) {
|
|
2415
2903
|
for (let r = 0; r < n.length; r++) {
|
|
2416
2904
|
const s = n[r];
|
|
2417
|
-
e.push(t, s.attrName,
|
|
2905
|
+
e.push(t, s.attrName, lu(s.value) ? s.value.untrackedValue : s.value);
|
|
2418
2906
|
}
|
|
2419
2907
|
}
|
|
2420
2908
|
this.backpatchMap.clear();
|
|
@@ -2426,27 +2914,67 @@ var SSRContainer = class extends Ou {
|
|
|
2426
2914
|
if (this.renderOptions.serverData?.nonce) {
|
|
2427
2915
|
t["nonce"] = this.renderOptions.serverData.nonce;
|
|
2428
2916
|
}
|
|
2429
|
-
this.
|
|
2430
|
-
this.write(JSON.stringify(e));
|
|
2431
|
-
this.closeElement();
|
|
2917
|
+
this.writeScript(t, JSON.stringify(e));
|
|
2432
2918
|
}
|
|
2433
2919
|
}
|
|
2920
|
+
emitBackpatchDataAndExecutorIfNeeded() {
|
|
2921
|
+
if (this.backpatchMap.size === 0) {
|
|
2922
|
+
return;
|
|
2923
|
+
}
|
|
2924
|
+
this.emitPatchDataIfNeeded();
|
|
2925
|
+
this.emitExecutorIfNeeded();
|
|
2926
|
+
}
|
|
2434
2927
|
emitExecutorIfNeeded() {
|
|
2435
2928
|
if (!this.isBackpatchExecutorEmitted) {
|
|
2436
2929
|
return;
|
|
2437
2930
|
}
|
|
2931
|
+
this.isBackpatchExecutorEmitted = false;
|
|
2438
2932
|
const e = {
|
|
2439
2933
|
type: "text/javascript"
|
|
2440
2934
|
};
|
|
2441
2935
|
if (this.renderOptions.serverData?.nonce) {
|
|
2442
2936
|
e["nonce"] = this.renderOptions.serverData.nonce;
|
|
2443
2937
|
}
|
|
2444
|
-
this.openElement("script", null, e);
|
|
2445
2938
|
const t = getQwikBackpatchExecutorScript({
|
|
2446
2939
|
debug: isDev8
|
|
2447
2940
|
});
|
|
2448
|
-
this.
|
|
2449
|
-
|
|
2941
|
+
this.writeScript(e, t);
|
|
2942
|
+
}
|
|
2943
|
+
emitOutOfOrderExecutorIfNeeded() {
|
|
2944
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed || this.isOutOfOrderExecutorEmitted) {
|
|
2945
|
+
return;
|
|
2946
|
+
}
|
|
2947
|
+
this.isOutOfOrderExecutorEmitted = true;
|
|
2948
|
+
this.writeScript({
|
|
2949
|
+
type: "text/javascript",
|
|
2950
|
+
nonce: this.renderOptions.serverData?.nonce
|
|
2951
|
+
}, getQwikOutOfOrderExecutorScript({
|
|
2952
|
+
debug: isDev8
|
|
2953
|
+
}));
|
|
2954
|
+
}
|
|
2955
|
+
emitInlineScript(e) {
|
|
2956
|
+
const t = {
|
|
2957
|
+
type: "text/javascript"
|
|
2958
|
+
};
|
|
2959
|
+
if (this.renderOptions.serverData?.nonce) {
|
|
2960
|
+
t["nonce"] = this.renderOptions.serverData.nonce;
|
|
2961
|
+
}
|
|
2962
|
+
this.writeScript(t, e);
|
|
2963
|
+
}
|
|
2964
|
+
writeScript(e, t) {
|
|
2965
|
+
this.openScript(e);
|
|
2966
|
+
if (t) {
|
|
2967
|
+
this.write(t);
|
|
2968
|
+
}
|
|
2969
|
+
this.closeScript();
|
|
2970
|
+
}
|
|
2971
|
+
openScript(e) {
|
|
2972
|
+
this.write("<script");
|
|
2973
|
+
this.writeAttrs("script", e, true, null, null, true);
|
|
2974
|
+
this.write(GT);
|
|
2975
|
+
}
|
|
2976
|
+
closeScript() {
|
|
2977
|
+
this.write("<\/script>");
|
|
2450
2978
|
}
|
|
2451
2979
|
emitPreloaderPre() {
|
|
2452
2980
|
if (!isDev8) {
|
|
@@ -2454,12 +2982,12 @@ var SSRContainer = class extends Ou {
|
|
|
2454
2982
|
}
|
|
2455
2983
|
}
|
|
2456
2984
|
isStatic() {
|
|
2457
|
-
return this.serializationCtx.
|
|
2985
|
+
return !(__EXPERIMENTAL__.suspense && this.outOfOrderStreaming && this.outOfOrderUsed) && this.serializationCtx.xt.size === 0;
|
|
2458
2986
|
}
|
|
2459
2987
|
emitQwikLoaderAtTopIfNeeded() {
|
|
2460
2988
|
if (this.qlInclude === 0 /* Module */) {
|
|
2461
2989
|
this.qlInclude = 2 /* Done */;
|
|
2462
|
-
const e = this.
|
|
2990
|
+
const e = this.qe + this.resolvedManifest.manifest.qwikLoader;
|
|
2463
2991
|
const t = {
|
|
2464
2992
|
rel: "modulepreload",
|
|
2465
2993
|
href: e
|
|
@@ -2478,8 +3006,7 @@ var SSRContainer = class extends Ou {
|
|
|
2478
3006
|
if (n) {
|
|
2479
3007
|
r["nonce"] = n;
|
|
2480
3008
|
}
|
|
2481
|
-
this.
|
|
2482
|
-
this.closeElement();
|
|
3009
|
+
this.writeScript(r);
|
|
2483
3010
|
}
|
|
2484
3011
|
}
|
|
2485
3012
|
emitQwikLoaderInline() {
|
|
@@ -2495,18 +3022,29 @@ var SSRContainer = class extends Ou {
|
|
|
2495
3022
|
if (this.renderOptions.serverData?.nonce) {
|
|
2496
3023
|
t["nonce"] = this.renderOptions.serverData.nonce;
|
|
2497
3024
|
}
|
|
2498
|
-
this.
|
|
2499
|
-
this.write(e);
|
|
2500
|
-
this.closeElement();
|
|
3025
|
+
this.writeScript(t, e);
|
|
2501
3026
|
}
|
|
2502
3027
|
emitQwikLoaderAtBottomIfNeeded() {
|
|
2503
3028
|
if (!this.isStatic()) {
|
|
2504
3029
|
if (this.qlInclude !== 2 /* Done */) {
|
|
2505
3030
|
this.emitQwikLoaderInline();
|
|
2506
3031
|
}
|
|
2507
|
-
this.
|
|
3032
|
+
this.emitNewQwikEvents(true);
|
|
2508
3033
|
}
|
|
2509
3034
|
}
|
|
3035
|
+
emitNewQwikEvents(e = false) {
|
|
3036
|
+
const t = [];
|
|
3037
|
+
for (const e of this.serializationCtx.At) {
|
|
3038
|
+
if (!this.emittedQwikEventNames.has(e)) {
|
|
3039
|
+
this.emittedQwikEventNames.add(e);
|
|
3040
|
+
t.push(JSON.stringify(e));
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
if (e) {
|
|
3044
|
+
t.push(`${QwikEvContainerReady}`, JSON.stringify(this.Te));
|
|
3045
|
+
}
|
|
3046
|
+
this.emitQwikEvents(t);
|
|
3047
|
+
}
|
|
2510
3048
|
emitQwikEvents(e) {
|
|
2511
3049
|
if (e.length > 0) {
|
|
2512
3050
|
const t = {};
|
|
@@ -2514,11 +3052,11 @@ var SSRContainer = class extends Ou {
|
|
|
2514
3052
|
if (n) {
|
|
2515
3053
|
t["nonce"] = n;
|
|
2516
3054
|
}
|
|
2517
|
-
this.
|
|
3055
|
+
this.openScript(t);
|
|
2518
3056
|
this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
|
|
2519
|
-
this.writeArray(e,
|
|
3057
|
+
this.writeArray(e, wr);
|
|
2520
3058
|
this.write(PAREN_CLOSE);
|
|
2521
|
-
this.
|
|
3059
|
+
this.closeScript();
|
|
2522
3060
|
}
|
|
2523
3061
|
}
|
|
2524
3062
|
// Keep in sync with process-vnode-data.unit.ts
|
|
@@ -2577,7 +3115,7 @@ var SSRContainer = class extends Ou {
|
|
|
2577
3115
|
o += " ";
|
|
2578
3116
|
}
|
|
2579
3117
|
i.push(`${o}<${e}> <= is not allowed as a child of ${allowedContent(s)[0]}.`);
|
|
2580
|
-
throw newTagError(i.
|
|
3118
|
+
throw newTagError(i.join("\n"));
|
|
2581
3119
|
}
|
|
2582
3120
|
}
|
|
2583
3121
|
}
|
|
@@ -2587,7 +3125,8 @@ var SSRContainer = class extends Ou {
|
|
|
2587
3125
|
elementName: e,
|
|
2588
3126
|
depthFirstElementIdx: t,
|
|
2589
3127
|
vNodeData: [ 0 /* NONE */ ],
|
|
2590
|
-
currentFile: isDev8 ? n || null : null
|
|
3128
|
+
currentFile: isDev8 ? n || null : null,
|
|
3129
|
+
refBase: null
|
|
2591
3130
|
};
|
|
2592
3131
|
this.currentElementFrame = s;
|
|
2593
3132
|
this.vNodeDatas.push(s.vNodeData);
|
|
@@ -2602,6 +3141,17 @@ var SSRContainer = class extends Ou {
|
|
|
2602
3141
|
this.size += e.length;
|
|
2603
3142
|
this.writer.write(e);
|
|
2604
3143
|
}
|
|
3144
|
+
writeRootRef(e) {
|
|
3145
|
+
this.size += String(e).length;
|
|
3146
|
+
this.writer.writeRootRef(e);
|
|
3147
|
+
}
|
|
3148
|
+
writeRootRefPath(e) {
|
|
3149
|
+
this.size += String(e[0]).length;
|
|
3150
|
+
this.writer.writeRootRefPath(e);
|
|
3151
|
+
for (let t = 1; t < e.length; t++) {
|
|
3152
|
+
this.size += 1 + String(e[t]).length;
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
2605
3155
|
writeArray(e, t) {
|
|
2606
3156
|
for (let n = 0; n < e.length; n++) {
|
|
2607
3157
|
const r = e[n];
|
|
@@ -2611,22 +3161,22 @@ var SSRContainer = class extends Ou {
|
|
|
2611
3161
|
this.write(r);
|
|
2612
3162
|
}
|
|
2613
3163
|
}
|
|
2614
|
-
writeAttrs(e, t,
|
|
3164
|
+
writeAttrs(e, t, r, i, o, a) {
|
|
2615
3165
|
let l = void 0;
|
|
2616
3166
|
for (let c in t) {
|
|
2617
3167
|
let u = t[c];
|
|
2618
3168
|
if (isSSRUnsafeAttr(c)) {
|
|
2619
3169
|
if (isDev8) {
|
|
2620
|
-
throw
|
|
3170
|
+
throw qe(32 /* unsafeAttr */ , [ c ]);
|
|
2621
3171
|
}
|
|
2622
3172
|
continue;
|
|
2623
3173
|
}
|
|
2624
|
-
if (
|
|
3174
|
+
if (Ns(c)) {
|
|
2625
3175
|
u = _setEvent(this.serializationCtx, c, u, a);
|
|
2626
3176
|
} else if (c === "ref") {
|
|
2627
3177
|
const e = this.getOrCreateLastNode();
|
|
2628
|
-
if (
|
|
2629
|
-
u.
|
|
3178
|
+
if (lu(u)) {
|
|
3179
|
+
u.Zt = new DomRef(e);
|
|
2630
3180
|
continue;
|
|
2631
3181
|
} else if (typeof u === "function") {
|
|
2632
3182
|
u(new DomRef(e));
|
|
@@ -2634,31 +3184,35 @@ var SSRContainer = class extends Ou {
|
|
|
2634
3184
|
} else if (u == null) {
|
|
2635
3185
|
continue;
|
|
2636
3186
|
} else {
|
|
2637
|
-
throw
|
|
3187
|
+
throw qe(15 /* invalidRefValue */ , [ o ]);
|
|
2638
3188
|
}
|
|
2639
|
-
} else if (c ===
|
|
2640
|
-
|
|
2641
|
-
|
|
3189
|
+
} else if (c === ys || c === ms) {
|
|
3190
|
+
const e = this.addRoot(u);
|
|
3191
|
+
if (e === void 0) {
|
|
3192
|
+
continue;
|
|
3193
|
+
}
|
|
3194
|
+
u = typeof e === "number" ? [ e ] : String(e);
|
|
3195
|
+
} else if (lu(u)) {
|
|
2642
3196
|
const e = this.getOrCreateLastNode();
|
|
2643
|
-
const t = new
|
|
2644
|
-
|
|
2645
|
-
et:
|
|
3197
|
+
const t = new Ti({
|
|
3198
|
+
O: i,
|
|
3199
|
+
et: r
|
|
2646
3200
|
});
|
|
2647
|
-
const
|
|
2648
|
-
u = n(() => this.trackSignalValue(
|
|
3201
|
+
const s = u;
|
|
3202
|
+
u = n(() => this.trackSignalValue(s, e, c, t));
|
|
2649
3203
|
}
|
|
2650
|
-
if (
|
|
3204
|
+
if (Ps(u)) {
|
|
2651
3205
|
const e = this.getOrCreateLastNode();
|
|
2652
3206
|
this.addPromiseAttribute(u);
|
|
2653
3207
|
u.then(t => {
|
|
2654
|
-
this.addBackpatchEntry(e.id, c, t);
|
|
3208
|
+
this.addBackpatchEntry(e.id, c, s(c, t, i));
|
|
2655
3209
|
});
|
|
2656
3210
|
continue;
|
|
2657
3211
|
}
|
|
2658
|
-
if (c ===
|
|
3212
|
+
if (c === Ss) {
|
|
2659
3213
|
if (u) {
|
|
2660
3214
|
l = String(u);
|
|
2661
|
-
c =
|
|
3215
|
+
c = es;
|
|
2662
3216
|
u = "html" /* HTML */;
|
|
2663
3217
|
}
|
|
2664
3218
|
if (e === "style") {
|
|
@@ -2670,28 +3224,44 @@ var SSRContainer = class extends Ou {
|
|
|
2670
3224
|
if (e === "textarea" && c === "value") {
|
|
2671
3225
|
if (u && typeof u !== "string") {
|
|
2672
3226
|
if (isDev8) {
|
|
2673
|
-
throw
|
|
3227
|
+
throw qe(23 /* wrongTextareaValue */ , [ o, u ]);
|
|
2674
3228
|
}
|
|
2675
3229
|
continue;
|
|
2676
3230
|
}
|
|
2677
3231
|
l = escapeHTML(u || "");
|
|
2678
|
-
c =
|
|
3232
|
+
c = es;
|
|
2679
3233
|
u = "text" /* TEXT */;
|
|
2680
3234
|
}
|
|
2681
|
-
const h =
|
|
3235
|
+
const h = s(c, u, i);
|
|
2682
3236
|
if (h != null && h !== false) {
|
|
2683
|
-
this.write(
|
|
3237
|
+
this.write(ga);
|
|
2684
3238
|
this.write(c);
|
|
2685
3239
|
if (h !== true) {
|
|
2686
3240
|
this.write(ATTR_EQUALS_QUOTE);
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
3241
|
+
if (Array.isArray(h)) {
|
|
3242
|
+
this.writeEscapedChunks(h);
|
|
3243
|
+
} else {
|
|
3244
|
+
const e = escapeHTML(String(h));
|
|
3245
|
+
this.write(e);
|
|
3246
|
+
}
|
|
3247
|
+
this.write($r);
|
|
2690
3248
|
}
|
|
2691
3249
|
}
|
|
2692
3250
|
}
|
|
2693
3251
|
return l;
|
|
2694
3252
|
}
|
|
3253
|
+
writeEscapedChunks(e) {
|
|
3254
|
+
for (let t = 0; t < e.length; t++) {
|
|
3255
|
+
const n = e[t];
|
|
3256
|
+
if (typeof n === "string") {
|
|
3257
|
+
this.write(escapeHTML(n));
|
|
3258
|
+
} else if (typeof n === "number") {
|
|
3259
|
+
this.writeRootRef(n);
|
|
3260
|
+
} else {
|
|
3261
|
+
this.writeRootRefPath(n.path);
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
2695
3265
|
addPromiseAttribute(e) {
|
|
2696
3266
|
this.promiseAttributes ||= [];
|
|
2697
3267
|
this.promiseAttributes.push(e);
|
|
@@ -2704,19 +3274,261 @@ var SSRContainer = class extends Ou {
|
|
|
2704
3274
|
}
|
|
2705
3275
|
};
|
|
2706
3276
|
|
|
3277
|
+
var SSRSegmentContainer = class extends SSRContainer {
|
|
3278
|
+
constructor(e, t) {
|
|
3279
|
+
super(e);
|
|
3280
|
+
this.Re = t;
|
|
3281
|
+
}
|
|
3282
|
+
Qe=0 /* Rendering */;
|
|
3283
|
+
Ke=null;
|
|
3284
|
+
subscriptionPatchRecords=[];
|
|
3285
|
+
pendingVNodeDataPatches=null;
|
|
3286
|
+
nextOutOfOrderId() {
|
|
3287
|
+
return this.Re.nextOutOfOrderId();
|
|
3288
|
+
}
|
|
3289
|
+
S(e) {
|
|
3290
|
+
return this.Re.S(e);
|
|
3291
|
+
}
|
|
3292
|
+
queueOutOfOrderSegment(e) {
|
|
3293
|
+
this.Re.queueOutOfOrderSegment(e);
|
|
3294
|
+
}
|
|
3295
|
+
emitOutOfOrderSegmentScripts(e) {
|
|
3296
|
+
this.Re.emitOutOfOrderSegmentScripts(e);
|
|
3297
|
+
}
|
|
3298
|
+
emitOutOfOrderExecutorIfNeeded() {
|
|
3299
|
+
this.Re.emitOutOfOrderExecutorIfNeeded();
|
|
3300
|
+
}
|
|
3301
|
+
nn(e, t, n, r) {
|
|
3302
|
+
recordExternalRootEffect(this.Re.serializationCtx, this.serializationCtx, this.Re.dt, this.subscriptionPatchRecords, e, t, n, r);
|
|
3303
|
+
}
|
|
3304
|
+
async P(e, t) {
|
|
3305
|
+
const n = this.Re;
|
|
3306
|
+
const r = n.A();
|
|
3307
|
+
const s = this.serializationCtx;
|
|
3308
|
+
try {
|
|
3309
|
+
const i = this.Ge(n, s);
|
|
3310
|
+
this.Je(n, s);
|
|
3311
|
+
this.Ye(n, s);
|
|
3312
|
+
const o = this.Ze(n, r, s);
|
|
3313
|
+
if (r && (i.newRootLocalIds.length > 0 || o !== void 0)) {
|
|
3314
|
+
s.ue = n.serializationCtx.zn;
|
|
3315
|
+
await this.emitStatePatchData(e, i.newRootStart, i.newRootLocalIds, o);
|
|
3316
|
+
n.serializationCtx.ae = n.serializationCtx.Yn.length + (n.serializationCtx.fe ? 1 : 0);
|
|
3317
|
+
n.serializationCtx.zn += s.zn;
|
|
3318
|
+
}
|
|
3319
|
+
this.emitPendingVNodeDataPatches();
|
|
3320
|
+
if (r) {
|
|
3321
|
+
this.t = true;
|
|
3322
|
+
this.emitVNodeData(e);
|
|
3323
|
+
const t = this.serializationCtx;
|
|
3324
|
+
this.serializationCtx = n.serializationCtx;
|
|
3325
|
+
this.emittedSyncFnCount = n.emittedSyncFnCount;
|
|
3326
|
+
this.emitSyncFnsData(true);
|
|
3327
|
+
n.emittedSyncFnCount = this.emittedSyncFnCount;
|
|
3328
|
+
this.serializationCtx = t;
|
|
3329
|
+
this.emitNewQwikEvents();
|
|
3330
|
+
}
|
|
3331
|
+
this.emitPatchDataIfNeeded();
|
|
3332
|
+
this.drainCleanupQueue();
|
|
3333
|
+
const a = i.rootIdMap;
|
|
3334
|
+
if (r) {
|
|
3335
|
+
this.Qe = 2 /* Done */;
|
|
3336
|
+
} else {
|
|
3337
|
+
this.Ke = a;
|
|
3338
|
+
this.Qe = 1 /* EarlyFinalized */;
|
|
3339
|
+
}
|
|
3340
|
+
return {
|
|
3341
|
+
html: renderSSRChunks(t.htmlChunks, a),
|
|
3342
|
+
scripts: t.writer.toString(a)
|
|
3343
|
+
};
|
|
3344
|
+
} finally {
|
|
3345
|
+
if (this.Qe !== 1 /* EarlyFinalized */) {
|
|
3346
|
+
s.me = void 0;
|
|
3347
|
+
n.removeOutOfOrderSegment(this);
|
|
3348
|
+
}
|
|
3349
|
+
n.serializationCtx.Bn(n.writer);
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
He() {
|
|
3353
|
+
try {
|
|
3354
|
+
this.emitVNodeData(this.vnodeSegment);
|
|
3355
|
+
this.emitPendingVNodeDataPatches();
|
|
3356
|
+
this.Re.emitOutOfOrderSegmentScripts(this.writer.toString(this.Ke));
|
|
3357
|
+
this.Qe = 2 /* Done */;
|
|
3358
|
+
this.Re.removeOutOfOrderSegment(this);
|
|
3359
|
+
} finally {
|
|
3360
|
+
this.serializationCtx.me = void 0;
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
markVNodeDataForSerialization(e, t = 16 /* SERIALIZE */) {
|
|
3364
|
+
const n = e.vnodeData[0];
|
|
3365
|
+
const r = n | t;
|
|
3366
|
+
if (r !== n) {
|
|
3367
|
+
e.vnodeData[0] = r;
|
|
3368
|
+
this.queueLateVNodeDataPatch(e, r & ~n);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
queueLateVNodeDataPatch(e, t) {
|
|
3372
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !(t & (16 /* SERIALIZE */ | 8 /* REFERENCE */))) {
|
|
3373
|
+
return;
|
|
3374
|
+
}
|
|
3375
|
+
const n = this.getVNodeDataOwnerFromNodeId(e.id);
|
|
3376
|
+
if (!this.F().isVNodeDataOwnerEmitted(n.owner)) {
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
let r = (this.pendingVNodeDataPatches ||= /* @__PURE__ */ new Map).get(n.owner);
|
|
3380
|
+
if (!r) {
|
|
3381
|
+
this.pendingVNodeDataPatches.set(n.owner, r = /* @__PURE__ */ new Map);
|
|
3382
|
+
}
|
|
3383
|
+
r.set(n.localIndex, e.vnodeData);
|
|
3384
|
+
}
|
|
3385
|
+
emitPendingVNodeDataPatches() {
|
|
3386
|
+
const e = this.pendingVNodeDataPatches;
|
|
3387
|
+
this.pendingVNodeDataPatches = null;
|
|
3388
|
+
if (!e) {
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3391
|
+
for (const [t, n] of e) {
|
|
3392
|
+
if (n.size === 0) {
|
|
3393
|
+
continue;
|
|
3394
|
+
}
|
|
3395
|
+
const e = Array.from(n).sort((e, t) => e[0] - t[0]);
|
|
3396
|
+
this.emitVNodeDataScript(t, e, true);
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
Ge(e, t) {
|
|
3400
|
+
const n = this.commitSegmentRoots(e, t);
|
|
3401
|
+
t.me = (t, r, s) => {
|
|
3402
|
+
this.commitSegmentRoot(e, t, r, s, n);
|
|
3403
|
+
};
|
|
3404
|
+
return n;
|
|
3405
|
+
}
|
|
3406
|
+
Ze(e, t, n) {
|
|
3407
|
+
let r = void 0;
|
|
3408
|
+
const s = t ? this.collectSubscriptionPatches(e, e.rootContainerSerializedRootCount) : void 0;
|
|
3409
|
+
if (s) {
|
|
3410
|
+
r = n.St(s);
|
|
3411
|
+
}
|
|
3412
|
+
return r;
|
|
3413
|
+
}
|
|
3414
|
+
commitSegmentRoots(e, t) {
|
|
3415
|
+
const n = [];
|
|
3416
|
+
const r = e.A() ? e.serializationCtx.ae : e.serializationCtx.Yn.length;
|
|
3417
|
+
const s = [];
|
|
3418
|
+
const i = {
|
|
3419
|
+
rootIdMap: n,
|
|
3420
|
+
newRootStart: r,
|
|
3421
|
+
newRootLocalIds: s
|
|
3422
|
+
};
|
|
3423
|
+
this.promoteSharedSegmentRoots(e, t, i);
|
|
3424
|
+
const o = t.Yn;
|
|
3425
|
+
const a = t.ye;
|
|
3426
|
+
for (let t = 0; t < o.length; t++) {
|
|
3427
|
+
const n = a[t];
|
|
3428
|
+
this.commitSegmentRoot(e, t, o[t], n, i);
|
|
3429
|
+
}
|
|
3430
|
+
return i;
|
|
3431
|
+
}
|
|
3432
|
+
promoteSharedSegmentRoots(e, t, n) {
|
|
3433
|
+
const r = t.Yn;
|
|
3434
|
+
const s = t.ye;
|
|
3435
|
+
for (let t = 0; t < s.length; t++) {
|
|
3436
|
+
const i = s[t];
|
|
3437
|
+
if (this.isRootOrUsedByOtherLiveSegment(e, i)) {
|
|
3438
|
+
this.commitSegmentRoot(e, t, r[t], i, n);
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
isRootOrUsedByOtherLiveSegment(e, t) {
|
|
3443
|
+
if (e.serializationCtx.ge(t) !== void 0) {
|
|
3444
|
+
return true;
|
|
3445
|
+
}
|
|
3446
|
+
const n = e.outOfOrderSegments;
|
|
3447
|
+
for (let e = 0; e < n.length; e++) {
|
|
3448
|
+
const r = n[e];
|
|
3449
|
+
if (r === this) {
|
|
3450
|
+
continue;
|
|
3451
|
+
}
|
|
3452
|
+
const s = r.serializationCtx.ye;
|
|
3453
|
+
for (let e = 0; e < s.length; e++) {
|
|
3454
|
+
if (s[e] === t) {
|
|
3455
|
+
return true;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
return false;
|
|
3460
|
+
}
|
|
3461
|
+
commitSegmentRoot(e, t, n, r, s) {
|
|
3462
|
+
if (s.rootIdMap[t] !== void 0) {
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
let i = e.serializationCtx.ge(r);
|
|
3466
|
+
if (i === void 0) {
|
|
3467
|
+
i = e.serializationCtx._e(n, r);
|
|
3468
|
+
s.newRootLocalIds.push(t);
|
|
3469
|
+
this.seedCommittedRootForLiveSegments(e, r);
|
|
3470
|
+
}
|
|
3471
|
+
const o = e.serializationCtx;
|
|
3472
|
+
s.rootIdMap[t] = e.A() && i >= o.ce ? i + (o.fe ? 1 : 0) : i;
|
|
3473
|
+
}
|
|
3474
|
+
seedCommittedRootForLiveSegments(e, t) {
|
|
3475
|
+
const n = e.outOfOrderSegments;
|
|
3476
|
+
for (let e = 0; e < n.length; e++) {
|
|
3477
|
+
const r = n[e];
|
|
3478
|
+
if (r !== this && r.Qe === 0 /* Rendering */) {
|
|
3479
|
+
r.serializationCtx.St(t);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
Je(e, t) {
|
|
3484
|
+
for (const n of t.At) {
|
|
3485
|
+
e.serializationCtx.At.add(n);
|
|
3486
|
+
}
|
|
3487
|
+
for (const n of t.xt) {
|
|
3488
|
+
e.serializationCtx.xt.add(n);
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
Ye(e, t) {
|
|
3492
|
+
e.serializationCtx.$e.push(...t.$e);
|
|
3493
|
+
}
|
|
3494
|
+
collectSubscriptionPatches(e, t) {
|
|
3495
|
+
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
3496
|
+
return;
|
|
3497
|
+
}
|
|
3498
|
+
return collectSubscriptionPatches(e.serializationCtx, this.subscriptionPatchRecords, t);
|
|
3499
|
+
}
|
|
3500
|
+
emitStatePatchData(e, t, n, r) {
|
|
3501
|
+
const s = this.statePatchScriptAttrs(e);
|
|
3502
|
+
this.openScript(s);
|
|
3503
|
+
this.serializationCtx.Bn(this.writer);
|
|
3504
|
+
this.serializationCtx.te = this.markVNodeDataForSerialization.bind(this);
|
|
3505
|
+
return qs(this.serializationCtx.be(t, n, r, 0), () => {
|
|
3506
|
+
this.closeScript();
|
|
3507
|
+
});
|
|
3508
|
+
}
|
|
3509
|
+
statePatchScriptAttrs(e) {
|
|
3510
|
+
const t = this.stateScriptAttrs();
|
|
3511
|
+
t[QStatePatchAttr] = true;
|
|
3512
|
+
if (e) {
|
|
3513
|
+
t[Ph] = e;
|
|
3514
|
+
}
|
|
3515
|
+
return t;
|
|
3516
|
+
}
|
|
3517
|
+
};
|
|
3518
|
+
|
|
2707
3519
|
var isQwikStyleElement = (e, t) => {
|
|
2708
3520
|
if (e === "style" && t != null) {
|
|
2709
|
-
return Object.prototype.hasOwnProperty.call(t,
|
|
3521
|
+
return Object.prototype.hasOwnProperty.call(t, Ue) || Object.prototype.hasOwnProperty.call(t, He);
|
|
2710
3522
|
}
|
|
2711
3523
|
return false;
|
|
2712
3524
|
};
|
|
2713
3525
|
|
|
2714
3526
|
function newTagError(e) {
|
|
2715
|
-
return
|
|
3527
|
+
return qe(12 /* tagError */ , [ e ]);
|
|
2716
3528
|
}
|
|
2717
3529
|
|
|
2718
3530
|
function hasDestroy(e) {
|
|
2719
|
-
return e && typeof e === "object" && typeof e.
|
|
3531
|
+
return e && typeof e === "object" && typeof e.Tn === "function";
|
|
2720
3532
|
}
|
|
2721
3533
|
|
|
2722
3534
|
function isSSRUnsafeAttr(e) {
|
|
@@ -2736,7 +3548,7 @@ function randomStr() {
|
|
|
2736
3548
|
function addPreventDefaultEventToSerializationContext(e, t) {
|
|
2737
3549
|
const n = "e" + t.substring(14);
|
|
2738
3550
|
if (n) {
|
|
2739
|
-
e.
|
|
3551
|
+
e.At.add(n);
|
|
2740
3552
|
}
|
|
2741
3553
|
}
|
|
2742
3554
|
|
|
@@ -2770,37 +3582,27 @@ var StreamHandler = class {
|
|
|
2770
3582
|
let t;
|
|
2771
3583
|
switch (this.inOrderStreaming.strategy) {
|
|
2772
3584
|
case "disabled":
|
|
2773
|
-
t = {
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
return;
|
|
2777
|
-
}
|
|
2778
|
-
e.enqueue(t);
|
|
2779
|
-
},
|
|
2780
|
-
waitForDrain() {
|
|
2781
|
-
return e.waitForPendingFlush();
|
|
3585
|
+
t = pr(t => {
|
|
3586
|
+
if (t === void 0 || t === null) {
|
|
3587
|
+
return;
|
|
2782
3588
|
}
|
|
2783
|
-
|
|
3589
|
+
e.enqueue(t);
|
|
3590
|
+
});
|
|
2784
3591
|
break;
|
|
2785
3592
|
|
|
2786
3593
|
case "direct":
|
|
2787
3594
|
{
|
|
2788
3595
|
const n = this.nativeStream;
|
|
2789
|
-
t = {
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
return e.trackPendingFlush(r);
|
|
2797
|
-
}
|
|
2798
|
-
return e.trackPendingFlush(n.write(t));
|
|
2799
|
-
},
|
|
2800
|
-
waitForDrain() {
|
|
2801
|
-
return e.waitForPendingFlush();
|
|
3596
|
+
t = pr(t => {
|
|
3597
|
+
if (t === void 0 || t === null) {
|
|
3598
|
+
return;
|
|
3599
|
+
}
|
|
3600
|
+
if (e.pendingFlush) {
|
|
3601
|
+
const r = e.pendingFlush.then(() => n.write(t));
|
|
3602
|
+
return e.trackPendingFlush(r);
|
|
2802
3603
|
}
|
|
2803
|
-
|
|
3604
|
+
return e.trackPendingFlush(n.write(t));
|
|
3605
|
+
});
|
|
2804
3606
|
break;
|
|
2805
3607
|
}
|
|
2806
3608
|
|
|
@@ -2809,23 +3611,18 @@ var StreamHandler = class {
|
|
|
2809
3611
|
{
|
|
2810
3612
|
const n = this.inOrderStreaming.maximumChunk ?? 0;
|
|
2811
3613
|
const r = this.inOrderStreaming.maximumInitialChunk ?? 0;
|
|
2812
|
-
t = {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
return e.flush();
|
|
2822
|
-
}
|
|
3614
|
+
t = pr(t => {
|
|
3615
|
+
if (t === void 0 || t === null) {
|
|
3616
|
+
return;
|
|
3617
|
+
}
|
|
3618
|
+
e.enqueue(t);
|
|
3619
|
+
if (e.streamBlockDepth === 0) {
|
|
3620
|
+
const t = e.networkFlushes === 0 ? r : n;
|
|
3621
|
+
if (e.bufferSize >= t) {
|
|
3622
|
+
return e.flush();
|
|
2823
3623
|
}
|
|
2824
|
-
},
|
|
2825
|
-
waitForDrain() {
|
|
2826
|
-
return e.waitForPendingFlush();
|
|
2827
3624
|
}
|
|
2828
|
-
};
|
|
3625
|
+
});
|
|
2829
3626
|
break;
|
|
2830
3627
|
}
|
|
2831
3628
|
}
|
|
@@ -2842,7 +3639,7 @@ var StreamHandler = class {
|
|
|
2842
3639
|
}
|
|
2843
3640
|
}
|
|
2844
3641
|
trackPendingFlush(e) {
|
|
2845
|
-
if (!
|
|
3642
|
+
if (!Ps(e)) {
|
|
2846
3643
|
return;
|
|
2847
3644
|
}
|
|
2848
3645
|
const t = Promise.resolve(e).finally(() => {
|
|
@@ -2905,26 +3702,30 @@ var StreamHandler = class {
|
|
|
2905
3702
|
|
|
2906
3703
|
// packages/qwik/src/server/ssr-render.ts
|
|
2907
3704
|
var renderToString = async (e, t = {}) => {
|
|
2908
|
-
const n =
|
|
2909
|
-
const r = {
|
|
2910
|
-
write(e) {
|
|
2911
|
-
n.push(e);
|
|
2912
|
-
}
|
|
2913
|
-
};
|
|
2914
|
-
const s = await renderToStream(e, {
|
|
3705
|
+
const n = new StringSSRWriter;
|
|
3706
|
+
const r = await renderToStream(e, {
|
|
2915
3707
|
...t,
|
|
2916
|
-
stream:
|
|
3708
|
+
stream: n
|
|
2917
3709
|
});
|
|
2918
3710
|
return {
|
|
2919
|
-
isStatic:
|
|
2920
|
-
timing:
|
|
2921
|
-
manifest:
|
|
2922
|
-
snapshotResult:
|
|
2923
|
-
html: n.
|
|
3711
|
+
isStatic: r.isStatic,
|
|
3712
|
+
timing: r.timing,
|
|
3713
|
+
manifest: r.manifest,
|
|
3714
|
+
snapshotResult: r.snapshotResult,
|
|
3715
|
+
html: n.toString()
|
|
2924
3716
|
};
|
|
2925
3717
|
};
|
|
2926
3718
|
|
|
2927
3719
|
var renderToStream = async (e, t) => {
|
|
3720
|
+
if (__EXPERIMENTAL__.suspense && t.streaming?.outOfOrder === void 0) {
|
|
3721
|
+
t = {
|
|
3722
|
+
...t,
|
|
3723
|
+
streaming: {
|
|
3724
|
+
...t.streaming,
|
|
3725
|
+
outOfOrder: true
|
|
3726
|
+
}
|
|
3727
|
+
};
|
|
3728
|
+
}
|
|
2928
3729
|
const n = {
|
|
2929
3730
|
firstFlush: 0,
|
|
2930
3731
|
render: 0,
|
|
@@ -2960,7 +3761,7 @@ var renderToStream = async (e, t) => {
|
|
|
2960
3761
|
};
|
|
2961
3762
|
|
|
2962
3763
|
function resolveManifest(e) {
|
|
2963
|
-
const t =
|
|
3764
|
+
const t = Qf();
|
|
2964
3765
|
const n = e ? {
|
|
2965
3766
|
...t,
|
|
2966
3767
|
...e
|
|
@@ -2972,7 +3773,7 @@ function resolveManifest(e) {
|
|
|
2972
3773
|
const e = {};
|
|
2973
3774
|
for (const t in n.mapping) {
|
|
2974
3775
|
const r = n.mapping[t];
|
|
2975
|
-
e[
|
|
3776
|
+
e[Rh(t)] = [ t, r ];
|
|
2976
3777
|
}
|
|
2977
3778
|
return {
|
|
2978
3779
|
mapper: e,
|
|
@@ -2987,7 +3788,7 @@ var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
|
2987
3788
|
|
|
2988
3789
|
// packages/qwik/src/server/index.ts
|
|
2989
3790
|
async function setServerPlatform2(e) {
|
|
2990
|
-
const t =
|
|
3791
|
+
const t = Us({
|
|
2991
3792
|
manifest: e
|
|
2992
3793
|
}, resolveManifest(e));
|
|
2993
3794
|
setPlatform2(t);
|