import{S as o}from"./Str.js?ver=1.5.4";import{A as f}from"./Arr.js?ver=1.5.4";import{a as w}from"./vue-router.js?ver=1.5.4";class S{static appendQueryParams(e,t={}){const r=new URL(e);return Object.entries(t).forEach(([n,s])=>{s!=null&&r.searchParams.append(n,s.toString())}),r.toString()}static join(e,t,r={}){return o.endsWith(e,"/")||(e=e+"/"),o.startsWith(t,"/")&&(t=t.substring(1)),this.appendQueryParams(e+t,r)}static addParam(e,t,r){const n=new URL(e);return n.searchParams.append(t,r),n.toString()}static getParam(e,t){return new URL(e??window.location.href).searchParams.get(t)}static removeParam(e,t){const r=new URL(e);return r.searchParams.delete(t),r.toString()}static pushToVueUrl(e=null,t={}){const r=this.appendToVueUrl(e,t);r&&window.history.replaceState({},"",r)}static appendToVueUrl(e=null,t={}){if(typeof window>"u")return;const r=e??window.location.href,n=new URL(r),s=r.split("#")[0],i=n.hash;if(!i.includes("?")){const a=i.replace(/\/?$/,"/")+"?"+new URLSearchParams(t).toString();return`${s}${a}`}const[l,u]=i.slice(1).split("?"),c=new URLSearchParams(u||"");Object.entries(t).forEach(([a,m])=>{c.set(a,m.toString())});const d=`#${l}?${c.toString()}`;return`${s}${d}`}static getAdminRoute(e=""){return f.get(window,"fluentCartAdminApp.admin_url")+e}static getVueParams(e){var r;const t=w();return((r=t==null?void 0:t.query)==null?void 0:r[e])??(t==null?void 0:t.query)??null}static scrollToHashSection(e){const t=e!=null&&e.startsWith("#")?e.slice(1):e||"";if(!t)return;const r=document.getElementById(t);r&&(r.scrollIntoView({behavior:"smooth",block:"start"}),r.classList.add("fct-scroll-highlight"),r.addEventListener("animationend",()=>r.classList.remove("fct-scroll-highlight"),{once:!0}))}}export{S as U};
