@krate/runtime 0.5.0-alpha.4 → 0.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-context.d.ts +5 -1
- package/dist/action-context.js +33 -3
- package/dist/action-context.test.js +26 -1
- package/dist/actions.d.ts +12 -1
- package/dist/actions.js +84 -4
- package/dist/actions.test.js +61 -1
- package/dist/assets-static.d.ts +5 -0
- package/dist/assets-static.js +31 -0
- package/dist/boundary.d.ts +12 -0
- package/dist/boundary.js +53 -13
- package/dist/cache-adapter.d.ts +113 -0
- package/dist/cache-adapter.js +217 -0
- package/dist/cache-adapter.test.d.ts +1 -0
- package/dist/cache-adapter.test.js +244 -0
- package/dist/cache-redis.d.ts +27 -0
- package/dist/cache-redis.js +110 -0
- package/dist/cache-scope.d.ts +25 -9
- package/dist/cache-scope.js +64 -13
- package/dist/cache.d.ts +1 -0
- package/dist/cache.js +3 -3
- package/dist/cache.test.js +16 -0
- package/dist/class-component.js +6 -0
- package/dist/class-component.test.js +53 -2
- package/dist/class-helpers.d.ts +4 -4
- package/dist/class-helpers.js +357 -32
- package/dist/class-helpers.test.d.ts +1 -0
- package/dist/class-helpers.test.js +169 -0
- package/dist/context.d.ts +16 -2
- package/dist/context.js +44 -3
- package/dist/dev-overlay.js +85 -12
- package/dist/dev-overlay.test.js +22 -0
- package/dist/dom.d.ts +15 -0
- package/dist/dom.js +97 -3
- package/dist/effect-errors.test.d.ts +1 -0
- package/dist/effect-errors.test.js +163 -0
- package/dist/effects.d.ts +8 -0
- package/dist/effects.js +13 -0
- package/dist/error-overlay.js +7 -7
- package/dist/handler-html.d.ts +63 -0
- package/dist/handler-html.js +285 -0
- package/dist/handler-html.test.d.ts +1 -0
- package/dist/handler-html.test.js +256 -0
- package/dist/handler-routing.d.ts +83 -0
- package/dist/handler-routing.js +579 -0
- package/dist/handler-routing.test.d.ts +1 -0
- package/dist/handler-routing.test.js +99 -0
- package/dist/handler-segments.d.ts +43 -0
- package/dist/handler-segments.js +115 -0
- package/dist/handler-segments.test.d.ts +1 -0
- package/dist/handler-segments.test.js +217 -0
- package/dist/head-tags.d.ts +51 -0
- package/dist/head-tags.js +329 -0
- package/dist/head-tags.test.d.ts +1 -0
- package/dist/head-tags.test.js +131 -0
- package/dist/highlight-bind.d.ts +42 -0
- package/dist/highlight-bind.js +176 -0
- package/dist/highlight-bind.test.d.ts +1 -0
- package/dist/highlight-bind.test.js +124 -0
- package/dist/highlight.d.ts +93 -0
- package/dist/highlight.js +426 -0
- package/dist/highlight.test.d.ts +1 -0
- package/dist/highlight.test.js +56 -0
- package/dist/hints.d.ts +19 -0
- package/dist/hints.js +97 -0
- package/dist/hook-args.d.ts +7 -0
- package/dist/hook-args.js +10 -0
- package/dist/htmlspec-attributes.d.ts +1 -0
- package/dist/htmlspec-attributes.js +159 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/jsx-types.d.ts +11 -0
- package/dist/krate-core.js +2 -0
- package/dist/krate-dev.js +75 -12
- package/dist/krate-f-actions.js +2 -0
- package/dist/krate-f-classes.js +8 -0
- package/dist/krate-f-helpers.js +2 -0
- package/dist/krate-f-highlight.js +2 -0
- package/dist/krate-f-list.js +2 -0
- package/dist/krate-f-navigation.js +2 -0
- package/dist/krate-f-router-lite.js +2 -0
- package/dist/krate-f-router.js +2 -0
- package/dist/krate-features.json +493 -0
- package/dist/krate-hydrate-lite.js +5 -5
- package/dist/krate-hydrate.js +5 -5
- package/dist/krate-runtime.js +5 -5
- package/dist/list.js +4 -2
- package/dist/metadata-routes.d.ts +75 -0
- package/dist/metadata-routes.js +76 -0
- package/dist/metadata.d.ts +222 -0
- package/dist/metadata.js +452 -0
- package/dist/metadata.test.d.ts +1 -0
- package/dist/metadata.test.js +167 -0
- package/dist/navigation-server.d.ts +27 -0
- package/dist/navigation-server.js +90 -0
- package/dist/navigation.d.ts +37 -0
- package/dist/navigation.js +195 -0
- package/dist/navigation.test.d.ts +1 -0
- package/dist/navigation.test.js +130 -0
- package/dist/node-server.d.ts +22 -0
- package/dist/node-server.js +436 -0
- package/dist/node-server.test.d.ts +1 -0
- package/dist/node-server.test.js +492 -0
- package/dist/og-files.d.ts +2 -0
- package/dist/og-files.js +19 -0
- package/dist/og.d.ts +56 -0
- package/dist/og.js +156 -0
- package/dist/patterns.test.d.ts +1 -0
- package/dist/patterns.test.js +98 -0
- package/dist/react.d.ts +47 -0
- package/dist/react.js +59 -1
- package/dist/react19.test.d.ts +1 -0
- package/dist/react19.test.js +176 -0
- package/dist/reactivity-core.test.d.ts +1 -0
- package/dist/reactivity-core.test.js +152 -0
- package/dist/reconcile.js +4 -2
- package/dist/request-context.d.ts +23 -0
- package/dist/request-context.js +45 -0
- package/dist/resp.d.ts +55 -0
- package/dist/resp.js +239 -0
- package/dist/router-layout.test.js +70 -0
- package/dist/router-nav.test.js +65 -0
- package/dist/router-speculation.test.d.ts +1 -0
- package/dist/router-speculation.test.js +25 -0
- package/dist/router-styles.test.d.ts +1 -0
- package/dist/router-styles.test.js +98 -0
- package/dist/router.js +175 -36
- package/dist/segmented-lru.d.ts +19 -0
- package/dist/segmented-lru.js +87 -0
- package/dist/server-async.test.js +43 -1
- package/dist/server-handler.d.ts +165 -0
- package/dist/server-handler.js +1826 -0
- package/dist/server-handler.test.d.ts +1 -0
- package/dist/server-handler.test.js +522 -0
- package/dist/server-highlight.test.d.ts +1 -0
- package/dist/server-highlight.test.js +32 -0
- package/dist/server-renderer.js +165 -720
- package/dist/server-renderer.test.d.ts +1 -0
- package/dist/server-renderer.test.js +266 -0
- package/dist/server.d.ts +13 -1
- package/dist/server.js +131 -16
- package/dist/server.test.js +20 -0
- package/dist/sha256.d.ts +1 -0
- package/dist/sha256.js +66 -0
- package/dist/sha256.test.d.ts +1 -0
- package/dist/sha256.test.js +13 -0
- package/dist/shared-isr.d.ts +31 -0
- package/dist/shared-isr.js +142 -0
- package/dist/signal.d.ts +3 -2
- package/dist/signal.js +163 -23
- package/dist/slots.js +12 -1
- package/dist/ssr-core-behavior.test.d.ts +1 -0
- package/dist/ssr-core-behavior.test.js +620 -0
- package/dist/ssr-core.d.ts +175 -0
- package/dist/ssr-core.js +940 -0
- package/dist/ssr-core.test.d.ts +1 -0
- package/dist/ssr-core.test.js +324 -0
- package/dist/static-memory.d.ts +3 -0
- package/dist/static-memory.js +47 -0
- package/dist/static-memory.test.d.ts +1 -0
- package/dist/static-memory.test.js +26 -0
- package/dist/test-redis.d.ts +12 -0
- package/dist/test-redis.js +131 -0
- package/dist/use-id.d.ts +8 -0
- package/dist/use-id.js +40 -0
- package/package.json +30 -2
package/dist/krate-dev.js
CHANGED
|
@@ -153,11 +153,11 @@ var __krate_exports = (() => {
|
|
|
153
153
|
:host {
|
|
154
154
|
--red: #f87171;
|
|
155
155
|
--green: #34d399;
|
|
156
|
-
--bg: #
|
|
157
|
-
--bg-2: #
|
|
158
|
-
--line: #
|
|
159
|
-
--fg: #
|
|
160
|
-
--muted: #
|
|
156
|
+
--bg: #111111;
|
|
157
|
+
--bg-2: #171717;
|
|
158
|
+
--line: #2a2a2a;
|
|
159
|
+
--fg: #e5e5e5;
|
|
160
|
+
--muted: #a3a3a3;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/* toolbar */
|
|
@@ -204,7 +204,7 @@ var __krate_exports = (() => {
|
|
|
204
204
|
/* overlay */
|
|
205
205
|
.overlay {
|
|
206
206
|
position: fixed; inset: 0; z-index: 2147483000;
|
|
207
|
-
background: rgba(
|
|
207
|
+
background: rgba(10, 10, 10, 0.72); backdrop-filter: blur(6px);
|
|
208
208
|
display: flex; align-items: flex-start; justify-content: center;
|
|
209
209
|
padding: 4vh 16px; overflow: auto;
|
|
210
210
|
font: 13px/1.5 "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
@@ -228,9 +228,9 @@ var __krate_exports = (() => {
|
|
|
228
228
|
border-radius: 9px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 12px;
|
|
229
229
|
transition: color .15s ease, background .15s ease, border-color .15s ease;
|
|
230
230
|
}
|
|
231
|
-
.btn:hover { color: var(--fg); background: rgba(255,255,255,.06); border-color: #
|
|
231
|
+
.btn:hover { color: var(--fg); background: rgba(255,255,255,.06); border-color: #444444; }
|
|
232
232
|
.list { padding: 6px 0; }
|
|
233
|
-
.diag { padding: 14px 18px; border-bottom: 1px solid #
|
|
233
|
+
.diag { padding: 14px 18px; border-bottom: 1px solid #1f1f1f; }
|
|
234
234
|
.diag:last-child { border-bottom: none; }
|
|
235
235
|
.actions { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
|
236
236
|
.loc {
|
|
@@ -241,10 +241,10 @@ var __krate_exports = (() => {
|
|
|
241
241
|
.loc:hover { text-decoration: underline; }
|
|
242
242
|
.msg { color: #f3f4f6; white-space: pre-wrap; word-break: break-word; }
|
|
243
243
|
.frame {
|
|
244
|
-
margin-top: 10px; background: #
|
|
244
|
+
margin-top: 10px; background: #0b0b0b; border: 1px solid #262626;
|
|
245
245
|
border-radius: 7px; padding: 8px 10px; overflow-x: auto; white-space: pre;
|
|
246
246
|
}
|
|
247
|
-
.frame .src { color: #
|
|
247
|
+
.frame .src { color: #d4d4d4; }
|
|
248
248
|
.frame .caret { color: var(--red); }
|
|
249
249
|
.hint { margin-top: 8px; color: #a3e635; }
|
|
250
250
|
.stack {
|
|
@@ -345,14 +345,32 @@ var __krate_exports = (() => {
|
|
|
345
345
|
} catch {
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
|
+
let connectedOnce = false;
|
|
349
|
+
sse.addEventListener("connected", () => {
|
|
350
|
+
if (connectedOnce) location.reload();
|
|
351
|
+
connectedOnce = true;
|
|
352
|
+
});
|
|
348
353
|
sse.addEventListener("reload", (e) => {
|
|
354
|
+
if (this.buildDiags.length > 0) {
|
|
355
|
+
this.buildDiags = [];
|
|
356
|
+
this.setStatus(true);
|
|
357
|
+
this.render();
|
|
358
|
+
}
|
|
359
|
+
let cssOnly = false;
|
|
349
360
|
try {
|
|
350
361
|
const d = JSON.parse(e.data);
|
|
351
|
-
|
|
362
|
+
cssOnly = d.cssOnly === true;
|
|
363
|
+
if (d.pages && Array.isArray(d.pages) && !d.pages.some(
|
|
364
|
+
(p) => p === "/404" || p === "/500" || routeMatches(p, location.pathname, this.cfg.basePath)
|
|
365
|
+
)) {
|
|
352
366
|
return;
|
|
353
367
|
}
|
|
354
368
|
} catch {
|
|
355
369
|
}
|
|
370
|
+
if (cssOnly) {
|
|
371
|
+
this.swapStylesheets().catch(() => location.reload());
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
356
374
|
location.reload();
|
|
357
375
|
});
|
|
358
376
|
sse.addEventListener("build-error", (e) => {
|
|
@@ -370,11 +388,55 @@ var __krate_exports = (() => {
|
|
|
370
388
|
const d = JSON.parse(e.data);
|
|
371
389
|
if (!d.clientError) return;
|
|
372
390
|
const err = d.clientError;
|
|
391
|
+
if (this.seen.has(err.message + "|" + (err.stack || ""))) return;
|
|
373
392
|
this.addRuntime("Runtime Error", err.message, err.stack);
|
|
374
393
|
} catch {
|
|
375
394
|
}
|
|
376
395
|
});
|
|
377
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Apply a CSS-only rebuild without a full reload: fetch the freshly built
|
|
399
|
+
* document, add its stylesheet links, and drop the ones it no longer has.
|
|
400
|
+
* Inline <style> changes cannot be diffed safely, so they fall back to a
|
|
401
|
+
* reload (the caller reloads when this rejects).
|
|
402
|
+
*/
|
|
403
|
+
async swapStylesheets() {
|
|
404
|
+
const res = await fetch(location.href, { cache: "no-store", headers: { Accept: "text/html" } });
|
|
405
|
+
if (!res.ok) throw new Error("fetch failed");
|
|
406
|
+
const next = new DOMParser().parseFromString(await res.text(), "text/html");
|
|
407
|
+
const inline = (d) => Array.from(d.querySelectorAll("style")).map((el) => el.textContent || "").join("\0");
|
|
408
|
+
if (inline(next) !== inline(document)) throw new Error("inline styles changed");
|
|
409
|
+
const abs = (href) => new URL(href, location.href).href;
|
|
410
|
+
const want = Array.from(next.querySelectorAll('link[rel~="stylesheet"]')).map((l) => abs(l.getAttribute("href") || ""));
|
|
411
|
+
const current = Array.from(document.querySelectorAll('link[rel~="stylesheet"]'));
|
|
412
|
+
const have = new Set(current.map((l) => abs(l.getAttribute("href") || "")));
|
|
413
|
+
const loads = [];
|
|
414
|
+
for (const href of want) {
|
|
415
|
+
if (have.has(href)) continue;
|
|
416
|
+
const link = document.createElement("link");
|
|
417
|
+
link.rel = "stylesheet";
|
|
418
|
+
link.href = href;
|
|
419
|
+
loads.push(
|
|
420
|
+
new Promise((resolve, reject) => {
|
|
421
|
+
link.onload = () => resolve();
|
|
422
|
+
link.onerror = () => reject(new Error("stylesheet failed"));
|
|
423
|
+
})
|
|
424
|
+
);
|
|
425
|
+
document.head.appendChild(link);
|
|
426
|
+
}
|
|
427
|
+
await Promise.all(loads);
|
|
428
|
+
const keep = new Set(want);
|
|
429
|
+
for (const l of current) {
|
|
430
|
+
if (!keep.has(abs(l.getAttribute("href") || ""))) l.remove();
|
|
431
|
+
}
|
|
432
|
+
for (const l of current) {
|
|
433
|
+
const href = abs(l.getAttribute("href") || "");
|
|
434
|
+
if (!keep.has(href) || !l.isConnected) continue;
|
|
435
|
+
const u = new URL(href);
|
|
436
|
+
u.searchParams.set("_krate", String(Date.now()));
|
|
437
|
+
l.href = u.href;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
378
440
|
captureRuntimeErrors() {
|
|
379
441
|
window.addEventListener("error", (e) => {
|
|
380
442
|
const stack = e.error?.stack || "";
|
|
@@ -406,7 +468,8 @@ var __krate_exports = (() => {
|
|
|
406
468
|
if (navigator.sendBeacon) {
|
|
407
469
|
navigator.sendBeacon(this.cfg.errors, new Blob([body], { type: "application/json" }));
|
|
408
470
|
} else {
|
|
409
|
-
fetch(this.cfg.errors, { method: "POST", body, headers: { "Content-Type": "application/json" }, keepalive: true })
|
|
471
|
+
fetch(this.cfg.errors, { method: "POST", body, headers: { "Content-Type": "application/json" }, keepalive: true }).catch(() => {
|
|
472
|
+
});
|
|
410
473
|
}
|
|
411
474
|
} catch {
|
|
412
475
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var g=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},U=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of W(e))!J.call(t,r)&&r!==n&&g(t,r,{get:()=>e[r],enumerable:!(o=N(e,r))||o.enumerable});return t};var Q=t=>U(g({},"__esModule",{value:!0}),t);var wt={};K(wt,{ACTION_ARGS_FIELD:()=>v,ServerActionError:()=>p,__krateAction:()=>tt,__krateActionState:()=>ft,__krateAssignRef:()=>rt,__krateBeginAction:()=>y,__krateBindFormAction:()=>st,__krateFormStatusMount:()=>ot,__krateOptimistic:()=>pt,callServerAction:()=>A,getFormStatus:()=>at,installActionForms:()=>j,isActionPending:()=>et,isServerAction:()=>D,reportActionError:()=>T,requestFormReset:()=>it,runActionTransition:()=>F,setActionTransitionRunner:()=>nt,submitFormAction:()=>$,takeFlash:()=>I});var _=window.createEffect;var R=window.krateRunEvent;var d=window.krateTransitionWrites,P=window.onCleanup;var v="__krate_args",p=class extends Error{constructor(e,n,o){super(e),this.name="ServerActionError",this.status=n,o&&(this.digest=o)}};function V(){let t=globalThis.__KRATE_CFG__;return t&&t.basePath?t.basePath:""}function D(t){return typeof t=="function"&&typeof t.$$krateAction=="string"}var S=0;function z(t){let e=X(t);if(!e)return;let n=globalThis.navigate;typeof n=="function"?n(e):typeof location<"u"&&location.assign(e)}function X(t){return!t||!t.startsWith("/")||t.startsWith("//")||t.includes("\\")||/[\u0000-\u001f\u007f]/.test(t)?"":t}function Y(t){if(typeof window>"u"||typeof CustomEvent>"u")return;let e={paths:t&&Array.isArray(t.paths)?t.paths:[],tags:t&&Array.isArray(t.tags)?t.tags:[]};window.dispatchEvent(new CustomEvent("krate:revalidate",{detail:e}))}function Z(t,e,n){let o=t?t.error:void 0;if(o&&typeof o=="object")return new p(o.message||"Server action failed",e,o.digest);let r=t&&(t.details||(typeof o=="string"?o:""))||n||"Server action failed";return new p(r,e)}async function A(t,e){let n={accept:"application/json","x-krate-action":"fetch"};typeof location<"u"&&(n["x-krate-return"]=location.pathname+location.search);let o,r=e[e.length-1];if(typeof FormData<"u"&&r instanceof FormData){let s=new FormData;r.forEach((u,l)=>{l!==v&&s.append(l,u)});let c=e.slice(0,-1);c.length>0&&s.set(v,JSON.stringify(c)),o=s}else n["content-type"]="application/json",o=JSON.stringify({args:e});let a=await fetch(t,{method:"POST",credentials:"same-origin",headers:n,body:o}),i=null;try{i=await a.json()}catch{i=null}if(!a.ok||!i||i.ok===!1)throw Z(i,a.status,a.statusText);return i.revalidated&&Y(i.revalidation),typeof i.redirect=="string"&&i.redirect&&(S++,z(i.redirect)),i.result}function L(t,e){let n=V()+"/__krate/action/"+t,o=function(...r){return A(n,e.concat(r))};return Object.defineProperty(o,"actionUrl",{value:n}),Object.defineProperty(o,"$$krateAction",{value:t}),Object.defineProperty(o,"$$krateBound",{value:e}),Object.defineProperty(o,"bind",{value:(r,...a)=>L(t,e.concat(a))}),o.toString=()=>n,o}function tt(t){return L(t,[])}var f=0,h=new Set;function y(){f++;let t=!1;return()=>{t||(t=!0,f--,f===0&&d(()=>{for(let e of Array.from(h))e()}))}}function et(){return f>0}var H=t=>{let e=y(),n;try{n=t()}catch(o){return e(),Promise.reject(o)}return Promise.resolve(n).finally(e)},G=H;function nt(t){G=t||H}function F(t){return G(t)}function T(t,e){let n=globalThis;if(typeof n.__krateActionError=="function")try{if(n.__krateActionError(t,e)===!0)return}catch{}let o=e||(typeof document<"u"?document:null),r=!1;if(o&&typeof CustomEvent<"u"){let a=new CustomEvent("krate:action-error",{bubbles:!0,cancelable:!0,detail:{error:t}});r=!o.dispatchEvent(a)}r||console.error("krate server action:",t)}var b=Object.freeze({pending:!1,data:null,method:null,action:null}),w=new WeakMap;function q(t){let e=w.get(t);return e||(e={status:b,subs:new Set,running:0,resetRequested:!1},w.set(t,e)),e}function O(t,e){t.status=e;for(let n of Array.from(t.subs))n(e)}function ot(t,e){let n=null;for(let a=t?t.parentElement:null;a;a=a.parentElement)if(a.tagName==="FORM"){n=a;break}if(!n)return()=>{};let o=q(n),r=a=>{e.status&&e.status(a),e.pending&&e.pending(a.pending),e.data&&e.data(a.data),e.method&&e.method(a.method),e.action&&e.action(a.action)};return o.subs.add(r),r(o.status),()=>{o.subs.delete(r)}}function rt(t,e){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e)}function at(t){return w.get(t)?.status||b}function B(t){let e=Array.from(t.querySelectorAll("[data-kattr-value],[data-kattr-checked]")).map(n=>({el:n,value:n.value,checked:n.checked}));t.reset();for(let n of e)n.el.hasAttribute("data-kattr-value")&&(n.el.value=n.value),n.el.hasAttribute("data-kattr-checked")&&(n.el.checked=n.checked)}function it(t){let e=w.get(t);if(e&&e.running>0){e.resetRequested=!0;return}B(t)}function st(t,e){t&&(t.__krateFormAction=e,t.tagName==="FORM"?(t.removeAttribute("action"),t.removeAttribute("method")):(t.removeAttribute("formaction"),t.removeAttribute("formmethod")),t.removeAttribute("data-krate-action"))}function C(t){if(!t)return null;let e=t.__krateFormAction;if(typeof e!="function")return null;try{return e()}catch{return null}}function ct(t,e){if(e&&e!==t){let o=C(e);if(typeof o=="function")return{fn:o};if(e.hasAttribute("data-krate-action"))return{url:e.formAction||t.action};if(e.hasAttribute("formaction"))return null}let n=C(t);return typeof n=="function"?{fn:n}:t.hasAttribute("data-krate-action")?{url:t.action}:null}function ut(t,e){let n;try{n=e?new FormData(t,e):new FormData(t)}catch{n=new FormData(t);let o=e;o&&o.name&&n.append(o.name,o.value)}return n}function lt(t){let e=t.indexOf("?");return e<0?t:t.slice(0,e)}async function $(t,e,n,o=null,r){let a=q(t),i=(o&&o.getAttribute("formmethod")||t.getAttribute("method")||"get").toLowerCase();a.running++,O(a,{pending:!0,data:n,method:i,action:e||r||null}),t.setAttribute("data-krate-action-pending","1");let s=!1;try{await F(async()=>{let c=e;if(c&&typeof c.__krateRun=="function"){s=await c.__krateRun(n);return}typeof c=="function"?await c(n):r&&await A(lt(r),[n]),s=!0})}catch(c){T(c,t)}finally{a.running--,a.running===0&&(t.removeAttribute("data-krate-action-pending"),d(()=>O(a,b)),(s||a.resetRequested)&&(a.resetRequested=!1,s&&t.hasAttribute("data-krate-reload")?location.reload():B(t)))}return s}function dt(t){let e=t.target;if(!e||e.tagName!=="FORM"||t.defaultPrevented)return;let n=t.submitter||null,o=ct(e,n);if(!o)return;t.preventDefault();let r=ut(e,n);R("submit",!0,()=>{$(e,o.fn,r,n,o.url)})}function j(t=typeof document<"u"?document:void 0){if(!t)return;let e=t.defaultView;!e||e.__krateActionBound||(e.__krateActionBound=!0,t.addEventListener("submit",dt,!1))}function x(t){try{let e=t.split(".")[0].replace(/-/g,"+").replace(/_/g,"/"),n=atob(e+"=".repeat((4-e.length%4)%4));return JSON.parse(decodeURIComponent(escape(n)))}catch{return null}}function I(t){if(typeof document>"u")return{found:!1};let e=/(?:^|;\s*)krate_flash=([^;]*)/.exec(document.cookie||"");if(e){let o=x(e[1]);return o&&o.a===t?(document.cookie="krate_flash=; Path=/; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax",M(t),{found:!0,value:o.r}):{found:!1}}let n=document.querySelectorAll("[data-krate-flash]");for(let o=0;o<n.length;o++){let r=x(n[o].getAttribute("data-krate-flash")||"");if(r&&r.a===t)return M(t),{found:!0,value:r.r}}return{found:!1}}function M(t){let e=document.querySelectorAll("[data-krate-flash]");for(let n=0;n<e.length;n++){let o=x(e[n].getAttribute("data-krate-flash")||"");o&&o.a===t&&e[n].parentNode?.removeChild(e[n])}}function ft(t,e,n,o){let r=[],a=!1;if(D(t)){let u=I(t.$$krateAction);u.found&&n(u.value)}let i=async()=>{for(a=!0;r.length>0;){let u=r.shift(),l=!1;try{let k=S,m=await F(()=>t(e(),u.payload));S===k&&d(()=>n(m)),l=!0}catch(k){let m=r.splice(0);for(let E of m)E.end(),E.done(!1);T(k)}finally{d(()=>{u.end(),u.done(l)})}}a=!1,d(()=>o(!1))},s=u=>new Promise(l=>{r.push({payload:u,end:y(),done:l}),o(!0),a||i()}),c=(u=>{s(u)});return c.__krateRun=s,c}function pt(t,e,n){let o=[],r=i=>{let s=i;for(let c of o)s=n?n(s,c):c;return s};_(()=>{e(r(t()))});let a=()=>{o.length!==0&&(o=[],e(t()))};return h.add(a),P(()=>{h.delete(a)}),i=>{o.push(i),e(r(t())),f===0&&queueMicrotask(()=>{f===0&&a()})}}typeof document<"u"&&j(document);return Q(wt);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var T=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var xe=Object.prototype.hasOwnProperty;var ge=(t,e)=>{for(var n in e)T(t,n,{get:e[n],enumerable:!0})},ve=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Oe(e))!xe.call(t,o)&&o!==n&&T(t,o,{get:()=>e[o],enumerable:!(r=ke(e,o))||r.enumerable});return t};var Se=t=>ve(T({},"__esModule",{value:!0}),t);var ze={};ge(ze,{__krateClass:()=>me,__krateClassError:()=>Ne,__krateCondPost:()=>Fe,__krateCondPre:()=>Ue,__krateOnError:()=>_e,__krateOwn:()=>Pe,__krateOwner:()=>Ie,componentStack:()=>de,createOwner:()=>be,getOwner:()=>I,handleError:()=>O,inCommitPhaseError:()=>V,krateScopeFailed:()=>je,mountClassElement:()=>Le,mountOwner:()=>z,onOwnerCleanup:()=>U,remountChildren:()=>_,runWithOwner:()=>j,setBoundary:()=>N,unmountChildren:()=>Q,unmountOwner:()=>F});var G=window.createEffect;var H=window.createSignal;var Y=window.krateCurrentScope;var Z=window.krateGetOwner;var $=window.krateOnDispose,ee=window.krateOnSettle;var te=window.krateRenderPhase,B=window.krateRequestFlush;var ne=window.krateScopeOfId,re=window.krateSetOwner;var oe=window.setOwnerHooks,h=window.untrack;var se=window.krateForgetOwner;var ie=window.krateOnHookError,ae=window.krateOnLayoutCommit;var x=null,ye=0,m=new Map,S=new Map,b=new Map,P=0,v=[];function ce(t,e,n,r,o,s,c){let a={id:t,name:e,parent:n,creator:r,children:[],order:ye++,state:"dormant",boundary:null,blocked:!1,inError:!1,cond:o,branch:s,setup:c,data:{},scope:Y(),cleanups:[]};return n&&n.children.push(a),a}function I(){return x}function be(t,e=x){let n=ce("",t,e||null,e||null,"","",null);return n.state=e&&e.state!=="mounted"?"dormant":"mounted",n}function j(t,e){if(!t)return e();let n=t;if(n.state!=="mounted")return;let r=x;x=n;try{return h(e)}catch(o){O(o,n);return}finally{x=r}}function U(t,e){let n=t;if(n.state!=="mounted"){Ee(e,n);return}n.cleanups.push(e)}function N(t,e){t.boundary=e}function de(t){let e="";for(let n=t;n;n=n.parent)e+=`
|
|
2
|
+
at `+n.name;return e}function O(t,e=x){if(!e)throw t;let n={componentStack:de(e)};for(let r=e.parent;r;r=r.parent){if(r.state!=="mounted"||!r.boundary)continue;let o=!1;try{o=r.boundary(t,n,e)}catch(s){O(s,r);return}if(o)return}Ce(t,n,e)}function Ce(t,e,n){let r=globalThis;try{let o=String(t?.stack||t?.message||t);Array.isArray(r.__krateErrs)&&r.__krateErrs.push(o)}catch{}typeof console<"u"&&(console.error(t),console.error("The above error occurred in the <"+n.name+"> component:"+e.componentStack+`
|
|
3
|
+
|
|
4
|
+
Add an error boundary (a class component with static getDerivedStateFromError) to recover from it.`)),n.blocked=!0,F(n)}function Ee(t,e){try{t()}catch(n){e&&e.parent?O(n,e):le(n)}}function le(t){typeof console<"u"&&console.error(t)}function F(t){g(t,"dormant")}function je(t){for(let e of m.values())if(e.scope===t&&e.inError)return!0;return!1}function z(t){let e=t;e.state==="dormant"&&(e.blocked=!1,C(e)&&E(e))}function Q(t){for(let e of t.children)g(e,"dormant")}function _(t){if(t.state==="mounted")for(let e of t.children.slice())e.blocked=!1,e.state==="dormant"&&C(e)&&E(e)}function g(t,e){if(t.state==="mounted"){t.state=e;let n=[];for(let r of t.cleanups.splice(0))try{r()}catch(o){n.push(o)}if(t.id)try{se(t.id)}catch(r){n.push(r)}for(let r of t.children)g(r,e);for(let r of n)t.parent?O(r,t):le(r);return}if(e==="disposed"&&t.state!=="disposed"){t.state="disposed";for(let n of t.children)g(n,e)}}function pe(t){if(!t.cond)return!0;let e=S.get(t.cond);return e===void 0||e===t.branch}function C(t){return t.blocked||!pe(t)?!1:!t.parent||t.parent.state==="mounted"}function E(t){if(t.state!=="dormant")return;t.state="mounted",P++;let e=Z();try{t.setup&&j(t,t.setup)}finally{re(e),P--}if(t.state==="mounted")for(let n of t.children.slice())n.state==="dormant"&&C(n)&&E(n);if(P===0&&v.length>0){let n=v.splice(0).sort((r,o)=>r.order-o.order);for(let r of n)r.state==="dormant"&&C(r)&&E(r)}}$(t=>{t===null?Re():De(t)});function Re(){let t=[];for(let e of m.values())e.parent||t.push(e);for(let e of t)g(e,"disposed");m.clear(),S.clear(),b.clear(),v.length=0}function De(t){let e=[];for(let n of m.values())t(n.scope)&&e.push(n);for(let n of e)n.state!=="disposed"&&g(n,"disposed");for(let n of e){m.delete(n.id);let r=n.parent;if(r&&!t(r.scope)){let o=r.children.indexOf(n);o>=0&&r.children.splice(o,1)}}for(let n of Array.from(S.keys()))t(ne(n))&&(S.delete(n),b.delete(n));for(let n=v.length-1;n>=0;n--)v[n].state==="disposed"&&v.splice(n,1)}function Pe(t,e,n){let r=e||{},o=m.get(t);o&&g(o,"disposed");let s=r.p&&m.get(r.p)||null,c=r.k&&m.get(r.k)||null,a=ce(t,r.n||t,s,c,r.c||"",r.b||"",n);if(m.set(t,a),a.cond){let p=b.get(a.cond);p||(p=[],b.set(a.cond,p)),p.push(a)}s&&s.inError&&pe(a)&&(a.blocked=!0),C(a)&&E(a)}function Ie(t){return m.get(t)||null}function Ue(t,e){let n=S.get(t);if(n===void 0||n===(e?"c":"a"))return;let o=b.get(t);if(o)for(let s of o)s.branch===n&&s.state==="mounted"&&g(s,"dormant")}function Fe(t,e){let n=e?"c":"a",r=S.get(t);if(S.set(t,n),r===n)return;let o=b.get(t);if(o)for(let s of o)s.branch!==n||s.state!=="dormant"||!C(s)||(P>0?v.push(s):E(s))}function _e(t,e){return!x||e&&e.isConnected===!1?!1:(O(t,x),!0)}ie((t,e)=>{let n=e?m.get(e):void 0;if(!n)return!1;if(n.state==="mounted"){L++;try{O(t,n)}finally{L--}}return!0});var L=0;function V(){return L>0}oe({current:()=>x,run:(t,e)=>{j(t,e)},cleanup:(t,e)=>U(t,e),error:(t,e)=>{let n=t;return n.state==="mounted"&&O(e,n),!0}});var ue=window.krateSetRef;var Ae=0,fe=Symbol.for("krate.class.rawProps"),J=class{constructor(e,n,r,o){this.seq=Ae++;this.rawGetters=[];this.queue=[];this.forced=!1;this.parentRender=!1;this.mounted=!1;this.disposed=!1;this.catching=!1;this.detachRef=null;this.errorCommitPending=!1;this.spec=o||{},this.owner=I(),this.raw=e&&typeof e=="object"?e:{},this.getState=n,this.setStateSignal=r;let c=this.raw[fe];if(!c){c=[];for(let i of Object.keys(this.raw)){let u=Object.getOwnPropertyDescriptor(this.raw,i);if(u&&u.get){let k=u.get,q=this.raw;c.push([i,()=>k.call(q)])}}try{Object.defineProperty(this.raw,fe,{value:c,enumerable:!1,configurable:!0})}catch{}}this.rawGetters.push(...c),this.props=this.readProps(),this.key=this.readKey(),this.state=h(n)||{},this.context=this.readContext();let[a,p]=H(this.props);this.setRendered=p,this.gateProps(a);let d=this,f={get props(){return d.props},get state(){return d.state},set state(i){d.state=i},get context(){return d.context},setState(i,u){d.enqueue({partial:i,callback:u})},forceUpdate(i){d.forced=!0,d.enqueue({partial:null,callback:i})}};if(this.inst=f,this.owner&&(this.owner.data.classController=this,U(this.owner,()=>this.unmount()),(this.spec.getDerivedStateFromError||this.spec.componentDidCatch)&&N(this.owner,(i,u)=>this.catchError(i,u))),this.spec.setContext&&this.spec.setContext(this.context),this.rawGetters.length>0||this.spec.context){let i=!0;G(()=>{for(let[,u]of this.rawGetters)u();if(this.trackContext(),i){i=!1;return}this.disposed||(y.add(this),we())})}R(this,()=>{let i=this.spec.expose?h(this.spec.expose):null;if(i)for(let k of Object.keys(i))k in this.inst||(this.inst[k]=i[k]);this.mounted=!0,this.spec.componentDidMount&&this.spec.componentDidMount.call(this.inst);let u=h(()=>this.raw.ref);u&&(this.detachRef=ue(u,this.inst))});let w=this.spec.buildError;if(w&&this.spec.componentDidCatch){let i=new Error(w.message||"Error");w.name&&(i.name=w.name),this.owner&&(this.owner.inError=!0),R(this,()=>{this.spec.componentDidCatch.call(this.inst,i,{componentStack:`
|
|
5
|
+
at `+(this.spec.name||"Component")+" (build)"})})}else w&&this.owner&&(this.owner.inError=!0)}readProps(){let e={};h(()=>{for(let r of Object.keys(this.raw)){if(r.startsWith("__krate")||r==="ref"||r==="key")continue;let o=this.rawGetters.find(s=>s[0]===r);e[r]=o?o[1]():this.raw[r]}});let n=this.spec.defaultProps;if(n)for(let r of Object.keys(n))e[r]===void 0&&(e[r]=n[r]);return e}readContext(){return h(()=>this.trackContext())}trackContext(){let e=this.spec.context;if(!e)return;let n=e();if(typeof n=="function"){for(let r of Object.keys(this.raw))if(r.startsWith("__krate_ctx_")&&this.raw[r]===n)return n()}return n}gateProps(e){let n=new Set;for(let[o]of this.rawGetters)n.add(o);let r=this.spec.defaultProps;if(r)for(let o of Object.keys(r))this.raw[o]===void 0&&n.add(o);for(let o of n)if(!(o.startsWith("__krate")||o==="ref"||o==="key"))try{Object.defineProperty(this.raw,o,{get:()=>e()[o],enumerable:!0,configurable:!0})}catch{}}enqueue(e){this.disposed||(this.queue.push(e),y.add(this),we())}markParentRender(){this.disposed||!this.mounted||(this.parentRender=!0,y.add(this))}performUpdate(){if(!(this.disposed||this.owner&&this.owner.state!=="mounted"))if(this.owner)j(this.owner,()=>this.update());else try{this.update()}catch(e){console.error(e)}}readKey(){let e=this.rawGetters.find(n=>n[0]==="__krate_key");return h(()=>e?e[1]():this.raw.__krate_key)}update(){let e=this.spec,n=this.inst;if(!Object.is(this.readKey(),this.key)&&this.owner){let l=this.owner;F(l),l.inError=!1,z(l),_(l);return}let r=this.readProps(),o=this.readContext(),s=!K(r,this.props)||o!==this.context,c=this.queue;this.queue=[];let a=this.forced;this.forced=!1;let p=this.parentRender;if(this.parentRender=!1,c.length===0&&!a&&!s&&!p)return;let d=!e.getDerivedStateFromProps&&!e.getSnapshotBeforeUpdate;d&&(s||p)&&e.componentWillReceiveProps&&(e.componentWillReceiveProps.call(n,r,o),c.push(...this.queue),this.queue=[]);let f=this.props,w=this.state,i=w,u=[];for(let l of c){let M=typeof l.partial=="function"?l.partial.call(n,i,r):l.partial;M!=null&&typeof M=="object"&&(i={...i,...M}),typeof l.callback=="function"&&u.push(l.callback)}if(e.getDerivedStateFromProps){let l=e.getDerivedStateFromProps(r,i);l!=null&&(i={...i,...l})}let k=!0;if(a||(e.shouldComponentUpdate?k=!!e.shouldComponentUpdate.call(n,r,i,o):e.pure&&(k=!K(f,r)||!K(w,i))),k&&d&&e.componentWillUpdate&&e.componentWillUpdate.call(n,r,i,o),this.props=r,this.state=i,this.context=o,!k){for(let l of u)R(this,()=>l.call(n));return}let q=e.getSnapshotBeforeUpdate?e.getSnapshotBeforeUpdate.call(n,f,w):void 0;this.setRendered(r),e.setContext&&e.setContext(o),this.setStateSignal(a&&i===w?{...i}:i),a&&i===w&&(this.state=h(this.getState)),this.owner&&this.owner.inError&&!this.errorCommitPending&&this.owner&&(this.owner.inError=!1,D.add(this.owner)),R(this,()=>{e.componentDidUpdate&&e.componentDidUpdate.call(n,f,w,q)});for(let l of u)R(this,()=>l.call(n));this.cascade()}cascade(){let e=this.owner;if(!e)return;let n=o=>{for(let s=o?o.creator:null;s;s=s.creator){if(s===e)return!0;if(s.data.classController)return!1}return!1},r=o=>{for(let s of o.children){if(s.state!=="mounted")continue;let c=s.data.classController;c&&n(s)&&c.markParentRender(),r(s)}};r(e)}catchError(e,n){let r=this.spec,o=this.owner;if(this.disposed||!o||o.state!=="mounted")return!1;if(this.catching)return!0;if(o.inError)return!1;this.catching=!0;try{typeof console<"u"&&(console.error(e),console.error("The above error occurred in the <"+(n.componentStack.match(/at (\S+)/)?.[1]||"Unknown")+"> component:"+n.componentStack+`
|
|
6
|
+
|
|
7
|
+
React will try to recreate this component tree from scratch using the error boundary you provided, `+(r.name||"Component")+".")),o.inError=!0;let s=o.children.filter(f=>f.state==="mounted");Q(o);for(let f of s)f.blocked=!0;let c=this.state;if(r.getDerivedStateFromError){this.mounted&&!X&&!V()&&r.getDerivedStateFromError(e);let f=r.getDerivedStateFromError(e);f!=null&&(c={...c,...f})}else typeof console<"u"&&console.error((r.name||"Component")+": Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.");let a=this.props,p=this.state,d=this.mounted;this.state=c,this.errorCommitPending=!0,this.setStateSignal(c),R(this,()=>{this.errorCommitPending=!1,d&&c!==p&&r.componentDidUpdate&&r.componentDidUpdate.call(this.inst,a,p,void 0),r.componentDidCatch&&r.componentDidCatch.call(this.inst,e,n)})}finally{this.catching=!1}return!0}unmount(){if(this.disposed)return;this.disposed=!0,y.delete(this);let e=this.detachRef;this.detachRef=null,e&&e(),this.mounted&&this.spec.componentWillUnmount&&this.spec.componentWillUnmount.call(this.inst),this.mounted=!1}runLifecycle(e){if(!this.disposed)if(this.owner)j(this.owner,e);else try{e()}catch(n){console.error(n)}}};function K(t,e){if(t===e)return!0;if(!t||!e)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}var y=new Set,D=new Set,A=[],We=0,W=!1;function we(){B()}function R(t,e){A.push({c:t,fn:e,n:We++}),W||(W=!0,B())}function qe(t,e){return t.owner&&e.owner?t.owner.order-e.owner.order:t.seq-e.seq}function he(t,e){for(let n=e.parent;n;n=n.parent)if(n===t)return!0;return!1}function Me(t,e){let n=t.c.owner,r=e.c.owner;return n&&r&&n!==r?he(n,r)?1:he(r,n)?-1:n.order-r.order:n===r?t.n-e.n:t.c.seq-e.c.seq||t.n-e.n}function Te(){for(let t=0;y.size>0&&t<1e3;t++){let e=Array.from(y).sort(qe);y.clear(),te(()=>{for(let n of e)n.performUpdate()})}}var X=!1;function Ge(){W=!1,X=!0;try{He()}finally{X=!1}}function He(){if(D.size>0){let t=Array.from(D).sort((e,n)=>e.order-n.order);D.clear();for(let e of t)_(e)}if(A.length>0){let t=A.splice(0).sort(Me);for(let e of t)e.c.runLifecycle(e.fn)}}ee(Te);ae(()=>{(W||A.length>0||D.size>0)&&Ge()});function me(t,e,n,r){return new J(t,e,n,r).inst}var Be=["shouldComponentUpdate","getSnapshotBeforeUpdate","componentDidMount","componentDidUpdate","componentWillUnmount","componentDidCatch","componentWillReceiveProps","componentWillUpdate"];function Le(t,e,n){let r=new t(e),[o,s]=H(r.state||{}),c={name:t.displayName||t.name,pure:!!t.prototype.isPureReactComponent,defaultProps:t.defaultProps||null,getDerivedStateFromProps:t.getDerivedStateFromProps,getDerivedStateFromError:t.getDerivedStateFromError};for(let d of Be){let f=r[d]??r["UNSAFE_"+d];typeof f=="function"&&(c[d]=(...w)=>f.apply(r,w))}let a=me(e,o,s,c);Object.defineProperty(r,"props",{get:()=>a.props,configurable:!0}),Object.defineProperty(r,"state",{get:()=>a.state,set:d=>{a.state=d},configurable:!0}),r.setState=a.setState,r.forceUpdate=a.forceUpdate;let p=document.createElement("div");return p.style.display="contents",G(()=>{o();let d=h(()=>n(r.render()));p.replaceChildren(d)}),p}function Ne(t){O(t,I())}return Se(ze);})();
|
|
8
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var b=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var N=(t,n)=>{for(var e in n)b(t,e,{get:n[e],enumerable:!0})},R=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of S(n))!v.call(t,o)&&o!==e&&b(t,o,{get:()=>n[o],enumerable:!(r=W(n,o))||r.enumerable});return t};var C=t=>R(b({},"__esModule",{value:!0}),t);var B={};N(B,{Slot:()=>H,cloneElement:()=>P,clsx:()=>h,cn:()=>L,cva:()=>M,twMerge:()=>w});function p(t,n){if(!(t==null||t===!1||t===!0||t==="")){if(typeof t=="string"){n.push(t);return}if(typeof t=="number"){t&&n.push(String(t));return}if(Array.isArray(t)){for(let e of t)p(e,n);return}if(typeof t=="object")for(let e of Object.keys(t))t[e]&&n.push(e)}}function h(...t){let n=[];for(let e of t)p(e,n);return n.join(" ")}function w(...t){let n=[];for(let o of t)p(o,n);let e=n.flatMap(o=>o.split(/\s+/)).filter(Boolean),r=new Map;for(let o of e){let{scope:s,group:i}=T(o);if(i===null){r.delete("\0"+o),r.set("\0"+o,o);continue}let d=s+i;r.delete(d);for(let l of j[i]??[])r.delete(s+l);r.set(d,o)}return Array.from(r.values()).join(" ")}var j={p:["px","py","pt","pr","pb","pl","ps","pe"],px:["pr","pl","ps","pe"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml","ms","me"],mx:["mr","ml","ms","me"],my:["mt","mb"],inset:["inset-x","inset-y","top","right","bottom","left","start","end"],"inset-x":["right","left","start","end"],"inset-y":["top","bottom"],gap:["gap-x","gap-y"],size:["w","h"],overflow:["overflow-x","overflow-y"],scale:["scale-x","scale-y"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-s","rounded-e","rounded-tl","rounded-tr","rounded-br","rounded-bl","rounded-ss","rounded-se","rounded-ee","rounded-es"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"border-w":["border-w-x","border-w-y","border-w-t","border-w-r","border-w-b","border-w-l","border-w-s","border-w-e"],"border-w-x":["border-w-r","border-w-l","border-w-s","border-w-e"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-t","border-color-r","border-color-b","border-color-l","border-color-s","border-color-e"],"border-color-x":["border-color-r","border-color-l","border-color-s","border-color-e"],"border-color-y":["border-color-t","border-color-b"],"font-size":["leading"]};function g(t,n){let e=[],r=0,o=0;for(let s=0;s<t.length;s++){let i=t[s];i==="["||i==="("?r++:i==="]"||i===")"?r=Math.max(0,r-1):i===n&&r===0&&(e.push(t.slice(o,s)),o=s+1)}return e.push(t.slice(o)),e}var A=/^(length|size|percentage|number|position|image|url|family|weight|line-width|bg-size)$/;function a(t){let n;if(t.startsWith("[")&&t.endsWith("]"))n=t.slice(1,-1);else if(t.startsWith("(")&&t.endsWith(")"))n=t.slice(1,-1);else return null;let e=/^([a-z-]+):(.*)$/.exec(n);if(e&&!e[2].startsWith(":")){let o=e[1];if(o==="color")return"color";if(o==="number"||o==="weight")return"number";if(A.test(o))return o==="family"||o==="image"||o==="url"?"other":"length"}if(t.startsWith("("))return"unknown";let r=n.replace(/_/g," ");return/^(#|rgb|hsl|hwb|lab|lch|oklab|oklch|color\()/i.test(r)?"color":/^(calc|min|max|clamp)\(/.test(r)||/^[+-]?(\d+\.?\d*|\.\d+)(%|[a-z]+)$/i.test(r)?"length":/^[+-]?(\d+\.?\d*|\.\d+)$/.test(r)?"number":"unknown"}var f=t=>/^[+-]?(\d+\.?\d*|\.\d+)$/.test(t)||/^\d+\/\d+$/.test(t),z=new Set(["p","px","py","pt","pr","pb","pl","ps","pe","m","mx","my","mt","mr","mb","ml","ms","me","gap","gap-x","gap-y","space-x","space-y","inset","inset-x","inset-y","top","right","bottom","left","start","end","z","order","opacity","duration","delay","ease","animate","basis","grow","shrink","w","h","size","min-w","max-w","min-h","max-h","grid-cols","grid-rows","col-span","col-start","col-end","row-span","row-start","row-end","leading","tracking","line-clamp","columns","aspect","blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-hue-rotate","backdrop-invert","backdrop-opacity","backdrop-saturate","backdrop-sepia","scale","scale-x","scale-y","rotate","translate-x","translate-y","skew-x","skew-y","origin","cursor","select","underline-offset","indent","perspective","will-change","overflow","overflow-x","overflow-y","overscroll","pointer-events","resize","whitespace","rounded","rounded-t","rounded-r","rounded-b","rounded-l","rounded-s","rounded-e","rounded-tl","rounded-tr","rounded-br","rounded-bl","rounded-ss","rounded-se","rounded-ee","rounded-es","transition"]),V=new Set(["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"]),E=/^(xs|sm|base|lg|xl|\d+xl)$/,y=new Set(["solid","dashed","dotted","double","hidden","none"]),O=new Set(["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]),c={};for(let t of["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"])c[t]="display";for(let t of["static","fixed","absolute","relative","sticky"])c[t]="position";for(let t of["visible","invisible","collapse"])c[t]="visibility";for(let t of["italic","not-italic"])c[t]="font-style";for(let t of["uppercase","lowercase","capitalize","normal-case"])c[t]="text-transform";for(let t of["underline","overline","line-through","no-underline"])c[t]="text-decoration";for(let t of["flex-row","flex-row-reverse","flex-col","flex-col-reverse"])c[t]="flex-direction";for(let t of["flex-wrap","flex-nowrap","flex-wrap-reverse"])c[t]="flex-wrap";c.truncate="truncate";function T(t){let n=g(t,":"),e=n.pop(),r=n.sort(),o="";e.startsWith("!")&&(o="!",e=e.slice(1)),e.endsWith("!")&&(o="!",e=e.slice(0,-1));let s=r.join(":")+":"+o;if(e.startsWith("-")&&(e=e.slice(1)),e.startsWith("[")){let l=/^\[([a-z-]+):/.exec(e);return{scope:s,group:l?"arb:"+l[1]:null}}let i=g(e,"/");i.length>1&&(e=i.slice(0,-1).join("/"));let d=I(e);return{scope:s,group:d}}function $(t,n){let e=g(t,"-");for(let r=Math.min(e.length,3);r>=1;r--){let o=e.slice(0,r).join("-");if(n.has(o))return[o,e.slice(r).join("-")]}return null}function I(t){if(c[t])return c[t];let n=g(t,"-"),e=n[0],r=n.slice(1).join("-");switch(e){case"text":return r===""?null:E.test(r)?"font-size":["left","center","right","justify","start","end"].includes(r)?"text-align":["wrap","nowrap","balance","pretty"].includes(r)?"text-wrap":["ellipsis","clip"].includes(r)?"text-overflow":a(r)==="length"?"font-size":"text-color";case"font":{let s=a(r);return V.has(r)||s==="number"?"font-weight":r.startsWith("stretch")?"font-stretch":"font-family"}case"bg":return r===""?null:["auto","cover","contain"].includes(r)?"bg-size":O.has(r)?"bg-position":/^(repeat|no-repeat)/.test(r)?"bg-repeat":["fixed","local","scroll"].includes(r)?"bg-attachment":r.startsWith("clip-")?"bg-clip":r.startsWith("origin-")?"bg-origin":r.startsWith("blend-")?"bg-blend":r==="none"||/^(gradient-to|linear|radial|conic)/.test(r)?"bg-image":a(r)==="length"?"bg-size":r.startsWith("[")&&/^\[(position|percentage):/.test(r)?"bg-position":r.startsWith("[")&&(/^\[(image|url):/.test(r)||r.startsWith("[url("))?"bg-image":"bg-color";case"border":return m(r,"border");case"divide":return r==="x"||r==="y"||r.startsWith("x-")||r.startsWith("y-")?"divide-"+r[0]:r==="reverse"||r.endsWith("-reverse")?"divide-reverse":y.has(r)?"divide-style":"divide-color";case"outline":return r.startsWith("offset")?"outline-offset":m(r,"outline");case"ring":{if(r.startsWith("offset-")){let i=r.slice(7),d=a(i);return f(i)||d==="length"||d==="number"?"ring-offset-w":"ring-offset-color"}if(r==="inset")return"ring-inset";if(r==="")return"ring-w";let s=a(r);return f(r)||s==="length"||s==="number"?"ring-w":"ring-color"}case"shadow":{if(r==="")return"shadow";let s=a(r);return s==="color"?"shadow-color":s==="length"||s==="number"||s==="other"||s==="unknown"&&r.startsWith("[")||/^(2xs|xs|sm|md|lg|xl|2xl|none|inner)$/.test(r)?"shadow":"shadow-color"}case"stroke":{let s=a(r);return f(r)||s==="length"||s==="number"?"stroke-w":"stroke-color"}case"fill":return"fill";case"decoration":{if(["solid","double","dotted","dashed","wavy"].includes(r))return"decoration-style";let s=a(r);return f(r)||s==="length"||s==="number"||r==="from-font"||r==="auto"?"decoration-thickness":"decoration-color"}case"object":return["contain","cover","fill","none","scale-down"].includes(r)?"object-fit":"object-position";case"list":return r==="inside"||r==="outside"?"list-position":r.startsWith("image")?"list-image":"list-style-type";case"flex":return r===""?null:"flex";case"grid":if(r.startsWith("flow"))return"grid-flow";break;case"shrink":case"grow":return e;case"transition":return"transition";case"inset":break}let o=$(t,z);return o?o[0]:null}function m(t,n){let e="",r=t,o=/^(x|y|t|r|b|l|s|e)(?:-(.*))?$/.exec(t);if(n==="border"&&o&&(e="-"+o[1],r=o[2]??""),n==="border"&&(t==="collapse"||t==="separate"))return"border-collapse";if(n==="border"&&t.startsWith("spacing"))return"border-spacing";if(r==="")return n==="border"?"border-w"+e:n+"-w";if(y.has(r))return n==="border"?"border-style":n==="outline"&&r!=="hidden"?"outline-style":n+"-style";let s=a(r);return f(r)||s==="length"||s==="number"?n==="border"?"border-w"+e:n+"-w":n==="border"?"border-color"+e:n+"-color"}function L(...t){return w(h(...t))}function M(t,n){let e=n?.variants??{},r=n?.defaultVariants??{};return o=>{let s={};for(let l of Object.keys(e)){let u=o?.[l]??r[l];u!=null&&(s[l]=String(u))}let i=[t];for(let l of Object.keys(e)){let u=s[l];u&&e[l][u]&&i.push(e[l][u])}for(let l of n?.compoundVariants??[])if(_(l,s,r)){let u=l.class;typeof u=="string"&&i.push(u)}let d=o?.class??o?.className;return typeof d=="string"&&i.push(d),w(h(i))}}function _(t,n,e){for(let r of Object.keys(t)){if(r==="class")continue;let o=t[r],s=n[r]??e[r]??void 0;if(Array.isArray(o)){if(!o.includes(s))return!1}else if(o!==s)return!1}return!0}function H(t){let n=x(t?.children);return n?(k(n,t),n):null}function x(t){if(t==null)return null;if(Array.isArray(t)){for(let n of t){let e=x(n);if(e)return e}return null}return t instanceof Node?t:null}function k(t,n){if(t instanceof Element)for(let e of Object.keys(n)){if(e==="children"||e==="ref")continue;let r=n[e];if(!(r==null||r===!1)){if(e==="class"||e==="className"){let o=t.getAttribute("class"),s=o?o+" "+String(r):String(r);t.setAttribute("class",s);continue}if(e==="style"&&typeof r=="object"){for(let[o,s]of Object.entries(r))t.style.setProperty(K(o),String(s));continue}if(e.startsWith("on")&&typeof r=="function"){t[e]=r;continue}if(r===!0){t.setAttribute(e,"");continue}t.setAttribute(e,String(r))}}}function K(t){return t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function P(t,n,...e){if(!(t instanceof Node))return t;if(n&&k(t,n),e.length>0&&t instanceof Element){t.textContent="";for(let r of e)r instanceof Node?t.appendChild(r):r!=null&&t.appendChild(document.createTextNode(String(r)))}return t}return C(B);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var h=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var i in e)h(t,i,{get:e[i],enumerable:!0})},O=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of H(e))!L.call(t,r)&&r!==i&&h(t,r,{get:()=>e[r],enumerable:!(n=y(e,r))||n.enumerable});return t};var R=t=>O(h({},"__esModule",{value:!0}),t);var K={};A(K,{krateHighlight:()=>P,krateHighlightInit:()=>x});var b=new Map;function k(t){let e=b.get(t);if(e===void 0){let i=typeof window<"u"&&window.__KRATE_HL?window.__KRATE_HL[t]:void 0,n=window.__KRATE_HL_LOAD||(r=>import(r));e=i?n(i).then(r=>r,()=>null):Promise.resolve(null),b.set(t,e)}return e}function P(t,e,i){return k(e).then(n=>n?n.highlight(n.trimSpace(t),e,i):null)}var N=new WeakSet;function M(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType===8&&e.data.startsWith("k:")){let i="/"+e.data;for(let n=e.nextSibling;n;n=n.nextSibling)if(n.nodeType===8&&n.data===i)return[e,n]}return null}function w(t){if(N.has(t))return;N.add(t);let e=t.getAttribute("data-krate-hl")||"";if(!e)return;let i=null,n,r=0,c=!1,f=()=>{let o=M(t);return o?{start:o[0],end:o[1]}:{start:null,end:null}},a=o=>o.start?o.start.nextSibling:t.firstChild,S=o=>{let l="";for(let s=a(o);s&&s!==o.end;s=s.nextSibling)l+=s.textContent||"";return l},m=f(),p=a(m);p&&p.nodeType===1&&(i=S(m));let v=o=>{let l=f(),s=document.createElement("template");s.innerHTML=o,c=!0;for(let d=a(l);d&&d!==l.end;){let u=d.nextSibling;d.parentNode&&d.parentNode.removeChild(d),d=u}(l.end&&l.end.parentNode?l.end.parentNode:t).insertBefore(s.content,l.end),c=!1,g.takeRecords()},E=(o,l)=>{let s=++r;n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,k(e).then(d=>{if(!d||s!==r||!t.isConnected)return;let u=d.highlight(d.trimSpace(o),e);u!==null&&s===r&&v(u)})},l)},C=()=>{if(c)return;if(!t.isConnected){g.disconnect();return}let o=f(),l=a(o);if(!l||l.nodeType!==3)return;for(let u=l.nextSibling;u&&u!==o.end;){let T=u.nextSibling;u.parentNode&&u.parentNode.removeChild(u),u=T}let s=l.textContent||"";if(s===i)return;let d=i===null;i=s,E(s,d?0:120)},g=new MutationObserver(C);g.observe(t,{childList:!0,characterData:!0,subtree:!0}),C()}var _=!1;function D(){_||typeof MutationObserver>"u"||(_=!0,new MutationObserver(t=>{for(let e of t)for(let i=0;i<e.addedNodes.length;i++){let n=e.addedNodes[i];if(n.nodeType!==1)continue;let r=n;r.matches("code[data-krate-hl]")?w(r):r.querySelector("code[data-krate-hl]")&&x(r)}}).observe(document.documentElement,{childList:!0,subtree:!0}))}function x(t){let i=(t||document).querySelectorAll("code[data-krate-hl]");for(let n=0;n<i.length;n++)w(i[n]);t||D()}return R(K);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var C=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var Q=(e,t)=>{for(var r in t)C(e,r,{get:t[r],enumerable:!0})},X=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of z(t))!J.call(e,i)&&i!==r&&C(e,i,{get:()=>t[i],enumerable:!(o=$(t,i))||o.enumerable});return e};var Y=e=>X(C({},"__esModule",{value:!0}),e);var le={};Q(le,{krateBindList:()=>de,krateList:()=>we,longestIncreasingSubsequence:()=>j});var N=window.createEffect;var A=window.createRoot,R=window.createSignal;var E=window.onCleanup;var D=window.untrack;var L=window.krateUnmount,V=window.krateWithOwner;var _=window.adoptValue,M=window.appendChild;var m=window.disposeNode;var T=window.insertAt;var K=window.removeRest,v=window.trackEffect,S=window.withDOM,H=window.withVNodes;var B=window.krateWithIdScope;function Z(e,t,r){if(!e)return String(r);let o=e(t,r);return o==null?String(r):"$"+String(o)}function ee(e){try{return decodeURIComponent(e)}catch{return e}}function te(e){let t=e.map(r=>r.charAt(0)==="$"?r.slice(1):r);console.error("Encountered two children with the same key, `"+t.join("`, `")+"`. Keys should be unique so that components maintain their identity across updates. Krate keeps the first occurrence on its existing row and renders each duplicate as its own row.")}function ne(){return[document.createComment(""),document.createComment("")]}function P(e,t,r,o,i){A(a=>{v(t.start,a);let s=(e.start.nodeValue||"").slice(2),{value:c,owner:l}=V(()=>B(s?s+":"+t.key:"",()=>{if(!e.accessor)return e.render(r,o);let[u,k]=R(r),[f,w]=R(o);return t.setItem=k,t.setIndex=w,e.render(u,f)}));E(()=>L(l)),i(c)})}function G(e,t,r,o){let[i,a]=ne(),s={key:t,item:r,index:o,start:i,end:a,setItem:null,setIndex:null,live:!0},c=document.createDocumentFragment();return c.appendChild(i),S(()=>P(e,s,r,o,l=>M(c,l))),c.appendChild(a),c.__row=s,c}function oe(e,t,r,o){t.item=r,t.index=o,t.live=!0;let i=t.start.parentNode;try{H(()=>P(e,t,r,o,a=>{let s={parent:i,next:t.start.nextSibling};S(()=>_(a,s)),K(s,t.end)}))}catch(a){console.error(a),U(t.start,t.end,!1),m(t.start);let s=G(e,t.key,r,o),c=s.__row;i.insertBefore(s,t.start),i.removeChild(t.start),i.removeChild(t.end),Object.assign(t,c)}}function U(e,t,r){let o=e.parentNode;if(!o)return;let i=e.nextSibling;for(;i&&i!==t;){let a=i.nextSibling;m(i),o.removeChild(i),i=a}r&&(m(e),o.removeChild(e),t.parentNode===o&&o.removeChild(t))}function W(e){U(e.start,e.end,!0)}function re(e,t){let r=t.parentNode;if(e.end.nextSibling===t)return;let o=e.start;for(;o;){let i=o===e.end?null:o.nextSibling;r.insertBefore(o,t),o=i}}function j(e){let t=e.length,r=new Int32Array(t),o=[];for(let s=0;s<t;s++){let c=e[s];if(c<0)continue;let l=0,u=o.length;for(;l<u;){let k=l+u>>1;e[o[k]]<c?l=k+1:u=k}r[s]=l>0?o[l-1]:-1,o[l]=s}let i=new Array(o.length),a=o.length?o[o.length-1]:-1;for(let s=o.length-1;s>=0;s--)i[s]=a,a=r[a];return i}function se(e){return e==null?[]:Array.isArray(e)?e:typeof e[Symbol.iterator]=="function"?Array.from(e):[]}function ie(e){if(typeof document>"u")return null;let t=document.activeElement;if(!t||t===document.body||!e||!e.contains(t))return null;let r=null;try{let o=t;typeof o.selectionStart=="number"&&(r=[o.selectionStart,o.selectionEnd,o.selectionDirection])}catch{r=null}return()=>{if(!(document.activeElement===t||!t.isConnected)&&(t.focus({preventScroll:!0}),r))try{t.setSelectionRange(r[0],r[1],r[2]||void 0)}catch{}}}function ae(e,t){let{end:r,keyFn:o}=e,i=r.parentNode,a=e.rows,s=t.length,c=new Array(s),l=new Map,u=null;for(let n=0;n<s;n++){let d=Z(o,t[n],n),p=l.get(d);p!==void 0?((u||(u=[])).push(d),l.set(d,p+1),d=d+"\0"+p):l.set(d,1),c[n]=d}u&&te(u);let k=new Map;for(let n=0;n<a.length;n++)k.set(a[n].key,n);for(let n=0;n<s&&n<a.length;n++){let d=a[n];!d.live&&!l.has(d.key)&&!k.has(c[n])&&(k.delete(d.key),d.key=c[n],k.set(d.key,n))}let f=ie(i),w=new Array(s),h=new Int32Array(s).fill(-1),F=new Uint8Array(a.length);for(let n=0;n<s;n++){let d=k.get(c[n]);if(d===void 0)continue;let p=a[d],q=t[n];p.live&&!e.accessor&&(p.item!==q||e.usesIndex&&p.index!==n)||(F[d]=1,h[n]=d,w[n]=p)}for(let n=0;n<a.length;n++)F[n]||W(a[n]);for(let n=0;n<s;n++){let d=w[n];if(!d)continue;let p=t[n];if(!d.live){oe(e,d,p,n);continue}d.item!==p&&(d.item=p,d.setItem&&d.setItem(()=>p)),d.index!==n&&(d.index=n,d.setIndex&&d.setIndex(n))}let g=new Array(s),x=null;for(let n=0;n<s;n++){if(w[n]){x=null;continue}let d=G(e,c[n],t[n],n);w[n]=d.__row,x?(x.appendChild(d),g[n-1]=null):x=d,g[n]=x}let I=new Uint8Array(s);for(let n of j(h))I[n]=1;let y=r;for(let n=s-1;n>=0;n--){let d=w[n],p=g[n];p?i.insertBefore(p,y):h[n]>=0&&!I[n]&&re(d,y),y=d.start}e.rows=w,f&&f()}function ce(e){let{start:t,end:r}=e,o=t.parentNode,i=(t.nodeValue||"").slice(2),a="k:"+i+":",s=[],c=t.nextSibling;for(;c&&c!==r;){let u=c.nodeType===8&&c.nodeValue||"";if(i&&u.indexOf(a)===0){let f="/"+u,w=c.nextSibling;for(;w&&w!==r&&!(w.nodeType===8&&w.nodeValue===f);)w=w.nextSibling;if(w&&w!==r){s.push({key:ee(u.slice(a.length)),item:void 0,index:s.length,start:c,end:w,setItem:null,setIndex:null,live:!1}),c=w.nextSibling;continue}}let k=c.nextSibling;m(c),o.removeChild(c),c=k}let l=new Set;e.rows=s.filter(u=>l.has(u.key)?(W(u),!1):(l.add(u.key),!0))}function b(e,t,r){let o=!0,i=N(()=>{let a=se(t());D(()=>{o&&(o=!1,r&&ce(e)),ae(e,a)})});v(e.start,i)}function O(e,t,r,o,i){return{start:e,end:t,rows:[],keyFn:r,render:o,accessor:i===1,usesIndex:o.length>1}}function de(e,t,r,o,i){let a="/"+(e.nodeValue||""),s=e.nextSibling;for(;s&&!(s.nodeType===8&&s.nodeValue===a);)s=s.nextSibling;s||(s=document.createComment(a),e.parentNode.insertBefore(s,e.nextSibling)),b(O(e,s,r,o,i),t,!0)}function we(e,t,r,o){return{__ka:1,mount(){let i=document.createDocumentFragment(),a=document.createComment(""),s=document.createComment("");return i.appendChild(a),i.appendChild(s),b(O(a,s,t,r,o),e,!1),i},adopt(i){let a=i.next;for(;a&&a.nodeType===8&&(a.nodeValue||"").indexOf("/k:")===0;)a=a.nextSibling;if(a&&a.nodeType===8&&(a.nodeValue||"").indexOf("k:")===0){let s="/"+a.nodeValue,c=a.nextSibling;for(;c&&!(c.nodeType===8&&c.nodeValue===s);)c=c.nextSibling;if(c){i.next=c.nextSibling,S(()=>b(O(a,c,t,r,o),e,!0));return}}T(i,S(()=>this.mount()))}}}return Y(le);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var w=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},U=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of q(t))!B.call(e,r)&&r!==n&&w(e,r,{get:()=>t[r],enumerable:!(o=L(t,r))||o.enumerable});return e};var G=e=>U(w({},"__esModule",{value:!0}),e);var ne={};H(ne,{forbidden:()=>b,krateResetNavigation:()=>K,notFound:()=>y,permanentRedirect:()=>te,redirect:()=>I,unauthorized:()=>C,useParams:()=>z,usePathname:()=>W,useRouter:()=>Q,useSearchParams:()=>j,useSelectedLayoutSegment:()=>ee,useSelectedLayoutSegments:()=>Z});var v=window.createSignal;var c=window.krateDerived;var X=Symbol.for("krate.request.store");function i(){let e=globalThis[X];return e&&typeof e.getStore=="function"?e.getStore():void 0}function y(){let e=new Error("NEXT_NOT_FOUND");throw e.__krateNotFound=!0,e.digest="NEXT_NOT_FOUND",e}function T(e){let t=new Error(e===403?"NEXT_FORBIDDEN":"NEXT_UNAUTHORIZED");throw t.__krateHTTPStatus=e,t.digest="NEXT_HTTP_ERROR_FALLBACK;"+e,t}function b(){return T(403)}function C(){return T(401)}function S(){let e=i();if(!e)return{path:"/",route:"",params:{}};let t=e.url.split("?")[0]||"/",n=e.params||{},o=[];for(let r of t.split("/").filter(Boolean)){let s=/^\[(\[)?(\.\.\.)?([^\]]+)\]?\]$/.exec(r);if(!s){o.push(r);continue}let u=n[s[3]];u!==void 0&&u!==""&&o.push(...u.split("/").filter(Boolean))}return{path:"/"+o.join("/"),route:t,params:n}}function m(e){try{return decodeURIComponent(e)}catch{return e}}function _(){return S().path}function A(){let e=i(),t=new URLSearchParams;for(let[n,o]of Object.entries(e&&e.searchParams||{}))t.append(n,String(o));return t}function E(){let{route:e,params:t}=S(),n={};for(let o of e.split("/").filter(Boolean)){let r=/^\[(\[)?(\.\.\.)?([^\]]+)\]?\]$/.exec(o);if(!r)continue;let s=t[r[3]];s===void 0||s===""||(n[r[3]]=r[2]?s.split("/").filter(Boolean).map(m):m(s))}return n}function d(e){return()=>{throw new Error(`useRouter().${e}() can only be called in the browser; use redirect() while rendering`)}}function N(){return{push:d("push"),replace:d("replace"),back:d("back"),forward:d("forward"),refresh:d("refresh"),prefetch:()=>{}}}function k(e,t){return S().path.split("/").filter(Boolean).map(m).slice(typeof t=="number"?t:0)}function P(e,t){let n=k(e,t);return n.length>0?n[0]:null}var O=window.getNavigationState,F=window.subscribeNavigation,a=window.krateRouter;function M(){let e=globalThis.__KRATE_ROUTE__;if(typeof e=="string")return e;if(typeof document>"u")return"";let t=document.getElementById("__krate_page");if(!t)return"";try{let n=JSON.parse(t.textContent||"{}");return typeof n.r=="string"?n.r:""}catch{return""}}function V(e){return e.length>1&&e.endsWith("/")?e.replace(/\/+$/,"")||"/":e}function D(){if(typeof location>"u")return{pathname:"/",search:"",route:""};let{pathname:e,search:t}=O();return{pathname:V(e),search:t,route:M()}}var g=null;function f(){if(g)return g;let[e,t]=v(D());if(g=e,typeof window<"u"){let n=()=>{let o=D(),r=e();(o.pathname!==r.pathname||o.search!==r.search||o.route!==r.route)&&t(o)};F(n),window.addEventListener("krate:navigate-end",n)}return e}function K(){g=null}function p(e,t){let n=e;return n.toString=t,n.toJSON=()=>e(),e}function W(){if(i())return _();let e=f(),t=c(()=>e().pathname);return p(t,()=>t())}function j(){if(i())return A();let e=f(),t=c(()=>new URLSearchParams(e().search));return p(t,()=>e().search)}function l(e){try{return decodeURIComponent(e)}catch{return e}}function $(e,t){let n={};if(!e)return n;let o=e.split("/").filter(Boolean),r=t.split("/").filter(Boolean);for(let s=0;s<o.length;s++){let u=o[s],h=/^\[(\[)?(\.\.\.)?([^\]]+)\]?\]$/.exec(u);if(!h)continue;let x=h[3];if(h[2]){let R=r.slice(s).map(l);return R.length>0&&(n[x]=R),n}s<r.length&&(n[x]=l(r[s]))}return n}function z(){if(i())return E();let e=f(),t=c(()=>{let n=e();return $(n.route,n.pathname)});return p(t,()=>JSON.stringify(t()))}var Y={push:(e,t)=>{a.push(e,t)},replace:(e,t)=>{a.replace(e,t)},back:()=>a.back(),forward:()=>a.forward(),refresh:()=>{a.refresh()},prefetch:e=>{a.prefetch(e)}};function Q(){return i()?N():Y}function Z(e,t){if(i())return k(e,t);let n=f(),o=typeof t=="number"?t:0,r=c(()=>n().pathname.split("/").filter(Boolean).map(l).slice(o));return p(r,()=>r().join("/"))}function ee(e,t){if(i())return P(e,t);let n=f(),o=typeof t=="number"?t:0,r=c(()=>{let s=n().pathname.split("/").filter(Boolean).map(l);return s.length>o?s[o]:null});return p(r,()=>String(r()))}function I(e){typeof location<"u"&&a.push(e);let t=new Error("Server action redirect to "+e);throw t.__krateRedirect=e,t}function te(e){return I(e)}return G(ne);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var n in e)o(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!f.call(t,i)&&i!==n&&o(t,i,{get:()=>e[i],enumerable:!(s=c(e,i))||s.enumerable});return t};var v=t=>p(o({},"__esModule",{value:!0}),t);var P={};h(P,{destroyRouter:()=>w,getHistoryState:()=>y,getNavigationState:()=>a,initRouter:()=>b,invalidatePrefetchCache:()=>u,krateRouter:()=>x,navigate:()=>r,reinitRouter:()=>m,subscribeNavigation:()=>d});function g(){let t=globalThis.__KRATE_CFG__,e=t&&t.basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function a(){if(typeof location>"u")return{url:"",pathname:"/",search:"",hash:"",status:"idle"};let t=g(),e=location.pathname;return t&&(e===t||e.startsWith(t+"/"))&&(e=e.slice(t.length)||"/"),{url:location.href,pathname:e,search:location.search,hash:location.hash,status:"idle"}}function d(t){if(typeof window>"u")return()=>{};let e=()=>t(a());return window.addEventListener("hashchange",e),()=>{window.removeEventListener("hashchange",e)}}function y(){return typeof history>"u"?null:history.state}function u(t){}function b(){}function m(){}function w(){}function r(t,e={}){return typeof location>"u"||(e.replace?location.replace(t):location.assign(t)),!0}var x={push(t,e={}){return r(t,{...e,replace:!1}),Promise.resolve()},replace(t,e={}){return r(t,{...e,replace:!0}),Promise.resolve()},back(){typeof history<"u"&&history.back()},forward(){typeof history<"u"&&history.forward()},refresh(){return typeof location<"u"&&location.reload(),Promise.resolve()},prefetch(t){return Promise.resolve()},subscribe:d,getState:a,invalidate:u};typeof window<"u"&&window.addEventListener("krate:revalidate",()=>{typeof location<"u"&&location.reload()});return v(P);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __krate_exports=(()=>{var ce=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var ut=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ct(t))!lt.call(e,o)&&o!==n&&ce(e,o,{get:()=>t[o],enumerable:!(r=at(t,o))||r.enumerable});return e};var dt=e=>ft(ce({},"__esModule",{value:!0}),e);var Xt={};ut(Xt,{compareRouteSpecificity:()=>Ve,destroyRouter:()=>Yt,getHistoryState:()=>bt,getNavigationState:()=>He,initRouter:()=>it,invalidatePrefetchCache:()=>ye,krateRouter:()=>Jt,matchRoutePattern:()=>Je,navigate:()=>Vt,pageAssetURLs:()=>Ne,reinitRouter:()=>zt,subscribeNavigation:()=>De});var pe=/\/chunks\/runtime\.[^/]+\.js$/;function te(){return globalThis.__KRATE_CFG__||{}}function me(){let e=te().basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function U(e){let t=me();if(t&&(e===t||e.startsWith(t+"/"))){let n=e.slice(t.length);return n===""?"/":n}return e}function fe(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function K(e){if(te().dev)try{console.warn("[krate router] "+e)}catch{}}function Ce(e,t){if(/^(https?:)?\/\//.test(e)||e.startsWith("/"))return new URL(e,t).href;let n=t;if(!n.endsWith("/")){let r=n.lastIndexOf("/");n=r>0?n.slice(0,r+1):"/"}return new URL(e,n).href}function Ne(e,t,n){let r=new DOMParser().parseFromString(e,"text/html"),o=[],i=new Set,s=c=>{if(!c)return;let a;try{a=Ce(c,t)}catch{return}i.has(a)||n.has(a)||pe.test(a)||(i.add(a),o.push(a))};return r.querySelectorAll("script[src]").forEach(c=>s(c.getAttribute("src"))),r.querySelectorAll('link[rel="modulepreload"][href], link[rel="preload"][as="script"][href]').forEach(c=>s(c.getAttribute("href"))),o}var R=!1,T=0,E,Ae=0,m="",L="",G="idle",F=new Set,S=new Map,O=new Map,ht=30,pt=3e4,A=new Map,mt=50,le=new Set,gt=128,X=new Map,B=new Map,N=null,W=[],yt="_krate/i",vt=150,kt=200;function de(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function M(){return Ae++,Date.now().toString(36)+"-"+Ae.toString(36)}function ne(e){try{let t=new URL(e,location.href);return t.hash="",t.href}catch{return e}}function _(e){let t=new URL(e,location.href);return fe(t.pathname)+t.search}function $(e,t=!1){let n=globalThis.__krateHardNavigate;if(typeof n=="function"){n(e,t);return}t?location.replace(e):location.assign(e)}function j(e,t){return{__krate:e,state:t===void 0?null:t}}function Q(e){if(e&&typeof e=="object"&&typeof e.__krate=="string")return e.__krate}function bt(){if(typeof history>"u")return null;let e=history.state;return Q(e)!==void 0?e.state:e}function Me(){let e=new URL(location.href);return{url:e.href,pathname:U(e.pathname),search:e.search,hash:e.hash,status:G}}function He(){return typeof location>"u"?{url:"",pathname:"/",search:"",hash:"",status:"idle"}:Me()}function re(){if(F.size===0)return;let e=Me();for(let t of Array.from(F))try{t(e)}catch(n){console.error(n)}}function H(e){G!==e&&(G=e,re())}function De(e){return F.add(e),()=>{F.delete(e)}}function k(e,t,n=!1){try{let r=new CustomEvent(e,{detail:t,cancelable:n});return window.dispatchEvent(r),!r.defaultPrevented}catch{return!0}}function ge(e){try{let t=globalThis.__krate_onNavigation;typeof t=="function"&&t(e)}catch{}}function V(e){if(e){if(A.delete(e),A.size>=mt){let t=A.keys().next().value;t!==void 0&&A.delete(t)}A.set(e,window.scrollY||0)}}function Ue(){let e=te().prefetchTTL;return typeof e=="number"&&e>=0?e:pt}function wt(e,t){for(S.delete(e);S.size>=ht;){let n=S.keys().next().value;if(n===void 0)break;S.delete(n)}S.set(e,t)}function Et(e){let t=S.get(e);if(t&&(S.delete(e),!(de()-t.at>Ue())))return t}function ye(e){if(e===void 0){S.clear();return}S.delete(ne(e))}function ve(e){return/text\/html|application\/xhtml\+xml/i.test(e)}function J(e){return/^\s*(<!doctype html|<html|<head|<body)/i.test(e)}function St(e){if(le.has(e)||le.size>=gt)return;le.add(e);let t=document.createElement("link");t.rel="prefetch",t.as="script",t.href=e,document.head.appendChild(t)}function ke(e){let t=ne(e),n=S.get(t);if(n&&de()-n.at<=Ue())return Promise.resolve();let r=O.get(t);if(r)return r;let o=fetch(t,{headers:{Accept:"text/html"},credentials:"same-origin"}).then(async i=>{if(!i.ok)return;let s=i.headers.get("content-type")||"",c=i.url||t;if(new URL(c,location.href).origin!==location.origin)return;let a=await i.text();if(!(ve(s)||s===""&&J(a)))return;wt(t,{html:a,url:c,status:i.status,at:de()});let u=new Set;document.querySelectorAll("script[src]").forEach(l=>u.add(l.src));for(let l of Ne(a,c,u))St(l)}).catch(()=>{}).finally(()=>{O.delete(t)});return O.set(t,o),o}function be(e){if(e.hasAttribute("data-krate-external")||e.hasAttribute("download"))return!1;let t=e.getAttribute("href");if(!t||t.startsWith("javascript:"))return!1;let n;try{n=new URL(t,location.href)}catch{return!1}if(n.origin!==location.origin)return!1;let r=e.getAttribute("target");return!(r&&r!=="_self")}function we(e){let t=e.getAttribute("data-prefetch");return e.hasAttribute("data-prefetch")&&t!=="false"&&t!=="0"}function Lt(e){let t=window.requestIdleCallback;typeof t=="function"?t(e,{timeout:1e3}):setTimeout(e,50)}function Z(e){let t=e.target;if(!t||typeof t.closest!="function")return;let n=t.closest("a[data-prefetch]");if(!n||!we(n)||!be(n))return;let r=n.getAttribute("href");if(!r)return;let o=new URL(r,location.href).href;if(_(o)===L)return;let i=B.get(n);i&&clearTimeout(i);let s=setTimeout(()=>{B.delete(n),ke(o)},kt);B.set(n,s)}function Ie(){N&&document.querySelectorAll("a[data-prefetch]").forEach(e=>{we(e)&&N.observe(e)})}function At(){document.addEventListener("mouseover",Z),document.addEventListener("focusin",Z),typeof IntersectionObserver<"u"&&(N=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let n=t.target,r=n.getAttribute("href");if(r&&be(n)&&we(n)){let o=new URL(r,location.href).href;_(o)!==L&&Lt(()=>{ke(o)})}N.unobserve(t.target)}},{rootMargin:"200px"}),Ie())}function Tt(){let e=typeof HTMLScriptElement<"u"?HTMLScriptElement.supports:void 0;if(!(typeof e!="function"||!e("speculationrules"))&&!document.querySelector('meta[http-equiv="Content-Security-Policy" i]'))try{let t=document.createElement("script");t.type="speculationrules",t.textContent=JSON.stringify({prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/__krate/*"}},{not:{href_matches:"/api/*"}}]},eagerness:"moderate"}]}),document.head.appendChild(t)}catch{}}function Ke(){if(typeof window<"u"&&window.matchMedia)try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{}return!1}function Oe(){return te().viewTransitions===!1||Ke()?!1:typeof document.startViewTransition=="function"}function b(e){return e.getElementById("root")||e.body}function Rt(){let e=document.querySelector("template[data-krate-loading]");if(e&&e.content&&W.length===0){let t=e.content.cloneNode(!0);W=Array.from(t.childNodes),document.body.appendChild(t)}if(!Oe()&&!Ke()){let t=b(document);t.style.transition=`opacity ${vt}ms ease`,t.style.opacity="0"}}function Be(){for(let t of W)t.parentNode&&t.parentNode.removeChild(t);W=[];let e=b(document);e.style.opacity==="0"&&(e.style.opacity="")}function Fe(e){e.querySelectorAll("[data-view-transition]").forEach(t=>{let n=t.getAttribute("data-view-transition");n&&(t.style.viewTransitionName=n);let r=t.getAttribute("data-view-transition-class");r&&t.style.setProperty("view-transition-class",r)})}var _t=3e3;function xt(e,t){let n=[];e.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let l=u.getAttribute("href");if(!l)return;let p=new URL(l,t).href;n.includes(p)||n.push(p)});let r=new Map,o=[];document.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let l=u;l.href&&(n.includes(l.href)&&!r.has(l.href)?r.set(l.href,l):o.push(l))});let i=[],s=[],c=null;n.forEach((u,l)=>{let p=r.get(u)||null;if(!p){let h=document.createElement("link");if(h.rel="stylesheet",h.href=u,s.push(new Promise(g=>{let f=()=>{h.removeEventListener("load",f),h.removeEventListener("error",f),g()};h.addEventListener("load",f),h.addEventListener("error",f)})),i.push({link:h,media:h.getAttribute("media")}),h.media="not all",c)c.after(h);else{let g=n.slice(l+1).map(f=>r.get(f)).find(f=>!!f);g?g.before(h):document.head.appendChild(h)}p=h}c=p});let a=Promise.resolve();if(s.length>0){let u,l=new Promise(p=>{u=setTimeout(p,_t)});a=Promise.race([Promise.all(s).then(()=>{}),l]).then(()=>clearTimeout(u))}return{ready:a,commit(){for(let{link:u,media:l}of i)l===null?u.removeAttribute("media"):u.setAttribute("media",l);o.forEach(u=>u.remove())},abort(){i.forEach(({link:u})=>u.remove())}}}var Te='meta[name="description"], meta[name="robots"], meta[property^="og:"], meta[name^="twitter:"], link[rel="canonical"], script[type="application/ld+json"]';function Pt(e){document.head.querySelectorAll(Te).forEach(t=>t.remove()),e.head.querySelectorAll(Te).forEach(t=>{document.head.appendChild(document.importNode(t,!0))})}function We(e,t){let n=new Set;document.querySelectorAll("script[src]:not([data-krate-spa])").forEach(i=>n.add(i.src));let r=[],o=new Set;return e.querySelectorAll("script[src]").forEach(i=>{let s=i.getAttribute("src");if(!s)return;let c=(i.getAttribute("type")||"").toLowerCase();if(c&&c!=="module"&&c!=="text/javascript"&&c!=="application/javascript")return;let a=Ce(s,t);!n.has(a)&&!o.has(a)&&(o.add(a),r.push({src:a,module:c==="module"}))}),r}function $e(e){return new Promise(t=>{let n=document.createElement("script");n.src=e.src,e.module&&(n.type="module"),pe.test(e.src)||n.setAttribute("data-krate-spa",""),n.onload=()=>t(!0),n.onerror=()=>t(!1),document.body.appendChild(n)})}function Ct(e){if(!e||e==="#")return null;let t=e.slice(1);try{t=decodeURIComponent(t)}catch{}return document.getElementById(t)||document.getElementsByName(t)[0]||null}function Ee(e){let t=Ct(e);if(!t)return!1;try{t.scrollIntoView({block:"start"})}catch{}return!0}function Nt(e,t){if(t.kind==="pop"){let r=t.restoreKey?A.get(t.restoreKey):void 0;if(r!==void 0){window.scrollTo(0,r);return}}let n=new URL(e,location.href).hash;Ee(n)||t.scroll&&t.kind!=="refresh"&&window.scrollTo(0,0)}var Y=null;function Mt(){let e=document.activeElement;if(e&&e!==document.body&&e.isConnected&&e!==Y)return;let t=b(document);t.hasAttribute("tabindex")||(t.setAttribute("tabindex","-1"),Y=t,t.addEventListener("blur",()=>{Y===t&&(t.removeAttribute("tabindex"),Y=null)},{once:!0}));try{t.focus({preventScroll:!0})}catch{}}var Re="__krate-route-announcer";function Ht(){let e=document.getElementById(Re);e||(e=document.createElement("div"),e.id=Re,e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.setAttribute("role","status"),e.setAttribute("style","position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0"),document.body.appendChild(e));let t=b(document).querySelector("h1"),n=document.title||(t&&t.textContent?t.textContent.trim():"")||U(location.pathname);e.textContent=n}function oe(){let e=fe(U(location.pathname));document.querySelectorAll("a[data-krate-link]").forEach(t=>{let n=t.getAttribute("href"),r="";try{r=n?fe(U(new URL(n,location.href).pathname)):""}catch{r=""}let o="";r&&r===e?o="exact":r&&r!=="/"&&e.startsWith(r+"/")&&(o="segment"),o==="exact"?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current"),o?t.setAttribute("data-krate-active",o):t.removeAttribute("data-krate-active")})}function _e(e){let t=me()+e;return X.has(t)?Promise.resolve(X.get(t)??null):fetch(t,{headers:{Accept:"text/html"},credentials:"same-origin"}).then(async n=>{let r=n.ok?await n.text():null,o=r&&J(r)?r:null;return X.set(t,o),o}).catch(()=>null)}async function Dt(e,t){let n=ne(e.url);if(!e.bypassCache){let p=O.get(n);if(p&&await p,t.aborted)return{ok:!1,aborted:!0};let h=Et(n);if(h){let g=new URL(e.url,location.href).hash,f=g&&!new URL(h.url,location.href).hash?h.url+g:h.url;return{ok:!0,doc:{html:h.html,url:f,status:h.status}}}}let r;try{r=await fetch(n,{headers:{Accept:"text/html"},credentials:"same-origin",signal:t,cache:e.bypassCache?"no-cache":"default"})}catch(p){return p?.name==="AbortError"||t.aborted?{ok:!1,aborted:!0}:k("krate:navigate-error",{url:e.url,status:0,error:p},!0)?{ok:!1,hard:e.url}:{ok:!1,aborted:!0}}let o=r.url||n;if(new URL(o,location.href).origin!==location.origin)return{ok:!1,hard:o};let i=r.headers.get("content-type")||"",s="";try{s=await r.text()}catch(p){if(p?.name==="AbortError"||t.aborted)return{ok:!1,aborted:!0};s=""}if(t.aborted)return{ok:!1,aborted:!0};let c=ve(i)||i===""&&J(s),a=new URL(e.url,location.href).hash,u=a&&!new URL(o).hash?o+a:o;if(r.ok)return c?{ok:!0,doc:{html:s,url:u,status:r.status}}:{ok:!1,hard:u};if(k("krate:navigate-error",{url:e.url,status:r.status}),c&&J(s))return{ok:!0,doc:{html:s,url:u,status:r.status}};let l=null;return r.status===404||r.status===410?l=await _e("/404.html"):r.status>=500&&(l=await _e("/500.html")),t.aborted?{ok:!1,aborted:!0}:l?{ok:!0,doc:{html:l,url:u,status:r.status}}:{ok:!1,hard:u}}async function ie(e){let t=location.href;if(e.kind!=="pop"){if(!k("krate:navigate-start",{url:e.url,from:t,kind:e.kind},!0))return}else k("krate:navigate-start",{url:e.url,from:t,kind:e.kind});let n=++T;E&&E.abort();let r=new AbortController;E=r,H("loading"),!e.bypassCache&&S.has(ne(e.url))||Rt();let i;try{i=await Dt(e,r.signal)}finally{E===r&&(E=void 0)}if(n===T){if(!i.ok){Be(),H("idle"),"hard"in i&&$(i.hard,e.kind==="replace"||e.kind==="refresh");return}await Ut(i.doc,e,n)}}async function Ut(e,t,n){let r=new DOMParser().parseFromString(e.html,"text/html"),o=e.url,i=b(r),s=b(document);t.kind==="push"&&V(m);let c=je(r),a=Bt(P,c,location.href,o,r),u=xt(r,o);if(await u.ready,n!==T){u.abort();return}if(await It(()=>{let g=r.querySelector("title");g&&(document.title=g.textContent||"");let f=globalThis;if(a.keep.length>0&&typeof f.krateDisposeExcept=="function"?f.krateDisposeExcept(a.keep):typeof f.disposeAll=="function"&&f.disposeAll(),a.region){let{live:v,next:d}=a.region;q(v[0],v[1]);let w=D(d[0],d[1]).map(y=>document.importNode(y,!0));for(let y of w)v[1].parentNode.insertBefore(y,v[1]);for(let y of a.slots){q(y.live[0],y.live[1]);for(let I of D(y.next[0],y.next[1]))y.live[1].parentNode.insertBefore(document.importNode(I,!0),y.live[1])}Kt(s,i)}else{let v=Array.from(i.childNodes).map(d=>document.importNode(d,!0));s.replaceChildren(...v)}P=a.chain,z.clear(),u.commit(),Pt(r),Fe(document)}),n!==T)return;Be(),t.kind==="push"?(m=M(),history.pushState(j(m,t.state),"",o)):t.kind==="replace"?(A.delete(m),m=M(),history.replaceState(j(m,t.state),"",o)):t.kind==="refresh"?o!==location.href&&history.replaceState(history.state,"",o):t.restoreKey&&(m=t.restoreKey),L=_(location.href),C=L,Ye(r),Ft(r),Nt(o,t),t.kind!=="pop"&&t.kind!=="refresh"&&Mt(),t.kind!=="refresh"&&Ht(),oe(),k("krate:navigate",{url:location.href,status:e.status}),ge(location.href),H("idle"),document.querySelectorAll("script[data-krate-spa]").forEach(g=>g.remove());let p=We(r,o);Pe(a.skip);let h=await Promise.all(p.map($e));if(Pe([]),n===T){if(h.some(g=>!g)){k("krate:navigate-error",{url:location.href,status:e.status,error:"script-load"}),$(location.href,!0);return}ee(),k("krate:navigate-end",{url:location.href,status:e.status})}}function It(e){if(!Oe())return e(),Promise.resolve();let t=!1,n=()=>{t||(t=!0,e())};try{let r=document.startViewTransition(n);r&&r.finished&&typeof r.finished.catch=="function"&&r.finished.catch(()=>{});let o=r&&r.updateCallbackDone;if(o&&typeof o.then=="function")return o.then(()=>n(),()=>n())}catch{}return n(),Promise.resolve()}var P=[];function je(e){let t=e.getElementById("__krate_route");if(!t)return[];try{let n=JSON.parse(t.textContent||"{}");return Array.isArray(n.chain)?n.chain:[]}catch{return K("unreadable #__krate_route route info; layouts will be remounted"),[]}}function xe(e,t){let n=U(new URL(e,location.href).pathname).split("/").filter(Boolean);return(t<0?n:n.slice(0,t)).join("/")}function x(e,t,n="kl:"){let o=(e.ownerDocument||e).createTreeWalker(e,128),i=n+t,s="/"+n+t;for(;o.nextNode();){let c=o.currentNode;if(c.nodeValue===i){for(let a=c.nextSibling;a;a=a.nextSibling)if(a.nodeType===8&&a.nodeValue===s)return[c,a];return null}}return null}function D(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function q(e,t){let n=globalThis.disposeNode;for(let r of D(e,t))r.parentNode.removeChild(r),typeof n=="function"&&n(r)}function Kt(e,t){let n=":scope > template[data-krate-loading]";e.querySelectorAll(n).forEach(r=>r.remove()),t.querySelectorAll(n).forEach(r=>e.appendChild(document.importNode(r,!0)))}function Pe(e){let t=globalThis.krateKeepScopes;typeof t=="function"&&t(e)}function Ot(e){let t=globalThis.krateScopeFailed;return typeof t=="function"&&!!t(e)}function Bt(e,t,n,r,o){let i={keep:[],skip:[],region:null,slots:[],chain:t},s=0;for(;s<e.length&&s<t.length;){let f=e[s],v=t[s];if(f.id!==v.id||f.k!==v.k||f.k!=="layout"&&f.k!=="error"||xe(n,f.d)!==xe(r,v.d)||f.k==="error"&&Ot(f.id))break;if(!f.p||!v.p){K(`layout ${v.f||v.id} is remounted on this navigation: ${v.why||f.why||"not persistable"}`);break}s++}if(s===0)return i;if(typeof globalThis.krateDisposeExcept!="function")return K("the runtime has no krateDisposeExcept; layouts are remounted"),i;let c=t[s-1].id,a=x(b(document),c),u=x(b(o),c);if(!a||!u)return K(`layout ${t[s-1].f||c} boundary markers are missing; the whole page is swapped`),i;let l=e.slice(0,s).map(f=>f.id),p=l.slice(),h=[],g=t.slice();for(let f=0;f<s;f++){let v=e[f].s||[],d=[];for(let w of t[f].s||[]){let y=v.find(st=>st.key===w.key),I=x(b(document),w.key,"ks:"),ae=x(b(o),w.key,"ks:");if(y&&I&&(w.src!=="page"||!ae)){l.push(y.scope),p.push(y.scope,w.scope),d.push({...w,scope:y.scope,src:y.src});continue}if(I&&ae){h.push({live:I,next:ae}),d.push(w);continue}return K(`slot @${w.n} markers are missing; the whole page is swapped`),i}g[f]={...t[f],s:d}}return{keep:l,skip:p,region:{live:a,next:u},slots:h,chain:g}}var z=new Map,C="";function he(e){let t=e.replace(/^\/+|\/+$/g,"");return t?t.split("/").map(n=>n.startsWith("[[...")&&n.endsWith("]]")?{kind:3,text:n.slice(5,-2)}:n.startsWith("[...")&&n.endsWith("]")?{kind:2,text:n.slice(4,-1)}:n.startsWith("[")&&n.endsWith("]")?{kind:1,text:n.slice(1,-1)}:{kind:0,text:n}):[]}function Je(e,t){let n=he(t),r=e.replace(/^\/+|\/+$/g,""),o=r?r.split("/"):[],i={};for(let s=0;s<n.length;s++){let c=n[s];if(c.kind>=2){if(s!==n.length-1)return null;let a=o.slice(s);return c.kind===2&&a.length===0||a.some(u=>u==="")?null:(i[c.text]=a.map(ue).join("/"),i)}if(s>=o.length)return null;if(c.kind===1){if(!o[s])return null;i[c.text]=ue(o[s])}else if(ue(o[s])!==c.text)return null}return o.length===n.length?i:null}function ue(e){try{return decodeURIComponent(e)}catch{return e}}function Ve(e,t){let n=he(e),r=he(t);for(let o=0;o<n.length&&o<r.length;o++){if(n[o].kind!==r[o].kind)return n[o].kind-r[o].kind;if(n[o].kind===0&&n[o].text!==r[o].text)return n[o].text<r[o].text?-1:1}return n.length!==r.length?r.length-n.length:e<t?-1:e>t?1:0}function Se(e){let t=U(new URL(e,location.href).pathname).replace(/^\/+|\/+$/g,""),n=null;for(let r of P)for(let o of r.s||[])for(let i of o.i||[])Je(t,i)&&(!n||Ve(i,n.pattern)<0)&&(n={hit:{entry:r,slot:o,path:t},pattern:i});return n&&!x(b(document),n.hit.slot.key,"ks:")?null:n?n.hit:null}function ze(e,t){P=P.map(n=>n.s&&n.s.some(r=>r.key===e)?{...n,s:n.s.map(r=>r.key===e?t:r)}:n)}function Ye(e){let t="",n=e.getElementById("__krate_page");if(n)try{let r=JSON.parse(n.textContent||"{}");typeof r.r=="string"&&(t=r.r)}catch{}globalThis.__KRATE_ROUTE__=t;for(let r of Array.from(e.querySelectorAll("script:not([src])"))){let o=/window\.__KRATE_PARAMS__\s*=\s*(\{[\s\S]*?\})\s*;?\s*$/.exec(r.textContent||"");if(o){try{globalThis.__KRATE_PARAMS__=JSON.parse(o[1])}catch{}return}}delete globalThis.__KRATE_PARAMS__}function Ft(e){let t=e.getElementById("__krate_error"),n=document.getElementById("__krate_error");if(!t){n&&n.remove();return}let r=document.importNode(t,!0);n?n.replaceWith(r):document.head.appendChild(r)}function Xe(e){let t=globalThis.krateDisposeScopes;typeof t=="function"&&t(e)}async function Le(e,t){let n=location.href;if(e.kind!=="pop"&&!k("krate:navigate-start",{url:e.url,from:n,kind:e.kind,intercept:t.slot.n},!0))return;let r=++T;E&&E.abort();let o=new AbortController;E=o,H("loading");let i=location.origin+me()+"/"+yt+"/"+t.slot.key+(t.path?"/"+t.path:""),s="",c=!1;try{let d=await fetch(i,{headers:{Accept:"text/html"},credentials:"same-origin",signal:o.signal,cache:e.bypassCache?"no-cache":"default"});s=await d.text(),c=d.ok&&(ve(d.headers.get("content-type")||"")||J(s)),c||k("krate:navigate-error",{url:e.url,status:d.status,intercept:t.slot.n})}catch(d){if(d?.name==="AbortError"||o.signal.aborted)return;k("krate:navigate-error",{url:e.url,status:0,error:d,intercept:t.slot.n})}finally{E===o&&(E=void 0)}if(r!==T)return;let a=c?new DOMParser().parseFromString(s,"text/html"):null,u=a?x(b(a),t.slot.key,"ks:"):null,l=x(b(document),t.slot.key,"ks:"),p=null;try{let d=a&&a.getElementById("__krate_route");p=d&&JSON.parse(d.textContent||"{}").frag||null}catch{p=null}if(!a||!u||!l||!p||p.key!==t.slot.key||!p.scope){try{console.warn(`[krate router] intercepting route for ${e.url} (slot @${t.slot.n}) could not be loaded; navigating to the page`)}catch{}return H("idle"),ie({...e})}if(e.kind==="push"&&V(m),t.slot.src!=="intercept"){z.set(m,{key:t.slot.key,nodes:D(l[0],l[1]),slot:t.slot,path:C});for(let d of D(l[0],l[1]))d.parentNode.removeChild(d)}else Xe([t.slot.scope]),q(l[0],l[1]);for(let d of D(u[0],u[1]))l[1].parentNode.insertBefore(document.importNode(d,!0),l[1]);let h=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(d=>h.add(d.href)),a.querySelectorAll('link[rel="stylesheet"][href]').forEach(d=>{let w=new URL(d.getAttribute("href"),i).href;if(h.has(w))return;let y=document.createElement("link");y.rel="stylesheet",y.href=w,document.head.appendChild(y)}),ze(t.slot.key,{...t.slot,scope:p.scope,src:"intercept"});let g={__krate:"",state:e.state===void 0?null:e.state,__kint:{key:t.slot.key,base:C}};e.kind==="push"?(m=M(),g.__krate=m,history.pushState(g,"",e.url)):e.kind==="replace"?(m=M(),g.__krate=m,history.replaceState(g,"",e.url)):e.kind==="pop"&&e.restoreKey&&(m=e.restoreKey),L=_(location.href),Ye(a),oe(),k("krate:navigate",{url:location.href,status:200,intercept:t.slot.n}),ge(location.href),H("idle");let f=We(a,i),v=await Promise.all(f.map($e));if(r===T){if(v.some(d=>!d)){k("krate:navigate-error",{url:location.href,status:200,error:"script-load",intercept:t.slot.n}),$(location.href,!0);return}ee(),k("krate:navigate-end",{url:location.href,status:200,intercept:t.slot.n})}}function Wt(e,t){let n=x(b(document),e.key,"ks:"),r=P.flatMap(i=>i.s||[]).find(i=>i.key===e.key);if(!n||!r||r.src!=="intercept")return!1;Xe([r.scope]),q(n[0],n[1]);for(let i of e.nodes)n[1].parentNode.insertBefore(i,n[1]);ze(e.key,e.slot),z.delete(t),m=t,L=_(location.href);let o=A.get(t);return o!==void 0&&window.scrollTo(0,o),oe(),k("krate:navigate",{url:location.href,status:200}),ge(location.href),re(),!0}function $t(e){return _(e)===L}function jt(e,t){V(m),(e!==location.href||t.state!==void 0)&&(t.kind==="replace"?history.replaceState(j(m||M(),t.state),"",e):(m=M(),history.pushState(j(m,t.state),"",e)));let n=new URL(e).hash;!Ee(n)&&t.scroll&&!n&&window.scrollTo(0,0),re()}function se(e){let t;try{t=new URL(e.url,location.href)}catch{return $(e.url),Promise.resolve()}if(t.origin!==location.origin)return $(t.href,e.kind==="replace"),Promise.resolve();if(e.url=t.href,(e.kind==="push"||e.kind==="replace")&&$t(t.href)&&(t.hash||t.href===location.href))return jt(t.href,e),Promise.resolve();if(e.kind==="push"||e.kind==="replace"){let n=Se(t.href);if(n)return Le(e,n)}return ie(e)}function Ge(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target;if(!t||typeof t.closest!="function")return;let n=t.closest("a[data-krate-link]");if(!n||!be(n))return;let r=n.getAttribute("href");r&&(e.preventDefault(),se({url:new URL(r,location.href).href,kind:n.hasAttribute("data-krate-replace")?"replace":"push",scroll:n.getAttribute("data-krate-scroll")!=="false"}))}function Qe(e){if(e.defaultPrevented)return;let t=e.target;if(!t||t.tagName!=="FORM"||t.hasAttribute("data-krate-reload"))return;let n=e.submitter||null;if((n&&n.getAttribute("formmethod")||t.getAttribute("method")||"get").toLowerCase()!=="get")return;let o=n&&n.getAttribute("formtarget")||t.getAttribute("target");if(o&&o!=="_self")return;let i=n&&n.getAttribute("formaction")||t.getAttribute("action")||"",s;try{s=new URL(i||location.href,location.href)}catch{return}if(s.origin!==location.origin||s.protocol.indexOf("http")!==0)return;let c;try{c=n?new FormData(t,n):new FormData(t)}catch{c=new FormData(t),n&&n.name&&c.append(n.name,n.value)}let a=new URLSearchParams;for(let[u,l]of c.entries()){if(typeof l!="string")return;a.append(u,l)}e.preventDefault(),s.search=a.toString(),s.hash="",se({url:s.href,kind:"push",scroll:!0})}function Ze(e){V(m);let t=Q(e.state),n=location.href;if(_(n)===L){m=t||m;let i=t?A.get(t):void 0;i!==void 0?window.scrollTo(0,i):Ee(location.hash),re();return}let r=t?z.get(t):void 0;if(r&&t&&r.path===_(n)&&r.path===C&&Wt(r,t))return;let o=e.state&&typeof e.state=="object"?e.state.__kint:null;if(o&&o.base===C){let i=Se(n);if(i&&i.slot.key===o.key){Le({url:n,kind:"pop",scroll:!1,restoreKey:t},i);return}}ie({url:n,kind:"pop",scroll:!0,restoreKey:t})}function qe(){ye(),nt()}function et(){V(m);try{history.scrollRestoration="auto"}catch{}}function tt(){try{history.scrollRestoration="manual"}catch{}}function ee(){Ie(),oe(),Fe(document),document.querySelectorAll("script[src]").forEach(e=>{pe.test(e.src)||e.setAttribute("data-krate-spa","")})}function nt(){if(!R||typeof location>"u")return typeof location<"u"&&location.reload(),Promise.resolve();if(L!==C){let e=Se(location.href);if(e&&e.slot.src==="intercept")return Le({url:location.href,kind:"refresh",scroll:!1,bypassCache:!0},e)}return ie({url:location.href,kind:"refresh",scroll:!1,bypassCache:!0})}function rt(e,t={}){return R?se({url:e,kind:"push",scroll:t.scroll!==!1,state:t.state}):(typeof location<"u"&&location.assign(e),Promise.resolve())}function ot(e,t={}){return R?se({url:e,kind:"replace",scroll:t.scroll!==!1,state:t.state}):(typeof location<"u"&&location.replace(e),Promise.resolve())}var Jt={push:rt,replace:ot,back(){typeof history<"u"&&history.back()},forward(){typeof history<"u"&&history.forward()},refresh:nt,prefetch(e){if(!R||typeof location>"u")return Promise.resolve();let t;try{t=new URL(e,location.href)}catch{return Promise.resolve()}return t.origin!==location.origin?Promise.resolve():ke(t.href)},subscribe:De,getState:He,invalidate:ye};function Vt(e,t={}){return R?(t.replace?ot(e,t):rt(e,t),!1):(typeof location<"u"&&(t.replace?location.replace(e):location.assign(e)),!0)}function it(){if(!(typeof document>"u")){if(R){ee();return}if(R=!0,L=_(location.href),P=je(document),C=L,m=Q(history.state)||M(),Q(history.state)===void 0)try{history.replaceState(j(m,history.state),"",location.href)}catch{}try{history.scrollRestoration="manual"}catch{}document.addEventListener("click",Ge),document.addEventListener("submit",Qe),window.addEventListener("popstate",Ze),window.addEventListener("krate:revalidate",qe),window.addEventListener("pagehide",et),window.addEventListener("pageshow",tt),At(),Tt(),ee()}}function zt(){it()}function Yt(){if(R){R=!1,document.removeEventListener("click",Ge),document.removeEventListener("submit",Qe),window.removeEventListener("popstate",Ze),window.removeEventListener("krate:revalidate",qe),window.removeEventListener("pagehide",et),window.removeEventListener("pageshow",tt),document.removeEventListener("mouseover",Z),document.removeEventListener("focusin",Z);for(let e of B.values())clearTimeout(e);B=new Map,N&&(N.disconnect(),N=null),E&&E.abort(),E=void 0,T++,S.clear(),O.clear(),A.clear(),X.clear(),F.clear(),G="idle",W=[],P=[],z.clear(),C=""}}return dt(Xt);})();
|
|
2
|
+
for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
|