'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("../../../common/components/NoDataState.js"),r=require("./common/helpers.js"),a=require("@gem-sdk/system"),i=require("./common/classes.js"),l=require("./common/styles.js"),c=require("./hooks/useGpDescription.js");exports.default=n=>{let{setting:o,advanced:d,builderProps:m}=n,{htmlTag:p}=o??{},u=s.useProduct(),g=s.useCurrentDevice(),x=s.getResponsiveValueByScreen(o?.hasLineClamp,g),{ref:y,open:h,isShowViewMore:C,handleToggleShowMore:j,mode:S,redirectProductShopifyLink:v}=c.useGpDescription(o),{t:f}=s.useI18nStore(),k=a.createClass({"gp-product-description":!0,[d?.cssClass]:!0}),q=a.createClass(i.getClasses({setting:o,isLiquid:!1})),I=a.createClass(i.getButtonClasses({setting:o})),N=a.createClass({"gp-show-more-text":!0}),L=a.createClass({"gp-show-more-icon gp-ml-1":!0,...h?{"gp-rotate-180":!0}:{}}),_=a.createClass(i.getClassPreBuilt()),b=a.createStyle({...l.getTextStyle({setting:o}),...!h&&C?s.makeStyleResponsive("line-clamp",s.makeLineClamp(o?.lineClamp,o?.hasLineClamp)):{}}),w=a.createStyle(l.getButtonStyle({setting:o})),T=a.createAttr({"data-id":`${m?.uid}`}),H=a.createAttr({"data-gp-text":""}),{gpDescriptionCss:M,textDescriptionCss:A}=l.getStaticCss(),B=!u?.descriptionHtml;return B&&"edit"===S?e.jsx(t.default,{elementType:"secondary",description:f("Highlight key benefits with product description."),descriptionActions:[{text:f("Add description"),callback:v},{text:f("sync data"),callback:"syncProduct"}]}):e.jsx(e.Fragment,{children:a.If(B,"",e.jsxs("div",{...T,className:k,children:[e.jsx("style",{children:A}),e.jsx("style",{children:M}),e.jsx("div",{className:_}),e.jsx("html"===p?"div":"p",{ref:y,...H,className:q,style:b,dangerouslySetInnerHTML:{__html:u?.descriptionHtml||""}}),a.If(x&&C,e.jsxs("button",{className:I,style:w,onClick:j,children:[e.jsx("span",{className:N,children:a.If(h,o?.viewLessText||"",o?.viewMoreText)}),a.If(o?.enableViewMoreIcon,e.jsx("span",{className:L,dangerouslySetInnerHTML:{__html:r.ICON_SVG}}))]})," ")]}))})};
