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