hasting-swatchcart-module 1.0.29 → 1.0.31
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.
- package/dist/assets/index.css +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/cdn/main.js +68 -61
- package/dist/cdn/src/app/main.d.ts +0 -1
- package/dist/main.cjs +15 -15
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +68 -61
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const D=require("react"),Vt=require("react-dom"),m=require("react/jsx-runtime"),Ze=require("@reduxjs/toolkit"),Tn=require("react-redux");function Au(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Au(D),Su=Au(Vt);function Nu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jt={},wi;function vf(){if(wi)return Jt;wi=1;var e=Vt;if(process.env.NODE_ENV==="production")Jt.createRoot=e.createRoot,Jt.hydrateRoot=e.hydrateRoot;else{var t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Jt.createRoot=function(n,r){t.usingClientEntryPoint=!0;try{return e.createRoot(n,r)}finally{t.usingClientEntryPoint=!1}},Jt.hydrateRoot=function(n,r,a){t.usingClientEntryPoint=!0;try{return e.hydrateRoot(n,r,a)}finally{t.usingClientEntryPoint=!1}}}return Jt}var wf=vf();const tt={UI:"UI",FETCH_DATA_PRODUCT:"FETCH_DATA_PRODUCT",FETCH_DATA_ALL:"FETCH_DATA_ALL"},kf={Finish:"Material",Color:"Color",Look:"Look"},Of=(e,t)=>e.toLowerCase()===t.toLowerCase();class Fr{static getMaterialsValuesFromOptions(t){if(t?.length)return t.reduce((n,r)=>{const a=Array.isArray(r.values)&&r.values.length?r.values:Array.isArray(r.valuesArray)&&r.valuesArray.length?r.valuesArray:void 0;if(!a)return n;const s=r.metadata?.Name??r.metadata?.Label??r.value??r.label??"without_name",i=a.map(o=>({...o,parentName:s}));return n.push(...i),n},[]).sort((n,r)=>(n.name?.toLowerCase()??"").localeCompare(r.name?.toLowerCase()??""))}static getUniqueByAssetId(t){const n=new Set;return t.filter(r=>n.has(r.assetId)?!1:(n.add(r.assetId),!0))}static normalizeToArray(t,n=!0){return t?Array.isArray(t)?t.map(r=>r.trim()).filter(Boolean):(n?t.split(","):[t]).map(r=>r.trim()).filter(Boolean):[]}static mapFiltersFromValues(t,n){return Object.keys(n).map(r=>{const a=kf[r],i=n[r].map(o=>{let l=0;for(const c of t){const d=Array.isArray(c.values)?c.values:[];for(const f of d){const p=this.normalizeToArray(f.metadata?.[a]);l+=p.filter(h=>Of(h,o)).length}}return{filterKey:o,filterCount:l}});return{filterType:r,filters:i}})}static getPositiveSelectedFilers(t){return t.map(n=>({filterName:n.filterType,filterKeys:n.filters.filter(r=>r.filterCount!==0).map(r=>r.filterKey)})).filter(n=>n.filterKeys.length>0)}}const Iu=e=>Array.from(new Set(e)),vu={GET_PRODUCT_LIST:()=>"products",GET_PRODUCT_DETAILS:e=>`products/${e}`},Rf={VITE_SWATH_CART_PRODUCTION_URL:"https://hbswatchcart.vivid3d.tech"},{VITE_SWATH_CART_PRODUCTION_URL:wu}=Rf,Lf=async()=>{try{const e=`${wu}/${vu.GET_PRODUCT_LIST()}?pageSize=500`,t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Request failed with status ${t.status}`);const n=await t.json();if(Array.isArray(n))throw new Error("API returned an array, expected IProductListResponse object");return n}catch(e){throw console.error("❌ Fetch error:",e),e}},Pf=async({assetId:e})=>{try{const t=`${wu}/${vu.GET_PRODUCT_DETAILS(e)}`,n=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Request failed with status ${n.status}`);return await n.json()}catch(t){throw console.error("❌ Fetch error:",t),t}};function ku(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=ku(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function yt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=ku(e))&&(r&&(r+=" "),r+=t);return r}function Df(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Df(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
2
|
-
`);var or=e=>typeof e=="number"&&!isNaN(e),jt=e=>typeof e=="string",_t=e=>typeof e=="function",Mf=e=>jt(e)||or(e),Za=e=>jt(e)||_t(e)?e:null,Bf=(e,t)=>e===!1||or(e)&&e>0?e:t,Ja=e=>D.isValidElement(e)||jt(e)||_t(e)||or(e);function Ff(e,t,n=300){let{scrollHeight:r,style:a}=e;requestAnimationFrame(()=>{a.minHeight="initial",a.height=r+"px",a.transition=`all ${n}ms`,requestAnimationFrame(()=>{a.height="0",a.padding="0",a.margin="0",setTimeout(t,n)})})}function Hf({enter:e,exit:t,appendPosition:n=!1,collapse:r=!0,collapseDuration:a=300}){return function({children:s,position:i,preventExitTransition:o,done:l,nodeRef:c,isIn:d,playToast:f}){let p=n?`${e}--${i}`:e,h=n?`${t}--${i}`:t,x=D.useRef(0);return D.useLayoutEffect(()=>{let g=c.current,A=p.split(" "),E=_=>{_.target===c.current&&(f(),g.removeEventListener("animationend",E),g.removeEventListener("animationcancel",E),x.current===0&&_.type!=="animationcancel"&&g.classList.remove(...A))};g.classList.add(...A),g.addEventListener("animationend",E),g.addEventListener("animationcancel",E)},[]),D.useEffect(()=>{let g=c.current,A=()=>{g.removeEventListener("animationend",A),r?Ff(g,l,a):l()};d||(o?A():(x.current=1,g.className+=` ${h}`,g.addEventListener("animationend",A)))},[d]),D.createElement(D.Fragment,null,s)}}function ki(e,t){return{content:Ou(e.content,e.props),containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,reason:e.removalReason,status:t}}function Ou(e,t,n=!1){return D.isValidElement(e)&&!jt(e.type)?D.cloneElement(e,{closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:n}):_t(e)?e({closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:n}):e}function Uf({closeToast:e,theme:t,ariaLabel:n="close"}){return D.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:r=>{r.stopPropagation(),e(!0)},"aria-label":n},D.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},D.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function jf({delay:e,isRunning:t,closeToast:n,type:r="default",hide:a,className:s,controlledProgress:i,progress:o,rtl:l,isIn:c,theme:d}){let f=a||i&&o===0,p={animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};i&&(p.transform=`scaleX(${o})`);let h=yt("Toastify__progress-bar",i?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${d}`,`Toastify__progress-bar--${r}`,{"Toastify__progress-bar--rtl":l}),x=_t(s)?s({rtl:l,type:r,defaultClassName:h}):yt(h,s),g={[i&&o>=1?"onTransitionEnd":"onAnimationEnd"]:i&&o<1?null:()=>{c&&n()}};return D.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":f},D.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${d} Toastify__progress-bar--${r}`}),D.createElement("div",{role:"progressbar","aria-hidden":f?"true":"false","aria-label":"notification timer",className:x,style:p,...g}))}var zf=1,Ru=()=>`${zf++}`;function Yf(e,t,n){let r=1,a=0,s=[],i=[],o=t,l=new Map,c=new Set,d=_=>(c.add(_),()=>c.delete(_)),f=()=>{i=Array.from(l.values()),c.forEach(_=>_())},p=({containerId:_,toastId:N,updateId:k})=>{let L=_?_!==e:e!==1,v=l.has(N)&&k==null;return L||v},h=(_,N)=>{l.forEach(k=>{var L;(N==null||N===k.props.toastId)&&((L=k.toggle)==null||L.call(k,_))})},x=_=>{var N,k;(k=(N=_.props)==null?void 0:N.onClose)==null||k.call(N,_.removalReason),_.isActive=!1},g=_=>{if(_==null)l.forEach(x);else{let N=l.get(_);N&&x(N)}f()},A=()=>{a-=s.length,s=[]},E=_=>{var N,k;let{toastId:L,updateId:v}=_.props,R=v==null;_.staleId&&l.delete(_.staleId),_.isActive=!0,l.set(L,_),f(),n(ki(_,R?"added":"updated")),R&&((k=(N=_.props).onOpen)==null||k.call(N))};return{id:e,props:o,observe:d,toggle:h,removeToast:g,toasts:l,clearQueue:A,buildToast:(_,N)=>{if(p(N))return;let{toastId:k,updateId:L,data:v,staleId:R,delay:P}=N,q=L==null;q&&a++;let K={...o,style:o.toastStyle,key:r++,...Object.fromEntries(Object.entries(N).filter(([z,$])=>$!=null)),toastId:k,updateId:L,data:v,isIn:!1,className:Za(N.className||o.toastClassName),progressClassName:Za(N.progressClassName||o.progressClassName),autoClose:N.isLoading?!1:Bf(N.autoClose,o.autoClose),closeToast(z){l.get(k).removalReason=z,g(k)},deleteToast(){let z=l.get(k);if(z!=null){if(n(ki(z,"removed")),l.delete(k),a--,a<0&&(a=0),s.length>0){E(s.shift());return}f()}}};K.closeButton=o.closeButton,N.closeButton===!1||Ja(N.closeButton)?K.closeButton=N.closeButton:N.closeButton===!0&&(K.closeButton=Ja(o.closeButton)?o.closeButton:!0);let U={content:_,props:K,staleId:R};o.limit&&o.limit>0&&a>o.limit&&q?s.push(U):or(P)?setTimeout(()=>{E(U)},P):E(U)},setProps(_){o=_},setToggle:(_,N)=>{let k=l.get(_);k&&(k.toggle=N)},isToastActive:_=>{var N;return(N=l.get(_))==null?void 0:N.isActive},getSnapshot:()=>i}}var Oe=new Map,tr=[],es=new Set,Wf=e=>es.forEach(t=>t(e)),Lu=()=>Oe.size>0;function Vf(){tr.forEach(e=>Du(e.content,e.options)),tr=[]}var $f=(e,{containerId:t})=>{var n;return(n=Oe.get(t||1))==null?void 0:n.toasts.get(e)};function Pu(e,t){var n;if(t)return!!((n=Oe.get(t))!=null&&n.isToastActive(e));let r=!1;return Oe.forEach(a=>{a.isToastActive(e)&&(r=!0)}),r}function qf(e){if(!Lu()){tr=tr.filter(t=>e!=null&&t.options.toastId!==e);return}if(e==null||Mf(e))Oe.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=Oe.get(e.containerId);t?t.removeToast(e.id):Oe.forEach(n=>{n.removeToast(e.id)})}}var Gf=(e={})=>{Oe.forEach(t=>{t.props.limit&&(!e.containerId||t.id===e.containerId)&&t.clearQueue()})};function Du(e,t){Ja(e)&&(Lu()||tr.push({content:e,options:t}),Oe.forEach(n=>{n.buildToast(e,t)}))}function Xf(e){var t;(t=Oe.get(e.containerId||1))==null||t.setToggle(e.id,e.fn)}function Mu(e,t){Oe.forEach(n=>{(t==null||!(t!=null&&t.containerId)||t?.containerId===n.id)&&n.toggle(e,t?.id)})}function Kf(e){let t=e.containerId||1;return{subscribe(n){let r=Yf(t,e,Wf);Oe.set(t,r);let a=r.observe(n);return Vf(),()=>{a(),Oe.delete(t)}},setProps(n){var r;(r=Oe.get(t))==null||r.setProps(n)},getSnapshot(){var n;return(n=Oe.get(t))==null?void 0:n.getSnapshot()}}}function Qf(e){return es.add(e),()=>{es.delete(e)}}function Zf(e){return e&&(jt(e.toastId)||or(e.toastId))?e.toastId:Ru()}function ur(e,t){return Du(e,t),t.toastId}function Qr(e,t){return{...t,type:t&&t.type||e,toastId:Zf(t)}}function Zr(e){return(t,n)=>ur(t,Qr(e,n))}function de(e,t){return ur(e,Qr("default",t))}de.loading=(e,t)=>ur(e,Qr("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t}));function Jf(e,{pending:t,error:n,success:r},a){let s;t&&(s=jt(t)?de.loading(t,a):de.loading(t.render,{...a,...t}));let i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},o=(c,d,f)=>{if(d==null){de.dismiss(s);return}let p={type:c,...i,...a,data:f},h=jt(d)?{render:d}:d;return s?de.update(s,{...p,...h}):de(h.render,{...p,...h}),f},l=_t(e)?e():e;return l.then(c=>o("success",r,c)).catch(c=>o("error",n,c)),l}de.promise=Jf;de.success=Zr("success");de.info=Zr("info");de.error=Zr("error");de.warning=Zr("warning");de.warn=de.warning;de.dark=(e,t)=>ur(e,Qr("default",{theme:"dark",...t}));function eh(e){qf(e)}de.dismiss=eh;de.clearWaitingQueue=Gf;de.isActive=Pu;de.update=(e,t={})=>{let n=$f(e,t);if(n){let{props:r,content:a}=n,s={delay:100,...r,...t,toastId:t.toastId||e,updateId:Ru()};s.toastId!==e&&(s.staleId=e);let i=s.render||a;delete s.render,ur(i,s)}};de.done=e=>{de.update(e,{progress:1})};de.onChange=Qf;de.play=e=>Mu(!0,e);de.pause=e=>Mu(!1,e);function th(e){var t;let{subscribe:n,getSnapshot:r,setProps:a}=D.useRef(Kf(e)).current;a(e);let s=(t=D.useSyncExternalStore(n,r,r))==null?void 0:t.slice();function i(o){if(!s)return[];let l=new Map;return e.newestOnTop&&s.reverse(),s.forEach(c=>{let{position:d}=c.props;l.has(d)||l.set(d,[]),l.get(d).push(c)}),Array.from(l,c=>o(c[0],c[1]))}return{getToastToRender:i,isToastActive:Pu,count:s?.length}}function nh(e){let[t,n]=D.useState(!1),[r,a]=D.useState(!1),s=D.useRef(null),i=D.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:o,pauseOnHover:l,closeToast:c,onClick:d,closeOnClick:f}=e;Xf({id:e.toastId,containerId:e.containerId,fn:n}),D.useEffect(()=>{if(e.pauseOnFocusLoss)return p(),()=>{h()}},[e.pauseOnFocusLoss]);function p(){document.hasFocus()||E(),window.addEventListener("focus",A),window.addEventListener("blur",E)}function h(){window.removeEventListener("focus",A),window.removeEventListener("blur",E)}function x(R){if(e.draggable===!0||e.draggable===R.pointerType){_();let P=s.current;i.canCloseOnClick=!0,i.canDrag=!0,P.style.transition="none",e.draggableDirection==="x"?(i.start=R.clientX,i.removalDistance=P.offsetWidth*(e.draggablePercent/100)):(i.start=R.clientY,i.removalDistance=P.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function g(R){let{top:P,bottom:q,left:K,right:U}=s.current.getBoundingClientRect();R.nativeEvent.type!=="touchend"&&e.pauseOnHover&&R.clientX>=K&&R.clientX<=U&&R.clientY>=P&&R.clientY<=q?E():A()}function A(){n(!0)}function E(){n(!1)}function _(){i.didMove=!1,document.addEventListener("pointermove",k),document.addEventListener("pointerup",L)}function N(){document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",L)}function k(R){let P=s.current;if(i.canDrag&&P){i.didMove=!0,t&&E(),e.draggableDirection==="x"?i.delta=R.clientX-i.start:i.delta=R.clientY-i.start,i.start!==R.clientX&&(i.canCloseOnClick=!1);let q=e.draggableDirection==="x"?`${i.delta}px, var(--y)`:`0, calc(${i.delta}px + var(--y))`;P.style.transform=`translate3d(${q},0)`,P.style.opacity=`${1-Math.abs(i.delta/i.removalDistance)}`}}function L(){N();let R=s.current;if(i.canDrag&&i.didMove&&R){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance){a(!0),e.closeToast(!0),e.collapseAll();return}R.style.transition="transform 0.2s, opacity 0.2s",R.style.removeProperty("transform"),R.style.removeProperty("opacity")}}let v={onPointerDown:x,onPointerUp:g};return o&&l&&(v.onMouseEnter=E,e.stacked||(v.onMouseLeave=A)),f&&(v.onClick=R=>{d&&d(R),i.canCloseOnClick&&c(!0)}),{playToast:A,pauseToast:E,isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:v}}var rh=typeof window<"u"?D.useLayoutEffect:D.useEffect,Jr=({theme:e,type:t,isLoading:n,...r})=>D.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...r});function ah(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function sh(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function ih(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function oh(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function uh(){return D.createElement("div",{className:"Toastify__spinner"})}var ts={info:sh,warning:ah,success:ih,error:oh,spinner:uh},lh=e=>e in ts;function ch({theme:e,type:t,isLoading:n,icon:r}){let a=null,s={theme:e,type:t};return r===!1||(_t(r)?a=r({...s,isLoading:n}):D.isValidElement(r)?a=D.cloneElement(r,s):n?a=ts.spinner():lh(t)&&(a=ts[t](s))),a}var dh=e=>{let{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:a,playToast:s}=nh(e),{closeButton:i,children:o,autoClose:l,onClick:c,type:d,hideProgressBar:f,closeToast:p,transition:h,position:x,className:g,style:A,progressClassName:E,updateId:_,role:N,progress:k,rtl:L,toastId:v,deleteToast:R,isIn:P,isLoading:q,closeOnClick:K,theme:U,ariaLabel:z}=e,$=yt("Toastify__toast",`Toastify__toast-theme--${U}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":L},{"Toastify__toast--close-on-click":K}),Y=_t(g)?g({rtl:L,position:x,type:d,defaultClassName:$}):yt($,g),F=ch(e),X=!!k||!l,Q={closeToast:p,type:d,theme:U},B=null;return i===!1||(_t(i)?B=i(Q):D.isValidElement(i)?B=D.cloneElement(i,Q):B=Uf(Q)),D.createElement(h,{isIn:P,done:R,position:x,preventExitTransition:n,nodeRef:r,playToast:s},D.createElement("div",{id:v,tabIndex:0,onClick:c,"data-in":P,className:Y,...a,style:A,ref:r,...P&&{role:N,"aria-label":z}},F!=null&&D.createElement("div",{className:yt("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!q})},F),Ou(o,e,!t),B,!e.customProgressBar&&D.createElement(jf,{..._&&!X?{key:`p-${_}`}:{},rtl:L,theme:U,delay:l,isRunning:t,isIn:P,closeToast:p,hide:f,type:d,className:E,controlledProgress:X,progress:k||0})))},fh=(e,t=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}),Bu=Hf(fh("bounce",!0)),hh={position:"top-right",transition:Bu,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:e=>e.altKey&&e.code==="KeyT"};function mh(e){let t={...hh,...e},n=e.stacked,[r,a]=D.useState(!0),s=D.useRef(null),{getToastToRender:i,isToastActive:o,count:l}=th(t),{className:c,style:d,rtl:f,containerId:p,hotKeys:h}=t;function x(A){let E=yt("Toastify__toast-container",`Toastify__toast-container--${A}`,{"Toastify__toast-container--rtl":f});return _t(c)?c({position:A,rtl:f,defaultClassName:E}):yt(E,Za(c))}function g(){n&&(a(!0),de.play())}return rh(()=>{var A;if(n){let E=s.current.querySelectorAll('[data-in="true"]'),_=12,N=(A=t.position)==null?void 0:A.includes("top"),k=0,L=0;Array.from(E).reverse().forEach((v,R)=>{let P=v;P.classList.add("Toastify__toast--stacked"),R>0&&(P.dataset.collapsed=`${r}`),P.dataset.pos||(P.dataset.pos=N?"top":"bot");let q=k*(r?.2:1)+(r?0:_*R);P.style.setProperty("--y",`${N?q:q*-1}px`),P.style.setProperty("--g",`${_}`),P.style.setProperty("--s",`${1-(r?L:0)}`),k+=P.offsetHeight,L+=.025})}},[r,l,n]),D.useEffect(()=>{function A(E){var _;let N=s.current;h(E)&&((_=N.querySelector('[tabIndex="0"]'))==null||_.focus(),a(!1),de.pause()),E.key==="Escape"&&(document.activeElement===N||N!=null&&N.contains(document.activeElement))&&(a(!0),de.play())}return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[h]),D.createElement("section",{ref:s,className:"Toastify",id:p,onMouseEnter:()=>{n&&(a(!1),de.pause())},onMouseLeave:g,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":t["aria-label"]},i((A,E)=>{let _=E.length?{...d}:{...d,pointerEvents:"none"};return D.createElement("div",{tabIndex:-1,className:x(A),"data-stacked":n,style:_,key:`c-${A}`},E.map(({content:N,props:k})=>D.createElement(dh,{...k,stacked:n,collapseAll:g,isIn:o(k.toastId,k.containerId),key:`t-${k.key}`},N)))}))}const Vn=Ze.createAsyncThunk("swatches/getSelectedProductThunk",async({assetId:e},{rejectWithValue:t})=>{try{return await Pf({assetId:e})}catch(n){return console.error(n.message),de("Failed to load product"),t(n.message)}}),Re=5,ph={listAttributes:[],productElementOptions:[],materialSelectState:{Finish:[],Color:[],Look:[]},allMaterialsValues:[],selectedMaterials:[],selectedProduct:null,isLoadingSelectedProduct:!1,isOpenMultiProductCart:!1},gh=e=>e.reduce((t,n)=>t+n.count,0),Fu=Ze.createSlice({name:"swatches",initialState:ph,reducers:{setMaterialSelect(e,t){const{filterName:n,values:r}=t.payload;if(r.length===0){e.materialSelectState[n]=[];return}e.materialSelectState[n]=Iu(r)},setPanelFilter(e,t){const n=t.payload.attributes;if(n.length){const r=Fr.getMaterialsValuesFromOptions(n);r?.length&&(e.allMaterialsValues=r)}},clearMaterialFilter:(e,t)=>{e.materialSelectState[t.payload]=[]},clearAllMaterialFilters:e=>{e.materialSelectState={Finish:[],Color:[],Look:[]}},setAllMaterialsOptions:(e,t)=>{const{allMaterialValues:n,productElementOptions:r}=t.payload;n?.length&&(e.allMaterialsValues=n),r?.length&&(e.productElementOptions=r)},setSelectedMaterial(e,t){const{materialCount:n,selectedMaterial:r,selectedMaterials:a,limitCb:s}=t.payload;if(!r)return;const i=l=>l.metadata?.label===r.metadata?.label&&l.parentName===r.parentName,o=a?.some(i);!o&&n>=5&&s&&s(),o?e.selectedMaterials=a.filter(l=>!i(l)):n<5&&(e.selectedMaterials=[...a,r])},resetSelectedMaterials(e){e.selectedMaterials=[]},setSelectedProduct(e,t){e.selectedProduct=t.payload},deleteSelectedProduct(e){e.selectedProduct=null},setIsOpenMultiProductCart(e,t){e.isOpenMultiProductCart=t.payload},removeItem(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial;e.selectedMaterials=e.selectedMaterials.filter(a=>!(a.metadata?.label===n?.label&&a.parentName===r))},increment(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,a=e.selectedMaterials.find(s=>s.metadata?.label===n?.label&&s.parentName===r);a&&gh(e.selectedMaterials)<Re&&(a.count+=1)},decrement(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,a=e.selectedMaterials.find(s=>s.metadata?.label===n?.label&&s.parentName===r);a&&a.count>1&&(a.count-=1)},setCount(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,{next:a}=t.payload,s=e.selectedMaterials.find(c=>c.metadata?.label===n?.label&&c.parentName===r);if(!s)return;const i=Math.max(1,Math.floor(a)),o=e.selectedMaterials.filter(c=>!(c.metadata?.label===n?.label&&c.parentName===r)).reduce((c,d)=>c+d.count,0),l=Math.max(1,Re-o);s.count=Math.min(i,l)}},extraReducers:e=>{e.addCase(Vn.pending,t=>{t.isLoadingSelectedProduct=!0}).addCase(Vn.fulfilled,t=>{t.isLoadingSelectedProduct=!1}).addCase(Vn.rejected,t=>{t.isLoadingSelectedProduct=!1})}}),Hu=Fu.reducer,{setMaterialSelect:ea,setAllMaterialsOptions:ns,setPanelFilter:_a,setSelectedMaterial:ta,clearMaterialFilter:sA,clearAllMaterialFilters:bh,setSelectedProduct:Eh,deleteSelectedProduct:Th,setIsOpenMultiProductCart:Uu,resetSelectedMaterials:iA,removeItem:xh,increment:yh,decrement:_h,setCount:oA}=Fu.actions,Ch={items:[]},ju=Ze.createSlice({name:"cart",initialState:Ch,reducers:{setCartItems(e,t){e.items=t.payload},clear(e){e.items=[]}}}),{setCartItems:Ah,clear:uA}=ju.actions,zu=ju.reducer,$n=Ze.createAsyncThunk("multiProducts/getProductListThunk",async(e,{rejectWithValue:t})=>{try{return await Lf()}catch(n){return console.error(n?.message??n),t(n?.message??"Unknown error")}}),Sh={items:[],productList:[],isLoadingProductList:!1,selectedProduct:null,activeMultiCartProduct:null,totalCount:0};function Nh(e,t,n){let r=e.items.find(a=>a.assetId===t);return r?n&&!r.name&&(r.name=n):(r={assetId:t,name:n??"",items:[]},e.items.push(r)),r}const Ca=(e,t)=>e.items.findIndex(n=>n.assetId===t),Oi=(e,t,n,r)=>t===-1?-1:e.items[t].items.findIndex(a=>a.metadata?.label===n&&a.parentName===r),Yu=Ze.createSlice({name:"multiProduct",initialState:Sh,reducers:{setCartForProduct(e,t){const{assetId:n}=t.payload,r=e.items.findIndex(a=>a.assetId===n);r>=0?e.items[r]=t.payload:e.items.push(t.payload)},setActiveMultiCartProduct(e,t){e.activeMultiCartProduct=t.payload},setMultiCartItems(e,t){const{assetId:n,items:r,name:a}=t.payload;if(!r||r.length===0){const i=e.items.findIndex(o=>o.assetId===n);i!==-1&&e.items.splice(i,1);return}const s=Nh(e,n,a);s.items=r},incrementMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n),i=Oi(e,s,r,a);i!==-1&&(e.items[s].items[i].count+=1)},decrementMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n),i=Oi(e,s,r,a);if(i!==-1){const o=e.items[s].items[i];o.count>1&&(o.count-=1)}},removeMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n);if(s===-1)return;const i=e.items[s].items.filter(o=>!(o.metadata?.label===r&&o.parentName===a));e.items[s].items=i},clear(e){e.items=[]}},extraReducers:e=>{e.addCase($n.pending,t=>{t.isLoadingProductList=!0}).addCase($n.fulfilled,(t,n)=>{t.productList=n.payload.rows,t.isLoadingProductList=!1}).addCase($n.rejected,t=>{t.isLoadingProductList=!1})}}),{setCartForProduct:lA,setMultiCartItems:rs,incrementMultiProductItem:Ih,decrementMultiProductItem:vh,removeMultiProductItem:wh,clear:cA,setActiveMultiCartProduct:as}=Yu.actions,Wu=Yu.reducer,kh=Ze.combineReducers({swatches:Hu,cart:zu,multiProductCart:Wu}),Oh={},{NODE_ENV:Rh}=Oh;Ze.configureStore({reducer:kh,middleware:e=>e({thunk:!0,serializableCheck:{ignoredActionPaths:["meta.limitCb","payload.limitCb"],ignoredPaths:[]}}),devTools:Rh!=="production"});const Pe=Tn.useDispatch.withTypes(),oe=Tn.useSelector.withTypes(),lr=e=>e.swatches.allMaterialsValues,xn=e=>e.swatches.materialSelectState,Lh=e=>e.swatches.productElementOptions,$t=e=>e.swatches.selectedMaterials,Vu=e=>e.swatches.isLoadingSelectedProduct,Ph=e=>e.swatches.isOpenMultiProductCart,na=e=>e.swatches.selectedProduct,$u=6.5,qu=({materials:e,containerStyles:t="flex flex-col gap-[8px] text-[12px]/snug p-[var(--sm-padding)] border-t border-solid border-[var(--border)] sm:gap-[12px] shadow-[0_-2px_10px_rgba(40,40,40,0.10)]"})=>{const n="flex flex-row justify-between items-center",r=D.useMemo(()=>e.reduce((a,s)=>a+(s.count??0),0)*$u,[e]);return m.jsxs("div",{className:t,children:[m.jsxs("div",{className:n,children:[m.jsx("span",{children:"Subtotal"}),m.jsxs("span",{children:["$",r]})]}),m.jsxs("div",{className:`${n} text-[var(--main-accent-color)]`,children:[m.jsx("span",{children:"Savings"}),m.jsxs("span",{children:["-$",r]})]}),m.jsxs("div",{className:`${n} text-sm font-medium`,children:[m.jsx("span",{children:"Total"}),m.jsx("span",{children:"$0"})]})]})},Gu=({children:e,disabled:t,...n})=>m.jsx("button",{className:`w-full bg-[var(--main-accent-color)] text-white py-3 rounded-full font-bold transition-colors duration-300 ${t?"bg-gray-400 text-gray-200 cursor-not-allowed opacity-70":"cursor-pointer hover:opacity-90"}`,...n,children:e}),yn=e=>e.multiProductCart.items,Dh=e=>e.multiProductCart.productList,Mh=e=>e.multiProductCart.isLoadingProductList;class zt{static getImage(t){const n=t?.metadata?.Image||t?.metadata?.image;return n?`https://preview.threekit.com${n}`:void 0}static getValueLabel(t){return t?.metadata?.label||t?.metadata?.Label||t?.name||"Unnamed"}static getZoomIconColor(t){return t?.metadata?.zoomIconColor||t?.metadata?.zoomIconColor||null}static getHexColor(t){return t?.metadata?.hex||t?.metadata?.Hex||null}static getAttributeLabel(t){return t?.metadata?.label||t?.metadata?.Label||t?.name||"Unnamed"}}function Le(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function Ri(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ra(...e){return t=>{let n=!1;const r=e.map(a=>{const s=Ri(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():Ri(e[a],null)}}}}function Xe(...e){return y.useCallback(ra(...e),e)}function Bh(e,t){const n=y.createContext(t),r=s=>{const{children:i,...o}=s,l=y.useMemo(()=>o,Object.values(o));return m.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function a(s){const i=y.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,a]}function aa(e,t=[]){let n=[];function r(s,i){const o=y.createContext(i),l=n.length;n=[...n,i];const c=f=>{const{scope:p,children:h,...x}=f,g=p?.[e]?.[l]||o,A=y.useMemo(()=>x,Object.values(x));return m.jsx(g.Provider,{value:A,children:h})};c.displayName=s+"Provider";function d(f,p){const h=p?.[e]?.[l]||o,x=y.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const a=()=>{const s=n.map(i=>y.createContext(i));return function(o){const l=o?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return a.scopeName=e,[r,Fh(a,...t)]}function Fh(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const i=r.reduce((o,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...o,...f}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Lt=globalThis?.document?y.useLayoutEffect:()=>{},Hh=y[" useId ".trim().toString()]||(()=>{}),Uh=0;function Or(e){const[t,n]=y.useState(Hh());return Lt(()=>{n(r=>r??String(Uh++))},[e]),e||(t?`radix-${t}`:"")}var jh=y[" useInsertionEffect ".trim().toString()]||Lt;function ws({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,i]=zh({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:a;{const d=y.useRef(e!==void 0);y.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=y.useCallback(d=>{if(o){const f=Yh(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[o,e,s,i]);return[l,c]}function zh({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),a=y.useRef(n),s=y.useRef(t);return jh(()=>{s.current=t},[t]),y.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function Yh(e){return typeof e=="function"}function Wh(e){const t=Vh(e),n=y.forwardRef((r,a)=>{const{children:s,...i}=r,o=y.Children.toArray(s),l=o.find(qh);if(l){const c=l.props.children,d=o.map(f=>f===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...i,ref:a,children:y.isValidElement(c)?y.cloneElement(c,void 0,d):null})}return m.jsx(t,{...i,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function Vh(e){const t=y.forwardRef((n,r)=>{const{children:a,...s}=n;if(y.isValidElement(a)){const i=Xh(a),o=Gh(s,a.props);return a.type!==y.Fragment&&(o.ref=r?ra(r,i):i),y.cloneElement(a,o)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $h=Symbol("radix.slottable");function qh(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$h}function Gh(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...o)=>{const l=s(...o);return a(...o),l}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function Xh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=Kh.reduce((e,t)=>{const n=Wh(`Primitive.${t}`),r=y.forwardRef((a,s)=>{const{asChild:i,...o}=a,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Qh(e,t){e&&Su.flushSync(()=>e.dispatchEvent(t))}function mn(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function Zh(e,t=globalThis?.document){const n=mn(e);y.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Jh="DismissableLayer",ss="dismissableLayer.update",e0="dismissableLayer.pointerDownOutside",t0="dismissableLayer.focusOutside",Li,Xu=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ks=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:o,...l}=e,c=y.useContext(Xu),[d,f]=y.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=y.useState({}),x=Xe(t,R=>f(R)),g=Array.from(c.layers),[A]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),E=g.indexOf(A),_=d?g.indexOf(d):-1,N=c.layersWithOutsidePointerEventsDisabled.size>0,k=_>=E,L=a0(R=>{const P=R.target,q=[...c.branches].some(K=>K.contains(P));!k||q||(a?.(R),i?.(R),R.defaultPrevented||o?.())},p),v=s0(R=>{const P=R.target;[...c.branches].some(K=>K.contains(P))||(s?.(R),i?.(R),R.defaultPrevented||o?.())},p);return Zh(R=>{_===c.layers.size-1&&(r?.(R),!R.defaultPrevented&&o&&(R.preventDefault(),o()))},p),y.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Li=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Pi(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Li)}},[d,p,n,c]),y.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Pi())},[d,c]),y.useEffect(()=>{const R=()=>h({});return document.addEventListener(ss,R),()=>document.removeEventListener(ss,R)},[]),m.jsx(Ne.div,{...l,ref:x,style:{pointerEvents:N?k?"auto":"none":void 0,...e.style},onFocusCapture:Le(e.onFocusCapture,v.onFocusCapture),onBlurCapture:Le(e.onBlurCapture,v.onBlurCapture),onPointerDownCapture:Le(e.onPointerDownCapture,L.onPointerDownCapture)})});ks.displayName=Jh;var n0="DismissableLayerBranch",r0=y.forwardRef((e,t)=>{const n=y.useContext(Xu),r=y.useRef(null),a=Xe(t,r);return y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(Ne.div,{...e,ref:a})});r0.displayName=n0;function a0(e,t=globalThis?.document){const n=mn(e),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const s=o=>{if(o.target&&!r.current){let l=function(){Ku(e0,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=l,t.addEventListener("click",a.current,{once:!0})):l()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function s0(e,t=globalThis?.document){const n=mn(e),r=y.useRef(!1);return y.useEffect(()=>{const a=s=>{s.target&&!r.current&&Ku(t0,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Pi(){const e=new CustomEvent(ss);document.dispatchEvent(e)}function Ku(e,t,n,{discrete:r}){const a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Qh(a,s):a.dispatchEvent(s)}var Aa="focusScope.autoFocusOnMount",Sa="focusScope.autoFocusOnUnmount",Di={bubbles:!1,cancelable:!0},i0="FocusScope",Os=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[o,l]=y.useState(null),c=mn(a),d=mn(s),f=y.useRef(null),p=Xe(t,g=>l(g)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let g=function(N){if(h.paused||!o)return;const k=N.target;o.contains(k)?f.current=k:vt(f.current,{select:!0})},A=function(N){if(h.paused||!o)return;const k=N.relatedTarget;k!==null&&(o.contains(k)||vt(f.current,{select:!0}))},E=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&vt(o)};document.addEventListener("focusin",g),document.addEventListener("focusout",A);const _=new MutationObserver(E);return o&&_.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",A),_.disconnect()}}},[r,o,h.paused]),y.useEffect(()=>{if(o){Bi.add(h);const g=document.activeElement;if(!o.contains(g)){const E=new CustomEvent(Aa,Di);o.addEventListener(Aa,c),o.dispatchEvent(E),E.defaultPrevented||(o0(f0(Qu(o)),{select:!0}),document.activeElement===g&&vt(o))}return()=>{o.removeEventListener(Aa,c),setTimeout(()=>{const E=new CustomEvent(Sa,Di);o.addEventListener(Sa,d),o.dispatchEvent(E),E.defaultPrevented||vt(g??document.body,{select:!0}),o.removeEventListener(Sa,d),Bi.remove(h)},0)}}},[o,c,d,h]);const x=y.useCallback(g=>{if(!n&&!r||h.paused)return;const A=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,E=document.activeElement;if(A&&E){const _=g.currentTarget,[N,k]=u0(_);N&&k?!g.shiftKey&&E===k?(g.preventDefault(),n&&vt(N,{select:!0})):g.shiftKey&&E===N&&(g.preventDefault(),n&&vt(k,{select:!0})):E===_&&g.preventDefault()}},[n,r,h.paused]);return m.jsx(Ne.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});Os.displayName=i0;function o0(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(vt(r,{select:t}),document.activeElement!==n)return}function u0(e){const t=Qu(e),n=Mi(t,e),r=Mi(t.reverse(),e);return[n,r]}function Qu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Mi(e,t){for(const n of e)if(!l0(n,{upTo:t}))return n}function l0(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c0(e){return e instanceof HTMLInputElement&&"select"in e}function vt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&c0(e)&&t&&e.select()}}var Bi=d0();function d0(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Fi(e,t),e.unshift(t)},remove(t){e=Fi(e,t),e[0]?.resume()}}}function Fi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function f0(e){return e.filter(t=>t.tagName!=="A")}var h0="Portal",Zu=y.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=y.useState(!1);Lt(()=>s(!0),[]);const i=n||a&&globalThis?.document?.body;return i?Vt.createPortal(m.jsx(Ne.div,{...r,ref:t}),i):null});Zu.displayName=h0;function m0(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var _n=e=>{const{present:t,children:n}=e,r=p0(t),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Xe(r.ref,g0(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:s}):null};_n.displayName="Presence";function p0(e){const[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[o,l]=m0(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=Tr(r.current);s.current=o==="mounted"?c:"none"},[o]),Lt(()=>{const c=r.current,d=a.current;if(d!==e){const p=s.current,h=Tr(c);e?l("MOUNT"):h==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),Lt(()=>{if(t){let c;const d=t.ownerDocument.defaultView??window,f=h=>{const g=Tr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(l("ANIMATION_END"),!a.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",c=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},p=h=>{h.target===t&&(s.current=Tr(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Tr(e){return e?.animationName||"none"}function g0(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Na=0;function Ju(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Hi()),document.body.insertAdjacentElement("beforeend",e[1]??Hi()),Na++,()=>{Na===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Na--}},[])}function Hi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lt=function(){return lt=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},lt.apply(this,arguments)};function el(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function b0(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,s;r<a;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Rr="right-scroll-bar-position",Lr="width-before-scroll-bar",E0="with-scroll-bars-hidden",T0="--removed-body-scroll-bar-size";function Ia(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function x0(e,t){var n=D.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var y0=typeof window<"u"?y.useLayoutEffect:y.useEffect,Ui=new WeakMap;function _0(e,t){var n=x0(null,function(r){return e.forEach(function(a){return Ia(a,r)})});return y0(function(){var r=Ui.get(n);if(r){var a=new Set(r),s=new Set(e),i=n.current;a.forEach(function(o){s.has(o)||Ia(o,null)}),s.forEach(function(o){a.has(o)||Ia(o,i)})}Ui.set(n,e)},[e]),n}function C0(e){return e}function A0(e,t){t===void 0&&(t=C0);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(s),i=n}var l=function(){var d=i;i=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){i.push(d),c()},filter:function(d){return i=i.filter(d),n}}}};return a}function S0(e){e===void 0&&(e={});var t=A0(null);return t.options=lt({async:!0,ssr:!1},e),t}var tl=function(e){var t=e.sideCar,n=el(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,lt({},n))};tl.isSideCarExport=!0;function N0(e,t){return e.useMedium(t),tl}var nl=S0(),va=function(){},sa=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:va,onWheelCapture:va,onTouchMoveCapture:va}),a=r[0],s=r[1],i=e.forwardProps,o=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,A=e.allowPinchZoom,E=e.as,_=E===void 0?"div":E,N=e.gapMode,k=el(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=p,v=_0([n,t]),R=lt(lt({},k),a);return y.createElement(y.Fragment,null,d&&y.createElement(L,{sideCar:nl,removeScrollBar:c,shards:f,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!A,lockRef:n,gapMode:N}),i?y.cloneElement(y.Children.only(o),lt(lt({},R),{ref:v})):y.createElement(_,lt({},R,{className:l,ref:v}),o))});sa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sa.classNames={fullWidth:Lr,zeroRight:Rr};var I0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function v0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=I0();return t&&e.setAttribute("nonce",t),e}function w0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function k0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var O0=function(){var e=0,t=null;return{add:function(n){e==0&&(t=v0())&&(w0(t,n),k0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},R0=function(){var e=O0();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rl=function(){var e=R0(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},L0={left:0,top:0,right:0,gap:0},wa=function(e){return parseInt(e||"",10)||0},P0=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[wa(n),wa(r),wa(a)]},D0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return L0;var t=P0(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M0=rl(),ln="data-scroll-locked",B0=function(e,t,n,r){var a=e.left,s=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
+
`);var or=e=>typeof e=="number"&&!isNaN(e),jt=e=>typeof e=="string",_t=e=>typeof e=="function",Mf=e=>jt(e)||or(e),Za=e=>jt(e)||_t(e)?e:null,Bf=(e,t)=>e===!1||or(e)&&e>0?e:t,Ja=e=>D.isValidElement(e)||jt(e)||_t(e)||or(e);function Ff(e,t,n=300){let{scrollHeight:r,style:a}=e;requestAnimationFrame(()=>{a.minHeight="initial",a.height=r+"px",a.transition=`all ${n}ms`,requestAnimationFrame(()=>{a.height="0",a.padding="0",a.margin="0",setTimeout(t,n)})})}function Hf({enter:e,exit:t,appendPosition:n=!1,collapse:r=!0,collapseDuration:a=300}){return function({children:s,position:i,preventExitTransition:o,done:l,nodeRef:c,isIn:d,playToast:f}){let p=n?`${e}--${i}`:e,h=n?`${t}--${i}`:t,x=D.useRef(0);return D.useLayoutEffect(()=>{let g=c.current,A=p.split(" "),E=_=>{_.target===c.current&&(f(),g.removeEventListener("animationend",E),g.removeEventListener("animationcancel",E),x.current===0&&_.type!=="animationcancel"&&g.classList.remove(...A))};g.classList.add(...A),g.addEventListener("animationend",E),g.addEventListener("animationcancel",E)},[]),D.useEffect(()=>{let g=c.current,A=()=>{g.removeEventListener("animationend",A),r?Ff(g,l,a):l()};d||(o?A():(x.current=1,g.className+=` ${h}`,g.addEventListener("animationend",A)))},[d]),D.createElement(D.Fragment,null,s)}}function ki(e,t){return{content:Ou(e.content,e.props),containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,reason:e.removalReason,status:t}}function Ou(e,t,n=!1){return D.isValidElement(e)&&!jt(e.type)?D.cloneElement(e,{closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:n}):_t(e)?e({closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:n}):e}function Uf({closeToast:e,theme:t,ariaLabel:n="close"}){return D.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:r=>{r.stopPropagation(),e(!0)},"aria-label":n},D.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},D.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function jf({delay:e,isRunning:t,closeToast:n,type:r="default",hide:a,className:s,controlledProgress:i,progress:o,rtl:l,isIn:c,theme:d}){let f=a||i&&o===0,p={animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};i&&(p.transform=`scaleX(${o})`);let h=yt("Toastify__progress-bar",i?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${d}`,`Toastify__progress-bar--${r}`,{"Toastify__progress-bar--rtl":l}),x=_t(s)?s({rtl:l,type:r,defaultClassName:h}):yt(h,s),g={[i&&o>=1?"onTransitionEnd":"onAnimationEnd"]:i&&o<1?null:()=>{c&&n()}};return D.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":f},D.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${d} Toastify__progress-bar--${r}`}),D.createElement("div",{role:"progressbar","aria-hidden":f?"true":"false","aria-label":"notification timer",className:x,style:p,...g}))}var zf=1,Ru=()=>`${zf++}`;function Yf(e,t,n){let r=1,a=0,s=[],i=[],o=t,l=new Map,c=new Set,d=_=>(c.add(_),()=>c.delete(_)),f=()=>{i=Array.from(l.values()),c.forEach(_=>_())},p=({containerId:_,toastId:N,updateId:k})=>{let L=_?_!==e:e!==1,v=l.has(N)&&k==null;return L||v},h=(_,N)=>{l.forEach(k=>{var L;(N==null||N===k.props.toastId)&&((L=k.toggle)==null||L.call(k,_))})},x=_=>{var N,k;(k=(N=_.props)==null?void 0:N.onClose)==null||k.call(N,_.removalReason),_.isActive=!1},g=_=>{if(_==null)l.forEach(x);else{let N=l.get(_);N&&x(N)}f()},A=()=>{a-=s.length,s=[]},E=_=>{var N,k;let{toastId:L,updateId:v}=_.props,R=v==null;_.staleId&&l.delete(_.staleId),_.isActive=!0,l.set(L,_),f(),n(ki(_,R?"added":"updated")),R&&((k=(N=_.props).onOpen)==null||k.call(N))};return{id:e,props:o,observe:d,toggle:h,removeToast:g,toasts:l,clearQueue:A,buildToast:(_,N)=>{if(p(N))return;let{toastId:k,updateId:L,data:v,staleId:R,delay:P}=N,q=L==null;q&&a++;let K={...o,style:o.toastStyle,key:r++,...Object.fromEntries(Object.entries(N).filter(([z,$])=>$!=null)),toastId:k,updateId:L,data:v,isIn:!1,className:Za(N.className||o.toastClassName),progressClassName:Za(N.progressClassName||o.progressClassName),autoClose:N.isLoading?!1:Bf(N.autoClose,o.autoClose),closeToast(z){l.get(k).removalReason=z,g(k)},deleteToast(){let z=l.get(k);if(z!=null){if(n(ki(z,"removed")),l.delete(k),a--,a<0&&(a=0),s.length>0){E(s.shift());return}f()}}};K.closeButton=o.closeButton,N.closeButton===!1||Ja(N.closeButton)?K.closeButton=N.closeButton:N.closeButton===!0&&(K.closeButton=Ja(o.closeButton)?o.closeButton:!0);let U={content:_,props:K,staleId:R};o.limit&&o.limit>0&&a>o.limit&&q?s.push(U):or(P)?setTimeout(()=>{E(U)},P):E(U)},setProps(_){o=_},setToggle:(_,N)=>{let k=l.get(_);k&&(k.toggle=N)},isToastActive:_=>{var N;return(N=l.get(_))==null?void 0:N.isActive},getSnapshot:()=>i}}var Oe=new Map,tr=[],es=new Set,Wf=e=>es.forEach(t=>t(e)),Lu=()=>Oe.size>0;function Vf(){tr.forEach(e=>Du(e.content,e.options)),tr=[]}var $f=(e,{containerId:t})=>{var n;return(n=Oe.get(t||1))==null?void 0:n.toasts.get(e)};function Pu(e,t){var n;if(t)return!!((n=Oe.get(t))!=null&&n.isToastActive(e));let r=!1;return Oe.forEach(a=>{a.isToastActive(e)&&(r=!0)}),r}function qf(e){if(!Lu()){tr=tr.filter(t=>e!=null&&t.options.toastId!==e);return}if(e==null||Mf(e))Oe.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=Oe.get(e.containerId);t?t.removeToast(e.id):Oe.forEach(n=>{n.removeToast(e.id)})}}var Gf=(e={})=>{Oe.forEach(t=>{t.props.limit&&(!e.containerId||t.id===e.containerId)&&t.clearQueue()})};function Du(e,t){Ja(e)&&(Lu()||tr.push({content:e,options:t}),Oe.forEach(n=>{n.buildToast(e,t)}))}function Xf(e){var t;(t=Oe.get(e.containerId||1))==null||t.setToggle(e.id,e.fn)}function Mu(e,t){Oe.forEach(n=>{(t==null||!(t!=null&&t.containerId)||t?.containerId===n.id)&&n.toggle(e,t?.id)})}function Kf(e){let t=e.containerId||1;return{subscribe(n){let r=Yf(t,e,Wf);Oe.set(t,r);let a=r.observe(n);return Vf(),()=>{a(),Oe.delete(t)}},setProps(n){var r;(r=Oe.get(t))==null||r.setProps(n)},getSnapshot(){var n;return(n=Oe.get(t))==null?void 0:n.getSnapshot()}}}function Qf(e){return es.add(e),()=>{es.delete(e)}}function Zf(e){return e&&(jt(e.toastId)||or(e.toastId))?e.toastId:Ru()}function ur(e,t){return Du(e,t),t.toastId}function Qr(e,t){return{...t,type:t&&t.type||e,toastId:Zf(t)}}function Zr(e){return(t,n)=>ur(t,Qr(e,n))}function de(e,t){return ur(e,Qr("default",t))}de.loading=(e,t)=>ur(e,Qr("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t}));function Jf(e,{pending:t,error:n,success:r},a){let s;t&&(s=jt(t)?de.loading(t,a):de.loading(t.render,{...a,...t}));let i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},o=(c,d,f)=>{if(d==null){de.dismiss(s);return}let p={type:c,...i,...a,data:f},h=jt(d)?{render:d}:d;return s?de.update(s,{...p,...h}):de(h.render,{...p,...h}),f},l=_t(e)?e():e;return l.then(c=>o("success",r,c)).catch(c=>o("error",n,c)),l}de.promise=Jf;de.success=Zr("success");de.info=Zr("info");de.error=Zr("error");de.warning=Zr("warning");de.warn=de.warning;de.dark=(e,t)=>ur(e,Qr("default",{theme:"dark",...t}));function eh(e){qf(e)}de.dismiss=eh;de.clearWaitingQueue=Gf;de.isActive=Pu;de.update=(e,t={})=>{let n=$f(e,t);if(n){let{props:r,content:a}=n,s={delay:100,...r,...t,toastId:t.toastId||e,updateId:Ru()};s.toastId!==e&&(s.staleId=e);let i=s.render||a;delete s.render,ur(i,s)}};de.done=e=>{de.update(e,{progress:1})};de.onChange=Qf;de.play=e=>Mu(!0,e);de.pause=e=>Mu(!1,e);function th(e){var t;let{subscribe:n,getSnapshot:r,setProps:a}=D.useRef(Kf(e)).current;a(e);let s=(t=D.useSyncExternalStore(n,r,r))==null?void 0:t.slice();function i(o){if(!s)return[];let l=new Map;return e.newestOnTop&&s.reverse(),s.forEach(c=>{let{position:d}=c.props;l.has(d)||l.set(d,[]),l.get(d).push(c)}),Array.from(l,c=>o(c[0],c[1]))}return{getToastToRender:i,isToastActive:Pu,count:s?.length}}function nh(e){let[t,n]=D.useState(!1),[r,a]=D.useState(!1),s=D.useRef(null),i=D.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:o,pauseOnHover:l,closeToast:c,onClick:d,closeOnClick:f}=e;Xf({id:e.toastId,containerId:e.containerId,fn:n}),D.useEffect(()=>{if(e.pauseOnFocusLoss)return p(),()=>{h()}},[e.pauseOnFocusLoss]);function p(){document.hasFocus()||E(),window.addEventListener("focus",A),window.addEventListener("blur",E)}function h(){window.removeEventListener("focus",A),window.removeEventListener("blur",E)}function x(R){if(e.draggable===!0||e.draggable===R.pointerType){_();let P=s.current;i.canCloseOnClick=!0,i.canDrag=!0,P.style.transition="none",e.draggableDirection==="x"?(i.start=R.clientX,i.removalDistance=P.offsetWidth*(e.draggablePercent/100)):(i.start=R.clientY,i.removalDistance=P.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function g(R){let{top:P,bottom:q,left:K,right:U}=s.current.getBoundingClientRect();R.nativeEvent.type!=="touchend"&&e.pauseOnHover&&R.clientX>=K&&R.clientX<=U&&R.clientY>=P&&R.clientY<=q?E():A()}function A(){n(!0)}function E(){n(!1)}function _(){i.didMove=!1,document.addEventListener("pointermove",k),document.addEventListener("pointerup",L)}function N(){document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",L)}function k(R){let P=s.current;if(i.canDrag&&P){i.didMove=!0,t&&E(),e.draggableDirection==="x"?i.delta=R.clientX-i.start:i.delta=R.clientY-i.start,i.start!==R.clientX&&(i.canCloseOnClick=!1);let q=e.draggableDirection==="x"?`${i.delta}px, var(--y)`:`0, calc(${i.delta}px + var(--y))`;P.style.transform=`translate3d(${q},0)`,P.style.opacity=`${1-Math.abs(i.delta/i.removalDistance)}`}}function L(){N();let R=s.current;if(i.canDrag&&i.didMove&&R){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance){a(!0),e.closeToast(!0),e.collapseAll();return}R.style.transition="transform 0.2s, opacity 0.2s",R.style.removeProperty("transform"),R.style.removeProperty("opacity")}}let v={onPointerDown:x,onPointerUp:g};return o&&l&&(v.onMouseEnter=E,e.stacked||(v.onMouseLeave=A)),f&&(v.onClick=R=>{d&&d(R),i.canCloseOnClick&&c(!0)}),{playToast:A,pauseToast:E,isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:v}}var rh=typeof window<"u"?D.useLayoutEffect:D.useEffect,Jr=({theme:e,type:t,isLoading:n,...r})=>D.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...r});function ah(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function sh(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function ih(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function oh(e){return D.createElement(Jr,{...e},D.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function uh(){return D.createElement("div",{className:"Toastify__spinner"})}var ts={info:sh,warning:ah,success:ih,error:oh,spinner:uh},lh=e=>e in ts;function ch({theme:e,type:t,isLoading:n,icon:r}){let a=null,s={theme:e,type:t};return r===!1||(_t(r)?a=r({...s,isLoading:n}):D.isValidElement(r)?a=D.cloneElement(r,s):n?a=ts.spinner():lh(t)&&(a=ts[t](s))),a}var dh=e=>{let{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:a,playToast:s}=nh(e),{closeButton:i,children:o,autoClose:l,onClick:c,type:d,hideProgressBar:f,closeToast:p,transition:h,position:x,className:g,style:A,progressClassName:E,updateId:_,role:N,progress:k,rtl:L,toastId:v,deleteToast:R,isIn:P,isLoading:q,closeOnClick:K,theme:U,ariaLabel:z}=e,$=yt("Toastify__toast",`Toastify__toast-theme--${U}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":L},{"Toastify__toast--close-on-click":K}),Y=_t(g)?g({rtl:L,position:x,type:d,defaultClassName:$}):yt($,g),F=ch(e),X=!!k||!l,Q={closeToast:p,type:d,theme:U},B=null;return i===!1||(_t(i)?B=i(Q):D.isValidElement(i)?B=D.cloneElement(i,Q):B=Uf(Q)),D.createElement(h,{isIn:P,done:R,position:x,preventExitTransition:n,nodeRef:r,playToast:s},D.createElement("div",{id:v,tabIndex:0,onClick:c,"data-in":P,className:Y,...a,style:A,ref:r,...P&&{role:N,"aria-label":z}},F!=null&&D.createElement("div",{className:yt("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!q})},F),Ou(o,e,!t),B,!e.customProgressBar&&D.createElement(jf,{..._&&!X?{key:`p-${_}`}:{},rtl:L,theme:U,delay:l,isRunning:t,isIn:P,closeToast:p,hide:f,type:d,className:E,controlledProgress:X,progress:k||0})))},fh=(e,t=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}),Bu=Hf(fh("bounce",!0)),hh={position:"top-right",transition:Bu,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:e=>e.altKey&&e.code==="KeyT"};function mh(e){let t={...hh,...e},n=e.stacked,[r,a]=D.useState(!0),s=D.useRef(null),{getToastToRender:i,isToastActive:o,count:l}=th(t),{className:c,style:d,rtl:f,containerId:p,hotKeys:h}=t;function x(A){let E=yt("Toastify__toast-container",`Toastify__toast-container--${A}`,{"Toastify__toast-container--rtl":f});return _t(c)?c({position:A,rtl:f,defaultClassName:E}):yt(E,Za(c))}function g(){n&&(a(!0),de.play())}return rh(()=>{var A;if(n){let E=s.current.querySelectorAll('[data-in="true"]'),_=12,N=(A=t.position)==null?void 0:A.includes("top"),k=0,L=0;Array.from(E).reverse().forEach((v,R)=>{let P=v;P.classList.add("Toastify__toast--stacked"),R>0&&(P.dataset.collapsed=`${r}`),P.dataset.pos||(P.dataset.pos=N?"top":"bot");let q=k*(r?.2:1)+(r?0:_*R);P.style.setProperty("--y",`${N?q:q*-1}px`),P.style.setProperty("--g",`${_}`),P.style.setProperty("--s",`${1-(r?L:0)}`),k+=P.offsetHeight,L+=.025})}},[r,l,n]),D.useEffect(()=>{function A(E){var _;let N=s.current;h(E)&&((_=N.querySelector('[tabIndex="0"]'))==null||_.focus(),a(!1),de.pause()),E.key==="Escape"&&(document.activeElement===N||N!=null&&N.contains(document.activeElement))&&(a(!0),de.play())}return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[h]),D.createElement("section",{ref:s,className:"Toastify",id:p,onMouseEnter:()=>{n&&(a(!1),de.pause())},onMouseLeave:g,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":t["aria-label"]},i((A,E)=>{let _=E.length?{...d}:{...d,pointerEvents:"none"};return D.createElement("div",{tabIndex:-1,className:x(A),"data-stacked":n,style:_,key:`c-${A}`},E.map(({content:N,props:k})=>D.createElement(dh,{...k,stacked:n,collapseAll:g,isIn:o(k.toastId,k.containerId),key:`t-${k.key}`},N)))}))}const Vn=Ze.createAsyncThunk("swatches/getSelectedProductThunk",async({assetId:e},{rejectWithValue:t})=>{try{return await Pf({assetId:e})}catch(n){return console.error(n.message),de("Failed to load product"),t(n.message)}}),Re=5,ph={listAttributes:[],productElementOptions:[],materialSelectState:{Finish:[],Color:[],Look:[]},allMaterialsValues:[],selectedMaterials:[],selectedProduct:null,isLoadingSelectedProduct:!1,isOpenMultiProductCart:!1},gh=e=>e.reduce((t,n)=>t+n.count,0),Fu=Ze.createSlice({name:"swatches",initialState:ph,reducers:{setMaterialSelect(e,t){const{filterName:n,values:r}=t.payload;if(r.length===0){e.materialSelectState[n]=[];return}e.materialSelectState[n]=Iu(r)},setPanelFilter(e,t){const n=t.payload.attributes;if(n.length){const r=Fr.getMaterialsValuesFromOptions(n);r?.length&&(e.allMaterialsValues=r)}},clearMaterialFilter:(e,t)=>{e.materialSelectState[t.payload]=[]},clearAllMaterialFilters:e=>{e.materialSelectState={Finish:[],Color:[],Look:[]}},setAllMaterialsOptions:(e,t)=>{const{allMaterialValues:n,productElementOptions:r}=t.payload;n?.length&&(e.allMaterialsValues=n),r?.length&&(e.productElementOptions=r)},setSelectedMaterial(e,t){const{materialCount:n,selectedMaterial:r,selectedMaterials:a,limitCb:s}=t.payload;if(!r)return;const i=l=>l.metadata?.label===r.metadata?.label&&l.parentName===r.parentName,o=a?.some(i);!o&&n>=5&&s&&s(),o?e.selectedMaterials=a.filter(l=>!i(l)):n<5&&(e.selectedMaterials=[...a,r])},resetSelectedMaterials(e){e.selectedMaterials=[]},setSelectedProduct(e,t){e.selectedProduct=t.payload},deleteSelectedProduct(e){e.selectedProduct=null},setIsOpenMultiProductCart(e,t){e.isOpenMultiProductCart=t.payload},removeItem(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial;e.selectedMaterials=e.selectedMaterials.filter(a=>!(a.metadata?.label===n?.label&&a.parentName===r))},increment(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,a=e.selectedMaterials.find(s=>s.metadata?.label===n?.label&&s.parentName===r);a&&gh(e.selectedMaterials)<Re&&(a.count+=1)},decrement(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,a=e.selectedMaterials.find(s=>s.metadata?.label===n?.label&&s.parentName===r);a&&a.count>1&&(a.count-=1)},setCount(e,t){const{metadata:n,parentName:r}=t.payload.selectedMaterial,{next:a}=t.payload,s=e.selectedMaterials.find(c=>c.metadata?.label===n?.label&&c.parentName===r);if(!s)return;const i=Math.max(1,Math.floor(a)),o=e.selectedMaterials.filter(c=>!(c.metadata?.label===n?.label&&c.parentName===r)).reduce((c,d)=>c+d.count,0),l=Math.max(1,Re-o);s.count=Math.min(i,l)}},extraReducers:e=>{e.addCase(Vn.pending,t=>{t.isLoadingSelectedProduct=!0}).addCase(Vn.fulfilled,t=>{t.isLoadingSelectedProduct=!1}).addCase(Vn.rejected,t=>{t.isLoadingSelectedProduct=!1})}}),Hu=Fu.reducer,{setMaterialSelect:ea,setAllMaterialsOptions:ns,setPanelFilter:_a,setSelectedMaterial:ta,clearMaterialFilter:sA,clearAllMaterialFilters:bh,setSelectedProduct:Eh,deleteSelectedProduct:Th,setIsOpenMultiProductCart:Uu,resetSelectedMaterials:iA,removeItem:xh,increment:yh,decrement:_h,setCount:oA}=Fu.actions,Ch={items:[]},ju=Ze.createSlice({name:"cart",initialState:Ch,reducers:{setCartItems(e,t){e.items=t.payload},clear(e){e.items=[]}}}),{setCartItems:Ah,clear:uA}=ju.actions,zu=ju.reducer,$n=Ze.createAsyncThunk("multiProducts/getProductListThunk",async(e,{rejectWithValue:t})=>{try{return await Lf()}catch(n){return console.error(n?.message??n),t(n?.message??"Unknown error")}}),Sh={items:[],productList:[],isLoadingProductList:!1,selectedProduct:null,activeMultiCartProduct:null,totalCount:0};function Nh(e,t,n){let r=e.items.find(a=>a.assetId===t);return r?n&&!r.name&&(r.name=n):(r={assetId:t,name:n??"",items:[]},e.items.push(r)),r}const Ca=(e,t)=>e.items.findIndex(n=>n.assetId===t),Oi=(e,t,n,r)=>t===-1?-1:e.items[t].items.findIndex(a=>a.metadata?.label===n&&a.parentName===r),Yu=Ze.createSlice({name:"multiProduct",initialState:Sh,reducers:{setCartForProduct(e,t){const{assetId:n}=t.payload,r=e.items.findIndex(a=>a.assetId===n);r>=0?e.items[r]=t.payload:e.items.push(t.payload)},setActiveMultiCartProduct(e,t){e.activeMultiCartProduct=t.payload},setMultiCartItems(e,t){const{assetId:n,items:r,name:a}=t.payload;if(!r||r.length===0){const i=e.items.findIndex(o=>o.assetId===n);i!==-1&&e.items.splice(i,1);return}const s=Nh(e,n,a);s.items=r},incrementMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n),i=Oi(e,s,r,a);i!==-1&&(e.items[s].items[i].count+=1)},decrementMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n),i=Oi(e,s,r,a);if(i!==-1){const o=e.items[s].items[i];o.count>1&&(o.count-=1)}},removeMultiProductItem(e,t){const{assetId:n,label:r,parentName:a}=t.payload,s=Ca(e,n);if(s===-1)return;const i=e.items[s].items.filter(o=>!(o.metadata?.label===r&&o.parentName===a));e.items[s].items=i},clear(e){e.items=[]}},extraReducers:e=>{e.addCase($n.pending,t=>{t.isLoadingProductList=!0}).addCase($n.fulfilled,(t,n)=>{t.productList=n.payload.rows,t.isLoadingProductList=!1}).addCase($n.rejected,t=>{t.isLoadingProductList=!1})}}),{setCartForProduct:lA,setMultiCartItems:rs,incrementMultiProductItem:Ih,decrementMultiProductItem:vh,removeMultiProductItem:wh,clear:cA,setActiveMultiCartProduct:as}=Yu.actions,Wu=Yu.reducer,kh=Ze.combineReducers({swatches:Hu,cart:zu,multiProductCart:Wu}),Oh={},{NODE_ENV:Rh}=Oh;Ze.configureStore({reducer:kh,middleware:e=>e({thunk:!0,serializableCheck:{ignoredActionPaths:["meta.limitCb","payload.limitCb"],ignoredPaths:[]}}),devTools:Rh!=="production"});const Pe=Tn.useDispatch.withTypes(),oe=Tn.useSelector.withTypes(),lr=e=>e.swatches.allMaterialsValues,xn=e=>e.swatches.materialSelectState,Lh=e=>e.swatches.productElementOptions,$t=e=>e.swatches.selectedMaterials,Vu=e=>e.swatches.isLoadingSelectedProduct,Ph=e=>e.swatches.isOpenMultiProductCart,na=e=>e.swatches.selectedProduct,$u=6.5,qu=({materials:e,containerStyles:t="flex flex-col gap-[8px] text-xs/snug p-[var(--sm-padding)] border-t border-solid border-[var(--border)] sm:gap-[12px] shadow-[0_-2px_10px_rgba(40,40,40,0.10)]"})=>{const n="flex flex-row justify-between items-center",r=D.useMemo(()=>e.reduce((a,s)=>a+(s.count??0),0)*$u,[e]);return m.jsxs("div",{className:t,children:[m.jsxs("div",{className:n,children:[m.jsx("span",{children:"Subtotal"}),m.jsxs("span",{children:["$",r]})]}),m.jsxs("div",{className:`${n} text-[var(--main-accent-color)]`,children:[m.jsx("span",{children:"Savings"}),m.jsxs("span",{children:["-$",r]})]}),m.jsxs("div",{className:`${n} text-sm font-medium`,children:[m.jsx("span",{children:"Total"}),m.jsx("span",{children:"$0"})]})]})},Gu=({children:e,disabled:t,...n})=>m.jsx("button",{className:`w-full bg-[var(--main-accent-color)] text-white py-3 rounded-full font-bold transition-colors duration-300 ${t?"bg-gray-400 text-gray-200 cursor-not-allowed opacity-70":"cursor-pointer hover:opacity-90"}`,...n,children:e}),yn=e=>e.multiProductCart.items,Dh=e=>e.multiProductCart.productList,Mh=e=>e.multiProductCart.isLoadingProductList;class zt{static getImage(t){const n=t?.metadata?.Image||t?.metadata?.image;return n?`https://preview.threekit.com${n}`:void 0}static getValueLabel(t){return t?.metadata?.label||t?.metadata?.Label||t?.name||"Unnamed"}static getZoomIconColor(t){return t?.metadata?.zoomIconColor||t?.metadata?.zoomIconColor||null}static getHexColor(t){return t?.metadata?.hex||t?.metadata?.Hex||null}static getAttributeLabel(t){return t?.metadata?.label||t?.metadata?.Label||t?.name||"Unnamed"}}function Le(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function Ri(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ra(...e){return t=>{let n=!1;const r=e.map(a=>{const s=Ri(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():Ri(e[a],null)}}}}function Xe(...e){return y.useCallback(ra(...e),e)}function Bh(e,t){const n=y.createContext(t),r=s=>{const{children:i,...o}=s,l=y.useMemo(()=>o,Object.values(o));return m.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function a(s){const i=y.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,a]}function aa(e,t=[]){let n=[];function r(s,i){const o=y.createContext(i),l=n.length;n=[...n,i];const c=f=>{const{scope:p,children:h,...x}=f,g=p?.[e]?.[l]||o,A=y.useMemo(()=>x,Object.values(x));return m.jsx(g.Provider,{value:A,children:h})};c.displayName=s+"Provider";function d(f,p){const h=p?.[e]?.[l]||o,x=y.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const a=()=>{const s=n.map(i=>y.createContext(i));return function(o){const l=o?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return a.scopeName=e,[r,Fh(a,...t)]}function Fh(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const i=r.reduce((o,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...o,...f}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Lt=globalThis?.document?y.useLayoutEffect:()=>{},Hh=y[" useId ".trim().toString()]||(()=>{}),Uh=0;function Or(e){const[t,n]=y.useState(Hh());return Lt(()=>{n(r=>r??String(Uh++))},[e]),e||(t?`radix-${t}`:"")}var jh=y[" useInsertionEffect ".trim().toString()]||Lt;function ws({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,i]=zh({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:a;{const d=y.useRef(e!==void 0);y.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=y.useCallback(d=>{if(o){const f=Yh(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[o,e,s,i]);return[l,c]}function zh({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),a=y.useRef(n),s=y.useRef(t);return jh(()=>{s.current=t},[t]),y.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function Yh(e){return typeof e=="function"}function Wh(e){const t=Vh(e),n=y.forwardRef((r,a)=>{const{children:s,...i}=r,o=y.Children.toArray(s),l=o.find(qh);if(l){const c=l.props.children,d=o.map(f=>f===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...i,ref:a,children:y.isValidElement(c)?y.cloneElement(c,void 0,d):null})}return m.jsx(t,{...i,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function Vh(e){const t=y.forwardRef((n,r)=>{const{children:a,...s}=n;if(y.isValidElement(a)){const i=Xh(a),o=Gh(s,a.props);return a.type!==y.Fragment&&(o.ref=r?ra(r,i):i),y.cloneElement(a,o)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $h=Symbol("radix.slottable");function qh(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$h}function Gh(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...o)=>{const l=s(...o);return a(...o),l}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function Xh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=Kh.reduce((e,t)=>{const n=Wh(`Primitive.${t}`),r=y.forwardRef((a,s)=>{const{asChild:i,...o}=a,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Qh(e,t){e&&Su.flushSync(()=>e.dispatchEvent(t))}function mn(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function Zh(e,t=globalThis?.document){const n=mn(e);y.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Jh="DismissableLayer",ss="dismissableLayer.update",e0="dismissableLayer.pointerDownOutside",t0="dismissableLayer.focusOutside",Li,Xu=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ks=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:o,...l}=e,c=y.useContext(Xu),[d,f]=y.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=y.useState({}),x=Xe(t,R=>f(R)),g=Array.from(c.layers),[A]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),E=g.indexOf(A),_=d?g.indexOf(d):-1,N=c.layersWithOutsidePointerEventsDisabled.size>0,k=_>=E,L=a0(R=>{const P=R.target,q=[...c.branches].some(K=>K.contains(P));!k||q||(a?.(R),i?.(R),R.defaultPrevented||o?.())},p),v=s0(R=>{const P=R.target;[...c.branches].some(K=>K.contains(P))||(s?.(R),i?.(R),R.defaultPrevented||o?.())},p);return Zh(R=>{_===c.layers.size-1&&(r?.(R),!R.defaultPrevented&&o&&(R.preventDefault(),o()))},p),y.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Li=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Pi(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Li)}},[d,p,n,c]),y.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Pi())},[d,c]),y.useEffect(()=>{const R=()=>h({});return document.addEventListener(ss,R),()=>document.removeEventListener(ss,R)},[]),m.jsx(Ne.div,{...l,ref:x,style:{pointerEvents:N?k?"auto":"none":void 0,...e.style},onFocusCapture:Le(e.onFocusCapture,v.onFocusCapture),onBlurCapture:Le(e.onBlurCapture,v.onBlurCapture),onPointerDownCapture:Le(e.onPointerDownCapture,L.onPointerDownCapture)})});ks.displayName=Jh;var n0="DismissableLayerBranch",r0=y.forwardRef((e,t)=>{const n=y.useContext(Xu),r=y.useRef(null),a=Xe(t,r);return y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(Ne.div,{...e,ref:a})});r0.displayName=n0;function a0(e,t=globalThis?.document){const n=mn(e),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const s=o=>{if(o.target&&!r.current){let l=function(){Ku(e0,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=l,t.addEventListener("click",a.current,{once:!0})):l()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function s0(e,t=globalThis?.document){const n=mn(e),r=y.useRef(!1);return y.useEffect(()=>{const a=s=>{s.target&&!r.current&&Ku(t0,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Pi(){const e=new CustomEvent(ss);document.dispatchEvent(e)}function Ku(e,t,n,{discrete:r}){const a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Qh(a,s):a.dispatchEvent(s)}var Aa="focusScope.autoFocusOnMount",Sa="focusScope.autoFocusOnUnmount",Di={bubbles:!1,cancelable:!0},i0="FocusScope",Os=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[o,l]=y.useState(null),c=mn(a),d=mn(s),f=y.useRef(null),p=Xe(t,g=>l(g)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let g=function(N){if(h.paused||!o)return;const k=N.target;o.contains(k)?f.current=k:vt(f.current,{select:!0})},A=function(N){if(h.paused||!o)return;const k=N.relatedTarget;k!==null&&(o.contains(k)||vt(f.current,{select:!0}))},E=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&vt(o)};document.addEventListener("focusin",g),document.addEventListener("focusout",A);const _=new MutationObserver(E);return o&&_.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",A),_.disconnect()}}},[r,o,h.paused]),y.useEffect(()=>{if(o){Bi.add(h);const g=document.activeElement;if(!o.contains(g)){const E=new CustomEvent(Aa,Di);o.addEventListener(Aa,c),o.dispatchEvent(E),E.defaultPrevented||(o0(f0(Qu(o)),{select:!0}),document.activeElement===g&&vt(o))}return()=>{o.removeEventListener(Aa,c),setTimeout(()=>{const E=new CustomEvent(Sa,Di);o.addEventListener(Sa,d),o.dispatchEvent(E),E.defaultPrevented||vt(g??document.body,{select:!0}),o.removeEventListener(Sa,d),Bi.remove(h)},0)}}},[o,c,d,h]);const x=y.useCallback(g=>{if(!n&&!r||h.paused)return;const A=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,E=document.activeElement;if(A&&E){const _=g.currentTarget,[N,k]=u0(_);N&&k?!g.shiftKey&&E===k?(g.preventDefault(),n&&vt(N,{select:!0})):g.shiftKey&&E===N&&(g.preventDefault(),n&&vt(k,{select:!0})):E===_&&g.preventDefault()}},[n,r,h.paused]);return m.jsx(Ne.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});Os.displayName=i0;function o0(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(vt(r,{select:t}),document.activeElement!==n)return}function u0(e){const t=Qu(e),n=Mi(t,e),r=Mi(t.reverse(),e);return[n,r]}function Qu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Mi(e,t){for(const n of e)if(!l0(n,{upTo:t}))return n}function l0(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c0(e){return e instanceof HTMLInputElement&&"select"in e}function vt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&c0(e)&&t&&e.select()}}var Bi=d0();function d0(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Fi(e,t),e.unshift(t)},remove(t){e=Fi(e,t),e[0]?.resume()}}}function Fi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function f0(e){return e.filter(t=>t.tagName!=="A")}var h0="Portal",Zu=y.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=y.useState(!1);Lt(()=>s(!0),[]);const i=n||a&&globalThis?.document?.body;return i?Vt.createPortal(m.jsx(Ne.div,{...r,ref:t}),i):null});Zu.displayName=h0;function m0(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var _n=e=>{const{present:t,children:n}=e,r=p0(t),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Xe(r.ref,g0(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:s}):null};_n.displayName="Presence";function p0(e){const[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[o,l]=m0(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=Tr(r.current);s.current=o==="mounted"?c:"none"},[o]),Lt(()=>{const c=r.current,d=a.current;if(d!==e){const p=s.current,h=Tr(c);e?l("MOUNT"):h==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),Lt(()=>{if(t){let c;const d=t.ownerDocument.defaultView??window,f=h=>{const g=Tr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(l("ANIMATION_END"),!a.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",c=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},p=h=>{h.target===t&&(s.current=Tr(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Tr(e){return e?.animationName||"none"}function g0(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Na=0;function Ju(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Hi()),document.body.insertAdjacentElement("beforeend",e[1]??Hi()),Na++,()=>{Na===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Na--}},[])}function Hi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lt=function(){return lt=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},lt.apply(this,arguments)};function el(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function b0(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,s;r<a;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Rr="right-scroll-bar-position",Lr="width-before-scroll-bar",E0="with-scroll-bars-hidden",T0="--removed-body-scroll-bar-size";function Ia(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function x0(e,t){var n=D.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var y0=typeof window<"u"?y.useLayoutEffect:y.useEffect,Ui=new WeakMap;function _0(e,t){var n=x0(null,function(r){return e.forEach(function(a){return Ia(a,r)})});return y0(function(){var r=Ui.get(n);if(r){var a=new Set(r),s=new Set(e),i=n.current;a.forEach(function(o){s.has(o)||Ia(o,null)}),s.forEach(function(o){a.has(o)||Ia(o,i)})}Ui.set(n,e)},[e]),n}function C0(e){return e}function A0(e,t){t===void 0&&(t=C0);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(s),i=n}var l=function(){var d=i;i=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){i.push(d),c()},filter:function(d){return i=i.filter(d),n}}}};return a}function S0(e){e===void 0&&(e={});var t=A0(null);return t.options=lt({async:!0,ssr:!1},e),t}var tl=function(e){var t=e.sideCar,n=el(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,lt({},n))};tl.isSideCarExport=!0;function N0(e,t){return e.useMedium(t),tl}var nl=S0(),va=function(){},sa=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:va,onWheelCapture:va,onTouchMoveCapture:va}),a=r[0],s=r[1],i=e.forwardProps,o=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,A=e.allowPinchZoom,E=e.as,_=E===void 0?"div":E,N=e.gapMode,k=el(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=p,v=_0([n,t]),R=lt(lt({},k),a);return y.createElement(y.Fragment,null,d&&y.createElement(L,{sideCar:nl,removeScrollBar:c,shards:f,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!A,lockRef:n,gapMode:N}),i?y.cloneElement(y.Children.only(o),lt(lt({},R),{ref:v})):y.createElement(_,lt({},R,{className:l,ref:v}),o))});sa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sa.classNames={fullWidth:Lr,zeroRight:Rr};var I0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function v0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=I0();return t&&e.setAttribute("nonce",t),e}function w0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function k0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var O0=function(){var e=0,t=null;return{add:function(n){e==0&&(t=v0())&&(w0(t,n),k0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},R0=function(){var e=O0();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rl=function(){var e=R0(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},L0={left:0,top:0,right:0,gap:0},wa=function(e){return parseInt(e||"",10)||0},P0=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[wa(n),wa(r),wa(a)]},D0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return L0;var t=P0(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M0=rl(),ln="data-scroll-locked",B0=function(e,t,n,r){var a=e.left,s=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
3
3
|
.`.concat(E0,` {
|
|
4
4
|
overflow: hidden `).concat(r,`;
|
|
5
5
|
padding-right: `).concat(o,"px ").concat(r,`;
|
|
@@ -47,11 +47,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
47
47
|
bg-[var(--background-grey)] rounded-2xl border-none pointer-events-none`,children:m.jsx(cr,{className:"w-[8px] h-2 stroke-[var(--svg-dark)]"})}):null]},e.assetId),xp=e=>m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:m.jsx("path",{d:"M2.5 6H9.5",stroke:"current",strokeLinecap:"round",strokeLinejoin:"round"})}),yp=e=>m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:m.jsx("path",{d:"M2.5 6H9.5M6 2.5V9.5",stroke:"current",strokeLinecap:"round",strokeLinejoin:"round"})}),_p=e=>m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:m.jsx("path",{d:"M5 5.5V8.5M7 5.5V8.5M9.5 3V10C9.5 10.2652 9.39464 10.5196 9.20711 10.7071C9.01957 10.8946 8.76522 11 8.5 11H3.5C3.23478 11 2.98043 10.8946 2.79289 10.7071C2.60536 10.5196 2.5 10.2652 2.5 10V3M1.5 3H10.5M4 3V2C4 1.73478 4.10536 1.48043 4.29289 1.29289C4.48043 1.10536 4.73478 1 5 1H7C7.26522 1 7.51957 1.10536 7.70711 1.29289C7.89464 1.48043 8 1.73478 8 2V3",stroke:"current",strokeLinecap:"round",strokeLinejoin:"round"})}),Cp=({value:e,canIncrement:t,onIncrement:n,onDecrement:r,onDelete:a})=>{const s=e<=1;return m.jsxs("div",{className:"flex flex-row items-center gap-[8px] text-sm",children:[s?m.jsx("button",{"aria-label":"Remove item",onClick:a,className:"[&_svg_path]:stroke-[var(--main-accent-color)]",children:m.jsx(_p,{})}):m.jsx("button",{"aria-label":"Decrease",onClick:r,className:"[&_svg_path]:stroke-[var(--svg-dark)]",children:m.jsx(xp,{})}),m.jsx("span",{className:"min-w-[16px] text-center select-none",children:e}),m.jsx("button",{"aria-label":"Increase",onClick:n,disabled:!t,className:"[&_svg_path]:stroke-[var(--svg-dark)] disabled:opacity-40",children:m.jsx(yp,{})})]})},Vl=({item:e,canInc:t,onDelete:n,onIncrement:r,onDecrement:a})=>m.jsx("li",{className:`
|
|
48
48
|
border-b border-[var(--border)]
|
|
49
49
|
px-[var(--sm-padding)] p-[var(--sm-padding)]
|
|
50
|
-
last:border-b-0`,children:m.jsxs("div",{className:"relative flex flex-row gap-[16px]",children:[m.jsx("div",{children:m.jsx(Tp,{val:e})}),m.jsxs("div",{className:"flex flex-col justify-between",children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsx("span",{className:"mb-[4px] font-semibold text-
|
|
50
|
+
last:border-b-0`,children:m.jsxs("div",{className:"relative flex flex-row gap-[16px]",children:[m.jsx("div",{children:m.jsx(Tp,{val:e})}),m.jsxs("div",{className:"flex flex-col justify-between",children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsx("span",{className:"mb-[4px] font-semibold text-xs",children:e.metadata?.label}),m.jsx("span",{className:"mb-[4px] font-bold text-[1rem]",children:e.parentName})]}),m.jsx(Cp,{value:e.count,canIncrement:t,onIncrement:r,onDecrement:a,onDelete:n})]}),m.jsxs("div",{className:" absolute text-xs top-0 right-0 font-bold",children:["$",e.count*$u]})]})},e.assetId),Ws=e=>m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:m.jsx("path",{d:"M9.99984 15.8333L4.1665 9.99996M4.1665 9.99996L9.99984 4.16663M4.1665 9.99996H15.8332",stroke:"current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ap=({totalCount:e})=>{const t=Pe(),n=()=>{t(Uu(!1))};return m.jsx("header",{className:"flex flex-row p-[var(--sm-padding)] justify-between items-center border-b border-solid border-[var(--border)]",children:m.jsxs("div",{className:"flex items-center flex-row gap-[4px]",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("button",{className:"[&_svg_path]:stroke-[var(--main-accent-color)] cursor-pointer",onClick:n,children:m.jsx(Ws,{})}),m.jsx("h2",{className:"m-0! text-base leading-[1.6] font-medium ",children:"Your cart"})]}),e>=Re?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-[var(--main-accent-color)] hidden text-xs sm:block",children:["(",Re,") You reached maximum amount of swatches"]}),m.jsxs("span",{className:"text-[var(--main-accent-color)] block sm:hidden",children:["(",Re,") Max"]})]}):null]})})},Sp=({onSendData:e})=>{const t=Pe(),n=oe(yn),r=oe($t),a=D.useMemo(()=>n.flatMap(c=>c.items),[n]),s=({item:c,assetId:d})=>{const{parentName:f,metadata:p}=c,h=p?.label;d&&h&&f&&(t(wh({assetId:d,label:h,parentName:f})),t(ta({selectedMaterial:c,materialCount:1,selectedMaterials:r})))},i=({item:c,assetId:d})=>{const{parentName:f,metadata:p}=c,h=p?.label;d&&h&&f&&t(Ih({assetId:d,label:h,parentName:f}))},o=({item:c,assetId:d})=>{const{parentName:f,metadata:p}=c,h=p?.label;d&&h&&f&&t(vh({assetId:d,label:h,parentName:f}))},l=D.useMemo(()=>a.reduce((c,d)=>c+(d.count??0),0),[a]);return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx(Ap,{totalCount:l}),m.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[m.jsx("ul",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:n.map(c=>{const{items:d,name:f,assetId:p}=c;return d.length?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:` p-[var(--sm-padding)] border-b border-[var(--border)]
|
|
51
51
|
sm:px-[var(--sm-padding)]`,children:f},c.value),m.jsx("ul",{children:d?.map(h=>m.jsx(Vl,{item:h,canInc:l<Re,onDelete:()=>{p&&s({item:h,assetId:p})},onIncrement:()=>{p&&i({item:h,assetId:p})},onDecrement:()=>{p&&o({item:h,assetId:p})}},`${h.value}/${h.parentName}`))})]}):null})}),m.jsxs("div",{className:`flex flex-col
|
|
52
52
|
sm:flex-row sm:w-full sm:justify-between sm:items-center
|
|
53
53
|
sm:border-t sm:border-[var(--border)] shadow-[0_-2px_10px_rgba(40,40,40,0.10)]
|
|
54
|
-
`,children:[m.jsx("div",{className:"sm:w-[50%] sm:border-r sm:border-solid sm:border-[var(--border)]",children:m.jsx(qu,{materials:a,containerStyles:"flex flex-col gap-[8px] text-
|
|
54
|
+
`,children:[m.jsx("div",{className:"sm:w-[50%] sm:border-r sm:border-solid sm:border-[var(--border)]",children:m.jsx(qu,{materials:a,containerStyles:"flex flex-col gap-[8px] text-xs/snug p-[var(--sm-padding)] border-t border-solid border-[var(--border)] sm:gap-[12px] sm:border-none s"})}),m.jsx("div",{className:"p-[var(--sm-padding)] border-t border-solid border-[var(--border)] shrink-0 sm:w-[50%] sm:border-none sm:flex flex-row sm:justify-end sm:items-end sm:h-full",children:m.jsx("div",{className:"sm:w-[50%]",children:m.jsx(Gu,{onClick:()=>e&&e(n),disabled:a.length>Re+1,children:"GO TO SHIPPING"})})})]})]})]})},Np=e=>m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[m.jsx("path",{d:"M17.5 17.5L13.8833 13.8834",stroke:"current",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M9.16667 15.8333C12.8486 15.8333 15.8333 12.8486 15.8333 9.16667C15.8333 5.48477 12.8486 2.5 9.16667 2.5C5.48477 2.5 2.5 5.48477 2.5 9.16667C2.5 12.8486 5.48477 15.8333 9.16667 15.8333Z",stroke:"current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Qi={MATERIAL:"material"},Ip="UIGrouping";class us{static getTransformedData({dataType:t,data:n}){switch(t){case tt.UI:return this.getMapUIData(n);case tt.FETCH_DATA_PRODUCT:return this.getTransformedFetchProductData(n);default:throw new Error("Unsupported format")}}static getGroupingValue(t){if(t)return t.find(n=>n.name===Ip)}static getAllMaterialValuesKeys(t){if(t)return t.flatMap(n=>n.groups.flatMap(r=>r.options.filter(a=>a.typeComponent===Qi.MATERIAL)).map(r=>r.optionName))}static getAllMaterialOptions(t){const n=JSON.parse(this.getGroupingValue(t).value);if(n){const r=this.getAllMaterialValuesKeys(n);if(r?.length){const a=t.filter(s=>r.includes(s.name));if(a?.length){const s=Fr.getMaterialsValuesFromOptions(a);if(s?.length)return{allMaterialValues:s,productElementOptions:a}}}}}static getMapUIData(t){return this.getAllMaterialOptions(t)}static getTransformedFetchProductData(t){const{materials:n=[],structure:r=[]}=t,a=new Map;for(const d of r)for(const f of d.groups??[])for(const p of f.options??[])p?.typeComponent===Qi.MATERIAL&&p?.optionName&&a.set(p.optionName,f.groupName);const i=n.filter(d=>d.optionName&&a.has(d.optionName)).map(d=>({...d,groupName:d.optionName?a.get(d.optionName):void 0})),o=i.flatMap(d=>{const{label:f,groupName:p}=d,h=(f.toLocaleLowerCase()==="color"?p:f)||"without_name";return(d.valuesArray??[]).map(x=>({...x,parentName:h}))}),l=new Set,c=i.map(({label:d,groupName:f,valuesArray:p})=>{const h=d?.toLowerCase()==="color"?f??d:d;return{id:h,value:h,label:h,valuesArray:p}}).filter(d=>d.label&&(l.has(d.label)?!1:(l.add(d.label),!0))).sort((d,f)=>d.label.localeCompare(f.label));return{allMaterialValues:o,productElementOptions:c}}}const vp=({productListItem:e})=>{const t=Pe(),{name:n,img:r}=e,a=r?`https://admin-fts.threekit.com${r}`:"https://clownfish-app-cvxrz.ondigitalocean.app/assets/product_thumb-Bn1S8z9K.png",s=async()=>{const{assetId:i,name:o}=e;if(i&&o){const l=await t(Vn({assetId:i})).unwrap();if(l){t(Eh(e));const c=us.getTransformedData({dataType:tt.FETCH_DATA_PRODUCT,data:l});t(ns(c))}}};return m.jsxs("li",{className:"min-w-0 cursor-pointer",tabIndex:0,onClick:s,children:[m.jsx("div",{className:"mb-[12px] w-full aspect-square relative overflow-hidden rounded-sm",children:m.jsx("img",{src:a,alt:"product-list-item",className:"absolute inset-0 w-full h-full! object-cover"})}),n]})},$l={name:"All",value:"",productId:0,items:[]};class wp{static getCartTotalCount({cartItems:t}){return t.reduce((n,r)=>n+r.count,0)}static getUniqueCategories(t){const n=["All","Vanities","Storage & Shelving","Countertops","Basins","Vessels","Pedestals & Consoles","Tubs","Mirrors","Toilets","Bathroom Accessories"],a=Array.from(new Set(t.map(o=>o.collection).filter(Boolean))).map(o=>({name:o,value:o,productId:0,items:[]}));return[$l,...a].sort((o,l)=>{const c=n.indexOf(o.name),d=n.indexOf(l.name),f=c===-1?Number.MAX_SAFE_INTEGER:c,p=d===-1?Number.MAX_SAFE_INTEGER:d;return f!==p?f-p:o.name.localeCompare(l.name)}).map((o,l)=>({...o,productId:l}))}static getCartPreparedOption(t,n){if(!t?.length)return[];const r=n.flatMap(a=>a.items||[]);return t.map(a=>{const s=r.find(i=>i.parentName===a.parentName&&i.metadata?.label===a.metadata?.label);return{...a,count:s?s.count:1}})}}const kp=({text:e,isActive:t=!1,onClick:n})=>{const r=()=>{n&&n()},a=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())};return m.jsx("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:a,className:`
|
|
55
55
|
flex flex-row justify-center items-center max-w-max px-4 py-2 capitalize rounded-full
|
|
56
56
|
font-medium text-sm cursor-pointer transition-all duration-[400ms] ease-in-out
|
|
57
57
|
outline-none focus:ring-2 focus:ring-[var(--main-accent-color)] focus:ring-offset-2
|
|
@@ -78,7 +78,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
78
78
|
<div class="p-4">
|
|
79
79
|
${String(i).trim()}
|
|
80
80
|
</div>
|
|
81
|
-
</details>`})}function tC({children:e,className:t="",openFirst:n=!1}){const a=eC(typeof e=="string"?e:"",{openFirst:n});return m.jsx("div",{className:["prose",Zd.prose,t].filter(Boolean).join(" "),children:m.jsx(Sx,{rehypePlugins:[Q_],children:a})})}function nC(e){return m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,className:"size-5",...e,children:[m.jsx("rect",{x:"0.666667",y:"0.666667",width:"10.6667",height:"10.6667",rx:"5.33333",stroke:"#B1B1B1",strokeWidth:"1.33333"}),m.jsx("circle",{cx:"6.00065",cy:"3.33268",r:"0.666667",fill:"#B1B1B1"}),m.jsx("rect",{x:"5.33398",y:"5.33398",width:"1.33333",height:"4",fill:"#B1B1B1"})]})}const Eu={},Jd=({tooltipData:e,openFirst:t=!1,trigger:n})=>{if(!e?.trim())return null;const r=a=>{a.stopPropagation()};return m.jsxs(Js,{children:[m.jsx(ei,{asChild:!0,children:n??m.jsx("button",{className:Eu.iconBtn,"aria-label":"Open tooltip",onClick:r,children:m.jsx(nC,{className:Eu.iconSvg})})}),m.jsx(ti,{className:"bg-[#000] text-white text-[1.1rem] leading-[1.45] w-auto max-w-[300px]",side:"top",children:m.jsx(tC,{openFirst:t,children:e})})]})},ef=y.forwardRef(({values:e,value:t,onValueChange:n,placeholder:r="Sort by",title:a,className:s,dropdownWidth:i,align:o="start",showClear:l=!1,getTooltipByMaterialAndSection:c,sectionName:d},f)=>{const[p,h]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{if(!p)return;const _=k=>{const L=k.target,v=x.current;v&&(v.contains(L)||L===v)||h(!1)},N=k=>k.key==="Escape"&&h(!1);return window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("keydown",N),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("keydown",N)}},[p]);const g=t?e.find(_=>_.value===t):void 0,A=_=>{n(_),h(!1)},E=()=>n(null);return m.jsxs(Cc,{open:p,onOpenChange:h,children:[m.jsxs(Ac,{ref:f,"aria-haspopup":"listbox","aria-expanded":p,className:ke("inline-flex flex-row items-center justify-between gap-[8px] rounded-full bg-[var(--label-bg, #f5f5f5)] px-
|
|
81
|
+
</details>`})}function tC({children:e,className:t="",openFirst:n=!1}){const a=eC(typeof e=="string"?e:"",{openFirst:n});return m.jsx("div",{className:["prose",Zd.prose,t].filter(Boolean).join(" "),children:m.jsx(Sx,{rehypePlugins:[Q_],children:a})})}function nC(e){return m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,className:"size-5",...e,children:[m.jsx("rect",{x:"0.666667",y:"0.666667",width:"10.6667",height:"10.6667",rx:"5.33333",stroke:"#B1B1B1",strokeWidth:"1.33333"}),m.jsx("circle",{cx:"6.00065",cy:"3.33268",r:"0.666667",fill:"#B1B1B1"}),m.jsx("rect",{x:"5.33398",y:"5.33398",width:"1.33333",height:"4",fill:"#B1B1B1"})]})}const Eu={},Jd=({tooltipData:e,openFirst:t=!1,trigger:n})=>{if(!e?.trim())return null;const r=a=>{a.stopPropagation()};return m.jsxs(Js,{children:[m.jsx(ei,{asChild:!0,children:n??m.jsx("button",{className:Eu.iconBtn,"aria-label":"Open tooltip",onClick:r,children:m.jsx(nC,{className:Eu.iconSvg})})}),m.jsx(ti,{className:"bg-[#000] text-white text-[1.1rem] leading-[1.45] w-auto max-w-[300px]",side:"top",children:m.jsx(tC,{openFirst:t,children:e})})]})},ef=y.forwardRef(({values:e,value:t,onValueChange:n,placeholder:r="Sort by",title:a,className:s,dropdownWidth:i,align:o="start",showClear:l=!1,getTooltipByMaterialAndSection:c,sectionName:d},f)=>{const[p,h]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{if(!p)return;const _=k=>{const L=k.target,v=x.current;v&&(v.contains(L)||L===v)||h(!1)},N=k=>k.key==="Escape"&&h(!1);return window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("keydown",N),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("keydown",N)}},[p]);const g=t?e.find(_=>_.value===t):void 0,A=_=>{n(_),h(!1)},E=()=>n(null);return m.jsxs(Cc,{open:p,onOpenChange:h,children:[m.jsxs(Ac,{ref:f,"aria-haspopup":"listbox","aria-expanded":p,className:ke("inline-flex flex-row items-center justify-between gap-[8px] rounded-full bg-[var(--label-bg, #f5f5f5)] px-[8px] py-[8px] text-xs font-medium h-[36px] text-blackborder border-transparent hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--main-accent-color)]sm:w-[102px]",s),children:[m.jsx("span",{className:ke(!g&&"text-xs text-gray-700 ms:text-sm"),children:g?.label??r}),m.jsx(kl,{className:ke("h-4 w-[16px] transition-transform",p&&"rotate-180")})]}),m.jsxs(Sc,{ref:x,align:o,sideOffset:6,className:ke("bg-white border border-gray-200 rounded-xl shadow-lg z-50 max-h-80 overflow-y-auto p-0",i||"w-[var(--radix-popover-trigger-width)]"),style:{WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},onTouchStart:_=>_.stopPropagation(),onTouchMove:_=>_.stopPropagation(),onWheel:_=>_.stopPropagation(),children:[(a??r)&&m.jsx("div",{className:"px-4 pt-3 pb-2 text-[1rem] font-regular",children:a??r}),l&&t!==null&&m.jsx("div",{className:"px-4 py-2 border-b",children:m.jsxs("button",{onClick:E,className:"inline-flex flex-row items-center gap-[4px] text-[0.95rem] text-black hover:text-[var(--main-accent-color)] transition-colors",children:[m.jsx(Bs,{className:"h-3.5 w-[12px].5"}),"Clear"]})}),m.jsx("div",{role:"listbox","aria-activedescendant":g?`option-${g.value}`:void 0,className:"py-1",children:e.map(_=>{const N=t===_.value;return m.jsxs("div",{id:`option-${_.value}`,role:"option","aria-selected":N,tabIndex:0,className:ke("flex flex-row items-start justify-between gap-[8px] px-4 py-2 cursor-pointer","hover:bg-gray-50 focus:bg-gray-50 focus:outline-none"),onClick:()=>A(_.value),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),A(_.value))},children:[m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("span",{className:"text-[1.05rem]",children:_.label}),(()=>{if(!c||!d)return null;const k=c(_.value,d);return k?.Description?m.jsx(Jd,{tooltipData:k.Description}):null})()]}),N?m.jsx(wl,{className:"h-4 w-[16px]"}):null]},_.value)})})]})]})});ef.displayName="SingleSelect";const tf=({size:e=80,trackClassName:t="text-white",accentClassName:n="text-amber-700",className:r="",isOverlay:a=!0})=>m.jsx("div",{className:a?"absolute inset-0 flex flex-row items-center justify-center backdrop-blur bg-black/30 z-150":"inline-flex flex-row items-center justify-center",children:m.jsxs("span",{role:"status","aria-label":"Loading",className:r,style:{width:e,height:e},children:[m.jsxs("svg",{viewBox:"0 0 80 80",className:"animate-spin",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M40.0003 6.66675V20.0001M54.0003 26.0001L63.667 16.3334M60.0003 40.0001H73.3337M54.0003 54.0001L63.667 63.6667M40.0003 60.0001V73.3334M16.3337 63.6667L26.0003 54.0001M6.66699 40.0001H20.0003M16.3337 16.3334L26.0003 26.0001",stroke:"currentColor",className:t,strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M54 25.9999L63.6667 16.3333",stroke:"currentColor",className:n,strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"})]}),m.jsx("span",{className:"sr-only",children:"Loading…"})]})}),rC=({open:e,target:t,children:n,offset:r=12,maxWidthPx:a=420,forceOverflowVisible:s=!0})=>{const i=D.useRef(null),[o,l]=D.useState({top:0,left:0,arrowLeft:16});return D.useEffect(()=>{if(!e||!t||!s)return;const c=t.style.position;getComputedStyle(t).position==="static"&&(t.style.position="relative");const f=t.style.overflow;return t.style.overflow="visible",()=>{t.style.position=c,t.style.overflow=f}},[e,t,s]),D.useLayoutEffect(()=>{if(!e||!t)return;const c=10,d=8,f=()=>{const g=i.current;if(!g)return;const A={vis:g.style.visibility,top:g.style.top,left:g.style.left,maxW:g.style.maxWidth,transform:g.style.transform};g.style.visibility="hidden",g.style.top="0px",g.style.left="0px",g.style.transform="none",g.style.maxWidth=`min(${a}px, calc(100vw - ${d*2}px))`;const E=g.getBoundingClientRect(),_=E.width,N=E.height,k=t.getBoundingClientRect(),L=k.left,v=Math.max(d,Math.min(L,window.innerWidth-d-_)),R=Math.max(d,k.top-(N+r+c)),P=L-v+16,q=Math.max(8,Math.min(P,_-8));g.style.visibility=A.vis,g.style.top=A.top,g.style.left=A.left,g.style.maxWidth=A.maxW,g.style.transform=A.transform,l({top:R,left:v,arrowLeft:q})};f();const p=()=>f(),h=()=>f();window.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",h);const x=new ResizeObserver(()=>f());return x.observe(t),()=>{window.removeEventListener("scroll",p),window.removeEventListener("resize",h),x.disconnect()}},[e,t,r,a]),!e||!t?null:Vt.createPortal(m.jsx("div",{className:"fixed inset-0 z-[60000] pointer-events-none",children:m.jsxs("div",{ref:i,role:"tooltip",className:`
|
|
82
82
|
absolute
|
|
83
83
|
rounded-2xl
|
|
84
84
|
text-white text-sm leading-6 font-medium
|
|
@@ -88,21 +88,21 @@ ${String(i).trim()}
|
|
|
88
88
|
border-l-[10px] border-l-transparent
|
|
89
89
|
border-r-[10px] border-r-transparent
|
|
90
90
|
border-t-[10px]
|
|
91
|
-
`,style:{left:o.arrowLeft,borderTopColor:"rgba(40,40,40,0.8)"}})]})}),document.
|
|
91
|
+
`,style:{left:o.arrowLeft,borderTopColor:"rgba(40,40,40,0.8)"}})]})}),document.querySelector("#root-container"))},nf=({val:e,onDelete:t})=>{const[n,r]=D.useState(null),[a,s]=D.useState(!1),[i,o]=D.useState({materialName:"",parentName:"",productName:""}),l=e.metadata,c=d=>{d.stopPropagation(),t(e)};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&d.preventDefault()},className:`
|
|
92
92
|
bg-[var(--background-grey)] relative w-[40px] h-[40px] border border-solid border-[var(--border)]
|
|
93
93
|
rounded-sm aspect-square overflow-hidden transition sm:w-[64px] sm:h-[64px]
|
|
94
94
|
select-none
|
|
95
95
|
`,"aria-label":`Selected swatch ${e.name??e.assetId}`,title:"Click to remove",onMouseEnter:d=>{r(d.currentTarget),o({materialName:l?.label||e?.name||"empty_materialName",parentName:e.parentName,productName:e.productName||"empty_product_name"}),s(!0)},onMouseLeave:()=>s(!1),children:[zt.getImage(e)?m.jsx(zs,{item:e}):m.jsx(Ys,{item:e}),m.jsx("div",{onClick:c,className:`absolute top-0 right-0 m-2 w-[16px] h-[16px] flex flex-row justify-center items-center
|
|
96
96
|
bg-[var(--background-grey)] rounded-2xl border-none z-[100] cursor-pointer`,children:m.jsx(cr,{className:"w-[8px] h-2 stroke-[var(--svg-dark)]"})})]}),m.jsx(rC,{open:a,target:n,offset:8,children:m.jsxs(m.Fragment,{children:[i.materialName," | ",i.parentName]})})]})},aC=()=>m.jsx("div",{className:["relative w-[40px] h-[40px] rounded-sm aspect-square overflow-hidden","border border-solid border-[var(--border)] bg-[var(--sidebar-b)] sm:w-[64px] sm:h-[64px]"].join(" "),"aria-hidden":!0}),sC=({selectedMaterials:e,containerStyles:t="p-[var(--padding)] border-t border-solid border-[var(--border)] shrink-0 sm:p-[var(--sm-padding)]"})=>{const n=Pe(),r=oe(na),a=oe(yn),s=o=>{if(!r)return;const l=f=>f.metadata?.label===o.metadata?.label&&f.parentName===o.parentName,c=a.find(f=>f.items.some(l)),d=c?.items.filter(f=>!l(f));if(c){const f={assetId:c.assetId||"empty_assetId",name:c.name,items:d||[]};n(rs(f)),n(as(f))}},i=Math.max(0,Re-e.length);return m.jsxs("div",{className:t,children:[m.jsxs("div",{className:"flex flex-row justify-between items-center mb-[12px]",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"",children:"Swatches list"}),m.jsx("span",{className:"absolute top-0 right-[-20px] font-medium text-[var(--main-accent-color)] text-[8px] leading-none",children:"Free"})]}),m.jsxs("div",{children:[e.length,"/",Re," Selected"]})]}),m.jsxs("div",{className:"flex flex-row flex-wrap gap-[8px]",children:[e.map((o,l)=>{const c=o.metadata;return m.jsx(nf,{val:o,onDelete:s},`${c?.label||l}/${o.parentName}`)}),Array.from({length:i}).map((o,l)=>m.jsx(aC,{},`mock-${l}`))]})]})},rf=()=>{const e=Pe(),t=oe(yn),n=D.useMemo(()=>t.flatMap(a=>a.items.map(s=>({...s,productName:a.name}))),[t]),r=()=>{n.length&&e(Uu(!0))};return m.jsxs("div",{className:`flex flex-col border-t border-[var(--border)] shrink-0 shadow-[0_-2px_10px_rgba(40,40,40,0.10)]
|
|
97
97
|
sm:flex-row
|
|
98
|
-
`,children:[m.jsx(sC,{selectedMaterials:n,containerStyles:"flex flex-col p-[var(--sm-padding)] shrink-0 sm:w-[50%] sm:border-r sm:border-[var(--border)]"}),m.jsx("div",{className:"flex flex-row w-full p-[var(--sm-padding)] border-t border-[var(--border)] sm:border-none lg:w-[50%] sm:justify-center sm:items-center lg:justify-end lg:items-end",children:m.jsx("div",{className:"w-full lg:w-[50%]",children:m.jsx(Gu,{onClick:r,children:"ADD SWATCHES TO CART"})})})]})},iC=[{label:"Clear All",value:""},{label:"A-Z",value:"asc"},{label:"Z-A",value:"dsc"}],oC=()=>{const e=Pe(),t=oe(Mh),n=oe(Vu),r=oe(Dh),a=oe(yn),[s,i]=D.useState($l),[o,l]=D.useState(""),[c,d]=D.useState(""),[f,p]=D.useState(null);D.useEffect(()=>{const E=setTimeout(()=>{d(o.trim().toLowerCase())},300);return()=>clearTimeout(E)},[o]),D.useEffect(()=>{e($n())},[e]);const h=D.useMemo(()=>wp.getUniqueCategories(r),[r]),x=E=>E.toLowerCase(),g=D.useMemo(()=>new Intl.Collator(void 0,{sensitivity:"base",numeric:!1}),[]),A=D.useMemo(()=>{let E=r;if(s?.value){const _=x(s.value);E=E.filter(N=>x(N.collection??"")===_)}return c&&(E=E.filter(_=>x(_.name).includes(c))),f==="asc"?E=[...E].sort((_,N)=>g.compare(_.name,N.name)):f==="dsc"?E=[...E].sort((_,N)=>g.compare(N.name,_.name)):E=[...E],E},[r,s,c,f,g]);return m.jsxs("div",{className:"relative flex flex-col h-full min-h-0 w-full",children:[m.jsxs("div",{className:"flex-shrink-0",children:[m.jsx("div",{className:"h-40 overflow-hidden",children:m.jsx("img",{src:"https://clownfish-app-cvxrz.ondigitalocean.app/assets/header_image-BZoSlAHj.png",className:"object-cover w-full h-full"})}),m.jsxs("header",{className:"flex flex-col border-b border-[var(--border)] lg:flex-row lg:justify-between",children:[m.jsx("h1",{className:"m-0! p-[var(--sm-padding)] text-
|
|
98
|
+
`,children:[m.jsx(sC,{selectedMaterials:n,containerStyles:"flex flex-col p-[var(--sm-padding)] shrink-0 sm:w-[50%] sm:border-r sm:border-[var(--border)]"}),m.jsx("div",{className:"flex flex-row w-full p-[var(--sm-padding)] border-t border-[var(--border)] sm:border-none lg:w-[50%] sm:justify-center sm:items-center lg:justify-end lg:items-end",children:m.jsx("div",{className:"w-full lg:w-[50%]",children:m.jsx(Gu,{onClick:r,children:"ADD SWATCHES TO CART"})})})]})},iC=[{label:"Clear All",value:""},{label:"A-Z",value:"asc"},{label:"Z-A",value:"dsc"}],oC=()=>{const e=Pe(),t=oe(Mh),n=oe(Vu),r=oe(Dh),a=oe(yn),[s,i]=D.useState($l),[o,l]=D.useState(""),[c,d]=D.useState(""),[f,p]=D.useState(null);D.useEffect(()=>{const E=setTimeout(()=>{d(o.trim().toLowerCase())},300);return()=>clearTimeout(E)},[o]),D.useEffect(()=>{e($n())},[e]);const h=D.useMemo(()=>wp.getUniqueCategories(r),[r]),x=E=>E.toLowerCase(),g=D.useMemo(()=>new Intl.Collator(void 0,{sensitivity:"base",numeric:!1}),[]),A=D.useMemo(()=>{let E=r;if(s?.value){const _=x(s.value);E=E.filter(N=>x(N.collection??"")===_)}return c&&(E=E.filter(_=>x(_.name).includes(c))),f==="asc"?E=[...E].sort((_,N)=>g.compare(_.name,N.name)):f==="dsc"?E=[...E].sort((_,N)=>g.compare(N.name,_.name)):E=[...E],E},[r,s,c,f,g]);return m.jsxs("div",{className:"relative flex flex-col h-full min-h-0 w-full",children:[m.jsxs("div",{className:"flex-shrink-0",children:[m.jsx("div",{className:"h-40 overflow-hidden",children:m.jsx("img",{src:"https://clownfish-app-cvxrz.ondigitalocean.app/assets/header_image-BZoSlAHj.png",className:"object-cover w-full h-full"})}),m.jsxs("header",{className:"flex flex-col border-b border-[var(--border)] lg:flex-row lg:justify-between",children:[m.jsx("h1",{className:"m-0! p-[var(--sm-padding)] text-base font-medium",children:"Swatches store"}),m.jsx("div",{className:"flex flex-row justify-center items-center border-t border-[var(--border)] p-[var(--sm-padding)] text-xs font-medium leading-[24px] lg:border-none",children:m.jsxs("span",{children:["Choose 5 free swatches to curate your perfect design. Plus get"," ",m.jsx("span",{className:"text-[var(--main-accent-color)] underline",children:"free design advice"})," ","from our experts"]})})]})]}),m.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[(t||n)&&m.jsx(tf,{}),m.jsxs("div",{className:"flex flex-row w-full items-center justify-between gap-[16px] border-b border-[var(--border)] p-[var(--sm-padding)]",children:[m.jsxs("div",{className:"flex flex-row h-[36px] w-full items-center justify-between gap-[16px] shrink-0 lg:max-w-[382px]",children:[m.jsxs("div",{className:"relative h-[36px] flex-1 min-w-0 lg:max-w-[240px]",children:[m.jsx("input",{type:"text",placeholder:"Search",value:o,onChange:E=>l(E.target.value),className:`
|
|
99
99
|
h-full w-full rounded-2xl border border-[var(--border)] bg-[var(--background)]
|
|
100
100
|
px-4 pr-8 text-sm text-black placeholder-[var(--text-muted)]
|
|
101
101
|
transition focus:border-[var(--main-accent-color)] focus:outline-none
|
|
102
102
|
`}),m.jsx("div",{className:`
|
|
103
103
|
pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 sm:right-4
|
|
104
104
|
[&_svg_path]:stroke-[var(--svg-dark)]
|
|
105
|
-
`,children:m.jsx(Np,{width:20,height:20})})]}),m.jsx(ef,{title:"Sort by",placeholder:"Sort by",values:iC,value:f,onValueChange:p,className:"shrink-0 w-[90px] xxs:w-[100px] bg-[var(--label-bg)] sm:py-
|
|
105
|
+
`,children:m.jsx(Np,{width:20,height:20})})]}),m.jsx(ef,{title:"Sort by",placeholder:"Sort by",values:iC,value:f,onValueChange:p,className:"shrink-0 w-[90px] xxs:w-[100px] bg-[var(--label-bg)] sm:py-8px sm:px-16px sm:w-[102px]",dropdownWidth:"w-64"})]}),m.jsx(Ji,{items:h,activeId:s.productId,onSelect:E=>i(E),className:"hidden lg:flex flex-row shrink-0 overflow-x-auto"})]}),m.jsx(Ji,{items:h,activeId:s.productId,onSelect:E=>i(E),className:"h-[64px] p-[var(--sm-padding)] border-b border-[var(--border)] lg:hidden"}),m.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-[var(--sm-padding)]",children:[m.jsx("div",{className:"mb-4",children:"Select Product"}),A.length?m.jsx("ul",{className:"grid grid-cols-2 gap-[16px] sm:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 2xl:grid-cols-9",children:A.map(E=>m.jsx(vp,{productListItem:E},E.name))}):m.jsx("div",{className:"flex flex-row h-full items-center justify-center",children:"No products were found"})]}),a.length?m.jsx(rf,{}):null]})]})};function uC(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ya="Checkbox",[lC]=aa(ya),[cC,Ci]=lC(ya);function dC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:s,form:i,name:o,onCheckedChange:l,required:c,value:d="on",internal_do_not_use_render:f}=e,[p,h]=ws({prop:n,defaultProp:a??!1,onChange:l,caller:ya}),[x,g]=y.useState(null),[A,E]=y.useState(null),_=y.useRef(!1),N=x?!!i||!!x.closest("form"):!0,k={checked:p,disabled:s,setChecked:h,control:x,setControl:g,name:o,form:i,value:d,hasConsumerStoppedPropagationRef:_,required:c,defaultChecked:Rt(a)?!1:a,isFormControl:N,bubbleInput:A,setBubbleInput:E};return m.jsx(cC,{scope:t,...k,children:fC(f)?f(k):r})}var af="CheckboxTrigger",sf=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a)=>{const{control:s,value:i,disabled:o,checked:l,required:c,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:h,bubbleInput:x}=Ci(af,e),g=Xe(a,d),A=y.useRef(l);return y.useEffect(()=>{const E=s?.form;if(E){const _=()=>f(A.current);return E.addEventListener("reset",_),()=>E.removeEventListener("reset",_)}},[s,f]),m.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":Rt(l)?"mixed":l,"aria-required":c,"data-state":ff(l),"data-disabled":o?"":void 0,disabled:o,value:i,...r,ref:g,onKeyDown:Le(t,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Le(n,E=>{f(_=>Rt(_)?!0:!_),x&&h&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})});sf.displayName=af;var of=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:s,required:i,disabled:o,value:l,onCheckedChange:c,form:d,...f}=e;return m.jsx(dC,{__scopeCheckbox:n,checked:a,defaultChecked:s,disabled:o,required:i,onCheckedChange:c,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:p})=>m.jsxs(m.Fragment,{children:[m.jsx(sf,{...f,ref:t,__scopeCheckbox:n}),p&&m.jsx(df,{__scopeCheckbox:n})]})})});of.displayName=ya;var uf="CheckboxIndicator",lf=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,s=Ci(uf,n);return m.jsx(_n,{present:r||Rt(s.checked)||s.checked===!0,children:m.jsx(Ne.span,{"data-state":ff(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});lf.displayName=uf;var cf="CheckboxBubbleInput",df=y.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:i,required:o,disabled:l,name:c,value:d,form:f,bubbleInput:p,setBubbleInput:h}=Ci(cf,e),x=Xe(n,h),g=uC(s),A=sc(r);y.useEffect(()=>{const _=p;if(!_)return;const N=window.HTMLInputElement.prototype,L=Object.getOwnPropertyDescriptor(N,"checked").set,v=!a.current;if(g!==s&&L){const R=new Event("click",{bubbles:v});_.indeterminate=Rt(s),L.call(_,Rt(s)?!1:s),_.dispatchEvent(R)}},[p,g,s,a]);const E=y.useRef(Rt(s)?!1:s);return m.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??E.current,required:o,disabled:l,name:c,value:d,form:f,...t,tabIndex:-1,ref:x,style:{...t.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});df.displayName=cf;function fC(e){return typeof e=="function"}function Rt(e){return e==="indeterminate"}function ff(e){return Rt(e)?"indeterminate":e?"checked":"unchecked"}function hC({className:e,...t}){return m.jsx(of,{"data-slot":"checkbox",className:ke(`
|
|
106
106
|
bg-white peer border-input dark:bg-input/30
|
|
107
107
|
data-[state=checked]:bg-transparent
|
|
108
108
|
data-[state=checked]:text-black
|
|
@@ -116,12 +116,12 @@ ${String(i).trim()}
|
|
|
116
116
|
flex-none flex flex-row justify-center items-center
|
|
117
117
|
w-[20px] h-5 rounded-full
|
|
118
118
|
bg-[var(--main-accent-color)] text-white
|
|
119
|
-
text-[
|
|
119
|
+
text-[1rem] leading-none
|
|
120
120
|
select-none pointer-events-none
|
|
121
121
|
overflow-hidden
|
|
122
|
-
`,children:g})]});if(e.length)return m.jsxs(Cc,{open:d,onOpenChange:f,children:[m.jsxs(Ac,{ref:c,className:ke("flex flex-row items-center justify-between rounded-full border border-[var(--main-accent-color)] px-2 sm:px-4 py-2 bg-white cursor-pointer hover:bg-gray-50 data-[state=open]:border-primary hover:border-primary focus:border-primary min-h-9",a),children:[m.jsx("div",{className:"w-full text-
|
|
122
|
+
`,children:g})]});if(e.length)return m.jsxs(Cc,{open:d,onOpenChange:f,children:[m.jsxs(Ac,{ref:c,className:ke("flex flex-row items-center justify-between rounded-full border border-[var(--main-accent-color)] px-2 sm:px-4 py-2 bg-white cursor-pointer hover:bg-gray-50 data-[state=open]:border-primary hover:border-primary focus:border-primary min-h-9",a),children:[m.jsx("div",{className:"w-full text-xs truncate text-left leading-[20px] sm:text-sm",children:A}),m.jsx(kl,{className:ke("h-4 w-[16px] transition-transform",d&&"rotate-180")})]}),m.jsxs(Sc,{ref:p,className:ke("bg-white border rounded-lg shadow-lg z-50 max-h-75 text-sm overflow-y-auto overscroll-behavior-y-contain touch-pan-y p-2",s||"w-[var(--radix-popover-trigger-width)]"),align:i,sideOffset:4,style:{WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},onTouchStart:E=>{E.stopPropagation()},onTouchMove:E=>{E.stopPropagation()},onWheel:E=>{E.stopPropagation()},children:[g>0&&m.jsx("div",{className:"flex flex-row gap-[8px] items-center justify-between px-2 py-1 mb-2 border-b",children:m.jsxs("button",{onClick:x,className:"text-sm text-black hover:text-primary transition-color cursor-pointer duration-200 flex flex-row items-center gap-[4px]",children:[m.jsx(Bs,{className:"h-3 w-[12px]"}),"Clear all"]})}),m.jsx("div",{className:"flex flex-col gap-[4px]",children:e.map(E=>{const _=t.includes(E.value);return m.jsxs("div",{className:"flex flex-row items-start gap-[8px] px-2 py-1 hover:bg-gray-50 rounded transition-background duration-300 cursor-pointer",onClick:()=>h(E.value,!_),children:[m.jsx(hC,{checked:_,className:"size-6",onCheckedChange:N=>h(E.value,N)}),m.jsxs("div",{className:"flex-1 flex flex-row items-center justify-between",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("span",{className:"text-sm",children:E.label}),(()=>{if(!o||!l)return null;const N=o(E.value,l);return N&&N.Description?m.jsx(Jd,{tooltipData:N?.Description}):null})()]}),E.count!==void 0&&m.jsx("span",{className:"text-sm text-gray-800 bg-gray-100 px-2 py-0.5 ml-2 rounded-full whitespace-nowrap",children:E.count})]})]},E.value)})})]})]})});Er.displayName="MultiSelect";const hf=({containerStyles:e,selectStyles:t})=>{const n=Pe(),r=oe(Lh),a=oe(xn),[s,i]=D.useState([]),[o,l]=D.useState([]);D.useEffect(()=>{if(!r?.length)return;const d=r.map(f=>{if(f.metadata){const{Name:p,Label:h}=f.metadata||{};return{value:p,label:h,id:p}}else{const{label:p,value:h}=f||{};return{value:h,label:p,id:h}}});i(d)},[r]);const c=(d,f)=>{if(f.length){const p=Iu(f);if(p.length){const h=r.filter(A=>A.metadata?p.includes(A.metadata?.Label):p.includes(A.value));l(p);const x=Fr.mapFiltersFromValues(h,a),g=Fr.getPositiveSelectedFilers(x);g.length&&g.forEach(A=>{const{filterName:E,filterKeys:_}=A;n(ea({filterName:E,values:_}))}),n(_a({attributes:h}))}else n(_a({attributes:r}))}else l([]),n(_a({attributes:r}))};return m.jsxs("div",{className:e,children:[m.jsx("span",{children:"Product element"}),m.jsx(Er,{options:s,values:o,onValueChange:d=>c("PanelElement",d),placeholder:"All product elements",className:t,dropdownWidth:"w-80"})]})},mC=()=>{const e=Pe(),t=oe(xn),n=oe(lr),[r,a]=D.useState([]);D.useEffect(()=>{if(n?.length){const i=[...new Set(n.map(o=>o.metadata?.Finish||o.metadata?.Material))].filter(Boolean).map(o=>{const l=n.filter(c=>c.metadata?.Finish===o||c.metadata?.Material===o).length;return{value:o,label:o,count:l}});i?.length&&a(i)}},[n]);const s=(i,o)=>{e(ea({filterName:i,values:o}))};return m.jsx(Er,{options:r,values:t.Finish,onValueChange:i=>s("Finish",i),placeholder:"Material",dropdownWidth:"w-80"})},pC=()=>{const e=Pe(),t=oe(xn),n=oe(lr),[r,a]=D.useState([]);D.useEffect(()=>{if(n?.length){const i=[...new Set(n.map(o=>o?.metadata?.Color).filter(Boolean).map(o=>o.split(",").map(l=>l.trim())).flat())].map(o=>{const l=n.filter(c=>c.metadata?.Color&&c.metadata?.Color.split(",").map(d=>d.trim()).includes(o)).length;return{value:o,label:o,count:l}});i?.length&&a(i)}},[n]);const s=(i,o)=>{e(ea({filterName:i,values:o}))};return m.jsx(Er,{options:r,values:t.Color,onValueChange:i=>s("Color",i),placeholder:"Color",dropdownWidth:"w-80"})},gC=()=>{const e=Pe(),t=oe(xn),n=oe(lr),[r,a]=D.useState([]);D.useEffect(()=>{if(n?.length){const i=[...new Set(n.map(o=>o?.metadata?.Look).filter(Boolean).map(o=>o.split(",").map(l=>l.trim())).flat())].map(o=>{const l=n.filter(c=>c.metadata?.Look&&c.metadata?.Look.split(",").map(d=>d.trim()).includes(o)).length;return{value:o,label:o,count:l}});i?.length&&a(i)}},[n]);const s=(i,o)=>{e(ea({filterName:i,values:o}))};return m.jsx(Er,{options:r,values:t.Look,onValueChange:i=>s("Look",i),placeholder:"Look",dropdownWidth:"w-80"})},mf=()=>m.jsxs("div",{className:"flex flex-row items-center gap-[16px] p-[var(--sm-padding)]",children:[m.jsx(mC,{}),m.jsx(pC,{}),m.jsx(gC,{})]}),bC=()=>m.jsxs("div",{className:`flex flex-col justify-between border-b border-[var(--border)]
|
|
123
123
|
sm:flex-row
|
|
124
|
-
`,children:[m.jsx(hf,{containerStyles:`flex flex-row justify-between items-center gap-[8px] p-[var(--sm-padding)] w-full text-
|
|
124
|
+
`,children:[m.jsx(hf,{containerStyles:`flex flex-row justify-between items-center gap-[8px] p-[var(--sm-padding)] w-full text-xs
|
|
125
125
|
border-b border-[var(--border)]
|
|
126
126
|
sm:max-w-[360px] sm:text-sm sm:border-none
|
|
127
127
|
`,selectStyles:"min-w-[auto] max-w-[154px] sm:max-w-[auto] sm:min-w-[180px] font-normal"}),m.jsx(mf,{})]});function on(e,t,n){let r=n.initialDeps??[],a;function s(){var i,o,l,c;let d;n.key&&((i=n.debug)!=null&&i.call(n))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((x,g)=>r[g]!==x)))return a;r=f;let h;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(h=Date.now()),a=t(...f),n.key&&((l=n.debug)!=null&&l.call(n))){const x=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-h)*100)/100,A=g/16,E=(_,N)=>{for(_=String(_);_.length<N;)_=" "+_;return _};console.info(`%c⏱ ${E(g,5)} /${E(x,5)} ms`,`
|
|
@@ -136,15 +136,15 @@ ${String(i).trim()}
|
|
|
136
136
|
flex flex-row items-center justify-center rounded-2xl border-none
|
|
137
137
|
bg-[var(--background-grey)] pointer-events-none
|
|
138
138
|
${l?"bg-[var(--main-accent-color)]":""}
|
|
139
|
-
`,children:m.jsx(wC,{})})]},e.assetId),m.jsxs("div",{className:"mb-[12px] flex flex-col",children:[m.jsxs("span",{className:"mb-[4px] text-
|
|
139
|
+
`,children:m.jsx(wC,{})})]},e.assetId),m.jsxs("div",{className:"mb-[12px] flex flex-col",children:[m.jsxs("span",{className:"mb-[4px] text-sm font-semibold leading-[16px]",children:[e.metadata?.label||e.label," "]}),m.jsxs("span",{className:"text-xs font-medium leading-[14px]",children:[e.parentName," "]})]})]})},kC=({isOpen:e,onClose:t,title:n="Message",width:r,height:a,children:s})=>{const i=D.useRef(null);return D.useEffect(()=>{const o=l=>{i.current&&!i.current.contains(l.target)&&t()};return e&&document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[e,t]),e?Vt.createPortal(m.jsx("div",{className:"fixed inset-0 z-99999999999999 flex flex-row items-center justify-center bg-black/40 p-4",children:m.jsxs("div",{ref:i,className:`
|
|
140
140
|
bg-white rounded-2xl shadow-xl flex flex-col overflow-hidden
|
|
141
141
|
max-w-[90vw] max-h-[90vh]
|
|
142
|
-
`,style:{width:r||"auto",height:a||"auto"},children:[m.jsxs("div",{className:"flex flex-row items-center justify-between p-[var(--sm-padding)] border-b border-[var(--border)]",children:[m.jsx("span",{className:"text-base font-semibold text-[var(--text)]",children:n}),m.jsx("button",{onClick:t,className:"flex flex-row justify-center items-center p-1 rounded-full bg-[var(--border)] hover:bg-gray-100 transition [&_svg_path]:stroke-[var(--svg-dark)] w-[30px] h-[30px]",children:m.jsx(cr,{className:"text-[var(--text)] ",width:10,hanging:10})})]}),m.jsx("div",{className:"flex flex-col gap-[12px] text-[var(--text-muted)]",children:s})]})}),document.
|
|
142
|
+
`,style:{width:r||"auto",height:a||"auto"},children:[m.jsxs("div",{className:"flex flex-row items-center justify-between p-[var(--sm-padding)] border-b border-[var(--border)]",children:[m.jsx("span",{className:"text-base font-semibold text-[var(--text)]",children:n}),m.jsx("button",{onClick:t,className:"flex flex-row justify-center items-center p-1 rounded-full bg-[var(--border)] hover:bg-gray-100 transition [&_svg_path]:stroke-[var(--svg-dark)] w-[30px] h-[30px]",children:m.jsx(cr,{className:"text-[var(--text)] ",width:10,hanging:10})})]}),m.jsx("div",{className:"flex flex-col gap-[12px] text-[var(--text-muted)]",children:s})]})}),document.querySelector("#root-container")):null},bf=({isOpen:e,onClose:t})=>m.jsx(kC,{isOpen:e,onClose:t,width:320,title:"Swatch Limit",children:m.jsxs("div",{children:[m.jsxs("div",{className:"text-sm font-medium p-[var(--sm-padding)] border-b border-[var(--border)] leading-[20px]",children:[m.jsx("p",{className:"mb-4",children:"You've reached your maximum number of swatches!"}),m.jsx("p",{children:"If you'd like to add another swatch please remove an existing swatch from your cart"})]}),m.jsx("div",{className:"p-[var(--sm-padding)] w-full",children:m.jsx("button",{className:`
|
|
143
143
|
w-full block py-3 rounded-full
|
|
144
144
|
bg-[var(--main-accent-color)] text-white font-bold capitalize
|
|
145
|
-
`,onClick:t,children:"OK"})})]})}),OC=({containerStyles:e="flex-1 min-h-0 overflow-y-auto p-[var(--padding)] sm:p-[var(--sm-padding)] ",gridStyles:t="grid grid-cols-1 gap-[8px] sm:grid-cols-3",desktopColumnsCount:n=3})=>{const r=Pe(),a=D.useRef(null),s=oe(lr),i=oe(xn),o=oe(na),l=oe(yn),[c,d]=D.useState(!1),f=D.useMemo(()=>l.flatMap($=>$.items),[l]),p=D.useMemo(()=>l.flatMap($=>$.items).reduce(($,Y)=>$+(Y.count??0),0),[l]),h=D.useMemo(()=>s.filter($=>{const Y=i.Finish.length===0||i.Finish.some(B=>$.metadata?.Finish===B||$.metadata?.Material===B),F=i.Color.length===0||$.metadata?.Color&&i.Color.some(B=>$.metadata?.Color?.split(",").map(ie=>ie.trim()).includes(B)),X=$.metadata?.Look,Q=!i.Look||i.Look.length===0||i.Look.some(B=>X&&X.includes(B));return Y&&F&&Q}),[i,s]),x=typeof window<"u"?window.matchMedia("(min-width: 640px)").matches:!1,g=x?n:1,A=Math.ceil(h.length/g),E=x?300:200,_=gf({count:A,getScrollElement:()=>a.current,estimateSize:()=>E,overscan:24,measureElement:$=>$?.getBoundingClientRect().height}),N=_.getVirtualItems(),k=_.getTotalSize(),L=N[0]?.index??0,v=N[N.length-1]?.index??-1,R=L*g,P=Math.min((v+1)*g,h.length),q=h.slice(R,P),K=N[0]?.start??0,U=k-(N[N.length-1]?.end??0),z=$=>{if(!o)return;const Y=l.find(Q=>o.assetId===Q.assetId),F=Q=>Q.metadata?.label===$.metadata?.label&&Q.parentName===$.parentName,X=f.some(F);if(!X&&p>=5){d(!0);return}if(X){const Q=f.filter(S=>!F(S)),ie={assetId:l.find(S=>S.items.some(xe=>xe.metadata?.label===$.metadata?.label&&xe.parentName===$.parentName))?.assetId||o.assetId,name:o.name,items:Q};r(rs(ie)),r(as(ie))}else if(f.length<5){const Q={...$,count:1},B=Y?[...Y.items,Q]:[Q],ie={assetId:o.assetId,name:o.name,items:B};r(rs(ie)),r(as(ie))}};return m.jsxs("div",{ref:a,className:e,children:[m.jsx(bf,{isOpen:c,onClose:()=>d(!1)}),m.jsx("div",{style:{height:K},"aria-hidden":!0}),m.jsx("div",{className:t,children:q.map(($,Y)=>{const F=R+Y,X=`${$.metadata?.label||F}/${$.parentName}`;return(F+1)%g===0||F===h.length-1?m.jsx("div",{ref:_.measureElement,children:m.jsx(Xr,{val:$,onClick:z})},X):m.jsx(Xr,{val:$,onClick:z},X)})}),m.jsx("div",{style:{height:U},"aria-hidden":!0})]})},RC=()=>{const e=Pe(),t=oe(na);D.useEffect(()=>()=>{e(bh())},[]);const n=()=>{e(Th())};return m.jsxs("div",{className:"flex flex-col h-full ",children:[m.jsx("header",{className:"flex flex-row shrink-0 items-center justify-between border-b border-[var(--border)] p-[var(--sm-padding)]",children:m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("button",{className:"[&_svg_path]:stroke-[var(--main-accent-color)] cursor-pointer",onClick:n,children:m.jsx(Ws,{})}),m.jsx("h2",{className:"m-0! text-base font-medium leading-[1.6]",children:t?.name})]})}),m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 ",children:[m.jsx("div",{className:"shrink-0",children:m.jsx(bC,{})}),m.jsx(OC,{containerStyles:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-[var(--sm-padding)]",gridStyles:"grid grid-cols-2 gap-[16px] sm:grid-cols-4 lg:grid-cols-5 xl:grid-cols-7 2xl:grid-cols-9",desktopColumnsCount:6}),m.jsx(rf,{})]})]})},LC=({onSendData:e})=>{const t=oe(Ph),n=oe(na);return m.jsx(m.Fragment,{children:t?m.jsx(Sp,{onSendData:e}):n?m.jsx(RC,{}):m.jsx(oC,{})})},Kr={SWATCH:"swatch",CART:"cart"},PC="_overlay_1aet8_1",DC="_panel_1aet8_10",MC="_enter_1aet8_38",BC="_exit_1aet8_42",Yn={overlay:PC,panel:DC,enter:MC,exit:BC},Ef=({children:e,isOpen:t,setIsOpen:n})=>{const r=D.useRef(null),a=D.useRef(null),s=()=>n(!1);return D.useLayoutEffect(()=>{t&&typeof document<"u"&&(a.current=document.activeElement)},[t]),D.useEffect(()=>{t?r.current?.focus():a.current?.focus?.()},[t]),D.useEffect(()=>{if(!t)return;const i=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t]),D.useEffect(()=>{if(!t)return;const i=document.documentElement,o=document.body,l=i.style.overflow,c=o.style.overflow;return i.style.overflow="hidden",o.style.overflow="hidden",()=>{i.style.overflow=l,o.style.overflow=c}},[t]),t?Vt.createPortal(m.jsx("div",{className:yt(Yn.overlay),onMouseDown:s,onTouchStart:s,children:m.jsx("div",{ref:r,tabIndex:-1,className:ke(Yn.panel,Yn.right,t?Yn.enter:Yn.exit,"bg-[var(--sidebar-bg)]"),onMouseDown:i=>i.stopPropagation(),onTouchStart:i=>i.stopPropagation(),children:e})}),document.
|
|
145
|
+
`,onClick:t,children:"OK"})})]})}),OC=({containerStyles:e="flex-1 min-h-0 overflow-y-auto p-[var(--padding)] sm:p-[var(--sm-padding)] ",gridStyles:t="grid grid-cols-1 gap-[8px] sm:grid-cols-3",desktopColumnsCount:n=3})=>{const r=Pe(),a=D.useRef(null),s=oe(lr),i=oe(xn),o=oe(na),l=oe(yn),[c,d]=D.useState(!1),f=D.useMemo(()=>l.flatMap($=>$.items),[l]),p=D.useMemo(()=>l.flatMap($=>$.items).reduce(($,Y)=>$+(Y.count??0),0),[l]),h=D.useMemo(()=>s.filter($=>{const Y=i.Finish.length===0||i.Finish.some(B=>$.metadata?.Finish===B||$.metadata?.Material===B),F=i.Color.length===0||$.metadata?.Color&&i.Color.some(B=>$.metadata?.Color?.split(",").map(ie=>ie.trim()).includes(B)),X=$.metadata?.Look,Q=!i.Look||i.Look.length===0||i.Look.some(B=>X&&X.includes(B));return Y&&F&&Q}),[i,s]),x=typeof window<"u"?window.matchMedia("(min-width: 640px)").matches:!1,g=x?n:1,A=Math.ceil(h.length/g),E=x?300:200,_=gf({count:A,getScrollElement:()=>a.current,estimateSize:()=>E,overscan:24,measureElement:$=>$?.getBoundingClientRect().height}),N=_.getVirtualItems(),k=_.getTotalSize(),L=N[0]?.index??0,v=N[N.length-1]?.index??-1,R=L*g,P=Math.min((v+1)*g,h.length),q=h.slice(R,P),K=N[0]?.start??0,U=k-(N[N.length-1]?.end??0),z=$=>{if(!o)return;const Y=l.find(Q=>o.assetId===Q.assetId),F=Q=>Q.metadata?.label===$.metadata?.label&&Q.parentName===$.parentName,X=f.some(F);if(!X&&p>=5){d(!0);return}if(X){const Q=f.filter(S=>!F(S)),ie={assetId:l.find(S=>S.items.some(xe=>xe.metadata?.label===$.metadata?.label&&xe.parentName===$.parentName))?.assetId||o.assetId,name:o.name,items:Q};r(rs(ie)),r(as(ie))}else if(f.length<5){const Q={...$,count:1},B=Y?[...Y.items,Q]:[Q],ie={assetId:o.assetId,name:o.name,items:B};r(rs(ie)),r(as(ie))}};return m.jsxs("div",{ref:a,className:e,children:[m.jsx(bf,{isOpen:c,onClose:()=>d(!1)}),m.jsx("div",{style:{height:K},"aria-hidden":!0}),m.jsx("div",{className:t,children:q.map(($,Y)=>{const F=R+Y,X=`${$.metadata?.label||F}/${$.parentName}`;return(F+1)%g===0||F===h.length-1?m.jsx("div",{ref:_.measureElement,children:m.jsx(Xr,{val:$,onClick:z})},X):m.jsx(Xr,{val:$,onClick:z},X)})}),m.jsx("div",{style:{height:U},"aria-hidden":!0})]})},RC=()=>{const e=Pe(),t=oe(na);D.useEffect(()=>()=>{e(bh())},[]);const n=()=>{e(Th())};return m.jsxs("div",{className:"flex flex-col h-full ",children:[m.jsx("header",{className:"flex flex-row shrink-0 items-center justify-between border-b border-[var(--border)] p-[var(--sm-padding)]",children:m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("button",{className:"[&_svg_path]:stroke-[var(--main-accent-color)] cursor-pointer",onClick:n,children:m.jsx(Ws,{})}),m.jsx("h2",{className:"m-0! text-base font-medium leading-[1.6]",children:t?.name})]})}),m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 ",children:[m.jsx("div",{className:"shrink-0",children:m.jsx(bC,{})}),m.jsx(OC,{containerStyles:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-[var(--sm-padding)]",gridStyles:"grid grid-cols-2 gap-[16px] sm:grid-cols-4 lg:grid-cols-5 xl:grid-cols-7 2xl:grid-cols-9",desktopColumnsCount:6}),m.jsx(rf,{})]})]})},LC=({onSendData:e})=>{const t=oe(Ph),n=oe(na);return m.jsx(m.Fragment,{children:t?m.jsx(Sp,{onSendData:e}):n?m.jsx(RC,{}):m.jsx(oC,{})})},Kr={SWATCH:"swatch",CART:"cart"},PC="_overlay_1aet8_1",DC="_panel_1aet8_10",MC="_enter_1aet8_38",BC="_exit_1aet8_42",Yn={overlay:PC,panel:DC,enter:MC,exit:BC},Ef=({children:e,isOpen:t,setIsOpen:n})=>{const r=D.useRef(null),a=D.useRef(null),s=()=>n(!1);return D.useLayoutEffect(()=>{t&&typeof document<"u"&&(a.current=document.activeElement)},[t]),D.useEffect(()=>{t?r.current?.focus():a.current?.focus?.()},[t]),D.useEffect(()=>{if(!t)return;const i=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t]),D.useEffect(()=>{if(!t)return;const i=document.documentElement,o=document.body,l=i.style.overflow,c=o.style.overflow;return i.style.overflow="hidden",o.style.overflow="hidden",()=>{i.style.overflow=l,o.style.overflow=c}},[t]),t?Vt.createPortal(m.jsx("div",{className:yt(Yn.overlay),onMouseDown:s,onTouchStart:s,children:m.jsx("div",{ref:r,tabIndex:-1,className:ke(Yn.panel,Yn.right,t?Yn.enter:Yn.exit,"bg-[var(--sidebar-bg)]"),onMouseDown:i=>i.stopPropagation(),onTouchStart:i=>i.stopPropagation(),children:e})}),document.querySelector("#root-container")):null};class FC{static getCartPreparedOption(t){return t?.length?t.map(n=>({...n,count:1})):[]}}const HC=()=>m.jsx("div",{className:["relative w-[40px] h-[40px] rounded-sm aspect-square overflow-hidden","border border-solid border-[var(--border)] bg-[var(--sidebar-b)] sm:w-[64px] sm:h-[64px]"].join(" "),"aria-hidden":!0}),UC=({selectedMaterials:e,containerStyles:t="p-[var(--sm-padding)] border-t border-solid border-[var(--border)] shrink-0 shadow-[0_-2px_10px_rgba(40,40,40,0.10)]"})=>{const n=Pe(),r=s=>{n(ta({selectedMaterial:s,materialCount:1,selectedMaterials:e}))},a=Math.max(0,Re-e.length);return m.jsxs("div",{className:t,children:[m.jsxs("div",{className:"flex flex-row justify-between items-center mb-[12px]",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"",children:"Swatches list"}),m.jsx("span",{className:"absolute top-0 right-[-20px] font-medium text-[var(--main-accent-color)] text-[8px] leading-none",children:"Free"})]}),m.jsxs("div",{children:[e.length,"/",Re," Selected"]})]}),m.jsxs("div",{className:"flex flex-row flex-wrap gap-[8px]",children:[e.map((s,i)=>{const o=s.metadata;return m.jsx(nf,{val:s,onDelete:r},`${o?.label||i}/${s.parentName}`)}),Array.from({length:a}).map((s,i)=>m.jsx(HC,{},`mock-${i}`))]})]})},jC=()=>{const e=oe($t)??[];return m.jsx(UC,{selectedMaterials:e})},zC=({containerStyles:e="flex-1 min-h-0 overflow-y-auto p-[var(--sm-padding)]",gridStyles:t="grid grid-cols-2 gap-[var(--sm-padding)] sm:grid-cols-3 ",desktopColumnsCount:n=3})=>{const r=Tn.useDispatch(),a=D.useRef(null),s=oe(lr),i=oe($t),o=oe(xn),[l,c]=D.useState(!1),d=D.useMemo(()=>i.reduce((U,z)=>U+(z.count??0),0),[i]),f=D.useMemo(()=>s.filter(U=>{const z=o.Finish.length===0||o.Finish.some(X=>U.metadata?.Finish===X||U.metadata?.Material===X),$=o.Color.length===0||U.metadata?.Color&&o.Color.some(X=>U.metadata?.Color?.split(",").map(Q=>Q.trim()).includes(X)),Y=U.metadata?.Look,F=!o.Look||o.Look.length===0||o.Look.some(X=>Y&&Y.includes(X));return z&&$&&F}),[o,s]),p=typeof window<"u"?window.matchMedia("(min-width: 640px)").matches:!1,h=p?n:1,x=Math.ceil(f.length/h),g=p?300:200,A=gf({count:x,getScrollElement:()=>a.current,estimateSize:()=>g,overscan:24,measureElement:U=>U?.getBoundingClientRect().height}),E=A.getVirtualItems(),_=A.getTotalSize(),N=E[0]?.index??0,k=E[E.length-1]?.index??-1,L=N*h,v=Math.min((k+1)*h,f.length),R=f.slice(L,v),P=E[0]?.start??0,q=_-(E[E.length-1]?.end??0),K=U=>{r(ta({materialCount:d,selectedMaterials:i,selectedMaterial:{...U,count:1},limitCb:()=>c(!0)}))};return m.jsxs("div",{ref:a,className:e,children:[m.jsx(bf,{isOpen:l,onClose:()=>c(!1)}),m.jsx("div",{style:{height:P},"aria-hidden":!0}),m.jsx("div",{className:t,children:R.map((U,z)=>{const $=L+z,Y=`${U.metadata?.label||$}/${U.parentName}`;return($+1)%h===0||$===f.length-1?m.jsx("div",{ref:A.measureElement,children:m.jsx(Xr,{val:U,onClick:K})},Y):m.jsx(Xr,{val:U,onClick:K},Y)})}),m.jsx("div",{style:{height:q},"aria-hidden":!0})]})},YC=({isOpen:e,onToggleSidebar:t,onSetActiveTab:n})=>{const r=Pe(),a=oe($t)??[],s=oe(Vu),i=()=>{const o=FC.getCartPreparedOption(a);o&&r(Ah(o)),n(Kr.CART)};return m.jsxs(Ef,{isOpen:e,setIsOpen:t,children:[m.jsxs("header",{className:"flex flex-row p-[var(--sm-padding)] justify-between items-center border-b border-solid border-[var(--border)]",children:[m.jsx("h2",{className:"m-0! text-[16px] leading-[1.6] font-medium",children:"Order free swatches"}),m.jsx("button",{className:`flex flex-row justify-center items-center w-[30px] h-[30px] bg-[var(--background-grey)]
|
|
146
146
|
border-none cursor-pointer rounded-full
|
|
147
|
-
[&_svg_path]:stroke-[var(--svg-dark)]`,onClick:t,children:m.jsx(cr,{width:10,height:10})})]}),m.jsxs("div",{className:"flex flex-col h-full min-h-0 relative",children:[s&&m.jsx(tf,{}),m.jsx(hf,{containerStyles:"flex flex-row justify-between items-center shrink-0 p-[var(--sm-padding)] border-b border-solid border-[var(--border)]",selectStyles:"min-w-[auto] max-w-[154px] sm:max-w-[auto] sm:min-w-[250px]"}),m.jsx(mf,{}),m.jsx(zC,{}),m.jsx(jC,{}),m.jsx("div",{className:"p-[var(--sm-padding)] border-t border-solid border-[var(--border)] shrink-0",children:m.jsx("button",{className:"w-full bg-[var(--main-accent-color)] text-white py-3 rounded-full font-bold cursor-pointer",onClick:i,children:"ADD SWATCHES TO CART"})})]})]})},WC=({onSetActiveTab:e,onToggleSidebar:t})=>{const n=oe($t),r=D.useMemo(()=>n.reduce((a,s)=>a+(s.count??0),0),[n]);return m.jsxs("header",{className:"flex flex-row MaterialMultiProductList justify-between items-center border-b border-solid border-[var(--border)] p-[var(--sm-padding)]",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[4px]",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("button",{className:"[&_svg_path]:stroke-[var(--main-accent-color)] cursor-pointer",onClick:()=>e&&e(Kr.SWATCH),children:m.jsx(Ws,{})}),m.jsx("h2",{className:"m-0! text-base leading-[1.6] font-medium ",children:"Your cart"})]}),r>=Re?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-[var(--main-accent-color)] hidden text-
|
|
147
|
+
[&_svg_path]:stroke-[var(--svg-dark)]`,onClick:t,children:m.jsx(cr,{width:10,height:10})})]}),m.jsxs("div",{className:"flex flex-col h-full min-h-0 relative",children:[s&&m.jsx(tf,{}),m.jsx(hf,{containerStyles:"flex flex-row justify-between items-center shrink-0 p-[var(--sm-padding)] border-b border-solid border-[var(--border)]",selectStyles:"min-w-[auto] max-w-[154px] sm:max-w-[auto] sm:min-w-[250px]"}),m.jsx("div",{className:"w-full border-b border-b-border",children:m.jsx(mf,{})}),m.jsx(zC,{}),m.jsx(jC,{}),m.jsx("div",{className:"p-[var(--sm-padding)] border-t border-solid border-[var(--border)] shrink-0",children:m.jsx("button",{className:"w-full bg-[var(--main-accent-color)] text-white py-3 rounded-full font-bold cursor-pointer",onClick:i,children:"ADD SWATCHES TO CART"})})]})]})},WC=({onSetActiveTab:e,onToggleSidebar:t})=>{const n=oe($t),r=D.useMemo(()=>n.reduce((a,s)=>a+(s.count??0),0),[n]);return m.jsxs("header",{className:"flex flex-row MaterialMultiProductList justify-between items-center border-b border-solid border-[var(--border)] p-[var(--sm-padding)]",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[4px]",children:[m.jsxs("div",{className:"flex flex-row items-center gap-[8px]",children:[m.jsx("button",{className:"[&_svg_path]:stroke-[var(--main-accent-color)] cursor-pointer",onClick:()=>e&&e(Kr.SWATCH),children:m.jsx(Ws,{})}),m.jsx("h2",{className:"m-0! text-base leading-[1.6] font-medium ",children:"Your cart"})]}),r>=Re?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-[var(--main-accent-color)] hidden text-xs sm:block",children:["(",Re,") You reached maximum amount of swatches"]}),m.jsxs("span",{className:"text-[var(--main-accent-color)] block sm:hidden",children:["(",Re,") Max"]})]}):null]}),m.jsx("button",{className:`flex flex-row justify-center items-center w-[30px] h-[30px] bg-[var(--background-grey)]
|
|
148
148
|
border-none cursor-pointer rounded-full
|
|
149
|
-
[&_svg_path]:stroke-[var(--svg-dark)]`,onClick:t,children:m.jsx(cr,{width:10,height:10})})]})},vs=e=>e.cart.items,VC=Ze.createSelector(vs,e=>e.reduce((t,n)=>t+n.count,0)),$C=Ze.createSelector(VC,e=>Math.max(0,Re-e)),qC=Ze.createSelector($C,e=>e>0),GC=()=>{const e=Pe(),t=oe($t)??[],n=oe(qC),r=i=>{
|
|
149
|
+
[&_svg_path]:stroke-[var(--svg-dark)]`,onClick:t,children:m.jsx(cr,{width:10,height:10})})]})},vs=e=>e.cart.items,VC=Ze.createSelector(vs,e=>e.reduce((t,n)=>t+n.count,0)),$C=Ze.createSelector(VC,e=>Math.max(0,Re-e)),qC=Ze.createSelector($C,e=>e>0),GC=()=>{const e=Pe(),t=oe($t)??[],n=oe(qC),r=i=>{e(xh({selectedMaterial:i})),e(ta({selectedMaterial:i,materialCount:1,selectedMaterials:t}))},a=i=>{e(yh({selectedMaterial:i}))},s=i=>{e(_h({selectedMaterial:i}))};return m.jsx("ul",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:t?.map(i=>m.jsx(Vl,{item:i,canInc:n,onDelete:()=>r(i),onIncrement:()=>a(i),onDecrement:()=>s(i)},`${i.assetId}/${i.parentName}`))})},XC=({isOpen:e,onToggleSidebar:t,onSetActiveTab:n,onSendData:r})=>{const a=oe(vs),s=oe(vs)??[];return m.jsxs(Ef,{isOpen:e,setIsOpen:t,children:[m.jsx(WC,{onSetActiveTab:n,onToggleSidebar:t}),m.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[m.jsx(GC,{}),m.jsx(qu,{materials:s}),m.jsx("div",{className:"p-[var(--sm-padding)] border-t border-solid border-[var(--border)] shrink-0",children:m.jsx("button",{className:"w-full bg-[var(--main-accent-color)] text-white py-3 rounded-full font-bold cursor-pointer",onClick:()=>r(a),children:"GO TO SHIPPING"})})]})]})},KC=({isOpen:e,onToggleSidebar:t,onSendData:n})=>{const[r,a]=D.useState(Kr.SWATCH),s=i=>{a(i)};return m.jsx(m.Fragment,{children:r===Kr.SWATCH?m.jsx(YC,{isOpen:e,onToggleSidebar:t,onSetActiveTab:s}):m.jsx(XC,{isOpen:e,onToggleSidebar:t,onSetActiveTab:s,onSendData:n})})},QC=Ze.combineReducers({swatches:Hu,cart:zu,multiProductCart:Wu});let Qa=null;function ZC(){return Ze.configureStore({reducer:QC,devTools:!1,middleware:e=>e({thunk:!0})})}const JC=()=>(Qa||(Qa=ZC()),Qa),eA=Tn.useDispatch.withTypes();Tn.useSelector.withTypes();function Tf({children:e}){return m.jsx(Tn.Provider,{store:JC(),children:e})}const tA=({isOpen:e,uiDataType:t,data:n,assetId:r,onToggleSidebar:a,onSendData:s})=>{const o=[tt.UI,tt.FETCH_DATA_PRODUCT].includes(t),l=eA();return D.useEffect(()=>{if(t===tt.UI){if(!n)throw new Error("SwatchCart-module: Attributes are important");const c=us.getTransformedData({dataType:tt.UI,data:n});c&&l(ns(c))}else t===tt.FETCH_DATA_PRODUCT&&r?(async()=>{try{const d=await l(Vn({assetId:r})).unwrap(),f=us.getTransformedData({dataType:tt.FETCH_DATA_PRODUCT,data:d});l(ns(f))}catch(d){console.error("Failed to load product",d)}})():t===tt.FETCH_DATA_ALL&&(async()=>{try{l($n()).unwrap()}catch(d){console.error("Failed to load product",d)}})()},[t,n,r]),m.jsx("div",{id:"root-container",className:"relative flex flex-col h-full min-h-0 w-full",children:m.jsxs(Tf,{children:[m.jsx(mh,{position:"top-center",autoClose:5e3,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!1,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"dark",transition:Bu}),e?m.jsxs(m.Fragment,{children:[o?null:m.jsx(LC,{onSendData:s,onToggleSidebar:a}),o?m.jsx(KC,{isOpen:e,uiDataType:t,data:n,assetId:r,onToggleSidebar:a,onSendData:s}):null]}):null]})})};function nA(e){const t=n=>m.jsx(Tf,{children:m.jsx(e,{...n})});return t.displayName=`withStore(${e.displayName||e.name||"Component"})`,t}const xf=nA(tA),rA=tt;function aA(e,t){const n=wf.createRoot(e);return n.render(D.createElement(xf,t)),()=>n.unmount()}exports.EDataInputType=rA;exports.SwatchModule=xf;exports.mountSwatchModule=aA;
|
|
150
150
|
//# sourceMappingURL=main.cjs.map
|