"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../../helpers.js"),styles=require("./common/styles.js"),system=require("@gem-sdk/system"),classes=require("./common/classes.js"),helpers=require("./common/helpers.js");const CollectionDescription=({setting:e,advanced:s,builderProps:t,pageContext:l})=>{let i=system.createClass(classes.getClassContainerCollectionDes({setting:e})),r=system.createClass(classes.getClassButtonViewMore({setting:e})),a=system.createClass(classes.getDescriptionClasses({advanced:s})),o=system.createClass(classes.getShowMoreIconClasses()),c=system.createClass(classes.getShowMoreTextClasses()),n=system.createClass(classes.getClassPreBuilt()),p=system.createStyle({...styles.getDefaultStyleCollectionDes({setting:e}),...core.makeStyleResponsive("line-clamp",core.makeLineClamp(e?.lineClamp,e?.hasLineClamp))}),m=system.createStyle({...styles.getStyleDefaultViewMore(e)}),y=helpers.getViewLessText({setting:e,builderProps:t,pageContext:l,type:"liquid"}),d=helpers.getViewMoreText({setting:e,builderProps:t,pageContext:l,type:"liquid"}),$=system.createAttr({"data-id":`${t?.uid}`,"view-more-text":`${l?.isPreviewing?d:`{{${d}}}`}`,"view-less-text":`${l?.isPreviewing?y:`{{${y}}}`}`}),g=system.createAttr({"data-gp-text":""}),{gpDescriptionCss:C,textDescriptionCss:u}=styles.getStaticCss(),v=system.createStateOrContext({setting:{lineClamp:e?.lineClamp,hasLineClamp:e?.hasLineClamp,viewMoreText:d,viewLessText:y,enableViewMoreIcon:e?.enableViewMoreIcon},textStyle:p}),S=()=>{let e=core.isLocalEnv?"{{ 'gp-collection-description-v7-5.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-collection-description-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return system.If(!1,"",system.Liquid(core.template`
    <gp-collection-description
      ${$}
      class="${a}"
      gp-data='${JSON.stringify(v).replaceAll("'","&#039;")}'
    >
      <style>${u}</style>
      <style>${C}</style>
      <div class="${n}" ></div>
      ${system.LiquidUnless("collection","<p>Collection not found</p>",core.template`<div ${g} class="${i}" style="${p}">
          {{collection.description}}
        </div>
        ${system.LiquidIf("collection.description != blank",core.template`<button type="button" class="${r}" style="${m}">
          <span class="${c}">
            ${system.If(l?.isPreviewing,d?.toString()||"",`{{${d}}}`)}
          </span>
          ${system.If(e?.enableViewMoreIcon,core.template`<span class="${o}">${helpers.ICON_SVG}</span>`," ")}
          </button>`)}`)}
    </gp-collection-description>
    ${S()}
    `))};exports.default=CollectionDescription;
