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