var e=Object.defineProperty,t=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n);import{i as r,d as n,j as s,r as o,b as a,e as i,f as c,s as u,E as l}from"./router-BXPf1XsM.js"; /** * @remix-run/server-runtime v2.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */let d=function(e){return e.Development="development",e.Production="production",e.Test="test",e}({});function f(e){return e===d.Development||e===d.Production||e===d.Test} /** * @remix-run/server-runtime v2.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function h(e,t){if(e instanceof Error&&t!==d.Development){let e=new Error("Unexpected Server Error");return e.stack=void 0,e}return e}function p(e,t){return Object.entries(e).reduce(((e,[r,n])=>Object.assign(e,{[r]:h(n,t)})),{})}function g(e,t){let r=h(e,t);return{message:r.message,stack:r.stack}}function y(e,t){if(!e)return null;let n=Object.entries(e),s={};for(let[o,a]of n)if(r(a))s[o]={...a,__type:"RouteErrorResponse"};else if(a instanceof Error){let e=h(a,t);s[o]={message:e.message,stack:e.stack,__type:"Error",..."Error"!==e.name?{__subType:e.name}:{}}}else s[o]=a;return s} /** * @remix-run/server-runtime v2.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */const m=(e,t={})=>s(e,t),b=(e,t={})=>n(e,t),w=(e,t=302)=>o(e,t),v=(e,t=302)=>i(e,t),S=(e,t=302)=>a(e,t);function j(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function O(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}const E=new Set([301,302,303,307,308]);function $(e){return E.has(e)}function k(e){return $(e.status)}function x(e){return null!=e&&"function"==typeof e.then&&!0===e._tracked}function N(e,t,r){let n=new TextEncoder;return new ReadableStream({async start(s){let o={},a=[];for(let[t,r]of Object.entries(e.data))x(r)?(o[t]=`__deferred_promise:${t}`,void 0===r._data&&void 0===r._error||a.push(t)):o[t]=r;s.enqueue(n.encode(JSON.stringify(o)+"\n\n"));for(let t of a)A(s,n,t,e.data[t],r);let i=e.subscribe(((t,o)=>{o&&A(s,n,o,e.data[o],r)}));await e.resolveData(t),i(),s.close()}})}function A(e,t,r,n,s){"_error"in n?e.enqueue(t.encode("error:"+JSON.stringify({[r]:n._error instanceof Error?g(n._error,s):n._error})+"\n\n")):e.enqueue(t.encode("data:"+JSON.stringify({[r]:n._data??null})+"\n\n"))}var R="E",q="P",C=class{constructor(){t(this,"promise"),t(this,"resolve"),t(this,"reject"),this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}};function P(e){const{indices:t}=this,r=t.get(e);if(r)return[r];if(void 0===e)return-7;if(null===e)return-5;if(Number.isNaN(e))return-2;if(e===Number.POSITIVE_INFINITY)return-6;if(e===Number.NEGATIVE_INFINITY)return-3;if(0===e&&1/e<0)return-4;const n=this.index++;return t.set(e,n),D.call(this,e,n),n}function D(e,t){const{deferred:r,plugins:n,postPlugins:s}=this,o=this.stringified,a=[[e,t]];for(;a.length>0;){const[e,t]=a.pop(),i=e=>Object.keys(e).map((t=>`"_${P.call(this,t)}":${P.call(this,e[t])}`)).join(",");let c=null;switch(typeof e){case"boolean":case"number":case"string":o[t]=JSON.stringify(e);break;case"bigint":o[t]=`["B","${e}"]`;break;case"symbol":{const r=Symbol.keyFor(e);r?o[t]=`["Y",${JSON.stringify(r)}]`:c=new Error("Cannot encode symbol unless created with Symbol.for()");break}case"object":{if(!e){o[t]="-5";break}const s=Array.isArray(e);let a=!1;if(!s&&n)for(const r of n){const n=r(e);if(Array.isArray(n)){a=!0;const[e,...r]=n;o[t]=`[${JSON.stringify(e)}`,r.length>0&&(o[t]+=`,${r.map((e=>P.call(this,e))).join(",")}`),o[t]+="]";break}}if(!a){let n=s?"[":"{";if(s){for(let t=0;t0?o[t]=`["S",${[...e].map((e=>P.call(this,e))).join(",")}]`:o[t]='["S"]':e instanceof Map?e.size>0?o[t]=`["M",${[...e].flatMap((([e,t])=>[P.call(this,e),P.call(this,t)])).join(",")}]`:o[t]='["M"]':e instanceof Promise?(o[t]=`["${q}",${t}]`,r[t]=e):e instanceof Error?(o[t]=`["${R}",${JSON.stringify(e.message)}`,"Error"!==e.name&&(o[t]+=`,${JSON.stringify(e.name)}`),o[t]+="]"):null===Object.getPrototypeOf(e)?o[t]=`["N",{${i(e)}}]`:_(e)?o[t]=`{${i(e)}}`:c=new Error("Cannot encode object with prototype")}break}default:{let r=!1;if(!Array.isArray(e)&&n)for(const s of n){const n=s(e);if(Array.isArray(n)){r=!0;const[e,...s]=n;o[t]=`[${JSON.stringify(e)}`,s.length>0&&(o[t]+=`,${s.map((e=>P.call(this,e))).join(",")}`),o[t]+="]";break}}r||(c=new Error("Cannot encode function or unexpected type"))}}if(c){let r=!1;if(s)for(const n of s){const s=n(e);if(Array.isArray(s)){r=!0;const[e,...n]=s;o[t]=`[${JSON.stringify(e)}`,n.length>0&&(o[t]+=`,${n.map((e=>P.call(this,e))).join(",")}`),o[t]+="]";break}}if(!r)throw c}}}var T=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function _(e){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t||Object.getOwnPropertyNames(t).sort().join("\0")===T}var I="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:void 0;function J(e){const{hydrated:t,values:r}=this;if("number"==typeof e)return H.call(this,e);if(!Array.isArray(e)||!e.length)throw new SyntaxError;const n=r.length;for(const s of e)r.push(s);return t.length=r.length,H.call(this,n)}function H(e){const{hydrated:t,values:r,deferred:n,plugins:s}=this;let o;const a=[[e,e=>{o=e}]];let i=[];for(;a.length>0;){const[e,o]=a.pop();switch(e){case-7:o(void 0);continue;case-5:o(null);continue;case-2:o(NaN);continue;case-6:o(1/0);continue;case-3:o(-1/0);continue;case-4:o(-0);continue}if(t[e]){o(t[e]);continue}const c=r[e];if(c&&"object"==typeof c)if(Array.isArray(c))if("string"==typeof c[0]){const[r,u,l]=c;switch(r){case"D":o(t[e]=new Date(u));continue;case"U":o(t[e]=new URL(u));continue;case"B":o(t[e]=BigInt(u));continue;case"R":o(t[e]=new RegExp(u,l));continue;case"Y":o(t[e]=Symbol.for(u));continue;case"S":const r=new Set;t[e]=r;for(let e=1;e{r.add(e)}]);o(r);continue;case"M":const d=new Map;t[e]=d;for(let e=1;e{t[1]=e}]),a.push([c[e],e=>{t[0]=e}]),i.push((()=>{d.set(t[0],t[1])}))}o(d);continue;case"N":const f=Object.create(null);t[e]=f;for(const e of Object.keys(u).reverse()){const t=[];a.push([u[e],e=>{t[1]=e}]),a.push([Number(e.slice(1)),e=>{t[0]=e}]),i.push((()=>{f[t[0]]=t[1]}))}o(f);continue;case q:if(t[u])o(t[e]=t[u]);else{const r=new C;n[u]=r,o(t[e]=r.promise)}continue;case R:const[,h,p]=c;let g=p&&I&&I[p]?new I[p](h):new Error(h);t[e]=g,o(g);continue;case"Z":o(t[e]=t[u]);continue;default:if(Array.isArray(s)){const r=[],n=c.slice(1);for(let e=0;e{r[e]=t}])}i.push((()=>{for(const n of s){const s=n(c[0],...r);if(s)return void o(t[e]=s.value)}throw new SyntaxError}));continue}throw new SyntaxError}}else{const r=[];t[e]=r;for(let e=0;e{r[e]=t}])}o(r)}else{const r={};t[e]=r;for(const e of Object.keys(c).reverse()){const t=[];a.push([c[e],e=>{t[1]=e}]),a.push([Number(e.slice(1)),e=>{t[0]=e}]),i.push((()=>{r[t[0]]=t[1]}))}o(r)}else t[e]=c,o(c)}for(;i.length>0;)i.pop()();return o}async function L(e,t){const{plugins:r}=t??{},n=new C,s=e.pipeThrough(function(){const e=new TextDecoder;let t="";return new TransformStream({transform(r,n){const s=e.decode(r,{stream:!0}),o=(t+s).split("\n");t=o.pop()||"";for(const e of o)n.enqueue(e)},flush(e){t&&e.enqueue(t)}})}()).getReader(),o={values:[],hydrated:[],deferred:{},plugins:r},a=await F.call(o,s);let i=n.promise;return a.done?n.resolve():i=M.call(o,s).then(n.resolve).catch((e=>{for(const t of Object.values(o.deferred))t.reject(e);n.reject(e)})),{done:i.then((()=>s.closed)),value:a.value}}async function F(e){const t=await e.read();if(!t.value)throw new SyntaxError;let r;try{r=JSON.parse(t.value)}catch(n){throw new SyntaxError}return{done:t.done,value:J.call(this,r)}}async function M(e){let t=await e.read();for(;!t.done;){if(!t.value)continue;const n=t.value;switch(n[0]){case q:{const e=n.indexOf(":"),t=Number(n.slice(1,e)),s=this.deferred[t];if(!s)throw new Error(`Deferred ID ${t} not found in stream`);const o=n.slice(e+1);let a;try{a=JSON.parse(o)}catch(r){throw new SyntaxError}const i=J.call(this,a);s.resolve(i);break}case R:{const e=n.indexOf(":"),t=Number(n.slice(1,e)),s=this.deferred[t];if(!s)throw new Error(`Deferred ID ${t} not found in stream`);const o=n.slice(e+1);let a;try{a=JSON.parse(o)}catch(r){throw new SyntaxError}const i=J.call(this,a);s.reject(i);break}default:throw new SyntaxError}t=await e.read()}}function U(e,t){if(!t)return e;if(t.aborted)return Promise.reject(t.reason||new Error("Signal was aborted."));const r=new Promise(((r,n)=>{t.addEventListener("abort",(e=>{n(t.reason||new Error("Signal was aborted."))})),e.then(r).catch(n)}));return r.catch((()=>{})),Promise.race([r,e])}var B={exports:{}},V={decodeValues:!0,map:!1,silent:!1};function Y(e){return"string"==typeof e&&!!e.trim()}function z(e,t){var r=e.split(";").filter(Y),n=function(e){var t="",r="",n=e.split("=");n.length>1?(t=n.shift(),r=n.join("=")):r=e;return{name:t,value:r}}(r.shift()),s=n.name,o=n.value;t=t?Object.assign({},V,t):V;try{o=t.decodeValues?decodeURIComponent(o):o}catch(i){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+o+"'. Set options.decodeValues to false to disable this feature.",i)}var a={name:s,value:o};return r.forEach((function(e){var t=e.split("="),r=t.shift().trimLeft().toLowerCase(),n=t.join("=");"expires"===r?a.expires=new Date(n):"max-age"===r?a.maxAge=parseInt(n,10):"secure"===r?a.secure=!0:"httponly"===r?a.httpOnly=!0:"samesite"===r?a.sameSite=n:"partitioned"===r?a.partitioned=!0:a[r]=n})),a}function X(e,t){if(t=t?Object.assign({},V,t):V,!e)return t.map?{}:[];if(e.headers)if("function"==typeof e.headers.getSetCookie)e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find((function(e){return"set-cookie"===e.toLowerCase()}))];r||!e.headers.cookie||t.silent||console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}if(Array.isArray(e)||(e=[e]),t.map){return e.filter(Y).reduce((function(e,r){var n=z(r,t);return e[n.name]=n,e}),{})}return e.filter(Y).map((function(e){return z(e,t)}))}B.exports=X,B.exports.parse=X,B.exports.parseString=z;var Z=B.exports.splitCookiesString=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return[];var t,r,n,s,o,a=[],i=0;function c(){for(;i=e.length)&&a.push(e.substring(t,e.length))}return a}; /** * @remix-run/server-runtime v2.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function G(e,t){let r,n=t.errors?t.matches.findIndex((e=>t.errors[e.route.id])):-1,s=n>=0?t.matches.slice(0,n+1):t.matches;if(n>=0){let{actionHeaders:e,actionData:s,loaderHeaders:o,loaderData:a}=t;t.matches.slice(n).some((t=>{let n=t.route.id;return!e[n]||s&&void 0!==s[n]?o[n]&&void 0===a[n]&&(r=o[n]):r=e[n],null!=r}))}return s.reduce(((n,o,a)=>{let{id:i}=o.route,c=e.routes[i].module,u=t.loaderHeaders[i]||new Headers,l=t.actionHeaders[i]||new Headers,d=null!=r&&a===s.length-1,f=d&&r!==u&&r!==l;if(null==c.headers){let e=new Headers(n);return f&&W(r,e),W(l,e),W(u,e),e}let h=new Headers(c.headers?"function"==typeof c.headers?c.headers({loaderHeaders:u,parentHeaders:n,actionHeaders:l,errorHeaders:d?r:void 0}):c.headers:void 0);return f&&W(r,h),W(l,h),W(u,h),W(n,h),h}),new Headers)}function W(e,t){let r=e.get("Set-Cookie");if(r){var n;let e=Z(r),s=new Set(null===(n=t.getSetCookie)||void 0===n?void 0:n.call(t));e.forEach((e=>{s.has(e)||t.append("Set-Cookie",e)}))}} /** * @remix-run/server-runtime v2.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */const K=Symbol("SingleFetchRedirect"),Q=202;function ee({isActionDataRequest:e,loadRouteIds:t}={}){return async({request:r,matches:n})=>{if(e&&"GET"===r.method)return{};let s=t?n.filter((e=>t.includes(e.route.id))):n;return(await Promise.all(s.map((e=>e.resolve())))).reduce(((e,t,r)=>Object.assign(e,{[s[r].route.id]:t})),{})}}async function te(e,t,n,s,o,a,i){try{let c=new Request(o,{method:s.method,body:s.body,headers:s.headers,signal:s.signal,...s.body?{duplex:"half"}:void 0}),u=await n.query(c,{requestContext:a,skipLoaderErrorBubbling:!0,dataStrategy:ee({isActionDataRequest:!0})});if(O(u))return{result:ne(u.status,u.headers,e.basename),headers:u.headers,status:Q};let l,d=u,f=G(e,d);return $(d.statusCode)&&f.has("Location")?{result:ne(d.statusCode,f,e.basename),headers:f,status:Q}:(d.errors&&(Object.values(d.errors).forEach((e=>{r(e)&&!e.error||i(e)})),d.errors=p(d.errors,t)),l=d.errors?{error:Object.values(d.errors)[0]}:{data:Object.values(d.actionData||{})[0]},{result:l,headers:f,status:d.statusCode})}catch(c){return i(c),{result:{error:c},headers:new Headers,status:500}}}async function re(e,t,n,s,o,a,i){try{var c;let u=new Request(o,{headers:s.headers,signal:s.signal}),l=(null===(c=new URL(s.url).searchParams.get("_routes"))||void 0===c?void 0:c.split(","))||void 0,d=await n.query(u,{requestContext:a,skipLoaderErrorBubbling:!0,dataStrategy:ee({loadRouteIds:l})});if(O(d))return{result:{[K]:ne(d.status,d.headers,e.basename)},headers:d.headers,status:Q};let f=d,h=G(e,f);if($(f.statusCode)&&h.has("Location"))return{result:{[K]:ne(f.statusCode,h,e.basename)},headers:h,status:Q};f.errors&&(Object.values(f.errors).forEach((e=>{r(e)&&!e.error||i(e)})),f.errors=p(f.errors,t));let g={};return(l?f.matches.filter((e=>e.route.loader&&l.includes(e.route.id))):f.matches).forEach((e=>{var t,r;let n=null===(t=f.loaderData)||void 0===t?void 0:t[e.route.id],s=null===(r=f.errors)||void 0===r?void 0:r[e.route.id];void 0!==s?g[e.route.id]={error:s}:void 0!==n&&(g[e.route.id]={data:n})})),{result:g,headers:h,status:f.statusCode}}catch(u){return i(u),{result:{root:{error:u}},headers:new Headers,status:500}}}function ne(e,t,r){let n=t.get("Location");return r&&(n=u(n,r)||n),{redirect:n,status:e,revalidate:t.has("X-Remix-Revalidate")||t.has("Set-Cookie"),reload:t.has("X-Remix-Reload-Document"),replace:t.has("X-Remix-Replace")}}function se(e,t,r,n){let s=new AbortController,o=setTimeout((()=>s.abort(new Error("Server Timeout"))),"number"==typeof r?r:4950);return t.addEventListener("abort",(()=>clearTimeout(o))),function(e,t){const{plugins:r,postPlugins:n,signal:s}=t??{},o={deferred:{},index:0,indices:new Map,stringified:[],plugins:r,postPlugins:n,signal:s},a=new TextEncoder;let i=0;return new ReadableStream({async start(t){const r=P.call(o,e);if(Array.isArray(r))throw new Error("This should never happen");r<0?t.enqueue(a.encode(`${r}\n`)):(t.enqueue(a.encode(`[${o.stringified.join(",")}]\n`)),i=o.stringified.length-1);const n=new WeakSet;for(;Object.keys(o.deferred).length>0;){for(const[e,r]of Object.entries(o.deferred))n.has(r)||n.add(o.deferred[Number(e)]=U(r,o.signal).then((r=>{const n=P.call(o,r);if(Array.isArray(n))t.enqueue(a.encode(`${q}${e}:[["Z",${n[0]}]]\n`)),o.index++,i++;else if(n<0)t.enqueue(a.encode(`${q}${e}:${n}\n`));else{const r=o.stringified.slice(i+1).join(",");t.enqueue(a.encode(`${q}${e}:[${r}]\n`)),i=o.stringified.length-1}}),(r=>{r&&"object"==typeof r&&r instanceof Error||(r=new Error("An unknown error occurred"));const n=P.call(o,r);if(Array.isArray(n))t.enqueue(a.encode(`${R}${e}:[["Z",${n[0]}]]\n`)),o.index++,i++;else if(n<0)t.enqueue(a.encode(`${R}${e}:${n}\n`));else{const r=o.stringified.slice(i+1).join(",");t.enqueue(a.encode(`${R}${e}:[${r}]\n`)),i=o.stringified.length-1}})).finally((()=>{delete o.deferred[Number(e)]})));await Promise.race(Object.values(o.deferred))}await Promise.all(Object.values(o.deferred)),t.close()}})}(e,{signal:s.signal,plugins:[e=>{if(e instanceof Error){let{name:t,message:r,stack:s}=n===d.Production?h(e,n):e;return["SanitizedError",t,r,s]}if(e instanceof l){let{data:t,status:r,statusText:n}=e;return["ErrorResponse",t,r,n]}if(e&&"object"==typeof e&&K in e)return["SingleFetchRedirect",e[K]]}],postPlugins:[e=>{if(e&&"object"==typeof e)return["SingleFetchClassInstance",Object.fromEntries(Object.entries(e))]},()=>["SingleFetchFallback"]]})}function oe(e,t){return c(e,t)}export{K as S,j as a,$ as b,k as c,L as d,se as e,Q as f,ne as g,d as h,O as i,m as j,N as k,te as l,re as m,G as n,p as o,y as p,f as q,w as r,g as s,oe as t,b as u,S as v,v as w};