@qwik.dev/core 0.0.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/LICENSE +22 -0
  2. package/bindings/qwik.darwin-arm64.node +0 -0
  3. package/bindings/qwik.darwin-x64.node +0 -0
  4. package/bindings/qwik.linux-x64-gnu.node +0 -0
  5. package/bindings/qwik.wasm.cjs +484 -0
  6. package/bindings/qwik.wasm.mjs +477 -0
  7. package/bindings/qwik.win32-x64-msvc.node +0 -0
  8. package/bindings/qwik_wasm_bg.wasm +0 -0
  9. package/build.d.ts +2 -0
  10. package/dist/build/index.cjs +35 -0
  11. package/dist/build/index.cjs.map +7 -0
  12. package/dist/build/index.d.ts +22 -0
  13. package/dist/build/index.dev.cjs +37 -0
  14. package/dist/build/index.dev.cjs.map +7 -0
  15. package/dist/build/index.dev.mjs +12 -0
  16. package/dist/build/index.dev.mjs.map +7 -0
  17. package/dist/build/index.mjs +12 -0
  18. package/dist/build/index.mjs.map +7 -0
  19. package/dist/build/index.prod.cjs +37 -0
  20. package/dist/build/index.prod.cjs.map +7 -0
  21. package/dist/build/index.prod.mjs +12 -0
  22. package/dist/build/index.prod.mjs.map +7 -0
  23. package/dist/build/package.json +8 -0
  24. package/dist/cli.cjs +4890 -0
  25. package/dist/core-internal.d.ts +3895 -0
  26. package/dist/core.cjs +10929 -0
  27. package/dist/core.cjs.map +1 -0
  28. package/dist/core.min.mjs +1 -0
  29. package/dist/core.mjs +10825 -0
  30. package/dist/core.mjs.map +1 -0
  31. package/dist/core.prod.cjs +5184 -0
  32. package/dist/core.prod.mjs +6028 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/insights/index.d.ts +1 -0
  35. package/dist/insights/index.qwik.cjs +751 -0
  36. package/dist/insights/index.qwik.mjs +751 -0
  37. package/dist/insights/insights.d.ts +59 -0
  38. package/dist/insights/vite/index.cjs +82 -0
  39. package/dist/insights/vite/index.d.ts +1 -0
  40. package/dist/insights/vite/index.mjs +55 -0
  41. package/dist/insights/vite/insights-plugin.d.ts +10 -0
  42. package/dist/jsx-runtime/index.d.ts +2 -0
  43. package/dist/jsx-runtime.d.ts +2 -0
  44. package/dist/loader/index.cjs +4 -0
  45. package/dist/loader/index.d.ts +2 -0
  46. package/dist/loader/index.mjs +3 -0
  47. package/dist/loader/package.json +8 -0
  48. package/dist/optimizer.cjs +9140 -0
  49. package/dist/optimizer.d.ts +707 -0
  50. package/dist/optimizer.mjs +9704 -0
  51. package/dist/prefetch/index.cjs +4 -0
  52. package/dist/prefetch/index.d.ts +2 -0
  53. package/dist/prefetch/index.mjs +3 -0
  54. package/dist/prefetch/package.json +8 -0
  55. package/dist/qwik-prefetch.debug.js +244 -0
  56. package/dist/qwik-prefetch.js +1 -0
  57. package/dist/qwikloader.debug.js +228 -0
  58. package/dist/qwikloader.js +3 -0
  59. package/dist/server-modules.d.ts +38 -0
  60. package/dist/server.cjs +8948 -0
  61. package/dist/server.d.ts +404 -0
  62. package/dist/server.mjs +8883 -0
  63. package/dist/starters/adapters/aws-lambda/.eslintignore +2 -0
  64. package/dist/starters/adapters/aws-lambda/.prettierignore +2 -0
  65. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +21 -0
  66. package/dist/starters/adapters/aws-lambda/gitignore +2 -0
  67. package/dist/starters/adapters/aws-lambda/package.json +23 -0
  68. package/dist/starters/adapters/aws-lambda/serverless.yml +31 -0
  69. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +32 -0
  70. package/dist/starters/adapters/azure-swa/README.md +13 -0
  71. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +23 -0
  72. package/dist/starters/adapters/azure-swa/azure-functions/host.json +20 -0
  73. package/dist/starters/adapters/azure-swa/gitignore +3 -0
  74. package/dist/starters/adapters/azure-swa/package.json +28 -0
  75. package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +23 -0
  76. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +22 -0
  77. package/dist/starters/adapters/azure-swa/swa-cli.config.json +11 -0
  78. package/dist/starters/adapters/bun/README.md +9 -0
  79. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +28 -0
  80. package/dist/starters/adapters/bun/package.json +27 -0
  81. package/dist/starters/adapters/bun/src/entry.bun.ts +46 -0
  82. package/dist/starters/adapters/cloud-run/Dockerfile +24 -0
  83. package/dist/starters/adapters/cloud-run/README.md +7 -0
  84. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +15 -0
  85. package/dist/starters/adapters/cloud-run/package.json +24 -0
  86. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +96 -0
  87. package/dist/starters/adapters/cloudflare-pages/README.md +46 -0
  88. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +15 -0
  89. package/dist/starters/adapters/cloudflare-pages/gitignore +2 -0
  90. package/dist/starters/adapters/cloudflare-pages/package.json +28 -0
  91. package/dist/starters/adapters/cloudflare-pages/public/_headers +9 -0
  92. package/dist/starters/adapters/cloudflare-pages/public/_redirects +1 -0
  93. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +24 -0
  94. package/dist/starters/adapters/deno/README.md +9 -0
  95. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +23 -0
  96. package/dist/starters/adapters/deno/package.json +24 -0
  97. package/dist/starters/adapters/deno/src/entry.deno.ts +45 -0
  98. package/dist/starters/adapters/express/README.md +9 -0
  99. package/dist/starters/adapters/express/adapters/express/vite.config.mts +15 -0
  100. package/dist/starters/adapters/express/package.json +33 -0
  101. package/dist/starters/adapters/express/src/entry.express.tsx +70 -0
  102. package/dist/starters/adapters/fastify/README.md +9 -0
  103. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +15 -0
  104. package/dist/starters/adapters/fastify/package.json +33 -0
  105. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +48 -0
  106. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +42 -0
  107. package/dist/starters/adapters/firebase/.eslintignore +1 -0
  108. package/dist/starters/adapters/firebase/.prettierignore +1 -0
  109. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +21 -0
  110. package/dist/starters/adapters/firebase/firebase.json +24 -0
  111. package/dist/starters/adapters/firebase/functions/.gitkeep +0 -0
  112. package/dist/starters/adapters/firebase/functions/index.js +5 -0
  113. package/dist/starters/adapters/firebase/functions/package.json +25 -0
  114. package/dist/starters/adapters/firebase/gitignore +3 -0
  115. package/dist/starters/adapters/firebase/package.json +24 -0
  116. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +22 -0
  117. package/dist/starters/adapters/netlify-edge/README.md +64 -0
  118. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +16 -0
  119. package/dist/starters/adapters/netlify-edge/gitignore +2 -0
  120. package/dist/starters/adapters/netlify-edge/netlify.toml +3 -0
  121. package/dist/starters/adapters/netlify-edge/package.json +29 -0
  122. package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
  123. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +22 -0
  124. package/dist/starters/adapters/node-server/README.md +12 -0
  125. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +15 -0
  126. package/dist/starters/adapters/node-server/package.json +23 -0
  127. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +39 -0
  128. package/dist/starters/adapters/static/README.md +5 -0
  129. package/dist/starters/adapters/static/adapters/static/vite.config.mts +19 -0
  130. package/dist/starters/adapters/static/package.json +19 -0
  131. package/dist/starters/adapters/vercel-edge/README.md +43 -0
  132. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +16 -0
  133. package/dist/starters/adapters/vercel-edge/gitignore +2 -0
  134. package/dist/starters/adapters/vercel-edge/package.json +28 -0
  135. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +22 -0
  136. package/dist/starters/adapters/vercel-edge/vercel.json +22 -0
  137. package/dist/starters/features/auth/package.json +20 -0
  138. package/dist/starters/features/auth/src/routes/plugin@auth.ts +8 -0
  139. package/dist/starters/features/bootstrap/package.json +33 -0
  140. package/dist/starters/features/bootstrap/src/components/bootstrap/alert.tsx +8 -0
  141. package/dist/starters/features/bootstrap/src/components/bootstrap/button.tsx +8 -0
  142. package/dist/starters/features/bootstrap/src/components/bootstrap/index.ts +4 -0
  143. package/dist/starters/features/bootstrap/src/components/bootstrap/navbar.tsx +44 -0
  144. package/dist/starters/features/bootstrap/src/components/bootstrap/spinner.tsx +13 -0
  145. package/dist/starters/features/bootstrap/src/constants/data.ts +10 -0
  146. package/dist/starters/features/bootstrap/src/models/bootstrap.ts +8 -0
  147. package/dist/starters/features/bootstrap/src/routes/bootstrap/alerts/index.tsx +28 -0
  148. package/dist/starters/features/bootstrap/src/routes/bootstrap/buttons/index.tsx +32 -0
  149. package/dist/starters/features/bootstrap/src/routes/bootstrap/index.tsx +32 -0
  150. package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +36 -0
  151. package/dist/starters/features/bootstrap/src/routes/bootstrap/spinners/index.tsx +45 -0
  152. package/dist/starters/features/builder.io/README.md +15 -0
  153. package/dist/starters/features/builder.io/package.json +27 -0
  154. package/dist/starters/features/builder.io/src/components/builder-registry.ts +25 -0
  155. package/dist/starters/features/builder.io/src/components/counter/counter.module.css +23 -0
  156. package/dist/starters/features/builder.io/src/components/counter/counter.tsx +81 -0
  157. package/dist/starters/features/builder.io/src/components/gauge/gauge.module.css +27 -0
  158. package/dist/starters/features/builder.io/src/components/gauge/index.tsx +38 -0
  159. package/dist/starters/features/builder.io/src/routes/[...index]/index.tsx +44 -0
  160. package/dist/starters/features/cypress/cypress/fixtures/example.json +5 -0
  161. package/dist/starters/features/cypress/cypress/support/commands.ts +37 -0
  162. package/dist/starters/features/cypress/cypress/support/component-index.html +12 -0
  163. package/dist/starters/features/cypress/cypress/support/component.ts +42 -0
  164. package/dist/starters/features/cypress/cypress/tsconfig.cy.json +17 -0
  165. package/dist/starters/features/cypress/cypress.config.ts +10 -0
  166. package/dist/starters/features/cypress/cypress.d.ts +14 -0
  167. package/dist/starters/features/cypress/package.json +28 -0
  168. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +18 -0
  169. package/dist/starters/features/cypress/src/components/example/example.tsx +17 -0
  170. package/dist/starters/features/drizzle/drizzle/db/.gitkeep +0 -0
  171. package/dist/starters/features/drizzle/drizzle/migrations/.gitkeep +0 -0
  172. package/dist/starters/features/drizzle/drizzle/schema.ts +24 -0
  173. package/dist/starters/features/drizzle/drizzle.config.ts +9 -0
  174. package/dist/starters/features/drizzle/package.json +41 -0
  175. package/dist/starters/features/drizzle/src/routes/create/index.tsx +42 -0
  176. package/dist/starters/features/drizzle/src/routes/users/[userId]/index.tsx +36 -0
  177. package/dist/starters/features/drizzle/src/routes/users/index.tsx +30 -0
  178. package/dist/starters/features/leaflet-map/package.json +30 -0
  179. package/dist/starters/features/leaflet-map/src/components/leaflet-map/index.tsx +60 -0
  180. package/dist/starters/features/leaflet-map/src/helpers/boundary-box.tsx +6 -0
  181. package/dist/starters/features/leaflet-map/src/models/location.ts +9 -0
  182. package/dist/starters/features/leaflet-map/src/models/map.ts +7 -0
  183. package/dist/starters/features/leaflet-map/src/routes/basic-map/index.tsx +25 -0
  184. package/dist/starters/features/localize/package.json +37 -0
  185. package/dist/starters/features/localize/src/entry.ssr.tsx +32 -0
  186. package/dist/starters/features/localize/src/locales/message.en.json +8 -0
  187. package/dist/starters/features/localize/src/locales/message.it.json +8 -0
  188. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +94 -0
  189. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +52 -0
  190. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +12 -0
  191. package/dist/starters/features/orama/package.json +23 -0
  192. package/dist/starters/features/orama/src/orama/index.ts +41 -0
  193. package/dist/starters/features/orama/src/routes/orama/index.tsx +110 -0
  194. package/dist/starters/features/pandacss/.eslintignore +3 -0
  195. package/dist/starters/features/pandacss/.prettierignore +2 -0
  196. package/dist/starters/features/pandacss/gitignore +2 -0
  197. package/dist/starters/features/pandacss/package.json +31 -0
  198. package/dist/starters/features/pandacss/panda.config.ts +22 -0
  199. package/dist/starters/features/pandacss/postcss.config.js +5 -0
  200. package/dist/starters/features/pandacss/src/global.css +5 -0
  201. package/dist/starters/features/pandacss/src/routes/pandacss/index.tsx +18 -0
  202. package/dist/starters/features/partytown/package.json +41 -0
  203. package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +19 -0
  204. package/dist/starters/features/playwright/package.json +18 -0
  205. package/dist/starters/features/playwright/playwright-report/index.html +22024 -0
  206. package/dist/starters/features/playwright/playwright.config.ts +40 -0
  207. package/dist/starters/features/playwright/tests/example.spec.ts +14 -0
  208. package/dist/starters/features/postcss/.vscode/settings.json +3 -0
  209. package/dist/starters/features/postcss/package.json +17 -0
  210. package/dist/starters/features/postcss/postcss.config.js +11 -0
  211. package/dist/starters/features/prisma/package.json +35 -0
  212. package/dist/starters/features/prisma/prisma/schema.prisma +17 -0
  213. package/dist/starters/features/prisma/src/routes/create/index.tsx +42 -0
  214. package/dist/starters/features/prisma/src/routes/users/[userId]/index.tsx +31 -0
  215. package/dist/starters/features/prisma/src/routes/users/index.tsx +27 -0
  216. package/dist/starters/features/react/package.json +41 -0
  217. package/dist/starters/features/react/src/integrations/react/mui.tsx +60 -0
  218. package/dist/starters/features/react/src/routes/react/index.tsx +45 -0
  219. package/dist/starters/features/storybook/.storybook/main.ts +22 -0
  220. package/dist/starters/features/storybook/.storybook/preview-head.html +3 -0
  221. package/dist/starters/features/storybook/.storybook/preview.tsx +19 -0
  222. package/dist/starters/features/storybook/.storybook/tsconfig.json +24 -0
  223. package/dist/starters/features/storybook/package.json +25 -0
  224. package/dist/starters/features/storybook/src/components/button/button.stories.tsx +17 -0
  225. package/dist/starters/features/storybook/src/components/button/button.tsx +27 -0
  226. package/dist/starters/features/styled-vanilla-extract/package.json +28 -0
  227. package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/flower.css.ts +83 -0
  228. package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/index.tsx +75 -0
  229. package/dist/starters/features/tailwind/.prettierrc.js +3 -0
  230. package/dist/starters/features/tailwind/.vscode/settings.json +3 -0
  231. package/dist/starters/features/tailwind/package.json +18 -0
  232. package/dist/starters/features/tailwind/postcss.config.cjs +6 -0
  233. package/dist/starters/features/tailwind/src/global.css +7 -0
  234. package/dist/starters/features/tailwind/tailwind.config.js +8 -0
  235. package/dist/starters/features/turso/.env.local +2 -0
  236. package/dist/starters/features/turso/package.json +30 -0
  237. package/dist/starters/features/turso/src/utils/turso.ts +21 -0
  238. package/dist/starters/features/vitest/package.json +20 -0
  239. package/dist/starters/features/vitest/src/components/example/example.spec.tsx +32 -0
  240. package/dist/starters/features/vitest/src/components/example/example.tsx +17 -0
  241. package/dist/templates/barrel/component/index.tsx.template +13 -0
  242. package/dist/templates/barrel/markdown/index.md.template +5 -0
  243. package/dist/templates/barrel/mdx/index.mdx.template +5 -0
  244. package/dist/templates/barrel/route/index.tsx.template +9 -0
  245. package/dist/templates/qwik/component/[slug].tsx.template +13 -0
  246. package/dist/templates/qwik/markdown/index.md.template +5 -0
  247. package/dist/templates/qwik/mdx/index.mdx.template +5 -0
  248. package/dist/templates/qwik/route/index.tsx.template +9 -0
  249. package/dist/testing/index.cjs +32431 -0
  250. package/dist/testing/index.d.ts +140 -0
  251. package/dist/testing/index.mjs +32395 -0
  252. package/dist/testing/package.json +9 -0
  253. package/jsx-dev-runtime.d.ts +2 -0
  254. package/jsx-runtime.d.ts +2 -0
  255. package/loader.d.ts +2 -0
  256. package/optimizer.d.ts +2 -0
  257. package/package.json +29 -21
  258. package/public.d.ts +70 -0
  259. package/qwik-cli.cjs +4 -0
  260. package/server.d.ts +15 -0
  261. package/testing.d.ts +2 -0
@@ -0,0 +1,4 @@
1
+ const QWIK_PREFETCH = "(()=>{const t=Number.MAX_SAFE_INTEGER>>>1;function n(n,i){const[o,s]=c(i),a=n.t.find((t=>o===t.i));if(a)return n.o(\"intercepting\",i.pathname),e(n,a,[s],t).then((()=>function(t,n){const e=t.u.find((t=>t.l.pathname===n.pathname));return e?e.$.then((t=>t.clone())):(t.o(\"CACHE HIT\",n.pathname),t.h(n))}(n,i)))}async function e(n,e,o,c){const a=new Map;o.forEach((t=>s(e,a,t,c))),await Promise.all(Array.from(a.entries()).map((([i,o])=>async function(n,e,i){let o=n.u.find((t=>t.l.pathname===e.pathname));const s=i>=t?\"direct\":\"prefetch\";if(o){const t=o.p?\"fetching\":\"waiting\";o.m<i?(n.o(\"queue update priority\",t,e.pathname),o.m=i):n.o(\"already in queue\",s,t,e.pathname)}else await n.h(e)||(n.o(\"enqueue\",s,e.pathname),o={m:i,l:e,v:null,$:null,p:!1},o.$=new Promise((t=>o.v=t)),n.u.push(o));return o}(n,new URL(e.i+i,n.l.origin),o)))),i(n)}function i(n){n.u.sort(o);let e=0;for(const o of n.u)if(o.p)e++;else if(n.C()&&(e<n.T||o.m>=t)){o.p=!0,e++;const s=o.m>=t?\"FETCH (CACHE MISS)\":\"FETCH\";n.o(s,o.l.pathname),n.H(o.l).then((async t=>{o.v(t),200===t.status&&(n.o(\"CACHED\",o.l.pathname),await n.R(o.l,t.clone()))})).finally((()=>{n.o(\"FETCH DONE\",o.l.pathname),n.u.splice(n.u.indexOf(o),1),i(n)}))}}function o(t,n){return n.m-t.m}function s(t,n,e,i,o=!0){if(!n.has(e)){if(n.set(e,i),!t.U){let n,e;t.U=new Map;for(let i=0;i<t.L.length;i++){const o=t.L[i];if(\"string\"==typeof o)n={S:[],A:[]},e=!0,t.U.set(o,n);else if(-1===o)e=!1;else{const i=t.L[o];e?n.S.push(i):n.A.push(i)}}}const c=t.U.get(e);if(!c)return n;for(const e of c.S)s(t,n,e,i);if(o){i--;for(const e of c.A)s(t,n,e,i,!1)}}return n}function c(t){const n=new URL(t).pathname,e=n.lastIndexOf(\"/\");return[n.substring(0,e+1),n.substring(e+1)]}const a=(...t)=>{console.log(\"⚙️ Prefetch SW:\",...t)};async function r(t,n,e,i){const o=t.t.findIndex((t=>t.i===n));if(-1!==o&&t.t.splice(o,1),t.o(\"adding base:\",n),t.t.push({i:n,L:e,U:void 0}),i){const i=new Set(e.filter((t=>\"string\"==typeof t))),o=await t.C();if(o)for(const e of await o.keys()){const[s,a]=c(new URL(e.url)),r=[];s!==n||i.has(a)||(t.o(\"deleting\",e.url),r.push(o.delete(e))),await Promise.all(r)}}}function u(t,n,i){let o=t.t.find((t=>t.L.includes(i[0].replace(\"./\",\"\"))));o||(o=t.t.find((t=>n===t.i))),o?e(t,o,i,0):console.error(`Base path not found: ${n}, ignoring prefetch.`)}function f(t){if(!t.N&&t.B.length){const e=t.B.shift();t.N=(async(t,e)=>{const i=e[0];t.o(\"received message:\",i,e[1],e.slice(2)),\"graph\"===i?await r(t,e[1],e.slice(2),!0):\"graph-url\"===i?await async function(t,e,i){await r(t,e,[],!1);const o=await n(t,new URL(e+i,t.l.origin));if(o&&200===o.status){const n=await o.json();n.push(i),await r(t,e,n,!0)}}(t,e[1],e[2]):\"prefetch\"===i?await u(t,e[1],e.slice(2)):\"prefetch-all\"===i?await function(t,n){const e=t.t.find((t=>n===t.i));e?u(t,n,e.L.filter((t=>\"string\"==typeof t))):console.error(`Base path not found: ${n}, ignoring prefetch.`)}(t,e[1]):\"ping\"===i?a(\"ping\"):\"verbose\"===i?(t.o=a)(\"mode: verbose\"):console.error(\"UNKNOWN MESSAGE:\",e)})(t,e).then((()=>{t.N=null,f(t)}))}}class l{constructor(t,n,e=4,i=null,o=null,s=[],c=[],a=[]){this.H=t,this.l=n,this.T=e,this.F=i,this.N=o,this.u=s,this.t=c,this.B=a}C(){return this.F}async R(t,n){const e=await this.C();return null==e?void 0:e.put(t,n)}async h(t){const n=await this.C();return null==n?void 0:n.match(t)}o(){}}(t=>{const e=(i=t.fetch.bind(t),o=new URL(t.location.href),new l(i,o));var i,o;e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open(\"QwikBundles\")),t.addEventListener(\"fetch\",(t=>{const i=t.request;if(\"GET\"===i.method){const o=n(e,new URL(i.url));o&&t.respondWith(o)}})),t.addEventListener(\"message\",(t=>{e.B.push(t.data),f(e)})),t.addEventListener(\"install\",(()=>{t.skipWaiting()})),t.addEventListener(\"activate\",(n=>{e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open(\"QwikBundles\")),n.waitUntil(t.clients.claim())}))})(globalThis)})();";
2
+ const QWIK_PREFETCH_DEBUG = "(() => {\n const DIRECT_PRIORITY = Number.MAX_SAFE_INTEGER >>> 1;\n function directFetch(swState, url) {\n const [basePath, filename] = parseBaseFilename(url);\n const base = swState.$bases$.find((base2 => basePath === base2.$path$));\n if (base) {\n swState.$log$(\"intercepting\", url.pathname);\n return enqueueFileAndDependencies(swState, base, [ filename ], DIRECT_PRIORITY).then((() => function(swState, url) {\n const currentRequestTask = swState.$queue$.find((task => task.$url$.pathname === url.pathname));\n if (currentRequestTask) {\n return currentRequestTask.$response$.then((response => response.clone()));\n }\n swState.$log$(\"CACHE HIT\", url.pathname);\n return swState.$match$(url);\n }(swState, url)));\n }\n }\n async function enqueueFileAndDependencies(swState, base, filenames, priority) {\n const fetchMap = new Map;\n filenames.forEach((filename => addDependencies(base, fetchMap, filename, priority)));\n await Promise.all(Array.from(fetchMap.entries()).map((([filename, prio]) => async function(swState, url, priority) {\n let task = swState.$queue$.find((task2 => task2.$url$.pathname === url.pathname));\n const mode = priority >= DIRECT_PRIORITY ? \"direct\" : \"prefetch\";\n if (task) {\n const state = task.$isFetching$ ? \"fetching\" : \"waiting\";\n if (task.$priority$ < priority) {\n swState.$log$(\"queue update priority\", state, url.pathname);\n task.$priority$ = priority;\n } else {\n swState.$log$(\"already in queue\", mode, state, url.pathname);\n }\n } else {\n if (!await swState.$match$(url)) {\n swState.$log$(\"enqueue\", mode, url.pathname);\n task = {\n $priority$: priority,\n $url$: url,\n $resolveResponse$: null,\n $response$: null,\n $isFetching$: !1\n };\n task.$response$ = new Promise((resolve => task.$resolveResponse$ = resolve));\n swState.$queue$.push(task);\n }\n }\n return task;\n }(swState, new URL(base.$path$ + filename, swState.$url$.origin), prio))));\n taskTick(swState);\n }\n function taskTick(swState) {\n swState.$queue$.sort(byFetchOrder);\n let outstandingRequests = 0;\n for (const task of swState.$queue$) {\n if (task.$isFetching$) {\n outstandingRequests++;\n } else if (swState.$getCache$() && (outstandingRequests < swState.$maxPrefetchRequests$ || task.$priority$ >= DIRECT_PRIORITY)) {\n task.$isFetching$ = !0;\n outstandingRequests++;\n const action = task.$priority$ >= DIRECT_PRIORITY ? \"FETCH (CACHE MISS)\" : \"FETCH\";\n swState.$log$(action, task.$url$.pathname);\n swState.$fetch$(task.$url$).then((async response => {\n task.$resolveResponse$(response);\n if (200 === response.status) {\n swState.$log$(\"CACHED\", task.$url$.pathname);\n await swState.$put$(task.$url$, response.clone());\n }\n })).finally((() => {\n swState.$log$(\"FETCH DONE\", task.$url$.pathname);\n swState.$queue$.splice(swState.$queue$.indexOf(task), 1);\n taskTick(swState);\n }));\n }\n }\n }\n function byFetchOrder(a, b) {\n return b.$priority$ - a.$priority$;\n }\n function addDependencies(base, fetchMap, filename, priority, addIndirect = !0) {\n if (!fetchMap.has(filename)) {\n fetchMap.set(filename, priority);\n if (!base.$processed$) {\n base.$processed$ = new Map;\n let current, isDirect;\n for (let i = 0; i < base.$graph$.length; i++) {\n const item = base.$graph$[i];\n if (\"string\" == typeof item) {\n current = {\n $direct$: [],\n $indirect$: []\n };\n isDirect = !0;\n base.$processed$.set(item, current);\n } else if (-1 === item) {\n isDirect = !1;\n } else {\n const depName = base.$graph$[item];\n isDirect ? current.$direct$.push(depName) : current.$indirect$.push(depName);\n }\n }\n }\n const deps = base.$processed$.get(filename);\n if (!deps) {\n return fetchMap;\n }\n for (const dependentFilename of deps.$direct$) {\n addDependencies(base, fetchMap, dependentFilename, priority);\n }\n if (addIndirect) {\n priority--;\n for (const dependentFilename of deps.$indirect$) {\n addDependencies(base, fetchMap, dependentFilename, priority, !1);\n }\n }\n }\n return fetchMap;\n }\n function parseBaseFilename(url) {\n const pathname = new URL(url).pathname;\n const slashIndex = pathname.lastIndexOf(\"/\");\n return [ pathname.substring(0, slashIndex + 1), pathname.substring(slashIndex + 1) ];\n }\n const log = (...args) => {\n console.log(\"⚙️ Prefetch SW:\", ...args);\n };\n const processMessage = async (state, msg) => {\n const type = msg[0];\n state.$log$(\"received message:\", type, msg[1], msg.slice(2));\n \"graph\" === type ? await processBundleGraph(state, msg[1], msg.slice(2), !0) : \"graph-url\" === type ? await async function(swState, base, graphPath) {\n await processBundleGraph(swState, base, [], !1);\n const response = await directFetch(swState, new URL(base + graphPath, swState.$url$.origin));\n if (response && 200 === response.status) {\n const graph = await response.json();\n graph.push(graphPath);\n await processBundleGraph(swState, base, graph, !0);\n }\n }(state, msg[1], msg[2]) : \"prefetch\" === type ? await processPrefetch(state, msg[1], msg.slice(2)) : \"prefetch-all\" === type ? await function(swState, basePath) {\n const base = swState.$bases$.find((base2 => basePath === base2.$path$));\n base ? processPrefetch(swState, basePath, base.$graph$.filter((item => \"string\" == typeof item))) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);\n }(state, msg[1]) : \"ping\" === type ? log(\"ping\") : \"verbose\" === type ? (state.$log$ = log)(\"mode: verbose\") : console.error(\"UNKNOWN MESSAGE:\", msg);\n };\n async function processBundleGraph(swState, base, graph, cleanup) {\n const existingBaseIndex = swState.$bases$.findIndex((b => b.$path$ === base));\n -1 !== existingBaseIndex && swState.$bases$.splice(existingBaseIndex, 1);\n swState.$log$(\"adding base:\", base);\n swState.$bases$.push({\n $path$: base,\n $graph$: graph,\n $processed$: void 0\n });\n if (cleanup) {\n const bundles = new Set(graph.filter((item => \"string\" == typeof item)));\n const cache = await swState.$getCache$();\n if (cache) {\n for (const request of await cache.keys()) {\n const [cacheBase, filename] = parseBaseFilename(new URL(request.url));\n const promises = [];\n if (cacheBase === base && !bundles.has(filename)) {\n swState.$log$(\"deleting\", request.url);\n promises.push(cache.delete(request));\n }\n await Promise.all(promises);\n }\n }\n }\n }\n function processPrefetch(swState, basePath, bundles) {\n let base = swState.$bases$.find((base2 => base2.$graph$.includes(bundles[0].replace(\"./\", \"\"))));\n base || (base = swState.$bases$.find((base2 => basePath === base2.$path$)));\n base ? enqueueFileAndDependencies(swState, base, bundles, 0) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);\n }\n function drainMsgQueue(swState) {\n if (!swState.$msgQueuePromise$ && swState.$msgQueue$.length) {\n const top = swState.$msgQueue$.shift();\n swState.$msgQueuePromise$ = processMessage(swState, top).then((() => {\n swState.$msgQueuePromise$ = null;\n drainMsgQueue(swState);\n }));\n }\n }\n class SWStateImpl {\n constructor($fetch$, $url$, $maxPrefetchRequests$ = 4, $cache$ = null, $msgQueuePromise$ = null, $queue$ = [], $bases$ = [], $msgQueue$ = []) {\n this.$fetch$ = $fetch$;\n this.$url$ = $url$;\n this.$maxPrefetchRequests$ = $maxPrefetchRequests$;\n this.$cache$ = $cache$;\n this.$msgQueuePromise$ = $msgQueuePromise$;\n this.$queue$ = $queue$;\n this.$bases$ = $bases$;\n this.$msgQueue$ = $msgQueue$;\n }\n $getCache$() {\n return this.$cache$;\n }\n async $put$(request, response) {\n const cache = await this.$getCache$();\n return null == cache ? void 0 : cache.put(request, response);\n }\n async $match$(request) {\n const cache = await this.$getCache$();\n return null == cache ? void 0 : cache.match(request);\n }\n $log$() {}\n }\n (swScope => {\n const swState = ((fetch, url) => new SWStateImpl(fetch, url))(swScope.fetch.bind(swScope), new URL(swScope.location.href));\n swState.$getCache$ = () => {\n if (swState.$cache$) {\n return swState.$cache$;\n }\n clearTimeout(undefined);\n setTimeout((() => {\n swState.$cache$ = null;\n }), 5e3);\n return swScope.caches.open(\"QwikBundles\");\n };\n swScope.addEventListener(\"fetch\", (ev => {\n const request = ev.request;\n if (\"GET\" === request.method) {\n const response = directFetch(swState, new URL(request.url));\n response && ev.respondWith(response);\n }\n }));\n swScope.addEventListener(\"message\", (ev => {\n swState.$msgQueue$.push(ev.data);\n drainMsgQueue(swState);\n }));\n swScope.addEventListener(\"install\", (() => {\n swScope.skipWaiting();\n }));\n swScope.addEventListener(\"activate\", (event => {\n swState.$getCache$ = () => {\n if (swState.$cache$) {\n return swState.$cache$;\n }\n clearTimeout(undefined);\n setTimeout((() => {\n swState.$cache$ = null;\n }), 5e3);\n return swScope.caches.open(\"QwikBundles\");\n };\n event.waitUntil(swScope.clients.claim());\n }));\n })(globalThis);\n})();";
3
+ exports.QWIK_PREFETCH = QWIK_PREFETCH;
4
+ exports.QWIK_PREFETCH_DEBUG = QWIK_PREFETCH_DEBUG;
@@ -0,0 +1,2 @@
1
+ export declare const QWIK_PREFETCH: string;
2
+ export declare const QWIK_PREFETCH_DEBUG: string;
@@ -0,0 +1,3 @@
1
+ const QWIK_PREFETCH = "(()=>{const t=Number.MAX_SAFE_INTEGER>>>1;function n(n,i){const[o,s]=c(i),a=n.t.find((t=>o===t.i));if(a)return n.o(\"intercepting\",i.pathname),e(n,a,[s],t).then((()=>function(t,n){const e=t.u.find((t=>t.l.pathname===n.pathname));return e?e.$.then((t=>t.clone())):(t.o(\"CACHE HIT\",n.pathname),t.h(n))}(n,i)))}async function e(n,e,o,c){const a=new Map;o.forEach((t=>s(e,a,t,c))),await Promise.all(Array.from(a.entries()).map((([i,o])=>async function(n,e,i){let o=n.u.find((t=>t.l.pathname===e.pathname));const s=i>=t?\"direct\":\"prefetch\";if(o){const t=o.p?\"fetching\":\"waiting\";o.m<i?(n.o(\"queue update priority\",t,e.pathname),o.m=i):n.o(\"already in queue\",s,t,e.pathname)}else await n.h(e)||(n.o(\"enqueue\",s,e.pathname),o={m:i,l:e,v:null,$:null,p:!1},o.$=new Promise((t=>o.v=t)),n.u.push(o));return o}(n,new URL(e.i+i,n.l.origin),o)))),i(n)}function i(n){n.u.sort(o);let e=0;for(const o of n.u)if(o.p)e++;else if(n.C()&&(e<n.T||o.m>=t)){o.p=!0,e++;const s=o.m>=t?\"FETCH (CACHE MISS)\":\"FETCH\";n.o(s,o.l.pathname),n.H(o.l).then((async t=>{o.v(t),200===t.status&&(n.o(\"CACHED\",o.l.pathname),await n.R(o.l,t.clone()))})).finally((()=>{n.o(\"FETCH DONE\",o.l.pathname),n.u.splice(n.u.indexOf(o),1),i(n)}))}}function o(t,n){return n.m-t.m}function s(t,n,e,i,o=!0){if(!n.has(e)){if(n.set(e,i),!t.U){let n,e;t.U=new Map;for(let i=0;i<t.L.length;i++){const o=t.L[i];if(\"string\"==typeof o)n={S:[],A:[]},e=!0,t.U.set(o,n);else if(-1===o)e=!1;else{const i=t.L[o];e?n.S.push(i):n.A.push(i)}}}const c=t.U.get(e);if(!c)return n;for(const e of c.S)s(t,n,e,i);if(o){i--;for(const e of c.A)s(t,n,e,i,!1)}}return n}function c(t){const n=new URL(t).pathname,e=n.lastIndexOf(\"/\");return[n.substring(0,e+1),n.substring(e+1)]}const a=(...t)=>{console.log(\"⚙️ Prefetch SW:\",...t)};async function r(t,n,e,i){const o=t.t.findIndex((t=>t.i===n));if(-1!==o&&t.t.splice(o,1),t.o(\"adding base:\",n),t.t.push({i:n,L:e,U:void 0}),i){const i=new Set(e.filter((t=>\"string\"==typeof t))),o=await t.C();if(o)for(const e of await o.keys()){const[s,a]=c(new URL(e.url)),r=[];s!==n||i.has(a)||(t.o(\"deleting\",e.url),r.push(o.delete(e))),await Promise.all(r)}}}function u(t,n,i){let o=t.t.find((t=>t.L.includes(i[0].replace(\"./\",\"\"))));o||(o=t.t.find((t=>n===t.i))),o?e(t,o,i,0):console.error(`Base path not found: ${n}, ignoring prefetch.`)}function f(t){if(!t.N&&t.B.length){const e=t.B.shift();t.N=(async(t,e)=>{const i=e[0];t.o(\"received message:\",i,e[1],e.slice(2)),\"graph\"===i?await r(t,e[1],e.slice(2),!0):\"graph-url\"===i?await async function(t,e,i){await r(t,e,[],!1);const o=await n(t,new URL(e+i,t.l.origin));if(o&&200===o.status){const n=await o.json();n.push(i),await r(t,e,n,!0)}}(t,e[1],e[2]):\"prefetch\"===i?await u(t,e[1],e.slice(2)):\"prefetch-all\"===i?await function(t,n){const e=t.t.find((t=>n===t.i));e?u(t,n,e.L.filter((t=>\"string\"==typeof t))):console.error(`Base path not found: ${n}, ignoring prefetch.`)}(t,e[1]):\"ping\"===i?a(\"ping\"):\"verbose\"===i?(t.o=a)(\"mode: verbose\"):console.error(\"UNKNOWN MESSAGE:\",e)})(t,e).then((()=>{t.N=null,f(t)}))}}class l{constructor(t,n,e=4,i=null,o=null,s=[],c=[],a=[]){this.H=t,this.l=n,this.T=e,this.F=i,this.N=o,this.u=s,this.t=c,this.B=a}C(){return this.F}async R(t,n){const e=await this.C();return null==e?void 0:e.put(t,n)}async h(t){const n=await this.C();return null==n?void 0:n.match(t)}o(){}}(t=>{const e=(i=t.fetch.bind(t),o=new URL(t.location.href),new l(i,o));var i,o;e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open(\"QwikBundles\")),t.addEventListener(\"fetch\",(t=>{const i=t.request;if(\"GET\"===i.method){const o=n(e,new URL(i.url));o&&t.respondWith(o)}})),t.addEventListener(\"message\",(t=>{e.B.push(t.data),f(e)})),t.addEventListener(\"install\",(()=>{t.skipWaiting()})),t.addEventListener(\"activate\",(n=>{e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open(\"QwikBundles\")),n.waitUntil(t.clients.claim())}))})(globalThis)})();";
2
+ const QWIK_PREFETCH_DEBUG = "(() => {\n const DIRECT_PRIORITY = Number.MAX_SAFE_INTEGER >>> 1;\n function directFetch(swState, url) {\n const [basePath, filename] = parseBaseFilename(url);\n const base = swState.$bases$.find((base2 => basePath === base2.$path$));\n if (base) {\n swState.$log$(\"intercepting\", url.pathname);\n return enqueueFileAndDependencies(swState, base, [ filename ], DIRECT_PRIORITY).then((() => function(swState, url) {\n const currentRequestTask = swState.$queue$.find((task => task.$url$.pathname === url.pathname));\n if (currentRequestTask) {\n return currentRequestTask.$response$.then((response => response.clone()));\n }\n swState.$log$(\"CACHE HIT\", url.pathname);\n return swState.$match$(url);\n }(swState, url)));\n }\n }\n async function enqueueFileAndDependencies(swState, base, filenames, priority) {\n const fetchMap = new Map;\n filenames.forEach((filename => addDependencies(base, fetchMap, filename, priority)));\n await Promise.all(Array.from(fetchMap.entries()).map((([filename, prio]) => async function(swState, url, priority) {\n let task = swState.$queue$.find((task2 => task2.$url$.pathname === url.pathname));\n const mode = priority >= DIRECT_PRIORITY ? \"direct\" : \"prefetch\";\n if (task) {\n const state = task.$isFetching$ ? \"fetching\" : \"waiting\";\n if (task.$priority$ < priority) {\n swState.$log$(\"queue update priority\", state, url.pathname);\n task.$priority$ = priority;\n } else {\n swState.$log$(\"already in queue\", mode, state, url.pathname);\n }\n } else {\n if (!await swState.$match$(url)) {\n swState.$log$(\"enqueue\", mode, url.pathname);\n task = {\n $priority$: priority,\n $url$: url,\n $resolveResponse$: null,\n $response$: null,\n $isFetching$: !1\n };\n task.$response$ = new Promise((resolve => task.$resolveResponse$ = resolve));\n swState.$queue$.push(task);\n }\n }\n return task;\n }(swState, new URL(base.$path$ + filename, swState.$url$.origin), prio))));\n taskTick(swState);\n }\n function taskTick(swState) {\n swState.$queue$.sort(byFetchOrder);\n let outstandingRequests = 0;\n for (const task of swState.$queue$) {\n if (task.$isFetching$) {\n outstandingRequests++;\n } else if (swState.$getCache$() && (outstandingRequests < swState.$maxPrefetchRequests$ || task.$priority$ >= DIRECT_PRIORITY)) {\n task.$isFetching$ = !0;\n outstandingRequests++;\n const action = task.$priority$ >= DIRECT_PRIORITY ? \"FETCH (CACHE MISS)\" : \"FETCH\";\n swState.$log$(action, task.$url$.pathname);\n swState.$fetch$(task.$url$).then((async response => {\n task.$resolveResponse$(response);\n if (200 === response.status) {\n swState.$log$(\"CACHED\", task.$url$.pathname);\n await swState.$put$(task.$url$, response.clone());\n }\n })).finally((() => {\n swState.$log$(\"FETCH DONE\", task.$url$.pathname);\n swState.$queue$.splice(swState.$queue$.indexOf(task), 1);\n taskTick(swState);\n }));\n }\n }\n }\n function byFetchOrder(a, b) {\n return b.$priority$ - a.$priority$;\n }\n function addDependencies(base, fetchMap, filename, priority, addIndirect = !0) {\n if (!fetchMap.has(filename)) {\n fetchMap.set(filename, priority);\n if (!base.$processed$) {\n base.$processed$ = new Map;\n let current, isDirect;\n for (let i = 0; i < base.$graph$.length; i++) {\n const item = base.$graph$[i];\n if (\"string\" == typeof item) {\n current = {\n $direct$: [],\n $indirect$: []\n };\n isDirect = !0;\n base.$processed$.set(item, current);\n } else if (-1 === item) {\n isDirect = !1;\n } else {\n const depName = base.$graph$[item];\n isDirect ? current.$direct$.push(depName) : current.$indirect$.push(depName);\n }\n }\n }\n const deps = base.$processed$.get(filename);\n if (!deps) {\n return fetchMap;\n }\n for (const dependentFilename of deps.$direct$) {\n addDependencies(base, fetchMap, dependentFilename, priority);\n }\n if (addIndirect) {\n priority--;\n for (const dependentFilename of deps.$indirect$) {\n addDependencies(base, fetchMap, dependentFilename, priority, !1);\n }\n }\n }\n return fetchMap;\n }\n function parseBaseFilename(url) {\n const pathname = new URL(url).pathname;\n const slashIndex = pathname.lastIndexOf(\"/\");\n return [ pathname.substring(0, slashIndex + 1), pathname.substring(slashIndex + 1) ];\n }\n const log = (...args) => {\n console.log(\"⚙️ Prefetch SW:\", ...args);\n };\n const processMessage = async (state, msg) => {\n const type = msg[0];\n state.$log$(\"received message:\", type, msg[1], msg.slice(2));\n \"graph\" === type ? await processBundleGraph(state, msg[1], msg.slice(2), !0) : \"graph-url\" === type ? await async function(swState, base, graphPath) {\n await processBundleGraph(swState, base, [], !1);\n const response = await directFetch(swState, new URL(base + graphPath, swState.$url$.origin));\n if (response && 200 === response.status) {\n const graph = await response.json();\n graph.push(graphPath);\n await processBundleGraph(swState, base, graph, !0);\n }\n }(state, msg[1], msg[2]) : \"prefetch\" === type ? await processPrefetch(state, msg[1], msg.slice(2)) : \"prefetch-all\" === type ? await function(swState, basePath) {\n const base = swState.$bases$.find((base2 => basePath === base2.$path$));\n base ? processPrefetch(swState, basePath, base.$graph$.filter((item => \"string\" == typeof item))) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);\n }(state, msg[1]) : \"ping\" === type ? log(\"ping\") : \"verbose\" === type ? (state.$log$ = log)(\"mode: verbose\") : console.error(\"UNKNOWN MESSAGE:\", msg);\n };\n async function processBundleGraph(swState, base, graph, cleanup) {\n const existingBaseIndex = swState.$bases$.findIndex((b => b.$path$ === base));\n -1 !== existingBaseIndex && swState.$bases$.splice(existingBaseIndex, 1);\n swState.$log$(\"adding base:\", base);\n swState.$bases$.push({\n $path$: base,\n $graph$: graph,\n $processed$: void 0\n });\n if (cleanup) {\n const bundles = new Set(graph.filter((item => \"string\" == typeof item)));\n const cache = await swState.$getCache$();\n if (cache) {\n for (const request of await cache.keys()) {\n const [cacheBase, filename] = parseBaseFilename(new URL(request.url));\n const promises = [];\n if (cacheBase === base && !bundles.has(filename)) {\n swState.$log$(\"deleting\", request.url);\n promises.push(cache.delete(request));\n }\n await Promise.all(promises);\n }\n }\n }\n }\n function processPrefetch(swState, basePath, bundles) {\n let base = swState.$bases$.find((base2 => base2.$graph$.includes(bundles[0].replace(\"./\", \"\"))));\n base || (base = swState.$bases$.find((base2 => basePath === base2.$path$)));\n base ? enqueueFileAndDependencies(swState, base, bundles, 0) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);\n }\n function drainMsgQueue(swState) {\n if (!swState.$msgQueuePromise$ && swState.$msgQueue$.length) {\n const top = swState.$msgQueue$.shift();\n swState.$msgQueuePromise$ = processMessage(swState, top).then((() => {\n swState.$msgQueuePromise$ = null;\n drainMsgQueue(swState);\n }));\n }\n }\n class SWStateImpl {\n constructor($fetch$, $url$, $maxPrefetchRequests$ = 4, $cache$ = null, $msgQueuePromise$ = null, $queue$ = [], $bases$ = [], $msgQueue$ = []) {\n this.$fetch$ = $fetch$;\n this.$url$ = $url$;\n this.$maxPrefetchRequests$ = $maxPrefetchRequests$;\n this.$cache$ = $cache$;\n this.$msgQueuePromise$ = $msgQueuePromise$;\n this.$queue$ = $queue$;\n this.$bases$ = $bases$;\n this.$msgQueue$ = $msgQueue$;\n }\n $getCache$() {\n return this.$cache$;\n }\n async $put$(request, response) {\n const cache = await this.$getCache$();\n return null == cache ? void 0 : cache.put(request, response);\n }\n async $match$(request) {\n const cache = await this.$getCache$();\n return null == cache ? void 0 : cache.match(request);\n }\n $log$() {}\n }\n (swScope => {\n const swState = ((fetch, url) => new SWStateImpl(fetch, url))(swScope.fetch.bind(swScope), new URL(swScope.location.href));\n swState.$getCache$ = () => {\n if (swState.$cache$) {\n return swState.$cache$;\n }\n clearTimeout(undefined);\n setTimeout((() => {\n swState.$cache$ = null;\n }), 5e3);\n return swScope.caches.open(\"QwikBundles\");\n };\n swScope.addEventListener(\"fetch\", (ev => {\n const request = ev.request;\n if (\"GET\" === request.method) {\n const response = directFetch(swState, new URL(request.url));\n response && ev.respondWith(response);\n }\n }));\n swScope.addEventListener(\"message\", (ev => {\n swState.$msgQueue$.push(ev.data);\n drainMsgQueue(swState);\n }));\n swScope.addEventListener(\"install\", (() => {\n swScope.skipWaiting();\n }));\n swScope.addEventListener(\"activate\", (event => {\n swState.$getCache$ = () => {\n if (swState.$cache$) {\n return swState.$cache$;\n }\n clearTimeout(undefined);\n setTimeout((() => {\n swState.$cache$ = null;\n }), 5e3);\n return swScope.caches.open(\"QwikBundles\");\n };\n event.waitUntil(swScope.clients.claim());\n }));\n })(globalThis);\n})();";
3
+ export { QWIK_PREFETCH, QWIK_PREFETCH_DEBUG };
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@qwik.dev/core/prefetch",
3
+ "version": "2.0.0-alpha.1-dev+10f5414",
4
+ "main": "index.mjs",
5
+ "types": "index.d.ts",
6
+ "private": true,
7
+ "type": "module"
8
+ }
@@ -0,0 +1,244 @@
1
+ (() => {
2
+ const DIRECT_PRIORITY = Number.MAX_SAFE_INTEGER >>> 1;
3
+ function directFetch(swState, url) {
4
+ const [basePath, filename] = parseBaseFilename(url);
5
+ const base = swState.$bases$.find((base2 => basePath === base2.$path$));
6
+ if (base) {
7
+ swState.$log$("intercepting", url.pathname);
8
+ return enqueueFileAndDependencies(swState, base, [ filename ], DIRECT_PRIORITY).then((() => function(swState, url) {
9
+ const currentRequestTask = swState.$queue$.find((task => task.$url$.pathname === url.pathname));
10
+ if (currentRequestTask) {
11
+ return currentRequestTask.$response$.then((response => response.clone()));
12
+ }
13
+ swState.$log$("CACHE HIT", url.pathname);
14
+ return swState.$match$(url);
15
+ }(swState, url)));
16
+ }
17
+ }
18
+ async function enqueueFileAndDependencies(swState, base, filenames, priority) {
19
+ const fetchMap = new Map;
20
+ filenames.forEach((filename => addDependencies(base, fetchMap, filename, priority)));
21
+ await Promise.all(Array.from(fetchMap.entries()).map((([filename, prio]) => async function(swState, url, priority) {
22
+ let task = swState.$queue$.find((task2 => task2.$url$.pathname === url.pathname));
23
+ const mode = priority >= DIRECT_PRIORITY ? "direct" : "prefetch";
24
+ if (task) {
25
+ const state = task.$isFetching$ ? "fetching" : "waiting";
26
+ if (task.$priority$ < priority) {
27
+ swState.$log$("queue update priority", state, url.pathname);
28
+ task.$priority$ = priority;
29
+ } else {
30
+ swState.$log$("already in queue", mode, state, url.pathname);
31
+ }
32
+ } else {
33
+ if (!await swState.$match$(url)) {
34
+ swState.$log$("enqueue", mode, url.pathname);
35
+ task = {
36
+ $priority$: priority,
37
+ $url$: url,
38
+ $resolveResponse$: null,
39
+ $response$: null,
40
+ $isFetching$: !1
41
+ };
42
+ task.$response$ = new Promise((resolve => task.$resolveResponse$ = resolve));
43
+ swState.$queue$.push(task);
44
+ }
45
+ }
46
+ return task;
47
+ }(swState, new URL(base.$path$ + filename, swState.$url$.origin), prio))));
48
+ taskTick(swState);
49
+ }
50
+ function taskTick(swState) {
51
+ swState.$queue$.sort(byFetchOrder);
52
+ let outstandingRequests = 0;
53
+ for (const task of swState.$queue$) {
54
+ if (task.$isFetching$) {
55
+ outstandingRequests++;
56
+ } else if (swState.$getCache$() && (outstandingRequests < swState.$maxPrefetchRequests$ || task.$priority$ >= DIRECT_PRIORITY)) {
57
+ task.$isFetching$ = !0;
58
+ outstandingRequests++;
59
+ const action = task.$priority$ >= DIRECT_PRIORITY ? "FETCH (CACHE MISS)" : "FETCH";
60
+ swState.$log$(action, task.$url$.pathname);
61
+ swState.$fetch$(task.$url$).then((async response => {
62
+ task.$resolveResponse$(response);
63
+ if (200 === response.status) {
64
+ swState.$log$("CACHED", task.$url$.pathname);
65
+ await swState.$put$(task.$url$, response.clone());
66
+ }
67
+ })).finally((() => {
68
+ swState.$log$("FETCH DONE", task.$url$.pathname);
69
+ swState.$queue$.splice(swState.$queue$.indexOf(task), 1);
70
+ taskTick(swState);
71
+ }));
72
+ }
73
+ }
74
+ }
75
+ function byFetchOrder(a, b) {
76
+ return b.$priority$ - a.$priority$;
77
+ }
78
+ function addDependencies(base, fetchMap, filename, priority, addIndirect = !0) {
79
+ if (!fetchMap.has(filename)) {
80
+ fetchMap.set(filename, priority);
81
+ if (!base.$processed$) {
82
+ base.$processed$ = new Map;
83
+ let current, isDirect;
84
+ for (let i = 0; i < base.$graph$.length; i++) {
85
+ const item = base.$graph$[i];
86
+ if ("string" == typeof item) {
87
+ current = {
88
+ $direct$: [],
89
+ $indirect$: []
90
+ };
91
+ isDirect = !0;
92
+ base.$processed$.set(item, current);
93
+ } else if (-1 === item) {
94
+ isDirect = !1;
95
+ } else {
96
+ const depName = base.$graph$[item];
97
+ isDirect ? current.$direct$.push(depName) : current.$indirect$.push(depName);
98
+ }
99
+ }
100
+ }
101
+ const deps = base.$processed$.get(filename);
102
+ if (!deps) {
103
+ return fetchMap;
104
+ }
105
+ for (const dependentFilename of deps.$direct$) {
106
+ addDependencies(base, fetchMap, dependentFilename, priority);
107
+ }
108
+ if (addIndirect) {
109
+ priority--;
110
+ for (const dependentFilename of deps.$indirect$) {
111
+ addDependencies(base, fetchMap, dependentFilename, priority, !1);
112
+ }
113
+ }
114
+ }
115
+ return fetchMap;
116
+ }
117
+ function parseBaseFilename(url) {
118
+ const pathname = new URL(url).pathname;
119
+ const slashIndex = pathname.lastIndexOf("/");
120
+ return [ pathname.substring(0, slashIndex + 1), pathname.substring(slashIndex + 1) ];
121
+ }
122
+ const log = (...args) => {
123
+ console.log("⚙️ Prefetch SW:", ...args);
124
+ };
125
+ const processMessage = async (state, msg) => {
126
+ const type = msg[0];
127
+ state.$log$("received message:", type, msg[1], msg.slice(2));
128
+ "graph" === type ? await processBundleGraph(state, msg[1], msg.slice(2), !0) : "graph-url" === type ? await async function(swState, base, graphPath) {
129
+ await processBundleGraph(swState, base, [], !1);
130
+ const response = await directFetch(swState, new URL(base + graphPath, swState.$url$.origin));
131
+ if (response && 200 === response.status) {
132
+ const graph = await response.json();
133
+ graph.push(graphPath);
134
+ await processBundleGraph(swState, base, graph, !0);
135
+ }
136
+ }(state, msg[1], msg[2]) : "prefetch" === type ? await processPrefetch(state, msg[1], msg.slice(2)) : "prefetch-all" === type ? await function(swState, basePath) {
137
+ const base = swState.$bases$.find((base2 => basePath === base2.$path$));
138
+ base ? processPrefetch(swState, basePath, base.$graph$.filter((item => "string" == typeof item))) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);
139
+ }(state, msg[1]) : "ping" === type ? log("ping") : "verbose" === type ? (state.$log$ = log)("mode: verbose") : console.error("UNKNOWN MESSAGE:", msg);
140
+ };
141
+ async function processBundleGraph(swState, base, graph, cleanup) {
142
+ const existingBaseIndex = swState.$bases$.findIndex((b => b.$path$ === base));
143
+ -1 !== existingBaseIndex && swState.$bases$.splice(existingBaseIndex, 1);
144
+ swState.$log$("adding base:", base);
145
+ swState.$bases$.push({
146
+ $path$: base,
147
+ $graph$: graph,
148
+ $processed$: void 0
149
+ });
150
+ if (cleanup) {
151
+ const bundles = new Set(graph.filter((item => "string" == typeof item)));
152
+ const cache = await swState.$getCache$();
153
+ if (cache) {
154
+ for (const request of await cache.keys()) {
155
+ const [cacheBase, filename] = parseBaseFilename(new URL(request.url));
156
+ const promises = [];
157
+ if (cacheBase === base && !bundles.has(filename)) {
158
+ swState.$log$("deleting", request.url);
159
+ promises.push(cache.delete(request));
160
+ }
161
+ await Promise.all(promises);
162
+ }
163
+ }
164
+ }
165
+ }
166
+ function processPrefetch(swState, basePath, bundles) {
167
+ let base = swState.$bases$.find((base2 => base2.$graph$.includes(bundles[0].replace("./", ""))));
168
+ base || (base = swState.$bases$.find((base2 => basePath === base2.$path$)));
169
+ base ? enqueueFileAndDependencies(swState, base, bundles, 0) : console.error(`Base path not found: ${basePath}, ignoring prefetch.`);
170
+ }
171
+ function drainMsgQueue(swState) {
172
+ if (!swState.$msgQueuePromise$ && swState.$msgQueue$.length) {
173
+ const top = swState.$msgQueue$.shift();
174
+ swState.$msgQueuePromise$ = processMessage(swState, top).then((() => {
175
+ swState.$msgQueuePromise$ = null;
176
+ drainMsgQueue(swState);
177
+ }));
178
+ }
179
+ }
180
+ class SWStateImpl {
181
+ constructor($fetch$, $url$, $maxPrefetchRequests$ = 4, $cache$ = null, $msgQueuePromise$ = null, $queue$ = [], $bases$ = [], $msgQueue$ = []) {
182
+ this.$fetch$ = $fetch$;
183
+ this.$url$ = $url$;
184
+ this.$maxPrefetchRequests$ = $maxPrefetchRequests$;
185
+ this.$cache$ = $cache$;
186
+ this.$msgQueuePromise$ = $msgQueuePromise$;
187
+ this.$queue$ = $queue$;
188
+ this.$bases$ = $bases$;
189
+ this.$msgQueue$ = $msgQueue$;
190
+ }
191
+ $getCache$() {
192
+ return this.$cache$;
193
+ }
194
+ async $put$(request, response) {
195
+ const cache = await this.$getCache$();
196
+ return null == cache ? void 0 : cache.put(request, response);
197
+ }
198
+ async $match$(request) {
199
+ const cache = await this.$getCache$();
200
+ return null == cache ? void 0 : cache.match(request);
201
+ }
202
+ $log$() {}
203
+ }
204
+ (swScope => {
205
+ const swState = ((fetch, url) => new SWStateImpl(fetch, url))(swScope.fetch.bind(swScope), new URL(swScope.location.href));
206
+ swState.$getCache$ = () => {
207
+ if (swState.$cache$) {
208
+ return swState.$cache$;
209
+ }
210
+ clearTimeout(undefined);
211
+ setTimeout((() => {
212
+ swState.$cache$ = null;
213
+ }), 5e3);
214
+ return swScope.caches.open("QwikBundles");
215
+ };
216
+ swScope.addEventListener("fetch", (ev => {
217
+ const request = ev.request;
218
+ if ("GET" === request.method) {
219
+ const response = directFetch(swState, new URL(request.url));
220
+ response && ev.respondWith(response);
221
+ }
222
+ }));
223
+ swScope.addEventListener("message", (ev => {
224
+ swState.$msgQueue$.push(ev.data);
225
+ drainMsgQueue(swState);
226
+ }));
227
+ swScope.addEventListener("install", (() => {
228
+ swScope.skipWaiting();
229
+ }));
230
+ swScope.addEventListener("activate", (event => {
231
+ swState.$getCache$ = () => {
232
+ if (swState.$cache$) {
233
+ return swState.$cache$;
234
+ }
235
+ clearTimeout(undefined);
236
+ setTimeout((() => {
237
+ swState.$cache$ = null;
238
+ }), 5e3);
239
+ return swScope.caches.open("QwikBundles");
240
+ };
241
+ event.waitUntil(swScope.clients.claim());
242
+ }));
243
+ })(globalThis);
244
+ })();
@@ -0,0 +1 @@
1
+ (()=>{const t=Number.MAX_SAFE_INTEGER>>>1;function n(n,i){const[o,s]=c(i),a=n.t.find((t=>o===t.i));if(a)return n.o("intercepting",i.pathname),e(n,a,[s],t).then((()=>function(t,n){const e=t.u.find((t=>t.l.pathname===n.pathname));return e?e.$.then((t=>t.clone())):(t.o("CACHE HIT",n.pathname),t.h(n))}(n,i)))}async function e(n,e,o,c){const a=new Map;o.forEach((t=>s(e,a,t,c))),await Promise.all(Array.from(a.entries()).map((([i,o])=>async function(n,e,i){let o=n.u.find((t=>t.l.pathname===e.pathname));const s=i>=t?"direct":"prefetch";if(o){const t=o.p?"fetching":"waiting";o.m<i?(n.o("queue update priority",t,e.pathname),o.m=i):n.o("already in queue",s,t,e.pathname)}else await n.h(e)||(n.o("enqueue",s,e.pathname),o={m:i,l:e,v:null,$:null,p:!1},o.$=new Promise((t=>o.v=t)),n.u.push(o));return o}(n,new URL(e.i+i,n.l.origin),o)))),i(n)}function i(n){n.u.sort(o);let e=0;for(const o of n.u)if(o.p)e++;else if(n.C()&&(e<n.T||o.m>=t)){o.p=!0,e++;const s=o.m>=t?"FETCH (CACHE MISS)":"FETCH";n.o(s,o.l.pathname),n.H(o.l).then((async t=>{o.v(t),200===t.status&&(n.o("CACHED",o.l.pathname),await n.R(o.l,t.clone()))})).finally((()=>{n.o("FETCH DONE",o.l.pathname),n.u.splice(n.u.indexOf(o),1),i(n)}))}}function o(t,n){return n.m-t.m}function s(t,n,e,i,o=!0){if(!n.has(e)){if(n.set(e,i),!t.U){let n,e;t.U=new Map;for(let i=0;i<t.L.length;i++){const o=t.L[i];if("string"==typeof o)n={S:[],A:[]},e=!0,t.U.set(o,n);else if(-1===o)e=!1;else{const i=t.L[o];e?n.S.push(i):n.A.push(i)}}}const c=t.U.get(e);if(!c)return n;for(const e of c.S)s(t,n,e,i);if(o){i--;for(const e of c.A)s(t,n,e,i,!1)}}return n}function c(t){const n=new URL(t).pathname,e=n.lastIndexOf("/");return[n.substring(0,e+1),n.substring(e+1)]}const a=(...t)=>{console.log("⚙️ Prefetch SW:",...t)};async function r(t,n,e,i){const o=t.t.findIndex((t=>t.i===n));if(-1!==o&&t.t.splice(o,1),t.o("adding base:",n),t.t.push({i:n,L:e,U:void 0}),i){const i=new Set(e.filter((t=>"string"==typeof t))),o=await t.C();if(o)for(const e of await o.keys()){const[s,a]=c(new URL(e.url)),r=[];s!==n||i.has(a)||(t.o("deleting",e.url),r.push(o.delete(e))),await Promise.all(r)}}}function u(t,n,i){let o=t.t.find((t=>t.L.includes(i[0].replace("./",""))));o||(o=t.t.find((t=>n===t.i))),o?e(t,o,i,0):console.error(`Base path not found: ${n}, ignoring prefetch.`)}function f(t){if(!t.N&&t.B.length){const e=t.B.shift();t.N=(async(t,e)=>{const i=e[0];t.o("received message:",i,e[1],e.slice(2)),"graph"===i?await r(t,e[1],e.slice(2),!0):"graph-url"===i?await async function(t,e,i){await r(t,e,[],!1);const o=await n(t,new URL(e+i,t.l.origin));if(o&&200===o.status){const n=await o.json();n.push(i),await r(t,e,n,!0)}}(t,e[1],e[2]):"prefetch"===i?await u(t,e[1],e.slice(2)):"prefetch-all"===i?await function(t,n){const e=t.t.find((t=>n===t.i));e?u(t,n,e.L.filter((t=>"string"==typeof t))):console.error(`Base path not found: ${n}, ignoring prefetch.`)}(t,e[1]):"ping"===i?a("ping"):"verbose"===i?(t.o=a)("mode: verbose"):console.error("UNKNOWN MESSAGE:",e)})(t,e).then((()=>{t.N=null,f(t)}))}}class l{constructor(t,n,e=4,i=null,o=null,s=[],c=[],a=[]){this.H=t,this.l=n,this.T=e,this.F=i,this.N=o,this.u=s,this.t=c,this.B=a}C(){return this.F}async R(t,n){const e=await this.C();return null==e?void 0:e.put(t,n)}async h(t){const n=await this.C();return null==n?void 0:n.match(t)}o(){}}(t=>{const e=(i=t.fetch.bind(t),o=new URL(t.location.href),new l(i,o));var i,o;e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open("QwikBundles")),t.addEventListener("fetch",(t=>{const i=t.request;if("GET"===i.method){const o=n(e,new URL(i.url));o&&t.respondWith(o)}})),t.addEventListener("message",(t=>{e.B.push(t.data),f(e)})),t.addEventListener("install",(()=>{t.skipWaiting()})),t.addEventListener("activate",(n=>{e.C=()=>e.F?e.F:(clearTimeout(void 0),setTimeout((()=>{e.F=null}),5e3),t.caches.open("QwikBundles")),n.waitUntil(t.clients.claim())}))})(globalThis)})();
@@ -0,0 +1,228 @@
1
+ (() => {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0,
10
+ value: value
11
+ }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {})) {
14
+ __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ if (__getOwnPropSymbols) {
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ }
21
+ return a;
22
+ };
23
+ ((doc, hasInitialized) => {
24
+ const Q_CONTEXT = "__q_context__";
25
+ const win = window;
26
+ const events = new Set;
27
+ const roots = new Set([ doc ]);
28
+ const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));
29
+ const querySelectorAll = query => {
30
+ const elements = [];
31
+ roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));
32
+ return elements;
33
+ };
34
+ const findShadowRoots = fragment => {
35
+ processEventOrNode(fragment);
36
+ nativeQuerySelectorAll(fragment, "[q\\:shadowroot]").forEach((parent => {
37
+ const shadowRoot = parent.shadowRoot;
38
+ shadowRoot && findShadowRoots(shadowRoot);
39
+ }));
40
+ };
41
+ const isPromise = promise => promise && "function" == typeof promise.then;
42
+ const broadcast = (infix, ev, type = ev.type) => {
43
+ querySelectorAll("[on" + infix + "\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));
44
+ };
45
+ const resolveContainer = containerEl => {
46
+ if (void 0 === containerEl._qwikjson_) {
47
+ let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;
48
+ while (script) {
49
+ if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {
50
+ containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\x3C(\/?script)/gi, "<$1"));
51
+ break;
52
+ }
53
+ script = script.previousElementSibling;
54
+ }
55
+ }
56
+ };
57
+ const createEvent = (eventName, detail) => new CustomEvent(eventName, {
58
+ detail: detail
59
+ });
60
+ const dispatch = async (element, scope, ev, eventName = ev.type) => {
61
+ const attrName = "on" + scope + ":" + eventName;
62
+ element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();
63
+ const ctx = element._qc_;
64
+ const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));
65
+ if (relevantListeners && relevantListeners.length > 0) {
66
+ for (const listener of relevantListeners) {
67
+ const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);
68
+ const cancelBubble = ev.cancelBubble;
69
+ isPromise(results) && await results;
70
+ cancelBubble && ev.stopPropagation();
71
+ }
72
+ return;
73
+ }
74
+ const qDispatchEvent = element.qDispatchEvent;
75
+ if (qDispatchEvent) {
76
+ return qDispatchEvent(ev, scope);
77
+ }
78
+ const attrValue = element.getAttribute(attrName);
79
+ if (attrValue) {
80
+ const container = element.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
81
+ const qBase = container.getAttribute("q:base");
82
+ const qVersion = container.getAttribute("q:version") || "unknown";
83
+ const qManifest = container.getAttribute("q:manifest-hash") || "dev";
84
+ const base = new URL(qBase, doc.baseURI);
85
+ for (const qrl of attrValue.split("\n")) {
86
+ const url = new URL(qrl, base);
87
+ const href = url.href;
88
+ const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";
89
+ const reqTime = performance.now();
90
+ let handler;
91
+ let importError;
92
+ let error;
93
+ const isSync = qrl.startsWith("#");
94
+ const eventData = {
95
+ qBase: qBase,
96
+ qManifest: qManifest,
97
+ qVersion: qVersion,
98
+ href: href,
99
+ symbol: symbol,
100
+ element: element,
101
+ reqTime: reqTime
102
+ };
103
+ if (isSync) {
104
+ const hash = container.getAttribute("q:instance");
105
+ handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];
106
+ if (!handler) {
107
+ importError = "sync";
108
+ error = new Error("sync handler error for symbol: " + symbol);
109
+ }
110
+ } else {
111
+ const uri = url.href.split("#")[0];
112
+ try {
113
+ const module = import(
114
+ /* @vite-ignore */
115
+ uri);
116
+ resolveContainer(container);
117
+ handler = (await module)[symbol];
118
+ if (!handler) {
119
+ importError = "no-symbol";
120
+ error = new Error(`${symbol} not in ${uri}`);
121
+ }
122
+ } catch (err) {
123
+ importError || (importError = "async");
124
+ error = err;
125
+ }
126
+ }
127
+ if (!handler) {
128
+ emitEvent("qerror", __spreadValues({
129
+ importError: importError,
130
+ error: error
131
+ }, eventData));
132
+ console.error(error);
133
+ break;
134
+ }
135
+ const previousCtx = doc[Q_CONTEXT];
136
+ if (element.isConnected) {
137
+ const handleEvent = async (retryCount = 0) => {
138
+ try {
139
+ doc[Q_CONTEXT] = [ element, ev, url ];
140
+ isSync || emitEvent("qsymbol", __spreadValues({}, eventData));
141
+ const results = handler(ev, element);
142
+ isPromise(results) && await results;
143
+ } catch (error2) {
144
+ isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({
145
+ error: error2
146
+ }, eventData));
147
+ } finally {
148
+ doc[Q_CONTEXT] = previousCtx;
149
+ }
150
+ };
151
+ handleEvent();
152
+ }
153
+ }
154
+ }
155
+ };
156
+ const emitEvent = (eventName, detail) => {
157
+ doc.dispatchEvent(createEvent(eventName, detail));
158
+ };
159
+ const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));
160
+ const processDocumentEvent = async ev => {
161
+ let type = camelToKebab(ev.type);
162
+ let element = ev.target;
163
+ broadcast("-document", ev, type);
164
+ while (element && element.getAttribute) {
165
+ const results = dispatch(element, "", ev, type);
166
+ let cancelBubble = ev.cancelBubble;
167
+ isPromise(results) && await results;
168
+ cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);
169
+ element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;
170
+ }
171
+ };
172
+ const processWindowEvent = ev => {
173
+ broadcast("-window", ev, camelToKebab(ev.type));
174
+ };
175
+ const processReadyStateChange = () => {
176
+ var _a;
177
+ const readyState = doc.readyState;
178
+ if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {
179
+ roots.forEach(findShadowRoots);
180
+ hasInitialized = 1;
181
+ emitEvent("qinit");
182
+ (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));
183
+ if (events.has("qvisible")) {
184
+ const results = querySelectorAll("[on\\:qvisible]");
185
+ const observer = new IntersectionObserver((entries => {
186
+ for (const entry of entries) {
187
+ if (entry.isIntersecting) {
188
+ observer.unobserve(entry.target);
189
+ dispatch(entry.target, "", createEvent("qvisible", entry));
190
+ }
191
+ }
192
+ }));
193
+ results.forEach((el => observer.observe(el)));
194
+ }
195
+ }
196
+ };
197
+ const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {
198
+ capture: capture,
199
+ passive: !1
200
+ });
201
+ const processEventOrNode = (...eventNames) => {
202
+ for (const eventNameOrNode of eventNames) {
203
+ if ("string" == typeof eventNameOrNode) {
204
+ if (!events.has(eventNameOrNode)) {
205
+ roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));
206
+ addEventListener(win, eventNameOrNode, processWindowEvent, !0);
207
+ events.add(eventNameOrNode);
208
+ }
209
+ } else if (!roots.has(eventNameOrNode)) {
210
+ events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));
211
+ roots.add(eventNameOrNode);
212
+ }
213
+ }
214
+ };
215
+ if (!(Q_CONTEXT in doc)) {
216
+ doc[Q_CONTEXT] = 0;
217
+ const qwikevents = win.qwikevents;
218
+ Array.isArray(qwikevents) && processEventOrNode(...qwikevents);
219
+ win.qwikevents = {
220
+ events: events,
221
+ roots: roots,
222
+ push: processEventOrNode
223
+ };
224
+ addEventListener(doc, "readystatechange", processReadyStateChange);
225
+ processReadyStateChange();
226
+ }
227
+ })(document);
228
+ })();
@@ -0,0 +1,3 @@
1
+ (()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&o(e,a,s[a]);if(t)for(var a of t(s))r.call(s,a)&&o(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",r=window,o=new Set,a=new Set([e]),c="replace",i="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\:"+n+"]")[i]((r=>E(r,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[c](/\\x3C(\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),E=async(t,r,o,a=o.type)=>{const i="on"+r+":"+a;t.hasAttribute("preventdefault:"+a)&&o.preventDefault();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===i));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,o],(()=>t[p]))(o,t),r=o.cancelBubble;q(n)&&await n,r&&o.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(o,r);const h=t[f](i);if(h){const r=t.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),a=r[f]("q:base"),i=r[f]("q:version")||"unknown",l=r[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\n")){const u=new URL(f,b),h=u.href,y=u.hash[c](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,E;const _=f.startsWith("#"),A={qBase:a,qManifest:l,qVersion:i,href:h,symbol:y,element:t,reqTime:d};if(_){const t=r.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",E=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(
2
+ /* @vite-ignore */
3
+ e);w(r),m=(await t)[y],m||(v="no-symbol",E=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),E=e}}if(!m){g("qerror",s({importError:v,error:E},A)),console.error(E);break}const k=e[n];if(t[p]){const r=async(a=0)=>{try{e[n]=[t,o,u],_||g("qsymbol",s({},A));const r=m(o,t);q(r)&&await r}catch(e){q(e)&&a<100?e.then((()=>r(a++))):g("qerror",s({error:e},A))}finally{e[n]=k}};r()}}}},g=(t,n)=>{e.dispatchEvent(v(t,n))},_=e=>e[c](/([A-Z])/g,(e=>"-"+e.toLowerCase())),A=async e=>{let t=_(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const r=E(n,"",e,t);let o=e.cancelBubble;q(r)&&await r,o=o||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==o?n.parentElement:null}},k=e=>{m("-window",e,_(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,g("qinit"),(null!=(n=r.requestIdleCallback)?n:r.setTimeout).bind(r)((()=>g("qidle"))),o.has(b))){const e=y("[on\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),E(n[l],"",v(b,n)))}));e[i]((e=>t.observe(e)))}},O=(e,t,n,r=!1)=>e.addEventListener(t,n,{capture:r,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?o.has(t)||(a.forEach((e=>O(e,t,A,!0))),O(r,t,k,!0),o.add(t)):a.has(t)||(o.forEach((e=>O(t,e,A,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=r.qwikevents;Array.isArray(t)&&S(...t),r.qwikevents={events:o,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})();
@@ -0,0 +1,38 @@
1
+ /// <reference types="./server" />
2
+ declare module '@qwik-client-manifest' {
3
+ const manifest: import('./optimizer').QwikManifest;
4
+ export { manifest };
5
+ }
6
+ // MD
7
+ declare module '*.md' {
8
+ const node: import('./core').FunctionComponent;
9
+ export const frontmatter: Record<string, any>;
10
+ export default node;
11
+ }
12
+ // MDX
13
+ declare module '*.mdx' {
14
+ const node: import('./core').FunctionComponent;
15
+ export const frontmatter: Record<string, any>;
16
+ export default node;
17
+ }
18
+ // SVG ?jsx
19
+ declare module '*.svg?jsx' {
20
+ const Cmp: import('./core').FunctionComponent<import('./core').QwikIntrinsicElements['svg']>
21
+ export default Cmp;
22
+ }
23
+ // Image ?jsx
24
+ declare module '*?jsx' {
25
+ const Cmp: import('./core').FunctionComponent<Omit<import('./core').QwikIntrinsicElements['img'], 'src' | 'width' | 'height' | 'srcSet'>>
26
+ export default Cmp;
27
+ export const width: number;
28
+ export const height: number;
29
+ export const srcSet: string;
30
+ }
31
+ // Image &jsx
32
+ declare module '*&jsx' {
33
+ const Cmp: import('./core').FunctionComponent<Omit<import('./core').QwikIntrinsicElements['img'], 'src' | 'width' | 'height' | 'srcSet'>>
34
+ export default Cmp;
35
+ export const width: number;
36
+ export const height: number;
37
+ export const srcSet: string;
38
+ }