function e(e){if(e)return e.split(`,`,1)[0]?.trim().split(`:`,1)[0]?.toLowerCase()||void 0}function t(t,n,r){if(!t?.length)return;let i=e(n),a=r?.toLowerCase();for(let n of t)if(i===e(n.domain)||a===n.defaultLocale.toLowerCase()||n.locales?.some(e=>e.toLowerCase()===a))return n}function n(e,t,n){let r=t.toLowerCase();if(r===n.toLowerCase())return e;let i=e.startsWith(`/`)?e:`/${e}`,a=(i.split(/[?#]/,1)[0]??i).toLowerCase(),o=`/${r}`;return a===o||a.startsWith(`${o}/`)?e.startsWith(`/`)?e:i:`/${t}${i}`}function r(e,t=``){return t?t+e:e}function i(i,a,{basePath:o,currentHostname:s,domainItems:c}){if(!c?.length)return;let l=t(c,void 0,a);if(!l)return;let u=t(c,s??void 0),d=n(i,a,l.defaultLocale);if(!(u&&e(u.domain)===e(l.domain)))return`${`http${l.http?``:`s`}://`}${l.domain}${r(d,o)}`}function a(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0})}function o(e,t,n){if(Object.hasOwn(e,t)){let r=e[t];a(e,t,Array.isArray(r)?r.concat(n):[r,n])}else a(e,t,n)}function s(e){return typeof e==`string`?e:typeof e==`number`&&!isNaN(e)||typeof e==`boolean`?String(e):``}function c(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e)){if(Array.isArray(r)){for(let e of r)t.append(n,s(e));continue}t.set(n,s(r))}return t}function l(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n),a=r.indexOf(`?`),o=a===-1?r:r.slice(0,a),s=a===-1?``:r.slice(a+1),c=new URLSearchParams(s);for(let[e,n]of t)c.append(e,n);let l=c.toString();return`${o}${l?`?${l}`:``}${i}`}export{i as a,n as i,l as n,c as r,o as t};