import{n as e}from"./dist-BXwifpp-.js";function t(e){return e.startsWith(`[[...`)&&e.endsWith(`]]`)?`:${e.slice(5,-2)}*`:e.startsWith(`[...`)&&e.endsWith(`]`)?`:${e.slice(4,-1)}+`:e.startsWith(`[`)&&e.endsWith(`]`)?`:${e.slice(1,-1)}`:e}function n(e){return e.split(`/`).filter(Boolean).map(t)}function r(e){let t=n(e);return t.length>0?`/${t.join(`/`)}`:``}function i(e,t){if(Array.isArray(t)){for(let n of t)e.push(n);return}e.push(t)}function a(e,t){let n=e.split(`/`).filter(Boolean),r=[];for(let e of n){if(e.startsWith(`[[...`)&&e.endsWith(`]]`)){let n=t[e.slice(5,-2)];if(n!==void 0&&n!==``){if(Array.isArray(n)&&n.length===0)continue;i(r,n)}continue}if(e.startsWith(`[...`)&&e.endsWith(`]`)){let n=t[e.slice(4,-1)];if(n===void 0||(Array.isArray(n)?n.length===0:n===``))return null;i(r,n);continue}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=t[e.slice(1,-1)];if(typeof n==`string`){r.push(n);continue}if(Array.isArray(n)&&n.length>0){if(n.length>1)return null;r.push(n[0]);continue}return null}r.push(e)}return r.length>0?`/${r.join(`/`)}`:`/`}function o(t,n){let r=s(t,n);return r&&e(r),r}function s(e,t){let n=Object.create(null);function r(i,a){if(a===t.length)return i===e.length;let o=t[a];if(o.startsWith(`:`)&&(o.endsWith(`+`)||o.endsWith(`*`))){let t=o.slice(1,-1),s=+!!o.endsWith(`+`);for(let o=i+s;o<=e.length;o++){let s=e.slice(i,o);if(s.length>0?n[t]=s:delete n[t],r(o,a+1))return!0}return delete n[t],!1}if(o.startsWith(`:`)){if(i>=e.length)return!1;let t=o.slice(1);return n[t]=e[i],r(i+1,a+1)?!0:(delete n[t],!1)}return i>=e.length||e[i]!==o?!1:r(i+1,a+1)}return r(0,0)?n:null}function c(e,t){let n=Object.create(null),r=0;for(let i of e){if(!i.startsWith(`:`)){r+=1;continue}let e=i.endsWith(`+`)||i.endsWith(`*`),a=i.slice(1,e?-1:void 0);if(e){let e=t.slice(r);e.length>0&&(n[a]=[...e]);break}let o=t[r];o!==void 0&&(n[a]=o),r+=1}return n}function l(e,t){let n=0;for(let r=0;r<t.length;r++){let i=t[r],a=r===t.length-1;if(i.startsWith(`:`)&&i.endsWith(`+`))return a&&e.length-n>=1;if(i.startsWith(`:`)&&i.endsWith(`*`))return a;if(n>=e.length)return!1;if(i.startsWith(`:`)){n++;continue}if(e[n]!==i)return!1;n++}return!0}export{s as a,l as i,a as n,r as o,o as r,c as t};