1import{r as e}from"./jsx-runtime-DGeXAQPT.js";import{t}from"./react-vt4WmSOl.js";import{i as n,r,t as i}from"./useRouter-BDZpXAeu.js";import{O as a,T as o,k as s}from"./index-C7JsbQO8.js";import{t as c}from"./createLucideIcon-IrB5uTdA.js";function l(e){if(Array.isArray(e))return e.flatMap(e=>l(e));if(typeof e!=`string`)return[];let t=[],n=0,r,i,a,o,s,c=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},u=()=>(i=e.charAt(n),i!==`=`&&i!==`;`&&i!==`,`);for(;n<e.length;){for(r=n,s=!1;c();)if(i=e.charAt(n),i===`,`){for(a=n,n+=1,c(),o=n;n<e.length&&u();)n+=1;n<e.length&&e.charAt(n)===`=`?(s=!0,n=o,t.push(e.slice(r,a)),r=n):n=a+1}else n+=1;(!s||n>=e.length)&&t.push(e.slice(r))}return t}function u(e){return e instanceof Headers?e:Array.isArray(e)||typeof e==`object`?new Headers(e):null}function d(...e){return e.reduce((e,t)=>{let n=u(t);if(!n)return e;for(let[t,r]of n.entries())t===`set-cookie`?l(r).forEach(t=>e.append(`set-cookie`,t)):e.set(t,r);return e},new Headers)}var f=e(t(),1);function p(e){let t=i();return f.useCallback(async(...n)=>{try{let t=await e(...n);if(r(t))throw t;return t}catch(e){if(r(e))return e.options._fromLocation=t.stores.location.get(),t.navigate(t.resolveRedirect(e).options);throw e}},[t,e])}function m(e){return e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function h(e,t){let n=Object.create(null);if(e)for(let t of Object.keys(e))m(t)&&(n[t]=e[t]);if(t&&typeof t==`object`)for(let e of Object.keys(t))m(e)&&(n[e]=t[e]);return n}function g(e){if(!e)return Object.create(null);let t=Object.create(null);for(let n of Object.keys(e))m(n)&&(t[n]=e[n]);return t}var _=()=>{throw Error(`createServerOnlyFn() functions can only be called on the server!`)},v=(e,t)=>{let r=t||e||{};return r.method===void 0&&(r.method=`GET`),Object.assign(e=>v(void 0,{...r,...e}),{options:r,middleware:e=>{let t=[...r.middleware||[]];e.map(e=>{s in e?e.options.middleware&&t.push(...e.options.middleware):t.push(e)});let n=v(void 0,{...r,middleware:t});return n[s]=!0,n},inputValidator:e=>v(void 0,{...r,inputValidator:e}),handler:(...e)=>{let[t,i]=e,a={...r,extractedFn:t,serverFn:i},o=[...a.middleware||[],S(a)];return t.method=r.method,Object.assign(async e=>{let r=await y(o,`client`,{...t,...a,data:e?.data,headers:e?.headers,signal:e?.signal,fetch:e?.fetch,context:g()}),i=n(r.error);if(i)throw i;if(r.error)throw r.error;return r.result},{...t,method:r.method,__executeServer:async e=>{let n=_(),r=n.contextAfterGlobalMiddlewares;return await y(o,`server`,{...t,...e,serverFnMeta:t.serverFnMeta,context:h(e.context,r),request:n.request}).then(e=>({result:e.result,error:e.error,context:e.sendContext}))}})}})};async function y(e,t,n){let i=b([...a()?.functionMiddleware||[],...e]);if(t===`server`){let e=_({throwIfNotFound:!1});e?.executedRequestMiddlewares&&(i=i.filter(t=>!e.executedRequestMiddlewares.has(t)))}let o=async e=>{let n=i.shift();if(!n)return e;try{`inputValidator`in n.options&&n.options.inputValidator&&t===`server`&&(e.data=await x(n.options.inputValidator,e.data));let i;if(t===`client`?`client`in n.options&&(i=n.options.client):`server`in n.options&&(i=n.options.server),i){let t=async(t={})=>{let n=await o({...e,...t,context:h(e.context,t.context),sendContext:h(e.sendContext,t.sendContext),headers:d(e.headers,t.headers),_callSiteFetch:e._callSiteFetch,fetch:e._callSiteFetch??t.fetch??e.fetch,result:t.result===void 0?t instanceof Response?t:e.result:t.result,error:t.error??e.error});if(n.error)throw n.error;return n},n=await i({...e,next:t});if(r(n))return{...e,error:n};if(n instanceof Response)return{...e,result:n};if(!n)throw Error(`User middleware returned undefined. You must call next() or return a result in your middlewares.`);return n}return o(e)}catch(t){return{...e,error:t}}};return o({...n,headers:n.headers||{},sendContext:n.sendContext||{},context:n.context||g(),_callSiteFetch:n.fetch})}function b(e,t=100){let n=new Set,r=[],i=(e,a)=>{if(a>t)throw Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);e.forEach(e=>{e.options.middleware&&i(e.options.middleware,a+1),n.has(e)||(n.add(e),r.push(e))})};return i(e,0),r}async function x(e,t){if(e==null)return{};if(`~standard`in e){let n=await e[`~standard`].validate(t);if(n.issues)throw Error(JSON.stringify(n.issues,void 0,2));return n.value}if(`parse`in e)return e.parse(t);if(typeof e==`function`)return e(t);throw Error(`Invalid validator type!`)}function S(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:n,fetch:r,...i})=>{let a={...i,context:n,fetch:r};return t(await e.extractedFn?.(a))},server:async({next:t,...n})=>{let r=await e.serverFn?.(n);return t({...n,result:r})}}}}
1var C=c(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),w=o({type:`function`});export{p as i,C as n,v as r,w as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.