import{useArticleStore as r,useShopStore as e,useRenderMode as t}from"@gem-sdk/core";import{urlJoin as o}from"../../link/common/helpers.js";import{useMemo as l}from"react";let useArticleLink=()=>{let n=r(r=>r.article),i=e(r=>r.storefrontUrl),{isPreviewSharePageMode:m}=t(),s=n?.handle?o("blogs",n?.blog?.handle??"",n.handle):"#",c=l(()=>{if(m)return`/articles/${n?.handle}`;if(!i)return"#";let r=new URL(i);return n?`${r.protocol}//${r.host}/${s}`:"#"},[i,n,s,m]);return{shopifyArticleLink:c}};export{useArticleLink};
