'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Link=require("next/link"),Text=require("../../text/components/Text.js"),core=require("@gem-sdk/core"),React=require("react"),useArticleLink=require("../hooks/useArticleLink.js"),NoDataState=require("../../common/components/NoDataState.js");const ArticleExcerpt=({setting:e,styles:t,builderProps:r})=>{let i=core.useArticleStore(e=>e.article),s=core.useShopStore(e=>e.storefrontUrl),c=React.useMemo(()=>i?.content?.excerptHtml,[i]),{shopifyArticleLink:l}=useArticleLink.useArticleLink(),n=()=>{if(!s)return;let e=new URL(s);window.open(`${e.protocol}//${e.host}/admin/content/articles`)};return jsxRuntime.jsx("div",{id:`shopify-text-element-${r?.uid}`,"data-article-id":i?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:i&&c?e?.linkArticle?jsxRuntime.jsx(Link,{href:l,title:i?.title,children:jsxRuntime.jsx(Text.default,{builderProps:r,styles:t,setting:{...e,text:c,excludeFlex:!0}})}):jsxRuntime.jsx(Text.default,{builderProps:r,styles:t,setting:{...e,text:c,excludeFlex:!0}}):jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Provide a brief summary or teaser of the article. ",descriptionActions:[{text:"Add article excerpt",callback:n},{text:"sync data",callback:"syncArticle"}]})})};exports.default=ArticleExcerpt;
