"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../../../helpers/function.js"),l=require("../../common/base/classes.js"),r=require("@gem-sdk/system"),a=require("../../common/base/attrs.js"),s=require("../../common/base/styles.js");exports.default=i=>{let{optionTypography:c,optionBorder:o,optionRounded:g,optionTypo:d,typeOfOption:u}=i,p="color"===u,n="image"===u||"image_shopify"===u,y=r.createClass(l.getColorClass({})),C=()=>e.template`
      ${r.LiquidFor("color in colors",`
          ${r.Liquid('{% assign backgroundType = "background-color" %}')}
          ${r.LiquidIf('color contains "linear-gradient"',r.Liquid('{% assign backgroundType = "background-image" %}'))}
          <div
            class="${y}"
            data-test="{{ backgroundType }}: {{ color }}"
            style="{{ backgroundType }}: {{ color }}; ${f()}"></div>
        `)}
      `,m=r.createStyle(s.getColorStyle({optionBorder:o,optionRounded:g,isActive:!0})),v=r.createStyle(s.getColorStyle({optionBorder:o,optionRounded:g,isActive:!1})),f=()=>r.LiquidIf("selectedValue == value",t.getStyleOfObject(m),t.getStyleOfObject(v)),b=r.createClass(l.getWrapperTextClass(n,p)),S=r.createStyle({...s.getWrapperTextStyle(i)}),$=r.createClass(l.getTextClass({optionTypo:d,optionTypography:c,isColorType:p,isUploadImageType:n})),q=r.createStyle(s.getTextStyle({optionTypo:d,optionTypography:c})),L=()=>e.template`
      <div
        class="${b}"
        style="${p?f():""} ${t.getStyleOfObject(S)}">
        ${r.If(n,'<svg width="15" height="12" viewBox="0 0 15 12" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="2" fill="#D6D6D6"></circle><path d="M0.196854 10.6453L2.40968 8.05946C2.4846 7.97175 2.57719 7.9008 2.68141 7.85124C2.78562 7.80168 2.89913 7.77461 3.01452 7.77181C3.12991 7.76902 3.2446 7.79055 3.3511 7.835C3.45761 7.87945 3.55353 7.94583 3.63262 8.02981L4.66733 9.12714L8.71205 4.29464C8.79123 4.19995 8.89077 4.1243 9.00325 4.07333C9.11573 4.02236 9.23827 3.99737 9.36176 4.00022C9.48524 4.00307 9.6065 4.03369 9.71651 4.08979C9.82651 4.1459 9.92245 4.22605 9.99717 4.32429L14.8329 10.6772C14.9254 10.7989 14.982 10.9441 14.9964 11.0962C15.0107 11.2484 14.9823 11.4016 14.9144 11.5385C14.8464 11.6754 14.7415 11.7907 14.6115 11.8713C14.4815 11.952 14.3316 11.9948 14.1786 11.995L0.822048 12C0.664945 11.9999 0.511148 11.9549 0.378853 11.8703C0.246557 11.7857 0.141299 11.6649 0.0755311 11.5224C0.00976323 11.3799 -0.013762 11.2216 0.00773837 11.0661C0.0292388 10.9107 0.0948652 10.7646 0.196854 10.6453Z" fill="#D6D6D6"></path></svg>'," ")}
        <span class="${$}" style="${q}">{{value}}</span>
      </div>
    `,h=()=>e.template`
      <img class="gp-object-cover gp-rounded-none" style="width: 64px; height: 64px" src="{{imageUrl}}" alt="" />
    `,j=r.createClass(l.getWrapperClass({...i,available:!0})),x=r.createAttr(a.getWrapperAttr(i,"Liquid")),O=r.createStyle(s.getWrapperStyleActive(i)),k=r.createStyle(s.getWrapperStyleNormalAndHover(i));return e.template`
    <div
      ${x}
      class="${j}"
      style="${r.LiquidIf("selectedValue == value",t.getStyleOfObject({...O,...m}),t.getStyleOfObject({...k,...v}))}">
      ${(()=>{switch(u){case"color":return e.template`${r.LiquidIf("colors != null and colors.size > 0",C(),L())}`;case"image":case"image_shopify":return e.template`${r.LiquidIf('imageUrl != null and imageUrl != ""',h(),L())}`;default:return L()}})()}
    </div>`};
