'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@gem-sdk/core"),p=require("react"),i=require("../../common/components/NoDataState.js"),r=require("../common/helpers.js");exports.default=({styles:o,builderProps:s})=>{let n=t.useArticleStore(e=>e.article),[a,l]=p.useState(!1),c=p.useRef(null),d=t.useCurrentDevice(),y=t.useShopStore(e=>e.storefrontUrl),{t:m}=t.useI18nStore(),u=t.getResponsiveValueByScreen(o?.hasLineClamp,d),g=t.getResponsiveValueByScreen(o?.lineClamp,d);p.useEffect(()=>{l(!1)},[u,g,n?.description]);let h=t.composeTypographyClassName(o?.typo,o?.typography),x=t.composeTypographyStyle(o?.typo,o?.typography),S=`
    .gp-p-description-text a:empty,
    .gp-p-description-text ul:empty,
    .gp-p-description-text dl:empty,
    .gp-p-description-text div:empty,
    .gp-p-description-text section:empty,
    .gp-p-description-text article:empty,
    .gp-p-description-text p:empty,
    .gp-p-description-text h1:empty,
    .gp-p-description-text h2:empty,
    .gp-p-description-text h3:empty,
    .gp-p-description-text h4:empty,
    .gp-p-description-text h5:empty,
    .gp-p-description-text h6:empty {
        display: none;
    }
   ${r.styleOverride}
  `;return e.jsx("div",{"data-id":s?.uid,id:`shopify-text-element-${s?.uid}`,className:"gp-article-description","data-article-id":n?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:n?.content?.html?e.jsxs(e.Fragment,{children:[!t.isSafari()&&e.jsx("style",{children:S}),e.jsx("div",{ref:c,className:t.cls("gp-p-description-text gp-content-text-override gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre",h),style:{...t.getGlobalColorStateStyle("c",o?.color),...t.makeStyleResponsive("ta",o?.textAlign),...u&&!a?t.makeStyleResponsive("line-clamp",o?.lineClamp):{},...t.getStyleShadow({value:o?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:o?.typo?.custom?.hasShadowText}),...t.makeStyle({tt:o?.transform}),...x},dangerouslySetInnerHTML:{__html:n?.content?.html}})]}):e.jsx("div",{children:e.jsx(i.default,{elementType:"secondary",description:m("Inform and provide value to the audience with article content."),descriptionActions:[{text:m("Add article content"),callback:()=>{if(!y)return;let e=new URL(y);window.open(`${e.protocol}//${e.host}/admin/content/articles`)}},{text:m("sync data"),callback:"syncArticle"}]})})})};
