import{ssrElement as K,escape as T,mergeProps as Ke,ssr as $,isServer as x,getRequestEvent as k,renderToString as ze,renderToStream as Ge,createComponent as R,delegateEvents as Je,ssrHydrationKey as q,useAssets as Ve,NoHydration as ye,Hydration as Xe,ssrAttribute as z,HydrationScript as Ye}from"solid-js/web";import{lazy as Qe,createComponent as we,sharedConfig as U,getOwner as ve,runWithOwner as Re,createMemo as P,createSignal as M,createRenderEffect as Ze,on as ne,useContext as et,createContext as be,startTransition as tt,resetErrorBoundaries as nt,batch as rt,untrack as Se,children as st,Show as Ee,createRoot as ot,onCleanup as re,Suspense as at,catchError as it,ErrorBoundary as ct}from"solid-js";import{provideRequestEvent as ut}from"solid-js/web/storage";import{H3Event as Y,setResponseStatus as lt,setHeader as ht,getRequestIP as dt,getResponseStatus as ft,getResponseStatusText as pt,getResponseHeader as mt,setResponseHeader as gt,removeResponseHeader as yt,appendResponseHeader as wt,getResponseHeaders as vt,getRequestURL as Rt,getRequestWebStream as bt,sendRedirect as St,getCookie as Et,setCookie as At,eventHandler as $t}from"h3";import{getContext as Pt}from"unctx";import{AsyncLocalStorage as Tt}from"node:async_hooks";import{createRouter as xt}from"radix3";function Ct(e){let t;const n=$e(e),s={duplex:"half",method:e.method,headers:e.headers};return e.node.req.body instanceof ArrayBuffer?new Request(n,{...s,body:e.node.req.body}):new Request(n,{...s,get body(){return t||(t=Mt(e),t)}})}function Lt(e){return e.web??={request:Ct(e),url:$e(e)},e.web.request}function Ht(){return Bt()}const Ae=Symbol("$HTTPEvent");function qt(e){return typeof e=="object"&&(e instanceof Y||e?.[Ae]instanceof Y||e?.__is_event__===!0)}function S(e){return function(...t){let n=t[0];if(qt(n))t[0]=n instanceof Y||n.__is_event__?n:n[Ae];else{if(!globalThis.app.config.server.experimental?.asyncContext)throw new Error("AsyncLocalStorage was not enabled. Use the `server.experimental.asyncContext: true` option in your app configuration to enable it. Or, pass the instance of HTTPEvent that you have as the first argument to the function.");if(n=Ht(),!n)throw new Error("No HTTPEvent found in AsyncLocalStorage. Make sure you are using the function within the server runtime.");t.unshift(n)}return e(...t)}}const $e=S(Rt),kt=S(dt),Q=S(lt),ue=S(ft),Ot=S(pt),G=S(vt),le=S(mt),Ft=S(gt),_t=S(wt),he=S(St),It=S(Et),Ut=S(At),jt=S(ht),Mt=S(bt),Nt=S(yt),Wt=S(Lt);function Dt(){return Pt("nitro-app",{asyncContext:!!globalThis.app.config.server.experimental?.asyncContext,AsyncLocalStorage:Tt})}function Bt(){return Dt().use().event}const Pe=[{page:!0,$component:{src:"src/routes/index.jsx?pick=default&pick=$css",build:()=>import("./index.js"),import:()=>import("./index.js")},path:"/",filePath:"/home/gromov/projects/my/svg-sprites/integration/apps/solid-start-vite/src/routes/index.jsx"}],Kt=zt(Pe.filter(e=>e.page));function zt(e){function t(n,s,r,o){const a=Object.values(n).find(i=>r.startsWith(i.id+"/"));return a?(t(a.children||(a.children=[]),s,r.slice(a.id.length)),n):(n.push({...s,id:r,path:r.replace(/\([^)/]+\)/g,"").replace(/\/+/g,"/")}),n)}return e.sort((n,s)=>n.path.length-s.path.length).reduce((n,s)=>t(n,s,s.path,s.path),[])}function Gt(e,t){const n=Vt.lookup(e);if(n&&n.route){const s=n.route,r=t==="HEAD"?s.$HEAD||s.$GET:s[`$${t}`];if(r===void 0)return;const o=s.page===!0&&s.$component!==void 0;return{handler:r,params:n.params,isPage:o}}}function Jt(e){return e.$HEAD||e.$GET||e.$POST||e.$PUT||e.$PATCH||e.$DELETE}const Vt=xt({routes:Pe.reduce((e,t)=>{if(!Jt(t))return e;let n=t.path.replace(/\([^)/]+\)/g,"").replace(/\/+/g,"/").replace(/\*([^/]*)/g,(s,r)=>`**:${r}`).split("/").map(s=>s.startsWith(":")||s.startsWith("*")?s:encodeURIComponent(s)).join("/");if(/:[^/]*\?/g.test(n))throw new Error(`Optional parameters are not supported in API routes: ${n}`);if(e[n])throw new Error(`Duplicate API routes for "${n}" found at "${e[n].route.path}" and "${t.path}"`);return e[n]={route:t},e},{})}),V="solidFetchEvent";function Xt(e){return{request:Wt(e),response:Zt(e),clientAddress:kt(e),locals:{},nativeEvent:e}}function Yt(e){if(!e.context[V]){const t=Xt(e);e.context[V]=t}return e.context[V]}class Qt{event;constructor(t){this.event=t}get(t){const n=le(this.event,t);return Array.isArray(n)?n.join(", "):n||null}has(t){return this.get(t)!==null}set(t,n){return Ft(this.event,t,n)}delete(t){return Nt(this.event,t)}append(t,n){_t(this.event,t,n)}getSetCookie(){const t=le(this.event,"Set-Cookie");return Array.isArray(t)?t:[t]}forEach(t){return Object.entries(G(this.event)).forEach(([n,s])=>t(Array.isArray(s)?s.join(", "):s,n,this))}entries(){return Object.entries(G(this.event)).map(([t,n])=>[t,Array.isArray(n)?n.join(", "):n])[Symbol.iterator]()}keys(){return Object.keys(G(this.event))[Symbol.iterator]()}values(){return Object.values(G(this.event)).map(t=>Array.isArray(t)?t.join(", "):t)[Symbol.iterator]()}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}function Zt(e){return{get status(){return ue(e)},set status(t){Q(e,t)},get statusText(){return Ot(e)},set statusText(t){Q(e,ue(e),t)},headers:new Qt(e)}}function en(e){e.forEach(t=>{if(!t.attrs.href)return;let n=document.head.querySelector(`link[href="${t.attrs.href}"]`);n||(n=document.createElement("link"),n.setAttribute("rel","preload"),n.setAttribute("as","style"),n.setAttribute("href",t.attrs.href),document.head.appendChild(n))})}var tn=" ";const nn={style:e=>K("style",e.attrs,()=>e.children,!0),link:e=>K("link",e.attrs,void 0,!0),script:e=>e.attrs.src?K("script",Ke(()=>e.attrs,{get id(){return e.key}}),()=>$(tn),!0):null,noscript:e=>K("noscript",e.attrs,()=>T(e.children),!0)};function Z(e,t){let{tag:n,attrs:{key:s,...r}={key:void 0},children:o}=e;return nn[n]({attrs:{...r,nonce:t},key:s,children:o})}function rn(e,t,n,s="default"){return Qe(async()=>{{const o=(await e.import())[s],i=(await t.inputs?.[e.src].assets()).filter(u=>u.tag==="style"||u.attrs.rel==="stylesheet");return typeof window<"u"&&en(i),{default:u=>[...i.map(h=>Z(h)),we(o,u)]}}})}function Te(){function e(n){return{...n,...n.$$route?n.$$route.require().route:void 0,info:{...n.$$route?n.$$route.require().route.info:{},filesystem:!0},component:n.$component&&rn(n.$component,globalThis.MANIFEST.client,globalThis.MANIFEST.ssr),children:n.children?n.children.map(e):void 0}}return Kt.map(e)}let de;const sn=x?()=>k().routes:()=>de||(de=Te());function on(e){const t=It(e.nativeEvent,"flash");if(t)try{let n=JSON.parse(t);if(!n||!n.result)return;const s=[...n.input.slice(0,-1),new Map(n.input[n.input.length-1])],r=n.error?new Error(n.result):n.result;return{input:s,url:n.url,pending:!1,result:n.thrown?void 0:r,error:n.thrown?r:void 0}}catch(n){console.error(n)}finally{Ut(e.nativeEvent,"flash","",{maxAge:0})}}async function an(e){const t=globalThis.MANIFEST.client;return globalThis.MANIFEST.ssr,e.response.headers.set("Content-Type","text/html"),Object.assign(e,{manifest:await t.json(),assets:[...await t.inputs[t.handler].assets()],router:{submission:on(e)},routes:Te(),complete:!1,$islands:new Set})}const cn=new Set([301,302,303,307,308]);function ee(e){return e.status&&cn.has(e.status)?e.status:302}function un(e,t,n={},s){return $t({handler:r=>{const o=Yt(r);return ut(o,async()=>{const a=Gt(new URL(o.request.url).pathname,o.request.method);if(a){const d=await a.handler.import(),g=o.request.method==="HEAD"?d.HEAD||d.GET:d[o.request.method];o.params=a.params||{},U.context={event:o};const l=await g(o);if(l!==void 0)return l;if(o.request.method!=="GET")throw new Error(`API handler for ${o.request.method} "${o.request.url}" did not return a response.`);if(!a.isPage)return}const i=await t(o),c=typeof n=="function"?await n(i):{...n},u=c.mode||"stream";if(c.nonce&&(i.nonce=c.nonce),u==="sync"){const d=ze(()=>(U.context.event=i,e(i)),c);if(i.complete=!0,i.response&&i.response.headers.get("Location")){const g=ee(i.response);return he(r,i.response.headers.get("Location"),g)}return d}if(c.onCompleteAll){const d=c.onCompleteAll;c.onCompleteAll=g=>{pe(i)(g),d(g)}}else c.onCompleteAll=pe(i);if(c.onCompleteShell){const d=c.onCompleteShell;c.onCompleteShell=g=>{fe(i,r)(),d(g)}}else c.onCompleteShell=fe(i,r);const h=Ge(()=>(U.context.event=i,e(i)),c);if(i.response&&i.response.headers.get("Location")){const d=ee(i.response);return he(r,i.response.headers.get("Location"),d)}if(u==="async")return h;const{writable:w,readable:m}=new TransformStream;return h.pipeTo(w),m})}})}function fe(e,t){return()=>{if(e.response&&e.response.headers.get("Location")){const n=ee(e.response);Q(t,n),jt(t,"Location",e.response.headers.get("Location"))}}}function pe(e){return({write:t})=>{e.complete=!0;const n=e.response&&e.response.headers.get("Location");n&&t(`