import{d as C,a3 as $,e as l,f as c,g as a,bi as f,bj as g,o as p,c6 as K,V as L}from"./BxiWQxwE.js";const R=["href","target"],S=["href"],W=C({__name:"app-link",props:{to:{type:[String,Object],required:!0},replace:{type:Boolean,required:!1,default:!1},target:{type:String,required:!1,default:void 0}},emits:["click"],setup(n,{expose:d,emit:h}){const e=n,i=$(),m=L(),k=/^(?:a1\.|t1\.)?dekamarkt\.nl$/,u=h,r=l(()=>{if(typeof e.to=="object")return i.resolve(e.to).href;if(typeof e.to=="string"){if(e.to.startsWith("#"))return e.to;if(K(e.to)){const t=new URL(e.to);return k.test(t.hostname)&&t.hostname.toLowerCase().includes(m.public.vendor.toLowerCase())?t.pathname+t.search:e.to}return e.to}return""}),b=l(()=>e.target?e.target:typeof r.value=="string"&&!r.value.startsWith("#")?"_blank":"_self"),y=t=>{var o;if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if((o=t.currentTarget)!=null&&o.getAttribute){const s=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(String(s)))return}return!0}},_=(t={})=>(u("click",t),y(t)?i[e.replace?"replace":"push"](r.value).catch(()=>{}):Promise.resolve());return d({href:r}),(t,o)=>!a(r).startsWith("/")||a(r).startsWith("#")||n.target==="_blank"?(p(),c("a",g({key:0,href:a(r)},t.$attrs,{target:a(b),rel:"noopener",onClick:o[0]||(o[0]=s=>u("click",s))}),[f(t.$slots,"default")],16,R)):(p(),c("a",g({key:1,href:a(r)},t.$attrs,{onClick:_}),[f(t.$slots,"default")],16,S))}});export{W as _};
