'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),system=require("@gem-sdk/system"),helpers=require("./common/helpers.js"),useDescription=require("../../hooks/useDescription.js");const CollectionDescription=({setting:e,builderProps:s,pageContext:t,advanced:l})=>{let{isPreviewSharePageMode:r}=core.useRenderMode(),a=core.useCollection(),{ref:i,open:c,isShowViewMore:n,handleToggleShowMore:o,hasLineClamp:m}=useDescription.useGpDescription(e),u=core.t("This collection does not have a description"),y=a?.descriptionHtml,p=system.createClass(classes.getClassContainerCollectionDes({setting:e})),x=system.createClass(classes.getClassEmptyCollectionDes()),d=system.createClass(classes.getClassButtonViewMore({setting:e})),j=system.createClass(classes.getDescriptionClasses({advanced:l})),C=system.createClass({...classes.getShowMoreIconClasses(),...c?{"gp-rotate-180":!0}:{}}),g=system.createClass(classes.getShowMoreTextClasses()),h=system.createClass(classes.getClassPreBuilt()),R=system.createStyle({...styles.getDefaultStyleCollectionDes({setting:e}),...c?{}:core.makeStyleResponsive("line-clamp",core.makeLineClamp(e?.lineClamp,e?.hasLineClamp))}),S=system.createStyle({...styles.getStyleDefaultViewMore(e)}),D=helpers.getViewLessText({setting:e,builderProps:s,pageContext:t,type:"react"}),M=helpers.getViewMoreText({setting:e,builderProps:s,pageContext:t,type:"react"}),I=system.createAttr({"data-id":`${s?.uid}`}),f=system.createAttr({"data-gp-text":""}),{gpDescriptionCss:_,textDescriptionCss:v}=styles.getStaticCss(),N=r?"":jsxRuntime.jsx("div",{className:x,dangerouslySetInnerHTML:{__html:u}});return jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(!y,N,jsxRuntime.jsxs("div",{...I,className:j,children:[jsxRuntime.jsx("style",{children:v}),jsxRuntime.jsx("style",{children:_}),jsxRuntime.jsx("div",{className:h}),jsxRuntime.jsx("div",{ref:i,className:p,style:R,dangerouslySetInnerHTML:{__html:a?.descriptionHtml??""},...f}),system.If(m&&n,jsxRuntime.jsxs("button",{type:"button",className:d,style:S,onClick:o,children:[jsxRuntime.jsx("span",{className:g,children:system.If(c,D?.toString()??"",M?.toString()??"")}),system.If(e?.enableViewMoreIcon,jsxRuntime.jsx("span",{className:C,dangerouslySetInnerHTML:{__html:helpers.ICON_SVG}}),"")]}),"")]}))})};exports.default=CollectionDescription;
