@qwik.dev/core 2.0.0-beta.39 → 2.0.0-beta.40

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.
Files changed (43) hide show
  1. package/dist/backpatch/index.mjs +2 -2
  2. package/dist/backpatch/package.json +1 -1
  3. package/dist/backpatch-executor.debug.js +55 -42
  4. package/dist/backpatch-executor.js +1 -1
  5. package/dist/build/package.json +1 -1
  6. package/dist/cli.mjs +2 -2
  7. package/dist/core-internal.d.ts +1 -1
  8. package/dist/core.min.mjs +6 -6
  9. package/dist/core.mjs +2 -2
  10. package/dist/core.prod.mjs +152 -152
  11. package/dist/insights/index.qwik.mjs +81 -93
  12. package/dist/insights/vite/index.mjs +79 -84
  13. package/dist/loader/index.mjs +2 -2
  14. package/dist/loader/package.json +1 -1
  15. package/dist/optimizer.d.ts +19 -3
  16. package/dist/optimizer.mjs +2992 -3624
  17. package/dist/out-of-order-executor.debug.js +138 -161
  18. package/dist/out-of-order-executor.js +1 -1
  19. package/dist/preloader.mjs +178 -1
  20. package/dist/qwikloader.debug.js +384 -433
  21. package/dist/qwikloader.js +1 -1
  22. package/dist/server.mjs +10 -216
  23. package/dist/server.prod.mjs +1046 -1046
  24. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.ts +1 -1
  25. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.ts +1 -1
  26. package/dist/starters/adapters/bun/adapters/bun/vite.config.ts +1 -1
  27. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.ts +1 -1
  28. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.ts +1 -1
  29. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +1 -1
  30. package/dist/starters/adapters/deno/adapters/deno/vite.config.ts +1 -1
  31. package/dist/starters/adapters/express/adapters/express/vite.config.ts +1 -1
  32. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.ts +1 -1
  33. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.ts +1 -1
  34. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.ts +1 -1
  35. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.ts +1 -1
  36. package/dist/starters/adapters/ssg/adapters/ssg/vite.config.ts +1 -1
  37. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.ts +1 -1
  38. package/dist/starters/features/csr/package.json +1 -1
  39. package/dist/testing/index.mjs +3 -2
  40. package/dist/testing/package.json +1 -1
  41. package/dist/worker/index.mjs +248 -315
  42. package/dist/worker/package.json +1 -1
  43. package/package.json +5 -5
@@ -1,95 +1,83 @@
1
- import { sync$, component$, isDev } from "@qwik.dev/core";
1
+ import { component$, isDev, sync$ } from "@qwik.dev/core";
2
2
  import { jsx } from "@qwik.dev/core/jsx-runtime";
3
- const insightsPing = sync$(
4
- () => ((w, d, l, n, p, r, S) => {
5
- var publicApiKey = __QI_KEY__, postUrl = __QI_URL__, qVersion = d.querySelector(`[q\\:version]`)?.getAttribute(`q:version`) || "unknown", manifestHash = d.querySelector(`[q\\:manifest-hash]`)?.getAttribute(`q:manifest-hash`) || "dev", qSymbols = [], existingSymbols = /* @__PURE__ */ new Set(), flushSymbolIndex = 0, lastReqTime = 0, timeoutID, qRouteChangeTime = p.now(), qRouteEl = d.querySelector(`[q\\:route]`), flush = () => {
6
- timeoutID = void 0;
7
- if (qSymbols.length > flushSymbolIndex) {
8
- var payload = {
9
- qVersion,
10
- publicApiKey,
11
- manifestHash,
12
- previousSymbol: flushSymbolIndex == 0 ? void 0 : qSymbols[flushSymbolIndex - 1].symbol,
13
- symbols: qSymbols.slice(flushSymbolIndex)
14
- };
15
- n.sendBeacon(postUrl, S(payload));
16
- flushSymbolIndex = qSymbols.length;
17
- }
18
- }, debounceFlush = () => {
19
- timeoutID != void 0 && clearTimeout(timeoutID);
20
- timeoutID = setTimeout(flush, 1e3);
21
- };
22
- w.qSymbolTracker = {
23
- symbols: qSymbols,
24
- publicApiKey
25
- };
26
- if (qRouteEl) {
27
- new MutationObserver((mutations) => {
28
- var mutation = mutations.find((m) => m.attributeName === `q:route`);
29
- if (mutation) {
30
- qRouteChangeTime = p.now();
31
- }
32
- }).observe(qRouteEl, { attributes: true });
33
- }
34
- d.addEventListener("visibilitychange", () => d.visibilityState === "hidden" && flush());
35
- d.addEventListener(`qsymbol`, (_event) => {
36
- var event = _event, detail = event.detail, symbolRequestTime = detail.reqTime, symbolDeliveredTime = event.timeStamp, symbol = detail.symbol;
37
- if (!existingSymbols.has(symbol)) {
38
- existingSymbols.add(symbol);
39
- var route = qRouteEl?.getAttribute(`q:route`) || "/";
40
- qSymbols.push({
41
- symbol,
42
- route,
43
- delay: r(0 - lastReqTime + symbolRequestTime),
44
- latency: r(symbolDeliveredTime - symbolRequestTime),
45
- timeline: r(0 - qRouteChangeTime + symbolRequestTime),
46
- interaction: !!detail.element
47
- });
48
- lastReqTime = symbolDeliveredTime;
49
- debounceFlush();
50
- }
51
- });
52
- w.addEventListener("error", (event) => {
53
- var error = event.error;
54
- if (!(error && typeof error === "object")) {
55
- return;
56
- }
57
- var payload = {
58
- url: `${l}`,
59
- manifestHash,
60
- timestamp: (/* @__PURE__ */ new Date()).getTime(),
61
- source: event.filename,
62
- line: event.lineno,
63
- column: event.colno,
64
- message: event.message,
65
- error: "message" in error ? error.message : `${error}`,
66
- stack: "stack" in error ? error.stack || "" : ""
67
- };
68
- n.sendBeacon(`${postUrl}error/`, S(payload));
69
- });
70
- })(window, document, location, navigator, performance, Math.round, JSON.stringify)
71
- );
72
- const Insights = component$(() => {
73
- if (!__EXPERIMENTAL__.insights) {
74
- throw new Error(
75
- 'Insights is experimental and must be enabled with `experimental: ["insights"]` in the `qwikVite` plugin.'
76
- );
77
- }
78
- const key = globalThis.__QI_KEY__;
79
- const url = globalThis.__QI_URL__;
80
- if (!key || !url) {
81
- if (!isDev) {
82
- console.warn("<Insights />: no config from qwikInsights plugin, skipping...");
83
- }
84
- return null;
85
- }
86
- return /* @__PURE__ */ jsx("script", {
87
- "document:onQInit$": insightsPing,
88
- // We must pass the vite injected variables via window because sync$ code doesn't get replaced by the vite plugin
89
- dangerouslySetInnerHTML: `__QI_KEY__=${JSON.stringify(key)};__QI_URL__=${JSON.stringify(url)}`
90
- });
3
+ //#region packages/qwik/src/insights/insights.ts
4
+ /** @internal */
5
+ var insightsPing = sync$(() => ((w, d, l, n, p, r, S) => {
6
+ var publicApiKey = __QI_KEY__, postUrl = __QI_URL__, qVersion = d.querySelector(`[q\\:version]`)?.getAttribute(`q:version`) || "unknown", manifestHash = d.querySelector(`[q\\:manifest-hash]`)?.getAttribute(`q:manifest-hash`) || "dev", qSymbols = [], existingSymbols = /* @__PURE__ */ new Set(), flushSymbolIndex = 0, lastReqTime = 0, timeoutID, qRouteChangeTime = p.now(), qRouteEl = d.querySelector(`[q\\:route]`), flush = () => {
7
+ timeoutID = void 0;
8
+ if (qSymbols.length > flushSymbolIndex) {
9
+ var payload = {
10
+ qVersion,
11
+ publicApiKey,
12
+ manifestHash,
13
+ previousSymbol: flushSymbolIndex == 0 ? void 0 : qSymbols[flushSymbolIndex - 1].symbol,
14
+ symbols: qSymbols.slice(flushSymbolIndex)
15
+ };
16
+ n.sendBeacon(postUrl, S(payload));
17
+ flushSymbolIndex = qSymbols.length;
18
+ }
19
+ }, debounceFlush = () => {
20
+ timeoutID != void 0 && clearTimeout(timeoutID);
21
+ timeoutID = setTimeout(flush, 1e3);
22
+ };
23
+ w.qSymbolTracker = {
24
+ symbols: qSymbols,
25
+ publicApiKey
26
+ };
27
+ if (qRouteEl) new MutationObserver((mutations) => {
28
+ if (mutations.find((m) => m.attributeName === `q:route`)) qRouteChangeTime = p.now();
29
+ }).observe(qRouteEl, { attributes: true });
30
+ d.addEventListener("visibilitychange", () => d.visibilityState === "hidden" && flush());
31
+ d.addEventListener(`qsymbol`, (_event) => {
32
+ var event = _event, detail = event.detail, symbolRequestTime = detail.reqTime, symbolDeliveredTime = event.timeStamp, symbol = detail.symbol;
33
+ if (!existingSymbols.has(symbol)) {
34
+ existingSymbols.add(symbol);
35
+ var route = qRouteEl?.getAttribute(`q:route`) || "/";
36
+ qSymbols.push({
37
+ symbol,
38
+ route,
39
+ delay: r(0 - lastReqTime + symbolRequestTime),
40
+ latency: r(symbolDeliveredTime - symbolRequestTime),
41
+ timeline: r(0 - qRouteChangeTime + symbolRequestTime),
42
+ interaction: !!detail.element
43
+ });
44
+ lastReqTime = symbolDeliveredTime;
45
+ debounceFlush();
46
+ }
47
+ });
48
+ w.addEventListener("error", (event) => {
49
+ var error = event.error;
50
+ if (!(error && typeof error === "object")) return;
51
+ var payload = {
52
+ url: `${l}`,
53
+ manifestHash,
54
+ timestamp: (/* @__PURE__ */ new Date()).getTime(),
55
+ source: event.filename,
56
+ line: event.lineno,
57
+ column: event.colno,
58
+ message: event.message,
59
+ error: "message" in error ? error.message : `${error}`,
60
+ stack: "stack" in error ? error.stack || "" : ""
61
+ };
62
+ n.sendBeacon(`${postUrl}error/`, S(payload));
63
+ });
64
+ })(window, document, location, navigator, performance, Math.round, JSON.stringify));
65
+ /**
66
+ * @beta
67
+ * @experimental
68
+ */
69
+ var Insights = component$(() => {
70
+ if (!__EXPERIMENTAL__.insights) throw new Error("Insights is experimental and must be enabled with `experimental: [\"insights\"]` in the `qwikVite` plugin.");
71
+ const key = globalThis.__QI_KEY__;
72
+ const url = globalThis.__QI_URL__;
73
+ if (!key || !url) {
74
+ if (!isDev) console.warn("<Insights />: no config from qwikInsights plugin, skipping...");
75
+ return null;
76
+ }
77
+ return /* @__PURE__ */ jsx("script", {
78
+ "document:onQInit$": insightsPing,
79
+ dangerouslySetInnerHTML: `__QI_KEY__=${JSON.stringify(key)};__QI_URL__=${JSON.stringify(url)}`
80
+ });
91
81
  });
92
- export {
93
- Insights,
94
- insightsPing
95
- };
82
+ //#endregion
83
+ export { Insights, insightsPing };
@@ -1,86 +1,81 @@
1
- import { existsSync as y, mkdirSync as v } from "node:fs";
2
- import { readFile as k, writeFile as $ } from "node:fs/promises";
3
- import { resolve as q, join as B } from "node:path";
4
- const b = (r, ...a) => {
5
- console.warn("\x1B[33m%s\x1B[0m", `qwikInsight()[WARN]: ${r}`, ...a);
6
- }, I = (r) => {
7
- console.log("\x1B[35m%s\x1B[0m", `qwikInsight(): ${r}`);
1
+ import { existsSync as e, mkdirSync as t } from "node:fs";
2
+ import { readFile as n, writeFile as r } from "node:fs/promises";
3
+ import { join as i, resolve as a } from "node:path";
4
+ //#region packages/qwik/src/insights/vite/insights-plugin.ts
5
+ var o = (e, ...t) => {
6
+ console.warn("\x1B[33m%s\x1B[0m", `qwikInsight()[WARN]: ${e}`, ...t);
7
+ }, s = (e) => {
8
+ console.log("\x1B[35m%s\x1B[0m", `qwikInsight(): ${e}`);
8
9
  };
9
- async function O(r) {
10
- const { publicApiKey: a, baseUrl: _ = "https://insights.qwik.dev", outDir: m = "" } = r;
11
- if (!a) {
12
- console.warn("qwikInsights: publicApiKey is required, skipping...");
13
- return;
14
- }
15
- let f = !1, g, n, i = null, l = null;
16
- const u = `${_}/api/v1/${a}`, p = `${u}/post/`;
17
- async function w() {
18
- return i || (y(n) ? (I("Reading Qwik Insight data from: " + n), i = JSON.parse(await k(n, "utf-8"))) : null);
19
- }
20
- return {
21
- name: "vite-plugin-qwik-insights",
22
- enforce: "pre",
23
- // Only activate in production builds
24
- apply: "build",
25
- async config(e) {
26
- return g = q(e.root || ".", m), n = B(g, "q-insights.json"), f = e.mode !== "ssr", {
27
- define: {
28
- "globalThis.__QI_KEY__": JSON.stringify(a),
29
- "globalThis.__QI_URL__": JSON.stringify(p)
30
- }
31
- };
32
- },
33
- configResolved: {
34
- // we want to register the bundle graph adder last so we overwrite existing routes
35
- order: "post",
36
- async handler(e) {
37
- if (l = e.plugins.find(
38
- (t) => t.name === "vite-plugin-qwik"
39
- ), !l)
40
- throw new Error("Missing vite-plugin-qwik");
41
- const c = l.api.getOptions();
42
- if (f)
43
- try {
44
- const t = { manual: {}, prefetch: [] }, o = await (await fetch(`${u}/bundles/strategy/`)).json();
45
- Object.assign(t, o), i = t, v(g, { recursive: !0 }), I("Fetched latest Qwik Insight data into: " + n), await $(n, JSON.stringify(t));
46
- } catch (t) {
47
- b(`Failed to fetch manifest from Insights DB at ${u}/bundles/strategy/`, t), await w();
48
- }
49
- else
50
- await w();
51
- i && (c.entryStrategy.manual = {
52
- ...i.manual,
53
- ...c.entryStrategy.manual
54
- }, l.api.registerBundleGraphAdder((t) => {
55
- const h = {};
56
- if (i)
57
- for (let o = 0; o < i.prefetch.length; o++) {
58
- const d = i.prefetch[o];
59
- if (d.symbols) {
60
- let s = d.route;
61
- s.startsWith("/") && (s = s.slice(1)), s.endsWith("/") || (s += "/"), h[s] = { ...t.bundles[s], imports: d.symbols };
62
- }
63
- }
64
- return h;
65
- }));
66
- }
67
- },
68
- closeBundle: async () => {
69
- const e = q(m, "q-manifest.json");
70
- if (f && y(e)) {
71
- const c = await k(e, "utf-8");
72
- try {
73
- await fetch(`${p}manifest`, {
74
- method: "post",
75
- body: c
76
- });
77
- } catch (t) {
78
- b(`Failed to post manifest to Insights DB at ${p}manifest`, t);
79
- }
80
- }
81
- }
82
- };
10
+ async function c(c) {
11
+ let { publicApiKey: l, baseUrl: u = "https://insights.qwik.dev", outDir: d = "" } = c;
12
+ if (!l) {
13
+ console.warn("qwikInsights: publicApiKey is required, skipping...");
14
+ return;
15
+ }
16
+ let f = !1, p, m, h = null, g = null, _ = `${u}/api/v1/${l}`, v = `${_}/post/`;
17
+ async function y() {
18
+ return h || (e(m) ? (s("Reading Qwik Insight data from: " + m), h = JSON.parse(await n(m, "utf-8"))) : null);
19
+ }
20
+ return {
21
+ name: "vite-plugin-qwik-insights",
22
+ enforce: "pre",
23
+ apply: "build",
24
+ async config(e) {
25
+ return p = a(e.root || ".", d), m = i(p, "q-insights.json"), f = e.mode !== "ssr", { define: {
26
+ "globalThis.__QI_KEY__": JSON.stringify(l),
27
+ "globalThis.__QI_URL__": JSON.stringify(v)
28
+ } };
29
+ },
30
+ configResolved: {
31
+ order: "post",
32
+ async handler(e) {
33
+ if (g = e.plugins.find((e) => e.name === "vite-plugin-qwik"), !g) throw Error("Missing vite-plugin-qwik");
34
+ let n = g.api.getOptions();
35
+ if (f) try {
36
+ let e = {
37
+ manual: {},
38
+ prefetch: []
39
+ }, n = await (await fetch(`${_}/bundles/strategy/`)).json();
40
+ Object.assign(e, n), h = e, t(p, { recursive: !0 }), s("Fetched latest Qwik Insight data into: " + m), await r(m, JSON.stringify(e));
41
+ } catch (e) {
42
+ o(`Failed to fetch manifest from Insights DB at ${_}/bundles/strategy/`, e), await y();
43
+ }
44
+ else await y();
45
+ h && (n.entryStrategy.manual = {
46
+ ...h.manual,
47
+ ...n.entryStrategy.manual
48
+ }, g.api.registerBundleGraphAdder((e) => {
49
+ let t = {};
50
+ if (h) for (let n = 0; n < h.prefetch.length; n++) {
51
+ let r = h.prefetch[n];
52
+ if (r.symbols) {
53
+ let n = r.route;
54
+ n.startsWith("/") && (n = n.slice(1)), n.endsWith("/") || (n += "/"), t[n] = {
55
+ ...e.bundles[n],
56
+ imports: r.symbols
57
+ };
58
+ }
59
+ }
60
+ return t;
61
+ }));
62
+ }
63
+ },
64
+ closeBundle: async () => {
65
+ let t = a(d, "q-manifest.json");
66
+ if (f && e(t)) {
67
+ let e = await n(t, "utf-8");
68
+ try {
69
+ await fetch(`${v}manifest`, {
70
+ method: "post",
71
+ body: e
72
+ });
73
+ } catch (e) {
74
+ o(`Failed to post manifest to Insights DB at ${v}manifest`, e);
75
+ }
76
+ }
77
+ }
78
+ };
83
79
  }
84
- export {
85
- O as qwikInsights
86
- };
80
+ //#endregion
81
+ export { c as qwikInsights };
@@ -1,3 +1,3 @@
1
- const QWIK_LOADER = "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]()},S=e=>{if(e.length){const t=()=>E(e);g=g?g.then(t,t):t()}},C=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 C(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 S(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 S(p);S(p)},P=e=>O(e,a,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+\":\"+r,s=v(\"[q-\"+CSS.escape(o)+\"]\"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(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\")}S(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\")}S(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))}S(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())";
2
- const QWIK_LOADER_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-\" + CSS.escape(scopedKebabName) + \"]\");\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}";
1
+ const QWIK_LOADER = "var e,t,n,r=document,o=window,s=\"w\",i=\"wp\",a=\"d\",c=\"dp\",l=\"e\",p=\"ep\",u=\"capture:\",d=\"readystatechange\",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.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]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if(\"SCRIPT\"===t.tagName&&\"qwik/json\"===t.getAttribute(\"type\")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute(\"q:instance\");return\"paused\"===e.getAttribute(\"q:container\")&&\"loading\"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{(\"loading\"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},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=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r[\"qFuncs_\"+e.getAttribute(\"q:instance\")]||[])[+i];if(!t&&c){const e=Error(\"sym:\"+i);I(\"qerror\",{importError:\"sync\",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.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=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute(\"preventdefault:\"+s)&&t.preventDefault(),e.hasAttribute(\"stoppropagation:\"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if(\"function\"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute(\"q-\"+n);if(l){const n=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),s=n.getAttribute(\"q:base\"),i=new URL(s,r.baseURI),c=l.split(\"|\"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split(\"#\"),q=n=>{if(n&&e.isConnected){const r=t=>{I(\"qerror\",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),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=l,n=!0)=>{const r=N(e.type),o=t+\":\"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+\":\"+r,s=v(\"[q-\"+CSS.escape(o)+\"]\"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if(\"interactive\"==n||\"complete\"==n){if(t=1,q.forEach(y),h.has(\"d:qinit\")){h.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\")}S(n)}if(h.has(\"d:qidle\")&&(h.delete(\"d:qidle\"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{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\")}S(n)})),h.has(\"e:qvisible\")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$(\"qvisible\",o),\"e:qvisible\",n))}S(n)}));const t=v(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute(\"q:observed\",\"true\")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if(\"string\"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||\"e:qvisible\"!==r&&\"d:qinit\"!==r&&\"d:qidle\"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H(\"e:click\",\"e:input\"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G())";
2
+ const QWIK_LOADER_DEBUG = "//#region packages/qwik/src/qwikloader.ts\nvar doc = document;\nvar win = window;\nvar windowPrefix = \"w\";\nvar passiveWindowPrefix = \"wp\";\nvar documentPrefix = \"d\";\nvar passiveDocumentPrefix = \"dp\";\nvar elementPrefix = \"e\";\nvar passiveElementPrefix = \"ep\";\nvar capturePrefix = \"capture:\";\nvar readyStateChange = \"readystatechange\";\nvar QwikEvContainerReady = 0;\nvar events = /* @__PURE__ */ new Set();\nvar roots = /* @__PURE__ */ new Set([doc]);\nvar symbols = /* @__PURE__ */ new Map();\nvar readyContainers = {};\nvar observer;\nvar hasInitialized;\nvar queuedTasks;\nvar nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nvar querySelectorAll = (query) => {\n\tconst elements = [];\n\troots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n\treturn elements;\n};\nvar addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, {\n\tcapture,\n\tpassive\n});\nvar findShadowRoots = (fragment) => {\n\taddEventOrRoot(fragment);\n\tconst shadowRoots = nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\");\n\tfor (let i = 0; i < shadowRoots.length; i++) {\n\t\tconst shadowRoot = shadowRoots[i].shadowRoot;\n\t\tshadowRoot && findShadowRoots(shadowRoot);\n\t}\n};\nvar isPromise = (promise) => promise && typeof promise.then === \"function\";\nvar runTasks = async (tasks) => {\n\tfor (let i = 0; i < tasks.length; i++) await tasks[i]();\n};\nvar queueTasks = (tasks) => {\n\tif (tasks.length) {\n\t\tconst run = () => runTasks(tasks);\n\t\tqueuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n\t}\n};\nvar resolveContainer = (containerEl) => {\n\tif (containerEl._qwikjson_ === void 0) {\n\t\tlet script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n\t\twhile (script) {\n\t\t\tif (script.tagName === \"SCRIPT\" && script.getAttribute(\"type\") === \"qwik/json\") {\n\t\t\t\tcontainerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\"));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tscript = script.previousElementSibling;\n\t\t}\n\t}\n};\nvar markContainerReady = (hash) => {\n\treadyContainers[hash] = 1;\n\temitEvent(readyStateChange);\n};\nvar waitForContainerReady = (container) => {\n\tconst hash = container.getAttribute(\"q:instance\");\n\treturn container.getAttribute(\"q:container\") === \"paused\" && doc.readyState === \"loading\" && !readyContainers[hash] && new Promise((resolve) => {\n\t\tconst ready = () => {\n\t\t\tif (doc.readyState !== \"loading\" || readyContainers[hash]) resolve();\n\t\t};\n\t\taddEventListener(doc, readyStateChange, ready);\n\t});\n};\nvar createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nvar emitEvent = (eventName, detail) => {\n\tdoc.dispatchEvent(createEvent(eventName, detail));\n};\nvar camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nvar kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nvar parseKebabEvent = (event) => {\n\tconst separatorIndex = event.indexOf(\":\");\n\treturn {\n\t\tscope: event.slice(0, separatorIndex),\n\t\teventName: kebabToCamel(event.slice(separatorIndex + 1))\n\t};\n};\nvar isPassiveScope = (scope) => scope.length === 2;\nvar getRootScope = (scope) => scope.charAt(0);\nvar isElementNode = (node) => !!node && node.nodeType === 1;\nvar isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute(\"q-\" + scopedKebabName));\nvar resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime, reportSyncError = true) => {\n\tconst eventData = {\n\t\tqBase,\n\t\tsymbol,\n\t\telement,\n\t\treqTime\n\t};\n\tif (!chunk) {\n\t\tconst handler = (doc[\"qFuncs_\" + container.getAttribute(\"q:instance\")] || [])[+symbol];\n\t\tif (!handler && reportSyncError) {\n\t\t\tconst error = /* @__PURE__ */ new Error(\"sym:\" + symbol);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"sync\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t}\n\t\treturn handler;\n\t}\n\tconst key = `${symbol}|${qBase}|${chunk}`;\n\tconst handler = symbols.get(key);\n\tif (handler) return handler;\n\tconst href = new URL(chunk, base).href;\n\tconst module = import(\n\t\t\t\thref\n);\n\tresolveContainer(container);\n\treturn module.then((module) => {\n\t\tconst handler = module[symbol];\n\t\tif (!handler) {\n\t\t\tconst error = /* @__PURE__ */ new Error(`${symbol} not in ${href}`);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"no-symbol\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t} else {\n\t\t\tsymbols.set(key, handler);\n\t\t\temitEvent(\"qsymbol\", eventData);\n\t\t}\n\t\treturn handler;\n\t}, (error) => {\n\t\temitEvent(\"qerror\", {\n\t\t\timportError: \"async\",\n\t\t\terror,\n\t\t\t...eventData\n\t\t});\n\t\tconsole.error(error);\n\t});\n};\n/**\n* Dispatch an event by invoking QRL handlers. If there are multiple handlers, they are awaited in\n* order.\n*/\nvar dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n\tlet defer = false;\n\tif (kebabName) {\n\t\tif (allowPreventDefault && element.hasAttribute(\"preventdefault:\" + kebabName)) ev.preventDefault();\n\t\tif (element.hasAttribute(\"stoppropagation:\" + kebabName)) ev.stopPropagation();\n\t}\n\tconst handlers = element._qDispatch?.[scopedKebabName];\n\tif (handlers) {\n\t\tif (typeof handlers === \"function\") {\n\t\t\tconst run = () => handlers(ev, element);\n\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) await result;\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (handlers.length) for (let i = 0; i < handlers.length; i++) {\n\t\t\tconst handler = handlers[i];\n\t\t\tif (handler) {\n\t\t\t\tconst run = () => handler(ev, element);\n\t\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) await result;\n\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\t\tdefer = true;\n\t\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tconst attrValue = element.getAttribute(\"q-\" + scopedKebabName);\n\tif (attrValue) {\n\t\tconst container = element.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");\n\t\tconst qBase = container.getAttribute(\"q:base\");\n\t\tconst base = new URL(qBase, doc.baseURI);\n\t\tconst qrls = attrValue.split(\"|\");\n\t\tconst waitForReady = waitForContainerReady(container);\n\t\tfor (let i = 0; i < qrls.length; i++) {\n\t\t\tconst qrl = qrls[i];\n\t\t\tconst reqTime = performance.now();\n\t\t\tconst [chunk, symbol, capturedIds] = qrl.split(\"#\");\n\t\t\tconst run = (handler) => {\n\t\t\t\tif (handler && element.isConnected) {\n\t\t\t\t\tconst onError = (error) => {\n\t\t\t\t\t\temitEvent(\"qerror\", {\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tqBase,\n\t\t\t\t\t\t\tsymbol,\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\treqTime\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = handler.call(capturedIds, ev, element);\n\t\t\t\t\t\tif (isPromise(result)) return result.catch(onError);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn onError(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst resolve = (reportSyncError = true) => resolveHandler(container, element, qBase, base, chunk, symbol, reqTime, reportSyncError);\n\t\t\tconst handler = waitForReady ? void 0 : resolve();\n\t\t\tif (waitForReady) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait waitForReady;\n\t\t\t\t\tawait run(await resolve(false) || await resolve());\n\t\t\t\t});\n\t\t\t} else if (isPromise(handler)) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(() => handler.then(run));\n\t\t\t} else if (defer) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait run(handler || await resolve());\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst result = run(handler);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n/**\n* Event handler responsible for processing element events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst captureAttribute = capturePrefix + kebabName;\n\tconst elements = [];\n\tconst captureHandlers = [];\n\tconst tasks = [];\n\tlet current = ev.target;\n\twhile (current) if (isElementNode(current)) {\n\t\telements.push(current);\n\t\tcaptureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n\t\tcurrent = current.parentElement;\n\t} else current = current.parentElement;\n\tfor (let i = elements.length - 1; i >= 0; i--) if (captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor (let i = 0; i < elements.length; i++) if (!captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (!ev.bubbles || ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tqueueTasks(tasks);\n};\nvar processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nvar broadcast = (scope, ev, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst elements = querySelectorAll(\"[q-\" + CSS.escape(scopedKebabName) + \"]\");\n\tconst tasks = [];\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst el = elements[i];\n\t\tdispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t}\n\tqueueTasks(tasks);\n};\n/**\n* Event handler responsible for processing browser events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processDocumentEvent = (ev) => {\n\tbroadcast(documentPrefix, ev);\n};\nvar processPassiveDocumentEvent = (ev) => {\n\tbroadcast(passiveDocumentPrefix, ev, false);\n};\nvar processWindowEvent = (ev) => {\n\tbroadcast(windowPrefix, ev);\n};\nvar processPassiveWindowEvent = (ev) => {\n\tbroadcast(passiveWindowPrefix, ev, false);\n};\n/**\n* Called when the document is ready and whenever a container is added, so make this idempotent. For\n* qidle and qinit we remove the attributes immediately, and for qvisible we add an attribute\n*/\nvar processReadyStateChange = () => {\n\tconst readyState = doc.readyState;\n\tif (readyState == \"interactive\" || readyState == \"complete\") {\n\t\thasInitialized = 1;\n\t\troots.forEach(findShadowRoots);\n\t\tif (events.has(\"d:qinit\")) {\n\t\t\tevents.delete(\"d:qinit\");\n\t\t\tconst ev = createEvent(\"qinit\");\n\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qinit]\");\n\t\t\tconst tasks = [];\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tdispatch(el, ev, \"d:qinit\", tasks);\n\t\t\t\tel.removeAttribute(\"q-d:qinit\");\n\t\t\t}\n\t\t\tqueueTasks(tasks);\n\t\t}\n\t\tif (events.has(\"d:qidle\")) {\n\t\t\tevents.delete(\"d:qidle\");\n\t\t\t(win.requestIdleCallback ?? win.setTimeout).bind(win)(() => {\n\t\t\t\tconst ev = createEvent(\"qidle\");\n\t\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qidle]\");\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\t\tconst el = elements[i];\n\t\t\t\t\tdispatch(el, ev, \"d:qidle\", tasks);\n\t\t\t\t\tel.removeAttribute(\"q-d:qidle\");\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t});\n\t\t}\n\t\tif (events.has(\"e:qvisible\")) {\n\t\t\tobserver || (observer = new IntersectionObserver((entries) => {\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tobserver.unobserve(entry.target);\n\t\t\t\t\t\tdispatch(entry.target, createEvent(\"qvisible\", entry), \"e:qvisible\", tasks);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t}));\n\t\t\tconst elements = querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tobserver.observe(el);\n\t\t\t\tel.setAttribute(\"q:observed\", \"true\");\n\t\t\t}\n\t\t}\n\t}\n};\nvar addEventOrRoot = (...eventNames) => {\n\tfor (let i = 0; i < eventNames.length; i++) {\n\t\tconst eventNameOrRoot = eventNames[i];\n\t\tif (eventNameOrRoot === QwikEvContainerReady) markContainerReady(eventNames[++i]);\n\t\telse if (typeof eventNameOrRoot === \"string\") {\n\t\t\tif (!events.has(eventNameOrRoot)) {\n\t\t\t\tevents.add(eventNameOrRoot);\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope === windowPrefix) addEventListener(win, eventName, passive ? processPassiveWindowEvent : processWindowEvent, true, passive);\n\t\t\t\telse roots.forEach((root) => addEventListener(root, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive));\n\t\t\t\tif (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) processReadyStateChange();\n\t\t\t}\n\t\t} else if (!roots.has(eventNameOrRoot)) {\n\t\t\tevents.forEach((kebabEventName) => {\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(kebabEventName);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope !== windowPrefix) addEventListener(eventNameOrRoot, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive);\n\t\t\t});\n\t\t\troots.add(eventNameOrRoot);\n\t\t}\n\t}\n};\nvar _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n\tif (Array.isArray(_qwikEv)) addEventOrRoot(..._qwikEv);\n\telse addEventOrRoot(\"e:click\", \"e:input\");\n\twin._qwikEv = {\n\t\tevents,\n\t\troots,\n\t\tpush: addEventOrRoot\n\t};\n\taddEventListener(doc, readyStateChange, processReadyStateChange);\n\tprocessReadyStateChange();\n}\n//#endregion";
3
3
  export { QWIK_LOADER, QWIK_LOADER_DEBUG };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/loader",
3
- "version": "2.0.0-beta.39-dev+6fb620f",
3
+ "version": "2.0.0-beta.40-dev+a459d55",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
@@ -239,10 +239,10 @@ declare interface QwikPluginOptions {
239
239
  }
240
240
 
241
241
  /** @public */
242
- export declare function qwikRollup(qwikRollupOpts?: QwikRollupPluginOptions): any;
242
+ export declare function qwikRolldown(qwikRolldownOpts?: QwikRolldownPluginOptions): any;
243
243
 
244
244
  /** @public */
245
- export declare interface QwikRollupPluginOptions {
245
+ export declare interface QwikRolldownPluginOptions {
246
246
  csr?: boolean;
247
247
  /**
248
248
  * Build `production` or `development`.
@@ -321,6 +321,22 @@ export declare interface QwikRollupPluginOptions {
321
321
  experimental?: (keyof typeof ExperimentalFeatures)[];
322
322
  }
323
323
 
324
+ /**
325
+ * Renamed to `qwikRolldown`.
326
+ *
327
+ * @deprecated Use `qwikRolldown`.
328
+ * @public
329
+ */
330
+ export declare const qwikRollup: typeof qwikRolldown;
331
+
332
+ /**
333
+ * Renamed to `QwikRolldownPluginOptions`.
334
+ *
335
+ * @deprecated Use `QwikRolldownPluginOptions`.
336
+ * @public
337
+ */
338
+ export declare type QwikRollupPluginOptions = QwikRolldownPluginOptions;
339
+
324
340
  /** @public */
325
341
  export declare interface QwikSymbol {
326
342
  origin: string;
@@ -340,7 +356,7 @@ export declare interface QwikSymbol {
340
356
  }
341
357
 
342
358
  /**
343
- * The types for Vite/Rollup don't allow us to be too specific about the return type. The correct
359
+ * The types for Vite/Rolldown don't allow us to be too specific about the return type. The correct
344
360
  * return type is `[QwikVitePlugin, VitePlugin<never>]`, and if you search the plugin by name you'll
345
361
  * get the `QwikVitePlugin`.
346
362
  *