const w=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function x(t){const i=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${_(t).map(s=>{const o=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(s);if(o)return i.push({name:o[1],matcher:o[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const l=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(s);if(l)return i.push({name:l[1],matcher:l[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!s)return;const r=s.split(/\[(.+?)\](?!\])/);return"/"+r.map((e,a)=>{if(a%2){if(e.startsWith("x+"))return h(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith("u+"))return h(String.fromCharCode(...e.slice(2).split("-").map(g=>parseInt(g,16))));const c=w.exec(e),[,u,p,m,d]=c;return i.push({name:m,matcher:d,optional:!!u,rest:!!p,chained:p?a===1&&r[0]==="":!1}),p?"([^]*?)":u?"([^/]*)?":"([^/]+?)"}return h(e)}).join("")}).join("")}/?$`),params:i}}function $(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function _(t){return t.slice(1).split("/").filter($)}function j(t,i,f){const s={},o=t.slice(1),l=o.filter(n=>n!==void 0);let r=0;for(let n=0;n<i.length;n+=1){const e=i[n];let a=o[n-r];if(e.chained&&e.rest&&r&&(a=o.slice(n-r,n+1).filter(c=>c).join("/"),r=0),a===void 0){e.rest&&(s[e.name]="");continue}if(!e.matcher||f[e.matcher](a)){s[e.name]=a;const c=i[n+1],u=o[n+1];c&&!c.rest&&c.optional&&u&&e.chained&&(r=0),!c&&!u&&Object.keys(s).length===l.length&&(r=0);continue}if(e.optional&&e.chained){r++;continue}return}if(!r)return s}function h(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const b=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function W(t,i){const f=_(t),s=t!="/"&&t.endsWith("/");return"/"+f.map(o=>o.replace(b,(l,r,n,e)=>{const a=i[e];if(!a){if(r||n&&a!==void 0)return"";throw new Error(`Missing parameter '${e}' in route ${t}`)}if(a.startsWith("/")||a.endsWith("/"))throw new Error(`Parameter '${e}' in route ${t} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return a})).filter(Boolean).join("/")+(s?"/":"")}const v=globalThis.__sveltekit_1q333f5?.base??"",k=globalThis.__sveltekit_1q333f5?.assets??v??"";export{k as a,v as b,j as e,x as p,W as r};
