@billgangcom/theme-lib 1.38.0 → 1.40.0

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/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-BFKWIiO6.cjs"),h=require("react");require("@phosphor-icons/react");const It="_wrapper_1ibay_2",kt="_alignmentBlock_1ibay_8",Nt="_title_1ibay_15",$t="_subtitle_1ibay_22",wt="_alignmentContent_1ibay_29",St="_alignments_1ibay_37",Ct="_alignment_1ibay_8",Bt="_circle_1ibay_60",Tt="_paddings_1ibay_67",Pt="_padding_1ibay_67",At="_active_1ibay_91",Ot="_input_1ibay_98",G={wrapper:It,alignmentBlock:kt,title:Nt,subtitle:$t,alignmentContent:wt,alignments:St,alignment:Ct,circle:Bt,paddings:Tt,padding:Pt,active:At,input:Ot},qt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Lt=["left","top","right","bottom"],Dt=l=>{const{alignment:a,padding:e,setPadding:s,setAlignment:o}=l;function i(j){switch(j){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function c(j){switch(j){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[u,n]=h.useState(null),[r,f]=h.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:G.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:G.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:G.alignments,children:qt.map(j=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{o(j)},className:G.alignment,onMouseEnter:()=>{n(j)},onMouseLeave:()=>{n(null)},children:[j!==a&&u!==j&&t.jsxRuntimeExports.jsx("div",{className:G.circle}),j!==a&&u===j&&t.jsxRuntimeExports.jsx(t.Icon,{name:i(u),fill:"#c2c2c2",width:22,height:22}),j===a&&t.jsxRuntimeExports.jsx(t.Icon,{name:i(a),fill:"#FF3F19",width:22,height:22})]},j))}),t.jsxRuntimeExports.jsx("div",{className:G.paddings,children:Lt.map(j=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(G.padding,{[G.active]:r===j}),onFocus:()=>{f(j)},onBlur:()=>{f(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(j),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[j]),onChange:p=>s({...e,[j]:Number(p)}),paddingless:!0,borderless:!0})]},j))})]})]})]})},Mt="_title_1jkiw_1",Ht="_subtitle_1jkiw_5",zt="_header_1jkiw_12",Ft="_text_1jkiw_13",Vt="_top_1jkiw_20",Ut="_itemsBlock_1jkiw_29",at={title:Mt,subtitle:Ht,header:zt,text:Ft,top:Vt,itemsBlock:Ut},Yt="_typeTexts_167ez_1",Gt="_block_167ez_8",Wt="_active_167ez_25",pt={typeTexts:Yt,block:Gt,active:Wt},Xt=["bold","italic","underline","strike-through","code"],_t=l=>{const{typesText:a,setTypesText:e}=l;function s(o){switch(o){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:pt.typeTexts,children:Xt.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(pt.block,{[pt.active]:a.includes(o)}),onClick:()=>{const i=[...a];if(i.includes(o)){const c=i.filter(u=>u!==o);e(c)}else i.push(o),e(i)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(o),fill:a.includes(o)?"#252525":"#757575",width:20,height:20})},String(o)))})},jt=l=>{const{typesText:a,isActiveText:e,setIsActiveText:s,text:o,setText:i,setTypesText:c,title:u,subtitle:n="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:at.text,children:[(u||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:at.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:at.title,children:u}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:r=>s(r)})]}),t.jsxRuntimeExports.jsxs("div",{className:at.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:at.subtitle,children:n}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:r=>i(r),value:o,maxLength:150}),t.jsxRuntimeExports.jsx(_t,{typesText:a,setTypesText:c})]})]})},Jt="_title_xma5o_1",Qt="_subtitle_xma5o_5",Kt="_header_xma5o_12",Zt="_text_xma5o_13",te="_productsBlock_xma5o_14",ee="_top_xma5o_26",se="_itemsBlock_xma5o_35",ne="_typeTexts_xma5o_41",oe="_block_xma5o_48",ie="_active_xma5o_61",ae="_products_xma5o_14",re="_product_xma5o_14",ce="_button_xma5o_80",le="_disabled_xma5o_91",ue="_image_xma5o_95",de="_info_xma5o_102",xe="_name_xma5o_114",me="_buttons_xma5o_118",pe="_modal_xma5o_125",he="_link_xma5o_145",_e="_modalOptions_xma5o_151",je="_addButton_xma5o_165",ge="_deleteButton_xma5o_180",fe="_closeIcon_xma5o_192",D={title:Jt,subtitle:Qt,header:Kt,text:Zt,productsBlock:te,top:ee,itemsBlock:se,typeTexts:ne,block:oe,active:ie,products:ae,product:re,button:ce,disabled:le,image:ue,info:de,name:xe,buttons:me,modal:pe,link:he,modalOptions:_e,addButton:je,deleteButton:ge,closeIcon:fe},be=h.forwardRef((l,a)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:i,setIsOpenModal:c}=l;function u(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:a,className:D.modal,onClick:n=>{n.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:D.top,children:[t.jsxRuntimeExports.jsx("h3",{className:D.title,children:u(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:D.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:D.modalOptions,children:i.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const f={...e,[n.field]:r};s(f)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(jt,{typesText:e[n.field.type],setTypesText:r=>{const f={...e,[n.field.type]:r};s(f)},text:e[n.field.text]||"",setText:r=>{const f={...e,[n.field.text]:r};s(f)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const f={...e,[n.field]:r};s(f)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:D.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const f={...e,[n.field.text]:r};s(f)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const f={...e,[n.field.switch]:r};s(f)}})]});if(n.type==="list")return t.jsxRuntimeExports.jsx(gt,{items:e[n.field]||[],setItems:r=>{const f={...e,[n.field]:r};s(f)},itemsType:"select",draggable:n.draggable||!1,itemsOptions:n.itemsOptions,deletable:n.deletable||!1,editable:!1,subtitle:n.label,addableOptions:n.addableOptions});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const f={...e,[n.field]:r};s(f)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),ve="_other_g74jx_1",Ee="_subtitle_g74jx_7",Re="_items_g74jx_14",ht={other:ve,subtitle:Ee,items:Re},xt=l=>{const{items:a,title:e="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:ht.other,children:[t.jsxRuntimeExports.jsx("h5",{className:ht.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:ht.items,children:a.map((s,o)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:i=>s.setIsItem(i),label:s.label,hasBackground:!0,paddingless:!1},o))})]})};function ye({product:l,children:a}){const{attributes:e,listeners:s,setNodeRef:o,transform:i,transition:c,isDragging:u}=t.useSortable({id:l.id}),n={transform:t.CSS.Transform.toString(i),transition:c};return t.jsxRuntimeExports.jsx("div",{ref:o,style:n,className:`${D.product} ${u?D.dragging:""}`,...e,...s,children:a})}const gt=l=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:o,other:i,title:c,subtitle:u,editable:n=!0,draggable:r=!1,withImage:f=!1,deletable:j=!0,addable:p=!0,itemsType:m,itemsPlaceholder:_="",itemsOptions:d,hasRangeSelector:k=!1,rangeSelectorOptions:P,modalOptions:E,addableOptions:q={},limit:$,autoScrollInterval:w}=l,[g,O]=h.useState(null),[Y,J]=h.useState({top:0,left:0}),[v,y]=h.useState(null),A=h.useRef(null),[U,B]=h.useState(!1),M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const x=()=>{O(null),B(!1)};return document.body.addEventListener("click",x),O(null),B(!1),()=>{O(null),B(!1),document.body.removeEventListener("click",x)}},[]),h.useEffect(()=>{if(g){const x=[...s].map(R=>R.id===g.id?g:R);o(x)}},[g]),h.useEffect(()=>{if(A.current&&v){const x=A.current.getBoundingClientRect().height,R=window.innerHeight;let S=v.top;S+x>R+window.scrollY-200&&(S=R+window.scrollY-x-200),S<0&&(S=10),J({top:S,left:v.left})}},[A.current,v]);const X=(x,R)=>{x.stopPropagation();const S=x.target.getBoundingClientRect();y({top:S.top+window.scrollY,left:S.left-30}),O(R),B(!0)};function st(x){if(f)return x?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${x[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const b=x=>{const{active:R,over:S}=x;if(S&&R.id!==S.id){const L=s.findIndex(C=>C.id===R.id),F=s.findIndex(C=>C.id===S.id);if(L!==-1&&F!==-1){const C=[...s],[nt]=C.splice(L,1);C.splice(F,0,nt),o(C)}}},T=(x,R)=>{var L,F;const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&d&&t.jsxRuntimeExports.jsx(t.Select,{onChange:C=>{const nt=[...s],it=d.find(lt=>lt.name===C);if(!it)return;const ot=nt.map(lt=>lt.id===x.id?{...it,name:C}:lt);O({...x,name:C}),o([...ot])},value:x.name,options:d.filter(C=>!s.find(nt=>nt.name===C.name)).map(C=>C.name),leftAddon:st(x.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:C=>{const it=[...s].map(ot=>ot.id===x.id?{...x,name:C}:ot);o([...it])},value:x.name,placeholder:_}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:C=>{const it=[...s].map(ot=>ot.id===x.id?{...x,images:C}:ot);o([...it])},activeImage:(L=s.find(C=>C.id===x.id))!=null&&L.images?(F=s.find(C=>C.id===x.id))==null?void 0:F.images[0]:void 0}),t.jsxRuntimeExports.jsxs("div",{className:D.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:D.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:C=>X(C,x)})}),j&&t.jsxRuntimeExports.jsx("div",{className:D.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(C=>C.id!==x.id))})})]})]});return r?t.jsxRuntimeExports.jsx(ye,{product:x,index:R,children:S},x.id):t.jsxRuntimeExports.jsx("div",{className:D.product,children:S},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:D.productsBlock,children:[(c||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:D.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:D.title,children:c}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:x=>e==null?void 0:e(x)})]}),g&&n&&E&&U&&t.jsxRuntimeExports.jsx(be,{ref:A,activeItem:g,setActiveItem:O,popupPosition:Y,modalOptions:E,setIsOpenModal:B}),k&&P&&t.jsxRuntimeExports.jsx(mt,{...P}),t.jsxRuntimeExports.jsxs("div",{className:D.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:D.subtitle,children:u}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:b,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(x=>x.id),strategy:t.verticalListSortingStrategy,children:s.map((x,R)=>T(x,R))})}):s.map((x,R)=>T(x,R)),p&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(D.button,{[D.disabled]:!!($&&$<=s.length||s.length===(d==null?void 0:d.length))}),size:"s",disabled:!!($&&$<=s.length||s.length===(d==null?void 0:d.length)),onClick:()=>{const x=[...s];let R=null;if(d){for(let S=0;S<d.length;S++)if(!s.find(L=>L.id===d[S].id)){R=d[S];break}}m==="select"&&d?x.push({name:R?R.name:d[0].name,id:(R==null?void 0:R.id)||d[0].id,...q}):m==="input"?x.push({name:"",id:t.v4(),...q}):x.push({name:`Image ${s.length+1}`,id:t.v4(),...q}),o(x)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:D.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),i!==void 0&&t.jsxRuntimeExports.jsx(xt,{items:i}),w!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(w.scrollInterval),onChange:x=>w.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ie="_title_82zux_1",ke="_subtitle_82zux_5",Ne="_header_82zux_12",$e="_text_82zux_13",we="_productsBlock_82zux_14",Se="_top_82zux_26",Ce="_itemsBlock_82zux_35",Be="_typeTexts_82zux_41",Te="_block_82zux_48",Pe="_active_82zux_61",Ae="_products_82zux_14",Oe="_product_82zux_14",qe="_button_82zux_80",Le="_disabled_82zux_91",De="_image_82zux_95",Me="_info_82zux_102",He="_name_82zux_114",ze="_buttons_82zux_118",Fe="_modal_82zux_125",Ve="_link_82zux_145",Ue="_modalOptions_82zux_151",Ye="_addButton_82zux_157",Ge="_deleteButton_82zux_179",W={title:Ie,subtitle:ke,header:Ne,text:$e,productsBlock:we,top:Se,itemsBlock:Ce,typeTexts:Be,block:Te,active:Pe,products:Ae,product:Oe,button:qe,disabled:Le,image:De,info:Me,name:He,buttons:ze,modal:Fe,link:Ve,modalOptions:Ue,addButton:Ye,deleteButton:Ge},We=l=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:o,other:i,title:c,subtitle:u,draggable:n=!1,withImage:r=!1,addable:f=!0,itemsOptions:j,hasRangeSelector:p=!1,rangeSelectorOptions:m,limit:_,autoScrollInterval:d}=l;function k(E){if(r)return E?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${E[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const P=E=>{const q=j.find(w=>w.id===E);if(!q)return;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[n&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const g=[...s],O=j.find(v=>v.name===w);if(!O)return;const Y=O.id,J=g.map(v=>v===E?Y:v);o([...J])},value:q.name,options:j.filter(w=>!s.find(g=>g===w.id)).map(w=>w.name),leftAddon:k(q.images)}),t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx("div",{className:W.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(w=>w!==E))})})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:$},E)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(c||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:c}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:E=>e==null?void 0:e(E)})]}),p&&m&&t.jsxRuntimeExports.jsx(mt,{...m}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:u}),s.map(E=>P(E)),f&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(_&&_<=s.length||s.length===j.length)}),size:"s",disabled:!!(_&&_<=s.length||s.length===j.length),onClick:()=>{const E=[...s];let q=null;if(j){for(let $=0;$<j.length;$++)if(!s.find(w=>w===j[$].id)){q=j[$];break}}E.push((q==null?void 0:q.id)||j[0].id),o(E)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:W.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),i!==void 0&&t.jsxRuntimeExports.jsx(xt,{items:i}),d!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(d.scrollInterval),onChange:E=>d.setScrollInterval(Number(E)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Xe="_title_wjbkg_1",Je="_subtitle_wjbkg_5",Qe="_header_wjbkg_12",Ke="_text_wjbkg_13",Ze="_productsBlock_wjbkg_14",ts="_top_wjbkg_26",es="_itemsBlock_wjbkg_35",ss="_typeTexts_wjbkg_41",ns="_block_wjbkg_48",os="_active_wjbkg_61",is="_products_wjbkg_14",as="_product_wjbkg_14",rs="_button_wjbkg_80",cs="_disabled_wjbkg_91",ls="_image_wjbkg_95",us="_info_wjbkg_102",ds="_name_wjbkg_114",xs="_buttons_wjbkg_118",ms="_modal_wjbkg_125",ps="_link_wjbkg_146",hs="_modalOptions_wjbkg_152",_s="_addButton_wjbkg_165",js="_deleteButton_wjbkg_180",gs="_closeIcon_wjbkg_192",H={title:Xe,subtitle:Je,header:Qe,text:Ke,productsBlock:Ze,top:ts,itemsBlock:es,typeTexts:ss,block:ns,active:os,products:is,product:as,button:rs,disabled:cs,image:ls,info:us,name:ds,buttons:xs,modal:ms,link:ps,modalOptions:hs,addButton:_s,deleteButton:js,closeIcon:gs},fs=h.forwardRef((l,a)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:i,setIsOpenModal:c}=l;function u(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:a,className:H.modal,onClick:n=>{n.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[t.jsxRuntimeExports.jsx("h3",{className:H.title,children:u(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:H.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:H.modalOptions,children:i.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const f={...e,[n.field]:r};s(f)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(jt,{typesText:e[n.field.type],setTypesText:r=>{const f={...e,[n.field.type]:r};s(f)},text:e[n.field.text]||"",setText:r=>{const f={...e,[n.field.text]:r};s(f)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const f={...e,[n.field]:r};s(f)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:H.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const f={...e,[n.field.text]:r};s(f)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const f={...e,[n.field.switch]:r};s(f)}})]});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const f={...e,[n.field]:r};s(f)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})});function bs(l){const{product:a,children:e}=l,{attributes:s,listeners:o,setNodeRef:i,transform:c,transition:u,isDragging:n}=t.useSortable({id:a.id}),r={transform:t.CSS.Transform.toString(c),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:i,style:r,className:`${H.product} ${n?H.dragging:""}`,...s,...o,children:e})}const vs=l=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:o,other:i,title:c,subtitle:u,editable:n=!0,draggable:r=!1,withImage:f=!1,deletable:j=!0,addable:p=!0,itemsType:m,itemsPlaceholder:_="",itemsOptions:d,hasRangeSelector:k=!1,rangeSelectorOptions:P,modalOptions:E,addableOptions:q={}}=l,[$,w]=h.useState(null),[g,O]=h.useState({top:0,left:0}),[Y,J]=h.useState(null),v=h.useRef(null),[y,A]=h.useState(!1),U=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const b=()=>{w(null),A(!1)};return document.body.addEventListener("click",b),w(null),A(!1),()=>{w(null),A(!1),document.body.removeEventListener("click",b)}},[]),h.useEffect(()=>{if($){const b=[...s].map(T=>T.id===$.id?$:T);o(b)}},[$]),h.useEffect(()=>{if(v.current&&Y){const b=v.current.getBoundingClientRect().height,T=window.innerHeight;let x=Y.top;x+b>T+window.scrollY-200&&(x=T+window.scrollY-b-200),x<0&&(x=10),O({top:x,left:Y.left})}},[v.current,Y]);const B=(b,T)=>{b.stopPropagation();const x=b.target.getBoundingClientRect();J({top:x.top+window.scrollY,left:x.left-30}),w(T),A(!0)};function M(b){if(f)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=b=>{const{active:T,over:x}=b;if(x&&T.id!==x.id){const R=s.findIndex(L=>L.id===T.id),S=s.findIndex(L=>L.id===x.id);if(R!==-1&&S!==-1){const L=[...s],[F]=L.splice(R,1);L.splice(S,0,F),o(L)}}},st=b=>{var x;const T=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&d&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const L=[...s].map(F=>F.id===b.id?{...b,name:R}:F);w({...b,name:R}),o([...L])},value:b.name,options:d.filter(R=>!s.find(S=>S.name===R)),leftAddon:M(b.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>{const L=[...s].map(F=>F.id===b.id?{...b,name:R}:F);o([...L])},value:b.name,placeholder:_}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:R=>{const L=[...s].map(F=>F.id===b.id?{...b,images:R}:F);o([...L])},activeImage:(x=s.find(R=>R.id===b.id))==null?void 0:x.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>B(R,b)})}),j&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(R=>R.id!==b.id))})})]})]});return r?t.jsxRuntimeExports.jsx(bs,{product:b,children:T},b.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:T},b.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(c||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:c}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:b=>e==null?void 0:e(b)})]}),$&&n&&E&&y&&t.jsxRuntimeExports.jsx(fs,{ref:v,activeItem:$,setActiveItem:w,popupPosition:g,modalOptions:E,setIsOpenModal:A}),k&&P&&t.jsxRuntimeExports.jsx(mt,{...P}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:u}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:U,onDragEnd:X,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(b=>b.id),strategy:t.verticalListSortingStrategy,children:s.map(b=>st(b))})}):s.map(b=>st(b)),p&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:H.button,size:"s",onClick:()=>{const b=[...s];let T=null;if(d){for(let x=0;x<d.length;x++)if(!s.find(R=>R.name===d[x])){T=d[x];break}}m==="select"&&d?b.push({name:T||d[0],id:t.v4(),...q,maxSymbols:100}):m==="input"?b.push({name:"",id:t.v4(),...q,maxSymbols:100}):b.push({name:`Image ${s.length+1}`,id:t.v4(),...q,maxSymbols:100}),o(b)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),i!==void 0&&t.jsxRuntimeExports.jsx(xt,{items:i})]})},Es="_title_bn7sv_1",Rs="_subtitle_bn7sv_5",ys="_header_bn7sv_12",Is="_text_bn7sv_13",ks="_productsBlock_bn7sv_14",Ns="_buttonsBlock_bn7sv_15",$s="_top_bn7sv_26",ws="_itemsBlock_bn7sv_35",Ss="_typeTexts_bn7sv_41",Cs="_block_bn7sv_48",Bs="_active_bn7sv_60",Ts="_products_bn7sv_14",Ps="_product_bn7sv_14",As="_button_bn7sv_15",Os="_image_bn7sv_90",qs="_info_bn7sv_97",Ls="_name_bn7sv_109",Ds="_buttons_bn7sv_15",Ms="_modal_bn7sv_120",Hs="_other_bn7sv_139",zs="_options_bn7sv_145",Fs="_closeIcon_bn7sv_153",et={title:Es,subtitle:Rs,header:ys,text:Is,productsBlock:ks,buttonsBlock:Ns,top:$s,itemsBlock:ws,typeTexts:Ss,block:Cs,active:Bs,products:Ts,product:Ps,button:As,image:Os,info:qs,name:Ls,buttons:Ds,modal:Ms,other:Hs,options:zs,closeIcon:Fs},Vs=h.forwardRef((l,a)=>{const{activeButton:e,setActiveButton:s,popupPosition:o}=l,[i,c]=h.useState(e.typesText),[u,n]=h.useState(e.destination),[r,f]=h.useState(e.page),[j,p]=h.useState(e.link||""),[m,_]=h.useState(e.text||""),[d,k]=h.useState(e.openInNewTab),{pages:P}=t.usePagesStore();return h.useEffect(()=>{s({...e,...{text:m,link:j,destination:u,typesText:i,page:r,openInNewTab:d}})},[i,u,j,m,r,d]),t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:E=>{E.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},ref:a,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:e.type}),t.jsxRuntimeExports.jsx("div",{className:et.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})})]}),t.jsxRuntimeExports.jsxs("div",{className:et.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:E=>n(E),options:["Go to Page","Open Link"].filter(E=>E!==u),value:u}),u==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:E=>f(E),options:P?Object.values(P).filter(E=>E.name!==r).map(E=>E.name):[],value:r}):t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>p(E),value:j,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:E=>k(E)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:E=>_(E),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(_t,{typesText:i,setTypesText:c})]})]})}),Us="_subtitle_jql1y_1",Ys="_header_jql1y_8",Gs="_text_jql1y_9",Ws="_productsBlock_jql1y_10",Xs="_buttonsBlock_jql1y_11",Js="_top_jql1y_23",Qs="_itemsBlock_jql1y_32",Ks="_typeTexts_jql1y_38",Zs="_block_jql1y_45",tn="_active_jql1y_58",en="_products_jql1y_10",sn="_product_jql1y_10",nn="_button_jql1y_11",on="_image_jql1y_88",an="_info_jql1y_95",rn="_name_jql1y_107",cn="_buttons_jql1y_11",ln="_modal_jql1y_118",un="_other_jql1y_138",dn="_options_jql1y_144",xn="_addButton_jql1y_150",mn="_deleteButton_jql1y_165",K={subtitle:Us,header:Ys,text:Gs,productsBlock:Ws,buttonsBlock:Xs,top:Js,itemsBlock:Qs,typeTexts:Ks,block:Zs,active:tn,products:en,product:sn,button:nn,image:on,info:an,name:rn,buttons:cn,modal:ln,other:un,options:dn,addButton:xn,deleteButton:mn},ft=l=>{const{buttons:a,setButtons:e,deletable:s=!0,addable:o=!0}=l,[i,c]=h.useState(null),[u,n]=h.useState({top:0,left:0}),[r,f]=h.useState(null),j=h.useRef(null);h.useEffect(()=>{const m=()=>{c(null)};return document.body.addEventListener("click",m),c(null),()=>{c(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(i){const m=[...a].map(_=>_.id===i.id?i:_);e(m)}},[i]),h.useEffect(()=>{if(j.current&&r){const m=j.current.getBoundingClientRect().height,_=window.innerHeight;let d=r.top;d+m>_+window.scrollY-200&&(d=_+window.scrollY-m-200),d<0&&(d=10),n({top:d,left:r.left})}},[j.current,r]);const p=(m,_)=>{m.stopPropagation();const d=m.target.getBoundingClientRect();f({top:d.top+window.scrollY,left:d.left-30}),c(_)};return t.jsxRuntimeExports.jsxs("div",{className:K.products,children:[t.jsxRuntimeExports.jsx("h5",{className:K.subtitle,children:"Button Type"}),a.map(m=>t.jsxRuntimeExports.jsxs("div",{className:K.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:_=>{const k=[...a].map(P=>P.id===m.id?{...m,type:_}:P);e(k)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:K.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:K.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:_=>{p(_,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:K.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const _=a.filter(d=>d.id!==m.id);e(_)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),i&&t.jsxRuntimeExports.jsx(Vs,{ref:j,activeButton:i,setActiveButton:c,popupPosition:u}),o&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:K.button,size:"s",onClick:()=>{const m=[...a];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:K.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},pn=l=>{const{isActiveButtons:a,setIsActiveButtons:e,buttons:s,setButtons:o}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:et.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:i=>e(i)})]}),t.jsxRuntimeExports.jsx(ft,{buttons:s,setButtons:o})]})})},hn="_wrapper_m18qi_1",_n="_subtitle_m18qi_7",jn="_content_m18qi_14",gn="_range_m18qi_22",fn="_track_m18qi_27",bn="_progress_m18qi_36",vn="_dots_m18qi_46",En="_dot_m18qi_46",Rn="_active_m18qi_65",yn="_input_m18qi_77",In="_countBlock_m18qi_91",kn="_count_m18qi_91",Nn="_controls_m18qi_107",$n="_button_m18qi_113",V={wrapper:hn,subtitle:_n,content:jn,range:gn,track:fn,progress:bn,dots:vn,dot:En,active:Rn,input:yn,countBlock:In,count:kn,controls:Nn,button:$n},mt=l=>{const{label:a,min:e=1,max:s=4,step:o=1,count:i,setCount:c}=l,[u,n]=h.useState(!1),r=Array.from({length:(s-e)/o+1}),f=(i-e)/(s-e)*100,j=()=>{i<s&&c(i+o)},p=()=>{i>e&&c(i-o)},m=_=>{const d=e+_*o;c(d)};return t.jsxRuntimeExports.jsxs("div",{className:V.wrapper,children:[a&&t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:a}),t.jsxRuntimeExports.jsxs("div",{className:V.content,children:[t.jsxRuntimeExports.jsxs("div",{className:V.range,children:[t.jsxRuntimeExports.jsx("div",{className:V.track}),t.jsxRuntimeExports.jsx("div",{className:V.progress,style:{width:`${f}%`}}),t.jsxRuntimeExports.jsx("div",{className:V.dots,children:r.map((_,d)=>{const k=d<=(i-e)/o;return t.jsxRuntimeExports.jsx("button",{onClick:()=>m(d),className:t.clx(V.dot,{[V.active]:k,[V.inactive]:!k,[V.dragging]:u}),"aria-label":`Set value to ${e+d*o}`},d)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:o,value:i,onChange:_=>c(Number(_.target.value)),onMouseDown:()=>n(!0),onMouseUp:()=>n(!1),onTouchStart:()=>n(!0),onTouchEnd:()=>n(!1),className:V.input})]}),t.jsxRuntimeExports.jsxs("div",{className:V.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:_=>{const d=Number(_);d>s?c(s):d<e?c(e):c(d)},value:String(i)}),t.jsxRuntimeExports.jsxs("div",{className:V.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:j,disabled:i>=s,className:V.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:p,disabled:i<=e,className:V.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},wn="_title_ix5ax_1",Sn="_subtitle_ix5ax_5",Cn="_header_ix5ax_12",Bn="_text_ix5ax_13",Tn="_productsBlock_ix5ax_14",Pn="_top_ix5ax_26",An="_itemsBlock_ix5ax_35",On="_typeTexts_ix5ax_41",qn="_block_ix5ax_48",Ln="_active_ix5ax_61",Dn="_products_ix5ax_14",Mn="_product_ix5ax_14",Hn="_button_ix5ax_80",zn="_image_ix5ax_91",Fn="_info_ix5ax_98",Vn="_name_ix5ax_110",Un="_buttons_ix5ax_114",Yn="_modal_ix5ax_121",Gn="_link_ix5ax_141",Wn="_modalOptions_ix5ax_147",Xn="_addButton_ix5ax_160",Jn="_deleteButton_ix5ax_175",Qn="_closeIcon_ix5ax_187",z={title:wn,subtitle:Sn,header:Cn,text:Bn,productsBlock:Tn,top:Pn,itemsBlock:An,typeTexts:On,block:qn,active:Ln,products:Dn,product:Mn,button:Hn,image:zn,info:Fn,name:Vn,buttons:Un,modal:Yn,link:Gn,modalOptions:Wn,addButton:Xn,deleteButton:Jn,closeIcon:Qn},Kn=l=>{const{activeItem:a,setActiveItem:e,popupPosition:s,setIsOpenModal:o,itemsOptions:i}=l,c=i.find(n=>n.id===a.listingId);if(!c)return null;function u(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{className:z.modal,onClick:n=>{n.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[t.jsxRuntimeExports.jsx("h3",{children:u(c.productData.name,20)}),t.jsxRuntimeExports.jsx("div",{className:z.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{o(!1),e(null)}})})]}),t.jsxRuntimeExports.jsx("div",{className:z.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:c.productData.images.length>0?c.productData.images[0].cfId:void 0,onChange:n=>{const r={...a,image:n[0]};e(r)}})})]})};function Zn(l){const{product:a,children:e}=l,{attributes:s,listeners:o,setNodeRef:i,transform:c,transition:u,isDragging:n}=t.useSortable({id:String(a.listingId)}),r={transform:t.CSS.Transform.toString(c),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:i,style:r,className:`${z.product} ${n?z.dragging:""}`,...s,...o,children:e})}const to=l=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:o,other:i,title:c,subtitle:u,editable:n=!0,draggable:r=!1,withImage:f=!1,deletable:j=!0,addable:p=!0,itemsType:m,itemsOptions:_}=l,[d,k]=h.useState(null),[P,E]=h.useState({top:0,left:0}),[q,$]=h.useState(!1),w=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const v=()=>{k(null),$(!1)};return document.body.addEventListener("click",v),k(null),$(!1),()=>{k(null),$(!1),document.body.removeEventListener("click",v)}},[]),h.useEffect(()=>{if(d){const v=[...s].map(y=>y.listingId===d.listingId?d:y);o(v)}},[d]);const g=(v,y)=>{v.stopPropagation();const A=v.target.getBoundingClientRect(),U=100,B=window.innerHeight;let M=A.top+window.scrollY;M+U>B&&(M=B-U-20),$(!0),E({top:M-80,left:A.left-30}),k(y)};function O(v){if(f)return v?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${v}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Y=v=>{const{active:y,over:A}=v;if(A&&y.id!==A.id){const U=s.findIndex(M=>String(M.listingId)===y.id),B=s.findIndex(M=>String(M.listingId)===A.id);if(U!==-1&&B!==-1){const M=[...s],[X]=M.splice(U,1);M.splice(B,0,X),o(M)}}},J=(v,y)=>{const A=_.find(B=>v.listingId===B.id);if(!A)return null;const U=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:B=>{const M=[...s],X=_.find(T=>T.productData.name===B);if(!X)return;const st={listingId:X.id,image:X.productData.images.length>0?X.productData.images[0].cfId:""},b=M.map(T=>T.listingId===v.listingId?st:T);k(st),o([...b])},value:A.productData.name,options:[..._.filter(B=>!s.find(M=>M.listingId===B.id)).map(B=>B.productData.name)],leftAddon:O(v.image||A.productData.images.length>0&&A.productData.images[0].cfId||"")},y),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:B=>g(B,v)})}),j&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(B=>B!==v))})})]})]});return r?t.jsxRuntimeExports.jsx(Zn,{product:v,children:U},v.listingId):t.jsxRuntimeExports.jsx("div",{className:z.product,children:U},v.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(c||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:c}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:v=>e==null?void 0:e(v)})]}),q&&d&&t.jsxRuntimeExports.jsx(Kn,{activeItem:d,setActiveItem:k,setIsOpenModal:$,popupPosition:P,itemsOptions:_}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:u}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:w,onDragEnd:Y,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(v=>String(v.listingId)),strategy:t.verticalListSortingStrategy,children:s.map((v,y)=>J(v,y))})}):s.map((v,y)=>J(v,y)),p&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:z.button,size:"s",onClick:()=>{const v=[...s];for(let y=0;y<_.length;y++)if(!s.find(A=>A.listingId===_[y].id)){v.push({listingId:_[y].id,image:_[y].productData.images.length>0?_[y].productData.images[0].cfId:""});break}o(v)},disabled:s.length===_.length,style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),i!==void 0&&t.jsxRuntimeExports.jsx(xt,{items:i})]})},eo="_options_d1lk6_1",so="_price_d1lk6_12",no="_oldPrice_d1lk6_19",oo="_newPrice_d1lk6_27",io="_animate_d1lk6_34",ao="_appearAndBounce_d1lk6_1",ro="_meta_d1lk6_52",co="_info_d1lk6_58",lo="_infoRight_d1lk6_66",uo="_buttons_d1lk6_73",xo="_variants_d1lk6_80",mo="_variant_d1lk6_80",po="_stock_d1lk6_98",ho="_variantInfo_d1lk6_105",_o="_quantity_d1lk6_111",jo="_count_d1lk6_118",go="_focused_d1lk6_135",fo="_button_d1lk6_73",bo="_activeVariant_d1lk6_161",vo="_chargeTypes_d1lk6_165",Eo="_charge_d1lk6_165",Ro="_chargeActive_d1lk6_190",yo="_title_d1lk6_198",I={options:eo,price:so,oldPrice:no,newPrice:oo,animate:io,appearAndBounce:ao,meta:ro,info:co,infoRight:lo,buttons:uo,variants:xo,variant:mo,stock:po,variantInfo:ho,quantity:_o,count:jo,focused:go,button:fo,activeVariant:bo,chargeTypes:vo,charge:Eo,chargeActive:Ro,title:yo};var bt=(l=>(l.ONE_TIME="One-Time",l.RECURRING="Subscribe & Save",l))(bt||{});const Io=l=>{var $,w;const{variants:a}=l,[e,s]=h.useState(a[0]),[o,i]=h.useState(e.chargeTypes[0]),c=t.useNavigate(),[u,n]=h.useState(1),[r,f]=h.useState(!1),{reset:j,addProductToCart:p,getProducts:m}=t.useCart(),[_,d]=h.useState(!1);h.useEffect(()=>{d(!0);const g=setTimeout(()=>d(!1),600);return()=>clearTimeout(g)},[u]);async function k(){await m(),await p({productId:l.id,productVariantId:e.id,quantity:u})}function P(){j(),k(),c("/checkout")}function E(g){if(g>=864e5){const y=Math.floor(g/864e5);return`${y} ${y===1?"day":"days"}`}else if(g>=36e5){const y=Math.floor(g/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(g>=6e4){const y=Math.floor(g/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(g/1e3);return`${y} ${y===1?"second":"seconds"}`}}function q(g,O){return g.length>O?g.slice(0,O)+"...":g}return t.jsxRuntimeExports.jsxs("div",{className:I.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:I.chargeTypes,children:e.chargeTypes.map(g=>t.jsxRuntimeExports.jsx("div",{className:t.clx(I.charge,{[I.chargeActive]:o===g}),onClick:()=>i(g),children:bt[g]},g))}),t.jsxRuntimeExports.jsx("div",{className:I.variants,children:a.map(g=>{var O;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.variant,{[I.activeVariant]:e.id===g.id}),onClick:()=>s(g),children:[t.jsxRuntimeExports.jsxs("div",{className:I.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:I.title,children:q(g.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:I.stock,children:[((O=g.quantity.restrictions)==null?void 0:O.max)||g.quantity.available||0," in stock"]})})]},g.id)})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:I.quantity,children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>{u>1?n(g=>g-1):n(1)},className:I.button,disabled:e.quantity.restrictions&&u<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("label",{className:t.clx(I.count,{[I.focused]:r}),onFocus:()=>f(!0),onBlur:()=>f(!1),children:t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(u),onChange:g=>n(Number(g)),max:(($=e.quantity.restrictions)==null?void 0:$.max)||e.quantity.available||1/0,min:((w=e.quantity.restrictions)==null?void 0:w.min)||0,style:{backgroundColor:"transparent",border:"none",textAlign:"center"}})}),t.jsxRuntimeExports.jsx("button",{onClick:()=>{n(g=>g+1)},className:I.button,disabled:!!(e.quantity.restrictions&&u>=e.quantity.restrictions.max||e.quantity.available&&u>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:I.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:I.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":E(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:I.infoRight,children:o==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",(e.price.amount||0)*u]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*u]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",(e.price.amount||0)*u]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>P(),children:t.jsxRuntimeExports.jsx("span",{children:o==="ONE_TIME"?"Buy Now":"Subscribe Now"})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>k(),children:"Add to Cart"})]})]})},ko="_button_oyh2y_1",No="_login_oyh2y_14",$o="_signUp_oyh2y_18",wo="_buttons_oyh2y_23",So="_modal_oyh2y_32",Co="_closing_oyh2y_61",Bo="_info_oyh2y_85",To="_top_oyh2y_92",Po="_title_oyh2y_103",Ao="_clear_oyh2y_110",Oo="_activeClear_oyh2y_117",qo="_count_oyh2y_121",Lo="_cart_oyh2y_136",Do="_empty_oyh2y_144",Mo="_product_oyh2y_170",Ho="_products_oyh2y_179",zo="_image_oyh2y_187",Fo="_productInfo_oyh2y_193",Vo="_content_oyh2y_200",Uo="_name_oyh2y_206",Yo="_price_oyh2y_212",Go="_productButtons_oyh2y_218",Wo="_productButton_oyh2y_218",Xo="_productCount_oyh2y_238",Jo="_bottom_oyh2y_254",Qo="_subtotal_oyh2y_262",Ko="_block_oyh2y_270",Zo="_shoppingCount_oyh2y_277",ti="_total_oyh2y_297",ei="_link_oyh2y_303",si="_userInfo_oyh2y_310",N={button:ko,login:No,signUp:$o,buttons:wo,modal:So,"slide-in-fade":"_slide-in-fade_oyh2y_1",closing:Co,"slide-out-fade":"_slide-out-fade_oyh2y_1",info:Bo,top:To,title:Po,clear:Ao,activeClear:Oo,count:qo,cart:Lo,empty:Do,product:Mo,products:Ho,image:zo,productInfo:Fo,content:Vo,name:Uo,price:Yo,productButtons:Go,productButton:Wo,productCount:Xo,bottom:Jo,subtotal:Qo,block:Ko,shoppingCount:Zo,total:ti,link:ei,userInfo:si},ni="_button_85085_1",oi="_primary_85085_20",ii="_primaryHovered_85085_30",ai="_secondary_85085_34",ri="_secondaryHovered_85085_44",ci="_tertiary_85085_48",li="_tertiaryHovered_85085_58",ui="_content_85085_62",Z={button:ni,primary:oi,primaryHovered:ii,secondary:ai,secondaryHovered:ri,tertiary:ci,tertiaryHovered:li,content:ui},dt=l=>{const{children:a,onClick:e,style:s,className:o,disabled:i=!1,type:c="Primary"}=l,{themeSettings:u}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(Z.button,o,{[Z.primary]:c==="Primary",[Z.secondary]:c==="Secondary",[Z.tertiary]:c==="Tertiary",[Z.primaryHovered]:c==="Primary"&&!i&&u.buttons.primary.hover,[Z.secondaryHovered]:c==="Secondary"&&!i&&u.buttons.secondary.hover,[Z.tertiaryHovered]:c==="Tertiary"&&!i&&u.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:i,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:Z.content,children:[a,t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:a})})};class ct extends Error{}ct.prototype.name="InvalidTokenError";function di(l){return decodeURIComponent(atob(l).replace(/(.)/g,(a,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function xi(l){let a=l.replace(/-/g,"+").replace(/_/g,"/");switch(a.length%4){case 0:break;case 2:a+="==";break;case 3:a+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return di(a)}catch{return atob(a)}}function mi(l,a){if(typeof l!="string")throw new ct("Invalid token specified: must be a string");a||(a={});const e=a.header===!0?0:1,s=l.split(".")[e];if(typeof s!="string")throw new ct(`Invalid token specified: missing part #${e+1}`);let o;try{o=xi(s)}catch(i){throw new ct(`Invalid token specified: invalid base64 for part #${e+1} (${i.message})`)}try{return JSON.parse(o)}catch(i){throw new ct(`Invalid token specified: invalid json for part #${e+1} (${i.message})`)}}const pi=l=>{const{shopping:a,signUp:e}=l,s=t.useNavigate();function o(c){s(c)}const i=JSON.parse(localStorage.getItem("token")||"{}");return t.jsxRuntimeExports.jsxs("div",{className:N.buttons,children:[a&&t.jsxRuntimeExports.jsx(vt,{}),!i.data&&t.jsxRuntimeExports.jsx(dt,{onClick:()=>o("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),!i.data&&e&&t.jsxRuntimeExports.jsx(dt,{onClick:()=>o("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"}),i.data&&t.jsxRuntimeExports.jsx(yt,{token:i.data})]})},vt=()=>{const[l,a]=h.useState(!1),[e,s]=h.useState([]),{cart:o,getProducts:i}=t.useCart();function c(p){for(let m=0;m<o.parts.length;m++)for(let _=0;_<p.variants.length;_++)if(o.parts[m].productVariantId===p.variants[m].id)return o.parts[m].productVariantId}function u(p){for(let m=0;m<o.parts.length;m++)for(let _=0;_<p.variants.length;_++)if(o.parts[m].productVariantId===p.variants[m].id)return o.parts[m].quantity}h.useEffect(()=>{(async()=>{const m=o.parts.map(k=>String(k.productId)),d=(await i([...m])).map(k=>({...k,activeVariantId:c(k),quantity:u(k)}));s(d)})()},[o.parts.length]);function n(p){var m;return!p||!(p!=null&&p.variants)?!1:(m=p.variants.find(_=>_.id===p.activeVariantId))==null?void 0:m.subscriptionSettings}const r=o.parts.length>0&&e.length>0&&!n(e[0]),[f,j]=h.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:N.button,onClick:p=>{p.stopPropagation(),a(!0),j(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),r&&t.jsxRuntimeExports.jsx("div",{className:N.shoppingCount,children:o.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{j(!1),setTimeout(()=>{a(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(Et,{activeProducts:e,isCartNotEmpty:r,isOpen:f})})]})},Et=l=>{const{activeProducts:a,isCartNotEmpty:e,isOpen:s}=l,{cart:o,reset:i,getTotalAndDiscount:c,updateQuantityOfProduct:u}=t.useCart(),n=t.useNavigate();function r(p){n(p)}function f(p){u({productId:p.id,productVariantId:p.activeVariantId,quantity:p.quantity+1})}function j(p){u({productId:p.id,productVariantId:p.activeVariantId,quantity:p.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(N.modal,{[N.closing]:!s}),onClick:p=>p.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[t.jsxRuntimeExports.jsxs("div",{className:N.info,children:[t.jsxRuntimeExports.jsx("span",{className:N.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:N.count,children:o.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(N.clear,{[N.activeClear]:e}),disabled:!e,onClick:i,children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:N.cart,children:[t.jsxRuntimeExports.jsx("div",{className:N.products,children:a.map(p=>t.jsxRuntimeExports.jsxs("div",{className:N.product,children:[t.jsxRuntimeExports.jsxs("div",{className:N.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:N.image}),t.jsxRuntimeExports.jsxs("div",{className:N.content,children:[t.jsxRuntimeExports.jsx("div",{className:N.name,children:p.name}),t.jsxRuntimeExports.jsxs("div",{className:N.price,children:["$",p.variants.find(m=>m.id===p.activeVariantId).price.amount*((p==null?void 0:p.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:N.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{p.quantity!==1&&j(p)},className:N.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:N.productCount,children:p.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(p),className:N.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},p.id))}),t.jsxRuntimeExports.jsxs("div",{className:N.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:N.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:N.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:N.total,children:["$",c().total]})]}),t.jsxRuntimeExports.jsx(dt,{onClick:()=>r("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(Rt,{})]})},Rt=()=>t.jsxRuntimeExports.jsxs("div",{className:N.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-secondary)"})}),t.jsxRuntimeExports.jsx("span",{children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:N.link,children:"view products"})]})]}),yt=({token:l})=>{const[a,e]=h.useState("test-email@gmail.com"),s=t.useNavigate();h.useEffect(()=>{(async()=>{const c=mi(l);e(c.email)})()},[l]);function o(i){s(i)}return t.jsxRuntimeExports.jsx("div",{className:N.userInfo,onClick:()=>o("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})})},hi="_share_11u0d_1",_i="_modal_11u0d_8",ji="_header_11u0d_14",gi="_socials_11u0d_24",fi="_social_11u0d_24",bi="_copy_11u0d_34",vi="_title_11u0d_41",Ei="_copyWrapper_11u0d_47",Ri="_copyText_11u0d_56",tt={share:hi,modal:_i,header:ji,socials:gi,social:fi,copy:bi,title:vi,copyWrapper:Ei,copyText:Ri},yi=()=>{const{isOpenModal:l,setIsOpenModal:a}=t.useShareLinkStore();function e(){a(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:tt.share,onClick:s=>{s.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:a,children:t.jsxRuntimeExports.jsx(Ii,{})})]})},Ii=()=>{const{setIsOpenModal:l}=t.useShareLinkStore(),{notification:a,setNotification:e}=t.useNotificationStore(),{setIsOpen:s}=t.useModalStore(),o=window.location.href;function i(){navigator.clipboard.writeText(o),e({message:"Link copied to clipboard",status:"success"})}function c(){s(!1),setTimeout(()=>{l(!1),s(!0)},300)}return t.jsxRuntimeExports.jsxs("div",{className:tt.modal,onClick:u=>u.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:tt.header,children:[t.jsxRuntimeExports.jsx("div",{className:tt.title,children:"Copy Product Link"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:c,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:tt.copyWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(tt.copy,tt.copyText),onClick:i,children:o}),t.jsxRuntimeExports.jsx("div",{onClick:i,className:tt.copy,children:a?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},ki="_accordion_1s1lq_1",Ni="_header_1s1lq_9",$i="_icon_1s1lq_18",wi="_open_1s1lq_21",Si="_content_1s1lq_25",rt={accordion:ki,header:Ni,icon:$i,open:wi,content:Si},Ci=({title:l,content:a})=>{const[e,s]=h.useState(!1),[o,i]=h.useState(0),c=h.useRef(null),u=()=>{s(!e)};return h.useEffect(()=>{c.current&&i(e?c.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:rt.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:rt.header,onClick:u,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(rt.icon,{[rt.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:c,className:rt.content,style:{height:`${o}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:a})})]})},Bi="_wrapper_p74l6_1",Ti="_label_p74l6_9",Pi="_input_p74l6_18",Ai="_paddingless_p74l6_31",Oi="_content_p74l6_35",qi="_contentBorder_p74l6_48",Li="_borderless_p74l6_53",Di="_rightIcon_p74l6_58",Q={wrapper:Bi,label:Ti,input:Pi,paddingless:Ai,content:Oi,contentBorder:qi,borderless:Li,rightIcon:Di},Mi=l=>{const{onChange:a,style:e,label:s,value:o,type:i,min:c,max:u,placeholder:n,disabled:r=!1,required:f=!1,regex:j,paddingless:p=!1,borderless:m=!1,editable:_=!1,isSearch:d=!1}=l,{themeSettings:k}=t.useThemeSettingsStore(),{inputs:P}=k,[E,q]=h.useState(!1);function $(g){return Number(g)<0?String(c):g}function w(g){return!f||!j?!0:new RegExp(j).test(g)}return t.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:Q.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Q.content,{[Q.contentBorder]:P.border.active}),style:{paddingRight:P.general.height+15,...e,background:P.field.active?P.field.color:"transparent"},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:i||"text",onChange:g=>{if(i==="text")a(g.target.value);else{const O=$(g.target.value);a(O)}},value:o,autoComplete:"off",placeholder:n||"Type something...",className:t.clx(Q.input,{[Q.required]:E&&f&&!w(o),[Q.paddingless]:p,[Q.borderless]:m}),min:i==="number"?c:void 0,max:i==="number"?u:void 0,disabled:r,onFocus:()=>q(!0)}),d&&t.jsxRuntimeExports.jsx("div",{className:Q.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:P.general.height,height:P.general.height})}),_&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},Hi="_wrapper_st58d_1",zi="_label_st58d_10",Fi="_textarea_st58d_18",Vi="_length_st58d_33",ut={wrapper:Hi,label:zi,textarea:Fi,length:Vi},Ui=l=>{const{onChange:a,label:e,value:s,maxLength:o,placeholder:i="Type something..."}=l,[c,u]=h.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:ut.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:ut.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:n=>{u(n.target.value.length),a(n.target.value)},placeholder:i,className:ut.textarea,maxLength:o}),o&&t.jsxRuntimeExports.jsxs("div",{className:ut.length,children:[c,"/",o]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=Ci;exports.Button=dt;exports.ButtonTypeSettings=ft;exports.ButtonsSettings=pn;exports.CategorySettings=We;exports.EmptyCart=Rt;exports.FormSettings=vs;exports.HeaderButtons=pi;exports.InputUI=Mi;exports.ItemsSettings=gt;exports.LayoutSettings=Dt;exports.ListingSelector=to;exports.ProductOptions=Io;exports.RangeSelector=mt;exports.ShareLink=yi;exports.ShoppingButton=vt;exports.ShoppingModalCart=Et;exports.TextSettings=jt;exports.TextareaUI=Ui;exports.TypesText=_t;exports.UserInfo=yt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-D5Z0Y9t7.cjs"),g=require("react");require("@phosphor-icons/react");const St="_wrapper_1ibay_2",wt="_alignmentBlock_1ibay_8",Ct="_title_1ibay_15",Bt="_subtitle_1ibay_22",Tt="_alignmentContent_1ibay_29",Pt="_alignments_1ibay_37",Mt="_alignment_1ibay_8",At="_circle_1ibay_60",Ot="_paddings_1ibay_67",qt="_padding_1ibay_67",Lt="_active_1ibay_91",Dt="_input_1ibay_98",X={wrapper:St,alignmentBlock:wt,title:Ct,subtitle:Bt,alignmentContent:Tt,alignments:Pt,alignment:Mt,circle:At,paddings:Ot,padding:qt,active:Lt,input:Dt},Ht=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],zt=["left","top","right","bottom"],Ft=l=>{const{alignment:i,padding:e,setPadding:s,setAlignment:o}=l;function a(p){switch(p){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function c(p){switch(p){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[d,n]=g.useState(null),[r,h]=g.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:X.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:X.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:X.alignments,children:Ht.map(p=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{o(p)},className:X.alignment,onMouseEnter:()=>{n(p)},onMouseLeave:()=>{n(null)},children:[p!==i&&d!==p&&t.jsxRuntimeExports.jsx("div",{className:X.circle}),p!==i&&d===p&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(d),fill:"#c2c2c2",width:22,height:22}),p===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(i),fill:"#FF3F19",width:22,height:22})]},p))}),t.jsxRuntimeExports.jsx("div",{className:X.paddings,children:zt.map(p=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(X.padding,{[X.active]:r===p}),onFocus:()=>{h(p)},onBlur:()=>{h(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(p),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[p]),onChange:_=>s({...e,[p]:Number(_)}),paddingless:!0,borderless:!0})]},p))})]})]})]})},Vt="_title_1jkiw_1",Ut="_subtitle_1jkiw_5",Yt="_header_1jkiw_12",Gt="_text_1jkiw_13",Xt="_top_1jkiw_20",Wt="_itemsBlock_1jkiw_29",rt={title:Vt,subtitle:Ut,header:Yt,text:Gt,top:Xt,itemsBlock:Wt},Jt="_typeTexts_167ez_1",Qt="_block_167ez_8",Kt="_active_167ez_25",_t={typeTexts:Jt,block:Qt,active:Kt},Zt=["bold","italic","underline","strike-through","code"],jt=l=>{const{typesText:i,setTypesText:e}=l;function s(o){switch(o){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:_t.typeTexts,children:Zt.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(_t.block,{[_t.active]:i.includes(o)}),onClick:()=>{const a=[...i];if(a.includes(o)){const c=a.filter(d=>d!==o);e(c)}else a.push(o),e(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(o),fill:i.includes(o)?"#252525":"#757575",width:20,height:20})},String(o)))})},ct={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",p:"Paragraph"},gt=l=>{const{typesText:i,isActiveText:e,setIsActiveText:s,text:o,setText:a,setTypesText:c,title:d,subtitle:n="Items",typeFont:r,setTypeFont:h}=l;return t.jsxRuntimeExports.jsxs("div",{className:rt.text,children:[(d||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:rt.top,children:[d&&t.jsxRuntimeExports.jsx("h3",{className:rt.title,children:d}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:p=>s(p)})]}),t.jsxRuntimeExports.jsxs("div",{className:rt.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:rt.subtitle,children:n}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:p=>a(p),value:o,maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:i,setTypesText:c}),t.jsxRuntimeExports.jsx(t.Select,{label:"Type Text",options:Object.values(ct).filter(p=>p!==ct[r]),onChange:p=>h(Object.keys(ct).find(_=>ct[_]===p)),value:ct[r]})]})]})},te="_title_xma5o_1",ee="_subtitle_xma5o_5",se="_header_xma5o_12",ne="_text_xma5o_13",oe="_productsBlock_xma5o_14",ie="_top_xma5o_26",ae="_itemsBlock_xma5o_35",re="_typeTexts_xma5o_41",ce="_block_xma5o_48",le="_active_xma5o_61",de="_products_xma5o_14",ue="_product_xma5o_14",xe="_button_xma5o_80",me="_disabled_xma5o_91",pe="_image_xma5o_95",_e="_info_xma5o_102",he="_name_xma5o_114",je="_buttons_xma5o_118",ge="_modal_xma5o_125",fe="_link_xma5o_145",be="_modalOptions_xma5o_151",ve="_addButton_xma5o_165",Ee="_deleteButton_xma5o_180",Re="_closeIcon_xma5o_192",q={title:te,subtitle:ee,header:se,text:ne,productsBlock:oe,top:ie,itemsBlock:ae,typeTexts:re,block:ce,active:le,products:de,product:ue,button:xe,disabled:me,image:pe,info:_e,name:he,buttons:je,modal:ge,link:fe,modalOptions:be,addButton:ve,deleteButton:Ee,closeIcon:Re},ye=g.forwardRef((l,i)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:a,setIsOpenModal:c}=l;function d(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:i,className:q.modal,onClick:n=>{n.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[t.jsxRuntimeExports.jsx("h3",{className:q.title,children:d(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:q.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:q.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const h={...e,[n.field]:r};s(h)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[n.field.type],setTypesText:r=>{const h={...e,[n.field.type]:r};s(h)},text:e[n.field.text]||"",setText:r=>{const h={...e,[n.field.text]:r};s(h)},typeFont:e[n.field.type],setTypeFont:r=>{const h={...e,[n.field.type]:r};s(h)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field]:r};s(h)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:q.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field.text]:r};s(h)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const h={...e,[n.field.switch]:r};s(h)}})]});if(n.type==="list")return t.jsxRuntimeExports.jsx(bt,{items:e[n.field]||[],setItems:r=>{const h={...e,[n.field]:r};s(h)},itemsType:"select",draggable:n.draggable||!1,itemsOptions:n.itemsOptions,deletable:n.deletable||!1,editable:!1,subtitle:n.label,addableOptions:n.addableOptions});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const h={...e,[n.field]:r};s(h)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),Ie="_other_g74jx_1",ke="_subtitle_g74jx_7",Ne="_items_g74jx_14",ht={other:Ie,subtitle:ke,items:Ne},mt=l=>{const{items:i,title:e="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:ht.other,children:[t.jsxRuntimeExports.jsx("h5",{className:ht.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:ht.items,children:i.map((s,o)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:a=>s.setIsItem(a),label:s.label,hasBackground:!0,paddingless:!1},o))})]})};function $e({product:l,children:i}){const{attributes:e,listeners:s,setNodeRef:o,transform:a,transition:c,isDragging:d}=t.useSortable({id:l.id}),n={transform:t.CSS.Transform.toString(a),transition:c};return t.jsxRuntimeExports.jsx("div",{ref:o,style:n,className:`${q.product} ${d?q.dragging:""}`,...e,...s,children:i})}const bt=l=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:d,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:f="",itemsOptions:u,hasRangeSelector:N=!1,rangeSelectorOptions:L,modalOptions:b,addableOptions:P={},limit:j,autoScrollInterval:y}=l,[z,M]=g.useState(null),[Y,O]=g.useState({top:0,left:0}),[E,B]=g.useState(null),T=g.useRef(null),[G,w]=g.useState(!1),D=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const x=()=>{M(null),w(!1)};return document.body.addEventListener("click",x),M(null),w(!1),()=>{M(null),w(!1),document.body.removeEventListener("click",x)}},[]),g.useEffect(()=>{if(z){const x=[...s].map(R=>R.id===z.id?z:R);o(x)}},[z]),g.useEffect(()=>{if(T.current&&E){const x=T.current.getBoundingClientRect().height,R=window.innerHeight;let $=E.top;$+x>R+window.scrollY-200&&($=R+window.scrollY-x-200),$<0&&($=10),O({top:$,left:E.left})}},[T.current,E]);const Q=(x,R)=>{x.stopPropagation();const $=x.target.getBoundingClientRect();B({top:$.top+window.scrollY,left:$.left-30}),M(R),w(!0)};function nt(x){if(h)return x?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${x[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const v=x=>{const{active:R,over:$}=x;if($&&R.id!==$.id){const A=s.findIndex(S=>S.id===R.id),V=s.findIndex(S=>S.id===$.id);if(A!==-1&&V!==-1){const S=[...s],[ot]=S.splice(A,1);S.splice(V,0,ot),o(S)}}},C=(x,R)=>{var A,V;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:S=>{const ot=[...s],at=u.find(ut=>ut.name===S);if(!at)return;const it=ot.map(ut=>ut.id===x.id?{...at,name:S}:ut);M({...x,name:S}),o([...it])},value:x.name,options:u.filter(S=>!s.find(ot=>ot.name===S.name)).map(S=>S.name),leftAddon:nt(x.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:S=>{const at=[...s].map(it=>it.id===x.id?{...x,name:S}:it);o([...at])},value:x.name,placeholder:f}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:S=>{const at=[...s].map(it=>it.id===x.id?{...x,images:S}:it);o([...at])},activeImage:(A=s.find(S=>S.id===x.id))!=null&&A.images?(V=s.find(S=>S.id===x.id))==null?void 0:V.images[0]:void 0}),t.jsxRuntimeExports.jsxs("div",{className:q.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:q.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:S=>Q(S,x)})}),p&&t.jsxRuntimeExports.jsx("div",{className:q.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(S=>S.id!==x.id))})})]})]});return r?t.jsxRuntimeExports.jsx($e,{product:x,index:R,children:$},x.id):t.jsxRuntimeExports.jsx("div",{className:q.product,children:$},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:q.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:q.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>e==null?void 0:e(x)})]}),z&&n&&b&&G&&t.jsxRuntimeExports.jsx(ye,{ref:T,activeItem:z,setActiveItem:M,popupPosition:Y,modalOptions:b,setIsOpenModal:w}),N&&L&&t.jsxRuntimeExports.jsx(pt,{...L}),t.jsxRuntimeExports.jsxs("div",{className:q.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:q.subtitle,children:d}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:D,onDragEnd:v,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(x=>x.id),strategy:t.verticalListSortingStrategy,children:s.map((x,R)=>C(x,R))})}):s.map((x,R)=>C(x,R)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(q.button,{[q.disabled]:!!(j&&j<=s.length||s.length===(u==null?void 0:u.length))}),size:"s",disabled:!!(j&&j<=s.length||s.length===(u==null?void 0:u.length)),onClick:()=>{const x=[...s];let R=null;if(u){for(let $=0;$<u.length;$++)if(!s.find(A=>A.id===u[$].id)){R=u[$];break}}m==="select"&&u?x.push({name:R?R.name:u[0].name,id:(R==null?void 0:R.id)||u[0].id,...P}):m==="input"?x.push({name:"",id:t.v4(),...P}):x.push({name:`Image ${s.length+1}`,id:t.v4(),...P}),o(x)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:q.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a}),y!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(y.scrollInterval),onChange:x=>y.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Se="_title_82zux_1",we="_subtitle_82zux_5",Ce="_header_82zux_12",Be="_text_82zux_13",Te="_productsBlock_82zux_14",Pe="_top_82zux_26",Me="_itemsBlock_82zux_35",Ae="_typeTexts_82zux_41",Oe="_block_82zux_48",qe="_active_82zux_61",Le="_products_82zux_14",De="_product_82zux_14",He="_button_82zux_80",ze="_disabled_82zux_91",Fe="_image_82zux_95",Ve="_info_82zux_102",Ue="_name_82zux_114",Ye="_buttons_82zux_118",Ge="_modal_82zux_125",Xe="_link_82zux_145",We="_modalOptions_82zux_151",Je="_addButton_82zux_157",Qe="_deleteButton_82zux_179",W={title:Se,subtitle:we,header:Ce,text:Be,productsBlock:Te,top:Pe,itemsBlock:Me,typeTexts:Ae,block:Oe,active:qe,products:Le,product:De,button:He,disabled:ze,image:Fe,info:Ve,name:Ue,buttons:Ye,modal:Ge,link:Xe,modalOptions:We,addButton:Je,deleteButton:Qe},Ke=l=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:d,draggable:n=!1,withImage:r=!1,addable:h=!0,itemsOptions:p,hasRangeSelector:_=!1,rangeSelectorOptions:m,limit:f,autoScrollInterval:u}=l;function N(b){if(r)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=b=>{const P=p.find(y=>y.id===b);if(!P)return;const j=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[n&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:y=>{const z=[...s],M=p.find(E=>E.name===y);if(!M)return;const Y=M.id,O=z.map(E=>E===b?Y:E);o([...O])},value:P.name,options:p.filter(y=>!s.find(z=>z===y.id)).map(y=>y.name),leftAddon:N(P.images)}),t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx("div",{className:W.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(y=>y!==b))})})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:j},b)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:b=>e==null?void 0:e(b)})]}),_&&m&&t.jsxRuntimeExports.jsx(pt,{...m}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:d}),s.map(b=>L(b)),h&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(f&&f<=s.length||s.length===p.length)}),size:"s",disabled:!!(f&&f<=s.length||s.length===p.length),onClick:()=>{const b=[...s];let P=null;if(p){for(let j=0;j<p.length;j++)if(!s.find(y=>y===p[j].id)){P=p[j];break}}b.push((P==null?void 0:P.id)||p[0].id),o(b)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:W.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a}),u!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(u.scrollInterval),onChange:b=>u.setScrollInterval(Number(b)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ze="_title_1vfw9_1",ts="_subtitle_1vfw9_5",es="_header_1vfw9_12",ss="_text_1vfw9_13",ns="_productsBlock_1vfw9_14",os="_top_1vfw9_26",is="_itemsBlock_1vfw9_35",as="_typeTexts_1vfw9_41",rs="_block_1vfw9_48",cs="_active_1vfw9_61",ls="_products_1vfw9_14",ds="_product_1vfw9_14",us="_button_1vfw9_80",xs="_disabled_1vfw9_91",ms="_image_1vfw9_95",ps="_info_1vfw9_102",_s="_name_1vfw9_114",hs="_buttons_1vfw9_118",js="_modal_1vfw9_125",gs="_link_1vfw9_145",fs="_modalOptions_1vfw9_151",bs="_addButton_1vfw9_164",vs="_deleteButton_1vfw9_179",Es="_closeIcon_1vfw9_191",H={title:Ze,subtitle:ts,header:es,text:ss,productsBlock:ns,top:os,itemsBlock:is,typeTexts:as,block:rs,active:cs,products:ls,product:ds,button:us,disabled:xs,image:ms,info:ps,name:_s,buttons:hs,modal:js,link:gs,modalOptions:fs,addButton:bs,deleteButton:vs,closeIcon:Es},Rs=g.forwardRef((l,i)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:a,setIsOpenModal:c}=l;function d(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:i,className:H.modal,onClick:n=>{n.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[t.jsxRuntimeExports.jsx("h3",{className:H.title,children:d(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:H.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:H.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const h={...e,[n.field]:r};s(h)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[n.field.type],setTypesText:r=>{const h={...e,[n.field.type]:r};s(h)},text:e[n.field.text]||"",setText:r=>{const h={...e,[n.field.text]:r};s(h)},typeFont:e[n.field.type],setTypeFont:r=>{const h={...e,[n.field.type]:r};s(h)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field]:r};s(h)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:H.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field.text]:r};s(h)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const h={...e,[n.field.switch]:r};s(h)}})]});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const h={...e,[n.field]:r};s(h)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})});function ys(l){const{product:i,children:e}=l,{attributes:s,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:n}=t.useSortable({id:i.id}),r={transform:t.CSS.Transform.toString(c),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:a,style:r,className:`${H.product} ${n?H.dragging:""}`,...s,...o,children:e})}const Is=l=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:d,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:f="",itemsOptions:u,hasRangeSelector:N=!1,rangeSelectorOptions:L,modalOptions:b,addableOptions:P={}}=l,[j,y]=g.useState(null),[z,M]=g.useState({top:0,left:0}),[Y,O]=g.useState(null),E=g.useRef(null),[B,T]=g.useState(!1),G=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const v=()=>{y(null),T(!1)};return document.body.addEventListener("click",v),y(null),T(!1),()=>{y(null),T(!1),document.body.removeEventListener("click",v)}},[]),g.useEffect(()=>{if(j){const v=[...s].map(C=>C.id===j.id?j:C);o(v)}},[j]),g.useEffect(()=>{if(E.current&&Y){const v=E.current.getBoundingClientRect().height,C=window.innerHeight;let x=Y.top;x+v>C+window.scrollY-200&&(x=C+window.scrollY-v-200),x<0&&(x=10),M({top:x,left:Y.left})}},[E.current,Y]);const w=(v,C)=>{v.stopPropagation();const x=v.target.getBoundingClientRect();O({top:x.top+window.scrollY,left:x.left-30}),y(C),T(!0)};function D(v){if(h)return v?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${v[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Q=v=>{const{active:C,over:x}=v;if(x&&C.id!==x.id){const R=s.findIndex(A=>A.id===C.id),$=s.findIndex(A=>A.id===x.id);if(R!==-1&&$!==-1){const A=[...s],[V]=A.splice(R,1);A.splice($,0,V),o(A)}}},nt=v=>{var x;const C=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const A=[...s].map(V=>V.id===v.id?{...v,name:R}:V);y({...v,name:R}),o([...A])},value:v.name,options:u.filter(R=>!s.find($=>$.name===R)),leftAddon:D(v.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>{const A=[...s].map(V=>V.id===v.id?{...v,name:R}:V);o([...A])},value:v.name,placeholder:f}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:R=>{const A=[...s].map(V=>V.id===v.id?{...v,images:R}:V);o([...A])},activeImage:(x=s.find(R=>R.id===v.id))==null?void 0:x.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>w(R,v)})}),p&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(R=>R.id!==v.id))})})]})]});return r?t.jsxRuntimeExports.jsx(ys,{product:v,children:C},v.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:C},v.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:v=>e==null?void 0:e(v)})]}),j&&n&&b&&B&&t.jsxRuntimeExports.jsx(Rs,{ref:E,activeItem:j,setActiveItem:y,popupPosition:z,modalOptions:b,setIsOpenModal:T}),N&&L&&t.jsxRuntimeExports.jsx(pt,{...L}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:d}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:G,onDragEnd:Q,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(v=>v.id),strategy:t.verticalListSortingStrategy,children:s.map(v=>nt(v))})}):s.map(v=>nt(v)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:H.button,size:"s",onClick:()=>{const v=[...s];let C=null;if(u){for(let x=0;x<u.length;x++)if(!s.find(R=>R.name===u[x])){C=u[x];break}}m==="select"&&u?v.push({name:C||u[0],id:t.v4(),...P,maxSymbols:100}):m==="input"?v.push({name:"",id:t.v4(),...P,maxSymbols:100}):v.push({name:`Image ${s.length+1}`,id:t.v4(),...P,maxSymbols:100}),o(v)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a})]})},ks="_title_bn7sv_1",Ns="_subtitle_bn7sv_5",$s="_header_bn7sv_12",Ss="_text_bn7sv_13",ws="_productsBlock_bn7sv_14",Cs="_buttonsBlock_bn7sv_15",Bs="_top_bn7sv_26",Ts="_itemsBlock_bn7sv_35",Ps="_typeTexts_bn7sv_41",Ms="_block_bn7sv_48",As="_active_bn7sv_60",Os="_products_bn7sv_14",qs="_product_bn7sv_14",Ls="_button_bn7sv_15",Ds="_image_bn7sv_90",Hs="_info_bn7sv_97",zs="_name_bn7sv_109",Fs="_buttons_bn7sv_15",Vs="_modal_bn7sv_120",Us="_other_bn7sv_139",Ys="_options_bn7sv_145",Gs="_closeIcon_bn7sv_153",st={title:ks,subtitle:Ns,header:$s,text:Ss,productsBlock:ws,buttonsBlock:Cs,top:Bs,itemsBlock:Ts,typeTexts:Ps,block:Ms,active:As,products:Os,product:qs,button:Ls,image:Ds,info:Hs,name:zs,buttons:Fs,modal:Vs,other:Us,options:Ys,closeIcon:Gs},Xs=g.forwardRef((l,i)=>{const{activeButton:e,setActiveButton:s,popupPosition:o}=l,[a,c]=g.useState(e.typesText),[d,n]=g.useState(e.destination),[r,h]=g.useState(e.page),[p,_]=g.useState(e.link||""),[m,f]=g.useState(e.text||""),[u,N]=g.useState(e.openInNewTab),{pages:L}=t.usePagesStore();return g.useEffect(()=>{s({...e,...{text:m,link:p,destination:d,typesText:a,page:r,openInNewTab:u}})},[a,d,p,m,r,u]),t.jsxRuntimeExports.jsxs("div",{className:st.modal,onClick:b=>{b.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},ref:i,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:e.type}),t.jsxRuntimeExports.jsx("div",{className:st.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})})]}),t.jsxRuntimeExports.jsxs("div",{className:st.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:b=>n(b),options:["Go to Page","Open Link"].filter(b=>b!==d),value:d}),d==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:b=>h(b),options:L?Object.values(L).filter(b=>b.name!==r).map(b=>b.name):[],value:r}):t.jsxRuntimeExports.jsx(t.Input,{onChange:b=>_(b),value:p,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:b=>N(b)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:b=>f(b),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:a,setTypesText:c})]})]})}),Ws="_subtitle_jql1y_1",Js="_header_jql1y_8",Qs="_text_jql1y_9",Ks="_productsBlock_jql1y_10",Zs="_buttonsBlock_jql1y_11",tn="_top_jql1y_23",en="_itemsBlock_jql1y_32",sn="_typeTexts_jql1y_38",nn="_block_jql1y_45",on="_active_jql1y_58",an="_products_jql1y_10",rn="_product_jql1y_10",cn="_button_jql1y_11",ln="_image_jql1y_88",dn="_info_jql1y_95",un="_name_jql1y_107",xn="_buttons_jql1y_11",mn="_modal_jql1y_118",pn="_other_jql1y_138",_n="_options_jql1y_144",hn="_addButton_jql1y_150",jn="_deleteButton_jql1y_165",Z={subtitle:Ws,header:Js,text:Qs,productsBlock:Ks,buttonsBlock:Zs,top:tn,itemsBlock:en,typeTexts:sn,block:nn,active:on,products:an,product:rn,button:cn,image:ln,info:dn,name:un,buttons:xn,modal:mn,other:pn,options:_n,addButton:hn,deleteButton:jn},vt=l=>{const{buttons:i,setButtons:e,deletable:s=!0,addable:o=!0}=l,[a,c]=g.useState(null),[d,n]=g.useState({top:0,left:0}),[r,h]=g.useState(null),p=g.useRef(null);g.useEffect(()=>{const m=()=>{c(null)};return document.body.addEventListener("click",m),c(null),()=>{c(null),document.body.removeEventListener("click",m)}},[]),g.useEffect(()=>{if(a){const m=[...i].map(f=>f.id===a.id?a:f);e(m)}},[a]),g.useEffect(()=>{if(p.current&&r){const m=p.current.getBoundingClientRect().height,f=window.innerHeight;let u=r.top;u+m>f+window.scrollY-200&&(u=f+window.scrollY-m-200),u<0&&(u=10),n({top:u,left:r.left})}},[p.current,r]);const _=(m,f)=>{m.stopPropagation();const u=m.target.getBoundingClientRect();h({top:u.top+window.scrollY,left:u.left-30}),c(f)};return t.jsxRuntimeExports.jsxs("div",{className:Z.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Z.subtitle,children:"Button Type"}),i.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Z.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const N=[...i].map(L=>L.id===m.id?{...m,type:f}:L);e(N)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Z.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{_(f,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=i.filter(u=>u.id!==m.id);e(f)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),a&&t.jsxRuntimeExports.jsx(Xs,{ref:p,activeButton:a,setActiveButton:c,popupPosition:d}),o&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:Z.button,size:"s",onClick:()=>{const m=[...i];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:Z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},gn=l=>{const{isActiveButtons:i,setIsActiveButtons:e,buttons:s,setButtons:o}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:st.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:a=>e(a)})]}),t.jsxRuntimeExports.jsx(vt,{buttons:s,setButtons:o})]})})},fn="_wrapper_m18qi_1",bn="_subtitle_m18qi_7",vn="_content_m18qi_14",En="_range_m18qi_22",Rn="_track_m18qi_27",yn="_progress_m18qi_36",In="_dots_m18qi_46",kn="_dot_m18qi_46",Nn="_active_m18qi_65",$n="_input_m18qi_77",Sn="_countBlock_m18qi_91",wn="_count_m18qi_91",Cn="_controls_m18qi_107",Bn="_button_m18qi_113",U={wrapper:fn,subtitle:bn,content:vn,range:En,track:Rn,progress:yn,dots:In,dot:kn,active:Nn,input:$n,countBlock:Sn,count:wn,controls:Cn,button:Bn},pt=l=>{const{label:i,min:e=1,max:s=4,step:o=1,count:a,setCount:c}=l,[d,n]=g.useState(!1),r=Array.from({length:(s-e)/o+1}),h=(a-e)/(s-e)*100,p=()=>{a<s&&c(a+o)},_=()=>{a>e&&c(a-o)},m=f=>{const u=e+f*o;c(u)};return t.jsxRuntimeExports.jsxs("div",{className:U.wrapper,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:i}),t.jsxRuntimeExports.jsxs("div",{className:U.content,children:[t.jsxRuntimeExports.jsxs("div",{className:U.range,children:[t.jsxRuntimeExports.jsx("div",{className:U.track}),t.jsxRuntimeExports.jsx("div",{className:U.progress,style:{width:`${h}%`}}),t.jsxRuntimeExports.jsx("div",{className:U.dots,children:r.map((f,u)=>{const N=u<=(a-e)/o;return t.jsxRuntimeExports.jsx("button",{onClick:()=>m(u),className:t.clx(U.dot,{[U.active]:N,[U.inactive]:!N,[U.dragging]:d}),"aria-label":`Set value to ${e+u*o}`},u)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:o,value:a,onChange:f=>c(Number(f.target.value)),onMouseDown:()=>n(!0),onMouseUp:()=>n(!1),onTouchStart:()=>n(!0),onTouchEnd:()=>n(!1),className:U.input})]}),t.jsxRuntimeExports.jsxs("div",{className:U.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:f=>{const u=Number(f);u>s?c(s):u<e?c(e):c(u)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:U.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:p,disabled:a>=s,className:U.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:_,disabled:a<=e,className:U.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},Tn="_title_ix5ax_1",Pn="_subtitle_ix5ax_5",Mn="_header_ix5ax_12",An="_text_ix5ax_13",On="_productsBlock_ix5ax_14",qn="_top_ix5ax_26",Ln="_itemsBlock_ix5ax_35",Dn="_typeTexts_ix5ax_41",Hn="_block_ix5ax_48",zn="_active_ix5ax_61",Fn="_products_ix5ax_14",Vn="_product_ix5ax_14",Un="_button_ix5ax_80",Yn="_image_ix5ax_91",Gn="_info_ix5ax_98",Xn="_name_ix5ax_110",Wn="_buttons_ix5ax_114",Jn="_modal_ix5ax_121",Qn="_link_ix5ax_141",Kn="_modalOptions_ix5ax_147",Zn="_addButton_ix5ax_160",to="_deleteButton_ix5ax_175",eo="_closeIcon_ix5ax_187",F={title:Tn,subtitle:Pn,header:Mn,text:An,productsBlock:On,top:qn,itemsBlock:Ln,typeTexts:Dn,block:Hn,active:zn,products:Fn,product:Vn,button:Un,image:Yn,info:Gn,name:Xn,buttons:Wn,modal:Jn,link:Qn,modalOptions:Kn,addButton:Zn,deleteButton:to,closeIcon:eo},so=l=>{const{activeItem:i,setActiveItem:e,popupPosition:s,setIsOpenModal:o,itemsOptions:a}=l,c=a.find(n=>n.id===i.listingId);if(!c)return null;function d(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{className:F.modal,onClick:n=>{n.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[t.jsxRuntimeExports.jsx("h3",{children:d(c.productData.name,20)}),t.jsxRuntimeExports.jsx("div",{className:F.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{o(!1),e(null)}})})]}),t.jsxRuntimeExports.jsx("div",{className:F.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:c.productData.images.length>0?c.productData.images[0].cfId:void 0,onChange:n=>{const r={...i,image:n[0]};e(r)}})})]})};function no(l){const{product:i,children:e}=l,{attributes:s,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:n}=t.useSortable({id:String(i.listingId)}),r={transform:t.CSS.Transform.toString(c),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:a,style:r,className:`${F.product} ${n?F.dragging:""}`,...s,...o,children:e})}const oo=l=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:d,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsOptions:f}=l,[u,N]=g.useState(null),[L,b]=g.useState({top:0,left:0}),[P,j]=g.useState(!1),y=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const E=()=>{N(null),j(!1)};return document.body.addEventListener("click",E),N(null),j(!1),()=>{N(null),j(!1),document.body.removeEventListener("click",E)}},[]),g.useEffect(()=>{if(u){const E=[...s].map(B=>B.listingId===u.listingId?u:B);o(E)}},[u]);const z=(E,B)=>{E.stopPropagation();const T=E.target.getBoundingClientRect(),G=100,w=window.innerHeight;let D=T.top+window.scrollY;D+G>w&&(D=w-G-20),j(!0),b({top:D-80,left:T.left-30}),N(B)};function M(E){if(h)return E?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${E}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Y=E=>{const{active:B,over:T}=E;if(T&&B.id!==T.id){const G=s.findIndex(D=>String(D.listingId)===B.id),w=s.findIndex(D=>String(D.listingId)===T.id);if(G!==-1&&w!==-1){const D=[...s],[Q]=D.splice(G,1);D.splice(w,0,Q),o(D)}}},O=(E,B)=>{const T=f.find(w=>E.listingId===w.id);if(!T)return null;const G=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const D=[...s],Q=f.find(C=>C.productData.name===w);if(!Q)return;const nt={listingId:Q.id,image:Q.productData.images.length>0?Q.productData.images[0].cfId:""},v=D.map(C=>C.listingId===E.listingId?nt:C);N(nt),o([...v])},value:T.productData.name,options:[...f.filter(w=>!s.find(D=>D.listingId===w.id)).map(w=>w.productData.name)],leftAddon:M(E.image||T.productData.images.length>0&&T.productData.images[0].cfId||"")},B),t.jsxRuntimeExports.jsxs("div",{className:F.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:w=>z(w,E)})}),p&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(w=>w!==E))})})]})]});return r?t.jsxRuntimeExports.jsx(no,{product:E,children:G},E.listingId):t.jsxRuntimeExports.jsx("div",{className:F.product,children:G},E.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:F.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:E=>e==null?void 0:e(E)})]}),P&&u&&t.jsxRuntimeExports.jsx(so,{activeItem:u,setActiveItem:N,setIsOpenModal:j,popupPosition:L,itemsOptions:f}),t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:d}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:y,onDragEnd:Y,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(E=>String(E.listingId)),strategy:t.verticalListSortingStrategy,children:s.map((E,B)=>O(E,B))})}):s.map((E,B)=>O(E,B)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:F.button,size:"s",onClick:()=>{const E=[...s];for(let B=0;B<f.length;B++)if(!s.find(T=>T.listingId===f[B].id)){E.push({listingId:f[B].id,image:f[B].productData.images.length>0?f[B].productData.images[0].cfId:""});break}o(E)},disabled:s.length===f.length,style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:F.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a})]})},io="_options_6cemk_1",ao="_price_6cemk_12",ro="_oldPrice_6cemk_19",co="_newPrice_6cemk_27",lo="_animate_6cemk_34",uo="_appearAndBounce_6cemk_1",xo="_meta_6cemk_52",mo="_info_6cemk_58",po="_infoRight_6cemk_66",_o="_buttons_6cemk_73",ho="_variants_6cemk_80",jo="_variant_6cemk_80",go="_stock_6cemk_98",fo="_variantInfo_6cemk_105",bo="_quantity_6cemk_111",vo="_count_6cemk_118",Eo="_focused_6cemk_135",Ro="_button_6cemk_73",yo="_activeVariant_6cemk_161",Io="_chargeTypes_6cemk_165",ko="_charge_6cemk_165",No="_chargeActive_6cemk_190",$o="_title_6cemk_198",k={options:io,price:ao,oldPrice:ro,newPrice:co,animate:lo,appearAndBounce:uo,meta:xo,info:mo,infoRight:po,buttons:_o,variants:ho,variant:jo,stock:go,variantInfo:fo,quantity:bo,count:vo,focused:Eo,button:Ro,activeVariant:yo,chargeTypes:Io,charge:ko,chargeActive:No,title:$o},So="_wrapper_p74l6_1",wo="_label_p74l6_9",Co="_input_p74l6_18",Bo="_paddingless_p74l6_31",To="_content_p74l6_35",Po="_contentBorder_p74l6_48",Mo="_borderless_p74l6_53",Ao="_rightIcon_p74l6_58",K={wrapper:So,label:wo,input:Co,paddingless:Bo,content:To,contentBorder:Po,borderless:Mo,rightIcon:Ao},Et=l=>{const{onChange:i,style:e,label:s,value:o,type:a,min:c,max:d,placeholder:n,disabled:r=!1,required:h=!1,regex:p,paddingless:_=!1,borderless:m=!1,editable:f=!1,isSearch:u=!1,centered:N=!1}=l,{themeSettings:L}=t.useThemeSettingsStore(),{inputs:b}=L,[P,j]=g.useState(!1);function y(M){return Number(M)<0?String(c):M}function z(M){return!h||!p?!0:new RegExp(p).test(M)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:K.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.content,{[K.contentBorder]:b.border.active}),style:{paddingRight:u?b.general.height+15:"auto",...e,background:b.field.active?b.field.color:"transparent"},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:a||"text",onChange:M=>{if(a==="text")i(M.target.value);else{const Y=y(M.target.value);i(Y)}},value:o,autoComplete:"off",placeholder:n||"Type something...",className:t.clx(K.input,{[K.required]:P&&h&&!z(o),[K.paddingless]:_,[K.borderless]:m}),min:a==="number"?c:void 0,max:a==="number"?d:void 0,disabled:r,onFocus:()=>j(!0),style:{textAlign:N?"center":"left"}}),u&&t.jsxRuntimeExports.jsx("div",{className:K.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:b.general.height,height:b.general.height})}),f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},Oo="_button_85085_1",qo="_primary_85085_20",Lo="_primaryHovered_85085_30",Do="_secondary_85085_34",Ho="_secondaryHovered_85085_44",zo="_tertiary_85085_48",Fo="_tertiaryHovered_85085_58",Vo="_content_85085_62",tt={button:Oo,primary:qo,primaryHovered:Lo,secondary:Do,secondaryHovered:Ho,tertiary:zo,tertiaryHovered:Fo,content:Vo},J=l=>{const{children:i,onClick:e,style:s,className:o,disabled:a=!1,type:c="Primary"}=l,{themeSettings:d}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(tt.button,o,{[tt.primary]:c==="Primary",[tt.secondary]:c==="Secondary",[tt.tertiary]:c==="Tertiary",[tt.primaryHovered]:c==="Primary"&&!a&&d.buttons.primary.hover,[tt.secondaryHovered]:c==="Secondary"&&!a&&d.buttons.secondary.hover,[tt.tertiaryHovered]:c==="Tertiary"&&!a&&d.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:a,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:tt.content,children:[i,t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:i})})};var Rt=(l=>(l.ONE_TIME="One-Time",l.RECURRING="Subscribe & Save",l))(Rt||{});const Uo=l=>{var b,P;const{variants:i}=l,[e,s]=g.useState(i[0]),[o,a]=g.useState(e.chargeTypes[0]),c=t.useNavigate(),[d,n]=g.useState(1),{reset:r,addProductToCart:h,getProducts:p}=t.useCart(),[_,m]=g.useState(!1);g.useEffect(()=>{m(!0);const j=setTimeout(()=>m(!1),600);return()=>clearTimeout(j)},[d]);async function f(){await p(),await h({productId:l.id,productVariantId:e.id,quantity:d})}function u(){r(),f(),c("/checkout")}function N(j){if(j>=864e5){const O=Math.floor(j/864e5);return`${O} ${O===1?"day":"days"}`}else if(j>=36e5){const O=Math.floor(j/36e5);return`${O} ${O===1?"hour":"hours"}`}else if(j>=6e4){const O=Math.floor(j/6e4);return`${O} ${O===1?"minute":"minutes"}`}else{const O=Math.floor(j/1e3);return`${O} ${O===1?"second":"seconds"}`}}function L(j,y){return j.length>y?j.slice(0,y)+"...":j}return t.jsxRuntimeExports.jsxs("div",{className:k.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:k.chargeTypes,children:e.chargeTypes.map(j=>t.jsxRuntimeExports.jsx("div",{className:t.clx(k.charge,{[k.chargeActive]:o===j}),onClick:()=>a(j),children:Rt[j]},j))}),t.jsxRuntimeExports.jsx("div",{className:k.variants,children:i.map(j=>{var y;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(k.variant,{[k.activeVariant]:e.id===j.id}),onClick:()=>s(j),children:[t.jsxRuntimeExports.jsxs("div",{className:k.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:k.title,children:L(j.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?j.price.amount:j.subscriptionSettings?j.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:k.stock,children:[((y=j.quantity.restrictions)==null?void 0:y.max)||j.quantity.available||0," in stock"]})})]},j.id)})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:k.quantity,children:[t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>{d>1?n(j=>j-1):n(1)},className:k.button,disabled:e.quantity.restrictions&&d<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(Et,{type:"number",value:String(d),onChange:j=>n(Number(j)),max:((b=e.quantity.restrictions)==null?void 0:b.max)||e.quantity.available||1/0,min:((P=e.quantity.restrictions)==null?void 0:P.min)||0,centered:!0}),t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>{n(j=>j+1)},className:k.button,disabled:!!(e.quantity.restrictions&&d>=e.quantity.restrictions.max||e.quantity.available&&d>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:k.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:k.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:k.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":N(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:k.infoRight,children:o==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:k.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:_}),children:["$ ",(e.price.amount||0)*d]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*d]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:_}),children:["$ ",(e.price.amount||0)*d]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:k.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.buttons,children:[t.jsxRuntimeExports.jsx(J,{type:"Primary",onClick:()=>u(),children:o==="ONE_TIME"?"Buy Now":"Subscribe Now"}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>f(),children:"Add to Cart"})]})]})},Yo="_button_1tdo3_1",Go="_login_1tdo3_14",Xo="_signUp_1tdo3_18",Wo="_buttons_1tdo3_23",Jo="_modal_1tdo3_32",Qo="_closing_1tdo3_64",Ko="_info_1tdo3_113",Zo="_top_1tdo3_120",ti="_title_1tdo3_131",ei="_clear_1tdo3_138",si="_activeClear_1tdo3_145",ni="_count_1tdo3_149",oi="_cart_1tdo3_164",ii="_empty_1tdo3_172",ai="_product_1tdo3_198",ri="_products_1tdo3_207",ci="_image_1tdo3_215",li="_productInfo_1tdo3_221",di="_content_1tdo3_228",ui="_name_1tdo3_234",xi="_price_1tdo3_240",mi="_productButtons_1tdo3_246",pi="_productButton_1tdo3_246",_i="_productCount_1tdo3_266",hi="_bottom_1tdo3_282",ji="_subtotal_1tdo3_290",gi="_block_1tdo3_298",fi="_shoppingCount_1tdo3_305",bi="_total_1tdo3_325",vi="_link_1tdo3_331",Ei="_userInfo_1tdo3_338",Ri="_pagesMobileModal_1tdo3_349",yi="_pagesMobileModalContent_1tdo3_363",Ii="_pagesMobileModalHeader_1tdo3_369",ki="_pagesMobileModalFooter_1tdo3_379",I={button:Yo,login:Go,signUp:Xo,buttons:Wo,modal:Jo,"slide-in-fade":"_slide-in-fade_1tdo3_1","mobile-slide-in-fade":"_mobile-slide-in-fade_1tdo3_1",closing:Qo,"mobile-slide-out-fade":"_mobile-slide-out-fade_1tdo3_1","slide-out-fade":"_slide-out-fade_1tdo3_1",info:Ko,top:Zo,title:ti,clear:ei,activeClear:si,count:ni,cart:oi,empty:ii,product:ai,products:ri,image:ci,productInfo:li,content:di,name:ui,price:xi,productButtons:mi,productButton:pi,productCount:_i,bottom:hi,subtotal:ji,block:gi,shoppingCount:fi,total:bi,link:vi,userInfo:Ei,pagesMobileModal:Ri,pagesMobileModalContent:yi,pagesMobileModalHeader:Ii,pagesMobileModalFooter:ki};class dt extends Error{}dt.prototype.name="InvalidTokenError";function Ni(l){return decodeURIComponent(atob(l).replace(/(.)/g,(i,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function $i(l){let i=l.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Ni(i)}catch{return atob(i)}}function Si(l,i){if(typeof l!="string")throw new dt("Invalid token specified: must be a string");i||(i={});const e=i.header===!0?0:1,s=l.split(".")[e];if(typeof s!="string")throw new dt(`Invalid token specified: missing part #${e+1}`);let o;try{o=$i(s)}catch(a){throw new dt(`Invalid token specified: invalid base64 for part #${e+1} (${a.message})`)}try{return JSON.parse(o)}catch(a){throw new dt(`Invalid token specified: invalid json for part #${e+1} (${a.message})`)}}const wi=l=>{const{shopping:i,signUp:e,isShowUserInfo:s=!0}=l;return t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[i&&t.jsxRuntimeExports.jsx(yt,{}),s&&t.jsxRuntimeExports.jsx(ft,{signUp:e})]})},yt=()=>{const[l,i]=g.useState(!1),[e,s]=g.useState([]),{cart:o,getProducts:a}=t.useCart();function c(_){for(let m=0;m<o.parts.length;m++)for(let f=0;f<_.variants.length;f++)if(o.parts[m].productVariantId===_.variants[m].id)return o.parts[m].productVariantId}function d(_){for(let m=0;m<o.parts.length;m++)for(let f=0;f<_.variants.length;f++)if(o.parts[m].productVariantId===_.variants[m].id)return o.parts[m].quantity}g.useEffect(()=>{(async()=>{const m=o.parts.map(N=>String(N.productId)),u=(await a([...m])).map(N=>({...N,activeVariantId:c(N),quantity:d(N)}));s(u)})()},[o.parts.length]);function n(_){var m;return!_||!(_!=null&&_.variants)?!1:(m=_.variants.find(f=>f.id===_.activeVariantId))==null?void 0:m.subscriptionSettings}const r=o.parts.length>0&&e.length>0&&!n(e[0]),[h,p]=g.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(J,{type:"Secondary",style:{padding:10},onClick:_=>{_.stopPropagation(),window.location.pathname!=="/admin/builder"&&(i(!0),p(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),r&&t.jsxRuntimeExports.jsx("div",{className:I.shoppingCount,children:o.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{p(!1),setTimeout(()=>{i(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(It,{activeProducts:e,isCartNotEmpty:r,isOpen:h})})]})},It=l=>{const{activeProducts:i,isCartNotEmpty:e,isOpen:s}=l,{cart:o,reset:a,getTotalAndDiscount:c,updateQuantityOfProduct:d}=t.useCart(),n=t.useNavigate();function r(_){n(_)}function h(_){d({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity+1})}function p(_){d({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.modal,{[I.closing]:!s}),onClick:_=>_.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:I.top,children:[t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{className:I.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:I.count,children:o.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(I.clear,{[I.activeClear]:e}),disabled:!e,onClick:a,children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:I.cart,children:[t.jsxRuntimeExports.jsx("div",{className:I.products,children:i.map(_=>t.jsxRuntimeExports.jsxs("div",{className:I.product,children:[t.jsxRuntimeExports.jsxs("div",{className:I.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${_.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:I.image}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsx("div",{className:I.name,children:_.name}),t.jsxRuntimeExports.jsxs("div",{className:I.price,children:["$",_.variants.find(m=>m.id===_.activeVariantId).price.amount*((_==null?void 0:_.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{_.quantity!==1&&p(_)},className:I.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:I.productCount,children:_.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>h(_),className:I.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},_.id))}),t.jsxRuntimeExports.jsxs("div",{className:I.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:I.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:I.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:I.total,children:["$",c().total]})]}),t.jsxRuntimeExports.jsx(J,{onClick:()=>r("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(kt,{})]})},kt=()=>t.jsxRuntimeExports.jsxs("div",{className:I.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-secondary)"})}),t.jsxRuntimeExports.jsx("span",{children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:I.link,children:"view products"})]})]}),ft=({signUp:l})=>{const i=JSON.parse(localStorage.getItem("token")||"{}"),{data:e}=i;if(!e)return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(J,{onClick:()=>c("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),l&&t.jsxRuntimeExports.jsx(J,{onClick:()=>c("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"})]});const[s,o]=g.useState("test-email@gmail.com"),a=t.useNavigate();g.useEffect(()=>{(async()=>{const n=Si(e);o(n.email)})()},[e]);function c(d){a(d)}return t.jsxRuntimeExports.jsx("div",{className:I.userInfo,onClick:()=>c("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:s||"test-email@gmail.com"})})},Nt=({children:l,logo:i,setIsOpen:e,signUp:s})=>{const{setIsOpen:o}=t.useModalStore(),a=()=>{o(!1),setTimeout(()=>{e(!1),o(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModal,onClick:c=>c.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:i}),t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:a,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"var(--icon-primary)"})})]}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalContent,children:l}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(ft,{signUp:s})})]})},Ci=({children:l,logo:i,signUp:e})=>{const[s,o]=g.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx($t,{setIsOpenModal:o}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>o(!1),children:t.jsxRuntimeExports.jsx(Nt,{logo:i,setIsOpen:o,signUp:e,children:l})})]})},$t=l=>{const{setIsOpenModal:i}=l;return t.jsxRuntimeExports.jsx(J,{type:"Secondary",style:{padding:10},onClick:e=>{e.stopPropagation(),i(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List",fill:"var(--icon-primary)"})})},Bi="_share_xddz7_1",Ti="_modal_xddz7_8",Pi="_header_xddz7_20",Mi="_socials_xddz7_30",Ai="_social_xddz7_30",Oi="_copy_xddz7_40",qi="_title_xddz7_47",Li="_copyWrapper_xddz7_53",Di="_copyText_xddz7_62",Hi="_copyTextMobile_xddz7_75",zi="_copyTextMiniMobile_xddz7_94",et={share:Bi,modal:Ti,header:Pi,socials:Mi,social:Ai,copy:Oi,title:qi,copyWrapper:Li,copyText:Di,copyTextMobile:Hi,copyTextMiniMobile:zi},Fi=()=>{const{isOpenModal:l,setIsOpenModal:i}=t.useShareLinkStore();function e(){i(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:et.share,onClick:s=>{s.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:i,children:t.jsxRuntimeExports.jsx(Vi,{})})]})},Vi=()=>{const{setIsOpenModal:l}=t.useShareLinkStore(),{notification:i,setNotification:e}=t.useNotificationStore(),{setIsOpen:s}=t.useModalStore(),o=window.location.href;function a(){navigator.clipboard.writeText(o),e({message:"Link copied to clipboard",status:"success"})}function c(){s(!1),setTimeout(()=>{l(!1),s(!0)},300)}function d(n,r){return n.length>r?n.slice(0,r)+"...":n}return t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:n=>n.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:et.header,children:[t.jsxRuntimeExports.jsx("div",{className:et.title,children:"Copy Product Link"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:c,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:et.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button,{type:"Secondary",onClick:a,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:et.copyText,children:d(o,100)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMobile,children:d(o,40)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMiniMobile,children:d(o,20)})]}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:a,children:i?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},Ui="_accordion_1s1lq_1",Yi="_header_1s1lq_9",Gi="_icon_1s1lq_18",Xi="_open_1s1lq_21",Wi="_content_1s1lq_25",lt={accordion:Ui,header:Yi,icon:Gi,open:Xi,content:Wi},Ji=({title:l,content:i})=>{const[e,s]=g.useState(!1),[o,a]=g.useState(0),c=g.useRef(null),d=()=>{s(!e)};return g.useEffect(()=>{c.current&&a(e?c.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:lt.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:lt.header,onClick:d,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(lt.icon,{[lt.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:c,className:lt.content,style:{height:`${o}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:i})})]})},Qi="_wrapper_st58d_1",Ki="_label_st58d_10",Zi="_textarea_st58d_18",ta="_length_st58d_33",xt={wrapper:Qi,label:Ki,textarea:Zi,length:ta},ea=l=>{const{onChange:i,label:e,value:s,maxLength:o,placeholder:a="Type something..."}=l,[c,d]=g.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:xt.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:xt.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:n=>{d(n.target.value.length),i(n.target.value)},placeholder:a,className:xt.textarea,maxLength:o}),o&&t.jsxRuntimeExports.jsxs("div",{className:xt.length,children:[c,"/",o]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=Ji;exports.BurgerMenuButton=$t;exports.Button=J;exports.ButtonTypeSettings=vt;exports.ButtonsSettings=gn;exports.CategorySettings=Ke;exports.EmptyCart=kt;exports.FormSettings=Is;exports.HeaderButtons=wi;exports.InputUI=Et;exports.ItemsSettings=bt;exports.LayoutSettings=Ft;exports.ListingSelector=oo;exports.PagesMobileMenu=Ci;exports.PagesMobileModal=Nt;exports.ProductOptions=Uo;exports.RangeSelector=pt;exports.ShareLink=Fi;exports.ShoppingButton=yt;exports.ShoppingModalCart=It;exports.TextSettings=gt;exports.TextareaUI=ea;exports.TypesText=jt;exports.UserInfo=ft;