diff --git a/server/Dockerfile b/server/Dockerfile index fd96eee..85e3ffd 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -10,7 +10,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \ FROM scratch WORKDIR /app COPY --from=build /out/server /app/server +COPY --from=build /src/playground/build /app/playground USER 65532:65532 EXPOSE 8080 -CMD ["/server","-root=/app/data","-addr=:8080"] +CMD ["/app/server","-root=/app/data","-addr=:8080","-playground-root=/app/playground"] diff --git a/server/cmd/marka-server/main.go b/server/cmd/marka-server/main.go index a6a7c75..311a75f 100644 --- a/server/cmd/marka-server/main.go +++ b/server/cmd/marka-server/main.go @@ -24,8 +24,21 @@ func main() { var roots multi flag.Var(&roots, "root", "repeatable; specify multiple -root flags") addr := flag.String("addr", ":8080", "listen address") + playgroundRoot := flag.String("playground-root", "", "path to playground build directory") flag.Parse() + if *playgroundRoot != "" { + absPlaygroundRoot, err := filepath.Abs(*playgroundRoot) + must(err) + info, err := os.Stat(absPlaygroundRoot) + must(err) + if !info.IsDir() { + log.Fatalf("playground-root %s is not a directory", *playgroundRoot) + } + log.Printf("serving playground from %s", absPlaygroundRoot) + http.Handle("/_playground/", http.StripPrefix("/_playground/", http.FileServer(http.Dir(absPlaygroundRoot)))) + } + if len(roots) == 0 { log.Fatal("at least one -root flag must be specified") } diff --git a/server/playground/_app/env.js b/server/playground/_app/env.js new file mode 100644 index 0000000..f5427da --- /dev/null +++ b/server/playground/_app/env.js @@ -0,0 +1 @@ +export const env={} \ No newline at end of file diff --git a/server/playground/_app/immutable/assets/0.z6k2NkFs.css b/server/playground/_app/immutable/assets/0.z6k2NkFs.css new file mode 100644 index 0000000..dda2edb --- /dev/null +++ b/server/playground/_app/immutable/assets/0.z6k2NkFs.css @@ -0,0 +1 @@ +/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-500:oklch(58.5% .233 277.117);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.relative{position:relative}.sticky{position:sticky}.top-0{top:calc(var(--spacing)*0)}.z-10{z-index:10}.mr-2{margin-right:calc(var(--spacing)*2)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-full{width:100%}.flex-1{flex:1}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-gray-50\/50{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/50{background-color:color-mix(in oklab,var(--color-gray-50)50%,transparent)}}.bg-gray-300{background-color:var(--color-gray-300)}.bg-red-300{background-color:var(--color-red-300)}.bg-white{background-color:var(--color-white)}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.p-4{padding:calc(var(--spacing)*4)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-black{color:var(--color-black)}.text-blue-800{color:var(--color-blue-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.uppercase{text-transform:uppercase}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.last\:border-r-0:last-child{border-right-style:var(--tw-border-style);border-right-width:0}@media (hover:hover){.hover\:text-black:hover{color:var(--color-black)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}.cm-foldGutter+.cm-foldGutter{display:none!important}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false} diff --git a/server/playground/_app/immutable/assets/2.DQ5mJGGf.css b/server/playground/_app/immutable/assets/2.DQ5mJGGf.css new file mode 100644 index 0000000..ca0034c --- /dev/null +++ b/server/playground/_app/immutable/assets/2.DQ5mJGGf.css @@ -0,0 +1 @@ +img.svelte-6uiykz{height:64px;width:64px;aspect-ratio:1;filter:drop-shadow(0px 0px 8px #0002)}.codemirror-wrapper.svelte-3fyul5 .cm-focused{outline:none}.scm-waiting.svelte-3fyul5{position:relative}.scm-waiting__loading.svelte-3fyul5{position:absolute;inset:0;background-color:#ffffff80}.scm-loading.svelte-3fyul5{display:flex;align-items:center;justify-content:center}.scm-loading__spinner.svelte-3fyul5{width:1rem;height:1rem;border-radius:100%;border:solid 2px #000;border-top-color:transparent;margin-right:.75rem;animation:svelte-3fyul5-spin 1s linear infinite}.scm-loading__text.svelte-3fyul5{font-family:sans-serif}.scm-pre.svelte-3fyul5{font-size:.85rem;font-family:monospace;tab-size:2;-moz-tab-size:2;resize:none;pointer-events:none;-webkit-user-select:none;user-select:none;overflow:auto}@keyframes svelte-3fyul5-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:#fff}*{box-sizing:border-box}textarea:focus{outline:none}pre{margin:0;font-family:SF Mono,Monaco,Cascadia Code,Roboto Mono,Consolas,Courier New,monospace} diff --git a/server/playground/_app/immutable/chunks/B4cBSMmy.js b/server/playground/_app/immutable/chunks/B4cBSMmy.js new file mode 100644 index 0000000..9d709a9 --- /dev/null +++ b/server/playground/_app/immutable/chunks/B4cBSMmy.js @@ -0,0 +1,3 @@ +import{w as Ae,o as je,c as _t}from"./D02mbrNz.js";import{aZ as U,g as L,W as P,aY as $e}from"./B7O2AcR_.js";class ce{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Se{constructor(t,n){this.status=t,this.location=n}}class Re extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function yt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function wt(e){return e.split("%25").map(decodeURI).join("%25")}function vt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function bt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(i,o){if(o==="get"||o==="getAll"||o==="has")return f=>(n(f),i[o](f));t();const c=Reflect.get(i,o);return typeof c=="function"?c.bind(i):c}}),enumerable:!0,configurable:!0});const s=["href","pathname","search","toString","toJSON"];r&&s.push("hash");for(const i of s)Object.defineProperty(a,i,{get(){return t(),e[i]},enumerable:!0,configurable:!0});return a}function kt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;const Et=new TextDecoder;function At(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&Y.delete(Te(e)),St(e,t));const Y=new Map;function Rt(e,t){const n=Te(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...s}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&Y.set(n,{body:a,init:s,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=At(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function Tt(e,t,n){if(Y.size>0){const r=Te(e,n),a=Y.get(r);if(a){if(performance.now(){const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const s=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(s)return t.push({name:s[1],matcher:s[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return _e(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return _e(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=It.exec(c),[,p,u,l,h]=d;return t.push({name:l,matcher:h,optional:!!p,rest:!!u,chained:u?f===1&&i[0]==="":!1}),u?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return _e(c)}).join("")}).join("")}/?$`),params:t}}function Lt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Pt(e){return e.slice(1).split("/").filter(Lt)}function xt(e,t,n){const r={},a=e.slice(1),s=a.filter(o=>o!==void 0);let i=0;for(let o=0;od).join("/"),i=0),f===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](f)){r[c.name]=f;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&c.chained&&(i=0),!d&&!p&&Object.keys(r).length===s.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function _e(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ct({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[c,f,d]])=>{const{pattern:p,params:u}=Ut(o),l={id:o,exec:h=>{const w=p.exec(h);if(w)return xt(w,u,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...f||[]].map(i),leaf:s(c)};return l.errors.length=l.layouts.length=Math.max(l.errors.length,l.layouts.length),l});function s(o){const c=o<0;return c&&(o=~o),[c,e[o]]}function i(o){return o===void 0?o:[a.has(o),e[o]]}}function We(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function De(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const I=globalThis.__sveltekit_rnl0m0?.base??"",Nt=globalThis.__sveltekit_rnl0m0?.assets??I??"",Ot="1759262745326",Je="sveltekit:snapshot",ze="sveltekit:scroll",Xe="sveltekit:states",jt="sveltekit:pageurl",B="sveltekit:history",W="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},le=location.origin;function Ze(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function fe(){return{x:pageXOffset,y:pageYOffset}}function F(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Fe={...j,"":j.hover};function Qe(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function et(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Qe(e)}}function ve(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,s=!r||!!a||ue(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=r?.origin===le&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function ee(e){let t=null,n=null,r=null,a=null,s=null,i=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=F(o,"preload-code")),a===null&&(a=F(o,"preload-data")),t===null&&(t=F(o,"keepfocus")),n===null&&(n=F(o,"noscroll")),s===null&&(s=F(o,"reload")),i===null&&(i=F(o,"replacestate")),o=Qe(o);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Fe[r??"off"],preload_data:Fe[a??"off"],keepfocus:c(t),noscroll:c(n),reload:c(s),replace_state:c(i)}}function Be(e){const t=Ae(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function s(i){let o;return t.subscribe(c=>{(o===void 0||n&&c!==o)&&i(o=c)})}return{notify:r,set:a,subscribe:s}}const tt={v:()=>{}};function $t(){const{set:e,subscribe:t}=Ae(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Ot;return i&&(e(!0),tt.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function ue(e,t,n){return e.origin!==le||!e.pathname.startsWith(t)?!0:n?!(e.pathname===t+"/"||e.pathname===t+"/index.html"||e.protocol==="file:"&&e.pathname.replace(/\/[^/]+\.html?$/,"")===t):!1}function Sn(e){}function Dt(e){const t=Bt(e),n=new ArrayBuffer(t.length),r=new DataView(n);for(let a=0;a>16),t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255),n=r=0);return r===12?(n>>=4,t+=String.fromCharCode(n)):r===18&&(n>>=2,t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255)),t}const Vt=-1,Mt=-2,qt=-3,Gt=-4,Yt=-5,Ht=-6;function Kt(e,t){if(typeof e=="number")return a(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const n=e,r=Array(n.length);function a(s,i=!1){if(s===Vt)return;if(s===qt)return NaN;if(s===Gt)return 1/0;if(s===Yt)return-1/0;if(s===Ht)return-0;if(i||typeof s!="number")throw new Error("Invalid input");if(s in r)return r[s];const o=n[s];if(!o||typeof o!="object")r[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const c=o[0],f=t?.[c];if(f)return r[s]=f(a(o[1]));switch(c){case"Date":r[s]=new Date(o[1]);break;case"Set":const d=new Set;r[s]=d;for(let l=1;lt!=null)}const zt="x-sveltekit-invalidated",Xt="x-sveltekit-trailing-slash";function te(e){return e instanceof ce||e instanceof Re?e.status:500}function Zt(e){return e instanceof Re?e.text:"Internal Error"}let S,J,ye;const Qt=je.toString().includes("$$")||/function \w+\(\) \{\}/.test(je.toString());Qt?(S={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},J={current:null},ye={current:!1}):(S=new class{#e=U({});get data(){return L(this.#e)}set data(t){P(this.#e,t)}#t=U(null);get form(){return L(this.#t)}set form(t){P(this.#t,t)}#n=U(null);get error(){return L(this.#n)}set error(t){P(this.#n,t)}#r=U({});get params(){return L(this.#r)}set params(t){P(this.#r,t)}#a=U({id:null});get route(){return L(this.#a)}set route(t){P(this.#a,t)}#o=U({});get state(){return L(this.#o)}set state(t){P(this.#o,t)}#s=U(-1);get status(){return L(this.#s)}set status(t){P(this.#s,t)}#i=U(new URL("https://example.com"));get url(){return L(this.#i)}set url(t){P(this.#i,t)}},J=new class{#e=U(null);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},ye=new class{#e=U(!1);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},tt.v=()=>ye.current=!0);function en(e){Object.assign(S,e)}const tn="/__data.json",nn=".html__data.json";function rn(e){return e.endsWith(".html")?e.replace(/\.html$/,nn):e.replace(/\/$/,"")+tn}const Ve={spanContext(){return an},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},an={traceId:"",spanId:"",traceFlags:0},{tick:on}=_t,sn=new Set(["icon","shortcut icon","apple-touch-icon"]),D=We(ze)??{},z=We(Je)??{},O={url:Be({}),page:Be({}),navigating:Ae(null),updated:$t()};function Ie(e){D[e]=fe()}function cn(e,t){let n=e+1;for(;D[n];)delete D[n],n+=1;for(n=t+1;z[n];)delete z[n],n+=1}function q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function rt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(I||"/");e&&await e.update()}}function Me(){}let Ue,be,ne,x,ke,v;const re=[],ae=[];let C=null;const Q=new Map,at=new Set,ln=new Set,H=new Set;let y={branch:[],error:null,url:null},Le=!1,oe=!1,qe=!0,X=!1,G=!1,ot=!1,Pe=!1,st,A,T,$;const K=new Set,Ge=new Map;async function Un(e,t,n){globalThis.__sveltekit_rnl0m0?.data&&globalThis.__sveltekit_rnl0m0.data,document.URL!==location.href&&(location.href=location.href),v=e,await e.hooks.init?.(),Ue=Ct(e),x=document.documentElement,ke=t,be=e.nodes[0],ne=e.nodes[1],be(),ne(),A=history.state?.[B],T=history.state?.[W],A||(A=T=Date.now(),history.replaceState({...history.state,[B]:A,[W]:T},""));const r=D[A];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await vn(ke,n)):(await V({type:"enter",url:Ze(v.hash?kn(new URL(location.href)):location.href),replace_state:!0}),a()),wn()}function fn(){re.length=0,Pe=!1}function it(e){ae.some(t=>t?.snapshot)&&(z[e]=ae.map(t=>t?.snapshot?.capture()))}function ct(e){z[e]?.forEach((t,n)=>{ae[n]?.snapshot?.restore(t)})}function Ye(){Ie(A),De(ze,D),it(T),De(Je,z)}async function un(e,t,n,r){let a;t.invalidateAll&&(C=null),await V({type:"goto",url:Ze(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Pe=!0,a=[...Ge.keys()]),t.invalidate&&t.invalidate.forEach(yn)}}),t.invalidateAll&&$e().then($e).then(()=>{Ge.forEach(({resource:s},i)=>{a?.includes(i)&&s.refresh?.()})})}async function dn(e){if(e.id!==C?.id){const t={};K.add(t),C={id:e.id,token:t,promise:ut({...e,preload:t}).then(n=>(K.delete(t),n.type==="loaded"&&n.state.error&&(C=null),n))}}return C.promise}async function we(e){const t=(await he(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}function lt(e,t,n){y=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(S,e.props.page),st=new v.root({target:t,props:{...e.props,stores:O,components:ae},hydrate:n,sync:!1}),ct(T),n){const a={from:null,to:{params:y.params,route:{id:y.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};H.forEach(s=>s(a))}oe=!0}function se({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if(I&&(e.pathname===I||e.pathname===I+"/"))o="always";else for(const l of n)l?.slash!==void 0&&(o=l.slash);e.pathname=yt(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:Jt(n).map(l=>l.node.component),page:Oe(S)}};i!==void 0&&(c.props.form=i);let f={},d=!S,p=0;for(let l=0;l(o&&(c.route=!0),u[l])}),params:new Proxy(r,{get:(u,l)=>(o&&c.params.add(l),u[l])}),data:s?.data??null,url:bt(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},v.hash),async fetch(u,l){u instanceof Request&&(l={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...l});const{resolved:h,promise:w}=ft(u,l,n);return o&&d(h.href),w},setHeaders:()=>{},depends:d,parent(){return o&&(c.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};i=await f.universal.load.call(null,p)??null}return{node:f,loader:e,server:s,universal:f.universal?.load?{type:"data",data:i,uses:c}:null,data:i??s?.data??null,slash:f.universal?.trailingSlash??s?.slash}}function ft(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const s=oe?Tt(r,a.href,t):Rt(r,t);return{resolved:a,promise:s}}function He(e,t,n,r,a,s){if(Pe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(s[i]!==y.params[i])return!0;for(const i of a.dependencies)if(re.some(o=>o(new URL(i))))return!0;return!1}function Ce(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function hn(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),s=t.searchParams.getAll(r);a.every(i=>s.includes(i))&&s.every(i=>a.includes(i))&&n.delete(r)}return n}function Ke({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Oe(S),constructors:[]}}}async function ut({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if(C?.id===e)return K.delete(C.token),C.promise;const{errors:i,layouts:o,leaf:c}=a,f=[...o,c];i.forEach(_=>_?.().catch(()=>{})),f.forEach(_=>_?.[1]().catch(()=>{}));let d=null;const p=y.url?e!==ie(y.url):!1,u=y.route?a.id!==y.route.id:!1,l=hn(y.url,n);let h=!1;const w=f.map((_,g)=>{const b=y.branch[g],k=!!_?.[0]&&(b?.loader!==_[1]||He(h,u,p,l,b.server?.uses,r));return k&&(h=!0),k});if(w.some(Boolean)){try{d=await pt(n,w)}catch(_){const g=await M(_,{url:n,params:r,route:{id:e}});return K.has(s)?Ke({error:g,url:n,params:r,route:a}):de({status:te(_),error:g,url:n,route:a})}if(d.type==="redirect")return d}const E=d?.nodes;let m=!1;const N=f.map(async(_,g)=>{if(!_)return;const b=y.branch[g],k=E?.[g];if((!k||k.type==="skip")&&_[1]===b?.loader&&!He(m,u,p,l,b.universal?.uses,r))return b;if(m=!0,k?.type==="error")throw k;return xe({loader:_[1],url:n,params:r,route:a,parent:async()=>{const pe={};for(let ge=0;ge{});const R=[];for(let _=0;_Promise.resolve({}),server_data_node:Ce(s)}),c={node:await ne(),loader:ne,universal:null,server:null,data:null};return se({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Se)return un(new URL(o.location,location.href),{},0);throw o}}async function gn(e){const t=e.href;if(Q.has(t))return Q.get(t);let n;try{const r=(async()=>{let a=await v.hooks.reroute({url:new URL(e),fetch:async(s,i)=>ft(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);v.hash?s.hash=a:s.pathname=a,a=s}return a})();Q.set(t,r),n=await r}catch{Q.delete(t);return}return n}async function he(e,t){if(e&&!ue(e,I,v.hash)){const n=await gn(e);if(!n)return;const r=mn(n);for(const a of Ue){const s=a.exec(r);if(s)return{id:ie(e),invalidating:t,route:a,params:vt(s),url:e}}}}function mn(e){return wt(v.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(I.length))||"/"}function ie(e){return(v.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function dt({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=Ne(y,n,e,t);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const o={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return X||at.forEach(c=>c(o)),s?null:i}async function V({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:f=Me,block:d=Me,event:p}){const u=$;$=c;const l=await he(t,!1),h=e==="enter"?Ne(y,l,t,e):dt({url:t,type:e,delta:n?.delta,intent:l,event:p});if(!h){d(),$===c&&($=u);return}const w=A,E=T;f(),X=!0,oe&&h.navigation.type!=="enter"&&O.navigating.set(J.current=h.navigation);let m=l&&await ut(l);if(!m){if(ue(t,I,v.hash))return await q(t,s);m=await ht(t,{id:null},await M(new Re(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=l?.url||t,$!==c)return h.reject(new Error("navigation aborted")),!1;if(m.type==="redirect"){if(o<20){await V({type:e,url:new URL(m.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i,redirect_count:o+1,nav_token:c}),h.fulfil(void 0);return}m=await de({status:500,error:await M(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else m.props.page.status>=400&&await O.updated.check()&&(await rt(),await q(t,s));if(fn(),Ie(w),it(E),m.props.page.url.pathname!==t.pathname&&(t.pathname=m.props.page.url.pathname),i=n?n.state:i,!n){const g=s?0:1,b={[B]:A+=g,[W]:T+=g,[Xe]:i};(s?history.replaceState:history.pushState).call(history,b,"",t),s||cn(A,T)}if(C=null,m.props.page.state=i,oe){const g=(await Promise.all(Array.from(ln,b=>b(h.navigation)))).filter(b=>typeof b=="function");if(g.length>0){let b=function(){g.forEach(k=>{H.delete(k)})};g.push(b),g.forEach(k=>{H.add(k)})}y=m.state,m.props.page&&(m.props.page.url=t),st.$set(m.props),en(m.props.page),ot=!0}else lt(m,ke,!1);const{activeElement:N}=document;await on();const R=n?n.scroll:a?fe():null;if(qe){const g=t.hash&&document.getElementById(mt(t));R?scrollTo(R.x,R.y):g?g.scrollIntoView():scrollTo(0,0)}const _=document.activeElement!==N&&document.activeElement!==document.body;!r&&!_&&bn(t),qe=!0,m.props.page&&Object.assign(S,m.props.page),X=!1,e==="popstate"&&ct(T),h.fulfil(void 0),H.forEach(g=>g(h.navigation)),O.navigating.set(J.current=null)}async function ht(e,t,n,r,a){return e.origin===le&&e.pathname===location.pathname&&!Le?await de({status:r,error:n,url:e,route:t}):await q(e,a)}function _n(){let e,t,n;x.addEventListener("mousemove",o=>{const c=o.target;clearTimeout(e),e=setTimeout(()=>{s(c,j.hover)},20)});function r(o){o.defaultPrevented||s(o.composedPath()[0],j.tap)}x.addEventListener("mousedown",r),x.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting&&(we(new URL(c.target.href)),a.unobserve(c.target))},{threshold:0});async function s(o,c){const f=et(o,x),d=f===t&&c>=n;if(!f||d)return;const{url:p,external:u,download:l}=ve(f,I,v.hash);if(u||l)return;const h=ee(f),w=p&&ie(y.url)===ie(p);if(!(h.reload||w))if(c<=h.preload_data){t=f,n=j.tap;const E=await he(p,!1);if(!E)return;dn(E)}else c<=h.preload_code&&(t=f,n=c,we(p))}function i(){a.disconnect();for(const o of x.querySelectorAll("a")){const{url:c,external:f,download:d}=ve(o,I,v.hash);if(f||d)continue;const p=ee(o);p.reload||(p.preload_code===j.viewport&&a.observe(o),p.preload_code===j.eager&&we(c))}}H.add(i),i()}function M(e,t){if(e instanceof ce)return e.body;const n=te(e),r=Zt(e);return v.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function yn(e){if(typeof e=="function")re.push(e);else{const{href:t}=new URL(e,location.href);re.push(n=>n.href===t)}}function wn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Ye(),!X){const r=Ne(y,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};at.forEach(s=>s(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ye()}),navigator.connection?.saveData||_n(),x.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=et(t.composedPath()[0],x);if(!n)return;const{url:r,external:a,target:s,download:i}=ve(n,I,v.hash);if(!r)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const o=ee(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||i)return;const[f,d]=(v.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=f===me(location);if(a||o.reload&&(!p||!d)){dt({url:r,type:"link",event:t})?X=!0:t.preventDefault();return}if(d!==void 0&&p){const[,u]=y.url.href.split("#");if(u===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)window.scrollTo({top:0});else{const l=n.ownerDocument.getElementById(decodeURIComponent(d));l&&(l.scrollIntoView(),l.focus())}return}if(G=!0,Ie(A),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await V({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),x.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const i=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ue(i,I,!1))return;const o=t.target,c=ee(o);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(o,r);i.search=new URLSearchParams(f).toString(),V({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Ee){if(t.state?.[B]){const n=t.state[B];if($={},n===A)return;const r=D[n],a=t.state[Xe]??{},s=new URL(t.state[jt]??location.href),i=t.state[W],o=y.url?me(location)===me(y.url):!1;if(i===T&&(ot||o)){a!==S.state&&(S.state=a),e(s),D[A]=fe(),r&&scrollTo(r.x,r.y),A=n;return}const f=n-A;await V({type:"popstate",url:s,popped:{state:a,scroll:r,delta:f},accept:()=>{A=n,T=i},block:()=>{history.go(-f)},nav_token:$,event:t})}else if(!G){const n=new URL(location.href);e(n),v.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[B]:++A,[W]:T},"",location.href))});for(const t of document.querySelectorAll("link"))sn.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&O.navigating.set(J.current=null)});function e(t){y.url=S.url=t,O.page.set(Oe(S)),O.page.notify()}}async function vn(e,{status:t=200,error:n,node_ids:r,params:a,route:s,server_route:i,data:o,form:c}){Le=!0;const f=new URL(location.href);let d;({params:a={},route:s={id:null}}=await he(f,!1)||{}),d=Ue.find(({id:l})=>l===s.id);let p,u=!0;try{const l=r.map(async(w,E)=>{const m=o[E];return m?.uses&&(m.uses=gt(m.uses)),xe({loader:v.nodes[w],url:f,params:a,route:s,parent:async()=>{const N={};for(let R=0;Rs?"1":"0").join(""));const r=window.fetch,a=await r(n.href,{});if(!a.ok){let s;throw a.headers.get("content-type")?.includes("application/json")?s=await a.json():a.status===404?s="Not Found":a.status===500&&(s="Internal Error"),new ce(a.status,s)}return new Promise(async s=>{const i=new Map,o=a.body.getReader();function c(d){return Kt(d,{...v.decoders,Promise:p=>new Promise((u,l)=>{i.set(p,{fulfil:u,reject:l})})})}let f="";for(;;){const{done:d,value:p}=await o.read();if(d&&!f)break;for(f+=!p&&f?` +`:Et.decode(p,{stream:!0});;){const u=f.indexOf(` +`);if(u===-1)break;const l=JSON.parse(f.slice(0,u));if(f=f.slice(u+1),l.type==="redirect")return s(l);if(l.type==="data")l.nodes?.forEach(h=>{h?.type==="data"&&(h.uses=gt(h.uses),h.data=c(h.data))}),s(l);else if(l.type==="chunk"){const{id:h,data:w,error:E}=l,m=i.get(h);i.delete(h),E?m.reject(c(E)):m.fulfil(c(w))}}}})}function gt(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Ee=!1;function bn(e){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const n=mt(e);if(n&&document.getElementById(n)){const{x:a,y:s}=fe();setTimeout(()=>{const i=history.state;Ee=!0,location.replace(`#${n}`),v.hash&&location.replace(e.hash),history.replaceState(i,"",e.hash),scrollTo(a,s),Ee=!1})}else{const a=document.body,s=a.getAttribute("tabindex");a.tabIndex=-1,a.focus({preventScroll:!0,focusVisible:!1}),s!==null?a.setAttribute("tabindex",s):a.removeAttribute("tabindex")}const r=getSelection();if(r&&r.type!=="None"){const a=[];for(let s=0;s{if(r.rangeCount===a.length){for(let s=0;s{a=c,s=f});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n},willUnload:!t,type:r,complete:i},fulfil:a,reject:s}}function Oe(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function kn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function mt(e){let t;if(v.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Un as a,Sn as l,S as p,O as s}; diff --git a/server/playground/_app/immutable/chunks/B7O2AcR_.js b/server/playground/_app/immutable/chunks/B7O2AcR_.js new file mode 100644 index 0000000..d58a792 --- /dev/null +++ b/server/playground/_app/immutable/chunks/B7O2AcR_.js @@ -0,0 +1 @@ +var fe=Array.isArray,Be=Array.prototype.indexOf,Gn=Array.from,Pt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,Ge=Object.prototype,$e=Array.prototype,oe=Object.getPrototypeOf,Qt=Object.isExtensible;function $n(t){return typeof t=="function"}const Ke=()=>{};function Kn(t){return t()}function ce(t){for(var e=0;e{t=r,e=a});return{promise:n,resolve:t,reject:e}}function Xn(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const S=2,Yt=4,St=8,ot=16,q=32,at=64,_e=128,R=256,Et=512,b=1024,O=2048,z=4096,$=8192,ct=16384,Vt=32768,Ht=65536,te=1<<17,ve=1<<18,yt=1<<19,de=1<<20,Mt=1<<21,Ut=1<<22,Q=1<<23,tt=Symbol("$state"),Zn=Symbol("legacy props"),zn=Symbol(""),Bt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Qn=1,kt=3,Wt=8,Ze=11;function ze(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Je(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qe(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function tn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function en(t){throw new Error("https://svelte.dev/e/effect_orphan")}function nn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function tr(){throw new Error("https://svelte.dev/e/get_abort_signal_outside_reaction")}function er(){throw new Error("https://svelte.dev/e/hydration_failed")}function nr(t){throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function rr(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function rn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function an(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function sn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ar(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const sr=1,ir=2,lr=4,ur=8,fr=16,or=1,cr=2,_r=4,vr=8,dr=16,ln=1,un=2,pe="[",fn="[!",on="]",Gt={},g=Symbol(),pr="http://www.w3.org/1999/xhtml",hr="http://www.w3.org/2000/svg",yr="@attach";function $t(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function wr(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function mr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let w=!1;function bt(t){w=t}let h;function D(t){if(t===null)throw $t(),Gt;return h=t}function he(){return D(j(h))}function gr(t){if(w){if(j(h)!==null)throw $t(),Gt;h=t}}function Er(t=1){if(w){for(var e=t,n=h;e--;)n=j(n);h=n}}function br(t=!0){for(var e=0,n=h;;){if(n.nodeType===Wt){var r=n.data;if(r===on){if(e===0)return n;e-=1}else(r===pe||r===fn)&&(e+=1)}var a=j(n);t&&n.remove(),n=a}}function Tr(t){if(!t||t.nodeType!==Wt)throw $t(),Gt;return t.data}function ye(t){return t===this.v}function cn(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function we(t){return!cn(t,this.v)}let Nt=!1;function Ar(){Nt=!0}let m=null;function Tt(t){m=t}function xr(t){return Rt().get(t)}function Sr(t,e){return Rt().set(t,e),e}function kr(t){return Rt().has(t)}function Nr(){return Rt()}function Rr(t,e=!1,n){m={p:m,c:null,e:null,s:t,x:null,l:Nt&&!e?{s:null,u:null,$:[]}:null}}function Cr(t){var e=m,n=e.e;if(n!==null){e.e=null;for(var r of n)Oe(r)}return m=e.p,{}}function wt(){return!Nt||m!==null&&m.l===null}function Rt(t){return m===null&&ze(),m.c??=new Map(_n(m)||void 0)}function _n(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}const vn=typeof requestIdleCallback>"u"?t=>setTimeout(t,1):requestIdleCallback;let B=[],ut=[];function me(){var t=B;B=[],ce(t)}function ge(){var t=ut;ut=[],ce(t)}function dn(){return B.length>0||ut.length>0}function Ee(t){if(B.length===0&&!pt){var e=B;queueMicrotask(()=>{e===B&&me()})}B.push(t)}function Or(t){ut.length===0&&vn(ge),ut.push(t)}function pn(){B.length>0&&me(),ut.length>0&&ge()}const hn=new WeakMap;function yn(t){var e=_;if(e===null)return c.f|=Q,t;if((e.f&Vt)===0){if((e.f&_e)===0)throw!e.parent&&t instanceof Error&&be(t),t;e.b.error(t)}else At(t,e)}function At(t,e){for(;e!==null;){if((e.f&_e)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t instanceof Error&&be(t),t}function be(t){const e=hn.get(t);e&&(Pt(t,"message",{value:e.message}),Pt(t,"stack",{value:e.stack}))}const It=new Set;let E=null,ee=new Set,nt=[],Ct=null,Ft=!1,pt=!1;class rt{current=new Map;#u=new Map;#a=new Set;#t=0;#f=null;#o=!1;#n=[];#s=[];#r=[];#e=[];#i=[];#c=[];#_=[];skipped_effects=new Set;process(e){nt=[];for(const a of e)this.#d(a);if(this.#n.length===0&&this.#t===0){this.#v();var n=this.#r,r=this.#e;this.#r=[],this.#e=[],this.#i=[],E=null,ne(n),ne(r),E===null?E=this:It.delete(this),this.#f?.resolve()}else this.#l(this.#r),this.#l(this.#e),this.#l(this.#i);for(const a of this.#n)lt(a);for(const a of this.#s)lt(a);this.#n=[],this.#s=[]}#d(e){e.f^=b;for(var n=e.first;n!==null;){var r=n.f,a=(r&(q|at))!==0,s=a&&(r&b)!==0,i=s||(r&$)!==0||this.skipped_effects.has(n);if(!i&&n.fn!==null){if(a)n.f^=b;else if((r&Yt)!==0)this.#e.push(n);else if((r&b)===0)if((r&Ut)!==0){var f=n.b?.is_pending()?this.#s:this.#n;f.push(n)}else Ot(n)&&((n.f&ot)!==0&&this.#i.push(n),lt(n));var l=n.first;if(l!==null){n=l;continue}}var u=n.parent;for(n=n.next;n===null&&u!==null;)n=u.next,u=u.parent}}#l(e){for(const n of e)((n.f&O)!==0?this.#c:this.#_).push(n),A(n,b);e.length=0}capture(e,n){this.#u.has(e)||this.#u.set(e,n),this.current.set(e,e.v)}activate(){E=this}deactivate(){E=null;for(const e of ee)if(ee.delete(e),e(),E!==null)break}neuter(){this.#o=!0}flush(){nt.length>0?Lt():this.#v(),E===this&&(this.#t===0&&It.delete(this),this.deactivate())}#v(){if(!this.#o)for(const e of this.#a)e();this.#a.clear()}increment(){this.#t+=1}decrement(){if(this.#t-=1,this.#t===0){for(const e of this.#c)A(e,O),ft(e);for(const e of this.#_)A(e,z),ft(e);this.#r=[],this.#e=[],this.flush()}else this.deactivate()}add_callback(e){this.#a.add(e)}settled(){return(this.#f??=Xe()).promise}static ensure(){if(E===null){const e=E=new rt;It.add(E),pt||rt.enqueue(()=>{E===e&&e.flush()})}return E}static enqueue(e){Ee(e)}}function wn(t){var e=pt;pt=!0;try{var n;for(t&&(Lt(),n=t());;){if(pn(),nt.length===0&&!dn()&&(E?.flush(),nt.length===0))return Ct=null,n;Lt()}}finally{pt=e}}function Lt(){var t=it;Ft=!0;try{var e=0;for(se(!0);nt.length>0;){var n=rt.ensure();if(e++>1e3){var r,a;mn()}n.process(nt),G.clear()}}finally{Ft=!1,se(t),Ct=null}}function mn(){try{nn()}catch(t){At(t,Ct)}}let J=null;function ne(t){var e=t.length;if(e!==0){for(var n=0;n0)){G.clear();for(const a of J)lt(a);J=[]}}J=null}}function ft(t){for(var e=Ct=t;e.parent!==null;){e=e.parent;var n=e.f;if(Ft&&e===_&&(n&ot)!==0)return;if((n&(at|q))!==0){if((n&b)===0)return;e.f^=b}}nt.push(e)}function gn(t,e,n){const r=wt()?Kt:Tn;if(e.length===0){n(t.map(r));return}var a=E,s=_,i=En(),f=w;Promise.all(e.map(l=>bn(l))).then(l=>{a?.activate(),i();try{n([...t.map(r),...l])}catch(u){(s.f&ct)===0&&At(u,s)}f&&bt(!1),a?.deactivate(),Te()}).catch(l=>{At(l,s)})}function En(){var t=_,e=c,n=m,r=E,a=w;if(a)var s=h;return function(){Z(t),P(e),Tt(n),r?.activate(),a&&(bt(!0),D(s))}}function Te(){Z(null),P(null),Tt(null)}function Kt(t){var e=S|O,n=c!==null&&(c.f&S)!==0?c:null;return _===null||n!==null&&(n.f&R)!==0?e|=R:_.f|=yt,{ctx:m,deps:null,effects:null,equals:ye,f:e,fn:t,reactions:null,rv:0,v:g,wv:0,parent:n??_,ac:null}}function bn(t,e){let n=_;n===null&&Je();var r=n.b,a=void 0,s=Zt(g),i=null,f=!c;return Nn(()=>{try{var l=t();i&&Promise.resolve(l).catch(()=>{})}catch(d){l=Promise.reject(d)}var u=()=>l;a=i?.then(u,u)??Promise.resolve(l),i=a;var o=E,v=r.is_pending();f&&(r.update_pending_count(1),v||o.increment());const y=(d,p=void 0)=>{i=null,v||o.activate(),p?p!==Bt&&(s.f|=Q,jt(s,p)):((s.f&Q)!==0&&(s.f^=Q),jt(s,d)),f&&(r.update_pending_count(-1),v||o.decrement()),Te()};if(a.then(y,d=>y(null,d||"unknown")),o)return()=>{queueMicrotask(()=>o.neuter())}}),new Promise(l=>{function u(o){function v(){o===a?l(s):u(a)}o.then(v,v)}u(a)})}function Ir(t){const e=Kt(t);return je(e),e}function Tn(t){const e=Kt(t);return e.equals=we,e}function Ae(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n{if(et===s)return f();var l=c,u=et;P(null),le(s);var o=f();return P(l),le(u),o};return r&&n.set("length",H(t.length)),new Proxy(t,{defineProperty(f,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&rn();var o=n.get(l);return o===void 0?o=i(()=>{var v=H(u.value);return n.set(l,v),v}):U(o,u.value,!0),!0},deleteProperty(f,l){var u=n.get(l);if(u===void 0){if(l in f){const o=i(()=>H(g));n.set(l,o),Dt(a)}}else U(u,g),Dt(a);return!0},get(f,l,u){if(l===tt)return t;var o=n.get(l),v=l in f;if(o===void 0&&(!v||dt(f,l)?.writable)&&(o=i(()=>{var d=vt(v?f[l]:g),p=H(d);return p}),n.set(l,o)),o!==void 0){var y=st(o);return y===g?void 0:y}return Reflect.get(f,l,u)},getOwnPropertyDescriptor(f,l){var u=Reflect.getOwnPropertyDescriptor(f,l);if(u&&"value"in u){var o=n.get(l);o&&(u.value=st(o))}else if(u===void 0){var v=n.get(l),y=v?.v;if(v!==void 0&&y!==g)return{enumerable:!0,configurable:!0,value:y,writable:!0}}return u},has(f,l){if(l===tt)return!0;var u=n.get(l),o=u!==void 0&&u.v!==g||Reflect.has(f,l);if(u!==void 0||_!==null&&(!o||dt(f,l)?.writable)){u===void 0&&(u=i(()=>{var y=o?vt(f[l]):g,d=H(y);return d}),n.set(l,u));var v=st(u);if(v===g)return!1}return o},set(f,l,u,o){var v=n.get(l),y=l in f;if(r&&l==="length")for(var d=u;dH(g)),n.set(d+"",p))}if(v===void 0)(!y||dt(f,l)?.writable)&&(v=i(()=>H(void 0)),U(v,vt(u)),n.set(l,v));else{y=v.v!==g;var Y=i(()=>vt(u));U(v,Y)}var mt=Reflect.getOwnPropertyDescriptor(f,l);if(mt?.set&&mt.set.call(o,u),!y){if(r&&typeof l=="string"){var gt=n.get("length"),V=Number(l);Number.isInteger(V)&&V>=gt.v&&U(gt,V+1)}Dt(a)}return!0},ownKeys(f){st(a);var l=Reflect.ownKeys(f).filter(v=>{var y=n.get(v);return y===void 0||y.v!==g});for(var[u,o]of n)o.v!==g&&!(u in f)&&l.push(u);return l},setPrototypeOf(){an()}})}function re(t){try{if(t!==null&&typeof t=="object"&&tt in t)return t[tt]}catch{}return t}function Mr(t,e){return Object.is(re(t),re(e))}var ae,xn,ke,Ne,Re;function Fr(){if(ae===void 0){ae=window,xn=document,ke=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Ne=dt(e,"firstChild").get,Re=dt(e,"nextSibling").get,Qt(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Qt(n)&&(n.__t=void 0)}}function K(t=""){return document.createTextNode(t)}function L(t){return Ne.call(t)}function j(t){return Re.call(t)}function Lr(t,e){if(!w)return L(t);var n=L(h);if(n===null)n=h.appendChild(K());else if(e&&n.nodeType!==kt){var r=K();return n?.before(r),D(r),r}return D(n),n}function jr(t,e=!1){if(!w){var n=L(t);return n instanceof Comment&&n.data===""?j(n):n}if(e&&h?.nodeType!==kt){var r=K();return h?.before(r),D(r),r}return h}function qr(t,e=1,n=!1){let r=w?h:t;for(var a;e--;)a=r,r=j(r);if(!w)return r;if(n&&r?.nodeType!==kt){var s=K();return r===null?a?.after(s):r.before(s),D(s),s}return D(r),r}function Yr(t){t.textContent=""}function Vr(){return!1}function zt(t){var e=c,n=_;P(null),Z(null);try{return t()}finally{P(e),Z(n)}}function Ce(t){_===null&&c===null&&en(),c!==null&&(c.f&R)!==0&&_===null&&tn(),_t&&Qe()}function Sn(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function M(t,e,n,r=!0){var a=_;a!==null&&(a.f&$)!==0&&(t|=$);var s={ctx:m,deps:null,nodes_start:null,nodes_end:null,f:t|O,first:null,fn:e,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{lt(s),s.f|=Vt}catch(l){throw X(s),l}else e!==null&&ft(s);if(r){var i=s;if(n&&i.deps===null&&i.teardown===null&&i.nodes_start===null&&i.first===i.last&&(i.f&yt)===0&&(i=i.first),i!==null&&(i.parent=a,a!==null&&Sn(i,a),c!==null&&(c.f&S)!==0&&(t&at)===0)){var f=c;(f.effects??=[]).push(i)}}return s}function Hr(){return c!==null&&!C}function kn(t){const e=M(St,null,!1);return A(e,b),e.teardown=t,e}function Ur(t){Ce();var e=_.f,n=!c&&(e&q)!==0&&(e&Vt)===0;if(n){var r=m;(r.e??=[]).push(t)}else return Oe(t)}function Oe(t){return M(Yt|de,t,!1)}function Br(t){return Ce(),M(St|de,t,!0)}function Wr(t){rt.ensure();const e=M(at|yt,t,!0);return(n={})=>new Promise(r=>{n.outro?In(e,()=>{X(e),r(void 0)}):(X(e),r(void 0))})}function Gr(t){return M(Yt,t,!1)}function Nn(t){return M(Ut|yt,t,!0)}function $r(t,e=0){return M(St|e,t,!0)}function Kr(t,e=[],n=[]){gn(e,n,r=>{M(St,()=>t(...r.map(st)),!0)})}function Ie(t,e=0){var n=M(ot|e,t,!0);return n}function Rn(t,e=!0){return M(q|yt,t,!0,e)}function De(t){var e=t.teardown;if(e!==null){const n=_t,r=c;ie(!0),P(null);try{e.call(null)}finally{ie(n),P(r)}}}function Pe(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const a=n.ac;a!==null&&zt(()=>{a.abort(Bt)});var r=n.next;(n.f&at)!==0?n.parent=null:X(n,e),n=r}}function Cn(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&q)===0&&X(e),e=n}}function X(t,e=!0){var n=!1;(e||(t.f&ve)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(On(t.nodes_start,t.nodes_end),n=!0),Pe(t,e&&!n),xt(t,0),A(t,ct);var r=t.transitions;if(r!==null)for(const s of r)s.stop();De(t);var a=t.parent;a!==null&&a.first!==null&&Me(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function On(t,e){for(;t!==null;){var n=t===e?null:j(t);t.remove(),t=n}}function Me(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function In(t,e){var n=[];Fe(t,n,!0),Dn(n,()=>{X(t),e&&e()})}function Dn(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var a of t)a.out(r)}else e()}function Fe(t,e,n){if((t.f&$)===0){if(t.f^=$,t.transitions!==null)for(const i of t.transitions)(i.is_global||n)&&e.push(i);for(var r=t.first;r!==null;){var a=r.next,s=(r.f&Ht)!==0||(r.f&q)!==0;Fe(r,e,s?n:!1),r=a}}}function Xr(t){Le(t,!0)}function Le(t,e){if((t.f&$)!==0){t.f^=$,(t.f&b)===0&&(A(t,O),ft(t));for(var n=t.first;n!==null;){var r=n.next,a=(n.f&Ht)!==0||(n.f&q)!==0;Le(n,a?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}let it=!1;function se(t){it=t}let _t=!1;function ie(t){_t=t}let c=null,C=!1;function P(t){c=t}let _=null;function Z(t){_=t}let F=null;function je(t){c!==null&&(F===null?F=[t]:F.push(t))}let T=null,x=0,N=null;function Pn(t){N=t}let qe=1,ht=0,et=ht;function le(t){et=t}let W=!1;function Ye(){return++qe}function Ot(t){var e=t.f;if((e&O)!==0)return!0;if((e&z)!==0){var n=t.deps,r=(e&R)!==0;if(n!==null){var a,s,i=(e&Et)!==0,f=r&&_!==null&&!W,l=n.length;if((i||f)&&(_===null||(_.f&ct)===0)){var u=t,o=u.parent;for(a=0;at.wv)return!0}(!r||_!==null&&!W)&&A(t,b)}return!1}function Ve(t,e,n=!0){var r=t.reactions;if(r!==null&&!F?.includes(t))for(var a=0;a{t.ac.abort(Bt)}),t.ac=null);try{t.f|=Mt;var v=t.fn,y=v(),d=t.deps;if(T!==null){var p;if(xt(t,x),d!==null&&x>0)for(d.length=x+T.length,p=0;pn?.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Ee(()=>{e.addEventListener(t,a,r)}):e.addEventListener(t,a,r),a}function ia(t){for(var e=0;e{throw V});throw y}}finally{t.__root=e,delete t.currentTarget,P(o),Z(v)}}}let k;function la(){k=void 0}function ua(t){let e=null,n=w;var r;if(w){for(e=h,k===void 0&&(k=L(document.head));k!==null&&(k.nodeType!==Wt||k.data!==pe);)k=j(k);k===null?bt(!1):k=D(j(k))}w||(r=document.head.appendChild(K()));try{Ie(()=>t(r),ve)}finally{n&&(bt(!0),k=h,D(e))}}function Jt(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function I(t,e){var n=_;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function fa(t,e){var n=(e&ln)!==0,r=(e&un)!==0,a,s=!t.startsWith("");return()=>{if(w)return I(h,null),h;a===void 0&&(a=Jt(s?t:""+t),n||(a=L(a)));var i=r||ke?document.importNode(a,!0):a.cloneNode(!0);if(n){var f=L(i),l=i.lastChild;I(f,l)}else I(i,i);return i}}function Bn(t,e,n="svg"){var r=!t.startsWith(""),a=`<${n}>${r?t:""+t}`,s;return()=>{if(w)return I(h,null),h;if(!s){var i=Jt(a),f=L(i);s=L(f)}var l=s.cloneNode(!0);return I(l,l),l}}function oa(t,e){return Bn(t,e,"svg")}function ca(t){return()=>Wn(t())}function Wn(t){if(w)return t;const e=t.nodeType===Ze,n=t.tagName==="SCRIPT"?[t]:t.querySelectorAll("script"),r=_;for(const s of n){const i=document.createElement("script");for(var a of s.attributes)i.setAttribute(a.name,a.value);i.textContent=s.textContent,(e?t.firstChild===s:t===s)&&(r.nodes_start=i),(e?t.lastChild===s:t===s)&&(r.nodes_end=i),s.replaceWith(i)}return t}function _a(t=""){if(!w){var e=K(t+"");return I(e,e),e}var n=h;return n.nodeType!==kt&&(n.before(n=K()),D(n)),I(n,n),n}function va(){if(w)return I(h,null),h;var t=document.createDocumentFragment(),e=document.createComment(""),n=K();return t.append(e,n),I(e,n),t}function da(t,e){if(w){_.nodes_end=h,he();return}t!==null&&t.before(e)}function pa(t,e,...n){var r=t,a=Ke,s;Ie(()=>{a!==(a=e())&&(s&&(X(s),s=null),s=Rn(()=>a(r,...n)))},Ht),w&&(r=h)}function ha(t){return(e,...n)=>{var r=t(...n),a;if(w)a=h,he();else{var s=r.render().trim(),i=Jt(s);a=L(i),e.before(a)}const f=r.setup?.(a);I(a,a),typeof f=="function"&&kn(f)}}export{xn as $,w as A,he as B,Tr as C,br as D,Ht as E,D as F,bt as G,fn as H,K as I,Rn as J,E as K,Vr as L,Xr as M,In as N,h as O,Gr as P,$r as Q,Ee as R,tt as S,Dr as T,g as U,kn as V,U as W,Pt as X,_ as Y,Zt as Z,dt as _,Ur as a,_a as a$,rr as a0,_r as a1,vt as a2,ct as a3,Tn as a4,Pr as a5,Z as a6,vr as a7,Nt as a8,cr as a9,er as aA,Yr as aB,Gn as aC,Vn as aD,Hn as aE,Wr as aF,Un as aG,ra as aH,la as aI,I as aJ,on as aK,$t as aL,cn as aM,ze as aN,tr as aO,fe as aP,nr as aQ,ha as aR,wn as aS,Nr as aT,xr as aU,kr as aV,Sr as aW,zr as aX,Zr as aY,H as aZ,Ir as a_,or as aa,$n as ab,Zn as ac,dr as ad,_t as ae,Hr as af,Dt as ag,jt as ah,Wt as ai,rt as aj,P as ak,Tt as al,yn as am,c as an,ee as ao,X as ap,At as aq,ar,yt as as,_e as at,j as au,mr as av,Fr as aw,L as ax,pe as ay,Gt as az,Jr as b,wr as b0,Mr as b1,gn as b2,yr as b3,ta as b4,sa as b5,ia as b6,na as b7,Or as b8,pr as b9,oe as ba,zn as bb,ea as bc,We as bd,ir as be,sr as bf,fr as bg,$ as bh,Fe as bi,Dn as bj,lr as bk,ur as bl,Qn as bm,hr as bn,aa as bo,oa as bp,Xn as bq,m as c,Kn as d,Qr as e,Kt as f,st as g,Ar as h,fa as i,jr as j,da as k,Cr as l,Lr as m,gr as n,va as o,Rr as p,ua as q,ce as r,qr as s,Kr as t,Br as u,pa as v,ca as w,Er as x,Ke as y,Ie as z}; diff --git a/server/playground/_app/immutable/chunks/BdnVOAET.js b/server/playground/_app/immutable/chunks/BdnVOAET.js new file mode 100644 index 0000000..aaa2ac7 --- /dev/null +++ b/server/playground/_app/immutable/chunks/BdnVOAET.js @@ -0,0 +1 @@ +import{c as d,u as g,a as l,b,r as i,d as m,g as p,e as h,f as v,h as k}from"./B7O2AcR_.js";function x(n=!1){const s=d,e=s.l.u;if(!e)return;let o=()=>h(s.s);if(n){let a=0,t={};const _=v(()=>{let c=!1;const r=s.s;for(const f in r)r[f]!==t[f]&&(t[f]=r[f],c=!0);return c&&a++,a});o=()=>p(_)}e.b.length&&g(()=>{u(s,o),i(e.b)}),l(()=>{const a=b(()=>e.m.map(m));return()=>{for(const t of a)typeof t=="function"&&t()}}),e.a.length&&l(()=>{u(s,o),i(e.a)})}function u(n,s){if(n.l.s)for(const e of n.l.s)p(e);s()}k();export{x as i}; diff --git a/server/playground/_app/immutable/chunks/C57w5sWn.js b/server/playground/_app/immutable/chunks/C57w5sWn.js new file mode 100644 index 0000000..acdf5d8 --- /dev/null +++ b/server/playground/_app/immutable/chunks/C57w5sWn.js @@ -0,0 +1,2 @@ +import{R as X,z,ap as w,J as B,P as D,A as S,aP as m,b0 as x,b1 as rr,V as er,b2 as fr,g as ir,b3 as tr,G as U,b4 as sr,b5 as ur,b6 as ar,b7 as lr,U as or,b8 as cr,b9 as nr,ba as vr,bb as dr,bc as br,bd as _r}from"./B7O2AcR_.js";function gr(r,i){if(i){const e=document.body;r.autofocus=!0,X(()=>{document.activeElement===e&&r.focus()})}}let V=!1;function hr(){V||(V=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{if(!r.defaultPrevented)for(const i of r.target.elements)i.__on_r?.()})},{capture:!0}))}function Ar(r,i){var e=void 0,f;z(()=>{e!==(e=i())&&(f&&(w(f),f=null),e&&(f=B(()=>{D(()=>e(r))})))})}function G(r){var i,e,f="";if(typeof r=="string"||typeof r=="number")f+=r;else if(typeof r=="object")if(Array.isArray(r)){var t=r.length;for(i=0;i=0;){var n=l+s;(l===0||R.includes(f[l-1]))&&(n===f.length||R.includes(f[n]))?f=(l===0?"":f.substring(0,l))+f.substring(n+1):l=n}}return f===""?null:f}function H(r,i=!1){var e=i?" !important;":";",f="";for(var t in r){var s=r[t];s!=null&&s!==""&&(f+=" "+t+": "+s+e)}return f}function P(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Er(r,i){if(i){var e="",f,t;if(Array.isArray(i)?(f=i[0],t=i[1]):f=i,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,l=0,n=!1,c=[];f&&c.push(...Object.keys(f).map(P)),t&&c.push(...Object.keys(t).map(P));var v=0,p=-1;const N=r.length;for(var d=0;d{M(r,r.__value)});i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),er(()=>{i.disconnect()})}function Y(r){return"__value"in r?r.__value:r.value}const T=Symbol("class"),y=Symbol("style"),K=Symbol("is custom element"),F=Symbol("is html");function Ir(r){if(S){var i=!1,e=()=>{if(!i){if(i=!0,r.hasAttribute("value")){var f=r.value;I(r,"value",null),r.value=f}if(r.hasAttribute("checked")){var t=r.checked;I(r,"checked",null),r.checked=t}}};r.__on_r=e,cr(e),hr()}}function Or(r,i){i?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function I(r,i,e,f){var t=J(r);S&&(t[i]=r.getAttribute(i),i==="src"||i==="srcset"||i==="href"&&r.nodeName==="LINK")||t[i]!==(t[i]=e)&&(i==="loading"&&(r[dr]=e),e==null?r.removeAttribute(i):typeof e!="string"&&Z(r).includes(i)?r[i]=e:r.setAttribute(i,e))}function Pr(r,i,e,f,t=!1,s=!1){if(S&&t&&r.tagName==="INPUT"){var l=r,n=l.type==="checkbox"?"defaultChecked":"defaultValue";n in e||Ir(l)}var c=J(r),v=c[K],p=!c[F];let d=S&&v;d&&U(!1);var u=i||{},A=r.tagName==="OPTION";for(var E in i)E in e||(e[E]=null);e.class?e.class=Nr(e.class):e[T]&&(e.class=null),e[y]&&(e.style??=null);var N=Z(r);for(const a in e){let o=e[a];if(A&&a==="value"&&o==null){r.value=r.__value="",u[a]=o;continue}if(a==="class"){var h=r.namespaceURI==="http://www.w3.org/1999/xhtml";Lr(r,h,o,f,i?.[T],e[T]),u[a]=o,u[T]=e[T];continue}if(a==="style"){Tr(r,o,i?.[y],e[y]),u[a]=o,u[y]=e[y];continue}var k=u[a];if(!(o===k&&!(o===void 0&&r.hasAttribute(a)))){u[a]=o;var $=a[0]+a[1];if($!=="$$")if($==="on"){const g={},L="$$"+a;let b=a.slice(2);var O=br(b);if(sr(b)&&(b=b.slice(0,-7),g.capture=!0),!O&&k){if(o!=null)continue;r.removeEventListener(b,u[L],g),u[L]=null}if(o!=null)if(O)r[`__${b}`]=o,ar([b]);else{let Q=function(W){u[a].call(this,W)};u[L]=ur(b,r,Q,g)}else O&&(r[`__${b}`]=void 0)}else if(a==="style")I(r,a,o);else if(a==="autofocus")gr(r,!!o);else if(!v&&(a==="__value"||a==="value"&&o!=null))r.value=r.__value=o;else if(a==="selected"&&A)Or(r,o);else{var _=a;p||(_=lr(_));var j=_==="defaultValue"||_==="defaultChecked";if(o==null&&!v&&!j)if(c[a]=null,_==="value"||_==="checked"){let g=r;const L=i===void 0;if(_==="value"){let b=g.defaultValue;g.removeAttribute(_),g.defaultValue=b,g.value=g.__value=L?b:null}else{let b=g.defaultChecked;g.removeAttribute(_),g.defaultChecked=b,g.checked=L?b:!1}}else r.removeAttribute(a);else j||N.includes(_)&&(v||typeof o!="string")?(r[_]=o,_ in c&&(c[_]=or)):typeof o!="function"&&I(r,_,o)}}}return d&&U(!0),u}function wr(r,i,e=[],f=[],t,s=!1,l=!1){fr(e,f,n=>{var c=void 0,v={},p=r.nodeName==="SELECT",d=!1;if(z(()=>{var A=i(...n.map(ir)),E=Pr(r,c,A,t,s,l);d&&p&&"value"in A&&M(r,A.value);for(let h of Object.getOwnPropertySymbols(v))A[h]||w(v[h]);for(let h of Object.getOwnPropertySymbols(A)){var N=A[h];h.description===tr&&(!c||N!==c[h])&&(v[h]&&w(v[h]),v[h]=B(()=>Ar(r,()=>N))),E[h]=N}c=E}),p){var u=r;D(()=>{M(u,c.value,!0),yr(u)})}d=!0})}function J(r){return r.__attributes??={[K]:r.nodeName.includes("-"),[F]:r.namespaceURI===nr}}var q=new Map;function Z(r){var i=r.getAttribute("is")||r.nodeName,e=q.get(i);if(e)return e;q.set(i,e=[]);for(var f,t=r,s=Element.prototype;s!==t;){f=_r(t);for(var l in f)f[l].set&&e.push(l);t=vr(t)}return e}export{wr as a,Lr as b,Nr as c,I as s}; diff --git a/server/playground/_app/immutable/chunks/D02mbrNz.js b/server/playground/_app/immutable/chunks/D02mbrNz.js new file mode 100644 index 0000000..086ee0e --- /dev/null +++ b/server/playground/_app/immutable/chunks/D02mbrNz.js @@ -0,0 +1,2 @@ +import{af as X,g as $,Z as j,Q as Z,b as y,ag as I,R as U,O as p,A as g,ah as ee,Y as R,z as te,B as se,ai as M,H as ne,J as d,aj as C,N as D,a6 as L,ak as E,al as P,am as ie,an as A,c as f,ao as ae,ap as N,F as S,x as re,D as oe,aq as z,ar as le,E as ue,as as fe,at as ce,au as V,av as he,aw as k,ax as _e,ay as de,az as O,G as w,aA as pe,aB as ge,aC as be,aD as ve,aE as B,aF as ye,aG as T,aH as me,I as Ee,aI as we,p as Te,aJ as Re,aK as xe,aL as Ae,l as Se,y as x,aM as Ce,aN as m,a as De,aO as Ne,aP as ke,aQ as W,a8 as Oe,aR as Fe,aS as Me,aT as Ye,aU as qe,aV as He,aW as Ie,aX as Le,aY as Pe}from"./B7O2AcR_.js";function ze(t){let e=0,s=j(0),n;return()=>{X()&&($(s),Z(()=>(e===0&&(n=y(()=>t(()=>I(s)))),e+=1,()=>{U(()=>{e-=1,e===0&&(n?.(),n=void 0,I(s))})})))}}var Be=ue|fe|ce;function $e(t,e,s){new je(t,e,s)}class je{parent;#n=!1;#t;#p=g?p:null;#i;#f;#a;#s=null;#e=null;#r=null;#o=null;#c=0;#l=0;#h=!1;#u=null;#b=()=>{this.#u&&ee(this.#u,this.#c)};#v=ze(()=>(this.#u=j(this.#c),()=>{this.#u=null}));constructor(e,s,n){this.#t=e,this.#i=s,this.#f=n,this.parent=R.b,this.#n=!!this.#i.pending,this.#a=te(()=>{if(R.b=this,g){const i=this.#p;se(),i.nodeType===M&&i.data===ne?this.#m():this.#y()}else{try{this.#s=d(()=>n(this.#t))}catch(i){this.error(i)}this.#l>0?this.#d():this.#n=!1}},Be),g&&(this.#t=p)}#y(){try{this.#s=d(()=>this.#f(this.#t))}catch(e){this.error(e)}this.#n=!1}#m(){const e=this.#i.pending;e&&(this.#e=d(()=>e(this.#t)),C.enqueue(()=>{this.#s=this.#_(()=>(C.ensure(),d(()=>this.#f(this.#t)))),this.#l>0?this.#d():(D(this.#e,()=>{this.#e=null}),this.#n=!1)}))}is_pending(){return this.#n||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#i.pending}#_(e){var s=R,n=A,i=f;L(this.#a),E(this.#a),P(this.#a.ctx);try{return e()}catch(a){return ie(a),null}finally{L(s),E(n),P(i)}}#d(){const e=this.#i.pending;this.#s!==null&&(this.#o=document.createDocumentFragment(),Ue(this.#s,this.#o)),this.#e===null&&(this.#e=d(()=>e(this.#t)))}#g(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#g(e);return}this.#l+=e,this.#l===0&&(this.#n=!1,this.#e&&D(this.#e,()=>{this.#e=null}),this.#o&&(this.#t.before(this.#o),this.#o=null))}update_pending_count(e){this.#g(e),this.#c+=e,ae.add(this.#b)}get_effect_pending(){return this.#v(),$(this.#u)}error(e){var s=this.#i.onerror;let n=this.#i.failed;if(this.#h||!s&&!n)throw e;this.#s&&(N(this.#s),this.#s=null),this.#e&&(N(this.#e),this.#e=null),this.#r&&(N(this.#r),this.#r=null),g&&(S(this.#p),re(),S(oe()));var i=!1,a=!1;const o=()=>{if(i){he();return}i=!0,a&&le(),C.ensure(),this.#c=0,this.#r!==null&&D(this.#r,()=>{this.#r=null}),this.#n=this.has_pending_snippet(),this.#s=this.#_(()=>(this.#h=!1,d(()=>this.#f(this.#t)))),this.#l>0?this.#d():this.#n=!1};var r=A;try{E(null),a=!0,s?.(e,o),a=!1}catch(h){z(h,this.#a&&this.#a.parent)}finally{E(r)}n&&U(()=>{this.#r=this.#_(()=>{this.#h=!0;try{return d(()=>{n(this.#t,()=>e,()=>o)})}catch(h){return z(h,this.#a.parent),null}finally{this.#h=!1}})})}}function Ue(t,e){for(var s=t.nodes_start,n=t.nodes_end;s!==null;){var i=s===n?null:V(s);e.append(s),s=i}}function nt(t,e){var s=e==null?"":typeof e=="object"?e+"":e;s!==(t.__t??=t.nodeValue)&&(t.__t=s,t.nodeValue=s+"")}function G(t,e){return J(t,e)}function Ve(t,e){k(),e.intro=e.intro??!1;const s=e.target,n=g,i=p;try{for(var a=_e(s);a&&(a.nodeType!==M||a.data!==de);)a=V(a);if(!a)throw O;w(!0),S(a);const o=J(t,{...e,anchor:a});return w(!1),o}catch(o){if(o instanceof Error&&o.message.split(` +`).some(r=>r.startsWith("https://svelte.dev/e/")))throw o;return o!==O&&console.warn("Failed to hydrate: ",o),e.recover===!1&&pe(),k(),ge(s),w(!1),G(t,e)}finally{w(n),S(i),we()}}const b=new Map;function J(t,{target:e,anchor:s,props:n={},events:i,context:a,intro:o=!0}){k();var r=new Set,h=_=>{for(var c=0;c<_.length;c++){var u=_[c];if(!r.has(u)){r.add(u);var q=me(u);e.addEventListener(u,T,{passive:q});var H=b.get(u);H===void 0?(document.addEventListener(u,T,{passive:q}),b.set(u,1)):b.set(u,H+1)}}};h(be(ve)),B.add(h);var l=void 0,K=ye(()=>{var _=s??e.appendChild(Ee());return $e(_,{pending:()=>{}},c=>{if(a){Te({});var u=f;u.c=a}if(i&&(n.$$events=i),g&&Re(c,null),l=t(c,n)||{},g&&(R.nodes_end=p,p===null||p.nodeType!==M||p.data!==xe))throw Ae(),O;a&&Se()}),()=>{for(var c of r){e.removeEventListener(c,T);var u=b.get(c);--u===0?(document.removeEventListener(c,T),b.delete(c)):b.set(c,u)}B.delete(h),_!==s&&_.parentNode?.removeChild(_)}});return F.set(l,K),l}let F=new WeakMap;function We(t,e){const s=F.get(t);return s?(F.delete(t),s(e)):Promise.resolve()}function Ge(t,e,s){if(t==null)return e(void 0),x;const n=y(()=>t.subscribe(e,s));return n.unsubscribe?()=>n.unsubscribe():n}const v=[];function it(t,e){return{subscribe:Je(t,e).subscribe}}function Je(t,e=x){let s=null;const n=new Set;function i(r){if(Ce(t,r)&&(t=r,s)){const h=!v.length;for(const l of n)l[1](),v.push(l,t);if(h){for(let l=0;l{n.delete(l),n.size===0&&s&&(s(),s=null)}}return{set:i,update:a,subscribe:o}}function at(t){let e;return Ge(t,s=>e=s)(),e}function Qe(){return A===null&&Ne(),(A.ac??=new AbortController).signal}function Q(t){f===null&&m(),Oe&&f.l!==null?Y(f).m.push(t):De(()=>{const e=y(t);if(typeof e=="function")return e})}function Ke(t){f===null&&m(),Q(()=>()=>y(t))}function Xe(t,e,{bubbles:s=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:s,cancelable:n})}function Ze(){const t=f;return t===null&&m(),(e,s,n)=>{const i=t.s.$$events?.[e];if(i){const a=ke(i)?i.slice():[i],o=Xe(e,s,n);for(const r of a)r.call(t.x,o);return!o.defaultPrevented}return!0}}function et(t){f===null&&m(),f.l===null&&W(),Y(f).b.push(t)}function tt(t){f===null&&m(),f.l===null&&W(),Y(f).a.push(t)}function Y(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}const rt=Object.freeze(Object.defineProperty({__proto__:null,afterUpdate:tt,beforeUpdate:et,createEventDispatcher:Ze,createRawSnippet:Fe,flushSync:Me,getAbortSignal:Qe,getAllContexts:Ye,getContext:qe,hasContext:He,hydrate:Ve,mount:G,onDestroy:Ke,onMount:Q,setContext:Ie,settled:Le,tick:Pe,unmount:We,untrack:y},Symbol.toStringTag,{value:"Module"}));export{Ge as a,Ke as b,rt as c,at as g,Ve as h,G as m,Q as o,it as r,nt as s,We as u,Je as w}; diff --git a/server/playground/_app/immutable/chunks/DsnmJJEf.js b/server/playground/_app/immutable/chunks/DsnmJJEf.js new file mode 100644 index 0000000..ca27dc7 --- /dev/null +++ b/server/playground/_app/immutable/chunks/DsnmJJEf.js @@ -0,0 +1 @@ +typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5"); diff --git a/server/playground/_app/immutable/chunks/PDm5JBFr.js b/server/playground/_app/immutable/chunks/PDm5JBFr.js new file mode 100644 index 0000000..0b2360a --- /dev/null +++ b/server/playground/_app/immutable/chunks/PDm5JBFr.js @@ -0,0 +1 @@ +import{z as K,A as y,B as j,E as q,C as Z,H as $,D as z,F as G,G as x,I as H,J as D,K as J,U as Q,L as V,M as W,N as X,O as k,P as ee,Q as re,b as B,R as ne,S as A,y as N,T as se,g as P,V as ie,W as M,X as ae,Y as m,Z as te,_ as R,a0 as ue,a1 as C,a2 as fe,a3 as le,f as ce,a4 as oe,a5 as L,a6 as U,a7 as de,a8 as _e,a9 as pe,aa as ve,ab as S,ac as F,ad as be,ae as he}from"./B7O2AcR_.js";import{a as Se,g as Pe}from"./D02mbrNz.js";function Re(e,r,s=!1){y&&j();var n=e,i=null,a=null,l=Q,d=s?q:0,p=!1;const I=(c,u=!0)=>{p=!0,_(u,c)};var f=null;function g(){f!==null&&(f.lastChild.remove(),n.before(f),f=null);var c=l?i:a,u=l?a:i;c&&W(c),u&&X(u,()=>{l?a=null:i=null})}const _=(c,u)=>{if(l===(l=c))return;let E=!1;if(y){const O=Z(n)===$;!!l===O&&(n=z(),G(n),x(!1),E=!0)}var b=V(),o=n;if(b&&(f=document.createDocumentFragment(),f.append(o=H())),l?i??=u&&D(()=>u(o)):a??=u&&D(()=>u(o)),b){var h=J,t=l?i:a,v=l?a:i;t&&h.skipped_effects.delete(t),v&&h.skipped_effects.add(v),h.add_callback(g)}else g();E&&x(!0)};K(()=>{p=!1,r(I),p||_(null,null)},d),y&&(n=k)}function Y(e,r){return e===r||e?.[A]===r}function we(e={},r,s,n){return ee(()=>{var i,a;return re(()=>{i=a,a=[],B(()=>{e!==s(...a)&&(r(e,...a),i&&Y(s(...i),e)&&r(null,...i))})}),()=>{ne(()=>{a&&Y(s(...a),e)&&r(null,...a)})}}),e}let T=!1,w=Symbol();function Ae(e,r,s){const n=s[r]??={store:null,source:se(void 0),unsubscribe:N};if(n.store!==e&&!(w in s))if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=N;else{var i=!0;n.unsubscribe=Se(e,a=>{i?n.source.v=a:M(n.source,a)}),i=!1}return e&&w in s?Pe(e):P(n.source)}function me(){const e={};function r(){ie(()=>{for(var s in e)e[s].unsubscribe();ae(e,w,{enumerable:!1,value:!0})})}return[e,r]}function Ie(e){var r=T;try{return T=!1,[e(),T]}finally{T=r}}const ge={get(e,r){if(!e.exclude.includes(r))return P(e.version),r in e.special?e.special[r]():e.props[r]},set(e,r,s){if(!(r in e.special)){var n=m;try{U(e.parent_effect),e.special[r]=Oe({get[r](){return e.props[r]}},r,C)}finally{U(n)}}return e.special[r](s),L(e.version),!0},getOwnPropertyDescriptor(e,r){if(!e.exclude.includes(r)&&r in e.props)return{enumerable:!0,configurable:!0,value:e.props[r]}},deleteProperty(e,r){return e.exclude.includes(r)||(e.exclude.push(r),L(e.version)),!0},has(e,r){return e.exclude.includes(r)?!1:r in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(r=>!e.exclude.includes(r))}};function xe(e,r){return new Proxy({props:e,exclude:r,special:{},version:te(0),parent_effect:m},ge)}const Ee={get(e,r){let s=e.props.length;for(;s--;){let n=e.props[s];if(S(n)&&(n=n()),typeof n=="object"&&n!==null&&r in n)return n[r]}},set(e,r,s){let n=e.props.length;for(;n--;){let i=e.props[n];S(i)&&(i=i());const a=R(i,r);if(a&&a.set)return a.set(s),!0}return!1},getOwnPropertyDescriptor(e,r){let s=e.props.length;for(;s--;){let n=e.props[s];if(S(n)&&(n=n()),typeof n=="object"&&n!==null&&r in n){const i=R(n,r);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,r){if(r===A||r===F)return!1;for(let s of e.props)if(S(s)&&(s=s()),s!=null&&r in s)return!0;return!1},ownKeys(e){const r=[];for(let s of e.props)if(S(s)&&(s=s()),!!s){for(const n in s)r.includes(n)||r.push(n);for(const n of Object.getOwnPropertySymbols(s))r.includes(n)||r.push(n)}return r}};function De(...e){return new Proxy({props:e},Ee)}function Oe(e,r,s,n){var i=!_e||(s&pe)!==0,a=(s&de)!==0,l=(s&be)!==0,d=n,p=!0,I=()=>(p&&(p=!1,d=l?B(n):n),d),f;if(a){var g=A in e||F in e;f=R(e,r)?.set??(g&&r in e?t=>e[r]=t:void 0)}var _,c=!1;a?[_,c]=Ie(()=>e[r]):_=e[r],_===void 0&&n!==void 0&&(_=I(),f&&(i&&ue(),f(_)));var u;if(i?u=()=>{var t=e[r];return t===void 0?I():(p=!0,t)}:u=()=>{var t=e[r];return t!==void 0&&(d=void 0),t===void 0?d:t},i&&(s&C)===0)return u;if(f){var E=e.$$legacy;return(function(t,v){return arguments.length>0?((!i||!v||E||c)&&f(v?u():t),t):u()})}var b=!1,o=((s&ve)!==0?ce:oe)(()=>(b=!1,u()));a&&P(o);var h=m;return(function(t,v){if(arguments.length>0){const O=v?P(o):i&&a?fe(t):t;return M(o,O),b=!0,d!==void 0&&(d=O),t}return he&&b||(h.f&le)!==0?o.v:P(o)})}export{Ae as a,we as b,me as c,Re as i,xe as l,Oe as p,De as s}; diff --git a/server/playground/_app/immutable/entry/app.BoM88Pvd.js b/server/playground/_app/immutable/entry/app.BoM88Pvd.js new file mode 100644 index 0000000..da8cdb4 --- /dev/null +++ b/server/playground/_app/immutable/entry/app.BoM88Pvd.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CmhkmvAc.js","../chunks/DsnmJJEf.js","../chunks/B7O2AcR_.js","../chunks/C57w5sWn.js","../assets/0.z6k2NkFs.css","../nodes/1.DTuMUC1g.js","../chunks/BdnVOAET.js","../chunks/D02mbrNz.js","../chunks/B4cBSMmy.js","../nodes/2.DJDSYz4L.js","../chunks/PDm5JBFr.js","../assets/2.DQ5mJGGf.css"])))=>i.map(i=>d[i]); +import{A as D,B as W,z as Y,E as z,I as G,J,K as I,L as K,O as X,N as Z,W as w,ac as H,g as d,aS as Q,X as $,T as ee,p as te,u as re,a as se,aZ as x,aY as ae,i as M,j as R,s as ne,k as P,l as oe,o as S,m as ce,n as ie,a_ as O,a$ as le,t as ue}from"../chunks/B7O2AcR_.js";import{h as fe,m as de,u as me,o as he,s as _e}from"../chunks/D02mbrNz.js";import"../chunks/DsnmJJEf.js";import{p as A,i as C,b as L}from"../chunks/PDm5JBFr.js";function T(l,e,a){D&&W();var o=l,n,r,t=null,s=null;function m(){r&&(Z(r),r=null),t&&(t.lastChild.remove(),o.before(t),t=null),r=s,s=null}Y(()=>{if(n!==(n=e())){var h=K();if(n){var c=o;h&&(t=document.createDocumentFragment(),t.append(c=G()),r&&I.skipped_effects.add(r)),s=J(()=>a(c,n))}h?I.add_callback(m):m()}},z),D&&(o=X)}function ve(l){return class extends ge{constructor(e){super({component:l,...e})}}}class ge{#t;#e;constructor(e){var a=new Map,o=(r,t)=>{var s=ee(t,!1,!1);return a.set(r,s),s};const n=new Proxy({...e.props||{},$$events:{}},{get(r,t){return d(a.get(t)??o(t,Reflect.get(r,t)))},has(r,t){return t===H?!0:(d(a.get(t)??o(t,Reflect.get(r,t))),Reflect.has(r,t))},set(r,t,s){return w(a.get(t)??o(t,s),s),Reflect.set(r,t,s)}});this.#e=(e.hydrate?fe:de)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&Q(),this.#t=n.$$events;for(const r of Object.keys(this.#e))r==="$set"||r==="$destroy"||r==="$on"||$(this,r,{get(){return this.#e[r]},set(t){this.#e[r]=t},enumerable:!0});this.#e.$set=r=>{Object.assign(n,r)},this.#e.$destroy=()=>{me(this.#e)}}$set(e){this.#e.$set(e)}$on(e,a){this.#t[e]=this.#t[e]||[];const o=(...n)=>a.call(this,...n);return this.#t[e].push(o),()=>{this.#t[e]=this.#t[e].filter(n=>n!==o)}}$destroy(){this.#e.$destroy()}}const ye="modulepreload",be=function(l,e){return new URL(l,e).href},F={},j=function(e,a,o){let n=Promise.resolve();if(a&&a.length>0){let h=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};const t=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),m=s?.nonce||s?.getAttribute("nonce");n=h(a.map(c=>{if(c=be(c,o),c in F)return;F[c]=!0;const f=c.endsWith(".css"),_=f?'[rel="stylesheet"]':"";if(o)for(let v=t.length-1;v>=0;v--){const i=t[v];if(i.href===c&&(!f||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${_}`))return;const u=document.createElement("link");if(u.rel=f?"stylesheet":ye,f||(u.as="script"),u.crossOrigin="",u.href=c,m&&u.setAttribute("nonce",m),document.head.appendChild(u),f)return new Promise((v,i)=>{u.addEventListener("load",v),u.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(t){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=t,window.dispatchEvent(s),!s.defaultPrevented)throw t}return n.then(t=>{for(const s of t||[])s.status==="rejected"&&r(s.reason);return e().catch(r)})},Ce={};var Ee=M('
'),Pe=M(" ",1);function pe(l,e){te(e,!0);let a=A(e,"components",23,()=>[]),o=A(e,"data_0",3,null),n=A(e,"data_1",3,null);re(()=>e.stores.page.set(e.page)),se(()=>{e.stores,e.page,e.constructors,a(),e.form,o(),n(),e.stores.page.notify()});let r=x(!1),t=x(!1),s=x(null);he(()=>{const i=e.stores.page.subscribe(()=>{d(r)&&(w(t,!0),ae().then(()=>{w(s,document.title||"untitled page",!0)}))});return w(r,!0),i});const m=O(()=>e.constructors[1]);var h=Pe(),c=R(h);{var f=i=>{const g=O(()=>e.constructors[0]);var y=S(),p=R(y);T(p,()=>d(g),(b,E)=>{L(E(b,{get data(){return o()},get form(){return e.form},get params(){return e.page.params},children:(k,we)=>{var N=S(),V=R(N);T(V,()=>d(m),(q,B)=>{L(B(q,{get data(){return n()},get form(){return e.form},get params(){return e.page.params}}),U=>a()[1]=U,()=>a()?.[1])}),P(k,N)},$$slots:{default:!0}}),k=>a()[0]=k,()=>a()?.[0])}),P(i,y)},_=i=>{const g=O(()=>e.constructors[0]);var y=S(),p=R(y);T(p,()=>d(g),(b,E)=>{L(E(b,{get data(){return o()},get form(){return e.form},get params(){return e.page.params}}),k=>a()[0]=k,()=>a()?.[0])}),P(i,y)};C(c,i=>{e.constructors[1]?i(f):i(_,!1)})}var u=ne(c,2);{var v=i=>{var g=Ee(),y=ce(g);{var p=b=>{var E=le();ue(()=>_e(E,d(s))),P(b,E)};C(y,b=>{d(t)&&b(p)})}ie(g),P(i,g)};C(u,i=>{d(r)&&i(v)})}P(l,h),oe()}const Le=ve(pe),Te=[()=>j(()=>import("../nodes/0.CmhkmvAc.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>j(()=>import("../nodes/1.DTuMUC1g.js"),__vite__mapDeps([5,1,6,2,7,8]),import.meta.url),()=>j(()=>import("../nodes/2.DJDSYz4L.js"),__vite__mapDeps([9,1,6,2,10,7,3,11]),import.meta.url)],je=[],Ne={"/":[2]},ke={handleError:(({error:l})=>{console.error(l)}),reroute:(()=>{}),transport:{}},Re=Object.fromEntries(Object.entries(ke.transport).map(([l,e])=>[l,e.decode])),De=!1,Ie=(l,e)=>Re[l](e);export{Ie as decode,Re as decoders,Ne as dictionary,De as hash,ke as hooks,Ce as matchers,Te as nodes,Le as root,je as server_loads}; diff --git a/server/playground/_app/immutable/entry/start.CICsRs5_.js b/server/playground/_app/immutable/entry/start.CICsRs5_.js new file mode 100644 index 0000000..5ff32f4 --- /dev/null +++ b/server/playground/_app/immutable/entry/start.CICsRs5_.js @@ -0,0 +1 @@ +import{l as o,a as r}from"../chunks/B4cBSMmy.js";export{o as load_css,r as start}; diff --git a/server/playground/_app/immutable/nodes/0.CmhkmvAc.js b/server/playground/_app/immutable/nodes/0.CmhkmvAc.js new file mode 100644 index 0000000..d8f9b89 --- /dev/null +++ b/server/playground/_app/immutable/nodes/0.CmhkmvAc.js @@ -0,0 +1 @@ +import"../chunks/DsnmJJEf.js";import{o as c,q as f,j as a,v as p,k as l,w as m,$ as v,x as d,t as _,y as g,i as h}from"../chunks/B7O2AcR_.js";import{s as u}from"../chunks/C57w5sWn.js";const w=!0,M=Object.freeze(Object.defineProperty({__proto__:null,prerender:w},Symbol.toStringTag,{value:"Module"})),y="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='107'%20height='128'%20viewBox='0%200%20107%20128'%3e%3ctitle%3esvelte-logo%3c/title%3e%3cpath%20d='M94.157%2022.819c-10.4-14.885-30.94-19.297-45.792-9.835L22.282%2029.608A29.92%2029.92%200%200%200%208.764%2049.65a31.5%2031.5%200%200%200%203.108%2020.231%2030%2030%200%200%200-4.477%2011.183%2031.9%2031.9%200%200%200%205.448%2024.116c10.402%2014.887%2030.942%2019.297%2045.791%209.835l26.083-16.624A29.92%2029.92%200%200%200%2098.235%2078.35a31.53%2031.53%200%200%200-3.105-20.232%2030%2030%200%200%200%204.474-11.182%2031.88%2031.88%200%200%200-5.447-24.116'%20style='fill:%23ff3e00'/%3e%3cpath%20d='M45.817%20106.582a20.72%2020.72%200%200%201-22.237-8.243%2019.17%2019.17%200%200%201-3.277-14.503%2018%2018%200%200%201%20.624-2.435l.49-1.498%201.337.981a33.6%2033.6%200%200%200%2010.203%205.098l.97.294-.09.968a5.85%205.85%200%200%200%201.052%203.878%206.24%206.24%200%200%200%206.695%202.485%205.8%205.8%200%200%200%201.603-.704L69.27%2076.28a5.43%205.43%200%200%200%202.45-3.631%205.8%205.8%200%200%200-.987-4.371%206.24%206.24%200%200%200-6.698-2.487%205.7%205.7%200%200%200-1.6.704l-9.953%206.345a19%2019%200%200%201-5.296%202.326%2020.72%2020.72%200%200%201-22.237-8.243%2019.17%2019.17%200%200%201-3.277-14.502%2017.99%2017.99%200%200%201%208.13-12.052l26.081-16.623a19%2019%200%200%201%205.3-2.329%2020.72%2020.72%200%200%201%2022.237%208.243%2019.17%2019.17%200%200%201%203.277%2014.503%2018%2018%200%200%201-.624%202.435l-.49%201.498-1.337-.98a33.6%2033.6%200%200%200-10.203-5.1l-.97-.294.09-.968a5.86%205.86%200%200%200-1.052-3.878%206.24%206.24%200%200%200-6.696-2.485%205.8%205.8%200%200%200-1.602.704L37.73%2051.72a5.42%205.42%200%200%200-2.449%203.63%205.79%205.79%200%200%200%20.986%204.372%206.24%206.24%200%200%200%206.698%202.486%205.8%205.8%200%200%200%201.602-.704l9.952-6.342a19%2019%200%200%201%205.295-2.328%2020.72%2020.72%200%200%201%2022.237%208.242%2019.17%2019.17%200%200%201%203.277%2014.503%2018%2018%200%200%201-8.13%2012.053l-26.081%2016.622a19%2019%200%200%201-5.3%202.328'%20style='fill:%23fff'/%3e%3c/svg%3e";var x=m(h(' + + + + + + + + + + + + + + Marka Playground + + +
logo

Marka

Bidirectional Markdown ↔ JSON Parser

Template

Define your mapping schema

Loading editor...

Markdown

Your source content

Loading editor...

---
+_type: Recipe
+author.name: Max Richter
+---
+
+# Baguette
+
+My favourite baguette recipe
+
+## Ingredients
+- Flour
+- Water
+- Salt
+
+## Steps
+1. Mix Flour Water and Salt
+2. Bake the bread

Data

Parsed JSON output

Loading editor...

+ + +
+ + diff --git a/server/playground/logo-2.svg b/server/playground/logo-2.svg new file mode 100644 index 0000000..0d59cff --- /dev/null +++ b/server/playground/logo-2.svg @@ -0,0 +1,3 @@ + + + diff --git a/server/playground/logo.svg b/server/playground/logo.svg new file mode 100644 index 0000000..e4f85db --- /dev/null +++ b/server/playground/logo.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/server/playground/main.wasm b/server/playground/main.wasm new file mode 100644 index 0000000..a68d48f Binary files /dev/null and b/server/playground/main.wasm differ diff --git a/server/playground/robots.txt b/server/playground/robots.txt new file mode 100644 index 0000000..b6dd667 --- /dev/null +++ b/server/playground/robots.txt @@ -0,0 +1,3 @@ +# allow crawling everything by default +User-agent: * +Disallow: diff --git a/server/playground/wasm_exec.js b/server/playground/wasm_exec.js new file mode 100644 index 0000000..53ea75f --- /dev/null +++ b/server/playground/wasm_exec.js @@ -0,0 +1,553 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// This file has been modified for use by the TinyGo compiler. + +(() => { + // Map multiple JavaScript environments to a single common API, + // preferring web standards over Node.js API. + // + // Environments considered: + // - Browsers + // - Node.js + // - Electron + // - Parcel + + if (typeof global !== "undefined") { + // global already exists + } else if (typeof window !== "undefined") { + window.global = window; + } else if (typeof self !== "undefined") { + self.global = self; + } else { + throw new Error("cannot export Go (neither global, window nor self is defined)"); + } + + if (!global.require && typeof require !== "undefined") { + global.require = require; + } + + if (!global.fs && global.require) { + global.fs = require("node:fs"); + } + + const enosys = () => { + const err = new Error("not implemented"); + err.code = "ENOSYS"; + return err; + }; + + if (!global.fs) { + let outputBuf = ""; + global.fs = { + constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused + writeSync(fd, buf) { + outputBuf += decoder.decode(buf); + const nl = outputBuf.lastIndexOf("\n"); + if (nl != -1) { + console.log(outputBuf.substr(0, nl)); + outputBuf = outputBuf.substr(nl + 1); + } + return buf.length; + }, + write(fd, buf, offset, length, position, callback) { + if (offset !== 0 || length !== buf.length || position !== null) { + callback(enosys()); + return; + } + const n = this.writeSync(fd, buf); + callback(null, n); + }, + chmod(path, mode, callback) { callback(enosys()); }, + chown(path, uid, gid, callback) { callback(enosys()); }, + close(fd, callback) { callback(enosys()); }, + fchmod(fd, mode, callback) { callback(enosys()); }, + fchown(fd, uid, gid, callback) { callback(enosys()); }, + fstat(fd, callback) { callback(enosys()); }, + fsync(fd, callback) { callback(null); }, + ftruncate(fd, length, callback) { callback(enosys()); }, + lchown(path, uid, gid, callback) { callback(enosys()); }, + link(path, link, callback) { callback(enosys()); }, + lstat(path, callback) { callback(enosys()); }, + mkdir(path, perm, callback) { callback(enosys()); }, + open(path, flags, mode, callback) { callback(enosys()); }, + read(fd, buffer, offset, length, position, callback) { callback(enosys()); }, + readdir(path, callback) { callback(enosys()); }, + readlink(path, callback) { callback(enosys()); }, + rename(from, to, callback) { callback(enosys()); }, + rmdir(path, callback) { callback(enosys()); }, + stat(path, callback) { callback(enosys()); }, + symlink(path, link, callback) { callback(enosys()); }, + truncate(path, length, callback) { callback(enosys()); }, + unlink(path, callback) { callback(enosys()); }, + utimes(path, atime, mtime, callback) { callback(enosys()); }, + }; + } + + if (!global.process) { + global.process = { + getuid() { return -1; }, + getgid() { return -1; }, + geteuid() { return -1; }, + getegid() { return -1; }, + getgroups() { throw enosys(); }, + pid: -1, + ppid: -1, + umask() { throw enosys(); }, + cwd() { throw enosys(); }, + chdir() { throw enosys(); }, + } + } + + if (!global.crypto) { + const nodeCrypto = require("node:crypto"); + global.crypto = { + getRandomValues(b) { + nodeCrypto.randomFillSync(b); + }, + }; + } + + if (!global.performance) { + global.performance = { + now() { + const [sec, nsec] = process.hrtime(); + return sec * 1000 + nsec / 1000000; + }, + }; + } + + if (!global.TextEncoder) { + global.TextEncoder = require("node:util").TextEncoder; + } + + if (!global.TextDecoder) { + global.TextDecoder = require("node:util").TextDecoder; + } + + // End of polyfills for common API. + + const encoder = new TextEncoder("utf-8"); + const decoder = new TextDecoder("utf-8"); + let reinterpretBuf = new DataView(new ArrayBuffer(8)); + var logLine = []; + const wasmExit = {}; // thrown to exit via proc_exit (not an error) + + global.Go = class { + constructor() { + this._callbackTimeouts = new Map(); + this._nextCallbackTimeoutID = 1; + + const mem = () => { + // The buffer may change when requesting more memory. + return new DataView(this._inst.exports.memory.buffer); + } + + const unboxValue = (v_ref) => { + reinterpretBuf.setBigInt64(0, v_ref, true); + const f = reinterpretBuf.getFloat64(0, true); + if (f === 0) { + return undefined; + } + if (!isNaN(f)) { + return f; + } + + const id = v_ref & 0xffffffffn; + return this._values[id]; + } + + + const loadValue = (addr) => { + let v_ref = mem().getBigUint64(addr, true); + return unboxValue(v_ref); + } + + const boxValue = (v) => { + const nanHead = 0x7FF80000n; + + if (typeof v === "number") { + if (isNaN(v)) { + return nanHead << 32n; + } + if (v === 0) { + return (nanHead << 32n) | 1n; + } + reinterpretBuf.setFloat64(0, v, true); + return reinterpretBuf.getBigInt64(0, true); + } + + switch (v) { + case undefined: + return 0n; + case null: + return (nanHead << 32n) | 2n; + case true: + return (nanHead << 32n) | 3n; + case false: + return (nanHead << 32n) | 4n; + } + + let id = this._ids.get(v); + if (id === undefined) { + id = this._idPool.pop(); + if (id === undefined) { + id = BigInt(this._values.length); + } + this._values[id] = v; + this._goRefCounts[id] = 0; + this._ids.set(v, id); + } + this._goRefCounts[id]++; + let typeFlag = 1n; + switch (typeof v) { + case "string": + typeFlag = 2n; + break; + case "symbol": + typeFlag = 3n; + break; + case "function": + typeFlag = 4n; + break; + } + return id | ((nanHead | typeFlag) << 32n); + } + + const storeValue = (addr, v) => { + let v_ref = boxValue(v); + mem().setBigUint64(addr, v_ref, true); + } + + const loadSlice = (array, len, cap) => { + return new Uint8Array(this._inst.exports.memory.buffer, array, len); + } + + const loadSliceOfValues = (array, len, cap) => { + const a = new Array(len); + for (let i = 0; i < len; i++) { + a[i] = loadValue(array + i * 8); + } + return a; + } + + const loadString = (ptr, len) => { + return decoder.decode(new DataView(this._inst.exports.memory.buffer, ptr, len)); + } + + const timeOrigin = Date.now() - performance.now(); + this.importObject = { + wasi_snapshot_preview1: { + // https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_write + fd_write: function(fd, iovs_ptr, iovs_len, nwritten_ptr) { + let nwritten = 0; + if (fd == 1) { + for (let iovs_i=0; iovs_i 0, // dummy + fd_fdstat_get: () => 0, // dummy + fd_seek: () => 0, // dummy + proc_exit: (code) => { + this.exited = true; + this.exitCode = code; + this._resolveExitPromise(); + throw wasmExit; + }, + random_get: (bufPtr, bufLen) => { + crypto.getRandomValues(loadSlice(bufPtr, bufLen)); + return 0; + }, + }, + gojs: { + // func ticks() float64 + "runtime.ticks": () => { + return timeOrigin + performance.now(); + }, + + // func sleepTicks(timeout float64) + "runtime.sleepTicks": (timeout) => { + // Do not sleep, only reactivate scheduler after the given timeout. + setTimeout(() => { + if (this.exited) return; + try { + this._inst.exports.go_scheduler(); + } catch (e) { + if (e !== wasmExit) throw e; + } + }, timeout); + }, + + // func finalizeRef(v ref) + "syscall/js.finalizeRef": (v_ref) => { + // Note: TinyGo does not support finalizers so this is only called + // for one specific case, by js.go:jsString. and can/might leak memory. + const id = v_ref & 0xffffffffn; + if (this._goRefCounts?.[id] !== undefined) { + this._goRefCounts[id]--; + if (this._goRefCounts[id] === 0) { + const v = this._values[id]; + this._values[id] = null; + this._ids.delete(v); + this._idPool.push(id); + } + } else { + console.error("syscall/js.finalizeRef: unknown id", id); + } + }, + + // func stringVal(value string) ref + "syscall/js.stringVal": (value_ptr, value_len) => { + value_ptr >>>= 0; + const s = loadString(value_ptr, value_len); + return boxValue(s); + }, + + // func valueGet(v ref, p string) ref + "syscall/js.valueGet": (v_ref, p_ptr, p_len) => { + let prop = loadString(p_ptr, p_len); + let v = unboxValue(v_ref); + let result = Reflect.get(v, prop); + return boxValue(result); + }, + + // func valueSet(v ref, p string, x ref) + "syscall/js.valueSet": (v_ref, p_ptr, p_len, x_ref) => { + const v = unboxValue(v_ref); + const p = loadString(p_ptr, p_len); + const x = unboxValue(x_ref); + Reflect.set(v, p, x); + }, + + // func valueDelete(v ref, p string) + "syscall/js.valueDelete": (v_ref, p_ptr, p_len) => { + const v = unboxValue(v_ref); + const p = loadString(p_ptr, p_len); + Reflect.deleteProperty(v, p); + }, + + // func valueIndex(v ref, i int) ref + "syscall/js.valueIndex": (v_ref, i) => { + return boxValue(Reflect.get(unboxValue(v_ref), i)); + }, + + // valueSetIndex(v ref, i int, x ref) + "syscall/js.valueSetIndex": (v_ref, i, x_ref) => { + Reflect.set(unboxValue(v_ref), i, unboxValue(x_ref)); + }, + + // func valueCall(v ref, m string, args []ref) (ref, bool) + "syscall/js.valueCall": (ret_addr, v_ref, m_ptr, m_len, args_ptr, args_len, args_cap) => { + const v = unboxValue(v_ref); + const name = loadString(m_ptr, m_len); + const args = loadSliceOfValues(args_ptr, args_len, args_cap); + try { + const m = Reflect.get(v, name); + storeValue(ret_addr, Reflect.apply(m, v, args)); + mem().setUint8(ret_addr + 8, 1); + } catch (err) { + storeValue(ret_addr, err); + mem().setUint8(ret_addr + 8, 0); + } + }, + + // func valueInvoke(v ref, args []ref) (ref, bool) + "syscall/js.valueInvoke": (ret_addr, v_ref, args_ptr, args_len, args_cap) => { + try { + const v = unboxValue(v_ref); + const args = loadSliceOfValues(args_ptr, args_len, args_cap); + storeValue(ret_addr, Reflect.apply(v, undefined, args)); + mem().setUint8(ret_addr + 8, 1); + } catch (err) { + storeValue(ret_addr, err); + mem().setUint8(ret_addr + 8, 0); + } + }, + + // func valueNew(v ref, args []ref) (ref, bool) + "syscall/js.valueNew": (ret_addr, v_ref, args_ptr, args_len, args_cap) => { + const v = unboxValue(v_ref); + const args = loadSliceOfValues(args_ptr, args_len, args_cap); + try { + storeValue(ret_addr, Reflect.construct(v, args)); + mem().setUint8(ret_addr + 8, 1); + } catch (err) { + storeValue(ret_addr, err); + mem().setUint8(ret_addr+ 8, 0); + } + }, + + // func valueLength(v ref) int + "syscall/js.valueLength": (v_ref) => { + return unboxValue(v_ref).length; + }, + + // valuePrepareString(v ref) (ref, int) + "syscall/js.valuePrepareString": (ret_addr, v_ref) => { + const s = String(unboxValue(v_ref)); + const str = encoder.encode(s); + storeValue(ret_addr, str); + mem().setInt32(ret_addr + 8, str.length, true); + }, + + // valueLoadString(v ref, b []byte) + "syscall/js.valueLoadString": (v_ref, slice_ptr, slice_len, slice_cap) => { + const str = unboxValue(v_ref); + loadSlice(slice_ptr, slice_len, slice_cap).set(str); + }, + + // func valueInstanceOf(v ref, t ref) bool + "syscall/js.valueInstanceOf": (v_ref, t_ref) => { + return unboxValue(v_ref) instanceof unboxValue(t_ref); + }, + + // func copyBytesToGo(dst []byte, src ref) (int, bool) + "syscall/js.copyBytesToGo": (ret_addr, dest_addr, dest_len, dest_cap, src_ref) => { + let num_bytes_copied_addr = ret_addr; + let returned_status_addr = ret_addr + 4; // Address of returned boolean status variable + + const dst = loadSlice(dest_addr, dest_len); + const src = unboxValue(src_ref); + if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) { + mem().setUint8(returned_status_addr, 0); // Return "not ok" status + return; + } + const toCopy = src.subarray(0, dst.length); + dst.set(toCopy); + mem().setUint32(num_bytes_copied_addr, toCopy.length, true); + mem().setUint8(returned_status_addr, 1); // Return "ok" status + }, + + // copyBytesToJS(dst ref, src []byte) (int, bool) + // Originally copied from upstream Go project, then modified: + // https://github.com/golang/go/blob/3f995c3f3b43033013013e6c7ccc93a9b1411ca9/misc/wasm/wasm_exec.js#L404-L416 + "syscall/js.copyBytesToJS": (ret_addr, dst_ref, src_addr, src_len, src_cap) => { + let num_bytes_copied_addr = ret_addr; + let returned_status_addr = ret_addr + 4; // Address of returned boolean status variable + + const dst = unboxValue(dst_ref); + const src = loadSlice(src_addr, src_len); + if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) { + mem().setUint8(returned_status_addr, 0); // Return "not ok" status + return; + } + const toCopy = src.subarray(0, dst.length); + dst.set(toCopy); + mem().setUint32(num_bytes_copied_addr, toCopy.length, true); + mem().setUint8(returned_status_addr, 1); // Return "ok" status + }, + } + }; + + // Go 1.20 uses 'env'. Go 1.21 uses 'gojs'. + // For compatibility, we use both as long as Go 1.20 is supported. + this.importObject.env = this.importObject.gojs; + } + + async run(instance) { + this._inst = instance; + this._values = [ // JS values that Go currently has references to, indexed by reference id + NaN, + 0, + null, + true, + false, + global, + this, + ]; + this._goRefCounts = []; // number of references that Go has to a JS value, indexed by reference id + this._ids = new Map(); // mapping from JS values to reference ids + this._idPool = []; // unused ids that have been garbage collected + this.exited = false; // whether the Go program has exited + this.exitCode = 0; + + if (this._inst.exports._start) { + let exitPromise = new Promise((resolve, reject) => { + this._resolveExitPromise = resolve; + }); + + // Run program, but catch the wasmExit exception that's thrown + // to return back here. + try { + this._inst.exports._start(); + } catch (e) { + if (e !== wasmExit) throw e; + } + + await exitPromise; + return this.exitCode; + } else { + this._inst.exports._initialize(); + } + } + + _resume() { + if (this.exited) { + throw new Error("Go program has already exited"); + } + try { + this._inst.exports.resume(); + } catch (e) { + if (e !== wasmExit) throw e; + } + if (this.exited) { + this._resolveExitPromise(); + } + } + + _makeFuncWrapper(id) { + const go = this; + return function () { + const event = { id: id, this: this, args: arguments }; + go._pendingEvent = event; + go._resume(); + return event.result; + }; + } + } + + if ( + global.require && + global.require.main === module && + global.process && + global.process.versions && + !global.process.versions.electron + ) { + if (process.argv.length != 3) { + console.error("usage: go_js_wasm_exec [wasm binary] [arguments]"); + process.exit(1); + } + + const go = new Go(); + WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then(async (result) => { + let exitCode = await go.run(result.instance); + process.exit(exitCode); + }).catch((err) => { + console.error(err); + process.exit(1); + }); + } +})();