@sledge-app/js 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{R as e,j as t,$ as i,a as s,b as l,c as n,d,e as r,f as a,g as o,h as c,i as u,k as g,l as h,m as p,n as m,o as _,p as v,q as w,r as x,s as f,t as j,u as C,v as y,w as S,x as N,y as L,z as A,A as T,B as E,C as b,D as R,E as I,F as O,G as P,H as k,I as D,J as M,K as W,L as B,M as H,N as U,O as F,P as G,Q as $,S as V,T as q,U as z,V as J,W as Z,X as K,Y,Z as X,_ as Q,a0 as ee,a1 as te,a2 as ie,a3 as se,a4 as le,a5 as ne,a6 as de,a7 as re,a8 as ae,a9 as oe,aa as ce,ab as ue,ac as ge,ad as he,ae as pe,af as me,ag as _e,ah as ve}from"./assets/vendor-f2befdd9.js";const we="",xe=e=>{if(!e)return"";let t=String(e);if(t.includes("shopify")&&t.includes("/")){let e=t.split("/");return e[e.length-1]||t}return t},fe=e=>{document.addEventListener("DOMContentLoaded",e)},je=(e,t)=>{let i=!1;document.body.addEventListener("DOMNodeInserted",(()=>{!i&&e&&(i=!0,t())}))},Ce=(e,t,i)=>{if(e&&i.includes(e)&&t&&i.includes(t)){let s=i.indexOf(e)+e.length;return i.substring(s,i.indexOf(t,s))}return i},ye=e=>"function"==typeof e,Se="https://sledge-api-preprod.offstack.io",Ne="https://instant-search-engine.offstack.io",Le="sledge-embed-script",Ae="data-component",Te={GLOBAL:{ON_AFTER_ADD_WISHLIST:"data-on-after-add-wishlist",ON_AFTER_REMOVE_WISHLIST:"data-on-after-remove-wishlist",ON_AFTER_ADD_TO_CART:"data-on-after-add-to-cart",ON_AFTER_ADD_REVIEW:"data-on-after-add-review",ON_AFTER_RENDER_PRODUCT:"data-on-after-render-product",PRODUCT_ID:"data-product-id",PRODUCT_VARIANT_ID:"data-product-variant-id",PRODUCT_NAME:"data-product-name",PRODUCT_VENDOR:"data-product-vendor",PRODUCT_SKU:"data-product-sku",PRODUCT_VARIANT_NAME:"data-product-variant-name",PRODUCT_LINK:"data-product-link",PRODUCT_IMAGE:"data-product-image",PRODUCT_CURRENCY:"data-product-currency",PRODUCT_PRICE:"data-product-price",USER_ID:"data-user-id",USER_EMAIL:"data-user-email",USER_FULLNAME:"data-user-fullname",COLLECTION_ID:"data-collection-id",WIDTH_ELEMENT:"data-width-element",ICON_SIZE:"data-icon-size",API_KEY:"data-api-key",INSTANT_SEARCH_API_KEY:"data-instant-search-api-key",RENDER_COMPONENT:"data-render-component"},WISHLIST:{SHARE_ID:"data-share-id"},PRODUCT_REVIEW:{RATING_SIZE:"data-rating-size"},INSTANT_SEARCH:{QUERY_KEYWORD:"data-query-keyword"}},Ee={ANONYM_ID:"sledge-anonym-id",AUTH_APP:"sledge-auth-app",INSTANT_SEARCH_AUTH_APP:"sledge-instant-search-auth-app",WISHLIST_SETTING:"sledge-wishlist-setting",PRODUCT_REVIEW_SETTING:"sledge-product-review-setting",INSTANT_SEARCH_SETTING:"sledge-instant-search-setting"},be={ELEMENT_TOAST_NOTIFICATION:"toast-notification",ELEMENT_CONFIRMATION_POPUP:"confirmation-popup",ELEMENT_INFO_POPUP:"info-popup",WISHLIST:{ELEMENT_BADGE_FLOATING_ICON:"wishlist-badge-floating-icon",ELEMENT_BADGE_FLOATING_FULL:"wishlist-badge-floating-full",ELEMENT_WIDGET_POPUP:"wishlist-widget-popup"},PRODUCT_REVIEW:{ELEMENT_WIDGET_POPUP_DETAIL:"product-review-widget-popup-detail",ELEMENT_WIDGET_FORM_ADD:"product-review-widget-form-add"},INSTANT_SEARCH:{ELEMENT_SEARCH_ICON_WIDGET_POPUP:"instant-search-icon-widget-popup"}},Re={GLOBAL:{ELEMENT_PRODUCT_CARDS:`[${Ae}="product-cards"]`,ELEMENT_SUGGESTION_KEYWORD_LISTS:`[${Ae}="suggestion-keyword-lists"]`,ELEMENT_OTHER_INDEX_LISTS:`[${Ae}="other-index-lists"]`,ELEMENT_SEARCH_VIEW_MORE_RESULT:`[${Ae}="search-view-more-result"]`},WISHLIST:{ELEMENT_BADGE:`[${Ae}="wishlist-badge"]`,ELEMENT_BADGE_MENU_ITEM:'[href="#sledge-wishlist-badge-menu-item"]',ELEMENT_TRIGGER:`[${Ae}="wishlist-trigger"]`,ELEMENT_WIDGET:`[${Ae}="wishlist-widget"]`,ELEMENT_BUTTON_DETAIL:`[${Ae}="wishlist-button-detail"]`},PRODUCT_REVIEW:{ELEMENT_WIDGET:`[${Ae}="product-review-widget"]`,ELEMENT_RATING:`[${Ae}="product-review-rating"]`},INSTANT_SEARCH:{ELEMENT_SEARCH_WIDGET:`[${Ae}="instant-search-widget"]`,ELEMENT_SEARCH_ICON_WIDGET:`[${Ae}="instant-search-icon-widget"]`,ELEMENT_SEARCH_RESULT_WIDGET:`[${Ae}="instant-search-result-widget"]`,ELEMENT_PLP_WIDGET:`[${Ae}="instant-search-product-filter-widget"]`}},Ie=[10,25,50,100],Oe="/pages/search-result",Pe={STORE:{NAME:"{{ shop.name }}"}},ke={PRODUCT:{CARDS:"ProductCards"},SUGGESTION_KEYWORD_LISTS:"SuggestionKeywordLists",OTHER_INDEX_LISTS:"OtherIndexLists",SEARCH_VIEW_MORE_RESULT:"SearchViewMoreResult"},De="gid://shopify/",Me=`${De}Product/`,We=`${De}ProductVariant/`,Be=async e=>{let t=localStorage.getItem(Ee.AUTH_APP);var i=new Headers;i.append("Authorization",`Bearer ${t}`);var s={method:"GET",headers:i,redirect:"follow"};return await fetch(`${Se}/app/${e}/setting`,s).then((e=>e.json())).then((e=>e)).catch((()=>{}))},He=async e=>{const{API_KEY:t,INSTANT_SEARCH_API_KEY:i,USER_ID:s,USER_EMAIL:l,USER_FULLNAME:n}=e;var d=new Headers;d.append("Authorization",`Bearer ${t||""}`),d.append("Content-Type","application/json");var r={method:"POST",headers:d,body:JSON.stringify({user:{id:s||"",email:l||"",name:n||"",anonym:localStorage.getItem(Ee.ANONYM_ID)||""}}),redirect:"follow"};return await fetch(`${Se}/app/token`,r).then((e=>e.json())).then((async e=>{const{data:t}=e||{},{anonym:s,token:l}=t||{};return localStorage.setItem(Ee.ANONYM_ID,s||""),localStorage.setItem(Ee.AUTH_APP,l||""),localStorage.setItem(Ee.INSTANT_SEARCH_AUTH_APP,i||""),e})).catch((e=>e))},Ue="",Fe="",Ge=()=>{const[c,u]=e.useState(""),[g,h]=e.useState(""),[p,m]=e.useState(""),[_,v]=e.useState(""),[w,x]=e.useState(""),[f,j]=e.useState(!1),[C,y]=e.useState({onSubmit:()=>{}});return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeConfirmationPopup=({title:e,message:t,textSubmit:i,textCancel:s,buttonSubmitType:l,onSubmit:n})=>{j(!0),u(e),h(t),m(i),v(s),x(l),y({onSubmit:n})})}),[]),t.jsx(i,{open:f,onOpenChange:j,children:t.jsxs(s,{children:[t.jsx(l,{className:"sledge__alert-dialog-overlay AlertDialogOverlay"}),t.jsxs(n,{className:"sledge__alert-dialog-content AlertDialogContent",children:[t.jsx(d,{className:"AlertDialogTitle",dangerouslySetInnerHTML:{__html:c}}),t.jsx(r,{className:"AlertDialogDescription",dangerouslySetInnerHTML:{__html:g}}),t.jsxs("div",{className:"AlertDialogFooter",children:[t.jsx(a,{asChild:!0,children:t.jsx("button",{className:"sledge__alert-dialog-button sledge__alert-dialog-button-cancel",onClick:()=>j(!1),children:_})}),t.jsx(o,{asChild:!0,children:t.jsx("button",{className:`sledge__alert-dialog-button ${w}`,onClick:()=>{C.onSubmit(),j(!1)},children:p})})]})]})]})})},$e=()=>{let i=document.querySelector(`[${Ae}="${be.ELEMENT_CONFIRMATION_POPUP}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.ELEMENT_CONFIRMATION_POPUP),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Ge,{})})))},Ve="",qe=()=>{const[i,s]=e.useState(""),[l,n]=e.useState(""),[d,r]=e.useState(""),[a,o]=e.useState(!1);return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeInfoPopup=({title:e,message:t,textCancel:i})=>{o(!0),s(e),n(t),r(i)})}),[]),t.jsx(u,{open:a,onOpenChange:o,children:t.jsxs(g,{children:[t.jsx(h,{className:"sledge__dialog-overlay DialogOverlay"}),t.jsxs(p,{className:"sledge__dialog-content DialogContent",children:[t.jsx(m,{className:"DialogTitle",dangerouslySetInnerHTML:{__html:i}}),t.jsx(_,{className:"DialogDescription",dangerouslySetInnerHTML:{__html:l}}),t.jsx("div",{className:"DialogCloseButton",children:t.jsx("button",{className:"sledge__dialog-button sledge__dialog-button-cancel",onClick:()=>o(!1),children:d})}),t.jsx("button",{className:"IconButton","aria-label":"Close",onClick:()=>o(!1),children:t.jsx("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M1.22578 13.8248L0.175781 12.7748L5.95078 6.9998L0.175781 1.2248L1.22578 0.174805L7.00078 5.9498L12.7758 0.174805L13.8258 1.2248L8.05078 6.9998L13.8258 12.7748L12.7758 13.8248L7.00078 8.0498L1.22578 13.8248Z",fill:"currentColor"})})})]})]})})},ze=()=>{let i=document.querySelector(`[${Ae}="${be.ELEMENT_INFO_POPUP}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.ELEMENT_INFO_POPUP),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(qe,{})})))},Je="",Ze=()=>{const[i,s]=e.useState(!1),[l,n]=e.useState(""),[d,r]=e.useState(""),[a,o]=e.useState(""),[c,u]=e.useState(null),[g,h]=e.useState(""),p=e.useRef(0);return e.useEffect((()=>("undefined"!=typeof window&&(window.sledgeToastNotification=({title:e,message:t,location:i="bottom-right",icon:l=null,type:d})=>{n(e),r(t),o(i),u(l),h(d),s(!1),window.clearTimeout(p.current),p.current=window.setTimeout((()=>{s(!0)}),10)}),()=>clearTimeout(p.current))),[]),t.jsxs(v,{children:[t.jsxs(w,{className:"sledge__ToastRoot",open:i,onOpenChange:s,children:[t.jsxs("div",{className:"sledge__toast-icon-wrapper",children:[c,t.jsx("div",{className:"sledge__toast-type","data-notification-type":g,children:"success"===g?t.jsx(ft,{width:15,height:15,color:"white"}):t.jsx(jt,{width:15,height:15,color:"white"})})]}),t.jsxs("div",{className:"sledge__toast-message-wrapper",children:[t.jsx(x,{className:"sledge__ToastTitle",children:l}),t.jsx(f,{asChild:!0,children:t.jsx("p",{className:"sledge__ToastDescription",children:d})})]}),t.jsx("div",{className:"sledge__toast-action-wrapper",children:t.jsx(j,{className:"sledge__ToastAction",asChild:!0,altText:"Close notification",children:t.jsx(Lt,{colorType:"outlined-danger",children:"Dismiss"})})})]}),t.jsx(C,{className:"sledge__ToastViewport","data-location":a})]})},Ke=()=>{let i=document.querySelector(`[${Ae}="${be.ELEMENT_TOAST_NOTIFICATION}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.ELEMENT_TOAST_NOTIFICATION),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Ze,{})})))},Ye="",Xe=({trigger:i,content:s,isOpen:l,setIsOpen:n,hideCloseIcon:d,align:r,className:a,withOpenState:o=!0,withArrow:c=!0,customArrow:u="",sideOffset:g=5,alignOffset:h=0})=>{const[p,m]=e.useState(!!o&&l);return e.useEffect((()=>{var e;let t=null==(e=null==document?void 0:document.querySelector(".PopoverArrow"))?void 0:e.parentElement;t&&(null==u?void 0:u.length)&&(t.style.display="inline-flex",t.innerHTML=u)}),[p]),t.jsxs(y,{...o&&{open:l},...n&&{onOpenChange:e=>{m(e),n(e)}},children:[t.jsx(S,{asChild:!0,children:i}),t.jsx(N,{children:t.jsxs(L,{className:`sledge__popover-content ${a||""}`,sideOffset:g,alignOffset:h,align:r,...n&&{onOpenAutoFocus:()=>n(!0),onCloseAutoFocus:()=>n(!1)},children:[s,!d&&t.jsx(A,{className:"PopoverClose","aria-label":"Close",children:t.jsx("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}),c?t.jsx(T,{className:"PopoverArrow"}):null]})})]})},Qe="",et=({value:i,total:s,fillColor:l="",outlineColor:n=""})=>{const[d,r]=e.useState(0);return e.useEffect((()=>{const e=setTimeout((()=>r(+i/s*100)),150);return()=>clearTimeout(e)}),[]),t.jsx(E,{className:"sledge__progress",value:d,style:n?{borderWidth:"1px",borderStyle:"solid",borderColor:n}:{},children:t.jsx(b,{className:"ProgressIndicator",style:{transform:`translateX(-${100-d}%)`,...l&&{backgroundColor:l}}})})},tt="",it=({id:e,name:i,value:s,required:l,label:n,defaultChecked:d,labelStyle:r={},onClick:a})=>t.jsxs("div",{className:"sledge__checkbox-wrapper",children:[t.jsx(R,{className:"sledge__checkbox-root",defaultChecked:d,id:e,name:i,value:s,required:l,onClick:a,children:t.jsx(I,{className:"sledge__checkbox-indicator",children:t.jsx("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.72318 0.237414C10.0707 0.574491 10.0942 1.14584 9.77561 1.51356L4.40976 7.70711C4.25243 7.88871 4.03181 7.99443 3.79903 7.99979C3.56625 8.00514 3.3415 7.90965 3.17686 7.73545L0.250031 4.63868C-0.0833435 4.28595 -0.0833435 3.71406 0.250031 3.36133C0.583405 3.00859 1.12391 3.00859 1.45729 3.36133L3.75367 5.79105L8.51706 0.292899C8.83564 -0.0748211 9.37564 -0.0996624 9.72318 0.237414Z",fill:"white"})})})}),n&&t.jsx("label",{className:"sledge__checkbox-label",htmlFor:e,style:r,children:n})]}),st="",lt=i=>{const{defaultValue:s,min:l,max:n,step:d=1,setValueCommit:r,setValueChange:a}=i,[o,c]=e.useState(s);return t.jsx("form",{children:t.jsxs(O,{className:"sledge__SliderRoot",defaultValue:s,min:l,max:n,step:d,"aria-label":"Volume",onValueCommit:e=>{r&&r(e),c(e)},onValueChange:e=>{a&&a(e),c(e)},children:[t.jsx(P,{className:"sledge__SliderTrack",children:t.jsx(k,{className:"sledge__SliderRange"})}),t.jsx(Vs,{content:o[0],customArrow:'<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#23BC45"/></svg>',wrapTrigger:!1,children:t.jsx(D,{className:"sledge__SliderThumb"})}),t.jsx(Vs,{content:o[1],customArrow:'<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#23BC45"/></svg>',wrapTrigger:!1,children:t.jsx(D,{className:"sledge__SliderThumb"})})]})})},nt="",dt=({currentPage:e,totalPage:i,totalResult:s,onChange:l})=>{const n=1===e,d=e===i;return t.jsxs("div",{className:"sledge__pagination",children:[t.jsx("button",{type:"button",className:"sledge__pagination-navigation",...n?{disabled:!0}:{onClick:()=>l(e-1)},children:t.jsx(_t,{width:17,height:17,color:"black"})}),t.jsxs("span",{children:["Page ",e," of ",i," - total ",s," result"]}),t.jsx("button",{type:"button",className:"sledge__pagination-navigation",...d?{disabled:!0}:{onClick:()=>l(e+1)},children:t.jsx(vt,{width:17,height:17,color:"black"})})]})},rt="",at=({id:e,name:i,required:s,defaultValue:l,items:n,labelStyle:d={},onValueChange:r})=>t.jsx("div",{className:"sledge__radio-group-wrapper",children:t.jsx("form",{children:t.jsx(M,{className:"sledge__radio-group-root","aria-label":"View density",defaultValue:l,id:e,name:i,required:s,onValueChange:r,children:n.map(((i,s)=>{const{label:l,value:n}=i;return t.jsxs("div",{className:"sledge__radio-group-item-flex",children:[t.jsx(W,{className:"sledge__radio-group-item",value:n,id:`${e}${s}`,children:t.jsx(B,{className:"sledge__radio-group-indicator"})}),t.jsx("label",{className:"sledge__radio-group-label",htmlFor:`${e}${s}`,style:d,children:l})]},s)}))})})}),ot="",ct=({id:e,name:i,value:s,rgb:l,image:n,required:d,defaultChecked:r,onClick:a})=>{const o={...(null==n?void 0:n.length)?{backgroundImage:`url(${n})`}:{backgroundColor:l}};return t.jsx("div",{className:"sledge__color-swatch-wrapper",children:t.jsx(R,{className:"sledge__color-swatch-root",defaultChecked:r,id:e,name:i,value:s,required:d,onClick:a,style:o})})},ut="",gt=({name:e,placeholder:i,required:s,defaultValue:l,items:n,labelStyle:d={},onValueChange:r})=>t.jsx("div",{className:"sledge__select-wrapper",children:t.jsxs(G,{name:e,required:s,onValueChange:r,children:[t.jsxs($,{className:"sledge__select-trigger",children:[t.jsx(V,{placeholder:i}),t.jsx(q,{className:"sledge__select-icon",children:t.jsx("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})]}),t.jsx(z,{children:t.jsxs(J,{className:"sledge__select-content",children:[t.jsx(Z,{className:"sledge__select-scroll-button",children:t.jsx("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}),t.jsx(K,{className:"sledge__select-viewport",children:n.map(((e,i)=>{const{label:s,value:l}=e;return t.jsx(ht,{value:l,children:s},i)}))}),t.jsx(Y,{className:"sledge__select-scroll-button",children:t.jsx("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})]})})]})}),ht=e.forwardRef((({children:e,className:i="",...s},l)=>t.jsxs(H,{className:`sledge__select-item ${i}`,...s,ref:l,children:[t.jsx(U,{children:e}),t.jsx(F,{className:"sledge__select-item-indicator",children:t.jsx("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})]}))),pt=({width:e,height:i,type:s,color:l})=>t.jsx("span",{className:"sledge-icon__heart",children:"outline"===s?t.jsx("svg",{width:e,height:i,id:"sledge-icon-heart-line",viewBox:"0 0 18 17",fill:l,children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.19515 0.86581C10.5501 0.00914308 12.3501 -0.227524 13.9051 0.27081C17.2876 1.36164 18.3376 5.04914 17.3985 7.98331C15.9493 12.5916 9.76015 16.0291 9.49765 16.1733C9.40431 16.225 9.30098 16.2508 9.19765 16.2508C9.09431 16.2508 8.99181 16.2258 8.89848 16.175C8.63765 16.0325 2.49348 12.6458 0.995979 7.98414L0.995146 7.98331C0.0551462 5.04831 1.10181 1.35998 4.48098 0.27081C6.06765 -0.242524 7.79681 -0.0166903 9.19515 0.86581ZM4.86431 1.46081C2.13015 2.34248 1.44348 5.28331 2.18598 7.60248C3.35431 11.2375 7.97015 14.1766 9.19681 14.9041C10.4276 14.1691 15.0768 11.1975 16.2076 7.60581C16.9501 5.28414 16.261 2.34331 13.5226 1.46081C12.196 1.03498 10.6485 1.29414 9.58015 2.12081C9.35681 2.29248 9.04681 2.29581 8.82181 2.12581C7.69015 1.27498 6.21181 1.02581 4.86431 1.46081ZM12.7226 3.11573C13.8585 3.48323 14.6543 4.48906 14.7518 5.67823C14.7793 6.02239 14.5235 6.32406 14.1793 6.35156C14.1618 6.35323 14.1451 6.35406 14.1276 6.35406C13.8051 6.35406 13.5318 6.10656 13.5051 5.77989C13.4501 5.09489 12.9918 4.51656 12.3393 4.30573C12.0101 4.19906 11.8301 3.84656 11.936 3.51906C12.0435 3.19073 12.3926 3.01239 12.7226 3.11573Z"})}):t.jsx("svg",{width:e,height:i,id:"sledge-icon-heart-fill",viewBox:"0 0 18 17",fill:l,children:t.jsx("path",{d:"M5.89936 0.0838691C6.42436 0.0998355 6.9327 0.191502 7.4252 0.359002H7.47436C7.5077 0.374836 7.5327 0.392336 7.54936 0.408169C7.73353 0.467336 7.9077 0.534002 8.07436 0.625669L8.39103 0.767336C8.51603 0.834002 8.66603 0.958169 8.74936 1.009C8.8327 1.05817 8.92436 1.109 8.99936 1.1665C9.9252 0.459002 11.0494 0.0756688 12.2077 0.0838691C12.7335 0.0838691 13.2585 0.158169 13.7577 0.325669C16.8335 1.32567 17.9419 4.70067 17.016 7.65067C16.491 9.15817 15.6327 10.534 14.5085 11.6582C12.8994 13.2165 11.1335 14.5998 9.2327 15.7915L9.02436 15.9173L8.8077 15.7832C6.9002 14.5998 5.12436 13.2165 3.5002 11.6498C2.38353 10.5257 1.52436 9.15817 0.991029 7.65067C0.0493627 4.70067 1.1577 1.32567 4.26686 0.308169C4.50853 0.224836 4.7577 0.166502 5.0077 0.134002H5.1077C5.34186 0.0998355 5.57436 0.0838691 5.8077 0.0838691H5.89936ZM13.3244 2.71734C12.9827 2.59984 12.6077 2.784 12.4827 3.134C12.366 3.484 12.5494 3.86734 12.8994 3.9915C13.4335 4.1915 13.791 4.71734 13.791 5.29984V5.32567C13.7752 5.5165 13.8327 5.70067 13.9494 5.84234C14.066 5.984 14.241 6.0665 14.4244 6.084C14.766 6.07484 15.0577 5.80067 15.0827 5.44984V5.35067C15.1077 4.18317 14.4002 3.12567 13.3244 2.71734Z"})})}),mt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__arrow-down",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{id:"Arrow - Down 2",children:t.jsx("g",{id:"Iconly/Light-Outline/Arrow---Down-2",children:t.jsx("g",{id:"Arrow---Down-2",children:t.jsx("path",{id:"Stroke-1",d:"M3.72407 6.6414C3.94596 6.41951 4.29318 6.39934 4.53786 6.58089L4.60796 6.6414L9.99935 12.0325L15.3907 6.6414C15.6126 6.41951 15.9598 6.39934 16.2045 6.58089L16.2746 6.6414C16.4965 6.86329 16.5167 7.21051 16.3351 7.45519L16.2746 7.52529L10.4413 13.3586C10.2194 13.5805 9.87218 13.6007 9.62751 13.4191L9.55741 13.3586L3.72407 7.52529C3.48 7.28121 3.48 6.88548 3.72407 6.6414Z",fill:s})})})})})}),_t=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__arrow-left",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M10.6875 2.97945C10.865 3.15697 10.8812 3.43474 10.7359 3.63048L10.6875 3.68656L6.37465 7.99967L10.6875 12.3128C10.865 12.4903 10.8812 12.7681 10.7359 12.9638L10.6875 13.0199C10.51 13.1974 10.2323 13.2135 10.0365 13.0683L9.98043 13.0199L5.31377 8.35323C5.13625 8.17572 5.12012 7.89794 5.26535 7.7022L5.31377 7.64612L9.98043 2.97945C10.1757 2.78419 10.4923 2.78419 10.6875 2.97945Z",fill:s})})}),vt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__arrow-right",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M5.60738 13.1302C5.42987 12.9527 5.41374 12.675 5.55897 12.4792L5.60738 12.4231L9.92027 8.11002L5.60738 3.79691C5.42987 3.6194 5.41374 3.34162 5.55897 3.14588L5.60738 3.0898C5.7849 2.91229 6.06267 2.89615 6.25841 3.04139L6.31449 3.0898L10.9812 7.75647C11.1587 7.93398 11.1748 8.21175 11.0296 8.4075L10.9812 8.46357L6.31449 13.1302C6.11923 13.3255 5.80265 13.3255 5.60738 13.1302Z",fill:s})})}),wt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__arrow-right",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3 8.79429C3 8.50952 3.21162 8.27418 3.48617 8.23693L3.5625 8.23179L13.4505 8.23224L9.87826 4.6746C9.65812 4.4554 9.65735 4.09925 9.87655 3.8791C10.0758 3.67897 10.3883 3.66015 10.6088 3.82306L10.672 3.87739L15.2095 8.39539C15.2386 8.42428 15.2638 8.45555 15.2852 8.48858C15.2912 8.49852 15.2973 8.50869 15.3032 8.51906C15.3085 8.52795 15.3134 8.53718 15.318 8.54652C15.3243 8.5601 15.3305 8.57413 15.3361 8.58845C15.3407 8.59949 15.3445 8.61023 15.348 8.62105C15.3522 8.63447 15.3562 8.64877 15.3597 8.66329C15.3622 8.67343 15.3643 8.68319 15.3661 8.69298C15.3686 8.70755 15.3707 8.72263 15.3722 8.73789C15.3735 8.74953 15.3743 8.76106 15.3747 8.77261C15.3749 8.77961 15.375 8.78693 15.375 8.79429L15.3747 8.81608C15.3743 8.82712 15.3735 8.83815 15.3725 8.84916L15.375 8.79429C15.375 8.82979 15.3717 8.86452 15.3654 8.89819C15.364 8.90623 15.3622 8.91449 15.3603 8.92271C15.3563 8.93964 15.3517 8.95595 15.3464 8.97194C15.3438 8.97988 15.3407 8.98837 15.3375 8.99679C15.3309 9.01371 15.3238 9.02985 15.3159 9.04557C15.3122 9.05296 15.3082 9.06069 15.3039 9.06835C15.2968 9.08084 15.2896 9.09272 15.2819 9.10429C15.2765 9.11248 15.2706 9.12101 15.2643 9.1294L15.2594 9.13588C15.2443 9.15568 15.2278 9.17444 15.2102 9.19204L15.2096 9.19256L10.6721 13.7113C10.4519 13.9305 10.0958 13.9298 9.87658 13.7097C9.67729 13.5096 9.65979 13.197 9.82363 12.9771L9.87823 12.9142L13.449 9.35724L3.5625 9.35679C3.25184 9.35679 3 9.10495 3 8.79429Z",fill:s})})}),xt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__bag",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.6334 3.33398C23.9899 3.33398 27.5887 6.65342 28.0324 10.8989L28.1562 10.9003C30.5729 10.9003 33.5112 12.5053 34.5029 17.007L35.8179 27.1853C36.2896 30.4703 35.6996 33.1053 34.0612 34.9953C32.4312 36.8753 29.8512 37.8703 26.5996 37.8703H12.6862C9.11458 37.8703 6.62625 36.9953 5.07792 35.197C3.52292 33.3936 3.00292 30.6886 3.53292 27.1586L4.82625 17.1153C5.67625 12.5103 8.78458 10.9003 11.1912 10.9003C11.399 8.98444 12.2629 7.16182 13.6334 5.79565C15.2084 4.23065 17.3801 3.33398 19.5984 3.33398H19.6334ZM28.1562 13.4003H11.1912C10.4562 13.4003 7.99958 13.697 7.29458 17.5036L6.00792 27.5036C5.58958 30.3086 5.91292 32.3386 6.97125 33.567C8.01625 34.7803 9.88625 35.3703 12.6862 35.3703H26.5996C28.3462 35.3703 30.7312 35.022 32.1712 33.3586C33.3146 32.0403 33.7079 30.077 33.3412 27.522L32.0429 17.4353C31.4896 14.9503 30.0296 13.4003 28.1562 13.4003ZM24.4942 18.0405C25.1842 18.0405 25.7826 18.6005 25.7826 19.2905C25.7826 19.9805 25.2609 20.5405 24.5709 20.5405H24.4942C23.8042 20.5405 23.2442 19.9805 23.2442 19.2905C23.2442 18.6005 23.8042 18.0405 24.4942 18.0405ZM14.7774 18.0405C15.4674 18.0405 16.0657 18.6005 16.0657 19.2905C16.0657 19.9805 15.5424 20.5405 14.8524 20.5405H14.7774C14.0874 20.5405 13.5274 19.9805 13.5274 19.2905C13.5274 18.6005 14.0874 18.0405 14.7774 18.0405ZM19.6284 5.83398H19.6034C18.0351 5.83398 16.5067 6.46565 15.3984 7.56732C14.4956 8.46609 13.9051 9.64764 13.7141 10.8995L25.5129 10.9C25.0846 8.03628 22.6082 5.83398 19.6284 5.83398Z",fill:s})})}),ft=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__check",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M5.90625 11.1562L2.40625 7.65625L3.07812 6.98438L5.90625 9.8125L11.9062 3.8125L12.5781 4.48438L5.90625 11.1562Z",fill:s})})}),jt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__close",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M6.22578 18.8248L5.17578 17.7748L10.9508 11.9998L5.17578 6.2248L6.22578 5.1748L12.0008 10.9498L17.7758 5.1748L18.8258 6.2248L13.0508 11.9998L18.8258 17.7748L17.7758 18.8248L12.0008 13.0498L6.22578 18.8248Z",fill:s})})}),Ct=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__star",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 32 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M8.68841 19.8162L8.75567 19.4179L8.44456 19.1604L2.64616 14.3604L2.64622 14.3603L2.63697 14.3529C2.02964 13.8672 2.28424 12.8955 3.04396 12.7636L11.2293 12.3989L11.6809 12.3788L11.8484 11.959L15.3475 3.18648C15.4773 2.94796 15.7259 2.79961 15.9982 2.79961C16.2692 2.79961 16.5188 2.94848 16.6491 3.18698L20.148 11.959L20.3155 12.3788L20.767 12.3989L28.9524 12.7636C29.7121 12.8955 29.9667 13.8672 29.3594 14.3529L29.3593 14.3528L29.3502 14.3604L23.5518 19.1604L23.2407 19.4179L23.308 19.8162L24.8887 29.1774C24.9836 29.8833 24.2616 30.4104 23.6226 30.1159L16.3737 25.5088L15.9983 25.2702L15.6228 25.5088L8.37397 30.1141C7.73341 30.409 7.01273 29.8817 7.1077 29.1758L8.68841 19.8162Z",stroke:s,strokeWidth:"1.4"})})}),yt=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__upload",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.8253 11.7254C10.3773 11.7254 10.8253 12.1734 10.8253 12.7254C10.8253 13.2774 10.3773 13.7254 9.8253 13.7254H8.5813C6.42264 13.7254 4.66797 15.4801 4.66797 17.6374V24.1374C4.66797 26.2961 6.42264 28.0507 8.5813 28.0507H23.4213C25.5786 28.0507 27.3346 26.2961 27.3346 24.1374V17.6254C27.3346 15.4747 25.5853 13.7254 23.436 13.7254H22.1786C21.6266 13.7254 21.1786 13.2774 21.1786 12.7254C21.1786 12.1734 21.6266 11.7254 22.1786 11.7254H23.436C26.688 11.7254 29.3346 14.3721 29.3346 17.6254V24.1374C29.3346 27.3987 26.6813 30.0507 23.4213 30.0507H8.5813C5.3213 30.0507 2.66797 27.3987 2.66797 24.1374V17.6374C2.66797 14.3774 5.3213 11.7254 8.5813 11.7254H9.8253ZM16.7088 2.9622L20.5968 6.8662C20.9861 7.2582 20.9848 7.8902 20.5941 8.27953C20.2021 8.66887 19.5701 8.66887 19.1808 8.27687L17 6.08853L17.0008 20.7213H15.0008L15 6.08853L12.8221 8.27687C12.6274 8.4742 12.3701 8.57153 12.1141 8.57153C11.8594 8.57153 11.6034 8.4742 11.4088 8.27953C11.0181 7.8902 11.0154 7.2582 11.4061 6.8662L15.2928 2.9622C15.6674 2.58487 16.3341 2.58487 16.7088 2.9622Z",fill:s})})}),St=({width:e,height:i,color:s})=>t.jsx("span",{className:"sledge-icon__search",children:t.jsx("svg",{width:e,height:i,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.78283 2.16669C14.2578 2.16669 17.8978 5.80669 17.8978 10.2817C17.8978 12.393 17.0876 14.3186 15.7617 15.7638L18.3707 18.3673C18.6148 18.6114 18.6157 19.0064 18.3715 19.2506C18.2498 19.3739 18.089 19.4348 17.929 19.4348C17.7698 19.4348 17.6098 19.3739 17.4873 19.2523L14.8469 16.6192C13.4579 17.7316 11.6967 18.3975 9.78283 18.3975C5.30783 18.3975 1.66699 14.7567 1.66699 10.2817C1.66699 5.80669 5.30783 2.16669 9.78283 2.16669ZM9.78283 3.41669C5.99699 3.41669 2.91699 6.49585 2.91699 10.2817C2.91699 14.0675 5.99699 17.1475 9.78283 17.1475C13.5678 17.1475 16.6478 14.0675 16.6478 10.2817C16.6478 6.49585 13.5678 3.41669 9.78283 3.41669Z",fill:s})})}),Nt="",Lt=e.forwardRef(((e,i)=>{const{className:s="",children:l,colorType:n="light",fullWidth:d=!1,elementType:r="button",link:a="",...o}=e;return"hyperlink"===r&&(null==a?void 0:a.length)?t.jsx("a",{href:a,className:`sledge__button ${s||""}`,"data-button-color-type":n,"data-button-full-width":d,ref:i,...o,children:l}):t.jsx("button",{className:`sledge__button ${s||""}`,"data-button-color-type":n,"data-button-full-width":d,ref:i,...o,children:l})})),At="",Tt=i=>{const{className:s="",icon:l,value:n="",withClearField:d,onChange:r,onResetField:a,fieldRef:o,...c}=i,[u,g]=e.useState(!1);return e.useEffect((()=>{g(Boolean(n))}),[n]),t.jsxs("div",{className:`sledge__search-input-field-wrapper ${s||""}`,children:[l?t.jsx("div",{className:"sledge__search-input-field-icon",children:l}):null,t.jsx("input",{className:"sledge__search-input-field",value:n,onChange:e=>(e=>{r&&r({value:e.target.value})})(e),ref:o,...c}),u&&d?t.jsx("div",{className:"sledge__clear-field-wrapper",children:t.jsx("button",{className:"sledge__clear-field",type:"button",onClick:()=>{(null==o?void 0:o.current)&&o.current.focus(),r&&r({value:""}),a&&a()},children:t.jsx("svg",{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",width:14,height:14,children:t.jsx("path",{d:"m11.414 10 6.293-6.293a1 1 0 1 0-1.414-1.414l-6.293 6.293-6.293-6.293a1 1 0 0 0-1.414 1.414l6.293 6.293-6.293 6.293a1 1 0 1 0 1.414 1.414l6.293-6.293 6.293 6.293a.998.998 0 0 0 1.707-.707.999.999 0 0 0-.293-.707l-6.293-6.293z"})})})}):null]})},Et="",bt=i=>{var s;const{className:l="",placeholder:n=null,prefixLabel:d=null,prefixSelectedLabel:r="",align:a="end",onChange:o,value:c="",options:u=[]}=i,[g,h]=e.useState(!1),p=(null==(s=null==u?void 0:u.filter((({value:e})=>e===c))[0])?void 0:s.label)||n;return t.jsx("div",{className:`sledge__select-field-wrapper ${l||""}`,children:t.jsx(Xe,{trigger:t.jsxs("button",{type:"button",className:"sledge__button sledge__select-field","data-button-color-type":"light","data-button-full-width":"true",children:[d?t.jsx("span",{className:"sledge__select-field-icon",children:d}):null,t.jsx("span",{children:(null==r?void 0:r.length)?`${r} ${p}`:p})]}),content:t.jsx("ul",{className:"sledge__select-field-option",children:null==u?void 0:u.map(((e,i)=>{const{label:s,value:l}=e;return t.jsx("li",{onClick:()=>((e,t)=>{o&&o({label:e,value:t}),h(!1)})(s,l),...l===c&&{"data-selected":!0},children:s},i)}))}),isOpen:g,setIsOpen:h,hideCloseIcon:!0,align:a,className:"sledge__select-field-option-content",withArrow:!1})})},Rt="",It=async e=>{var t,i=new Headers;i.append("Content-Type","application/json");let s=[];e.map((e=>{const{id:t,quantity:i}=e;s.push({id:t,quantity:i})}));var l={method:"POST",headers:i,body:JSON.stringify({items:s}),redirect:"follow"};if(null==(t=null==window?void 0:window.Shopify)?void 0:t.routes)return await fetch(`${window.Shopify.routes.root}cart/add.js`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Ot="",Pt="",kt=async(e,t)=>{const{page:i,limit:s,sort:l,keyword:n,rating:d}=t||{};let r=xe(e),a=localStorage.getItem(Ee.AUTH_APP),o="?"+new URLSearchParams({page:i||"",limit:s||"",sort:l||"",keyword:n||"",rating:d||""}).toString();var c=new Headers;c.append("Authorization",`Bearer ${a}`);var u={method:"GET",headers:c,redirect:"follow"};return await fetch(`${Se}/review/${r}${o}`,u).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Dt=async e=>{let t=xe(e),i=localStorage.getItem(Ee.AUTH_APP);var s=new Headers;s.append("Authorization",`Bearer ${i}`);var l={method:"GET",headers:s,redirect:"follow"};return await fetch(`${Se}/review/info/${t}`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Mt=async()=>{let e=localStorage.getItem(Ee.AUTH_APP);var t=new Headers;t.append("Authorization",`Bearer ${e}`);var i={method:"GET",headers:t,redirect:"follow"};return await fetch(`${Se}/review/media`,i).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Wt=async e=>{let t=localStorage.getItem(Ee.AUTH_APP);var i=new Headers;i.append("Authorization",`Bearer ${t}`);var s=new FormData;[...e].map((e=>{s.append("files",e,e.name)}));var l={method:"POST",headers:i,body:s,redirect:"follow"};return await fetch(`${Se}/review/media`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Bt=async e=>{let t=localStorage.getItem(Ee.AUTH_APP);var i=new Headers;i.append("Authorization",`Bearer ${t}`);var s={method:"DELETE",headers:i,redirect:"follow"};return await fetch(`${Se}/review/media/${e}`,s).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Ht=async e=>{const{userFirstName:t,userLastName:i,userEmail:s,productId:l,productVariantId:n,rating:d,title:r,review:a,mediaIds:o}=e;let c=localStorage.getItem(Ee.AUTH_APP);var u=new Headers;u.append("Authorization",`Bearer ${c}`),u.append("Content-Type","application/json");var g={method:"POST",headers:u,body:JSON.stringify({user:{name:`${t}${i?` ${i}`:""}`,email:s},product:{id:xe(l),variant_id:xe(n)},review:{rating:d,title:r,review:a,media_ids:o}}),redirect:"follow"};return await fetch(`${Se}/review`,g).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Ut=t=>{const i=e.useRef();return e.useEffect((()=>{i.current=t})),i.current},Ft=i=>{var s;const{value:l,size:n="md",data:d,withSkeletonLoading:r=!0}=i,{productId:a}=d||{},{isRenderApp:o}=e.useContext(Fi),[c,u]=e.useState(!0),[g,h]=e.useState(!0),[p,m]=e.useState({width:0,height:0}),[_,v]=e.useState(0),[w,x]=e.useState("0"),[f,j]=e.useState({}),C=Ut({productId:a}),{fill_color:y,outline_color:S}=(null==(s=null==f?void 0:f.display)?void 0:s.rating)||{},N=async e=>{let t;h(!0);let i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:n}=t,{code:r}=s;i=200===r||!1,i&&(j(n),await(async()=>{var e;if(l&&!d)x(l),h(!1);else{let t,i,s=!1,l=0;if(t=await Dt(a),!t)return;const{status:n,data:d}=t,{code:r}=n;s=200===r||!1,l=(null==d?void 0:d.review_count)?d.review_count:0,i=(null==(e=null==d?void 0:d.rating)?void 0:e.average)?d.rating.average:0,s&&(v(l),x(i),h(!1),u(!1))}})())};return e.useEffect((()=>{if(!(null==o?void 0:o.productReview))return;m("xs"===n?{width:14.4,height:14.4}:"sm"===n?{width:18,height:18}:{width:28.8,height:28.8}),Boolean(C&&(null==C?void 0:C.productId)!==a)&&u(!0),N(localStorage.getItem(Ee.PRODUCT_REVIEW_SETTING)||"")}),[o,a]),t.jsx("div",{className:"sledge-product-review__rating",children:c&&r?t.jsx(tl.Item,{width:"230px",height:"28px",color:"grey-100",rounded:"md"}):t.jsxs(t.Fragment,{children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"none"},id:"sledge-product-review-rating-icon-svg-store",children:[t.jsx("symbol",{id:"sledge-product-review-icons-rating-icon-fill",viewBox:"0 0 30 29",fill:y||"#23BC45",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.00014 17.7L1.20174 12.9C0.107339 12.0248 0.587339 10.2648 1.97614 10.0664L10.2001 9.69998L13.7121 0.895176C13.9569 0.407176 14.4545 0.0999756 15.0001 0.0999756C15.5457 0.0999756 16.0433 0.408776 16.2881 0.895176L19.8001 9.69998L28.0241 10.0664C29.4129 10.2648 29.8929 12.0248 28.7985 12.9L23.0001 17.7L24.5825 27.0712C24.7649 28.3496 23.4369 29.3064 22.2833 28.7288L15.0001 24.1L7.71694 28.7272C6.56174 29.3048 5.23534 28.348 5.41774 27.0696L7.00014 17.7Z"})}),t.jsx("symbol",{id:"sledge-product-review-icons-rating-icon-line",viewBox:"0 0 30 29",stroke:S||"#8D9196",fill:"none",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.00014 17.7L1.20174 12.9C0.107339 12.0248 0.587339 10.2648 1.97614 10.0664L10.2001 9.69998L13.7121 0.895176C13.9569 0.407176 14.4545 0.0999756 15.0001 0.0999756C15.5457 0.0999756 16.0433 0.408776 16.2881 0.895176L19.8001 9.69998L28.0241 10.0664C29.4129 10.2648 29.8929 12.0248 28.7985 12.9L23.0001 17.7L24.5825 27.0712C24.7649 28.3496 23.4369 29.3064 22.2833 28.7288L15.0001 24.1L7.71694 28.7272C6.56174 29.3048 5.23534 28.348 5.41774 27.0696L7.00014 17.7Z",strokeWidth:"1.4"})}),t.jsx("defs",{children:t.jsxs("g",{id:"sledge-product-review-icons-rating-icon",children:[t.jsx("use",{href:"#sledge-product-review-icons-rating-icon-line",className:"sledge-product-review__rating-icon-line"}),t.jsx("use",{href:"#sledge-product-review-icons-rating-icon-fill",className:"sledge-product-review__rating-icon-fill"})]})})]}),!g&&t.jsxs(t.Fragment,{children:[[1,2,3,4,5].map(((e,i)=>{let s=Math.floor(parseFloat(w)),l=String(w).includes(",")?String(w).split(","):[],n=String(w).includes(".")?String(w).split("."):[],d=l.length||n.length?l[1]||n[1]:0,r="fill-0";return e>s&&s+1===e&&(r=`fill-${d}`),X.createElement("svg",{...p,viewBox:"0 0 30 29","data-product-review-rating-fill":e<=s?"full":r,key:i},t.jsx("use",{href:"#sledge-product-review-icons-rating-icon"}))})),!l&&d?t.jsxs("div",{className:"sledge-product-review__rating-summary-total",children:["(",_,")"]}):t.jsx(t.Fragment,{})]})]})})},Gt=i=>{const s=i.getAttribute(Te.GLOBAL.PRODUCT_ID),l=i.getAttribute(Te.PRODUCT_REVIEW.RATING_SIZE);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(Ft,{data:{productId:s||""},size:l})})}))},$t=()=>{let e=Array.from(document.querySelectorAll(Re.PRODUCT_REVIEW.ELEMENT_RATING));je(e,(()=>{e.length&&e.map((e=>Gt(e)))})),new MutationObserver((function(t){t.forEach((function(t){Array.prototype.slice.call(t.addedNodes).forEach((function(t){1===t.nodeType&&t.querySelector(Re.PRODUCT_REVIEW.ELEMENT_RATING)&&(e=Array.from(t.querySelectorAll(Re.PRODUCT_REVIEW.ELEMENT_RATING)),e.length&&e.map((e=>Gt(e))))}))}))})).observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1})},Vt="",qt=({isFirstLoading:e,text:i,dataSettings:s,data:l,onAfterAddReview:n})=>{var d,r,a;const{text_color:o,border_color:c,border_radius:u,padding_top:g,padding_bottom:h,padding_left:p,padding_right:m,background_color:_,font_size:v,font_weight:w,text_transform:x}=(null==(r=null==(d=null==s?void 0:s.display)?void 0:d.widget)?void 0:r.button_write_review)||{},{button_write_review:f}=(null==(a=null==s?void 0:s.languages)?void 0:a.widget)||{},j={...o&&{color:o},...c&&{borderColor:c},...u&&{borderRadius:u},...g&&{paddingTop:g},...h&&{paddingBottom:h},...p&&{paddingLeft:p},...m&&{paddingRight:m},..._&&{backgroundColor:_},...v&&{fontSize:v},...w&&{fontWeight:w},...x&&{textTransform:x}};return t.jsx("div",{className:"sledge-product-review__widget-header-item",children:e?t.jsx(tl.Item,{width:"134px",height:"42px",rounded:"lg",color:"grey-100"}):t.jsxs(Lt,{type:"button",colorType:"success",onClick:()=>"undefined"!=typeof window&&window.sledgeProductReviewWidgetFormAdd&&window.sledgeProductReviewWidgetFormAdd(l,n),style:j,children:[t.jsx("svg",{width:16,height:17,viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.8323 14.1264C14.1083 14.1264 14.3323 14.3504 14.3323 14.6264C14.3323 14.9024 14.1083 15.1264 13.8323 15.1264H8.99701C8.72101 15.1264 8.49701 14.9024 8.49701 14.6264C8.49701 14.3504 8.72101 14.1264 8.99701 14.1264H13.8323ZM10.7429 2.93576C10.7762 2.96176 11.8915 3.82843 11.8915 3.82843C12.2969 4.06976 12.6135 4.5011 12.7335 5.01176C12.8529 5.5171 12.7662 6.03843 12.4882 6.47909C12.4864 6.48203 12.4845 6.48494 12.4781 6.49358L12.4731 6.50025C12.4279 6.55972 12.2318 6.80776 11.2417 8.04815C11.2325 8.06441 11.2221 8.07963 11.2107 8.09443C11.1941 8.11624 11.1759 8.13628 11.1565 8.15453C11.089 8.23956 11.0176 8.3289 10.9426 8.42283L10.7907 8.61313C10.4772 9.00579 10.1053 9.47139 9.66407 10.0236L9.43764 10.3071C8.58586 11.3732 7.49499 12.7382 6.09755 14.4864C5.79155 14.8678 5.33288 15.0898 4.84021 15.0958L2.41421 15.1264H2.40755C2.17621 15.1264 1.97488 14.9678 1.92088 14.7418L1.37488 12.4278C1.26221 11.9484 1.37421 11.4538 1.68155 11.0698L7.96155 3.2151C7.96421 3.21243 7.96621 3.2091 7.96888 3.20643C8.65755 2.3831 9.90288 2.26176 10.7429 2.93576ZM7.26136 5.69133L2.46221 11.6944C2.34821 11.8371 2.30621 12.0211 2.34821 12.1978L2.80221 14.1211L4.82821 14.0958C5.02088 14.0938 5.19888 14.0078 5.31688 13.8611C5.92454 13.1008 6.68825 12.1452 7.47345 11.1627L7.75125 10.815L8.02952 10.4668C8.76591 9.54526 9.4934 8.63471 10.1021 7.87258L7.26136 5.69133ZM8.73888 3.84443L7.88603 4.91L10.7265 7.09062C11.2733 6.4058 11.633 5.95476 11.6662 5.91176C11.7755 5.73443 11.8182 5.48376 11.7609 5.24243C11.7022 4.9951 11.5482 4.78509 11.3262 4.65109C11.2789 4.61843 10.1555 3.74643 10.1209 3.71909C9.69821 3.38043 9.08155 3.4391 8.73888 3.84443Z",fill:"currentColor"})}),i||(f||"Add review")]})})},zt=({isFirstLoading:i,productReviewSort:s,dataSettings:l,setSelectedSort:n,setIsRefreshWidgetList:d})=>{var r,a;const{default_sort:o,show_sorting_options:c}=(null==(r=null==l?void 0:l.display)?void 0:r.widget)||{},[u,g]=e.useState(o||null),h=u||(null==(a=s[0])?void 0:a.value);return t.jsx(t.Fragment,{children:c?t.jsx("div",{className:"sledge-product-review__widget-header-item",children:i?t.jsx(tl.Item,{width:"134px",height:"42px",rounded:"lg",color:"grey-100"}):t.jsx(bt,{align:"end",prefixLabel:t.jsx("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5919 9.13869C12.7359 9.13869 13.6666 10.0647 13.6666 11.2027C13.6666 12.3407 12.7359 13.2667 11.5919 13.2667C10.4473 13.2667 9.51593 12.3407 9.51593 11.2027C9.51593 10.0647 10.4473 9.13869 11.5919 9.13869ZM11.5919 10.1387C10.9986 10.1387 10.5159 10.616 10.5159 11.2027C10.5159 11.79 10.9986 12.2667 11.5919 12.2667C12.1846 12.2667 12.6666 11.79 12.6666 11.2027C12.6666 10.616 12.1846 10.1387 11.5919 10.1387ZM6.7202 10.7286C6.9962 10.7286 7.2202 10.9526 7.2202 11.2286C7.2202 11.5046 6.9962 11.7286 6.7202 11.7286H2.51953C2.24353 11.7286 2.01953 11.5046 2.01953 11.2286C2.01953 10.9526 2.24353 10.7286 2.51953 10.7286H6.7202ZM4.07533 2.66669C5.22 2.66669 6.15067 3.59335 6.15067 4.73135C6.15067 5.86935 5.22 6.79469 4.07533 6.79469C2.93133 6.79469 2 5.86935 2 4.73135C2 3.59335 2.93133 2.66669 4.07533 2.66669ZM4.07533 3.66669C3.48267 3.66669 3 4.14402 3 4.73135C3 5.31802 3.48267 5.79469 4.07533 5.79469C4.66867 5.79469 5.15067 5.31802 5.15067 4.73135C5.15067 4.14402 4.66867 3.66669 4.07533 3.66669ZM12.7941 4.26695C13.0701 4.26695 13.2941 4.49095 13.2941 4.76695C13.2941 5.04295 13.0701 5.26695 12.7941 5.26695H8.59407C8.31807 5.26695 8.09407 5.04295 8.09407 4.76695C8.09407 4.49095 8.31807 4.26695 8.59407 4.26695H12.7941Z",fill:"currentColor"})}),prefixSelectedLabel:"Sort by",options:s.map((e=>{const{name:t,value:i}=e;return{label:t,value:i}})),value:h,onChange:({value:e})=>(e=>{g(e),d&&d(!0),n&&n(e)})(e)})}):null})},Jt={open:{rotate:180},closed:{rotate:0},transition:{type:"spring",duration:.2}},Zt={hidden:{opacity:0,scale:0},visible:e=>{const{duration:t}=e||{};return{opacity:1,scale:1,transition:{type:"spring",duration:t||.7}}}},Kt=i=>{var s,l,n;const{data:d,dataSettings:r}=i,{productId:a}=d||{},{fill_color:o,outline_color:c}=(null==(l=null==(s=null==r?void 0:r.display)?void 0:s.widget)?void 0:l.summary_bar)||{},{review_singular:u,review_plural:g}=(null==(n=null==r?void 0:r.languages)?void 0:n.widget)||{},[h,p]=e.useState(!0),[m,_]=e.useState(!0),[v,w]=e.useState(!0),[x,f]=e.useState(!0),[j,C]=e.useState(!1),[y,S]=e.useState(0),[N,L]=e.useState({5:0,4:0,3:0,2:0,1:0}),[A,T]=e.useState("0"),E=Ut({productId:a}),b=async()=>{var e;let t,i,s,l=!1,n=0;if(t=await Dt(a),!t)return;const{status:d,data:r}=t,{code:o}=d;l=200===o||!1,n=(null==r?void 0:r.review_count)?r.review_count:0,i=(null==r?void 0:r.rating)?{5:r.rating[5]||0,4:r.rating[4]||0,3:r.rating[3]||0,2:r.rating[2]||0,1:r.rating[1]||0}:N,s=(null==(e=null==r?void 0:r.rating)?void 0:e.average)?r.rating.average:"0",l&&(S(n),L(i),T(s),w(!1),f(!1),p(!1),j&&_(!1))};return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeProductReviewWidgetSummaryUpdate=()=>{f(!0),b()}),Boolean(E&&(null==E?void 0:E.productId)!==a)&&p(!0),b()}),[j,a]),t.jsx("div",{className:"sledge-product-review__widget-summary",children:h?t.jsx(tl.Item,{width:"630px",height:"42px",color:"grey-100",rounded:"md",animationDuration:"5s"}):t.jsx(Xe,{trigger:v?t.jsx(t.Fragment,{}):t.jsxs(Q.div,{initial:!1,animate:j?"open":"closed",className:"sledge-product-review__widget-summary-trigger",children:[t.jsx("div",{className:"sledge-product-review__widget-summary-average",children:A}),t.jsx("div",{className:"sledge-product-review__widget-summary-rating",children:!x&&t.jsx(Ft,{value:String(A),size:"md",withSkeletonLoading:!1})}),t.jsxs("div",{className:"sledge-product-review__widget-summary-total",children:[y," ",y>1?g||"Reviews":u||"Review"]}),t.jsx(Q.div,{variants:Jt,className:"summary-trigger-icon",children:t.jsx("svg",{width:20,height:20,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})]}),content:m?t.jsx("div",{className:"sledge-product-review__widget-summary-dist-progress",children:[5,4,3,2,1].map((e=>t.jsxs("div",{className:"sledge-product-review__widget-summary-dist-progress-item",children:[t.jsx(tl.Item,{width:"108px",height:"22px",color:"grey-100",rounded:"md",animationDuration:"15s"}),t.jsx(tl.Item,{width:"128px",height:"22px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{marginLeft:"13px",marginRight:"12px"}}),t.jsx(tl.Item,{width:"38px",height:"22px",color:"grey-100",rounded:"md",animationDuration:"42s"})]},e)))}):t.jsx("div",{className:"sledge-product-review__widget-summary-dist",children:t.jsx("div",{className:"sledge-product-review__widget-summary-dist-progress",children:[5,4,3,2,1].map(((e,i)=>t.jsxs("div",{className:"sledge-product-review__widget-summary-dist-progress-item",children:[t.jsx(Ft,{value:e,size:"sm",withSkeletonLoading:!1}),t.jsx(et,{value:String(N[e]),total:y,fillColor:o,outlineColor:c}),t.jsxs("small",{children:["(",N[e],")"]})]},i)))})}),setIsOpen:C,hideCloseIcon:!0,align:"end",alignOffset:-170,className:"sledge-product-review__widget-summary-content",withArrow:!1})})},Yt=i=>{const[s,l]=e.useState(!0);return e.useEffect((()=>{l(!1)}),[]),t.jsx(t.Fragment,{children:!s&&t.jsx("div",{className:"sledge-product-review__widget-header",children:e.Children.count(i.children)&&e.Children.map(i.children,(t=>e.cloneElement(t,{...i})))})})};Yt.Sort=zt,Yt.AddTrigger=qt,Yt.Summary=Kt;const Xt=e=>{var i;const{isFirstLoading:s,isLoading:l,productReviewData:n,dataSettings:d,currentPage:r,setCurrentPage:a,totalPage:o,totalData:c,setIsReplaceWidgetList:u}=e||{},{type:g}=(null==(i=null==d?void 0:d.display)?void 0:i.widget)||{},h="list"===g?t.jsx(dt,{currentPage:r||1,totalPage:o||1,totalResult:c||0,onChange:e=>(e=>{a&&a(e),u&&u(!0)})(e)}):null;return t.jsx(t.Fragment,{children:l?t.jsxs(t.Fragment,{children:[t.jsx(tl.ReviewGrid,{count:"grid"===g?8:10,type:g,gridItemHeights:["252px","342px","196px","398px","342px","252px","398px","196px"]}),s?null:h]}):t.jsx("div",{className:"sledge-product-review__widget-review-wrapper","data-layout-type":g,children:(null==n?void 0:n.length)?t.jsxs(t.Fragment,{children:[t.jsx(ei,{...e}),h]}):t.jsx(Qt,{...e})})})},Qt=i=>{var s;const{dataSettings:l}=i||{},{title_no_result:n,text_no_result:d}=(null==(s=null==l?void 0:l.languages)?void 0:s.widget)||{},[r,a]=e.useState(""),[o,c]=e.useState("");return e.useEffect((()=>{a(n||"No reviews for this item yet!"),c(d||'Click "write a review" button to add a review on this product')}),[]),t.jsxs("div",{className:"sledge-product-review__widget-product-empty",children:[t.jsx("div",{className:"sledge-product-review__widget-product-empty-title",dangerouslySetInnerHTML:{__html:r}}),t.jsx("div",{className:"sledge-product-review__widget-product-empty-description",dangerouslySetInnerHTML:{__html:o}})]})},ei=i=>{var s,l,n,d,r,a,o,c;const{productReviewData:u,currentPage:g,setCurrentPage:h,totalPage:p,totalData:m,dataSettings:_,setIsRefreshWidgetList:v,setIsReplaceWidgetList:w}=i||{},{type:x,rating_size:f,show_review_date:j}=(null==(s=null==_?void 0:_.display)?void 0:s.widget)||{},{text_color:C,border_color:y,border_radius:S,padding_top:N,padding_bottom:L,padding_left:A,padding_right:T,background_color:E,font_size:b,font_weight:R,text_transform:I}=(null==(n=null==(l=null==_?void 0:_.display)?void 0:l.widget)?void 0:n.button_load_more)||{},{text_color:O,border_color:P,border_radius:k,padding_top:D,padding_bottom:M,padding_left:W,padding_right:B,background_color:H,font_size:U,font_weight:F,text_transform:G}=(null==(r=null==(d=null==_?void 0:_.display)?void 0:d.widget)?void 0:r.verified)||{},{button_load_more:$,verified:V}=(null==(a=null==_?void 0:_.languages)?void 0:a.widget)||{},{name:q,image:z}=(null==(c=null==(o=null==_?void 0:_.display)?void 0:o.widget)?void 0:c.replier)||{},J={...C&&{color:C},...y&&{borderColor:y},...S&&{borderRadius:S},...N&&{paddingTop:N},...L&&{paddingBottom:L},...A&&{paddingLeft:A},...T&&{paddingRight:T},...E&&{backgroundColor:E},...b&&{fontSize:b},...R&&{fontWeight:R},...I&&{textTransform:I}},Z={...O&&{color:O},...P&&{borderWidth:"1px",borderStyle:"solid",borderColor:P},...k&&{borderRadius:k},...D&&{paddingTop:D},...M&&{paddingBottom:M},...W&&{paddingLeft:W},...B&&{paddingRight:B},...H&&{backgroundColor:H},...U&&{fontSize:U},...F&&{fontWeight:F},...G&&{textTransform:G}};let K=g||0,Y=p||0;const[X,Q]=e.useState(!1),[ie,se]=e.useState(!1);e.useEffect((()=>{se(!(Y===K&&!X)&&Y>=K)}),[X]),e.useEffect((()=>{Q(!1)}),[u]);const le=t.jsxs(t.Fragment,{children:[(null==u?void 0:u.length)?t.jsx(ee,{columnsCountBreakPoints:{350:1,750:3,1024:4},className:"sledge-product-review__widget-review-grid",children:t.jsx(te,{gutter:"30px",children:u.map(((e,i)=>{var s,l;const{user:{name:n},review:{rating:d,review:r,media:a,reply:o,is_verified:c},created_at:u}=e;let g=new Intl.DateTimeFormat("en-US").format(new Date(u)),h=q?String(String(q).includes("<span>")?String(q).split("<span>")[0]:String(q)).replaceAll(Pe.STORE.NAME,null==(s=o[0])?void 0:s.name):null==(l=o[0])?void 0:l.name,p=q?Ce("<span>","</span>",q):"Admin";return t.jsx("div",{className:"sledge-product-review__widget-review-card",onClick:()=>"undefined"!=typeof window&&window.sledgeProductReviewWidgetPopupDetail&&window.sledgeProductReviewWidgetPopupDetail({...e,settings:_}),children:t.jsxs("div",{className:"sledge-product-review__widget-review-card-content",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-desc-wrapper",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-desc",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-customer",children:[t.jsx("span",{children:n}),c?t.jsx("span",{className:"sledge-product-review__widget-review-card-verified-text",style:Z,children:V}):null]}),t.jsxs("div",{className:"sledge-product-review__widget-review-card-column",children:[t.jsx("div",{className:"sledge-product-review__widget-review-card-rating",children:t.jsx(Ft,{value:d,size:f,withSkeletonLoading:!1})}),j?t.jsx("div",{className:"sledge-product-review__widget-review-card-date",children:g}):null]}),t.jsx("div",{className:"sledge-product-review__widget-review-card-message",children:r.length>=250?`${r.slice(0,250)}...`:r})]}),(null==a?void 0:a.length)?t.jsx("div",{className:"sledge-product-review__widget-review-card-image",children:a.slice(0,4).map(((e,i)=>{const{type:s,file:l}=e;let n="image"===s?t.jsx("img",{src:l,alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`},i):t.jsx("video",{controls:!1,children:t.jsx("source",{src:l})},i);return i<3?n:t.jsxs("div",{className:"sledge-product-review__widget-review-card-media",children:[t.jsx("div",{className:"sledge-product-review__widget-review-card-media-more",children:"More+"}),n]},i)}))}):t.jsx(t.Fragment,{})]}),(null==o?void 0:o.length)?t.jsxs("div",{className:"sledge-product-review__widget-review-card-reply",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-reply-title",children:[t.jsx("img",{src:z||"",alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`,className:"sledge-product-review__widget-review-card-reply-profile-image"},i),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-name",children:h}),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-status",children:p})]}),t.jsx("div",{className:"sledge-product-review__widget-review-card-reply-message",dangerouslySetInnerHTML:{__html:o[0].text}})]}):null]})},i)}))})}):t.jsx(t.Fragment,{}),ie&&t.jsx("div",{className:"sledge-product-review__widget-button-load-more",children:t.jsx(Lt,{type:"button",role:"button",colorType:"light",disabled:X,onClick:()=>{h&&g&&h(g+1),Q(!0)},style:{...J,...X&&{cursor:"wait"}},children:X?"Loading...":$||"Load More"})})]}),ne=t.jsx(t.Fragment,{children:(null==u?void 0:u.length)?t.jsx(ee,{columnsCountBreakPoints:{350:1},className:"sledge-product-review__widget-review-grid",children:t.jsx(te,{children:u.map(((e,i)=>{var s,l;const{id:n,user:{name:d},review:{rating:r,review:a,media:o,reply:c,is_verified:u},created_at:g}=e;let h=new Intl.DateTimeFormat("en-US").format(new Date(g)),p=q?String(String(q).includes("<span>")?String(q).split("<span>")[0]:String(q)).replaceAll(Pe.STORE.NAME,null==(s=c[0])?void 0:s.name):null==(l=c[0])?void 0:l.name,m=q?Ce("<span>","</span>",q):"Admin";return t.jsxs("div",{className:"sledge-product-review__widget-review-card",onClick:()=>"undefined"!=typeof window&&window.sledgeProductReviewWidgetPopupDetail&&window.sledgeProductReviewWidgetPopupDetail({...e,settings:_}),children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-customer-wrapper",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-customer",children:[t.jsx("span",{children:d}),u?t.jsx("span",{className:"sledge-product-review__widget-review-card-verified-text",style:Z,children:V}):null]}),t.jsxs("div",{className:"sledge-product-review__widget-review-card-column",children:[t.jsx("div",{className:"sledge-product-review__widget-review-card-rating",children:t.jsx(Ft,{value:r,size:f,withSkeletonLoading:!1})}),j?t.jsx("div",{className:"sledge-product-review__widget-review-card-date",children:h}):null]})]}),t.jsx("div",{className:"sledge-product-review__widget-review-card-content",children:t.jsx("div",{className:"sledge-product-review__widget-review-card-desc-wrapper",children:t.jsxs("div",{className:"sledge-product-review__widget-review-card-desc",children:[t.jsx("div",{className:"sledge-product-review__widget-review-card-message",children:a.length>=350?`${a.slice(0,350)}...`:a}),(null==c?void 0:c.length)?t.jsxs("div",{className:"sledge-product-review__widget-review-card-reply",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-reply-title",children:[t.jsx("svg",{width:18,height:16,viewBox:"0 0 18 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M0.5625 15.5C0.764999 15.5 0.955502 15.3905 1.056 15.2068L1.07175 15.1783C2.754 12.14 5.9595 10.25 9.4365 10.25H10.5V13.4375C10.5 13.6633 10.6358 13.8673 10.8435 13.9558C11.0498 14.0428 11.2928 13.9993 11.454 13.841L17.829 7.65351C17.9385 7.54776 18 7.40226 18 7.25001C18 7.09776 17.9385 6.95226 17.829 6.84651L11.454 0.659013C11.292 0.501513 11.0498 0.456513 10.8435 0.544263C10.6358 0.632763 10.5 0.836763 10.5 1.06251V4.25151C4.69275 4.35201 0 9.10701 0 14.9375C0 15.1948 0.174 15.419 0.423 15.4828C0.4695 15.4948 0.516001 15.5 0.5625 15.5ZM11.0625 9.12501H9.4365C6.3045 9.12501 3.36975 10.4968 1.3635 12.8083C2.334 8.55651 6.14625 5.37501 10.6875 5.37501H11.0625C11.373 5.37501 11.625 5.12301 11.625 4.81251V2.39226L16.6298 7.25001L11.625 12.1078V9.68751C11.625 9.37701 11.373 9.12501 11.0625 9.12501Z",fill:"#677487"})}),t.jsx("img",{src:z||"",alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`,className:"sledge-product-review__widget-review-card-reply-profile-image"},i),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-name",children:p}),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-status",children:m})]}),t.jsx("div",{className:"sledge-product-review__widget-review-card-reply-message",dangerouslySetInnerHTML:{__html:c[0].text}})]}):null]})})}),(null==o?void 0:o.length)?t.jsx("div",{className:"sledge-product-review__widget-review-card-image",children:o.slice(0,4).map(((e,i)=>{const{type:s,file:l}=e;let n="image"===s?t.jsx("img",{src:l,alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`},i):t.jsx("video",{controls:!1,children:t.jsx("source",{src:l})},i);return i<3?n:t.jsxs("div",{className:"sledge-product-review__widget-review-card-media",children:[t.jsx("div",{className:"sledge-product-review__widget-review-card-media-more",children:"More+"}),n]},i)}))}):t.jsx(t.Fragment,{})]},i)}))})}):t.jsx(t.Fragment,{})});return"list"===x?ne:le},ti=i=>{const{children:s,data:l,onAfterAddReview:n}=i,{productId:d}=l||{},{isRenderApp:r}=e.useContext(Fi),[a,o]=e.useState(!0),[c,u]=e.useState(!0),[g,h]=e.useState(!1),[p,m]=e.useState(!1),[_,v]=e.useState([]),[w,x]=e.useState([]),[f,j]=e.useState(""),[C,y]=e.useState(1),[S,N]=e.useState(0),[L,A]=e.useState(0),[T,E]=e.useState({}),b=Ut({currentPage:C,isReplaceWidgetList:p,productId:d}),R=async(e=!1,t=!1,i)=>{var s;let l,n=10,r=f;if(u(!!t||!e),!e||t){t||y(1),v([]);let e=await I(i);const{review_per_page:l,default_sort:d}=(null==(s=null==e?void 0:e.display)?void 0:s.widget)||{};n=l||n,r=f||d,j(r)}let a,c,g=!1,p=0,w=0,S={page:e?C:1,limit:n,sort:r};if(l=await kt(d,S),!l)return;const{status:L,data:T,page:E,sorts:b}=l,{code:R}=L;g=200===R||!1,a=(null==T?void 0:T.length)?t=>(null==_?void 0:_.length)&&e?[...t,...T]:T:[],c=(null==b?void 0:b.length)?b:[],p=(null==E?void 0:E.total_page)||1,w=(null==E?void 0:E.total_data)||1,g&&(v(a),x(c),N(p),A(w),u(!1),h(!1),m(!1),setTimeout((()=>{o(!1)}),1300))},I=async e=>{let t,i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;return i=200===n||!1,i?(E(l),l):void 0};return e.useEffect((()=>{if(!(null==r?void 0:r.productReview))return;let e=localStorage.getItem(Ee.PRODUCT_REVIEW_SETTING)||"";"undefined"!=typeof window&&(window.sledgeProductReviewWidgetListUpdate=()=>{R(!1,!1,e)}),Boolean(b&&(null==b?void 0:b.productId)!==d)&&R(!1,!1,e),I(e)}),[r,d]),e.useEffect((()=>{if(!(null==r?void 0:r.productReview))return;let e=Boolean(b&&(null==b?void 0:b.currentPage)!==C),t=localStorage.getItem(Ee.PRODUCT_REVIEW_SETTING)||"";Boolean(b&&(null==b?void 0:b.isReplaceWidgetList)!==p)?R(!0,!0,t):R(!g&&e,p,t)}),[C,g,p,r]),t.jsx(t.Fragment,{children:t.jsx("div",{className:"sledge-product-review__widget-wrapper",children:e.Children.count(s)&&e.Children.map(s,(t=>e.cloneElement(t,{data:l,isFirstLoading:a,isLoading:c,productReviewData:_,productReviewSort:w,selectedSort:f,currentPage:C,totalPage:S,totalData:L,dataSettings:T,setIsLoading:u,setIsRefreshWidgetList:h,setIsReplaceWidgetList:m,setSelectedSort:j,setCurrentPage:y,onAfterAddReview:n})))})})},ii=({children:i})=>t.jsx(t.Fragment,{children:e.Children.count(i)&&e.Children.map(i,(t=>e.cloneElement(t,{})))});ii.Root=ti,ii.Header=Yt,ii.List=Xt;const si="",li=()=>{var i,s,l;const[n,d]=e.useState(!1),[r,a]=e.useState(""),[o,c]=e.useState(""),[m,_]=e.useState(""),[v,w]=e.useState(""),[x,f]=e.useState([]),[j,C]=e.useState([]),[y,S]=e.useState(""),[N,L]=e.useState(""),[A,T]=e.useState(!1),[E,b]=e.useState(""),[R,I]=e.useState({}),[O,P]=e.useState(0),[k,D]=e.useState({}),{text_color:M,border_color:W,border_radius:B,padding_top:H,padding_bottom:U,padding_left:F,padding_right:G,background_color:$,font_size:V,font_weight:q,text_transform:z}=(null==(s=null==(i=null==R?void 0:R.display)?void 0:i.widget)?void 0:s.verified)||{},{verified:J}=(null==(l=null==R?void 0:R.languages)?void 0:l.widget)||{},Z={...M&&{color:M},...W&&{borderWidth:"1px",borderStyle:"solid",borderColor:W},...B&&{borderRadius:B},...H&&{paddingTop:H},...U&&{paddingBottom:U},...F&&{paddingLeft:F},...G&&{paddingRight:G},...$&&{backgroundColor:$},...V&&{fontSize:V},...q&&{fontWeight:q},...z&&{textTransform:z}},K=0===O,Y=O===(null==x?void 0:x.length)-1;return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeProductReviewWidgetPopupDetail=e=>{var t,i,s,l;const{user:{name:n},review:{rating:r,title:o,review:u,media:g,reply:h,is_verified:p},created_at:m,settings:v}=e,{name:x,image:j}=(null==(i=null==(t=null==v?void 0:v.display)?void 0:t.widget)?void 0:i.replier)||{};a(n),c(r),_(o),w(u),f(g),C(h),S(x?String(String(x).includes("<span>")?String(x).split("<span>")[0]:String(x)).replaceAll(Pe.STORE.NAME,null==(s=h[0])?void 0:s.name):null==(l=h[0])?void 0:l.name),L(x?Ce("<span>","</span>",x):"Admin"),T(p),b(new Intl.DateTimeFormat("en-US").format(new Date(m))),d(!0),I(v),P(0),D({name:x,image:j})})}),[]),t.jsx(u,{open:n,onOpenChange:d,children:t.jsxs(g,{children:[t.jsx(h,{className:"sledge__popup-overlay"}),t.jsx(h,{className:"sledge__popup-overlay-blur"}),t.jsx(p,{className:"sledge-product-review__widget-popup-detail-content DialogContent",children:t.jsxs("div",{className:"sledge-product-review__widget-popup-flex",children:[t.jsxs("div",{className:"sledge-product-review__widget-popup-image",children:[t.jsx("div",{className:"sledge-product-review__widget-popup-close",onClick:()=>d(!1),children:t.jsx("svg",{width:18,height:18,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"#A7A7A7",fillRule:"evenodd",clipRule:"evenodd"})})}),(null==x?void 0:x.length)?t.jsxs(t.Fragment,{children:[x.map(((i,s)=>{const{type:l,file:n}=i,d={hidden:{opacity:0,visibility:"hidden"},show:{opacity:1,visibility:"visible"}};let r="image"===l?t.jsx("img",{src:n,alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`,style:d[O!==s?"hidden":"show"]}):t.jsx("video",{controls:!0,style:d[O!==s?"hidden":"show"],children:t.jsx("source",{src:n})});return t.jsx(e.Fragment,{children:r},s)})),t.jsxs("div",{className:"sledge-product-review__widget-popup-media-nav",children:[!K&&t.jsx("div",{className:"sledge-product-review__widget-popup-media-nav-item sledge-product-review__widget-popup-media-nav-item-prev",onClick:()=>P(O-1),children:t.jsx(_t,{width:16,height:16,color:"white"})}),!Y&&t.jsx("div",{className:"sledge-product-review__widget-popup-media-nav-item sledge-product-review__widget-popup-media-nav-item-next",onClick:()=>P(O+1),children:t.jsx(vt,{width:16,height:16,color:"white"})})]})]}):t.jsx("div",{className:"sledge-product-review__widget-popup-no-media",children:"No Media Upload"})]}),t.jsxs("div",{className:"sledge-product-review__widget-popup-content",children:[t.jsxs("div",{className:"sledge-product-review__widget-popup-content-heading",children:[t.jsx("div",{className:"sledge-product-review__widget-popup-content-title",children:r}),A?t.jsx("div",{className:"sledge-product-review__widget-popup-content-verified-text",style:Z,children:J}):null]}),t.jsxs("div",{className:"sledge-product-review__widget-popup-content-subheading",children:[t.jsx(Ft,{value:o,size:"sm",withSkeletonLoading:!1}),t.jsx("div",{className:"sledge-product-review__widget-popup-content-date",children:E})]}),t.jsx("div",{className:"sledge-product-review__widget-popup-content-title-description",children:m}),t.jsxs("div",{className:"sledge-product-review__widget-popup-content-description",children:[t.jsx("div",{className:"sledge-product-review__widget-popup-content-message",dangerouslySetInnerHTML:{__html:v}}),(null==j?void 0:j.length)?t.jsxs("div",{className:"sledge-product-review__widget-popup-reply-wrapper",children:[t.jsxs("div",{className:"sledge-product-review__widget-review-card-reply-title",children:[t.jsx("img",{src:(null==k?void 0:k.image)||"",alt:"sledge-review-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`,className:"sledge-product-review__widget-review-card-reply-profile-image"}),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-name",children:y}),t.jsx("span",{className:"sledge-product-review__widget-review-card-reply-status",children:N})]}),t.jsx("div",{className:"sledge-product-review__widget-popup-content-message",dangerouslySetInnerHTML:{__html:j[0].text}})]}):t.jsx(t.Fragment,{})]})]})]})})]})})},ni="",di=()=>{var i,s,l,n;const{sledgeAnonymId:d}=e.useContext(Fi),[r,a]=e.useState(!1),[o,c]=e.useState([{key:"Step_SelectRate",isDone:!0,component:ri},{key:"Step_WriteReview",isDone:!1,component:ai},{key:"Step_PersonalData",isDone:!1,component:oi}]),[m,_]=e.useState(o[0]),[v,w]=e.useState(!1),[x,f]=e.useState(null),[j,C]=e.useState(!1),[y,S]=e.useState(!1),[N,L]=e.useState(!1),[A,T]=e.useState(null),[E,b]=e.useState({}),[R,I]=e.useState({onAfterAddReview:e=>{}}),[O,P]=e.useState(""),[k,D]=e.useState(""),[M,W]=e.useState(""),[B,H]=e.useState(""),[U,F]=e.useState(""),[G,$]=e.useState(0),[V,q]=e.useState(""),[z,J]=e.useState(""),[Z,K]=e.useState([]),[Y,X]=e.useState([]),{title_added_to_review:Q,text_added_to_review:ee}=(null==(i=null==E?void 0:E.languages)?void 0:i.notification)||{},{title_confirm_add_review:te,text_confirm_add_review:le,button_submit_confirm_add_review:ne,button_cancel_confirm_add_review:de}=(null==(s=null==E?void 0:E.languages)?void 0:s.popup)||{},{navigation_previous:re,navigation_next:ae,button_submit:oe}=(null==(l=null==E?void 0:E.languages)?void 0:l.write_review_form)||{},ce=async()=>{let e;C(!0);let i=!1;if(e=await Ht({userFirstName:O,userLastName:k,userEmail:M,productId:B,productVariantId:U,rating:G,title:V,review:z,mediaIds:Z}),!e)return;const{status:{code:s}}=e;i=200===s,i?(R.onAfterAddReview("success"),setTimeout((()=>{C(!1),a(!1),_(o[0]),P(""),D(""),W(""),$(0),q(""),J(""),K([]),X([]),ge&&ge(),"undefined"!=typeof window&&(window.sledgeProductReviewWidgetListUpdate&&window.sledgeProductReviewWidgetListUpdate(),window.sledgeProductReviewWidgetSummaryUpdate&&window.sledgeProductReviewWidgetSummaryUpdate(),window.sledgeToastNotification&&window.sledgeToastNotification({title:Q,message:ee,type:"success",icon:t.jsx(Ct,{width:40,height:40,color:"black"})}))}),500)):(R.onAfterAddReview("failed"),C(!1),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:"failed add to review",type:"failed",icon:t.jsx(Ct,{width:40,height:40,color:"black"})}))},ue=()=>{const e=o.findIndex((e=>e.key===m.key));c((e=>e.map((e=>(e.key===m.key&&(e.isDone=!0),e))))),_(o[e+1])},ge=async()=>{let e,t=!1,i=[],s=[];if(e=await Mt(),!e)return;const{status:l,data:n}=e,{code:d}=l;t=200===d||!1,i=(null==n?void 0:n.ids)||[],s=(null==n?void 0:n.media)||[],t&&(K(i),X(s),S(!1),L(!1),T(null))},he=()=>{"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:te,message:le,textSubmit:ne,textCancel:de,buttonSubmitType:"success",onSubmit:ce||{}})};return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeProductReviewWidgetFormAdd=(e,t)=>{const{productId:i,productVariantId:s}=e||{};a(!0),H(i||""),F(s||""),t&&I({onAfterAddReview:t})}),(async e=>{let t,i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;i=200===n||!1,i&&(b(l),await ge())})(localStorage.getItem(Ee.PRODUCT_REVIEW_SETTING)||"")}),[]),e.useEffect((()=>{_(o[0])}),[d]),e.useEffect((()=>{switch(null==m?void 0:m.key){case"Step_SelectRate":w(!!G),f(t.jsxs(t.Fragment,{children:[t.jsx("span",{children:ae}),t.jsx(wt,{width:18,height:18,color:"black"})]}));break;case"Step_WriteReview":w(!0),f(d?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:ae}),t.jsx(wt,{width:18,height:18,color:"black"})]}):oe);break;case"Step_PersonalData":w(!0),f(oe)}}),[m,G,z,O,M,d]),t.jsx(u,{open:r,onOpenChange:a,children:t.jsxs(g,{children:[t.jsx(h,{className:"sledge__popup-overlay"}),t.jsx(h,{className:"sledge__popup-overlay-blur"}),t.jsx(p,{className:"sledge-product-review__widget-form-add-content DialogContent",children:t.jsxs(ie,{className:"sledge-product-review__widget-form-review FormRoot",onSubmit:e=>(e=>{e.preventDefault(),"Step_SelectRate"===(null==m?void 0:m.key)?ue():d&&"Step_WriteReview"===(null==m?void 0:m.key)?ue&&ue():he&&he()})(e),"data-active-step":(null==m?void 0:m.key)||"","data-visible-next":v,children:[t.jsx("div",{className:"sledge-product-review__widget-form-add-step",children:(null==m?void 0:m.component)&&e.cloneElement(t.jsx(m.component,{}),{steps:o,activeStep:m,isLoadingAddReview:j,isLoadingUploadMedia:y,isLoadingDeleteMedia:N,selectedDeleteMediaId:A,dataSettings:E,postUserFirstName:O,postUserLastName:k,postUserEmail:M,postRating:G,postReview:z,postMedia:Y,setIsLoadingUploadMedia:S,setIsLoadingDeleteMedia:L,setSelectedDeleteMediaId:T,handleNext:ue,handleProductReviewMedia:ge,handleAddReview:ce,setPostUserFirstName:P,setPostUserLastName:D,setPostUserEmail:W,setPostRating:$,setPostTitle:q,setPostReview:J,confirmAddReview:he})}),t.jsxs("div",{className:"sledge-product-review__widget-form-add-step-navigator",children:[(null==(n=o[0])?void 0:n.key)===(null==m?void 0:m.key)?t.jsx("span",{}):t.jsx("span",{onClick:()=>{const e=o.findIndex((e=>e.key===m.key));0!==e&&(c((e=>e.map((e=>(e.key===m.key&&(e.isDone=!1),e))))),_(o[e-1]))},children:re}),v&&t.jsx(se,{asChild:!0,disabled:j,children:t.jsx(Lt,{role:"button",colorType:"light",style:{...j&&{cursor:"wait"}},children:j?"Adding...":x})})]})]})})]})})},ri=e=>{var i,s,l,n;const{postRating:d,setPostRating:r,setPostTitle:a,dataSettings:o}=e,{text_color:c,border_color:u,border_radius:g,padding_top:h,padding_bottom:p,padding_left:m,padding_right:_,background_color:v,selected_background_color:w,font_size:x,font_weight:f,text_transform:j}=(null==(s=null==(i=null==o?void 0:o.display)?void 0:i.write_review_form)?void 0:s.button_select_rating)||{},{title:C,ratings:y}=(null==(n=null==(l=null==o?void 0:o.languages)?void 0:l.write_review_form)?void 0:n.select_rating)||{},{rating_5:S,rating_4:N,rating_3:L,rating_2:A,rating_1:T}=y||{},E={...c&&{color:c},...u&&{borderColor:u},...g&&{borderRadius:g},...h&&{paddingTop:h},...p&&{paddingBottom:p},...m&&{paddingLeft:m},..._&&{paddingRight:_},...x&&{fontSize:x},...f&&{fontWeight:f},...j&&{textTransform:j}},b=[{rate:5,title:S},{rate:4,title:N},{rate:3,title:L},{rate:2,title:A},{rate:1,title:T}];return t.jsxs("div",{className:"sledge-product-review__widget-form",children:[t.jsx("div",{className:"sledge-product-review__widget-form-title",children:C}),t.jsx("div",{className:"sledge-product-review__widget-form-select-rate-list",children:b.map(((e,i)=>t.jsxs("button",{type:"button",className:`sledge-product-review__widget-form-select-rate-list-item ${e.rate===d&&"selected"}`,onClick:()=>{return t=e.rate,i=e.title,r&&r(t),void(a&&a(i));var t,i},style:{...E,...v&&w?{backgroundColor:e.rate===d?w:v}:{}},children:[t.jsx(Fi.Provider,{value:{isRenderApp:{productReview:!0}},children:t.jsx(Ft,{value:e.rate,size:"md",withSkeletonLoading:!1})})," ",t.jsx("span",{className:"sledge-product-review__widget-form-select-rate-text",children:e.title})]},i)))})]})},ai=i=>{var s;const{isLoadingUploadMedia:l,isLoadingDeleteMedia:n,selectedDeleteMediaId:d,dataSettings:r,postMedia:a,postReview:o,setIsLoadingUploadMedia:c,setIsLoadingDeleteMedia:u,setSelectedDeleteMediaId:g,handleNext:h,handleProductReviewMedia:p,setPostMediaIds:m,setPostMedia:_,setPostReview:v}=i,{description:w}=(null==(s=null==r?void 0:r.languages)?void 0:s.write_review_form)||{},{title:x,form_placeholder:f}=w||{},[j,C]=e.useState(!1),y=async()=>{if(!d)return;let e;u&&u(!0);let i=!1;if(e=await Bt(d),!e)return;const{status:s}=e,{code:l}=s;i=200===l,i?(p&&p(),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Media removed",message:"successfully removed from media",type:"success",icon:t.jsx(yt,{width:40,height:40,color:"black"})})):(u&&u(!1),g&&g(null),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:"failed delete to media",type:"failed",icon:t.jsx(yt,{width:40,height:40,color:"black"})}))};e.useEffect((()=>{C(!1)}),[]),e.useEffect((()=>{d&&j&&(C(!1),"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Are you sure want to delete this media?",message:"This action cannot be undone. This will permanently delete this media.",textSubmit:"Delete",textCancel:"Cancel",buttonSubmitType:"danger",onSubmit:y||{}}))}),[d,j]);const S=t.jsx("label",{htmlFor:"file-upload",className:"sledge-product-review__widget-form-upload-media-file",children:t.jsx("div",{className:"sledge-product-review__widget-form-upload-media",children:t.jsxs("div",{className:"sledge-product-review__widget-form-upload-media-description",children:[t.jsx(yt,{width:32,height:32,color:"currentColor"}),t.jsx("div",{className:"sledge-product-review__widget-form-upload-media-text",children:l?t.jsx("span",{children:"Uploading..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Upload a file PNG, JPG max 5MB"}),t.jsx("input",{id:"file-upload",name:"file-upload",type:"file",multiple:!0,onChange:e=>{e.target.files&&(async e=>{let i;c&&c(!0);let s=!1,l=[],n=[];i=await Wt(e),i||(c&&c(!1),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:"failed add to media",type:"failed",icon:t.jsx(yt,{width:40,height:40,color:"black"})}));const{status:d,data:r}=i||{},{code:a}=d||{};s=200===a,l=(null==r?void 0:r.ids)||[],n=(null==r?void 0:r.media)||[],s?(m&&m(l),_&&_(n),p&&p(),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Media added",message:"successfully added to media",type:"success",icon:t.jsx(yt,{width:40,height:40,color:"black"})})):(c&&c(!1),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:"failed add to media",type:"failed",icon:t.jsx(yt,{width:40,height:40,color:"black"})}))})(e.target.files)},className:"sledge-product-review__widget-form-sr-only"})]})})]})})});return t.jsxs("div",{className:"sledge-product-review__widget-form",children:[t.jsx("div",{className:"sledge-product-review__widget-form-title",children:x}),t.jsx(ks,{className:"Textarea",required:!0,placeholder:f,value:o,onChange:e=>v&&v(e.target.value)}),(null==a?void 0:a.length)?t.jsx(t.Fragment,{children:t.jsxs("div",{className:"sledge-product-review__widget-form-upload-media-filled",children:[a.map(((e,i)=>{const{id:s,file:l,type:r}=e;let a=n&&s==d;return t.jsxs(Q.div,{initial:"hidden",animate:"visible",variants:Zt,className:"sledge-product-review__widget-form-upload-media-filled-item",children:[a?t.jsx("div",{className:"sledge-product-review__widget-form-upload-media-delete-loading",children:"Deleting..."}):t.jsx("div",{className:"sledge-product-review__widget-form-upload-media-delete-item",onClick:()=>{C(!0),g&&g(s)},children:t.jsx("svg",{width:25,height:20,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:"#fff",fillRule:"evenodd",clipRule:"evenodd"})})}),"image"===r?t.jsx("img",{src:l,className:"sledge-product-review__widget-form-upload-media-filled-item-file",alt:"sledge-review-uploaded-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`}):t.jsx("video",{controls:!a,className:"sledge-product-review__widget-form-upload-media-filled-item-file",children:t.jsx("source",{src:l})})]},i)})),S]})}):S]})},oi=e=>{var i;const{dataSettings:s,postUserFirstName:l,postUserLastName:n,postUserEmail:d,setPostUserFirstName:r,setPostUserLastName:a,setPostUserEmail:o}=e,{user:c}=(null==(i=null==s?void 0:s.languages)?void 0:i.write_review_form)||{},{title:u,first_name_form_placeholder:g,last_name_form_placeholder:h,email_form_placeholder:p}=c||{};return t.jsx("div",{className:"sledge-product-review__widget-form",children:t.jsxs("div",{className:"sledge-product-review__widget-form-personal-data",children:[t.jsx("div",{className:"sledge-product-review__widget-form-title",children:u}),t.jsxs("div",{className:"sledge-product-review__widget-form-group-flex",children:[t.jsx(Ms,{name:"userFirstName",type:"text",required:!0,placeholder:g,onChange:e=>r&&r(e.target.value),value:l}),t.jsx(Ms,{name:"userLastName",type:"text",required:!0,placeholder:h,onChange:e=>a&&a(e.target.value),value:n})]}),t.jsx(Ms,{name:"userEmail",type:"email",required:!0,placeholder:p,onChange:e=>o&&o(e.target.value),value:d}),t.jsxs("div",{className:"sledge-product-review__widget-form-review-description",children:["By submitting, I acknowledge the ",t.jsx("a",{href:"#",children:"Terms of Service"})," and ",t.jsx("a",{href:"#",children:"Privacy Policy"})," and that my review will be publicly posted and shared online"]})]})})},ci=()=>{let i=document.querySelector(Re.PRODUCT_REVIEW.ELEMENT_WIDGET);je(i,(()=>{if(i){const s=i.getAttribute(Te.GLOBAL.PRODUCT_ID),l=i.getAttribute(Te.GLOBAL.PRODUCT_VARIANT_ID),n=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_REVIEW);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsxs(ii.Root,{data:{productId:s||"",productVariantId:l||""},onAfterAddReview:e=>{i&&n&&eval(n)({element:i,state:e})},children:[t.jsxs(ii.Header,{children:[t.jsx(Yt.Summary,{}),t.jsx(Yt.AddTrigger,{}),t.jsx(Yt.Sort,{})]}),t.jsx(ii.List,{})]})})}))}}))},ui=()=>{let i=document.querySelector(`[${Ae}="${be.PRODUCT_REVIEW.ELEMENT_WIDGET_POPUP_DETAIL}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.PRODUCT_REVIEW.ELEMENT_WIDGET_POPUP_DETAIL),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(li,{})})))},gi=()=>{let i=document.querySelector(`[${Ae}="${be.PRODUCT_REVIEW.ELEMENT_WIDGET_FORM_ADD}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.PRODUCT_REVIEW.ELEMENT_WIDGET_FORM_ADD),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(di,{})})))},hi=()=>{ci(),ui(),gi(),$t()},pi=e=>t.jsx(Oi,{layoutType:"product-filter",...e}),mi=()=>{let i=document.querySelector(Re.INSTANT_SEARCH.ELEMENT_PLP_WIDGET);je(i,(()=>{var s,l,n,d;if(i){const r=i.getAttribute(Te.INSTANT_SEARCH.QUERY_KEYWORD),a=i.getAttribute(Te.GLOBAL.COLLECTION_ID),o=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_TO_CART),u=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),g=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST),h=i.getAttribute(Te.GLOBAL.ON_AFTER_RENDER_PRODUCT),p=null==(s=i.querySelector(Re.GLOBAL.ELEMENT_PRODUCT_CARDS))?void 0:s.getAttribute(Te.GLOBAL.RENDER_COMPONENT);null==(l=i.querySelector(Re.GLOBAL.ELEMENT_SUGGESTION_KEYWORD_LISTS))||l.getAttribute(Te.GLOBAL.RENDER_COMPONENT),null==(n=i.querySelector(Re.GLOBAL.ELEMENT_OTHER_INDEX_LISTS))||n.getAttribute(Te.GLOBAL.RENDER_COMPONENT),null==(d=i.querySelector(Re.GLOBAL.ELEMENT_SEARCH_VIEW_MORE_RESULT))||d.getAttribute(Te.GLOBAL.RENDER_COMPONENT),i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(pi,{query:{keyword:r||""},data:{collectionId:Number(a)||""},onAfterAddToCart:e=>{i&&o&&eval(o)({element:i,state:e})},onAfterAddWishlist:e=>{i&&u&&eval(u)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&g&&eval(g)({element:i,state:e})},onAfterRenderProduct:e=>{i&&h&&eval(h)({element:i,state:e})},children:t.jsx(Gi,{component:p?eval(p):null,isJsVersion:!0})})})}))}}))},_i="",vi=i=>{const{size:s="sm",children:l,onAfterAddToCart:n,onAfterAddWishlist:d,onAfterRemoveWishlist:r,onAfterRenderProduct:a}=i||{};let o=null,c=null,u=null,g=null,h=!1;e.Children.map(l,(t=>{if(e.isValidElement(t)&&ye(t.type)){const{component:e,isJsVersion:i}=(null==t?void 0:t.props)||{};switch(h=i,t.type.name){case ke.PRODUCT.CARDS:o=e;break;case ke.SUGGESTION_KEYWORD_LISTS:c=e;break;case ke.OTHER_INDEX_LISTS:u=e;break;case ke.SEARCH_VIEW_MORE_RESULT:g=e}}}));const{isRenderApp:p}=e.useContext(Fi),[m,_]=e.useState({width:0,height:0});e.useEffect((()=>{(null==p?void 0:p.instantSearch)&&_("xs"===s?{width:14,height:14}:"sm"===s?{width:20,height:20}:{width:25,height:25})}),[p]);return t.jsx("span",{className:"sledge-instant-search__icon-widget",onClick:()=>{"undefined"!=typeof window&&window.sledgeInstantSearchIconWidgetPopup&&window.sledgeInstantSearchIconWidgetPopup(n,d,r,a,h,o,c,u,g)},children:t.jsx(St,{...m,color:"currentColor"})})},wi="",xi=async(e,t,i)=>{let s=localStorage.getItem(Ee.INSTANT_SEARCH_AUTH_APP);var l=new Headers;l.append("Authorization",`Bearer ${s}`),l.append("Content-Type","application/json");var n={method:t,headers:l,redirect:"follow",...i&&{body:JSON.stringify(i)}};return await fetch(`${Ne}${e}`,n).then((e=>e.json())).then((e=>e)).catch((()=>{}))},fi=async(e,t)=>await xi(`/indexes/${e}/search`,"POST",t),ji=async e=>await xi("/multi-search","POST",e),Ci=async e=>{const{keyword:t,resultCount:i}=e;let s=localStorage.getItem(Ee.AUTH_APP);var l=new Headers;l.append("Authorization",`Bearer ${s}`),l.append("Content-Type","application/json");var n={method:"POST",headers:l,body:JSON.stringify({keyword:t,result_count:i}),redirect:"follow"};return await fetch(`${Se}/instantsearch/statistics/search`,n).then((e=>e.json())).then((e=>e)).catch((()=>{}))},yi=async e=>{const{productId:t}=e;let i=localStorage.getItem(Ee.AUTH_APP);var s=new Headers;s.append("Authorization",`Bearer ${i}`),s.append("Content-Type","application/json");var l={method:"POST",headers:s,body:JSON.stringify({product:{id:xe(t)}}),redirect:"follow"};return await fetch(`${Se}/instantsearch/statistics/click`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Si=async e=>{const{productId:t}=e;let i=localStorage.getItem(Ee.AUTH_APP);var s=new Headers;s.append("Authorization",`Bearer ${i}`),s.append("Content-Type","application/json");var l={method:"POST",headers:s,body:JSON.stringify({product:{id:xe(t)}}),redirect:"follow"};return await fetch(`${Se}/instantsearch/statistics/cart`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Ni=({listsComponent:e,name:i,items:s,isComponentJsVersion:l})=>{const n=e?e({name:i,items:s}):null;return e?l?t.jsx("div",{dangerouslySetInnerHTML:{__html:n}}):n:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-title",children:i}),(null==s?void 0:s.length)?t.jsx("ul",{className:"sledge-instant-search__icon-widget-search-form-result-list",children:s.map(((e,i)=>{const{title:s,url:l}=e;return t.jsx("li",{children:t.jsx("a",{href:l,className:"sledge-instant-search__icon-widget-search-form-result-list-link",children:s})},i)}))}):t.jsx("ul",{className:"sledge-instant-search__icon-widget-search-form-result-list",children:t.jsxs("li",{className:"sledge-instant-search__icon-widget-search-form-result-item-disabled",children:["No ",null==i?void 0:i.toLowerCase()," were found"]})})]})},Li=({listsComponent:e,keywords:i,isComponentJsVersion:s=!1})=>{const l=e?e({keywords:i}):null;return e?s?t.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):l:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-title",children:"Suggestions"}),t.jsx("ul",{className:"sledge-instant-search__icon-widget-search-form-result-list",children:null==i?void 0:i.map(((e,i)=>t.jsx("li",{children:t.jsxs("a",{href:`${Oe}?q=${e}`,className:"sledge-instant-search__icon-widget-search-form-result-list-link sledge-instant-search__icon-widget-search-form-result-list-link-suggestion",children:[t.jsx(St,{width:12,height:12,color:"#677487"})," ",e]})},i)))})]})},Ai=({component:e,keyword:i,isComponentJsVersion:s=!1})=>{const l=e?e({keyword:i}):null;return e?s?t.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):l:t.jsx("a",{href:`${Oe}?q=${i}`,className:"sledge-instant-search__icon-widget-button-more",children:"View More Result"})},Ti={OtherIndexLists:Ni,SuggestionKeywordLists:Li,SearchViewMoreResult:Ai},Ei=()=>{var i,s,l,n,d,r,a,o,c,m,_,v,w,x,f,j,C,y,S,N,L,A;const[T,E]=e.useState(!0),[b,R]=e.useState(!1),[I,O]=e.useState(""),[P,k]=e.useState(""),[D,M]=e.useState([]),[W,B]=e.useState([]),[H,U]=e.useState([]),[F,G]=e.useState([]),[$,V]=e.useState({}),[q,z]=e.useState({}),[J,Z]=e.useState(""),[K,Y]=e.useState({onAfterAddToCart:e=>{},onAfterAddWishlist:e=>{},onAfterRemoveWishlist:e=>{},onAfterRenderProduct:e=>{},separateJsVersionComponent:null,productCardsComponent:null,suggestionKeywordListsComponent:null,otherIndexListsComponent:null,searchViewMoreResultComponent:null}),X=e.useRef(null),Q=Ut({keyword:I}),ee=async(e,t=!1)=>{var i,s,l,n,d,r,a,o,c,u,g;if(!b)return;E(!0);const{tabs:h,suffix_index_product:p,hidden_tags:m,display:_}=e,v=(null==(i=null==_?void 0:_.search)?void 0:i.suggestion)||{};let w,x={queries:h.map((e=>{var t;const{index:i}=e;let s=i.includes(p),l=[];return(null==m?void 0:m.length)&&l.push(`tags NOT IN [${m}]`),(null==(t=null==_?void 0:_.filter)?void 0:t.show_out_of_stock)||l.push("variants.inventory_quantity > 0"),{indexUid:i,q:I,hitsPerPage:s?6:4,filter:s?l.join(" AND "):""}}))};if(w=await ji(x),!w)return;const{results:f}=w;let j=null==f?void 0:f.filter((({indexUid:e})=>null==e?void 0:e.includes(p)));t&&(null==I?void 0:I.length)&&Ci({keyword:I,resultCount:(null==(s=j[0])?void 0:s.totalHits)||0});let C=(null==(l=null==f?void 0:f.filter((({indexUid:e})=>!(null==e?void 0:e.includes(p)))))?void 0:l.map((e=>{const{indexUid:t}=e,{name:i}=null==h?void 0:h.find((({index:e})=>e.includes(t)));return{...e,name:i||""}})))||[],y=(null==j?void 0:j.length)?null==(n=j[0])?void 0:n.hits:[],S=I.length?(null==y?void 0:y.length)?"":"no_result":"zero_character",N=Boolean(!I.length&&Object.keys(v).length&&(null==(r=null==(d=v[S])?void 0:d.products)?void 0:r.active)&&(null==(c=null==(o=null==(a=v[S])?void 0:a.products)?void 0:o.list)?void 0:c.length));M(N?null==(g=null==(u=v[S])?void 0:u.products)?void 0:g.list:y),B(C),Z(S),E(!1)};return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeInstantSearchIconWidgetPopup=(e=(()=>{}),t=(()=>{}),i=(()=>{}),s=(()=>{}),l=null,n=(()=>{}),d=(()=>{}),r=(()=>{}),a=(()=>{}))=>{R(!0),Y({onAfterAddToCart:e,onAfterAddWishlist:t,onAfterRemoveWishlist:i,onAfterRenderProduct:s,separateJsVersionComponent:l,productCardsComponent:n,suggestionKeywordListsComponent:d,otherIndexListsComponent:r,searchViewMoreResultComponent:a}),setTimeout((()=>{(null==X?void 0:X.current)&&(X.current.focus(),X.current.value=I)}),500)}),(async e=>{var t;if(!b)return;let i,s=!1;if(i=JSON.parse(e),!i)return;const{status:l,data:n}=i,{code:d}=l,{tabs:r,suffix_index_product:a,hidden_tags:o,display:c}=n;s=200===d||!1,s&&(U(r),k(a),G(o),V(c),z(null==(t=null==c?void 0:c.search)?void 0:t.suggestion),await ee(n))})(localStorage.getItem(Ee.INSTANT_SEARCH_SETTING)||"")}),[b]),e.useEffect((()=>{if(Boolean(Q&&(null==Q?void 0:Q.keyword)!==I)){const e=setTimeout((()=>{ee({tabs:H,suffix_index_product:P,hidden_tags:F,display:$},!0)}),500);return()=>clearTimeout(e)}}),[I]),t.jsx(u,{open:b,onOpenChange:R,children:t.jsxs(g,{children:[t.jsx(h,{className:"sledge__popup-overlay"}),t.jsx(h,{className:"sledge__popup-overlay-blur"}),t.jsxs(p,{className:"sledge-instant-search__icon-widget-popup-detail-content","data-layout-type":(null==(i=null==$?void 0:$.search)?void 0:i.layout)||"",children:[t.jsx(Tt,{type:"text",icon:t.jsx(St,{width:20,height:20,color:"#000000"}),placeholder:"Search anything...",value:I,fieldRef:X,onChange:({value:e})=>O(e),className:"sledge-instant-search__icon-widget-search-form-field",withClearField:!0}),t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result",children:T?t.jsx(zs,{children:t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-wrapper",children:t.jsxs("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex",children:[t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex-item-other sledge-instant-search__icon-widget-search-form-result-flex-item-other-skeleton",children:[0,1,2].map((i=>t.jsxs(e.Fragment,{children:[t.jsx(tl.Item,{width:"100%",height:"42px",color:"grey-100",rounded:"md",...Boolean(i)&&{style:{marginTop:"12px"}}}),t.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"12px",marginTop:"12px"},children:[1,2,3].map((e=>t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{maxWidth:"140px"}},e)))})]},i)))}),t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex-item-product",children:t.jsx(tl.ProductGrid,{count:6,type:"medium"})})]})})}):t.jsx(zs,{children:t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-wrapper",children:t.jsxs("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex",children:[t.jsxs("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex-item-other",children:[Object.keys(q).length&&(null==(l=null==(s=q[J])?void 0:s.keywords)?void 0:l.active)&&(null==(r=null==(d=null==(n=q[J])?void 0:n.keywords)?void 0:d.list)?void 0:r.length)?t.jsx(Ti.SuggestionKeywordLists,{listsComponent:K.suggestionKeywordListsComponent,keywords:q[J].keywords.list,isComponentJsVersion:K.separateJsVersionComponent}):null,W&&W.map(((i,s)=>{const{hits:l,name:n}=i;return t.jsx(e.Fragment,{children:t.jsx(Ti.OtherIndexLists,{listsComponent:K.otherIndexListsComponent,name:n,items:l,isComponentJsVersion:K.separateJsVersionComponent})},s)}))]}),t.jsxs("div",{className:"sledge-instant-search__icon-widget-search-form-result-flex-item-product",children:[(null==D?void 0:D.length)?t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-product",children:t.jsx(Os,{sourceApp:"instant-search",type:"medium",data:D.map((e=>{const{variants:t,...i}=e||{};return{product:i,variants:t}})),setting:{show_vendor:null==(a=null==$?void 0:$.search)?void 0:a.show_vendor,show_sku:null==(o=null==$?void 0:$.search)?void 0:o.show_sku,show_price:null==(c=null==$?void 0:$.search)?void 0:c.show_price},showOptionOutOfStock:!0,isComponentJsVersion:K.separateJsVersionComponent,cards:K.productCardsComponent,onAfterAddToCart:K.onAfterAddToCart,onAfterAddWishlist:K.onAfterAddWishlist,onAfterRemoveWishlist:K.onAfterRemoveWishlist,onAfterRenderProduct:K.onAfterRenderProduct})}):Object.keys(q).length&&(null==(_=null==(m=q[J])?void 0:m.products)?void 0:_.active)&&(null==(x=null==(w=null==(v=q[J])?void 0:v.products)?void 0:w.list)?void 0:x.length)?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sledge-instant-search__icon-widget-search-form-result-product-suggestion-no-result-text",children:[t.jsx("span",{children:"Sorry"}),", nothing found for ",t.jsx("span",{children:I}),". Did you mean:"]}),t.jsx(Os,{sourceApp:"instant-search",type:"medium",data:q[J].products.list.map((e=>{const{variants:t,...i}=e||{};return{product:i,variants:t}})),setting:{show_vendor:null==(f=null==$?void 0:$.search)?void 0:f.show_vendor,show_sku:null==(j=null==$?void 0:$.search)?void 0:j.show_sku,show_price:null==(C=null==$?void 0:$.search)?void 0:C.show_price},showOptionOutOfStock:!0,isComponentJsVersion:K.separateJsVersionComponent,cards:K.productCardsComponent,onAfterAddToCart:K.onAfterAddToCart,onAfterAddWishlist:K.onAfterAddWishlist,onAfterRemoveWishlist:K.onAfterRemoveWishlist,onAfterRenderProduct:K.onAfterRenderProduct})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-title",children:"Products"}),t.jsx("div",{className:"sledge-instant-search__icon-widget-search-form-result-item-disabled",children:"No product were found"})]}),(null==D?void 0:D.length)||Object.keys(q).length&&(null==(S=null==(y=q[J])?void 0:y.products)?void 0:S.active)&&(null==(A=null==(L=null==(N=q[J])?void 0:N.products)?void 0:L.list)?void 0:A.length)?t.jsx("div",{className:"sledge-instant-search__icon-widget-button-more-wrapper",children:t.jsx(Ti.SearchViewMoreResult,{component:K.searchViewMoreResultComponent,keyword:I,isComponentJsVersion:K.separateJsVersionComponent})}):null]})]})})})})]})]})})},bi=()=>{let i=document.querySelector(Re.INSTANT_SEARCH.ELEMENT_SEARCH_ICON_WIDGET);je(i,(()=>{var s,l,n,d;if(i){const r=i.getAttribute(Te.GLOBAL.ICON_SIZE),a=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_TO_CART),o=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),u=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST),g=i.getAttribute(Te.GLOBAL.ON_AFTER_RENDER_PRODUCT),h=null==(s=i.querySelector(Re.GLOBAL.ELEMENT_PRODUCT_CARDS))?void 0:s.getAttribute(Te.GLOBAL.RENDER_COMPONENT),p=null==(l=i.querySelector(Re.GLOBAL.ELEMENT_SUGGESTION_KEYWORD_LISTS))?void 0:l.getAttribute(Te.GLOBAL.RENDER_COMPONENT),m=null==(n=i.querySelector(Re.GLOBAL.ELEMENT_OTHER_INDEX_LISTS))?void 0:n.getAttribute(Te.GLOBAL.RENDER_COMPONENT),_=null==(d=i.querySelector(Re.GLOBAL.ELEMENT_SEARCH_VIEW_MORE_RESULT))?void 0:d.getAttribute(Te.GLOBAL.RENDER_COMPONENT);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{instantSearch:!0}},children:t.jsxs(vi,{size:r||"sm",onAfterAddToCart:e=>{i&&a&&eval(a)({element:i,state:e})},onAfterAddWishlist:e=>{i&&o&&eval(o)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&u&&eval(u)({element:i,state:e})},onAfterRenderProduct:e=>{i&&g&&eval(g)({element:i,state:e})},children:[t.jsx(Vi,{component:p?eval(p):null,isJsVersion:!0}),t.jsx($i,{component:m?eval(m):null,isJsVersion:!0}),t.jsx(Gi,{component:h?eval(h):null,isJsVersion:!0}),t.jsx(qi,{component:_?eval(_):null,isJsVersion:!0})]})})}))}}))},Ri=()=>{let i=document.createElement("div");i.setAttribute(Ae,be.INSTANT_SEARCH.ELEMENT_SEARCH_ICON_WIDGET_POPUP),document.body.appendChild(i),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Ei,{})})))},Ii="",Oi=i=>{var s,l,n,d,r,a,o,c,u,g;const{layoutType:h="default",query:p,data:m,children:_,onAfterAddToCart:v,onAfterAddWishlist:w,onAfterRemoveWishlist:x,onAfterRenderProduct:f}=i,{keyword:j=""}=p||{},{collectionId:C}=m||{};let y=null,S=!1;e.Children.map(_,(t=>{if(e.isValidElement(t)&&ye(t.type)&&t.type.name===ke.PRODUCT.CARDS){const{component:e,isJsVersion:i}=(null==t?void 0:t.props)||{};y=e,S=i}}));const{isRenderApp:N}=e.useContext(Fi),[L,A]=e.useState(!0),[T,E]=e.useState(!0),[b,R]=e.useState(""),[I,O]=e.useState(null),[P,k]=e.useState(),[D,M]=e.useState(t.jsx(Pi,{})),[W,B]=e.useState(!0),[H,U]=e.useState([]),[F,G]=e.useState([]),[$,V]=e.useState([]),[q,z]=e.useState([]),[J,Z]=e.useState(""),[K,Y]=e.useState({}),[X,Q]=e.useState([]),[ee,te]=e.useState({}),[ie,se]=e.useState([]),[le,ne]=e.useState(""),[de,re]=e.useState(!1),ae=Ut({keyword:b}),oe=async(e,t)=>{const{filters:i,tabs:s,suffix_index_product:l,hidden_tags:n,display:d,show_out_of_stock:r}=e;let a,o={queries:("product-filter"===h?s.filter((({index:e})=>null==e?void 0:e.includes(l))):s).map((e=>{const{index:s}=e;let d=!1,a=d?[]:null==i?void 0:i.map((e=>{const{collections:t,items:i}=e;return C&&(null==t?void 0:t.includes(Number(C)))||(null==t?void 0:t.includes("all"))?(d=!0,null==i?void 0:i.map((({value:e})=>e))):void 0})),o=s.includes(l),c=o&&a.length,u=[];return(null==n?void 0:n.length)&&u.push(`tags NOT IN [${n}]`),r||u.push("variants.inventory_quantity > 0"),C&&u.push(`collections.id = '${C}'`),c&&z(a[0]),{indexUid:s,q:"default"===t?"":b,hitsPerPage:1,facets:c?a[0]:[],filter:o?u.join(" AND "):""}}))};if(a=await ji(o),!a)return;const{results:c}=a;if(setTimeout((()=>{A(!1)}),1300),B(!1),E(!1),"totalDataPerIndex"===t)V(null==s?void 0:s.map((e=>{const{index:t}=e,{totalHits:i}=(null==c?void 0:c.find((({indexUid:e})=>e===t)))||{};return{...e,total:i}})));else{const{facetDistribution:e,facetStats:t}=(null==c?void 0:c.find((({indexUid:e})=>e.includes(l))))||{};Y(e?Object.fromEntries(Object.entries(e).map((i=>{let s=i[0],l=[];return"variants.inventory_quantity"===s?(Object.keys(e[s]).map((t=>Boolean(Number(t))?e[s][t]:0)),l=[{name:"In Stock",value:"> 0"}]):l="variants.price"===s?t[s]:Object.keys(e[s]).map((t=>({name:t,value:t,total:e[s][t]||0}))),[s,l]}))):{})}};e.useEffect((()=>{if(!(null==N?void 0:N.instantSearch))return;const e=new URLSearchParams(document.location.search);R((null==e?void 0:e.get(j))||""),(async e=>{let t;B(!0);let i,s=!1;if(t=JSON.parse(e),!t)return;const{status:l,data:n}=t,{code:d}=l,{allowed_sorts:r,default_sort:a,filters:o,tabs:c,suffix_index_product:u,hidden_tags:g,display:p,colors:m,show_out_of_stock:_}=n;s=200===d||!1,s&&(U((null==r?void 0:r.length)?r:[]),G((null==o?void 0:o.length)?o:[]),Z(u),Q(g),te(p),se(m),ne(a),re(_),i=c.find((({index:e})=>e.includes(u))),Object.keys(i).length&&(O(i.index),k(i.name)),await oe(n,"default"),"default"===h&&await oe(n,"totalDataPerIndex"))})(localStorage.getItem(Ee.INSTANT_SEARCH_SETTING)||"")}),[N]),e.useEffect((()=>{if(Boolean(ae&&(null==ae?void 0:ae.keyword)!==b)&&"default"===h){const e=setTimeout((()=>{oe({filters:F,tabs:$,suffix_index_product:J,hidden_tags:X,display:ee,colors:ie,show_out_of_stock:de},"totalDataPerIndex")}),500);return()=>clearTimeout(e)}}),[b]);const ce="default"===h?t.jsx("div",{className:"sledge-instant-search__result-tab-list sledge-instant-search__result-tab-list-skeleton",children:[1,2,3,4,5].map((e=>t.jsx(tl.Item,{width:"122px",height:"28px",rounded:"md",color:"grey-100",animationDuration:"15s"},e)))}):null,ue=(null==(s=null==ee?void 0:ee.filter)?void 0:s.enable_on_search)&&"horizontal"===(null==(l=null==ee?void 0:ee.filter)?void 0:l.layout)?t.jsx("div",{className:"sledge-instant-search__result-filter-horizontal-skeleton",children:[1,2,3,4,5,6,7].map((e=>t.jsx(tl.Item,{width:"106px",height:"42px",rounded:"md",color:"grey-100",animationDuration:"13s"},e)))}):null,ge=(null==(n=null==ee?void 0:ee.filter)?void 0:n.enable_on_search)&&"vertical"===(null==(d=null==ee?void 0:ee.filter)?void 0:d.layout)?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",justifyContent:"space-between",marginBottom:"23px"},children:[t.jsx(tl.Item,{width:"117px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"15s"}),t.jsx(tl.Item,{width:"80px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"15s"})]}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"18px"}}),[1,2,3].map((e=>t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"9px"}},e))),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"18px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"14px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"9px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"17px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"38px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"35px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"12px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"9px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"20px"}}),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"12px"}}),[1,2,3].map((e=>t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"163px",marginBottom:"9px"}},e))),t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"270px",marginBottom:"11px"}}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"12px"},children:[1,2,3,4,5,6,7,8,9].map((e=>t.jsx(tl.Item,{width:"34px",height:"34px",color:"grey-100",rounded:"full",animationDuration:"40s"},e)))})]}):null,he=t.jsxs(t.Fragment,{children:[(null==(r=null==ee?void 0:ee.filter)?void 0:r.show_total_products)&&"vertical"===(null==(a=null==ee?void 0:ee.filter)?void 0:a.layout)?t.jsx(tl.Item,{width:"117px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{marginBottom:"21px"}}):null,t.jsx(tl.ProductGrid,{count:12,type:"large"})]}),pe=t.jsxs("div",{className:"sledge-instant-search__result-data-keyword",children:[(null==(o=null==ee?void 0:ee.filter)?void 0:o.show_total_products)&&"horizontal"===(null==(c=null==ee?void 0:ee.filter)?void 0:c.layout)?t.jsx("div",{className:"sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-horizontal",children:t.jsx(tl.Item,{width:"117px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"13s"})}):null,t.jsx("div",{className:"sledge-instant-search__result-data-keyword-form",children:t.jsx(tl.Item,{width:"100%",height:"42px",color:"grey-100",rounded:"lg",style:{maxWidth:"630px"}})}),t.jsxs("div",{className:"sledge-instant-search__result-data-summary-item sledge-instant-search__result-data-summary-select-field",children:[t.jsx("div",{className:"sledge-instant-search__result-data-summary-select-field-item",children:t.jsx(tl.Item,{width:"150px",height:"42px",color:"grey-100",rounded:"lg"})}),t.jsx("div",{className:"sledge-instant-search__result-data-summary-select-field-item",children:t.jsx(tl.Item,{width:"150px",height:"42px",color:"grey-100",rounded:"lg"})})]})]});return t.jsxs("div",{className:"sledge-instant-search__result-container",children:[L?null:t.jsx("div",{className:""+("default"===h&&(null==$?void 0:$.length)?"sledge-instant-search__result-tab":"sledge-instant-search__result-tab-no-index"),children:"default"===h&&(null==$?void 0:$.length)?t.jsx("ul",{className:"sledge-instant-search__result-tab-list",children:$.map((e=>{const{name:i,index:s,total:l}=e;let n=I===s;return t.jsxs("li",{onClick:e=>((e,i,s)=>{O(e),k(i),M(e.includes(J)?t.jsx(Pi,{}):t.jsx(ki,{}))})(s,i),className:""+(n?"sledge-instant-search__result-tab-list-item-active":""),children:[i,t.jsx("span",{className:"sledge-instant-search__result-tab-total",children:l||0})]},s)}))}):null}),L&&(null==h?void 0:h.length)?t.jsxs(t.Fragment,{children:[ce,ue,t.jsxs("div",{className:"sledge-instant-search__result-wrapper sledge-instant-search__result-wrapper-skeleton",children:[(null==(u=null==ee?void 0:ee.filter)?void 0:u.enable_on_search)&&"vertical"===(null==(g=null==ee?void 0:ee.filter)?void 0:g.layout)?t.jsx("div",{className:"sledge-instant-search__result-filter",children:ge}):null,t.jsxs("div",{className:"sledge-instant-search__result-data",children:[pe,he]})]})]}):e.cloneElement(D,{isLoading:T,keyword:b,clickedTabIndexId:I,clickedTabIndexName:P,isLoadingSetting:W,allowedSorts:H,allowedFilters:F,facets:q,searchResultFacets:K,hiddenTags:X,displaySettings:ee,colorSwatches:ie,defaultSort:le,showOutOfStock:de,query:p,data:m,separateJsVersionComponent:S,productCardsComponent:y,onAfterAddToCart:v,onAfterAddWishlist:w,onAfterRemoveWishlist:x,onAfterRenderProduct:f,setIsLoading:E,setKeyword:R,filterHorizontalSkeleton:ue,filterVerticalSkeleton:ge,productGridSkeleton:he,searchAndSelectOptionSkeleton:pe})]})},Pi=i=>{var s,l,n,d,r,a,o,c,u,g,h,p,m,_,v,w,x,f,j,C;const{keyword:y,clickedTabIndexId:S,isLoadingSetting:N,allowedSorts:L,allowedFilters:A,facets:T,searchResultFacets:E,hiddenTags:b,displaySettings:R,colorSwatches:I,defaultSort:O,showOutOfStock:P,query:k,data:D,separateJsVersionComponent:M,productCardsComponent:W,setKeyword:B,filterHorizontalSkeleton:H,filterVerticalSkeleton:U,productGridSkeleton:F,searchAndSelectOptionSkeleton:G,onAfterAddToCart:$,onAfterAddWishlist:V,onAfterRemoveWishlist:q,onAfterRenderProduct:z}=i||{},{keyword:J=""}=k||{},{collectionId:Z}=D||{},[K,Y]=e.useState(!0),[X,ee]=e.useState(!0),[te,ie]=e.useState(!1),[se,le]=e.useState(!1),[ne,de]=e.useState(O||""),[re,ae]=e.useState(L&&Boolean(null==L?void 0:L.length)?null==(s=L.find((({value:e})=>e===O)))?void 0:s.label:""),[oe,ce]=e.useState((null==(l=null==R?void 0:R.search)?void 0:l.limit)||10),[ue,ge]=e.useState(null),[he,pe]=e.useState({...P?{}:{"variants.inventory_quantity":"> 0"}}),[me,_e]=e.useState(!1),[ve,we]=e.useState([]),[xe,fe]=e.useState(0),[je,Ce]=e.useState(1),[ye,Se]=e.useState(0),[Ne,Le]=e.useState(0),[Ae,Te]=e.useState([]),[Ee,be]=e.useState([]),[Re,Ie]=e.useState(!1),[Oe,Pe]=e.useState(null),ke=Ut({keyword:y,clickedLimitId:oe,clickedFacets:he}),{color:De,font_size:Me,font_weight:We,text_transform:Be}=(null==(n=null==R?void 0:R.filter)?void 0:n.title)||{},{color:He,font_size:Ue,font_weight:Fe,text_transform:Ge}=(null==(d=null==R?void 0:R.filter)?void 0:d.option)||{},{text_color:$e,border_color:Ve,border_radius:qe,padding_top:ze,padding_bottom:Je,padding_left:Ze,padding_right:Ke,background_color:Ye,font_size:Qe,font_weight:et,text_transform:tt}=(null==(r=null==R?void 0:R.filter)?void 0:r.button)||{},st={...De&&{color:De},...Me&&{fontSize:Me},...We&&{fontWeight:We},...Be&&{textTransform:Be}},nt={...He&&{color:He},...Ue&&{fontSize:Ue},...Fe&&{fontWeight:Fe},...Ge&&{textTransform:Ge}},rt=e=>{var t;const i=new URLSearchParams(document.location.search),s=Object.fromEntries(i);let l={};for(const d in s){(null==T?void 0:T.length)&&!T.includes(d)&&(l[d]=s[d])}for(const d in e)(null==(t=e[d])?void 0:t.length)&&(l[d]=e[d]);const n=new URLSearchParams({...l}).toString();window.history.pushState(null,"",`${document.location.pathname}${(null==n?void 0:n.length)?`?${n}`:""}`)},ot=e=>{ge(e===ue?"":e)},ut=()=>{Ie(!0),pe({}),_e(!me),rt({}),Te([]),setTimeout((()=>{Ie(!1)}),10)},ht=(e,t,i=!1)=>{var s;Ie(!0);let l=[t],n=["variants.price"].includes(e);he&&(i?l=[t]:(null==(s=he[e])?void 0:s.includes(t))?l=he[e].filter((e=>e!==t)):n?(he[e],he[e]===t?(l=[],Te([])):l=t):l=he[e]?[...he[e],t]:[t]);let d={...he,[e]:l};rt(d),pe(d),_e(!me),setTimeout((()=>{Ie(!1)}),10)},pt=async(e=!1,i=!1)=>{if(!S)return;e&&Ce(1),ee(!0);let s,l=(e=>{const t=new URLSearchParams(document.location.search),i=Object.fromEntries(t);for(const s in i)(null==T?void 0:T.length)&&T.includes(s)&&(e[s]=i[s].split(","));return Object.keys(e).length&&pe(e),e})(he),n=Object.entries(l).map((e=>{var t,i;if((null==e?void 0:e.length)&&e[1].length){let s=e[0],l=["variants.inventory_quantity"].includes(s),n=["variants.price"].includes(s),d=["tags"].includes(s);return Array.isArray(e[1])&&(null==(t=e[1])?void 0:t.length)>1?n?`${s} >= ${e[1][0]} AND ${s} <= ${e[1][1]}`:d?`${s} IN [${e[1]}]`:null==(i=e[1])?void 0:i.map((e=>l?`${s} ${e}`:`${s} = '${e}'`)).join(" OR "):l?`${s} ${e[1]}`:d?`${s} IN [${e[1]}]`:`${s} = '${e[1]}'`}return null})).filter((e=>e));(null==b?void 0:b.length)&&n.push(`tags NOT IN [${b}]`),Z&&n.push(`collections.id = '${Z}'`);let d={q:y,sort:ne?[ne]:[],page:e?1:je,hitsPerPage:oe,facets:T,filter:n.join(" AND ")};s=await fi(S,d),((e,i)=>{var s;if(!e)return;const{hits:l,processingTimeMs:n,totalHits:d,totalPages:r}=e;i&&(null==y?void 0:y.length)&&Ci({keyword:y,resultCount:d||0}),Y(!1),ee(!1),we(l),fe(n||0),Se(r),Le(d||0),Pe(t.jsx("div",{className:"sledge-instant-search__result-data-summary-item",children:(null==(s=null==R?void 0:R.filter)?void 0:s.show_total_products)?t.jsxs("span",{className:"sledge-instant-search__result-data-summary-text",children:[d," result"," ",(null==y?void 0:y.length)?t.jsxs(t.Fragment,{children:["for ",t.jsxs("span",{className:"sledge-instant-search__result-data-summary-text-keyword",children:['"',y,'"']})]}):null]}):null}))})(s,i)},_t=e=>{const t=new URLSearchParams(document.location.search);t.set(J,e),B&&B(e),window.history.pushState(null,"",`${document.location.pathname}?${t.toString()}`)};e.useEffect((()=>{let e=Boolean(ke&&((null==ke?void 0:ke.keyword)!==y||(null==ke?void 0:ke.clickedLimitId)!==oe||(null==ke?void 0:ke.clickedFacets)!==he));if(Boolean(ke&&(null==ke?void 0:ke.keyword)!==y)){const e=setTimeout((()=>{pt(!0,!0)}),500);return()=>clearTimeout(e)}pt(e)}),[ne,oe,me,y,je,S]),e.useEffect((()=>{(()=>{var e,t;if(!(null==(e=null==R?void 0:R.filter)?void 0:e.enable_on_search)||(null==(t=null==R?void 0:R.filter)?void 0:t.hide_when_one_value)&&Ne<=1)return;let i=!1;i||null==A||A.map((e=>{const{collections:t,items:s}=e;(Z&&(null==t?void 0:t.includes(Number(Z)))||(null==t?void 0:t.includes("all")))&&(i=!0,be(s))}))})()}),[A,E,Ne]);const vt=({label:e,name:i,value:s,index:l})=>{var n;let d=s;return["variants.price"].includes(i)&&(d=null==s?void 0:s.join(" - ")),t.jsxs("div",{className:"sledge-instant-search__result-filter-item-refine-selected",style:nt,children:[t.jsxs("span",{className:"sledge-instant-search__result-filter-item-title-refine-list",children:[e,": ",null==(n=String(d))?void 0:n.replaceAll("_"," ")]}),t.jsx("span",{className:"sledge-instant-search__result-filter-item-refine-title-clear",onClick:()=>ht(i,s),children:t.jsx("svg",{width:12,height:12,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})]},l)},wt=e=>{var i,s;const{value:l,label:n,display:d}=e;let r=null,a=E[l],o=null==(i=null==R?void 0:R.filter)?void 0:i.show_number_matching_product;return"slider"===d.toLowerCase()?r=t.jsxs("div",{className:"sledge-instant-search__result-filter-item-list-slider",children:[t.jsx(lt,{defaultValue:[Ae[0]||(null==a?void 0:a.min),Ae[1]||(null==a?void 0:a.max)],min:null==a?void 0:a.min,max:null==a?void 0:a.max,step:1,setValueCommit:e=>ht(l,e),setValueChange:e=>Te(e)}),t.jsxs("div",{className:"sledge-instant-search__result-filter-item-list-slider-minmax",children:[t.jsx("div",{className:"sledge-instant-search__result-filter-minmax-field",children:Ae[0]||(null==a?void 0:a.min)}),t.jsx("div",{className:"sledge-instant-search__result-filter-minmax-field",children:Ae[1]||(null==a?void 0:a.max)})]})]}):"checkbox"===d.toLowerCase()&&(null==a?void 0:a.length)?r=t.jsx(t.Fragment,{children:null==a?void 0:a.map(((e,i)=>{var s;return t.jsx("li",{children:t.jsx(it,{id:`${l}_${i}`,name:l,value:e.value,label:`${e.name}${void 0!==e.total&&o?` (${e.total})`:""}`,onClick:e=>ht(l,e.currentTarget.value),defaultChecked:he&&(null==(s=he[l])?void 0:s.includes(e.value)),labelStyle:nt})},i)}))}):"radio"===d.toLowerCase()&&(null==a?void 0:a.length)?r=t.jsx("li",{children:t.jsx(at,{id:l,name:l,onValueChange:e=>ht(l,e,!0),items:null==a?void 0:a.map((e=>{const{name:t,value:i,total:s}=e;return{label:`${t} ${void 0!==s&&o?` (${s})`:""}`,value:i}})),defaultValue:he&&(null==(s=he[l])?void 0:s.length)?he[l][0]:"",labelStyle:nt})}):"select"===d.toLowerCase()&&(null==a?void 0:a.length)?r=t.jsx("li",{children:t.jsx(gt,{placeholder:`Select ${n}`,name:l,onValueChange:e=>ht(l,e,!0),items:null==a?void 0:a.map((e=>{const{name:t,value:i,total:s}=e;return{label:`${t} ${void 0!==s&&o?` (${s})`:""}`,value:i}})),labelStyle:nt})}):"swatch"===d.toLowerCase()&&(null==a?void 0:a.length)&&(r=t.jsx(t.Fragment,{children:null==a?void 0:a.map(((e,i)=>{var s;let n=(null==I?void 0:I.filter((({name:t})=>null==t?void 0:t.includes(e.value)))[0])||{};return t.jsx("li",{children:t.jsx(ct,{id:`${l}_${i}`,name:l,value:e.value,rgb:null==n?void 0:n.rgb,image:null==n?void 0:n.image,onClick:e=>ht(l,e.currentTarget.value),defaultChecked:he&&(null==(s=he[l])?void 0:s.includes(e.value))})},i)}))})),r},xt=Ee.map(((e,i)=>{const{value:s,label:l,display:n}=e;let d=ue===s,r=E[s],a=Boolean("slider"===n.toLowerCase()?r:null==r?void 0:r.length),o=["select"].includes(n.toLowerCase())&&(null==r?void 0:r.length),c=["sledge-instant-search__result-filter-item-list"],u=wt(e);return"swatch"===n.toLowerCase()&&(null==r?void 0:r.length)&&c.push("sledge-instant-search__result-filter-item-color-swatches"),a?t.jsxs("div",{className:"sledge-instant-search__result-filter-item",children:[t.jsxs("div",{className:"sledge-instant-search__result-filter-item-title",onClick:()=>ot(s),children:[t.jsx("span",{className:"sledge-instant-search__result-filter-title",style:st,children:l}),t.jsx(Q.div,{initial:!1,animate:d?"open":"closed",variants:Jt,children:t.jsx(mt,{width:15,height:15,color:"#000000"})})]}),d&&t.jsx("ul",{className:c.join(" "),children:o?u:Re?null:u})]},i):null})),ft=Ee.map(((e,i)=>{const{value:s,label:l,display:n}=e;let d=ue===s,r=E[s],a=Boolean("slider"===n.toLowerCase()?r:null==r?void 0:r.length),o=["radio","select"].includes(n.toLowerCase())&&(null==r?void 0:r.length),c=["sledge-instant-search__result-filter-item-list"],u=wt(e);return"swatch"===n.toLowerCase()&&(null==r?void 0:r.length)&&c.push("sledge-instant-search__result-filter-item-color-swatches"),a?t.jsx("div",{className:"",children:t.jsx(Xe,{trigger:t.jsxs(Lt,{type:"button",onClick:()=>ot(s),children:[l,t.jsx(Q.div,{initial:"closed",animate:d?"open":"closed",variants:Jt,className:"sort-trigger-icon",children:t.jsx(mt,{width:20,height:20,color:"#000000"})})]}),content:t.jsx("div",{className:"sledge-instant-search__result-filter-horizontal-facet",children:d&&t.jsx("ul",{className:c.join(" "),children:o?u:Re?null:u})}),withOpenState:!1,setIsOpen:e=>ge(e?s:""),hideCloseIcon:!0,align:"center",className:"sledge-instant-search__filter-horizontal-facet-content",customArrow:'<svg style="transform: rotate(180deg); margin-bottom: 3px; stroke-dasharray: 0,0,36;" width="44" height="12" viewBox="0 0 44 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23.2222 1.99825e-06C23.2222 11.9998 4.88979 11.9999 0.000354767 12L23.2222 12L44 12C23.2222 12 23.2222 1.99825e-06 23.2222 1.99825e-06Z" fill="white" stroke="#393d4e" stroke-width="1px" /></svg>'})},i):null}));let jt=[];Object.entries(he).map((e=>{var t,i;if((null==e?void 0:e.length)&&e[1].length){let s=e[0];if(["variants.inventory_quantity"].includes(s))return;let l=["variants.price"].includes(s),n=Ee.filter((({value:e})=>null==e?void 0:e.includes(s))),d=(null==n?void 0:n.length)?n[0].label:s;return Array.isArray(e[1])&&(null==(t=e[1])?void 0:t.length)>1?l?jt.push({label:d,name:s,value:e[1]}):null==(i=e[1])?void 0:i.map((e=>{jt.push({label:d,name:s,value:e})})):jt.push({label:d,name:s,value:e[1][0]})}}));const Ct=t.jsx(dt,{currentPage:je,totalPage:ye,totalResult:Ne,onChange:e=>(e=>{Ce(e)})(e)});return t.jsxs(t.Fragment,{children:[(null==(a=null==R?void 0:R.filter)?void 0:a.enable_on_search)&&"horizontal"===(null==(o=null==R?void 0:R.filter)?void 0:o.layout)?t.jsx(t.Fragment,{children:K?H:t.jsx(t.Fragment,{children:N?t.jsx("div",{className:"sledge-instant-search__result-filter-horizontal-loading",children:H}):ft.every((e=>!e))?null:t.jsxs("div",{className:"sledge-instant-search__result-filter-horizontal-wrapper",children:[t.jsx("div",{className:"sledge-instant-search__result-filter-horizontal",children:ft}),Boolean((null==jt?void 0:jt.length)&&(null==(c=null==R?void 0:R.filter)?void 0:c.show_refine_by_block))?t.jsx(t.Fragment,{children:Boolean(jt.every((e=>!e)))?null:t.jsxs("div",{className:"sledge-instant-search__result-filter-horizontal",children:[t.jsx("div",{className:"sledge-instant-search__result-filter-horizontal-refine-item sledge-instant-search__result-filter-horizontal-refine-item-clear-all",onClick:ut,children:"Clear All"}),jt.map(((e,t)=>{const{label:i,name:s,value:l}=e;return vt({label:i,name:s,value:l,index:t})}))]})}):null]})})}):null,t.jsx("div",{className:"sledge-instant-search__result-wrapper","data-filter-layout":null==(u=null==R?void 0:R.filter)?void 0:u.layout,children:t.jsxs(t.Fragment,{children:[(null==(g=null==R?void 0:R.filter)?void 0:g.enable_on_search)&&"vertical"===(null==(h=null==R?void 0:R.filter)?void 0:h.layout)?K?t.jsx("div",{className:"sledge-instant-search__result-filter",children:U}):xt.every((e=>!e))?null:t.jsx("div",{className:"sledge-instant-search__result-filter",children:N?U:t.jsxs(t.Fragment,{children:[Boolean((null==jt?void 0:jt.length)&&(null==(p=null==R?void 0:R.filter)?void 0:p.show_refine_by_block))?Boolean(jt.every((e=>!e)))?null:t.jsxs("div",{className:"sledge-instant-search__result-filter-item",children:[t.jsxs("div",{className:"sledge-instant-search__result-filter-item-title-refine",children:[t.jsx("strong",{className:"sledge-instant-search__result-filter-item-title-refine-heading",children:"Filter"}),t.jsx("span",{className:"sledge-instant-search__result-filter-item-title-refine-clear",onClick:ut,children:"Clear All"})]}),t.jsx("div",{className:"sledge-instant-search__result-filter-item-refine-selected-flex",children:jt.map(((e,t)=>{const{label:i,name:s,value:l}=e;return vt({label:i,name:s,value:l,index:t})}))})]}):null,xt]})}):null,t.jsxs("div",{className:"sledge-instant-search__result-data",children:[K?G:t.jsxs("div",{className:"sledge-instant-search__result-data-keyword",children:["horizontal"===(null==(m=null==R?void 0:R.filter)?void 0:m.layout)&&t.jsx("div",{className:"sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-horizontal",children:Oe}),t.jsx(Tt,{type:"text",icon:t.jsx(St,{width:18,height:18,color:"#868686"}),placeholder:"Search products...",value:y,onChange:({value:e})=>_t(e),onResetField:()=>_t(""),className:"sledge-instant-search__result-data-keyword-form",withClearField:!0}),t.jsxs("div",{className:"sledge-instant-search__result-data-summary-item sledge-instant-search__result-data-summary-select-field",children:[t.jsxs("div",{className:"sledge-instant-search__result-data-summary-select-field-item",children:[t.jsx("span",{children:"Sort by:"}),L&&Boolean(null==L?void 0:L.length)&&t.jsx(bt,{align:"end",prefixLabel:t.jsx("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M12.6296 4.34737C12.9144 4.34737 13.1497 4.55898 13.1869 4.83354L13.1921 4.90987L13.192 13.7599L15.2892 11.6543C15.5083 11.4341 15.8645 11.4333 16.0847 11.6525C16.2848 11.8517 16.3037 12.1641 16.1408 12.3847L16.0865 12.4479L13.0282 15.5204C13.0097 15.5386 12.991 15.555 12.9712 15.5701L13.0282 15.5204C13.0006 15.5482 12.9708 15.5724 12.9394 15.5932C12.9285 15.6 12.9171 15.607 12.9055 15.6135C12.8946 15.62 12.8837 15.6258 12.8725 15.6311C12.8615 15.6359 12.8504 15.6408 12.8391 15.6454C12.8247 15.6515 12.8099 15.6568 12.795 15.6613C12.7862 15.6637 12.7772 15.6662 12.7681 15.6685C12.7519 15.673 12.7357 15.6763 12.7193 15.6789C12.7116 15.6798 12.7036 15.6809 12.6955 15.6819C12.677 15.6844 12.6587 15.6857 12.6404 15.686C12.6368 15.6857 12.6332 15.6857 12.6296 15.6857L12.6186 15.686C12.6003 15.6857 12.582 15.6844 12.5637 15.6823L12.6296 15.6857C12.5989 15.6857 12.5689 15.6833 12.5396 15.6785C12.5233 15.6763 12.5071 15.673 12.4909 15.6689C12.4824 15.6663 12.4738 15.6639 12.4654 15.6614C12.4493 15.6569 12.4332 15.6512 12.4174 15.6448C12.4088 15.6408 12.4005 15.6372 12.3922 15.6333C12.3793 15.6278 12.3663 15.6211 12.3535 15.6139C12.342 15.6069 12.3307 15.6 12.3196 15.5926C12.3109 15.5875 12.3024 15.5815 12.294 15.5752L12.288 15.5701C12.2682 15.555 12.2494 15.5386 12.2318 15.5209L12.2308 15.5204L9.1725 12.4479C8.95334 12.2278 8.95416 11.8716 9.17434 11.6525C9.3745 11.4532 9.68704 11.4358 9.90687 11.5997L9.96983 11.6543L12.067 13.7614L12.0671 4.90987C12.0671 4.59921 12.3189 4.34737 12.6296 4.34737ZM5.18325 2.3122L5.19421 2.31189C5.21254 2.31224 5.23085 2.31348 5.24908 2.31562L5.18325 2.3122C5.21389 2.3122 5.24396 2.31465 5.27328 2.31937C5.28931 2.32156 5.3054 2.32487 5.32136 2.32889C5.33074 2.33164 5.3403 2.33433 5.34975 2.33725C5.36452 2.34142 5.37882 2.34648 5.39293 2.35213C5.40313 2.35668 5.41346 2.36119 5.42362 2.366C5.4357 2.37123 5.4476 2.37737 5.45931 2.38397C5.46933 2.39014 5.47926 2.39616 5.48898 2.40246C5.49898 2.40841 5.50899 2.41537 5.51882 2.42269L5.582 2.47746L8.64033 5.54996C8.85949 5.77013 8.85867 6.12629 8.63849 6.34545C8.43833 6.54469 8.12579 6.56212 7.90596 6.39822L7.843 6.34361L5.74525 4.23564L5.74575 13.088C5.74575 13.3987 5.49391 13.6505 5.18325 13.6505C4.89848 13.6505 4.66313 13.4389 4.62588 13.1644L4.62075 13.088L4.62025 4.23639L2.52367 6.34361C2.32443 6.54377 2.01197 6.56265 1.79139 6.39977L1.72817 6.34545C1.52801 6.14621 1.50914 5.83376 1.67202 5.61317L1.72633 5.54996L4.78467 2.47746L4.81779 2.44709C4.82557 2.44043 4.83353 2.43399 4.84167 2.42776L4.78467 2.47746C4.81226 2.44974 4.84202 2.42549 4.87341 2.40473C4.88436 2.39791 4.89574 2.39094 4.90738 2.38438C4.91819 2.37787 4.92917 2.37215 4.9403 2.36682C4.95128 2.36196 4.96242 2.35706 4.97375 2.35251C4.98814 2.34636 5.00289 2.34115 5.0178 2.33657C5.02687 2.33414 5.03616 2.33154 5.04555 2.32918C5.06066 2.32503 5.07593 2.32186 5.09129 2.31932C5.10053 2.31817 5.10959 2.31691 5.11871 2.31586C5.13607 2.31348 5.15388 2.31227 5.17171 2.3119C5.17564 2.31224 5.17944 2.3122 5.18325 2.3122Z",fill:"black"})}),options:L.map((e=>{const{label:t,value:i}=e;return{label:t,value:i}})),value:ne,onChange:({label:e,value:t})=>((e,t)=>{ie(!1),ae(e),de(t)})(e,t)})]}),t.jsxs("div",{className:"sledge-instant-search__result-data-summary-select-field-item",children:[t.jsx("span",{children:"Limit:"}),(null==(_=null==R?void 0:R.search)?void 0:_.allowed_limit)&&Boolean(null==(w=null==(v=null==R?void 0:R.search)?void 0:v.allowed_limit)?void 0:w.length)&&t.jsx(bt,{align:"end",options:R.search.allowed_limit.map((e=>({label:e,value:e}))),value:oe,onChange:({value:e})=>(e=>{le(!1),ce(e)})(e)})]})]})]}),X?t.jsxs(t.Fragment,{children:[F,(null==ve?void 0:ve.length)?Ct:null]}):t.jsxs(t.Fragment,{children:["vertical"===(null==(x=null==R?void 0:R.filter)?void 0:x.layout)&&t.jsx("div",{className:"sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-vertical",children:Oe}),(null==ve?void 0:ve.length)?t.jsxs(t.Fragment,{children:[t.jsx(Os,{sourceApp:"instant-search",type:"large",data:ve.map((e=>{const{variants:t,...i}=e||{};return{product:i,variants:t}})),setting:{show_vendor:null==(f=null==R?void 0:R.search)?void 0:f.show_vendor,show_sku:null==(j=null==R?void 0:R.search)?void 0:j.show_sku,show_price:null==(C=null==R?void 0:R.search)?void 0:C.show_price},isComponentJsVersion:M,cards:W,showOptionOutOfStock:!0,onAfterAddToCart:$,onAfterAddWishlist:V,onAfterRemoveWishlist:q,onAfterRenderProduct:z}),Ct]}):t.jsx(Di,{})]})]})]})})]})},ki=i=>{var s,l,n,d;const{keyword:r,clickedTabIndexId:a,clickedTabIndexName:o,setKeyword:c}=i||{},[u,g]=e.useState(!0),[h,p]=e.useState(!0),[m,_]=e.useState(""),[v,w]=e.useState([]),[x,f]=e.useState(0),[j,C]=e.useState(1),[y,S]=e.useState(0),[N,L]=e.useState(0),[A,T]=e.useState(null),E=Ut({keyword:r}),b=async()=>{if(!a)return;let e;p(!0);let i={q:r,sort:m?[m]:[],page:j,hitsPerPage:12};e=await fi(a,i),(e=>{if(!e)return;const{hits:i,processingTimeMs:s,totalHits:l,totalPages:n}=e;g(!1),p(!1),w(i),f(s||0),S(n),L(l||0),T(t.jsx("div",{className:"sledge-instant-search__result-data-summary-item",children:t.jsxs("span",{className:"sledge-instant-search__result-data-summary-text",children:[l," result"," ",(null==r?void 0:r.length)?t.jsxs(t.Fragment,{children:["for ",t.jsxs("span",{className:"sledge-instant-search__result-data-summary-text-keyword",children:['"',r,'"']})]}):null]})}))})(e)};e.useEffect((()=>{if(Boolean(E&&(null==E?void 0:E.keyword)!==r)){const e=setTimeout((()=>{b()}),500);return()=>clearTimeout(e)}b()}),[m,r,j,a]);const R=t.jsx("div",{className:"sledge-instant-search__result-data-keyword sledge-instant-search__result-data-keyword-category",children:t.jsx(Tt,{type:"text",icon:t.jsx(St,{width:18,height:18,color:"#868686"}),placeholder:`Search ${o?o.toLowerCase():""}...`,value:r,onChange:({value:e})=>c&&c(e),onResetField:()=>c&&c(""),className:"sledge-instant-search__result-data-keyword-form",withClearField:!0})}),I=t.jsx("div",{className:"sledge-instant-search__result-data-summary",children:t.jsx(tl.Item,{width:"117px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"18s"})}),O=(null==(s=String(a))?void 0:s.includes("collection"))?t.jsx(tl.CollectionGrid,{count:3}):(null==(l=String(a))?void 0:l.includes("page"))?t.jsx(tl.PageGrid,{count:12}):(null==(n=String(a))?void 0:n.includes("blog"))||(null==(d=String(a))?void 0:d.includes("article"))?t.jsx(tl.BlogGrid,{count:12}):null,P=()=>t.jsxs("div",{className:"sledge-instant-search__result-data-category-wrapper",children:[R,I,O]}),k=()=>t.jsxs(t.Fragment,{children:[R,I,O]}),D=e=>{var i,s,l,n;return(null==(i=String(a))?void 0:i.includes("collection"))?t.jsx(Bs,{...e}):(null==(s=String(a))?void 0:s.includes("page"))?t.jsx(Us,{...e}):(null==(l=String(a))?void 0:l.includes("blog"))||(null==(n=String(a))?void 0:n.includes("article"))?t.jsx(Gs,{...e}):null};return t.jsx("div",{className:"sledge-instant-search__result-wrapper",children:u?t.jsx(P,{}):t.jsx("div",{className:"sledge-instant-search__result-data-category-wrapper",children:h?t.jsx(k,{}):t.jsxs(t.Fragment,{children:[R,t.jsx("div",{className:"sledge-instant-search__result-data-summary",children:A}),(null==v?void 0:v.length)?t.jsxs(t.Fragment,{children:[t.jsx(D,{data:v.map((e=>{const{id:t,title:i,url:s}=e;return{id:t,title:i,description:`${i}${o?` ${o.toLowerCase()}`:""}`,url:s,image:""}}))}),t.jsx(dt,{currentPage:j,totalPage:y,totalResult:N,onChange:e=>(e=>{C(e)})(e)})]}):t.jsx(Di,{})]})})})},Di=i=>{const[s,l]=e.useState(""),[n,d]=e.useState("");return e.useEffect((()=>{l("No results found"),d("Your search did not match any results. <br/> Please try again")}),[]),t.jsxs("div",{className:"sledge-instant-search__result-empty",children:[t.jsx("div",{className:"sledge-instant-search__result-empty-title",dangerouslySetInnerHTML:{__html:s}}),t.jsx("div",{className:"sledge-instant-search__result-empty-description",dangerouslySetInnerHTML:{__html:n}})]})},Mi=()=>{let i=document.querySelector(Re.INSTANT_SEARCH.ELEMENT_SEARCH_RESULT_WIDGET);je(i,(()=>{var s,l,n,d;if(i){const r=i.getAttribute(Te.INSTANT_SEARCH.QUERY_KEYWORD),a=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_TO_CART),o=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),u=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST),g=i.getAttribute(Te.GLOBAL.ON_AFTER_RENDER_PRODUCT),h=null==(s=i.querySelector(Re.GLOBAL.ELEMENT_PRODUCT_CARDS))?void 0:s.getAttribute(Te.GLOBAL.RENDER_COMPONENT);null==(l=i.querySelector(Re.GLOBAL.ELEMENT_SUGGESTION_KEYWORD_LISTS))||l.getAttribute(Te.GLOBAL.RENDER_COMPONENT),null==(n=i.querySelector(Re.GLOBAL.ELEMENT_OTHER_INDEX_LISTS))||n.getAttribute(Te.GLOBAL.RENDER_COMPONENT),null==(d=i.querySelector(Re.GLOBAL.ELEMENT_SEARCH_VIEW_MORE_RESULT))||d.getAttribute(Te.GLOBAL.RENDER_COMPONENT),i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(Oi,{query:{keyword:r||""},onAfterAddToCart:e=>{i&&a&&eval(a)({element:i,state:e})},onAfterAddWishlist:e=>{i&&o&&eval(o)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&u&&eval(u)({element:i,state:e})},onAfterRenderProduct:e=>{i&&g&&eval(g)({element:i,state:e})},children:t.jsx(Gi,{component:h?eval(h):null,isJsVersion:!0})})})}))}}))},Wi="",Bi=i=>{var s,l,n,d,r,a,o,c,u,g,h,p,m,_,v,w,x,f,j,C,y;const{width:S="400px",children:N,onAfterAddToCart:L,onAfterAddWishlist:A,onAfterRemoveWishlist:T,onAfterRenderProduct:E}=i;let b=null,R=null,I=null,O=null,P=!1;e.Children.map(N,(t=>{if(e.isValidElement(t)&&ye(t.type)){const{component:e,isJsVersion:i}=(null==t?void 0:t.props)||{};switch(P=i,t.type.name){case ke.PRODUCT.CARDS:b=e;break;case ke.SUGGESTION_KEYWORD_LISTS:R=e;break;case ke.OTHER_INDEX_LISTS:I=e;break;case ke.SEARCH_VIEW_MORE_RESULT:O=e}}}));const{isRenderApp:k}=e.useContext(Fi),[D,M]=e.useState(!0),[W,B]=e.useState(""),[H,U]=e.useState(""),[F,G]=e.useState([]),[$,V]=e.useState([]),[q,z]=e.useState([]),[J,Z]=e.useState([]),[K,Y]=e.useState({}),[X,ee]=e.useState({}),[te,ie]=e.useState(""),se=Ut({keyword:W}),le=async(e,t=!1)=>{var i,s,l,n,d,r,a,o,c,u,g;if(!W.length)return;M(!0);const{tabs:h,suffix_index_product:p,hidden_tags:m,display:_}=e,v=(null==(i=null==_?void 0:_.search)?void 0:i.suggestion)||{};let w,x={queries:h.map((e=>{var t;const{index:i}=e;let s=i.includes(p),l=[];return(null==m?void 0:m.length)&&l.push(`tags NOT IN [${m}]`),(null==(t=null==_?void 0:_.filter)?void 0:t.show_out_of_stock)||l.push("variants.inventory_quantity > 0"),{indexUid:i,q:W,hitsPerPage:s?6:4,filter:s?l.join(" AND "):""}}))};if(w=await ji(x),!w)return;const{results:f}=w;let j=null==f?void 0:f.filter((({indexUid:e})=>null==e?void 0:e.includes(p)));t&&(null==W?void 0:W.length)&&Ci({keyword:W,resultCount:(null==(s=j[0])?void 0:s.totalHits)||0});let C=(null==(l=null==f?void 0:f.filter((({indexUid:e})=>!(null==e?void 0:e.includes(p)))))?void 0:l.map((e=>{const{indexUid:t}=e,{name:i}=null==h?void 0:h.find((({index:e})=>e.includes(t)));return{...e,name:i||""}})))||[],y=(null==j?void 0:j.length)?null==(n=j[0])?void 0:n.hits:[],S=W.length?(null==y?void 0:y.length)?"":"no_result":"zero_character",N=Boolean(!W.length&&Object.keys(v).length&&(null==(r=null==(d=v[S])?void 0:d.products)?void 0:r.active)&&(null==(c=null==(o=null==(a=v[S])?void 0:a.products)?void 0:o.list)?void 0:c.length));G(N?null==(g=null==(u=v[S])?void 0:u.products)?void 0:g.list:y),V(C),ie(S),M(!1)};e.useEffect((()=>{(null==k?void 0:k.instantSearch)&&(async e=>{var t;if(!W.length)return;let i,s=!1;if(i=JSON.parse(e),!i)return;const{status:l,data:n}=i,{code:d}=l,{tabs:r,suffix_index_product:a,hidden_tags:o,display:c}=n;s=200===d||!1,s&&(z(r),U(a),Z(o),Y(c),ee(null==(t=null==c?void 0:c.search)?void 0:t.suggestion),await le(n))})(localStorage.getItem(Ee.INSTANT_SEARCH_SETTING)||"")}),[W]),e.useEffect((()=>{if(Boolean(se&&(null==se?void 0:se.keyword)!==W)){const e=setTimeout((()=>{le({tabs:q,suffix_index_product:H,hidden_tags:J,display:K},!0)}),500);return()=>clearTimeout(e)}}),[W]);const ne={maxWidth:S};return t.jsxs("div",{className:"sledge-instant-search__widget-search-form-wrapper",style:ne,children:[t.jsx(Tt,{type:"text",icon:t.jsx(St,{width:18,height:18,color:"#868686"}),placeholder:"Search anything",value:W,onChange:({value:e})=>B(e),onResetField:()=>B(""),withClearField:!0}),t.jsx(Q.div,{initial:"hidden",animate:W.length?"visible":"hidden",variants:Zt,className:"sledge-instant-search__widget-search-form-result",children:D?t.jsx(zs,{children:t.jsxs("div",{className:"sledge-instant-search__widget-search-form-result-flex",children:[t.jsx("div",{className:"sledge-instant-search__widget-search-form-result-flex-item-other sledge-instant-search__widget-search-form-result-flex-item-other-skeleton",children:[0,1,2].map((i=>t.jsxs(e.Fragment,{children:[t.jsx(tl.Item,{width:"100%",height:"42px",color:"grey-100",rounded:"md",...Boolean(i)&&{style:{marginTop:"12px"}}}),t.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"12px",marginTop:"12px"},children:[1,2,3].map((e=>t.jsx(tl.Item,{width:"100%",height:"28px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{maxWidth:"140px"}},e)))})]},i)))}),t.jsx("div",{className:"sledge-instant-search__widget-search-form-result-flex-item-product",children:t.jsx(tl.ProductGrid,{count:6,type:"small"})})]})}):t.jsx(zs,{isLoading:D,withCorner:!1,children:t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sledge-instant-search__widget-search-form-result-flex",children:[t.jsxs("div",{className:"sledge-instant-search__widget-search-form-result-flex-item-other",children:[Object.keys(X).length&&(null==(l=null==(s=X[te])?void 0:s.keywords)?void 0:l.active)&&(null==(r=null==(d=null==(n=X[te])?void 0:n.keywords)?void 0:d.list)?void 0:r.length)?t.jsx(Ti.SuggestionKeywordLists,{listsComponent:R,keywords:X[te].keywords.list,isComponentJsVersion:P}):null,$.map(((i,s)=>{const{hits:l,name:n}=i;return t.jsx(e.Fragment,{children:t.jsx(Ti.OtherIndexLists,{listsComponent:I,name:n,items:l,isComponentJsVersion:P})},s)}))]}),t.jsxs("div",{className:"sledge-instant-search__widget-search-form-result-flex-item-product",children:[t.jsx("div",{className:"sledge-instant-search__widget-search-form-result-title-product",children:"Products"}),(null==F?void 0:F.length)?t.jsx("div",{className:"sledge-instant-search__widget-search-form-result-product",children:t.jsx(Os,{sourceApp:"instant-search",type:"small",data:F.map((e=>{const{variants:t,...i}=e||{};return{product:i,variants:t}})),setting:{show_vendor:null==(a=null==K?void 0:K.search)?void 0:a.show_vendor,show_sku:null==(o=null==K?void 0:K.search)?void 0:o.show_sku,show_price:null==(c=null==K?void 0:K.search)?void 0:c.show_price},showOptionOutOfStock:!0,isComponentJsVersion:P,cards:b,onAfterAddToCart:L,onAfterAddWishlist:A,onAfterRemoveWishlist:T,onAfterRenderProduct:E})}):Object.keys(X).length&&(null==(g=null==(u=X[te])?void 0:u.products)?void 0:g.active)&&(null==(m=null==(p=null==(h=X[te])?void 0:h.products)?void 0:p.list)?void 0:m.length)?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sledge-instant-search__widget-search-form-result-product-suggestion-no-result-text",children:[t.jsx("span",{children:"Sorry, nothing found for"})," ",t.jsx("strong",{children:W}),". ",t.jsx("span",{children:"Did you mean:"})]}),t.jsx(Os,{sourceApp:"instant-search",type:"small",data:X[te].products.list.map((e=>{const{variants:t,...i}=e||{};return{product:i,variants:t}})),setting:{show_vendor:null==(_=null==K?void 0:K.search)?void 0:_.show_vendor,show_sku:null==(v=null==K?void 0:K.search)?void 0:v.show_sku,show_price:null==(w=null==K?void 0:K.search)?void 0:w.show_price},showOptionOutOfStock:!0,isComponentJsVersion:P,cards:b,onAfterAddToCart:L,onAfterAddWishlist:A,onAfterRemoveWishlist:T,onAfterRenderProduct:E})]}):t.jsx("div",{className:"sledge-instant-search__widget-search-form-result-product-disabled",children:"No product were found"})]})]}),(null==F?void 0:F.length)||Object.keys(X).length&&(null==(f=null==(x=X[te])?void 0:x.products)?void 0:f.active)&&(null==(y=null==(C=null==(j=X[te])?void 0:j.products)?void 0:C.list)?void 0:y.length)?t.jsx("div",{className:"sledge-instant-search__widget-button-more-wrapper",children:t.jsx(Ti.SearchViewMoreResult,{component:O,keyword:W,isComponentJsVersion:P})}):null]})})})]})},Hi=()=>{let i=document.querySelector(Re.INSTANT_SEARCH.ELEMENT_SEARCH_WIDGET);je(i,(()=>{var s,l,n,d;if(i){const r=i.getAttribute(Te.GLOBAL.WIDTH_ELEMENT),a=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_TO_CART),o=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),u=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST),g=i.getAttribute(Te.GLOBAL.ON_AFTER_RENDER_PRODUCT),h=null==(s=i.querySelector(Re.GLOBAL.ELEMENT_PRODUCT_CARDS))?void 0:s.getAttribute(Te.GLOBAL.RENDER_COMPONENT),p=null==(l=i.querySelector(Re.GLOBAL.ELEMENT_SUGGESTION_KEYWORD_LISTS))?void 0:l.getAttribute(Te.GLOBAL.RENDER_COMPONENT),m=null==(n=i.querySelector(Re.GLOBAL.ELEMENT_OTHER_INDEX_LISTS))?void 0:n.getAttribute(Te.GLOBAL.RENDER_COMPONENT),_=null==(d=i.querySelector(Re.GLOBAL.ELEMENT_SEARCH_VIEW_MORE_RESULT))?void 0:d.getAttribute(Te.GLOBAL.RENDER_COMPONENT);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsxs(Bi,{width:r||"",onAfterAddToCart:e=>{i&&a&&eval(a)({element:i,state:e})},onAfterAddWishlist:e=>{i&&o&&eval(o)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&u&&eval(u)({element:i,state:e})},onAfterRenderProduct:e=>{i&&g&&eval(g)({element:i,state:e})},children:[t.jsx(Vi,{component:p?eval(p):null,isJsVersion:!0}),t.jsx($i,{component:m?eval(m):null,isJsVersion:!0}),t.jsx(Gi,{component:h?eval(h):null,isJsVersion:!0}),t.jsx(qi,{component:_?eval(_):null,isJsVersion:!0})]})})}))}}))},Ui=()=>{mi(),Mi(),bi(),Ri(),Hi()},Fi=e.createContext({apiKey:"",instantSearchApiKey:"",userId:"",userEmail:"",userFullname:"",isRenderApp:{wishlist:!1,productReview:!1,instantSearch:!1},triggerRenderMultipleComponent:{wishlist:{badge:{trigger:()=>{},value:!1}}},sledgeAnonymId:""}),Gi=({component:e})=>null,$i=({component:e})=>null,Vi=({component:e})=>null,qi=({component:e})=>null,zi=i=>{var s,l;const{sledgeAnonymId:n}=e.useContext(Fi),{isFirstLoading:d,isLoading:r,totalWishlist:a,isMaximizeTotalWishlist:o,proxyUrl:c,position:u="left",dataSettings:g}=i||{},{is_required_login:h}=(null==(s=null==g?void 0:g.display)?void 0:s.global)||{},{type:p}=(null==(l=null==g?void 0:g.display)?void 0:l.widget)||{},[m,_]=e.useState(!1);e.useEffect((()=>{_(n&&h)}),[n]);return t.jsx("div",{className:`sledge-wishlist__badge-floating sledge-wishlist__badge-floating-${u}`,children:t.jsxs("span",{onClick:e=>{e.preventDefault(),e.stopPropagation(),m?"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}):("popup_window"===p&&"undefined"!=typeof window&&window.sledgeWishlistWidgetPopup&&window.sledgeWishlistWidgetPopup(),window.location.href="popup_window"===p?"#":c||"/")},className:"sledge-wishlist__badge-floating-icon-link",children:[t.jsx("span",{className:"sledge-wishlist__badge-floating-text",children:"My Wishlist"}),t.jsxs("span",{className:"sledge-wishlist__badge-icon",children:[t.jsx(pt,{width:18,height:18,type:"fill",color:"#000000"}),!d&&t.jsx("span",{className:"sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right "+(o?"sledge-wishlist__badge-fit-content":""),children:r||m?0:`${o?"99+":a}`||0})]})]})})},Ji=i=>{var s,l;const{sledgeAnonymId:n}=e.useContext(Fi),{isFirstLoading:d,isLoading:r,totalWishlist:a,isMaximizeTotalWishlist:o,proxyUrl:c,position:u="bottom-right",dataSettings:g}=i||{},{is_required_login:h}=(null==(s=null==g?void 0:g.display)?void 0:s.global)||{},{type:p}=(null==(l=null==g?void 0:g.display)?void 0:l.widget)||{},[m,_]=e.useState(!1);e.useEffect((()=>{_(n&&h)}),[n]);return t.jsx("div",{className:`sledge-wishlist__badge-floating-icon sledge-wishlist__badge-floating-${u}`,children:t.jsx("span",{onClick:e=>{e.preventDefault(),e.stopPropagation(),m?"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}):("popup_window"===p&&"undefined"!=typeof window&&window.sledgeWishlistWidgetPopup&&window.sledgeWishlistWidgetPopup(),window.location.href="popup_window"===p?"#":c||"/")},className:"sledge-wishlist__badge-floating-icon-link",children:t.jsxs("span",{className:"sledge-wishlist__badge-icon",children:[t.jsx(pt,{width:27.01,height:25.73,type:"outline",color:"#000000"}),!d&&t.jsx("span",{className:"sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right "+(o?"sledge-wishlist__badge-fit-content":""),children:r||m?0:`${o?"99+":a}`||0})]})})})},Zi=i=>{var s,l;const{sledgeAnonymId:n}=e.useContext(Fi),{isFirstLoading:d,isLoading:r,totalWishlist:a,isMaximizeTotalWishlist:o,proxyUrl:c,dataSettings:u}=i||{},{is_required_login:g}=(null==(s=null==u?void 0:u.display)?void 0:s.global)||{},{type:h}=(null==(l=null==u?void 0:u.display)?void 0:l.widget)||{},p="#000000",[m,_]=e.useState(p),[v,w]=e.useState(!1);e.useEffect((()=>{w(n&&g)}),[n]);return t.jsxs("span",{className:"sledge-wishlist__badge",onClick:e=>{e.preventDefault(),e.stopPropagation(),v?"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}):("popup_window"===h&&"undefined"!=typeof window&&window.sledgeWishlistWidgetPopup&&window.sledgeWishlistWidgetPopup(),window.location.href="popup_window"===h?"#":c||"/")},onMouseEnter:()=>_("#F85538"),onMouseLeave:()=>_(p),children:[t.jsx(pt,{width:20,height:20,type:"outline",color:m}),!d&&t.jsx("span",{className:"sledge-wishlist__badge-counter sledge-wishlist__badge-counter-header-menu "+(o?"sledge-wishlist__badge-fit-content":""),children:r||v?0:`${o?"99+":a}`||0})]})},Ki=async e=>{const{page:t,limit:i,sort:s,keyword:l,shareId:n}=e||{};let d=localStorage.getItem(Ee.AUTH_APP),r="?"+new URLSearchParams({page:t||"",limit:i||"",sort:s||"",keyword:l||"",share_id:n||""}).toString();var a=new Headers;a.append("Authorization",`Bearer ${d}`);var o={method:"GET",headers:a,redirect:"follow"};return await fetch(`${Se}/wishlist${r}`,o).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Yi=async e=>{const{productId:t,productVariantId:i,productName:s,productVendor:l,productSku:n,productVariantName:d,productLink:r,productImage:a,productCurrency:o,productPrice:c}=e;let u=localStorage.getItem(Ee.AUTH_APP);var g=new Headers;g.append("Authorization",`Bearer ${u}`),g.append("Content-Type","application/json");var h={method:"POST",headers:g,body:JSON.stringify({product:{id:xe(t),variant_id:xe(i),name:s,vendor:l,sku:n,variant_name:d,url:r,image_url:a,currency:o,price:c}}),redirect:"follow"};return await fetch(`${Se}/wishlist`,h).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Xi=async e=>{let t=localStorage.getItem(Ee.AUTH_APP);var i=new Headers;i.append("Authorization",`Bearer ${t}`),i.append("Content-Type","application/json");let s=e.map((e=>{const{productId:t,productVariantId:i,productName:s,productVariantName:l,productLink:n,productImage:d,productCurrency:r,productPrice:a}=e;return{id:xe(t),variant_id:xe(i),name:s,variant_name:l,url:n,image_url:d,currency:r,price:a}}));var l={method:"POST",headers:i,body:JSON.stringify({products:s}),redirect:"follow"};return await fetch(`${Se}/wishlist/bulk`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},Qi=async()=>{let e=localStorage.getItem(Ee.AUTH_APP);var t=new Headers;t.append("Authorization",`Bearer ${e}`);var i={method:"GET",headers:t,redirect:"follow"};return await fetch(`${Se}/wishlist/info`,i).then((e=>e.json())).then((e=>e)).catch((()=>{}))},es=async(e,t)=>{let i=xe(e),s=t?xe(t):"",l=localStorage.getItem(Ee.AUTH_APP),n="?"+new URLSearchParams({variant_id:s}).toString();var d=new Headers;d.append("Authorization",`Bearer ${l}`);var r={method:"GET",headers:d,redirect:"follow"};return await fetch(`${Se}/wishlist/check/${i}${n}`,r).then((e=>e.json())).then((e=>Boolean(e.data))).catch((()=>{}))},ts=async()=>{let e=localStorage.getItem(Ee.AUTH_APP);var t=new Headers;t.append("Authorization",`Bearer ${e}`);var i={method:"DELETE",headers:t,redirect:"follow"};return await fetch(`${Se}/wishlist/clear`,i).then((e=>e.json())).then((e=>e)).catch((()=>{}))},is=async e=>{const{productId:t}=e;let i=localStorage.getItem(Ee.AUTH_APP);var s=new Headers;s.append("Authorization",`Bearer ${i}`),s.append("Content-Type","application/json");var l={method:"POST",headers:s,body:JSON.stringify({product:{id:xe(t)}}),redirect:"follow"};return await fetch(`${Se}/wishlist/cart`,l).then((e=>e.json())).then((e=>e)).catch((()=>{}))},ss=i=>{const{children:s}=i,{isRenderApp:l,triggerRenderMultipleComponent:n}=e.useContext(Fi),[d,r]=e.useState(0),[a,o]=e.useState(!0),[c,u]=e.useState(!0),[g,h]=e.useState(!1),[p,m]=e.useState(""),[_,v]=e.useState({}),w=async()=>{var e,t,i;let s,l,n,d=!1;s=await Qi(),d=200===(null==(e=null==s?void 0:s.status)?void 0:e.code)||!1,l=(null==(t=null==s?void 0:s.data)?void 0:t.total_data)?s.data.total_data:0,n=(null==(i=null==s?void 0:s.data)?void 0:i.proxy_url)||"",d&&(r(l),h(l>99),m(n),o(!1),u(!1))};return e.useEffect((()=>{(null==l?void 0:l.wishlist)&&("undefined"!=typeof window&&(window.sledgeWishlistBadgeUpdate=()=>{w()}),(async e=>{let t,i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;i=200===n||!1,i&&(v(l),await w())})(localStorage.getItem(Ee.WISHLIST_SETTING)||""))}),[l,n]),t.jsx(t.Fragment,{children:e.Children.count(s)&&e.Children.map(s,(t=>e.cloneElement(t,{isFirstLoading:a,isLoading:c,totalWishlist:d,isMaximizeTotalWishlist:g,proxyUrl:p,dataSettings:_})))})},ls=i=>{var s,l;const{sledgeAnonymId:n}=e.useContext(Fi),{htmlElement:d,proxyUrl:r,dataSettings:a}=i||{},{is_required_login:o}=(null==(s=null==a?void 0:a.display)?void 0:s.global)||{},{type:c}=(null==(l=null==a?void 0:a.display)?void 0:l.widget)||{},[u,g]=e.useState(!1);e.useEffect((()=>{g(n&&o)}),[n]);return t.jsx("span",{onClick:e=>{e.preventDefault(),e.stopPropagation(),u?"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}):("popup_window"===c&&"undefined"!=typeof window&&window.sledgeWishlistWidgetPopup&&window.sledgeWishlistWidgetPopup(),window.location.href="popup_window"===c?"#":r||"/")},children:t.jsx("span",{dangerouslySetInnerHTML:{__html:d}})})},ns=({children:i})=>t.jsx(t.Fragment,{children:e.Children.count(i)&&e.Children.map(i,(t=>e.cloneElement(t,{})))});ns.Root=ss,ns.HeaderMenu=Zi,ns.FloatingFull=zi,ns.FloatingIcon=Ji,ns.MenuItem=ls;const ds=()=>{const i=JSON.parse(localStorage.getItem(Ee.WISHLIST_SETTING)||"");if(!i)return;const{data:s}=i,{type:l,floating_button_type:n}=(null==s?void 0:s.launch_point)||{};if("floating_button"===l)if("left"===n||"right"===n){let i=document.createElement("div");i.setAttribute(Ae,be.WISHLIST.ELEMENT_BADGE_FLOATING_FULL),document.body.appendChild(i),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(ns.Root,{children:t.jsx(ns.FloatingFull,{position:n})})})})))}else{let i=document.createElement("div");i.setAttribute(Ae,be.WISHLIST.ELEMENT_BADGE_FLOATING_ICON),document.body.appendChild(i),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(ns.Root,{children:t.jsx(ns.FloatingIcon,{position:n})})})})))}else if("header_menu"===l){let i=document.querySelector(Re.WISHLIST.ELEMENT_BADGE);je(i,(()=>{i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(ns.Root,{children:t.jsx(ns.HeaderMenu,{})})})})))}))}else{let i=document.querySelector(Re.WISHLIST.ELEMENT_BADGE_MENU_ITEM);je(i,(()=>{i&&c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(ns.Root,{children:t.jsx(ns.MenuItem,{htmlElement:i.innerHTML})})})}))}))}},rs="",as=i=>{var s,l,n,d,r;const{data:a,onAfterAddWishlist:o,onAfterRemoveWishlist:c}=i,{productId:u,productVariantId:g}=a||{},{isRenderApp:h,triggerRenderMultipleComponent:p,sledgeAnonymId:m}=e.useContext(Fi),[_,v]=e.useState(!0),[w,x]=e.useState(!0),[f,j]=e.useState(!1),[C,y]=e.useState({}),[S,N]=e.useState(!1),[L,A]=e.useState(!1),{is_required_login:T}=(null==(s=null==C?void 0:C.display)?void 0:s.global)||{},{type:E,icon:b,click_again_action:R,text_color:I,border_color:O,border_radius:P,padding_top:k,padding_bottom:D,padding_left:M,padding_right:W,background_color:B,font_size:H,font_weight:U,text_transform:F}=(null==(l=null==C?void 0:C.display)?void 0:l.button_detail)||{},{show:G,location:$}=(null==(n=null==C?void 0:C.display)?void 0:n.notification)||{},{before_adding_wishlist:V,after_adding_wishlist:q,remove_from_wishlist:z}=(null==(d=null==C?void 0:C.languages)?void 0:d.button_detail)||{},{title_added_to_wishlist:J,text_added_to_wishlist:Z,title_removed_to_wishlist:K,text_removed_to_wishlist:Y}=(null==(r=null==C?void 0:C.languages)?void 0:r.notification)||{},X={...I&&{color:I},...O&&{borderColor:O},...P&&{borderRadius:P},...k&&{paddingTop:k},...D&&{paddingBottom:D},...M&&{paddingLeft:M},...W&&{paddingRight:W},...B&&{backgroundColor:B},...H&&{fontSize:H},...U&&{fontWeight:U},...F&&{textTransform:F}},Q=async()=>{let e;e=await es(u,g),j(e)},ee=async e=>{var i,s,l,n,d,r,u;if(e.preventDefault(),e.stopPropagation(),L)return void("undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}));N(!0),j(!f);let g=await Yi(a);200===(null==(i=null==g?void 0:g.status)?void 0:i.code)?(N(!1),"undefined"!=typeof window&&(window.sledgeWishlistBadgeUpdate&&((null==(l=null==(s=null==p?void 0:p.wishlist)?void 0:s.badge)?void 0:l.trigger)&&(null==(u=null==(n=null==p?void 0:p.wishlist)?void 0:n.badge)||u.trigger(!(null==(r=null==(d=null==p?void 0:p.wishlist)?void 0:d.badge)?void 0:r.value))),window.sledgeWishlistBadgeUpdate()),window.sledgeWishlistWidgetListUpdate&&window.sledgeWishlistWidgetListUpdate(),window.sledgeWishlistTriggerUpdate&&window.sledgeWishlistTriggerUpdate()),Q(),f?c&&c("success"):o&&o("success"),"undefined"!=typeof window&&window.sledgeToastNotification&&G&&window.sledgeToastNotification({title:f?K:J,message:f?Y:Z,location:$,type:"success",icon:t.jsx(pt,{width:40,height:40,color:"black",type:"outline"})})):(f?c&&c("failed"):o&&o("failed"),N(!1),"undefined"!=typeof window&&window.sledgeToastNotification&&G&&window.sledgeToastNotification({title:"Failed",message:"failed add to wishlist",location:$,type:"failed"}))};e.useEffect((()=>{(null==h?void 0:h.wishlist)&&("undefined"!=typeof window&&(window.sledgeWishlistButtonDetailUpdate=()=>{Q()}),(async e=>{let t;x(!0);let i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;i=200===n||!1,i&&(y(l),x(!1),setTimeout((()=>{v(!1)}),1300))})(localStorage.getItem(Ee.WISHLIST_SETTING)||""))}),[h]),e.useEffect((()=>{A(m&&T)}),[m]),e.useEffect((()=>{Q()}),[g]);const te=t.jsxs(t.Fragment,{children:[E&&String(E).toLowerCase().includes("icon")&&(null==b?void 0:b.length)?t.jsx("span",{className:"sledge-wishlist__widget-button-detail-icon",dangerouslySetInnerHTML:{__html:b},style:{fill:I}}):null,L?V:E&&String(E).toLowerCase().includes("text")?S?f?"Adding...":"Removing...":f&&!R?q:f?z:V:null]});return t.jsx(t.Fragment,{children:_?t.jsx(tl.Item,{width:"100%",height:"44px",rounded:"md",color:"grey-100"}):t.jsx(t.Fragment,{children:E&&String(E).toLowerCase().includes("button")?t.jsx(Lt,{type:"button",fullWidth:!0,style:X,...S||f&&!R?{disabled:!0}:{onClick:e=>ee(e)},children:te}):t.jsx("span",{className:"sledge-wishlist__widget-button-detail",style:X,...S||f&&!R?{disabled:!0}:{onClick:e=>ee(e)},children:te})})})},os=()=>{let i=document.querySelector(Re.WISHLIST.ELEMENT_BUTTON_DETAIL);je(i,(()=>{if(i){const s=i.getAttribute(Te.GLOBAL.PRODUCT_ID),l=i.getAttribute(Te.GLOBAL.PRODUCT_VARIANT_ID),n=i.getAttribute(Te.GLOBAL.PRODUCT_NAME),d=i.getAttribute(Te.GLOBAL.PRODUCT_VENDOR),r=i.getAttribute(Te.GLOBAL.PRODUCT_SKU),a=i.getAttribute(Te.GLOBAL.PRODUCT_VARIANT_NAME),o=i.getAttribute(Te.GLOBAL.PRODUCT_LINK),u=i.getAttribute(Te.GLOBAL.PRODUCT_IMAGE),g=i.getAttribute(Te.GLOBAL.PRODUCT_CURRENCY),h=i.getAttribute(Te.GLOBAL.PRODUCT_PRICE),p=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),m=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(as,{data:{productId:s||"",productVariantId:l||"",productName:n||"",productVendor:d||"",productSku:r||"",productVariantName:a||"",productLink:o||"",productImage:u||"",productCurrency:g||"",productPrice:h||""},onAfterAddWishlist:e=>{i&&p&&eval(p)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&m&&eval(m)({element:i,state:e})}})})}))}}))},cs="",us=i=>{var s,l,n;const{data:d,forceActive:r=!1,hidden:a=!1,onAfterAddWishlist:o,onAfterRemoveWishlist:c}=i,{productId:u,productVariantId:g}=d||{},{isRenderApp:h,triggerRenderMultipleComponent:p,sledgeAnonymId:m}=e.useContext(Fi),_="#767676",v="outline",w="#F85538",x="fill",[f,j]=e.useState(_),[C,y]=e.useState(v),[S,N]=e.useState(!1),[L,A]=e.useState(!0),[T,E]=e.useState({}),[b,R]=e.useState({onAfterAddWishlist:o,onAfterRemoveWishlist:c}),[I,O]=e.useState(!1),{is_required_login:P}=(null==(s=null==T?void 0:T.display)?void 0:s.global)||{},{show:k,location:D}=(null==(l=null==T?void 0:T.display)?void 0:l.notification)||{},{title_added_to_wishlist:M,text_added_to_wishlist:W,title_removed_to_wishlist:B,text_removed_to_wishlist:H}=(null==(n=null==T?void 0:T.languages)?void 0:n.notification)||{},U=async()=>{let e;e=await es(u,g),N(r||e)};e.useEffect((()=>{(null==h?void 0:h.wishlist)&&("undefined"!=typeof window&&(window.sledgeWishlistTriggerUpdate=()=>{U()}),(async e=>{let t;A(!0);let i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;i=200===n||!1,i&&(E(l),A(!1))})(localStorage.getItem(Ee.WISHLIST_SETTING)||""))}),[h]),e.useEffect((()=>{O(m&&P)}),[m]),e.useEffect((()=>{U()}),[g]);const F=(S||r)&&!I;return e.useEffect((()=>{F?(j(w),y(x)):(j(_),y(v))}),[S]),t.jsx(t.Fragment,{children:!L&&!a&&t.jsx("div",{className:"sledge-wishlist__trigger-block",children:t.jsx("span",{className:"sledge-wishlist__trigger",onClick:e=>(async e=>{var i,s,l,n,r,a;if(e.preventDefault(),e.stopPropagation(),I)return void("undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:"Login required!",message:"Please login to save your wishlist across devices.",textSubmit:"Login",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:()=>window.location.href="/account/login"}));N(!S);let o=await Yi(d);const{status:c,data:u}=o||{},{code:g}=c||{};200===g?("undefined"!=typeof window&&(window.sledgeWishlistBadgeUpdate&&((null==(s=null==(i=null==p?void 0:p.wishlist)?void 0:i.badge)?void 0:s.trigger)&&(null==(a=null==(l=null==p?void 0:p.wishlist)?void 0:l.badge)||a.trigger(!(null==(r=null==(n=null==p?void 0:p.wishlist)?void 0:n.badge)?void 0:r.value))),window.sledgeWishlistBadgeUpdate()),window.sledgeWishlistWidgetListUpdate&&window.sledgeWishlistWidgetListUpdate(),window.sledgeWishlistButtonDetailUpdate&&window.sledgeWishlistButtonDetailUpdate()),U(),S?b.onAfterRemoveWishlist&&b.onAfterRemoveWishlist("success"):b.onAfterAddWishlist&&b.onAfterAddWishlist("success"),"undefined"!=typeof window&&window.sledgeToastNotification&&k&&window.sledgeToastNotification({title:S?B:M,message:S?H:W,location:D,type:"success",icon:t.jsx(pt,{width:40,height:40,color:"black",type:"outline"})})):(S?b.onAfterRemoveWishlist&&b.onAfterRemoveWishlist("failed"):b.onAfterAddWishlist&&b.onAfterAddWishlist("failed"),"undefined"!=typeof window&&window.sledgeToastNotification&&k&&window.sledgeToastNotification({title:"Failed",message:"failed add to wishlist",location:D,type:"failed",icon:t.jsx(pt,{width:40,height:40,color:"black",type:"outline"})}))})(e),onMouseEnter:()=>{F||(j(w),y(x))},onMouseLeave:()=>{F||(j(_),y(v))},children:t.jsx(pt,{width:16.67,height:15.83,type:C,color:f})})})})},gs=(i,s="")=>{i.parentNode&&i.parentNode.classList.add("sledge-wishlist__trigger-parent-element"),i.classList.add("sledge-wishlist__trigger-wrapper");const l=i.getAttribute(Te.GLOBAL.PRODUCT_ID),n=i.getAttribute(Te.GLOBAL.PRODUCT_VARIANT_ID),d=i.getAttribute(Te.GLOBAL.PRODUCT_NAME),r=i.getAttribute(Te.GLOBAL.PRODUCT_VENDOR),a=i.getAttribute(Te.GLOBAL.PRODUCT_SKU),o=i.getAttribute(Te.GLOBAL.PRODUCT_VARIANT_NAME),u=i.getAttribute(Te.GLOBAL.PRODUCT_LINK),g=i.getAttribute(Te.GLOBAL.PRODUCT_IMAGE),h=i.getAttribute(Te.GLOBAL.PRODUCT_CURRENCY),p=i.getAttribute(Te.GLOBAL.PRODUCT_PRICE),m=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),_=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(us,{data:{productId:l||"",productVariantId:n||"",productName:d||"",productVendor:r||"",productSku:a||"",productVariantName:o||"",productLink:u||"",productImage:g||"",productCurrency:h||"",productPrice:p||""},onAfterAddWishlist:e=>{i&&m&&eval(m)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&_&&eval(_)({element:i,state:e})}})})}))},hs=()=>{let e=Array.from(document.querySelectorAll(Re.WISHLIST.ELEMENT_TRIGGER));je(e,(()=>{e.length&&e.map((e=>{gs(e,e)}))})),new MutationObserver((function(t){t.forEach((function(t){Array.prototype.slice.call(t.addedNodes).forEach((function(t){1===t.nodeType&&t.querySelector(Re.WISHLIST.ELEMENT_TRIGGER)&&(e=Array.from(t.querySelectorAll(Re.WISHLIST.ELEMENT_TRIGGER)),e.length&&e.map((e=>{gs(e,e)})))}))}))})).observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1})},ps="",ms=({buttonText:i,shareId:s,dataSettings:l,isFirstLoading:n})=>{var d,r,a,o,c;const{sledgeAnonymId:u}=e.useContext(Fi),{is_required_login:g}=(null==(d=null==l?void 0:l.display)?void 0:d.global)||{},{text_color:h,border_color:p,border_radius:m,padding_top:_,padding_bottom:v,padding_left:w,padding_right:x,background_color:f,font_size:j,font_weight:C,text_transform:y}=(null==(a=null==(r=null==l?void 0:l.display)?void 0:r.widget)?void 0:a.button_clear_all)||{},{title_confirm_clear_all_wishlist:S,text_confirm_clear_all_wishlist:N,button_submit_confirm_clear_all_wishlist:L,button_cancel_confirm_clear_all_wishlist:A}=(null==(o=null==l?void 0:l.languages)?void 0:o.popup)||{},{button_clear_all:T}=(null==(c=null==l?void 0:l.languages)?void 0:c.widget)||{},[E,b]=e.useState(!1),R={...h&&{color:h},...p&&{borderColor:p},...m&&{borderRadius:m},..._&&{paddingTop:_},...v&&{paddingBottom:v},...w&&{paddingLeft:w},...x&&{paddingRight:x},...f&&{backgroundColor:f},...j&&{fontSize:j},...C&&{fontWeight:C},...y&&{textTransform:y}};e.useEffect((()=>{b(u&&g)}),[u]);return t.jsx(t.Fragment,{children:!E&&t.jsx(t.Fragment,{children:!s&&t.jsx(t.Fragment,{children:n?t.jsx(tl.Item,{width:"132px",height:"46px",color:"grey-100",rounded:"md"}):t.jsx("div",{className:"sledge-wishlist__widget-header-item",children:t.jsx(Lt,{type:"button",colorType:"danger",onClick:()=>{"undefined"!=typeof window&&window.sledgeConfirmationPopup&&window.sledgeConfirmationPopup({title:S,message:N,textSubmit:L,textCancel:A,buttonSubmitType:"danger",onSubmit:window.sledgeWishlistWidgetClearList||{}})},style:R,children:T||(i||"Clear Wishlist")})})})})})},_s=({wishlistData:i,buttonText:s,showShareTrigger:l,shareLink:n,shareId:d,dataSettings:r,isFirstLoading:a})=>{var o,c,u,g,h,p;const{triggerRenderMultipleComponent:m,sledgeAnonymId:_}=e.useContext(Fi),{is_required_login:v}=(null==(o=null==r?void 0:r.display)?void 0:o.global)||{},{text_color:w,border_color:x,border_radius:f,padding_top:j,padding_bottom:C,padding_left:y,padding_right:S,background_color:N,font_size:L,font_weight:A,text_transform:T}=(null==(u=null==(c=null==r?void 0:r.display)?void 0:c.widget)?void 0:u.button_share)||{},{title_share_wishlist:E}=(null==(g=null==r?void 0:r.languages)?void 0:g.popup)||{},{button_share:b}=(null==(h=null==r?void 0:r.languages)?void 0:h.widget)||{},{title_added_all_to_wishlist:R,text_added_all_to_wishlist:I}=(null==(p=null==r?void 0:r.languages)?void 0:p.notification)||{},[O,P]=e.useState(!1),k={...w&&{color:w},...x&&{borderColor:x},...f&&{borderRadius:f},...j&&{paddingTop:j},...C&&{paddingBottom:C},...y&&{paddingLeft:y},...S&&{paddingRight:S},...N&&{backgroundColor:N},...L&&{fontSize:L},...A&&{fontWeight:A},...T&&{textTransform:T}},[D,M]=e.useState(!1);let W='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M15 17V20C15 20.2652 14.8946 20.5196 14.7071 20.7071C14.5196 20.8946 14.2652 21 14 21H4C3.73478 21 3.48043 20.8946 3.29289 20.7071C3.10536 20.5196 3 20.2652 3 20V8C3 7.73478 3.10536 7.48043 3.29289 7.29289C3.48043 7.10536 3.73478 7 4 7H7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M18 3H8C7.44772 3 7 3.44772 7 4V16C7 16.5523 7.44772 17 8 17H18C18.5523 17 19 16.5523 19 16V4C19 3.44772 18.5523 3 18 3Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>';const B=async()=>{var e,t,s,l,n,d,r;M(!0);let a=i.map((e=>{const{id:t,variant_id:i,name:s,variant_name:l,url:n,image_url:d,currency:r,price:a}=e.product;return{productId:t,productVariantId:i,productName:s,productVariantName:l,productLink:n,productImage:d,productCurrency:r,productPrice:a}})),o=await Xi(a);200===(null==(e=null==o?void 0:o.status)?void 0:e.code)?("undefined"!=typeof window&&(window.sledgeWishlistBadgeUpdate&&((null==(s=null==(t=null==m?void 0:m.wishlist)?void 0:t.badge)?void 0:s.trigger)&&(null==(r=null==(l=null==m?void 0:m.wishlist)?void 0:l.badge)||r.trigger(!(null==(d=null==(n=null==m?void 0:m.wishlist)?void 0:n.badge)?void 0:d.value))),window.sledgeWishlistBadgeUpdate()),window.sledgeInfoPopup&&window.sledgeInfoPopup({title:R,message:I,textCancel:"Cancel"})),M(!1)):"undefined"!=typeof window&&window.sledgeInfoPopup&&window.sledgeInfoPopup({title:"Failed",message:"Failed add to wishlist, please try again",textCancel:"Cancel"})};return e.useEffect((()=>{P(_&&v)}),[_]),t.jsx(t.Fragment,{children:!O&&t.jsx(t.Fragment,{children:l&&t.jsx(t.Fragment,{children:a?t.jsx(tl.Item,{width:"136px",height:"46px",color:"grey-100",rounded:"md"}):t.jsx("div",{className:"sledge-wishlist__widget-header-item sledge-wishlist__widget-header-share-trigger",children:t.jsx(Lt,{type:"button",style:k,...d&&!i.length||D?{disabled:!0}:{onClick:async()=>{d&&i.length?window.sledgeConfirmationPopup({title:"Are you sure want to add this to your wishlist item?",message:`This action cannot be undone. This will adding <strong>${i.length}</strong> item to your wishlist page.`,textSubmit:"Add to your wishlist",textCancel:"Cancel",buttonSubmitType:"info",onSubmit:B||{}}):"undefined"!=typeof window&&window.sledgeInfoPopup&&(window.sledgeInfoPopup({title:E,message:n?`<div class="sledge-wishlist__widget-box-copy">\n <div class="sledge-wishlist__widget-box-copy-icon" title="Copy to clipboard">\n ${W}\n </div>\n <div class="sledge-wishlist__widget-box-copy-content">${n}</div>\n </div>`:"",textCancel:"Cancel"}),(()=>{let e=!0;document.body.addEventListener("DOMNodeInserted",(()=>{if(document.querySelector(".sledge-wishlist__widget-box-copy")&&e){e=!1;let t=document.querySelector(".sledge-wishlist__widget-box-copy-icon");null==t||t.addEventListener("click",(()=>{var e;let i=null==(e=document.querySelector(".sledge-wishlist__widget-box-copy-content"))?void 0:e.textContent;i&&(navigator.clipboard.writeText(i),t&&(t.classList.add("active"),t.innerHTML='<svg width="20" height="20" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>',setTimeout((()=>{t&&(t.classList.remove("active"),t.innerHTML=W)}),2500)))}))}}))})())}},children:d?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sledge-wishlist__badge-counter sledge-wishlist__badge-counter-top-right",children:i.length}),D?"Adding...":"Add to your wishlist"]}):b||(s||"Share Wishlist")})})})})})},vs=({setIsLoading:i,setKeyword:s,keyword:l,placeholder:n,dataSettings:d})=>{var r,a;const{sledgeAnonymId:o}=e.useContext(Fi),{is_required_login:c}=(null==(r=null==d?void 0:d.display)?void 0:r.global)||{},{search_form_placeholder:u}=(null==(a=null==d?void 0:d.languages)?void 0:a.widget)||{},[g,h]=e.useState(!1),p=e.useRef(null);return e.useEffect((()=>{h(o&&c)}),[o]),t.jsx(t.Fragment,{children:!g&&t.jsx(Tt,{type:"text",icon:t.jsx(St,{width:18,height:18,color:"#868686"}),placeholder:u||(n||"Search product..."),value:l,fieldRef:p,onChange:({value:e})=>(e=>{s&&s(e)})(e),onResetField:()=>{var e;i&&i(!0),s&&s(""),null==(e=null==p?void 0:p.current)||e.focus()},className:"sledge-wishlist__widget-search-form",withClearField:!0})})},ws=({text:e,dataSettings:i})=>{var s,l,n;const{color:d,font_size:r,font_weight:a,text_transform:o}=(null==(l=null==(s=null==i?void 0:i.display)?void 0:s.widget)?void 0:l.header_title)||{},{header_title:c}=(null==(n=null==i?void 0:i.languages)?void 0:n.widget)||{},u={...d&&{color:d},...r&&{fontSize:r},...a&&{fontWeight:a},...o&&{textTransform:o}};return t.jsx("div",{className:"sledge-wishlist__widget-header-item",children:t.jsx("h1",{style:u,children:c||(e||"My Wishlist")})})},xs=({options:i,defaultLimitOptions:s,selectedLimit:l,setSelectedLimit:n,setIsRefreshWidgetList:d,dataSettings:r})=>{var a;const{sledgeAnonymId:o}=e.useContext(Fi),{is_required_login:c}=(null==(a=null==r?void 0:r.display)?void 0:a.global)||{},[u,g]=e.useState(!1);let h=i||s;return e.useEffect((()=>{g(o&&c)}),[o]),t.jsx(t.Fragment,{children:!u&&t.jsx(t.Fragment,{children:h&&Boolean(null==h?void 0:h.length)&&t.jsx("div",{className:"sledge-wishlist__widget-header-item",children:t.jsx(bt,{align:"end",options:h.map((e=>({label:e,value:e}))),value:l||h[0],onChange:({value:e})=>(e=>{n&&n(e),d&&d(!0)})(e)})})})})},fs=({wishlistSort:i,selectedSort:s,setSelectedSort:l,setIsRefreshWidgetList:n,dataSettings:d})=>{var r,a;const{sledgeAnonymId:o}=e.useContext(Fi),{is_required_login:c}=(null==(r=null==d?void 0:d.display)?void 0:r.global)||{},[u,g]=e.useState(!1);return e.useEffect((()=>{g(o&&c)}),[o]),t.jsx(t.Fragment,{children:!u&&t.jsx(t.Fragment,{children:i&&Boolean(null==i?void 0:i.length)&&t.jsx("div",{className:"sledge-wishlist__widget-header-item",children:t.jsx(bt,{align:"end",options:i.map((e=>{const{name:t,value:i}=e;return{label:t,value:i}})),value:s||(null==(a=i[0])?void 0:a.value),onChange:({value:e})=>(e=>{l&&l(e),n&&n(!0)})(e)})})})})},js=({isFirstLoading:i,...s})=>t.jsx("div",{className:"sledge-wishlist__widget-header",children:i?t.jsxs("div",{style:{display:"flex",gap:"8px",width:"100%",justifyContent:"space-between"},children:[t.jsx(tl.Item,{width:"190px",height:"46px",color:"grey-100",rounded:"md"}),t.jsxs("div",{style:{display:"flex",gap:"8px"},children:[t.jsx(tl.Item,{width:"440px",height:"46px",color:"grey-100",rounded:"md"}),t.jsx(tl.Item,{width:"132px",height:"46px",color:"grey-100",rounded:"md"}),t.jsx(tl.Item,{width:"136px",height:"46px",color:"grey-100",rounded:"md"})]}),t.jsxs("div",{style:{display:"flex",gap:"26px"},children:[t.jsx(tl.Item,{width:"190px",height:"46px",color:"grey-100",rounded:"md"}),t.jsx(tl.Item,{width:"190px",height:"46px",color:"grey-100",rounded:"md"})]})]}):e.Children.count(s.children)&&e.Children.map(s.children,(t=>e.cloneElement(t,{...s})))});js.Title=ws,js.SearchForm=vs,js.ShareTrigger=_s,js.ClearTrigger=ms,js.Sort=fs,js.Limit=xs;const Cs="large",ys=i=>{var s;const{sledgeAnonymId:l}=e.useContext(Fi),{isLoading:n,wishlistData:d,dataSettings:r,gridType:a=Cs}=i||{},{is_required_login:o}=(null==(s=null==r?void 0:r.display)?void 0:s.global)||{},[c,u]=e.useState(!1);return e.useEffect((()=>{u(l&&o)}),[l]),t.jsx(t.Fragment,{children:n?t.jsx(tl.ProductGrid,{count:8,type:a}):t.jsx("div",{className:"sledge-wishlist__widget-product-wrapper",children:!(null==d?void 0:d.length)||c?t.jsx(Ss,{...i,isRequiredLogin:c}):t.jsx(Ns,{...i})})})},Ss=i=>{var s;const{onSearch:l,keyword:n,dataSettings:d,isRequiredLogin:r}=i||{},{title_no_result:a,text_no_result:o}=(null==(s=null==d?void 0:d.languages)?void 0:s.widget)||{},[c,u]=e.useState(""),[g,h]=e.useState(""),[p,m]=e.useState(!1),[_,v]=e.useState(""),[w,x]=e.useState("");return e.useEffect((()=>{r?(u("Login required!"),h("Please login to save your wishlist across devices."),m(!0),v("Login"),x("/account/login")):l||(u(n?"No products found":a),h(n?"Your search did not match any products. <br/> Please try again":o),m(!n),v("Continue Shopping"),x("/"))}),[l,d]),t.jsxs("div",{className:"sledge-wishlist__widget-product-empty",children:[t.jsx("div",{className:"sledge-wishlist__widget-product-empty-title",dangerouslySetInnerHTML:{__html:c}}),t.jsx("div",{className:"sledge-wishlist__widget-product-empty-description",dangerouslySetInnerHTML:{__html:g}}),p&&t.jsx("div",{className:"sledge-wishlist__widget-button-wrapper",children:t.jsx("a",{href:w,className:"sledge__button","data-button-color-type":"light",children:_})})]})},Ns=i=>{var s,l,n,d,r,a,o,c;const{wishlistData:u,currentPage:g,setCurrentPage:h,totalPage:p,shareId:m,dataSettings:_,gridType:v=Cs,productCardsComponent:w,separateJsVersionComponent:x,onAfterAddToCart:f,onAfterAddWishlist:j,onAfterRemoveWishlist:C,onAfterRenderProduct:y}=i||{},{show_add_to_cart:S,redirect_add_to_cart:N}=(null==(s=null==_?void 0:_.display)?void 0:s.widget)||{},{text_color:L,border_color:A,border_radius:T,padding_top:E,padding_bottom:b,padding_left:R,padding_right:I,background_color:O,font_size:P,font_weight:k,text_transform:D}=(null==(n=null==(l=null==_?void 0:_.display)?void 0:l.widget)?void 0:n.button_add_to_cart)||{},{color:M,font_size:W,font_weight:B,text_transform:H}=(null==(r=null==(d=null==_?void 0:_.display)?void 0:d.widget)?void 0:r.price)||{},{color:U,font_size:F,font_weight:G,text_transform:$}=(null==(o=null==(a=null==_?void 0:_.display)?void 0:a.widget)?void 0:o.product_name)||{},{button_add_to_cart:V}=(null==(c=null==_?void 0:_.languages)?void 0:c.widget)||{},q={...L&&{color:L},...A&&{borderColor:A},...T&&{borderRadius:T},...E&&{paddingTop:E},...b&&{paddingBottom:b},...R&&{paddingLeft:R},...I&&{paddingRight:I},...O&&{backgroundColor:O},...P&&{fontSize:P},...k&&{fontWeight:k},...D&&{textTransform:D}},z={...M&&{color:M},...W&&{fontSize:W},...B&&{fontWeight:B},...H&&{textTransform:H}},J={...U&&{color:U},...F&&{fontSize:F},...G&&{fontWeight:G},...$&&{textTransform:$}};let Z=g||0,K=p||0;const[Y,X]=e.useState(!1),[Q,ee]=e.useState(!1);return e.useEffect((()=>{ee(!(K===Z&&!Y)&&K>=Z)}),[Y]),e.useEffect((()=>{X(!1)}),[u]),t.jsxs(t.Fragment,{children:[(null==u?void 0:u.length)?t.jsx(Os,{sourceApp:"wishlist",type:v,data:u.map((e=>{const{id:t,variant_id:i,name:s,variant_name:l,url:n,image_url:d,currency:r,price:a,vendor:o,sku:c}=(null==e?void 0:e.product)||{},u=new URL(n).pathname.split("/"),g=u[u.length-1];return{product:{id:t,admin_graphql_api_id:`${Me}${t}`,handle:g,title:s,image:{src:d},url:n,vendor:o,currency:r},variants:[{id:i,admin_graphql_api_id:`${We}${i}`,title:l,price:a,sku:c}]}})),setting:{show_vendor:!0,show_sku:!0,show_price:!0,show_add_to_cart:S,redirect_add_to_cart:N,language_button_add_to_cart:V,display_product_name_style:J,display_price_style:z,display_button_add_to_cart_style:q},showOptionOutOfStock:!1,triggerPropAdditional:{forceActive:!0,...m&&{hidden:!0}},isComponentJsVersion:x,cards:w,onAfterAddToCart:f,onAfterAddWishlist:j,onAfterRemoveWishlist:C,onAfterRenderProduct:y}):t.jsx(t.Fragment,{}),Q&&t.jsx("div",{className:"sledge-wishlist__widget-button-load-more",children:t.jsx(Lt,{type:"button",role:"button",colorType:"light",disabled:Y,onClick:()=>{h&&g&&h(g+1),X(!0)},style:{...Y&&{cursor:"wait"}},children:Y?"Loading...":"Load More"})})]})},Ls=i=>{var s;const{children:l,data:n,onAfterAddToCart:d,onAfterAddWishlist:r,onAfterRemoveWishlist:a,onAfterRenderProduct:o}=i,c=(null==n?void 0:n.shareId)?n.shareId:"",{isRenderApp:u,triggerRenderMultipleComponent:g,sledgeAnonymId:h}=e.useContext(Fi),[p,m]=e.useState(!0),[_,v]=e.useState(!0),[w,x]=e.useState([]),[f,j]=e.useState([]),[C,y]=e.useState(!1),[S,N]=e.useState(""),[L,A]=e.useState(""),[T,E]=e.useState(""),[b,R]=e.useState(1),[I,O]=e.useState(0),[P,k]=e.useState(!1),[D,M]=e.useState(!1),[W,B]=e.useState(""),[H,U]=e.useState(""),[F,G]=e.useState({}),[$,V]=e.useState(!1),q=Ut({keyword:T,currentPage:b}),z=Ie,{is_required_login:J}=(null==(s=null==F?void 0:F.display)?void 0:s.global)||{},Z=async(e=!1)=>{var t,i,s,l;let n;v(!e),e||(R(1),x([]));let d,r,a=!1,o=0,u={page:e?b:1,limit:L||z[0],sort:S,keyword:T,shareId:c};n=await Ki(u),a=200===(null==(t=null==n?void 0:n.status)?void 0:t.code)||!1,d=(null==(i=n.data)?void 0:i.length)?t=>(null==w?void 0:w.length)&&e?[...t,...n.data]:n.data:[],r=(null==(s=n.sorts)?void 0:s.length)?n.sorts:[],o=(null==(l=null==n?void 0:n.page)?void 0:l.total_page)||1,a&&(x(d),j(r),O(o),v(!1),y(!1))};e.useEffect((()=>{let e=Boolean(q&&(null==q?void 0:q.currentPage)!==b);if(q&&(null==q?void 0:q.keyword)!==T){k(!0);const e=setTimeout((()=>{k(!1),Z()}),500);return()=>clearTimeout(e)}Z(!C&&e)}),[T,b,C]),e.useEffect((()=>{(null==u?void 0:u.wishlist)&&("undefined"!=typeof window&&(window.sledgeWishlistWidgetListUpdate=()=>{Z()},window.sledgeWishlistWidgetClearList=()=>{(async()=>{var e,t,i,s,l,n,d;let r;v(!0);let a=!1;r=await ts(),a=200===(null==(e=null==r?void 0:r.status)?void 0:e.code),a?(await Z(),"undefined"!=typeof window&&window.sledgeWishlistBadgeUpdate&&((null==(i=null==(t=null==g?void 0:g.wishlist)?void 0:t.badge)?void 0:i.trigger)&&(null==(d=null==(s=null==g?void 0:g.wishlist)?void 0:s.badge)||d.trigger(!(null==(n=null==(l=null==g?void 0:g.wishlist)?void 0:l.badge)?void 0:n.value))),window.sledgeWishlistBadgeUpdate())):"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:"failed clear all wishlist",type:"failed"})})()}),(async()=>{var e,t,i;let s;M(!1);let l,n,d=!1;s=await Qi(),d=200===(null==(e=null==s?void 0:s.status)?void 0:e.code)||!1,l=(null==(t=null==s?void 0:s.data)?void 0:t.share_link)||"",n=(null==(i=null==s?void 0:s.data)?void 0:i.proxy_url)||"",d&&(B(window.location.origin+l),U(n),M(!0))})(),(async e=>{let t,i=!1;if(t=JSON.parse(e),!t)return;const{status:s,data:l}=t,{code:n}=s;i=200===n||!1,i&&G(l)})(localStorage.getItem(Ee.WISHLIST_SETTING)||""),setTimeout((()=>{m(!1)}),1300))}),[u]),e.useEffect((()=>{V(h&&!J)}),[h]);let K=null,Y=!1;return e.Children.map(l,(t=>{if(e.isValidElement(t)&&ye(t.type)&&t.type.name===ke.PRODUCT.CARDS){const{component:e,isJsVersion:i}=(null==t?void 0:t.props)||{};K=e,Y=i}})),t.jsx(t.Fragment,{children:t.jsxs("div",{className:"sledge-wishlist__widget-wrapper",children:[$&&t.jsx(t.Fragment,{children:p?t.jsx(tl.Item,{width:"99.5%",height:"72px",color:"grey-100",rounded:"none",animationDuration:"3s",style:{margin:"0 auto"}}):t.jsx("div",{className:"sledge-wishlist__widget-alert",children:t.jsxs("div",{className:"sledge-wishlist__widget-alert-text",children:["Please login to save your wishlist across devices.",t.jsx("a",{href:"/account/login",className:"sledge-wishlist__widget-alert-link",children:"Login Here"})]})})}),e.Children.count(l)&&e.Children.map(l,(t=>e.cloneElement(t,{isLoading:_,isFirstLoading:p,wishlistData:w,wishlistSort:f,selectedSort:S,selectedLimit:L,keyword:T,currentPage:b,totalPage:I,defaultLimitOptions:z,onSearch:P,showShareTrigger:D,shareLink:W,shareId:c,proxyUrl:H,dataSettings:F,separateJsVersionComponent:Y,productCardsComponent:K,setIsLoading:v,setIsRefreshWidgetList:y,setSelectedSort:N,setSelectedLimit:A,setKeyword:E,setCurrentPage:R,onAfterAddToCart:d,onAfterAddWishlist:r,onAfterRemoveWishlist:a,onAfterRenderProduct:o})))]})})},As=({children:i})=>t.jsx(t.Fragment,{children:e.Children.count(i)&&e.Children.map(i,(t=>e.cloneElement(t,{})))});As.Root=Ls,As.Header=js,As.List=ys;const Ts="",Es=({children:i})=>{const[s,l]=e.useState(!1);return e.useEffect((()=>{"undefined"!=typeof window&&(window.sledgeWishlistWidgetPopup=()=>{l(!0)})}),[]),t.jsx(u,{open:s,onOpenChange:l,children:t.jsxs(g,{children:[t.jsx(h,{className:"sledge__popup-overlay"}),t.jsx(h,{className:"sledge__popup-overlay-blur"}),t.jsx(p,{className:"sledge-wishlist__widget-popup-content DialogContent",children:t.jsxs("div",{className:"sledge-wishlist__widget-popup-wrapper",children:[t.jsx("div",{className:"sledge-wishlist__widget-popup-close",onClick:()=>l(!1),children:t.jsx("svg",{width:18,height:18,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}),i]})})]})})},bs=()=>{let i=document.querySelector(Re.WISHLIST.ELEMENT_WIDGET);je(i,(()=>{var s;if(i){const l=i.getAttribute(Te.WISHLIST.SHARE_ID),n=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_TO_CART),d=i.getAttribute(Te.GLOBAL.ON_AFTER_ADD_WISHLIST),r=i.getAttribute(Te.GLOBAL.ON_AFTER_REMOVE_WISHLIST),a=i.getAttribute(Te.GLOBAL.ON_AFTER_RENDER_PRODUCT),o=null==(s=i.querySelector(Re.GLOBAL.ELEMENT_PRODUCT_CARDS))?void 0:s.getAttribute(Te.GLOBAL.RENDER_COMPONENT);i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsxs(As.Root,{data:{shareId:l||""},onAfterAddToCart:e=>{i&&n&&eval(n)({element:i,state:e})},onAfterAddWishlist:e=>{i&&d&&eval(d)({element:i,state:e})},onAfterRemoveWishlist:e=>{i&&r&&eval(r)({element:i,state:e})},onAfterRenderProduct:e=>{i&&a&&eval(a)({element:i,state:e})},children:[t.jsx(Gi,{component:o?eval(o):null,isJsVersion:!0}),t.jsxs(As.Header,{children:[t.jsx(js.Title,{text:"My Wishlist"}),t.jsx(js.SearchForm,{placeholder:"Search product"}),t.jsx(js.ClearTrigger,{buttonText:"Clear Wishlist"}),t.jsx(js.ShareTrigger,{buttonText:"Share Wishlist"}),t.jsx(js.Sort,{}),t.jsx(js.Limit,{options:[10,25,50,100]})]}),t.jsx(As.List,{gridType:"large"})]})})}))}}))},Rs=()=>{let i=document.querySelector(`[${Ae}="${be.WISHLIST.ELEMENT_WIDGET_POPUP}"]`);i||(i=document.createElement("div"),i.setAttribute(Ae,be.WISHLIST.ELEMENT_WIDGET_POPUP),document.body.appendChild(i)),i&&(i.innerHTML="",c.createRoot(i).render(t.jsx(e.StrictMode,{children:t.jsx(Fi.Provider,{value:{isRenderApp:{wishlist:!0,productReview:!0,instantSearch:!0}},children:t.jsx(Es,{children:t.jsxs(As.Root,{children:[t.jsxs(As.Header,{children:[t.jsx(js.Title,{text:"My Wishlist"}),t.jsx(js.SearchForm,{placeholder:"Search product"}),t.jsx(js.ClearTrigger,{buttonText:"Clear Wishlist"}),t.jsx(js.ShareTrigger,{buttonText:"Share Wishlist"}),t.jsx(js.Sort,{}),t.jsx(js.Limit,{options:[10,25,50,100]})]}),t.jsx(As.List,{gridType:"medium"})]})})})})))},Is=()=>{ds(),hs(),bs(),Rs(),os()},Os=({type:i,className:s="",data:l,setting:n,showOptionOutOfStock:d=!1,triggerPropAdditional:r,sourceApp:a=null,isComponentJsVersion:o=!1,cards:c,onAfterAddToCart:u,onAfterAddWishlist:g,onAfterRemoveWishlist:h,onAfterRenderProduct:p})=>{const{show_vendor:m=!0,show_sku:_=!0,show_price:v=!0,show_add_to_cart:w=!0,redirect_add_to_cart:x=!0,language_button_add_to_cart:f="Add To Cart",display_product_name_style:j={},display_price_style:C={},display_button_add_to_cart_style:y={}}=n||{},[S,N]=e.useState(null);return e.useEffect((()=>{p&&p("success")}),[]),t.jsx("div",{className:`sledge__product-grid ${s}`,"data-grid-type":i,children:null==l?void 0:l.map(((i,s)=>{const{product:l,variants:n}=i||{},{id:p,title:L,image:A,url:T,vendor:E="",currency:b}=l||{},{id:R="",title:I="",price:O="",sku:P=""}=(null==n?void 0:n.length)?n[0]:{};let k=S==R,D=!(!(null==n?void 0:n.length)||!Object.hasOwn(n[0],"inventory_quantity"))&&(!n[0].inventory_quantity&&d);const M=c?c({product:{...l,variants:n.map(((e,t)=>{const{inventory_quantity:i}=e||{};return{...e,is_out_of_stock:!!Object.hasOwn(n[t],"inventory_quantity")&&!i}}))}}):null;return c?t.jsx(e.Fragment,{children:o?t.jsx("div",{dangerouslySetInnerHTML:{__html:M}}):M},s):t.jsxs("div",{className:"sledge__product-grid-card",children:[t.jsxs("div",{className:"sledge__product-grid-content",children:[t.jsxs("div",{className:"sledge__product-grid-card-image",children:[t.jsxs("a",{href:T,onClick:()=>"instant-search"===a&&yi({productId:p}),children:[t.jsx(us,{data:{productId:p,productVariantId:R,productName:L,productVendor:E,productSku:P,productVariantName:I,productLink:T,productImage:(null==A?void 0:A.src)||`${Se}/img/blank-image.png`,productCurrency:b,productPrice:O},...r,onAfterAddWishlist:g,onAfterRemoveWishlist:h}),t.jsx("img",{src:(null==A?void 0:A.src)||"",alt:"sledge-product-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`})]}),D?t.jsx("div",{className:"sledge__product-grid-card-out-of-stock",children:"Sold out"}):null]}),t.jsxs("div",{className:"sledge__product-grid-card-desc",children:[t.jsxs("div",{className:"sledge__product-grid-card-title",children:[L?t.jsx("a",{href:T,onClick:()=>"instant-search"===a&&yi({productId:p}),children:t.jsx("h3",{style:j,children:L})}):null,v?t.jsx("div",{className:"sledge__product-grid-card-price",children:t.jsxs("p",{style:C,children:[b,O]})}):null]}),t.jsxs("div",{className:"sledge__product-grid-card-text",children:[t.jsx("div",{children:I}),t.jsxs("div",{children:[t.jsx(t.Fragment,{children:m?t.jsxs(t.Fragment,{children:["Vendor: ",E]}):null}),t.jsx(t.Fragment,{children:" | "}),t.jsx(t.Fragment,{children:_?t.jsxs(t.Fragment,{children:["SKU: ",P]}):null})]})]}),t.jsx("div",{className:"sledge__product-grid-card-rating",children:t.jsx(Ft,{data:{productId:p},size:"xs",withSkeletonLoading:!1})})]})]}),w?t.jsx("div",{className:"sledge__product-grid-button-wrapper",children:t.jsx(Lt,{type:"button",colorType:"light",style:{...y,...k&&{cursor:"wait"}},...k||D?{disabled:!0}:{onClick:()=>(async e=>{var i;const{id:s,quantity:l}=e;N(s);let n=await It([{id:s,quantity:l}]);(null==(i=null==n?void 0:n.items)?void 0:i.length)?("wishlist"===a?await is({productId:s}):"instant-search"===a&&await Si({productId:s}),N(null),u&&u("success"),x?window.location.href="/cart":window.sledgeToastNotification({title:"Cart added",message:"Successfully added to wishlist",type:"success",icon:t.jsx(xt,{width:40,height:40,color:"black"})})):(u&&u("failed"),setTimeout((()=>{var e;N(null),"undefined"!=typeof window&&window.sledgeToastNotification&&window.sledgeToastNotification({title:"Failed",message:(null==(e=null==n?void 0:n.description)?void 0:e.length)?n.description:"failed add to cart, please try again",type:"failed",icon:t.jsx(xt,{width:40,height:40,color:"black"})})}),1e3))})({id:R,quantity:1})},children:k?"Adding...":D?"Sold out":t.jsxs(t.Fragment,{children:[t.jsx("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.83562 1.50023C10.796 1.50023 12.4155 2.99397 12.6152 4.90442L12.6709 4.90507C13.7584 4.90507 15.0806 5.62732 15.5269 7.65307L16.1186 12.2333C16.3309 13.7116 16.0654 14.8973 15.3281 15.7478C14.5946 16.5938 13.4336 17.0416 11.9704 17.0416H5.7094C4.10215 17.0416 2.9824 16.6478 2.28565 15.8386C1.5859 15.0271 1.3519 13.8098 1.5904 12.2213L2.1724 7.70182C2.5549 5.62957 3.95365 4.90507 5.03665 4.90507C5.13014 4.04293 5.51889 3.22275 6.13562 2.60797C6.84437 1.90372 7.82162 1.50023 8.81987 1.50023H8.83562ZM12.6709 6.03007H5.03665C4.7059 6.03007 3.6004 6.16357 3.28315 7.87657L2.70415 12.3766C2.5159 13.6388 2.6614 14.5523 3.13765 15.1051C3.6079 15.6511 4.4494 15.9166 5.7094 15.9166H11.9704C12.7564 15.9166 13.8296 15.7598 14.4776 15.0113C14.9921 14.4181 15.1691 13.5346 15.0041 12.3848L14.4199 7.84582C14.1709 6.72757 13.5139 6.03007 12.6709 6.03007ZM11.023 8.11815C11.3335 8.11815 11.6027 8.37015 11.6027 8.68065C11.6027 8.99115 11.368 9.24315 11.0575 9.24315H11.023C10.7125 9.24315 10.4605 8.99115 10.4605 8.68065C10.4605 8.37015 10.7125 8.11815 11.023 8.11815ZM6.65042 8.11815C6.96092 8.11815 7.23017 8.37015 7.23017 8.68065C7.23017 8.99115 6.99467 9.24315 6.68417 9.24315H6.65042C6.33992 9.24315 6.08792 8.99115 6.08792 8.68065C6.08792 8.37015 6.33992 8.11815 6.65042 8.11815ZM8.83337 2.62522H8.82212C8.11637 2.62522 7.42862 2.90947 6.92987 3.40522C6.5236 3.80967 6.25789 4.34137 6.17193 4.90472L11.4814 4.90493C11.2887 3.61626 10.1743 2.62522 8.83337 2.62522Z",fill:"#393D4E"})}),t.jsx("span",{children:f||"Add To Cart"})]})})}):null]},s)}))})},Ps="",ks=e=>{const{className:i="",value:s="",onChange:l,required:n,...d}=e;return t.jsx("div",{className:`sledge__text-area-field-wrapper ${i||""}`,children:t.jsxs(le,{className:"FormField FormTextArea",name:"review",children:[t.jsxs("div",{className:"sledge__text-area-field-control",children:[t.jsx(ne,{asChild:!0,children:t.jsx("textarea",{className:"sledge__text-area-field",value:s,onChange:e=>(e=>{l&&l(e)})(e),rows:6,maxLength:1e3,required:n,...d})}),t.jsxs("div",{className:"sledge__text-area-field-counter",children:[null==s?void 0:s.length,"/",1e3]})]}),n&&t.jsx(de,{className:"FormMessage",match:"valueMissing",children:"Required field"})]})})},Ds="",Ms=e=>{const{className:i="",value:s="",onChange:l,required:n,type:d,name:r="",...a}=e;return t.jsx("div",{className:`sledge__input-field-wrapper ${i||""}`,children:t.jsxs(le,{className:"FormField",name:r,children:[t.jsx(ne,{asChild:!0,children:t.jsx("input",{className:"sledge__input-field",type:d,value:s,required:n,onChange:e=>(e=>{l&&l(e)})(e),...a})}),n&&t.jsx(de,{className:"FormMessage",match:"valueMissing",children:"Required field"}),"email"===d&&t.jsx(de,{className:"FormMessage",match:"typeMismatch",children:"Please fill a valid email address"})]})})},Ws="",Bs=({className:e="",data:i})=>t.jsx(t.Fragment,{children:(null==i?void 0:i.length)?t.jsx("div",{className:`sledge__collection-grid ${e}`,children:i.map(((e,i)=>{const{id:s,title:l,description:n,url:d,image:r}=e;return t.jsxs("div",{className:"sledge__collection-grid-card",children:[t.jsx("div",{className:"sledge__collection-grid-card-image",children:t.jsx("img",{src:r||`${Se}/img/blank-image.png`,alt:"sledge-product-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`})}),t.jsxs("div",{className:"sledge__collection-grid-card-content",children:[t.jsxs("div",{className:"sledge__collection-grid-card-text",children:[t.jsx("div",{className:"sledge__collection-grid-card-content-title",children:l}),t.jsx("div",{className:"sledge__collection-grid-card-content-description",children:n})]}),t.jsx("div",{className:"sledge__collection-grid-card-content-button-wrapper",children:t.jsx(Lt,{type:"button",colorType:"success",elementType:"hyperlink",link:d,children:"Shop Now"})})]})]},i)}))}):null}),Hs="",Us=({className:e="",data:i})=>t.jsx(t.Fragment,{children:(null==i?void 0:i.length)?t.jsx("div",{className:`sledge__page-grid ${e}`,children:i.map(((e,i)=>{const{id:s,title:l,description:n,url:d,image:r}=e;return t.jsx("a",{href:d,children:t.jsxs("div",{className:"sledge__page-grid-card",children:[t.jsx("div",{className:"sledge__page-grid-card-image",children:t.jsx("img",{src:r||`${Se}/img/blank-image.png`,alt:"sledge-product-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`})}),t.jsxs("div",{className:"sledge__page-grid-card-content",children:[t.jsx("div",{className:"sledge__page-grid-card-content-title",children:l}),t.jsx("div",{className:"sledge__page-grid-card-content-description",children:n})]})]})},i)}))}):null}),Fs="",Gs=({className:e="",data:i})=>t.jsx(t.Fragment,{children:(null==i?void 0:i.length)?t.jsx("div",{className:`sledge__blog-grid ${e}`,children:null==i?void 0:i.map(((e,i)=>{const{id:s,title:l,date:n,description:d,url:r,image:a}=e;return t.jsxs("div",{className:"sledge__blog-grid-card",children:[t.jsxs("div",{className:"sledge__blog-grid-content",children:[t.jsx("div",{className:"sledge__blog-grid-card-image",children:t.jsx("a",{href:r,children:t.jsx("img",{src:a||`${Se}/img/blank-image.png`,alt:"sledge-blog-card-image",loading:"lazy",onError:e=>e.currentTarget.src=`${Se}/img/blank-image.png`})})}),t.jsxs("div",{className:"sledge__blog-grid-card-desc",children:[t.jsx("div",{className:"sledge__blog-grid-card-title",children:t.jsx("div",{children:t.jsx("a",{href:r,children:t.jsx("div",{children:l})})})}),(null==n?void 0:n.length)?t.jsx("div",{className:"sledge__blog-grid-card-date",children:n}):null,t.jsx("div",{className:"sledge__blog-grid-card-text",children:d})]})]}),t.jsx("div",{className:"sledge__blog-grid-button-wrapper",children:t.jsx(Lt,{type:"button",colorType:"light",elementType:"hyperlink",link:r,children:"Learn More"})})]},i)}))}):null}),$s="",Vs=({children:i,content:s,withArrow:l=!0,customArrow:n="",sideOffset:d=5,alignOffset:r=0,wrapTrigger:a=!0})=>{const[o,c]=e.useState(!1);return e.useEffect((()=>{var e;let t=null==(e=null==document?void 0:document.querySelector(".sledge__tooltip-arrow"))?void 0:e.parentElement;t&&(null==n?void 0:n.length)&&(t.classList.add("sledge__tooltip-arrow-parent"),t.innerHTML=n)}),[o]),t.jsx(re,{delayDuration:0,children:t.jsxs(ae,{onOpenChange:c,children:[t.jsx(oe,{asChild:!0,children:a?t.jsx("span",{children:i}):i}),t.jsx(ce,{children:t.jsxs(ue,{className:"sledge__tooltip-content",sideOffset:d,alignOffset:r,children:[s,l?t.jsx(ge,{className:"sledge__tooltip-arrow"}):null]})})]})})},qs="",zs=({children:e,isLoading:i=!1,className:s="",withCorner:l=!0})=>t.jsxs(he,{className:`sledge__scroll-area-root ${s}`,children:[t.jsx(pe,{className:"sledge__scroll-area-viewport "+(i?"sledge__scroll-area-viewport-loading":""),children:e}),!i&&t.jsxs(t.Fragment,{children:[t.jsx(me,{className:"sledge__scroll-area-scrollbar",orientation:"vertical",children:t.jsx(_e,{className:"sledge__scroll-area-thumb"})}),t.jsx(me,{className:"sledge__scroll-area-scrollbar",orientation:"horizontal",children:t.jsx(_e,{className:"sledge__scroll-area-thumb"})}),l&&t.jsx(ve,{className:"sledge__scroll-area-corner"})]})]}),Js="",Zs=({width:e,height:i,rounded:s,color:l,animationDuration:n="8s",disableAnimation:d=!1,style:r={},className:a="",...o})=>t.jsx("div",{className:`sledge__skeleton-item ${a} ${d?"":"sledge__skeleton-item-animation"}`,style:{width:e,height:i,WebkitAnimationDuration:n,animationDuration:n,...r},"data-skeleton-rounded":s,"data-skeleton-color":l,...o}),Ks=({count:e,type:i})=>{let s=[];for(let l=0;l<e;l++)s.push(t.jsxs("div",{className:"sledge__product-grid-card",children:[t.jsxs("div",{className:"sledge__product-grid-content",children:[t.jsxs("div",{className:"sledge__product-grid-card-image sledge__skeleton-product-grid-card-image",children:[t.jsx("div",{className:"sledge-wishlist__trigger-block",children:t.jsx(Zs,{width:"40px",height:"40px",color:"grey-300",rounded:"sm",disableAnimation:!0})}),t.jsx(Zs,{width:"100%",height:"100%",color:"grey-100",rounded:"md"})]}),t.jsxs("div",{className:"sledge__product-grid-card-desc",children:[t.jsxs("div",{className:"sledge__product-grid-card-title",children:[t.jsx(Zs,{width:"134px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"15s"}),t.jsx(Zs,{width:"80px",height:"28px",color:"grey-100",rounded:"md",animationDuration:"20s"})]}),t.jsx("div",{className:"sledge__product-grid-card-text",children:t.jsx(Zs,{width:"190px",height:"46px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{marginBottom:"16px"}})})]})]}),t.jsx("div",{className:"sledge__product-grid-button-wrapper",children:t.jsx(Zs,{width:"117px",height:"40px",color:"grey-100",rounded:"md",animationDuration:"15s"})})]},l));return t.jsx("div",{className:"sledge__product-grid sledge__skeleton-product-grid sledge__skeleton-pointer-events-none","data-grid-type":i,children:s})},Ys=({count:e,type:i,gridItemHeights:s=[]})=>{let l=[];for(let n=0;n<e;n++)l.push(t.jsx("div",{className:"sledge-product-review__widget-review-card",children:t.jsx(Zs,{width:"100%",height:"list"===i||"grid"===i&&!(null==s?void 0:s.length)?"111px":s[n],color:"grey-100",rounded:"md",animationDuration:"list"===i?"2.5s":"8s"})},n));return t.jsx(ee,{columnsCountBreakPoints:"grid"===i?{350:1,750:3,1024:4}:{350:1},className:"sledge-product-review__widget-review-grid sledge__skeleton-review-grid sledge__skeleton-pointer-events-none",children:t.jsx(te,{gutter:"30px",children:l})})},Xs=({count:e})=>{let i=[];for(let s=0;s<e;s++)i.push(t.jsxs("div",{className:"sledge__collection-grid-card",children:[t.jsx("div",{className:"sledge__collection-grid-card-image",children:t.jsx(Zs,{width:"246px",height:"246px",color:"grey-300",rounded:"md"})}),t.jsxs("div",{className:"sledge__collection-grid-card-content",children:[t.jsxs("div",{className:"sledge__collection-grid-card-text",children:[t.jsx("div",{className:"sledge__collection-grid-card-content-title",children:t.jsx(Zs,{width:"100%",height:"70px",color:"grey-300",rounded:"lg"})}),t.jsx("div",{className:"sledge__collection-grid-card-content-description",children:t.jsx(Zs,{width:"100%",height:"47px",color:"grey-300",rounded:"md",style:{maxWidth:"357px"}})})]}),t.jsx("div",{className:"sledge__collection-grid-card-content-button-wrapper",children:t.jsx(Zs,{width:"100%",height:"40px",color:"grey-300",rounded:"md",animationDuration:"20s",style:{maxWidth:"117px"}})})]})]},s));return t.jsx("div",{className:"sledge__collection-grid sledge__skeleton-collection-grid sledge__skeleton-pointer-events-none",children:i})},Qs=({count:e})=>{let i=[];for(let s=0;s<e;s++)i.push(t.jsxs("div",{className:"sledge__page-grid-card",children:[t.jsx("div",{className:"sledge__page-grid-card-image",children:t.jsx(Zs,{width:"100%",height:"100%",color:"grey-300",rounded:"md",animationDuration:"13s",style:{borderTopRightRadius:0,borderBottomRightRadius:0}})}),t.jsxs("div",{className:"sledge__page-grid-card-content",children:[t.jsx("div",{className:"sledge__page-grid-card-content-title",children:t.jsx(Zs,{width:"100%",height:"40px",color:"grey-300",rounded:"md",animationDuration:"6s"})}),t.jsx("div",{className:"sledge__page-grid-card-content-description",children:t.jsx(Zs,{width:"100%",height:"40px",color:"grey-300",rounded:"md",animationDuration:"17s",style:{maxWidth:"115px"}})})]})]},s));return t.jsx("div",{className:"sledge__page-grid sledge__skeleton-page-grid sledge__skeleton-pointer-events-none",children:i})},el=({count:e})=>{let i=[];for(let s=0;s<e;s++)i.push(t.jsx("div",{className:"sledge__blog-grid-card",children:t.jsxs("div",{className:"sledge__blog-grid-content",children:[t.jsx("div",{className:"sledge__blog-grid-card-image",children:t.jsx(Zs,{width:"100%",height:"100%",color:"grey-100",rounded:"md",animationDuration:"10s"})}),t.jsxs("div",{className:"sledge__blog-grid-card-desc",children:[t.jsx(Zs,{width:"100%",height:"28px",color:"grey-100",rounded:"md",style:{maxWidth:"242px",marginTop:"26px",marginBottom:"12px"}}),t.jsx(Zs,{width:"100%",height:"28px",color:"grey-100",rounded:"md",animationDuration:"23s",style:{maxWidth:"80px",marginBottom:"27px"}}),t.jsx(Zs,{width:"100%",height:"80px",color:"grey-100",rounded:"md",animationDuration:"13s",style:{maxWidth:"190px",marginBottom:"27px"}}),t.jsx(Zs,{width:"100%",height:"40px",color:"grey-100",rounded:"md",animationDuration:"20s",style:{maxWidth:"117px"}})]})]})},s));return t.jsx("div",{className:"sledge__blog-grid sledge__skeleton-blog-grid sledge__skeleton-pointer-events-none",children:i})},tl={Item:Zs,ReviewGrid:Ys,ProductGrid:Ks,CollectionGrid:Xs,PageGrid:Qs,BlogGrid:el},il="color: white; background: black; border: 1px solid white; padding: 2px 5px; border-radius: 350px;";fe((()=>{let e=document.querySelector(`script[id="${Le}"]`);const t=null==e?void 0:e.getAttribute(Te.GLOBAL.API_KEY),i=null==e?void 0:e.getAttribute(Te.GLOBAL.INSTANT_SEARCH_API_KEY),s=null==e?void 0:e.getAttribute(Te.GLOBAL.USER_ID),l=null==e?void 0:e.getAttribute(Te.GLOBAL.USER_EMAIL),n=null==e?void 0:e.getAttribute(Te.GLOBAL.USER_FULLNAME);He({API_KEY:t||"",INSTANT_SEARCH_API_KEY:i||"",USER_ID:s||"",USER_EMAIL:l||"",USER_FULLNAME:n||""}).then((e=>{var t,i;(null==(t=null==e?void 0:e.data)?void 0:t.token)?($e(),ze(),Ke(),Be("wishlist").then((e=>{var t;200===(null==(t=null==e?void 0:e.status)?void 0:t.code)?(localStorage.setItem(Ee.WISHLIST_SETTING,JSON.stringify(e)),Is()):console.error("%cSledge",il,"Error wishlist app settings")})),Be("review").then((e=>{var t;200===(null==(t=null==e?void 0:e.status)?void 0:t.code)?(localStorage.setItem(Ee.PRODUCT_REVIEW_SETTING,JSON.stringify(e)),hi()):console.error("%cSledge",il,"Error product review app settings")})),Be("instantsearch").then((e=>{var t;200===(null==(t=null==e?void 0:e.status)?void 0:t.code)?(localStorage.setItem(Ee.INSTANT_SEARCH_SETTING,JSON.stringify(e)),Ui()):console.error("%cSledge",il,"Error instant search app settings")}))):console.error("%cSledge",il,`${(null==(i=e.status)?void 0:i.code)?e.status.message:e}`)}))}));