@qwik.dev/core 2.0.0-beta.30 → 2.0.0-beta.31

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.
@@ -1,9 +1,20 @@
1
- import { isBrowser } from "@qwik.dev/core/build";
2
- const doc = isBrowser ? document : void 0;
3
- const config = { t: 0, o: 25, l: 0.65 };
4
- const rel = isBrowser && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
5
- const loadStart = Date.now();
1
+ import { isServer, isBrowser as isBrowser$2 } from "@qwik.dev/core/build";
2
+ const createMacroTask = (e) => {
3
+ let t;
4
+ if (typeof MessageChannel !== "undefined") {
5
+ const n = new MessageChannel();
6
+ n.port1.onmessage = () => e();
7
+ t = () => n.port2.postMessage(null);
8
+ } else t = () => setTimeout(e);
9
+ return t;
10
+ };
11
+ const isBrowser$1 = !isServer;
12
+ const doc = isBrowser$1 ? document : void 0;
13
+ const config = { t: 0, o: 25, u: 0.65 };
14
+ const rel = isBrowser$1 && doc.createElement("link").relList?.supports?.("modulepreload") ? "modulePreload" : "preload";
15
+ const loadStart = performance.now();
6
16
  const isJSRegex = /\.[mc]?js$/;
17
+ const yieldInterval = 1e3 / 60;
7
18
  const BundleImportState_None = 0;
8
19
  const BundleImportState_Queued = 1;
9
20
  const BundleImportState_Preload = 2;
@@ -13,178 +24,265 @@ const bundles = /* @__PURE__ */ new Map();
13
24
  let queueDirty;
14
25
  let preloadCount = 0;
15
26
  const queue = [];
27
+ const nextTriggerMacroTask = createMacroTask(trigger);
28
+ const nextAdjustmentMacroTask = createMacroTask(processPendingAdjustments);
29
+ let isTriggerScheduled = 0;
30
+ let isAdjustmentScheduled = 0;
31
+ let isProcessingAdjustments = 0;
32
+ const shouldYieldInBrowser = isBrowser$2;
33
+ const adjustmentStack = [];
16
34
  const log = (...e) => {
17
- console.log(`Preloader ${Date.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`, ...e);
35
+ console.log(`Preloader ${performance.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`, ...e);
18
36
  };
19
37
  const sortQueue = () => {
20
38
  if (queueDirty) {
21
- queue.sort((e, t) => e.u - t.u);
39
+ queue.sort((e, t) => e.l - t.l);
22
40
  queueDirty = 0;
23
41
  }
24
42
  };
25
- const trigger = () => {
43
+ function trigger() {
44
+ isTriggerScheduled = 0;
26
45
  if (!queue.length) return;
27
46
  sortQueue();
47
+ const e = performance.now() + yieldInterval;
48
+ let t = 0;
28
49
  while (queue.length) {
29
- const e = queue[0];
30
- const t = e.u;
31
- const o = 1 - t;
32
- const n = graph ? config.o : (
50
+ const n = queue[0];
51
+ const s = n.l;
52
+ const o = 1 - s;
53
+ const r = graph ? config.o : (
33
54
  // While the graph is not available, we limit to 5 preloads
34
55
  5
35
56
  );
36
- if (o >= 0.99 || preloadCount < n) {
57
+ if (o >= 0.99 || preloadCount < r) {
37
58
  queue.shift();
38
- preloadOne(e);
59
+ preloadOne(n);
60
+ if (performance.now() >= e) {
61
+ t = 1;
62
+ break;
63
+ }
39
64
  } else break;
40
65
  }
66
+ if (t && queue.length && !isTriggerScheduled) {
67
+ isTriggerScheduled = 1;
68
+ nextTriggerMacroTask();
69
+ }
41
70
  if (config.t && !queue.length) {
42
- const e = [...bundles.values()].filter((e2) => e2.i > BundleImportState_None);
43
- const t = e.reduce((e2, t2) => e2 + t2.p, 0);
44
- const o = e.reduce((e2, t2) => e2 + t2.$, 0);
45
- log(`>>>> done ${e.length}/${bundles.size} total: ${t}ms waited, ${o}ms loaded`);
71
+ const e2 = [...bundles.values()].filter((e3) => e3.i > BundleImportState_None);
72
+ const t2 = e2.reduce((e3, t3) => e3 + t3.m, 0);
73
+ const n = e2.reduce((e3, t3) => e3 + t3.p, 0);
74
+ log(`>>>> done ${e2.length}/${bundles.size} total: ${t2}ms waited, ${n}ms loaded`);
46
75
  }
76
+ }
77
+ const enqueueAdjustment = (e, t, n, s) => {
78
+ adjustmentStack.unshift({ $: e, l: t, B: s, h: n });
47
79
  };
48
- const preloadOne = (e) => {
49
- if (e.i >= BundleImportState_Preload) return;
50
- preloadCount++;
51
- const t = Date.now();
52
- e.p = t - e.B;
53
- e.i = BundleImportState_Preload;
54
- config.t && log(`<< load ${Math.round((1 - e.u) * 100)}% after ${`${e.p}ms`}`, e.m);
55
- const o = doc.createElement("link");
56
- o.href = new URL(`${base}${e.m}`, doc.baseURI).toString();
57
- o.rel = rel;
58
- o.as = "script";
59
- o.onload = o.onerror = () => {
60
- preloadCount--;
61
- const n = Date.now();
62
- e.$ = n - t;
63
- e.i = BundleImportState_Loaded;
64
- config.t && log(`>> done after ${e.$}ms`, e.m);
65
- o.remove();
66
- trigger();
67
- };
68
- doc.head.appendChild(o);
69
- };
70
- const adjustProbabilities = (e, t, o) => {
71
- if (o?.has(e)) return;
72
- const n = e.u;
73
- e.u = t;
74
- if (n - e.u < 0.01) return;
80
+ const processAdjustmentFrame = () => {
81
+ const e = adjustmentStack[adjustmentStack.length - 1];
82
+ const t = e.$;
83
+ if (e.S) {
84
+ const n2 = e.j;
85
+ if (n2 >= e.S.length) {
86
+ adjustmentStack.pop();
87
+ return 0;
88
+ }
89
+ const s = e.S[n2];
90
+ e.j = n2 + 1;
91
+ const o = getBundle(s.k);
92
+ if (o.l === 0) return 1;
93
+ const r = 1 - t.l;
94
+ let a;
95
+ if (r === 1 || r >= 0.99 && e.h.T < 100) {
96
+ e.h.T++;
97
+ a = Math.min(0.01, 1 - s.I);
98
+ } else {
99
+ const e2 = 1 - s.I * r;
100
+ const t2 = s.A;
101
+ const n3 = e2 / t2;
102
+ a = Math.max(0.02, o.l * n3);
103
+ s.A = n3;
104
+ }
105
+ adjustmentStack.push({ $: o, l: a, B: e.B, h: e.h });
106
+ return 1;
107
+ }
108
+ if (e.B?.has(t)) {
109
+ adjustmentStack.pop();
110
+ return 0;
111
+ }
112
+ const n = t.l;
113
+ t.l = e.l;
114
+ if (n - t.l < 0.01) {
115
+ adjustmentStack.pop();
116
+ return 0;
117
+ }
75
118
  if (
76
119
  // don't queue until we have initialized the preloader
77
- base != null && e.i < BundleImportState_Preload
120
+ base != null && t.i < BundleImportState_Preload
78
121
  ) {
79
- if (e.i === BundleImportState_None) {
80
- e.i = BundleImportState_Queued;
81
- queue.push(e);
82
- config.t && log(`queued ${Math.round((1 - e.u) * 100)}%`, e.m);
122
+ if (t.i === BundleImportState_None) {
123
+ t.i = BundleImportState_Queued;
124
+ queue.push(t);
125
+ config.t && log(`queued ${Math.round((1 - t.l) * 100)}%`, t.k);
83
126
  }
84
127
  queueDirty = 1;
85
128
  }
86
- if (e.h) {
87
- o ||= /* @__PURE__ */ new Set();
88
- o.add(e);
89
- const t2 = 1 - e.u;
90
- for (const n2 of e.h) {
91
- const e2 = getBundle(n2.m);
92
- if (e2.u === 0) continue;
93
- let r;
94
- if (t2 === 1 || t2 >= 0.99 && depsCount < 100) {
95
- depsCount++;
96
- r = Math.min(0.01, 1 - n2.S);
97
- } else {
98
- const o2 = 1 - n2.S * t2;
99
- const s = n2.q;
100
- const l = o2 / s;
101
- r = Math.max(0.02, e2.u * l);
102
- n2.q = l;
129
+ if (t.S?.length) {
130
+ const n2 = e.B || /* @__PURE__ */ new Set();
131
+ n2.add(t);
132
+ e.B = n2;
133
+ e.S = t.S;
134
+ e.j = 0;
135
+ return 0;
136
+ }
137
+ adjustmentStack.pop();
138
+ return 0;
139
+ };
140
+ function processPendingAdjustments() {
141
+ if (isProcessingAdjustments || !adjustmentStack.length) return;
142
+ isAdjustmentScheduled = 0;
143
+ isProcessingAdjustments = 1;
144
+ const e = shouldYieldInBrowser ? performance.now() + yieldInterval : 0;
145
+ let t = 0;
146
+ while (adjustmentStack.length) {
147
+ t = 1;
148
+ const n = processAdjustmentFrame();
149
+ if (shouldYieldInBrowser && n && performance.now() >= e) {
150
+ if (!isAdjustmentScheduled) {
151
+ isAdjustmentScheduled = 1;
152
+ nextAdjustmentMacroTask();
103
153
  }
104
- adjustProbabilities(e2, r, o);
154
+ break;
105
155
  }
106
156
  }
157
+ isProcessingAdjustments = 0;
158
+ if (t && shouldYieldInBrowser) nextTriggerMacroTask();
159
+ }
160
+ const preloadOne = (e) => {
161
+ if (e.i >= BundleImportState_Preload) return;
162
+ preloadCount++;
163
+ const t = performance.now();
164
+ e.m = t - e.M;
165
+ e.i = BundleImportState_Preload;
166
+ config.t && log(`<< load ${Math.round((1 - e.l) * 100)}% after ${`${e.m}ms`}`, e.k);
167
+ const n = doc.createElement("link");
168
+ n.href = new URL(`${base}${e.k}`, doc.baseURI).toString();
169
+ n.rel = rel;
170
+ n.as = "script";
171
+ n.onload = n.onerror = () => {
172
+ preloadCount--;
173
+ const s = performance.now();
174
+ e.p = s - t;
175
+ e.i = BundleImportState_Loaded;
176
+ config.t && log(`>> done after ${e.p}ms`, e.k);
177
+ n.remove();
178
+ nextTriggerMacroTask();
179
+ };
180
+ doc.head.appendChild(n);
107
181
  };
108
- const handleBundle = (e, t) => {
109
- const o = getBundle(e);
110
- if (o && o.u > t) adjustProbabilities(o, t);
182
+ const adjustProbabilities = (e, t, n) => {
183
+ enqueueAdjustment(e, t, { T: 0 }, n);
184
+ if (shouldYieldInBrowser) nextAdjustmentMacroTask();
185
+ else processPendingAdjustments();
186
+ };
187
+ const handleBundle = (e, t, n) => {
188
+ const s = getBundle(e);
189
+ if (s && s.l > t) if (n) enqueueAdjustment(s, t, n);
190
+ else adjustProbabilities(s, t);
111
191
  };
112
- let depsCount;
113
192
  const preload = (e, t) => {
114
193
  if (!e?.length) return;
115
- depsCount = 0;
116
- let o = t ? 1 - t : 0.4;
194
+ let n = t ? 1 - t : 0.4;
195
+ const s = { T: 0 };
117
196
  if (Array.isArray(e)) for (let t2 = e.length - 1; t2 >= 0; t2--) {
118
- const n = e[t2];
119
- if (typeof n === "number") o = 1 - n / 10;
120
- else handleBundle(n, o);
197
+ const o = e[t2];
198
+ if (typeof o === "number") n = 1 - o / 10;
199
+ else handleBundle(o, n, s);
121
200
  }
122
- else handleBundle(e, o);
123
- if (isBrowser) trigger();
201
+ else handleBundle(e, n, s);
202
+ if (shouldYieldInBrowser) nextAdjustmentMacroTask();
203
+ else processPendingAdjustments();
124
204
  };
125
- if (isBrowser) document.addEventListener("qsymbol", (e) => {
126
- const { symbol: t, href: o } = e.detail;
127
- if (o) {
205
+ if (isBrowser$2) document.addEventListener("qsymbol", (e) => {
206
+ const { symbol: t, href: n } = e.detail;
207
+ if (n) {
128
208
  const e2 = t.slice(t.lastIndexOf("_") + 1);
129
209
  preload(e2, 1);
130
210
  }
131
211
  });
132
212
  let base;
133
213
  let graph;
134
- const makeBundle = (e, t) => ({ m: e, i: isJSRegex.test(e) ? BundleImportState_None : BundleImportState_Alias, h: t, u: 1, B: Date.now(), p: 0, $: 0 });
214
+ const isBrowser = !isServer;
215
+ const makeBundle = (e, t) => ({ k: e, i: isJSRegex.test(e) ? BundleImportState_None : BundleImportState_Alias, S: t, l: 1, M: performance.now(), m: 0, p: 0 });
135
216
  const parseBundleGraph = (e) => {
136
217
  const t = /* @__PURE__ */ new Map();
137
- let o = 0;
138
- while (o < e.length) {
139
- const n = e[o++];
140
- const r = [];
141
- let s;
142
- let l = 1;
143
- while (s = e[o], typeof s === "number") {
144
- if (s < 0) l = -s / 10;
145
- else r.push({ m: e[s], S: l, q: 1 });
146
- o++;
218
+ let n = 0;
219
+ while (n < e.length) {
220
+ const s = e[n++];
221
+ const o = [];
222
+ let r;
223
+ let a = 1;
224
+ while (r = e[n], typeof r === "number") {
225
+ if (r < 0) a = -r / 10;
226
+ else o.push({ k: e[r], I: a, A: 1 });
227
+ n++;
147
228
  }
148
- t.set(n, r);
229
+ t.set(s, o);
149
230
  }
150
231
  return t;
151
232
  };
152
233
  const getBundle = (e) => {
153
234
  let t = bundles.get(e);
154
235
  if (!t) {
155
- let o;
236
+ let n;
156
237
  if (graph) {
157
- o = graph.get(e);
158
- if (!o) return;
159
- if (!o.length) o = void 0;
238
+ n = graph.get(e);
239
+ if (!n) return;
240
+ if (!n.length) n = void 0;
160
241
  }
161
- t = makeBundle(e, o);
242
+ t = makeBundle(e, n);
162
243
  bundles.set(e, t);
163
244
  }
164
245
  return t;
165
246
  };
166
- const loadBundleGraph = (e, t, o) => {
167
- if (o) {
168
- if ("d" in o) config.t = !!o.d;
169
- if ("P" in o) config.o = o["P"];
170
- if ("Q" in o) config.l = 1 - o["Q"];
247
+ const loadBundleGraph = (e, t, n) => {
248
+ if (n) {
249
+ if ("d" in n) config.t = !!n.d;
250
+ if ("P" in n) config.o = n["P"];
251
+ if ("Q" in n) config.u = 1 - n["Q"];
171
252
  }
172
253
  if (!isBrowser || e == null) return;
173
254
  base = e;
174
255
  if (t) t.then((e2) => e2.text()).then((e2) => {
175
256
  graph = parseBundleGraph(JSON.parse(e2));
176
257
  const t2 = [];
177
- for (const [e3, o2] of graph.entries()) {
178
- const n = getBundle(e3);
179
- n.h = o2;
180
- if (n.u < 1) {
181
- t2.push([n, n.u]);
182
- n.u = 1;
258
+ for (const [e3, n3] of graph.entries()) {
259
+ const s2 = getBundle(e3);
260
+ s2.S = n3;
261
+ if (s2.l < 1) {
262
+ t2.push([s2, s2.l]);
263
+ s2.l = 1;
183
264
  }
184
265
  }
185
266
  config.t && log(`parseBundleGraph got ${graph.size} bundles, adjusting ${t2.length}`);
186
- for (const [e3, o2] of t2) adjustProbabilities(e3, o2);
187
- trigger();
267
+ if (!t2.length) {
268
+ nextTriggerMacroTask();
269
+ return;
270
+ }
271
+ let n2 = 0;
272
+ const s = createMacroTask(() => {
273
+ const e3 = performance.now() + yieldInterval;
274
+ while (n2 < t2.length) {
275
+ const [o, r] = t2[n2];
276
+ n2++;
277
+ adjustProbabilities(o, r);
278
+ if (n2 < t2.length && performance.now() >= e3) {
279
+ s();
280
+ return;
281
+ }
282
+ }
283
+ nextTriggerMacroTask();
284
+ });
285
+ s();
188
286
  }).catch(console.warn);
189
287
  };
190
288
  export {
@@ -16,10 +16,12 @@ const querySelectorAll = (query) => {
16
16
  const addEventListener = (el, eventName, handler, capture = false) => el.addEventListener(eventName, handler, { capture, passive: false });
17
17
  const findShadowRoots = (fragment) => {
18
18
  addEventOrRoot(fragment);
19
- nativeQuerySelectorAll(fragment, "[q\\:shadowroot]").forEach((parent) => {
19
+ const shadowRoots = nativeQuerySelectorAll(fragment, "[q\\:shadowroot]");
20
+ for (let i = 0; i < shadowRoots.length; i++) {
21
+ const parent = shadowRoots[i];
20
22
  const shadowRoot = parent.shadowRoot;
21
23
  shadowRoot && findShadowRoots(shadowRoot);
22
- });
24
+ }
23
25
  };
24
26
  const isPromise = (promise) => promise && typeof promise.then === "function";
25
27
  const resolveContainer = (containerEl) => {
@@ -81,7 +83,9 @@ const dispatch = async (element, ev, scopedKebabName, kebabName) => {
81
83
  );
82
84
  const qBase = container.getAttribute("q:base");
83
85
  const base = new URL(qBase, doc.baseURI);
84
- for (const qrl of attrValue.split("|")) {
86
+ const qrls = attrValue.split("|");
87
+ for (let i = 0; i < qrls.length; i++) {
88
+ const qrl = qrls[i];
85
89
  const reqTime = performance.now();
86
90
  const [chunk, symbol, capturedIds] = qrl.split("#");
87
91
  const eventData = {
@@ -163,9 +167,11 @@ const processElementEvent = async (ev) => {
163
167
  const broadcast = (infix, ev) => {
164
168
  const kebabName = camelToKebab(ev.type);
165
169
  const scopedKebabName = infix + ":" + kebabName;
166
- querySelectorAll("[q-" + infix + "\\:" + kebabName + "]").forEach(
167
- (el) => dispatch(el, ev, scopedKebabName, kebabName)
168
- );
170
+ const elements = querySelectorAll("[q-" + infix + "\\:" + kebabName + "]");
171
+ for (let i = 0; i < elements.length; i++) {
172
+ const el = elements[i];
173
+ dispatch(el, ev, scopedKebabName, kebabName);
174
+ }
169
175
  };
170
176
  const processDocumentEvent = async (ev) => {
171
177
  broadcast(documentPrefix, ev);
@@ -181,35 +187,42 @@ const processReadyStateChange = () => {
181
187
  if (events.has("d:qinit")) {
182
188
  events.delete("d:qinit");
183
189
  const ev = createEvent("qinit");
184
- querySelectorAll("[q-d\\:qinit]").forEach((el) => {
190
+ const elements = querySelectorAll("[q-d\\:qinit]");
191
+ for (let i = 0; i < elements.length; i++) {
192
+ const el = elements[i];
185
193
  dispatch(el, ev, "d:qinit");
186
194
  el.removeAttribute("q-d:qinit");
187
- });
195
+ }
188
196
  }
189
197
  if (events.has("d:qidle")) {
190
198
  events.delete("d:qidle");
191
199
  const riC = win.requestIdleCallback ?? win.setTimeout;
192
200
  riC.bind(win)(() => {
193
201
  const ev = createEvent("qidle");
194
- querySelectorAll("[q-d\\:qidle]").forEach((el) => {
202
+ const elements = querySelectorAll("[q-d\\:qidle]");
203
+ for (let i = 0; i < elements.length; i++) {
204
+ const el = elements[i];
195
205
  dispatch(el, ev, "d:qidle");
196
206
  el.removeAttribute("q-d:qidle");
197
- });
207
+ }
198
208
  });
199
209
  }
200
210
  if (events.has("e:qvisible")) {
201
211
  observer || (observer = new IntersectionObserver((entries) => {
202
- for (const entry of entries) {
212
+ for (let i = 0; i < entries.length; i++) {
213
+ const entry = entries[i];
203
214
  if (entry.isIntersecting) {
204
215
  observer.unobserve(entry.target);
205
216
  dispatch(entry.target, createEvent("qvisible", entry), "e:qvisible");
206
217
  }
207
218
  }
208
219
  }));
209
- querySelectorAll("[q-e\\:qvisible]:not([q\\:observed])").forEach((el) => {
220
+ const elements = querySelectorAll("[q-e\\:qvisible]:not([q\\:observed])");
221
+ for (let i = 0; i < elements.length; i++) {
222
+ const el = elements[i];
210
223
  observer.observe(el);
211
224
  el.setAttribute("q:observed", "true");
212
- });
225
+ }
213
226
  }
214
227
  }
215
228
  };
@@ -1 +1 @@
1
- const e=document,t=window,o="w",n="d",r=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(o=>t.push(...l(o,e))),t},d=(e,t,o,n=!1)=>e.addEventListener(t,o,{capture:n,passive:!1}),b=e=>{_(e),l(e,"[q\\:shadowroot]").forEach(e=>{const t=e.shadowRoot;t&&b(t)})},f=e=>e&&"function"==typeof e.then,p=t=>{if(void 0===t._qwikjson_){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if("SCRIPT"===o.tagName&&"qwik/json"===o.getAttribute("type")){t._qwikjson_=JSON.parse(o.textContent.replace(/\\x3C(\/?script)/gi,"<$1"));break}o=o.previousElementSibling}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,o)=>{e.dispatchEvent(u(t,o))},m=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),v=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:v(e.slice(2))}),y=async(t,o,n,r)=>{r&&(t.hasAttribute("preventdefault:"+r)&&o.preventDefault(),t.hasAttribute("stoppropagation:"+r)&&o.stopPropagation());const s=t._qDispatch?.[n];if(s){if("function"==typeof s){const e=s(o,t);f(e)&&await e}else if(s.length)for(let e=0;e<s.length;e++){const n=s[e],r=n?.(o,t);f(r)&&await r}return}const a=t.getAttribute("q-"+n);if(a){const n=t.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),r=n.getAttribute("q:base"),s=new URL(r,e.baseURI);for(const c of a.split("|")){const a=performance.now(),[l,q,d]=c.split("#"),b={qBase:r,symbol:q,element:t,reqTime:a};let u,m,v;if(""===l){const t=n.getAttribute("q:instance");u=(e["qFuncs_"+t]||[])[Number.parseInt(q)],u||(m="sync",v=Error("sym:"+q))}else{const e=`${q}|${r}|${l}`;if(u=i.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(n),u=(await o)[q],u?(i.set(e,u),h("qsymbol",b)):(m="no-symbol",v=Error(`${q} not in ${t}`))}catch(e){m="async",v=e}}}if(u){if(t.isConnected)try{const e=u.call(d,o,t);f(e)&&await e}catch(e){h("qerror",{error:e,...b})}}else h("qerror",{importError:m,error:v,...b}),console.error(v)}}},g=async e=>{const t=m(e.type),o="e:"+t;let n=e.target;for(;n&&n.getAttribute;){const r=y(n,e,o,t),s=e.bubbles&&!e.cancelBubble;f(r)&&await r,n=s&&e.bubbles&&!e.cancelBubble?n.parentElement:null}},E=(e,t)=>{const o=m(t.type),n=e+":"+o;q("[q-"+e+"\\:"+o+"]").forEach(e=>y(e,t,n,o))},A=async e=>{E(n,e)},C=e=>{E(o,e)},k=()=>{const o=e.readyState;if("interactive"==o||"complete"==o){if(c=1,s.forEach(b),r.has("d:qinit")){r.delete("d:qinit");const e=u("qinit");q("[q-d\\:qinit]").forEach(t=>{y(t,e,"d:qinit"),t.removeAttribute("q-d:qinit")})}r.has("d:qidle")&&(r.delete("d:qidle"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u("qidle");q("[q-d\\:qidle]").forEach(t=>{y(t,e,"d:qidle"),t.removeAttribute("q-d:qidle")})})),r.has("e:qvisible")&&(a||(a=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(a.unobserve(t.target),y(t.target,u("qvisible",t),"e:qvisible"))})),q("[q-e\\:qvisible]:not([q\\:observed])").forEach(e=>{a.observe(e),e.setAttribute("q:observed","true")}))}},_=(...e)=>{for(let i=0;i<e.length;i++){const a=e[i];if("string"==typeof a){if(!r.has(a)){r.add(a);const{scope:e,eventName:i}=w(a);e===o?d(t,i,C,!0):s.forEach(t=>d(t,i,e===n?A:g,!0)),1!==c||"e:qvisible"!==a&&"d:qinit"!==a&&"d:qidle"!==a||k()}}else s.has(a)||(r.forEach(e=>{const{scope:t,eventName:r}=w(e);t!==o&&d(a,r,t===n?A:g,!0)}),s.add(a))}},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_("e:click","e:input"),t._qwikEv={events:r,roots:s,push:_},d(e,"readystatechange",k),k());
1
+ const e=document,t=window,n="w",o="d",r=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(n=>t.push(...l(n,e))),t},d=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),b=e=>{_(e);const t=l(e,"[q\\:shadowroot]");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&b(n)}},f=e=>e&&"function"==typeof e.then,p=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}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,n)=>{e.dispatchEvent(u(t,n))},g=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),m=e=>e.replace(/-./g,e=>e[1].toUpperCase()),v=e=>({scope:e.charAt(0),eventName:m(e.slice(2))}),w=async(t,n,o,r)=>{r&&(t.hasAttribute("preventdefault:"+r)&&n.preventDefault(),t.hasAttribute("stoppropagation:"+r)&&n.stopPropagation());const s=t._qDispatch?.[o];if(s){if("function"==typeof s){const e=s(n,t);f(e)&&await e}else if(s.length)for(let e=0;e<s.length;e++){const o=s[e],r=o?.(n,t);f(r)&&await r}return}const a=t.getAttribute("q-"+o);if(a){const o=t.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),r=o.getAttribute("q:base"),s=new URL(r,e.baseURI),c=a.split("|");for(let a=0;a<c.length;a++){const l=c[a],q=performance.now(),[d,b,u]=l.split("#"),g={qBase:r,symbol:b,element:t,reqTime:q};let m,v,w;if(""===d){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(b)],m||(v="sync",w=Error("sym:"+b))}else{const e=`${b}|${r}|${d}`;if(m=i.get(e),!m){const t=new URL(d,s).href;try{const n=import(t);p(o),m=(await n)[b],m?(i.set(e,m),h("qsymbol",g)):(v="no-symbol",w=Error(`${b} not in ${t}`))}catch(e){v="async",w=e}}}if(m){if(t.isConnected)try{const e=m.call(u,n,t);f(e)&&await e}catch(e){h("qerror",{error:e,...g})}}else h("qerror",{importError:v,error:w,...g}),console.error(w)}}},y=async e=>{const t=g(e.type),n="e:"+t;let o=e.target;for(;o&&o.getAttribute;){const r=w(o,e,n,t),s=e.bubbles&&!e.cancelBubble;f(r)&&await r,o=s&&e.bubbles&&!e.cancelBubble?o.parentElement:null}},A=(e,t)=>{const n=g(t.type),o=e+":"+n,r=q("[q-"+e+"\\:"+n+"]");for(let e=0;e<r.length;e++){const s=r[e];w(s,t,o,n)}},E=async e=>{A(o,e)},C=e=>{A(n,e)},k=()=>{const n=e.readyState;if("interactive"==n||"complete"==n){if(c=1,s.forEach(b),r.has("d:qinit")){r.delete("d:qinit");const e=u("qinit"),t=q("[q-d\\:qinit]");for(let n=0;n<t.length;n++){const o=t[n];w(o,e,"d:qinit"),o.removeAttribute("q-d:qinit")}}if(r.has("d:qidle")&&(r.delete("d:qidle"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u("qidle"),t=q("[q-d\\:qidle]");for(let n=0;n<t.length;n++){const o=t[n];w(o,e,"d:qidle"),o.removeAttribute("q-d:qidle")}})),r.has("e:qvisible")){a||(a=new IntersectionObserver(e=>{for(let t=0;t<e.length;t++){const n=e[t];n.isIntersecting&&(a.unobserve(n.target),w(n.target,u("qvisible",n),"e:qvisible"))}}));const e=q("[q-e\\:qvisible]:not([q\\:observed])");for(let t=0;t<e.length;t++){const n=e[t];a.observe(n),n.setAttribute("q:observed","true")}}}},_=(...e)=>{for(let i=0;i<e.length;i++){const a=e[i];if("string"==typeof a){if(!r.has(a)){r.add(a);const{scope:e,eventName:i}=v(a);e===n?d(t,i,C,!0):s.forEach(t=>d(t,i,e===o?E:y,!0)),1!==c||"e:qvisible"!==a&&"d:qinit"!==a&&"d:qidle"!==a||k()}}else s.has(a)||(r.forEach(e=>{const{scope:t,eventName:r}=v(e);t!==n&&d(a,r,t===o?E:y,!0)}),s.add(a))}},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_("e:click","e:input"),t._qwikEv={events:r,roots:s,push:_},d(e,"readystatechange",k),k());