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