'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 m,makeStyleResponsive as c,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 w=w=>{let{setting:L,advanced:b,builderProps:v}=w,{htmlTag:C}=L??{},H=o(),T=i(),M=r(L?.hasLineClamp,T),{ref:_,open:D,isShowViewMore:I,handleToggleShowMore:S,mode:A,redirectProductShopifyLink:P}=j(L),{t:q}=m(),G=p({"gp-product-description":!0,[b?.cssClass]:!0}),V=p(y({setting:L,isLiquid:!1})),$=p(g({setting:L})),z=p({"gp-show-more-text":!0}),B=p({"gp-show-more-icon gp-ml-1":!0,...D?{"gp-rotate-180":!0}:{}}),E=p(f()),F=d({...x({setting:L}),...D?{}:c("line-clamp",n(L?.lineClamp,L?.hasLineClamp))}),J=d(k({setting:L})),K=h({"data-id":`${v?.uid}`}),O=h({"data-gp-text":""}),{gpDescriptionCss:Q,textDescriptionCss:R}=N(),U=!H?.descriptionHtml;return U&&"edit"===A?e(l,{elementType:"secondary",description:q("Highlight key benefits with product description."),descriptionActions:[{text:q("Add description"),callback:P},{text:q("sync data"),callback:"syncProduct"}]}):e(t,{children:u(U,"",s("div",{...K,className:G,children:[e("style",{children:R}),e("style",{children:Q}),e("div",{className:E}),e("html"===C?"div":"p",{ref:_,...O,className:V,style:F,dangerouslySetInnerHTML:{__html:H?.descriptionHtml||""}}),u(M&&I,s("button",{className:$,style:J,onClick:S,children:[e("span",{className:z,children:u(D,L?.viewLessText||"",L?.viewMoreText)}),u(L?.enableViewMoreIcon,e("span",{className:B,dangerouslySetInnerHTML:{__html:a}}))]})," ")]}))})};export{w as default};
