"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),system=require("@gem-sdk/system"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers$1=require("./common/helpers.js"),translate=require("../../settings/product-description/configs/translate.js");const ProductDescription=e=>{let{setting:s,advanced:t,builderProps:r,pageContext:a}=e,{htmlTag:i,viewMoreText:l,viewLessText:c}=s??{},o="html"===i?"div":"p",n=system.createClass({"gp-product-description":!0,[t?.cssClass]:!0}),p=system.createClass(classes.getClasses({setting:s,isLiquid:!0})),d=system.createClass(classes.getButtonClasses({setting:s})),m=system.createClass({"gp-show-more-text":!0}),u=system.createClass({"gp-show-more-icon gp-ml-1":!0}),y=system.createStyle({...styles.getTextStyle({setting:s,renderMaxHeight:!0}),...core.makeStyleResponsive("line-clamp",core.makeLineClamp(s?.lineClamp,s?.hasLineClamp))}),g=system.createClass(classes.getClassPreBuilt()),$=system.createStyle(styles.getButtonStyle({setting:s})),C=system.createAttr({"data-id":`${r?.uid}`}),S=system.createAttr({"data-gp-text":""}),{textDescriptionCss:v,gpDescriptionCss:h}=styles.getStaticCss(),x="product.description == blank",L=()=>{let e=core.isLocalEnv?"{{ 'gp-product-description-v7-5.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-description-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`},q=helpers.getDynamicSourceLocales({val:l,uid:r?.uid,settingId:helpers.createSettingId({id:translate.ProductDescription?.viewMoreText?.id}),pageContext:a??{}}),I=helpers.getDynamicSourceLocales({val:c,uid:r?.uid,settingId:helpers.createSettingId({id:translate.ProductDescription?.viewLessText?.id}),pageContext:a??{}}),f=system.createStateOrContext({setting:{lineClamp:s?.lineClamp,hasLineClamp:s?.hasLineClamp,viewMoreText:q,viewLessText:I,enableViewMoreIcon:s?.enableViewMoreIcon},textStyle:y});return system.LiquidIf(x,"",system.Liquid(core.template`
    <gp-product-description
      ${C}
      class="${n}"
      gp-data='${core.dataStringify(f).replaceAll("'","&#039;")}'
      data-view-more-text="${q}"
      data-view-less-text="${I}"
    >
      <style>${v}</style>
      <style>${h}</style>
      <div class="${g}" ></div>
      ${system.LiquidUnless("product","<p>Product not found</p>",core.template`<${o} ${S} class="${p}" style="${y}">
          {{product.description}}
        </${o}>
        ${system.LiquidUnless(x,core.template`<button type="button" class="${d}" style="${$}">
          <span class="${m}">
            ${system.If(!1,I?.toString(),q?.toString())}
          </span>
          ${system.If(s?.enableViewMoreIcon,core.template`<span class="${u}">${helpers$1.ICON_SVG}</span>`," ")}
          </button>`)}`)}
    </gp-product-description>

    ${L()}
  `))};exports.default=ProductDescription;
